Refactor to do non-dependent initializations before construction.
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
using Sandbox.ModAPI.Ingame;
|
||||
using SpaceEngineers.Game.ModAPI.Ingame;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using VRageMath;
|
||||
|
||||
@ -9,16 +10,16 @@ namespace IngameScript
|
||||
{
|
||||
public class AirZone
|
||||
{
|
||||
public bool Triggered { get; private set; } = false;
|
||||
public string Name { get; private set; }
|
||||
public List<IMyAirVent> Vents { get; private set; }
|
||||
public bool Triggered { get; private set; } = false;
|
||||
public List<IMyAirVent> Vents { get; } = new List<IMyAirVent>();
|
||||
|
||||
private IConsoleProgram _program;
|
||||
private List<IMyDoor> _doors;
|
||||
private List<IMyTextSurface> _displays;
|
||||
private List<IMyDoor> _doors = new List<IMyDoor>();
|
||||
private List<IMyTextSurface> _displays = new List<IMyTextSurface>();
|
||||
private List<IMyLightingBlock> _lights = new List<IMyLightingBlock>();
|
||||
private PrefixedConsole _console;
|
||||
private Sequencer _sequencer;
|
||||
private List<IMyLightingBlock> _lights;
|
||||
|
||||
private const float TriggerLevel = 0.75F;
|
||||
|
||||
@ -28,10 +29,6 @@ namespace IngameScript
|
||||
_program = program;
|
||||
_console = new PrefixedConsole(program.Console, zoneName);
|
||||
_sequencer = new Sequencer(zoneName, _console);
|
||||
Vents = new List<IMyAirVent>();
|
||||
_doors = new List<IMyDoor>();
|
||||
_displays = new List<IMyTextSurface>();
|
||||
_lights = new List<IMyLightingBlock>();
|
||||
}
|
||||
|
||||
public void AddBlock(IMyTerminalBlock block)
|
||||
|
@ -10,28 +10,20 @@ namespace IngameScript
|
||||
{
|
||||
public partial class Program : MyGridProgram, IConsoleProgram
|
||||
{
|
||||
public MyIni Ini { get; private set; }
|
||||
public MyIni Ini { get; } = new MyIni();
|
||||
public IConsole Console { get; private set; }
|
||||
|
||||
private MyCommandLine _cli;
|
||||
private Dictionary<string, AirZone> _zones;
|
||||
private List<IEnumerator<bool>> _jobs;
|
||||
private List<IMyTextSurface> _displays;
|
||||
private StringBuilder _displayBuffer;
|
||||
private List<IMyGasTank> _oxygenTanks;
|
||||
private MyCommandLine _cli = new MyCommandLine();
|
||||
private Dictionary<string, AirZone> _zones = new Dictionary<string, AirZone>();
|
||||
private List<IEnumerator<bool>> _jobs = new List<IEnumerator<bool>>();
|
||||
private List<IMyTextSurface> _displays = new List<IMyTextSurface>();
|
||||
private StringBuilder _displayBuffer = new StringBuilder();
|
||||
private List<IMyGasTank> _oxygenTanks = new List<IMyGasTank>();
|
||||
|
||||
public Program()
|
||||
{
|
||||
Ini = new MyIni();
|
||||
Console = new MainConsole(this, "Air Pressure Monitor");
|
||||
|
||||
_cli = new MyCommandLine();
|
||||
_zones = new Dictionary<string, AirZone>();
|
||||
_jobs = new List<IEnumerator<bool>>();
|
||||
_displays = new List<IMyTextSurface>();
|
||||
_displayBuffer = new StringBuilder();
|
||||
_oxygenTanks = new List<IMyGasTank>();
|
||||
|
||||
// Find all tagged objects and build out zones
|
||||
List<IMyTerminalBlock> blocks = new List<IMyTerminalBlock>();
|
||||
GridTerminalSystem.GetBlocksOfType(blocks, block => MyIni.HasSection(block.CustomData, "airMonitor"));
|
||||
|
Reference in New Issue
Block a user