From 372e9e22d22e09d5c937979d26e8b93f2bd419ca Mon Sep 17 00:00:00 2001 From: annabunches Date: Fri, 14 Feb 2025 15:57:46 -0500 Subject: [PATCH] Cleanup old sequencer references. --- ActionSequencer/ActionSequencer.csproj | 2 +- AirMonitor/AirMonitor.csproj | 2 +- Airlock/Airlock.csproj | 1 - .../ActionGroup.cs | 0 .../ActionGroups.projitems} | 0 .../ActionGroups.shproj} | 0 .../ActionSequence.cs | 0 .../BlockActionDoor.cs | 0 .../BlockActionPiston.cs | 0 .../BlockActionRotor.cs | 0 .../BlockActionTemplate.cs | 0 .../IBlockAction.cs | 0 Mixins/Sequencer/ISequenceableAction.cs | 9 -- Mixins/Sequencer/SequenceableBlock.cs | 132 ------------------ SpaceEngineers.sln | 2 +- 15 files changed, 3 insertions(+), 145 deletions(-) rename Mixins/{Sequencer => ActionGroups}/ActionGroup.cs (100%) rename Mixins/{Sequencer/Sequencer.projitems => ActionGroups/ActionGroups.projitems} (100%) rename Mixins/{Sequencer/Sequencer.shproj => ActionGroups/ActionGroups.shproj} (100%) rename Mixins/{Sequencer => ActionGroups}/ActionSequence.cs (100%) rename Mixins/{Sequencer => ActionGroups}/BlockActionDoor.cs (100%) rename Mixins/{Sequencer => ActionGroups}/BlockActionPiston.cs (100%) rename Mixins/{Sequencer => ActionGroups}/BlockActionRotor.cs (100%) rename Mixins/{Sequencer => ActionGroups}/BlockActionTemplate.cs (100%) rename Mixins/{Sequencer => ActionGroups}/IBlockAction.cs (100%) delete mode 100644 Mixins/Sequencer/ISequenceableAction.cs delete mode 100644 Mixins/Sequencer/SequenceableBlock.cs diff --git a/ActionSequencer/ActionSequencer.csproj b/ActionSequencer/ActionSequencer.csproj index 0f4379c..4126f8c 100644 --- a/ActionSequencer/ActionSequencer.csproj +++ b/ActionSequencer/ActionSequencer.csproj @@ -24,5 +24,5 @@ - + \ No newline at end of file diff --git a/AirMonitor/AirMonitor.csproj b/AirMonitor/AirMonitor.csproj index 0f4379c..4126f8c 100644 --- a/AirMonitor/AirMonitor.csproj +++ b/AirMonitor/AirMonitor.csproj @@ -24,5 +24,5 @@ - + \ No newline at end of file diff --git a/Airlock/Airlock.csproj b/Airlock/Airlock.csproj index 899617a..7705310 100644 --- a/Airlock/Airlock.csproj +++ b/Airlock/Airlock.csproj @@ -24,5 +24,4 @@ - \ No newline at end of file diff --git a/Mixins/Sequencer/ActionGroup.cs b/Mixins/ActionGroups/ActionGroup.cs similarity index 100% rename from Mixins/Sequencer/ActionGroup.cs rename to Mixins/ActionGroups/ActionGroup.cs diff --git a/Mixins/Sequencer/Sequencer.projitems b/Mixins/ActionGroups/ActionGroups.projitems similarity index 100% rename from Mixins/Sequencer/Sequencer.projitems rename to Mixins/ActionGroups/ActionGroups.projitems diff --git a/Mixins/Sequencer/Sequencer.shproj b/Mixins/ActionGroups/ActionGroups.shproj similarity index 100% rename from Mixins/Sequencer/Sequencer.shproj rename to Mixins/ActionGroups/ActionGroups.shproj diff --git a/Mixins/Sequencer/ActionSequence.cs b/Mixins/ActionGroups/ActionSequence.cs similarity index 100% rename from Mixins/Sequencer/ActionSequence.cs rename to Mixins/ActionGroups/ActionSequence.cs diff --git a/Mixins/Sequencer/BlockActionDoor.cs b/Mixins/ActionGroups/BlockActionDoor.cs similarity index 100% rename from Mixins/Sequencer/BlockActionDoor.cs rename to Mixins/ActionGroups/BlockActionDoor.cs diff --git a/Mixins/Sequencer/BlockActionPiston.cs b/Mixins/ActionGroups/BlockActionPiston.cs similarity index 100% rename from Mixins/Sequencer/BlockActionPiston.cs rename to Mixins/ActionGroups/BlockActionPiston.cs diff --git a/Mixins/Sequencer/BlockActionRotor.cs b/Mixins/ActionGroups/BlockActionRotor.cs similarity index 100% rename from Mixins/Sequencer/BlockActionRotor.cs rename to Mixins/ActionGroups/BlockActionRotor.cs diff --git a/Mixins/Sequencer/BlockActionTemplate.cs b/Mixins/ActionGroups/BlockActionTemplate.cs similarity index 100% rename from Mixins/Sequencer/BlockActionTemplate.cs rename to Mixins/ActionGroups/BlockActionTemplate.cs diff --git a/Mixins/Sequencer/IBlockAction.cs b/Mixins/ActionGroups/IBlockAction.cs similarity index 100% rename from Mixins/Sequencer/IBlockAction.cs rename to Mixins/ActionGroups/IBlockAction.cs diff --git a/Mixins/Sequencer/ISequenceableAction.cs b/Mixins/Sequencer/ISequenceableAction.cs deleted file mode 100644 index 63bf653..0000000 --- a/Mixins/Sequencer/ISequenceableAction.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System.Collections.Generic; - -namespace IngameScript -{ - partial class Program - { - - } -} \ No newline at end of file diff --git a/Mixins/Sequencer/SequenceableBlock.cs b/Mixins/Sequencer/SequenceableBlock.cs deleted file mode 100644 index 4d92a3d..0000000 --- a/Mixins/Sequencer/SequenceableBlock.cs +++ /dev/null @@ -1,132 +0,0 @@ -// A SequenceableBlock holds a reference to a compatible block type, -// and a list of available actions sorted by name. -// It provides a RunAction() method that allows the caller to -// run the configured actions. - -using System; -using System.Collections.Generic; -using Sandbox.ModAPI.Ingame; -using VRage.Game.ModAPI.Ingame.Utilities; - -namespace IngameScript -{ - partial class Program - { - public interface ISequenceableAction - { - string Name { get; } - IEnumerator Run(); - } - - public class SequenceableBlock - { - private IConsole _console; - private IMyTerminalBlock _block; - private Dictionary _actions = new Dictionary(); - - public SequenceableBlock(IConsole console, IMyTerminalBlock block) - { - _console = console; - if (!(_block is IMyDoor || _block is IMyPistonBase || _block is IMyMotorRotor)) - { - _console.Print("ERROR: Incompatible block '{_block.CustomName}' being sequenced."); - } - _block = block; - } - - // We employ a pseudo-factory pattern to parse the settings - // into ISequenceableAction objects. - public void Parse(MyIni ini, string sectionName = "sequencer") - { - ini.TryParse(_block.CustomData, sectionName); - List keys = new List(); - ini.GetKeys(sectionName, keys); - - if (_block is IMyDoor) - { - parseDoor(ini, keys); - } - else if (_block is IMyPistonBase) - { - parsePiston(ini, keys); - } - else if (_block is IMyMotorRotor) - { - parseRotor(ini, keys); - } - } - - // Alternatively, the user can parse manually and override anything they - // need to. - public void AddAction(ISequenceableAction action, string name) - { - _actions.Add(action.Name, action); - } - - private void parseDoor(MyIni ini, List keys) - { - foreach (MyIniKey key in keys) - { - string[] values = ini.Get(key).ToString().Split(','); - string actionType = values[1]; - bool lockDoor = true; - if (values.Length >= 3) lockDoor = values[2] == "true" ? true : false; - - SequenceableActionDoor action = new SequenceableActionDoor( - _console, - key.Name, - _block as IMyDoor, - actionType, - lockDoor - ); - _actions.Add(key.Name, action); - } - } - - private void parsePiston(MyIni ini, List keys) - { - foreach (MyIniKey key in keys) - { - string[] values = ini.Get(key).ToString().Split(','); - float angle = Single.Parse(values[1]); - float velocity = 5f; - if (values.Length >= 3) velocity = Single.Parse(values[2]); - - MyRotationDirection dir = MyRotationDirection.AUTO; - if (values.Length >= 4) - { - switch (values[3]) - { - case "cw": - dir = MyRotationDirection.CW; - break; - case "ccw": - dir = MyRotationDirection.CCW; - break; - } - } - - SequenceableActionPiston action = new SequenceableActionPiston( - _console, - key.Name, - _block as IMyPistonBase, - - ); - _actions.Add(key.Name, action); - } - } - - private void parseRotor(MyIni ini, List keys) - { - foreach (MyIniKey key in keys) - { - string[] values = ini.Get(key).ToString().Split(','); - - SequenceableActionRotor action = new SequenceableActionRotor(); - _actions.Add(key.Name, action); - } - - } - } - } -} \ No newline at end of file diff --git a/SpaceEngineers.sln b/SpaceEngineers.sln index 5207d23..f7334d0 100644 --- a/SpaceEngineers.sln +++ b/SpaceEngineers.sln @@ -9,7 +9,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ActionSequencer", "ActionSe EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AirMonitor", "AirMonitor\AirMonitor.csproj", "{40B352CD-100E-4F87-A7A0-FF00F4B8846C}" EndProject -Project("{8A3CDCC5-4B55-4D87-A415-698A0E1FF06F}") = "Sequencer", "Mixins\Sequencer\Sequencer.shproj", "{722A2146-2E38-477C-9587-55075B8FA0E6}" +Project("{8A3CDCC5-4B55-4D87-A415-698A0E1FF06F}") = "ActionGroups", "Mixins\ActionGroups\ActionGroups.shproj", "{722A2146-2E38-477C-9587-55075B8FA0E6}" EndProject Project("{8A3CDCC5-4B55-4D87-A415-698A0E1FF06F}") = "Console", "Mixins\Console\Console.shproj", "{323E8400-84C2-46A0-B2E9-FCD3B31681DA}" EndProject