Replace ConfigParser with SDK-provided MyIni
This commit is contained in:
@ -24,7 +24,6 @@
|
||||
<AdditionalFiles Include="thumb.png" />
|
||||
</ItemGroup>
|
||||
<Import Project="..\Mixins\Console\Console.projitems" Label="shared" />
|
||||
<Import Project="..\Mixins\ConfigParser\ConfigParser.projitems" Label="shared" />
|
||||
<Import Project="..\Mixins\Sequencer\Sequencer.projitems" Label="shared" />
|
||||
<Import Project="..\Mixins\Utils\Utils.projitems" Label="shared" />
|
||||
</Project>
|
@ -8,6 +8,7 @@ namespace IngameScript
|
||||
public partial class Program : MyGridProgram
|
||||
{
|
||||
private MyCommandLine _cli;
|
||||
private MyIni _ini;
|
||||
private Console _console;
|
||||
private List<IEnumerator<bool>> _jobs;
|
||||
private Dictionary<string, Sequencer> _doors;
|
||||
@ -17,13 +18,14 @@ namespace IngameScript
|
||||
{
|
||||
_tickCount = 0;
|
||||
_cli = new MyCommandLine();
|
||||
_console = new Console(this);
|
||||
_ini = new MyIni();
|
||||
_console = new Console(this, _ini);
|
||||
_jobs = new List<IEnumerator<bool>>();
|
||||
|
||||
_doors = new Dictionary<string, Sequencer>();
|
||||
|
||||
List<IMyTerminalBlock> doorParts = Utils.GetBlocksNameContains(GridTerminalSystem, "!Door");
|
||||
foreach (IMyTerminalBlock block in doorParts)
|
||||
List<IMyTerminalBlock> doorBlocks = new List<IMyTerminalBlock>();
|
||||
GridTerminalSystem.GetBlocksOfType<IMyTerminalBlock>(doorBlocks, block => block.CustomName.Contains("!Door"));
|
||||
foreach (IMyTerminalBlock block in doorBlocks)
|
||||
{
|
||||
string doorName = Utils.ExtractTag(block, "!Door");
|
||||
|
||||
@ -36,7 +38,7 @@ namespace IngameScript
|
||||
// Add the part; the Door object handles typing and sequencing.
|
||||
int defaultStep = 1;
|
||||
if (block is IMyShipMergeBlock) defaultStep = 0;
|
||||
ISequenceable wrapped = SequenceableFactory.MakeSequenceable(block, defaultStep);
|
||||
ISequenceable wrapped = SequenceableFactory.MakeSequenceable(block, _ini, defaultStep);
|
||||
if (wrapped == null) { _console.Print($"Tried to add incompatible block '{block.CustomName}'"); continue; }
|
||||
_doors[doorName].AddBlock(wrapped);
|
||||
}
|
||||
|
Reference in New Issue
Block a user