public static ListValue PartList(this IShipconstruct vessel, string partType, SharedObjects sharedObj) { var list = new ListValue(); var partList = vessel.Parts.ToList(); switch (partType.ToUpper()) { case "RESOURCES": list = ResourceValue.PartsToList(partList); break; case "PARTS": list = PartValue.PartsToList(partList, sharedObj); break; case "ENGINES": list = EngineValue.PartsToList(partList, sharedObj); break; case "SENSORS": list = SensorValue.PartsToList(partList, sharedObj); break; case "ELEMENTS": list = ElementValue.PartsToList(partList); break; case "DOCKINGPORTS": list = DockingPortValue.PartsToList(partList, sharedObj); break; } return(list); }
private void InitializeSuffixes() { AddSuffix("NAME", new SetSuffix <StringValue>(() => dockedVesselInfo.name, SetName)); AddSuffix("UID", new Suffix <StringValue>(() => dockedVesselInfo.rootPartUId.ToString())); AddSuffix("VESSEL", new Suffix <VesselTarget>(() => new VesselTarget(parts[0].vessel, shared))); AddSuffix("PARTS", new Suffix <ListValue>(() => PartValueFactory.Construct(parts, shared))); AddSuffix("DOCKINGPORTS", new Suffix <ListValue>(() => DockingPortValue.PartsToList(parts, shared))); AddSuffix("RESOURCES", new Suffix <ListValue>(GetResourceManifest)); }
private void InitializeSuffixes() { AddSuffix("NAME", new SetSuffix <StringValue>(() => dockedVesselInfo.name, SetName)); AddSuffix("UID", new Suffix <StringValue>(() => dockedVesselInfo.rootPartUId.ToString())); AddSuffix("VESSEL", new Suffix <VesselTarget>(() => VesselTarget.CreateOrGetExisting(parts[0].vessel, shared))); AddSuffix("PARTS", new Suffix <ListValue>(() => PartValueFactory.Construct(parts, shared))); AddSuffix("DOCKINGPORTS", new Suffix <ListValue>(() => DockingPortValue.PartsToList(parts, shared))); AddSuffix(new string[] { "DECOUPLERS", "SEPARATORS" }, new Suffix <ListValue>(() => DecouplerValue.PartsToList(parts, shared))); AddSuffix("RESOURCES", new Suffix <ListValue>(GetResourceManifest)); }