diff --git a/MechanicalDoor/DoorHinge.cs b/MechanicalDoor/DoorHinge.cs
index bdcaab2..d0cf1e6 100644
--- a/MechanicalDoor/DoorHinge.cs
+++ b/MechanicalDoor/DoorHinge.cs
@@ -20,7 +20,11 @@ namespace IngameScript
{
_p = p;
_hinge = hinge;
- parseConfig();
+
+ ConfigParser config = new ConfigParser(_hinge);
+ _openAngle = config.GetValue("OpenAngle", 90F);
+ _closedAngle = config.GetValue("ClosedAngle", 0F);
+ _velocity = config.GetValue("Velocity", 5F);
}
// For these two functions, IMyMotorStator.Angle reports radians, but
@@ -52,28 +56,6 @@ namespace IngameScript
return Locked;
}
- private void parseConfig()
- {
- string[] lines = _hinge.CustomData.Split('\n');
- foreach (string line in lines)
- {
- string[] tokens = line.Split('=');
- if (tokens.Length != 2) continue;
- switch (tokens[0])
- {
- case "OpenAngle":
- _openAngle = float.Parse(tokens[1]);
- break;
- case "ClosedAngle":
- _closedAngle = float.Parse(tokens[1]);
- break;
- case "Velocity":
- _velocity = float.Parse(tokens[1]);
- break;
- }
- }
- }
-
private float degToRad(float degrees)
{
return degrees * ((float)Math.PI / 180F);
diff --git a/MechanicalDoor/MechanicalDoor.csproj b/MechanicalDoor/MechanicalDoor.csproj
index f2006f4..7b595e0 100644
--- a/MechanicalDoor/MechanicalDoor.csproj
+++ b/MechanicalDoor/MechanicalDoor.csproj
@@ -23,4 +23,6 @@
+
+
\ No newline at end of file