Use console.

This commit is contained in:
Anna Rose 2025-02-08 21:26:21 -05:00
parent cb759ccdc2
commit ef40362062
3 changed files with 8 additions and 8 deletions

View File

@ -5,7 +5,7 @@ namespace IngameScript
{
public class Door
{
private MyGridProgram _p;
private PrefixedConsole _console;
private List<DoorHinge> _hinges;
public bool Locked
@ -20,16 +20,16 @@ namespace IngameScript
}
}
public Door(MyGridProgram p)
public Door(Console console, string name)
{
_p = p;
_console = new PrefixedConsole(console, name);
_hinges = new List<DoorHinge>();
}
// Add a hinge to the door
public void AddHinge(IMyMotorStator hinge)
{
_hinges.Add(new DoorHinge(_p, hinge));
_hinges.Add(new DoorHinge(_console, hinge));
}
public void OpenDoor()

View File

@ -8,7 +8,7 @@ namespace IngameScript
{
public bool Locked { get { return _hinge.RotorLock; } }
private MyGridProgram _p;
private PrefixedConsole _console;
private IMyMotorStator _hinge;
private float _targetAngle;
private float _lastAngle;
@ -16,10 +16,10 @@ namespace IngameScript
private float _closedAngle = 0F;
private float _velocity = 5F;
public DoorHinge(MyGridProgram p, IMyMotorStator hinge)
public DoorHinge(PrefixedConsole console, IMyMotorStator hinge)
{
_p = p;
_hinge = hinge;
_console = console;
ConfigParser config = new ConfigParser(_hinge);
_openAngle = config.GetValue("OpenAngle", 90F);

View File

@ -30,7 +30,7 @@ namespace IngameScript
string doorName = hinge.CustomName.Split(' ')[0];
if (!_doors.ContainsKey(doorName))
{
_doors[doorName] = new Door(this);
_doors[doorName] = new Door(_console, doorName);
}
_doors[doorName].AddHinge(hinge);
}