Fixes and add some default output.
This commit is contained in:
parent
1f33b7fbb4
commit
136938a3e3
|
@ -3,9 +3,11 @@ using SpaceEngineers.Game.ModAPI.Ingame;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using VRage.Game.ModAPI.Ingame.Utilities;
|
using VRage.Game.ModAPI.Ingame.Utilities;
|
||||||
|
|
||||||
namespace IngameScript {
|
namespace IngameScript
|
||||||
partial class Program {
|
{
|
||||||
public class AirZone
|
partial class Program
|
||||||
|
{
|
||||||
|
public class AirZone
|
||||||
{
|
{
|
||||||
public bool Triggered = false;
|
public bool Triggered = false;
|
||||||
|
|
||||||
|
@ -28,14 +30,18 @@ namespace IngameScript {
|
||||||
if (block is IMyAirVent)
|
if (block is IMyAirVent)
|
||||||
{
|
{
|
||||||
_vents.Add(block as IMyAirVent);
|
_vents.Add(block as IMyAirVent);
|
||||||
} else if (block is IMyDoor) {
|
}
|
||||||
SequenceableDoor wrapped = SequenceableFactory.MakeSequenceable(block as IMyDoor, _ini, "") as SequenceableDoor;
|
else if (block is IMyDoor)
|
||||||
|
{
|
||||||
|
SequenceableDoor wrapped = SequenceableFactory.MakeSequenceable(block as IMyDoor, _ini, "airMonitor") as SequenceableDoor;
|
||||||
wrapped.Step = 0;
|
wrapped.Step = 0;
|
||||||
wrapped.DeployOpen = false;
|
wrapped.DeployOpen = false;
|
||||||
wrapped.LockOpen = false;
|
wrapped.LockOpen = false;
|
||||||
wrapped.LockClosed = true;
|
wrapped.LockClosed = true;
|
||||||
_sequencer.AddBlock(wrapped);
|
_sequencer.AddBlock(wrapped);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
_console.Print("Tried to add incompatible block '{block.CustomName}'");
|
_console.Print("Tried to add incompatible block '{block.CustomName}'");
|
||||||
}
|
}
|
||||||
// TODO: support for arbitrary (sub-)sequences here could be powerful
|
// TODO: support for arbitrary (sub-)sequences here could be powerful
|
||||||
|
|
|
@ -27,6 +27,7 @@ namespace IngameScript
|
||||||
private MyCommandLine _cli;
|
private MyCommandLine _cli;
|
||||||
private Dictionary<string, AirZone> _zones;
|
private Dictionary<string, AirZone> _zones;
|
||||||
private List<IEnumerator<bool>> _jobs;
|
private List<IEnumerator<bool>> _jobs;
|
||||||
|
private int _totalTicks = 0;
|
||||||
|
|
||||||
public Program()
|
public Program()
|
||||||
{
|
{
|
||||||
|
@ -62,6 +63,7 @@ namespace IngameScript
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_console.Print($"Found {_zones.Count} zones.");
|
||||||
foreach (AirZone zone in _zones.Values)
|
foreach (AirZone zone in _zones.Values)
|
||||||
{
|
{
|
||||||
_jobs.Add(zone.Monitor());
|
_jobs.Add(zone.Monitor());
|
||||||
|
@ -71,6 +73,7 @@ namespace IngameScript
|
||||||
|
|
||||||
public void Main(string argument, UpdateType updateSource)
|
public void Main(string argument, UpdateType updateSource)
|
||||||
{
|
{
|
||||||
|
_console.PrintLower($"Air Monitor\nTotal Ticks: {++_totalTicks}");
|
||||||
if (argument != "")
|
if (argument != "")
|
||||||
{
|
{
|
||||||
_cli.TryParse(argument);
|
_cli.TryParse(argument);
|
||||||
|
@ -78,9 +81,11 @@ namespace IngameScript
|
||||||
{
|
{
|
||||||
for (int i = 0; i < _cli.ArgumentCount; i++)
|
for (int i = 0; i < _cli.ArgumentCount; i++)
|
||||||
{
|
{
|
||||||
if (_zones.ContainsKey(_cli.Argument(i)))
|
string zone = _cli.Argument(i);
|
||||||
|
_console.Print($"Resetting {zone}.");
|
||||||
|
if (_zones.ContainsKey(zone))
|
||||||
{
|
{
|
||||||
_zones[_cli.Argument(i)].Triggered = false;
|
_zones[zone].Triggered = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user