Add an info display option for loading docks.
This commit is contained in:
parent
3727cf8f20
commit
64a1a414a1
|
@ -1,6 +1,6 @@
|
|||
using Sandbox.ModAPI.Ingame;
|
||||
using SpaceEngineers.Game.ModAPI.Ingame;
|
||||
using System.Collections.Generic;
|
||||
using VRage.Game.GUI.TextPanel;
|
||||
using VRage.Game.ModAPI.Ingame.Utilities;
|
||||
|
||||
namespace IngameScript
|
||||
|
@ -30,6 +30,7 @@ namespace IngameScript
|
|||
}
|
||||
}
|
||||
|
||||
private IMyTextSurface _display;
|
||||
private IMyConveyorSorter _inputSorter;
|
||||
private IMyConveyorSorter _outputSorter;
|
||||
private List<IMyShipConnector> _ports = new List<IMyShipConnector>();
|
||||
|
@ -62,9 +63,26 @@ namespace IngameScript
|
|||
_wasDocked = isDocked;
|
||||
}
|
||||
|
||||
public void UpdateDisplay()
|
||||
{
|
||||
if (_display == null) return;
|
||||
switch (Mode)
|
||||
{
|
||||
case DockMode.Loading:
|
||||
_display.WriteText("Ready to load cargo");
|
||||
break;
|
||||
case DockMode.Unloading:
|
||||
_display.WriteText("Unloading Cargo");
|
||||
break;
|
||||
case DockMode.Off:
|
||||
_display.WriteText("Standby Mode");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void StartLoading()
|
||||
{
|
||||
_console.Print("Loading mode.");
|
||||
Mode = DockMode.Loading;
|
||||
_outputSorter.Enabled = false;
|
||||
_inputSorter.Enabled = true;
|
||||
|
@ -72,6 +90,7 @@ namespace IngameScript
|
|||
|
||||
public void StartUnloading()
|
||||
{
|
||||
_console.Print("Unloading mode.");
|
||||
Mode = DockMode.Unloading;
|
||||
_inputSorter.Enabled = false;
|
||||
_outputSorter.Enabled = true;
|
||||
|
@ -79,6 +98,7 @@ namespace IngameScript
|
|||
|
||||
public void Reset()
|
||||
{
|
||||
_console.Print("Disabling conveyors.");
|
||||
Mode = DockMode.Off;
|
||||
_inputSorter.Enabled = false;
|
||||
_outputSorter.Enabled = false;
|
||||
|
@ -108,6 +128,13 @@ namespace IngameScript
|
|||
{
|
||||
_ports.Add(block as IMyShipConnector);
|
||||
}
|
||||
else if (block is IMyTextSurfaceProvider)
|
||||
{
|
||||
// for now we'll just assume the first display, since that meets our most popular use case
|
||||
_display = ((IMyTextSurfaceProvider)block).GetSurface(0);
|
||||
_display.ContentType = ContentType.TEXT_AND_IMAGE;
|
||||
_display.WriteText("Standby Mode");
|
||||
}
|
||||
else
|
||||
{
|
||||
_console.Print($"Can't add block '{block.CustomName}'");
|
||||
|
|
|
@ -32,6 +32,7 @@ namespace IngameScript
|
|||
_timeoutTicks--;
|
||||
if (_timeoutTicks == 0 || loadingCount == 0)
|
||||
{
|
||||
_console.Print("Disabling loading mode and restoring default behavior.");
|
||||
_timeoutTicks = 0;
|
||||
_outputSorter.Enabled = false;
|
||||
_inputSorter.Enabled = true;
|
||||
|
@ -42,6 +43,7 @@ namespace IngameScript
|
|||
// A dock has requested loading
|
||||
public void StartLoading()
|
||||
{
|
||||
_console.Print("A dock has requested loading mode.");
|
||||
_inputSorter.Enabled = false;
|
||||
_outputSorter.Enabled = true;
|
||||
_timeoutTicks = 75; // This is approximately 2 minutes.
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace IngameScript
|
|||
{
|
||||
switch (key.Name)
|
||||
{
|
||||
case "ingotReport":
|
||||
case "resourceReport":
|
||||
if (_oreReport != null) break;
|
||||
int index = Ini.Get(key).ToInt32();
|
||||
// extract text surface
|
||||
|
|
Loading…
Reference in New Issue
Block a user