Replace ConfigParser with SDK-provided MyIni
This commit is contained in:
@ -2,6 +2,7 @@
|
||||
|
||||
using Sandbox.ModAPI.Ingame;
|
||||
using SpaceEngineers.Game.ModAPI.Ingame;
|
||||
using VRage.Game.ModAPI.Ingame.Utilities;
|
||||
|
||||
namespace IngameScript
|
||||
{
|
||||
@ -9,11 +10,14 @@ namespace IngameScript
|
||||
{
|
||||
public class SequenceableFactory
|
||||
{
|
||||
public static ISequenceable MakeSequenceable(IMyTerminalBlock block, int step = 0)
|
||||
public static ISequenceable MakeSequenceable(
|
||||
IMyTerminalBlock block,
|
||||
MyIni ini,
|
||||
int step = 0)
|
||||
{
|
||||
if (block is IMyMotorStator)
|
||||
{
|
||||
return new SequenceableRotor(block as IMyMotorStator, step);
|
||||
return new SequenceableRotor(block as IMyMotorStator, ini, step);
|
||||
}
|
||||
if (block is IMyPistonBase)
|
||||
{
|
||||
|
@ -1,6 +1,6 @@
|
||||
using Sandbox.ModAPI.Ingame;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using VRage.Game.ModAPI.Ingame.Utilities;
|
||||
|
||||
namespace IngameScript
|
||||
{
|
||||
@ -19,15 +19,18 @@ namespace IngameScript
|
||||
private float _closedAngle;
|
||||
private IMyMotorStator _rotor;
|
||||
|
||||
public SequenceableRotor(IMyMotorStator rotor, int defaultStep = 0)
|
||||
public SequenceableRotor(
|
||||
IMyMotorStator rotor,
|
||||
MyIni ini,
|
||||
int defaultStep = 0)
|
||||
{
|
||||
_rotor = rotor;
|
||||
|
||||
ConfigParser config = new ConfigParser(_rotor);
|
||||
_openAngle = config.GetValue("OpenAngle", 90F);
|
||||
_closedAngle = config.GetValue("ClosedAngle", 0F);
|
||||
_velocity = config.GetValue("Velocity", 5F);
|
||||
Step = config.GetValue("Step", defaultStep);
|
||||
ini.TryParse(rotor.CustomData);
|
||||
_openAngle = ini.Get("sequencer", "openAngle").ToSingle(90F);
|
||||
_closedAngle = ini.Get("sequencer", "closedAngle").ToSingle(0F);
|
||||
_velocity = ini.Get("sequencer", "velocity").ToSingle(5F);
|
||||
Step = ini.Get("sequencer", "step").ToInt32(defaultStep);
|
||||
}
|
||||
|
||||
public void Start(bool reverse)
|
||||
|
Reference in New Issue
Block a user