Oops, interface implementations on Program don't carry over into the compiled game script. IConsoleProgram will have to just stand as a compile-time checking convenience.

This commit is contained in:
Anna Rose 2025-02-14 16:20:50 -05:00
parent 372e9e22d2
commit 54f04a7cf0
3 changed files with 7 additions and 11 deletions
AirMonitor
Airlock
Mixins/Console

View File

@ -38,7 +38,7 @@ namespace IngameScript
public List<IMyAirVent> Vents { get; } = new List<IMyAirVent>(); public List<IMyAirVent> Vents { get; } = new List<IMyAirVent>();
private IConsoleProgram _program; private Program _program;
// private List<IMyTextSurface> _displays = new List<IMyTextSurface>(); // TODO: add single-zone displays // private List<IMyTextSurface> _displays = new List<IMyTextSurface>(); // TODO: add single-zone displays
private List<IMyLightingBlock> _lights = new List<IMyLightingBlock>(); private List<IMyLightingBlock> _lights = new List<IMyLightingBlock>();
@ -48,7 +48,7 @@ namespace IngameScript
private const float TriggerLevel = 0.75F; private const float TriggerLevel = 0.75F;
public AirZone(IConsoleProgram program, string zoneName) public AirZone(Program program, string zoneName)
{ {
Name = zoneName; Name = zoneName;
_program = program; _program = program;

View File

@ -86,7 +86,7 @@ namespace IngameScript
private const int CooldownTicks = 12; private const int CooldownTicks = 12;
private const int SealTimeoutTicks = 30; private const int SealTimeoutTicks = 30;
public Airlock(string name, IConsoleProgram _program) public Airlock(string name, Program _program)
{ {
_ini = _program.Ini; _ini = _program.Ini;
_name = name; _name = name;
@ -121,7 +121,8 @@ namespace IngameScript
// Precondition: _ini.TryParse() should be called on the block before calling this function. // Precondition: _ini.TryParse() should be called on the block before calling this function.
private void addVent(IMyAirVent vent) private void addVent(IMyAirVent vent)
{ {
if (_airVent == null) { if (_airVent == null)
{
_airVent = vent; _airVent = vent;
return; return;
} }

View File

@ -23,11 +23,6 @@ namespace IngameScript
// Properties that should be defined by the implementer. // Properties that should be defined by the implementer.
MyIni Ini { get; } MyIni Ini { get; }
Program.IConsole Console { get; } Program.IConsole Console { get; }
// Inherited properties that we need access to
IMyGridProgramRuntimeInfo Runtime { get; }
IMyProgrammableBlock Me { get; }
Action<string> Echo { get; }
} }
partial class Program partial class Program
@ -46,13 +41,13 @@ namespace IngameScript
private List<string> _buffer = new List<string>(); private List<string> _buffer = new List<string>();
private StringBuilder _builder = new StringBuilder(); private StringBuilder _builder = new StringBuilder();
private int _tickCount = 0; private int _tickCount = 0;
private IConsoleProgram _program; private Program _program;
private string _programName; private string _programName;
private int _maxLines = 10; private int _maxLines = 10;
private const int DefaultMaxLines = 10; private const int DefaultMaxLines = 10;
public MainConsole(IConsoleProgram program, string programName) public MainConsole(Program program, string programName)
{ {
_program = program; _program = program;
_programName = programName; _programName = programName;