Skip to content

Commit

Permalink
For issue KSP-KOS#2319
Browse files Browse the repository at this point in the history
Signed-off-by: Evan Dickinson <evan_dickinson@protonmail.com>
  • Loading branch information
evandisoft committed Nov 12, 2018
1 parent cac38e8 commit 1f0a761
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/kOS/Suffixed/BodyTarget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,16 @@ public static BodyTarget CreateOrGetExisting(string bodyName, SharedObjects shar
return CreateOrGetExisting(VesselUtils.GetBodyByName(bodyName), shared);
}



private void BodyInitializeSuffixes()
{
AddSuffix("NAME", new Suffix<StringValue>(() => Body.name));
AddSuffix("DESCRIPTION", new Suffix<StringValue>(() => Body.bodyDescription));
AddSuffix("MASS", new Suffix<ScalarValue>(() => Body.Mass));
AddSuffix ("MASS", new Suffix<ScalarValue> (() => Body.Mass));
AddSuffix("OCEAN", new Suffix<BooleanValue> (() => Body.ocean));
AddSuffix("HASSOLIDSURFACE", new Suffix<BooleanValue> (() => Body.hasSolidSurface));
AddSuffix("ORBITINGCHILDREN", new Suffix<ListValue> (GetOrbitingBodies));
AddSuffix("ALTITUDE", new Suffix<ScalarValue>(() => Body.orbit.altitude));
AddSuffix("RADIUS", new Suffix<ScalarValue>(() => Body.Radius));
AddSuffix("MU", new Suffix<ScalarValue>(() => Body.gravParameter));
Expand All @@ -107,6 +112,15 @@ private void BodyInitializeSuffixes()
"Given latitude and longitude, return the geoposition on this body corresponding to it."));
}

public ListValue GetOrbitingBodies()
{
var toReturn = new ListValue();
foreach (CelestialBody body in Body.orbitingBodies) {
toReturn.Add(CreateOrGetExisting(body,Shared));
}
return toReturn;
}

public override StringValue GetName()
{
return Body.name;
Expand Down

0 comments on commit 1f0a761

Please sign in to comment.