More refactoring.

This commit is contained in:
Anna Rose 2025-02-11 13:18:34 -05:00
parent 2311019f4e
commit be989a233d
5 changed files with 12 additions and 14 deletions

View File

@ -28,7 +28,7 @@ namespace IngameScript
Name = zoneName; Name = zoneName;
_program = program; _program = program;
_console = new PrefixedConsole(program.Console, zoneName); _console = new PrefixedConsole(program.Console, zoneName);
_sequencer = new Sequencer(zoneName, _console); _sequencer = new Sequencer(program, zoneName);
} }
public void AddBlock(IMyTerminalBlock block) public void AddBlock(IMyTerminalBlock block)

View File

@ -27,7 +27,7 @@ namespace IngameScript
// Create the door if this is a new id // Create the door if this is a new id
if (!_doors.ContainsKey(doorName)) if (!_doors.ContainsKey(doorName))
{ {
_doors[doorName] = new Sequencer(doorName, new PrefixedConsole(Console, doorName)); _doors[doorName] = new Sequencer(this, doorName);
} }
// Add the part; the Door object handles typing and sequencing. // Add the part; the Door object handles typing and sequencing.

View File

@ -33,12 +33,12 @@ namespace IngameScript
// Either use a reference to that instance directly where needed or use it to create PrefixedConsoles. // Either use a reference to that instance directly where needed or use it to create PrefixedConsoles.
public class MainConsole : IConsole public class MainConsole : IConsole
{ {
private Program _program; private List<string> _buffer = new List<string>();
private int _maxLines; private StringBuilder _builder = new StringBuilder();
private List<string> _buffer;
private StringBuilder _builder;
private string _programName;
private int _tickCount = 0; private int _tickCount = 0;
private Program _program;
private string _programName;
private int _maxLines;
private const int DefaultMaxLines = 10; private const int DefaultMaxLines = 10;
@ -46,8 +46,6 @@ namespace IngameScript
{ {
_program = program; _program = program;
_programName = programName; _programName = programName;
_buffer = new List<string>();
_builder = new StringBuilder();
// Check the PB's custom data for a maxlines directive. // Check the PB's custom data for a maxlines directive.
_program.Ini.TryParse(program.Me.CustomData); _program.Ini.TryParse(program.Me.CustomData);

View File

@ -11,11 +11,12 @@ namespace IngameScript
public bool Running { get; } public bool Running { get; }
public int Step { get; set; } public int Step { get; set; }
private IMyDoor _door;
public bool DeployOpen { get; set; } public bool DeployOpen { get; set; }
public bool LockOpen { get; set; } public bool LockOpen { get; set; }
public bool LockClosed { get; set; } public bool LockClosed { get; set; }
private IMyDoor _door;
public SequenceableDoor( public SequenceableDoor(
IMyDoor door, IMyDoor door,
MyIni ini, MyIni ini,

View File

@ -16,13 +16,12 @@ namespace IngameScript
private IConsole _console; private IConsole _console;
private string _name; private string _name;
private SortedDictionary<int, List<ISequenceable>> _sequence; private SortedDictionary<int, List<ISequenceable>> _sequence = new SortedDictionary<int, List<ISequenceable>>();
public Sequencer(string name, IConsole console) public Sequencer(IConsoleProgram program, string name)
{ {
_name = name; _name = name;
_console = console; _console = new PrefixedConsole(program.Console, _name);
_sequence = new SortedDictionary<int, List<ISequenceable>>();
} }
public void AddBlock(ISequenceable block) public void AddBlock(ISequenceable block)