public StaticObject spawnInstance(StaticModel model) { StaticObject obj = new StaticObject(); obj.gameObject = GameDatabase.Instance.GetModel(model.path + "/" + model.getSetting("mesh")); obj.setSetting("RadiusOffset", (float)FlightGlobals.ActiveVessel.altitude); obj.setSetting("CelestialBody", KerbalKonstructs.instance.getCurrentBody()); obj.setSetting("Group", "Ungrouped"); obj.setSetting("RadialPosition", KerbalKonstructs.instance.getCurrentBody().transform.InverseTransformPoint(FlightGlobals.ActiveVessel.transform.position)); obj.setSetting("RotationAngle", 0f); obj.setSetting("Orientation", Vector3.up); obj.setSetting("VisibilityRange", 25000f); string sPad = ((string)model.getSetting("DefaultLaunchPadTransform")); if (sPad != null) { obj.setSetting("LaunchPadTransform", sPad); } if (!KerbalKonstructs.instance.DevMode) { obj.setSetting("CustomInstance", "True"); } obj.model = model; KerbalKonstructs.instance.getStaticDB().addStatic(obj); enableColliders = false; obj.spawnObject(true, false); return(obj); }
public void updateSelection(StaticModel obj) { infAuthor = (string)obj.getSetting("author"); infMesh = "" + obj.getSetting("mesh"); infManufacturer = (string)obj.getSetting("manufacturer"); infCost = obj.getSetting("cost").ToString(); infDescription = (string)obj.getSetting("description"); infTitle = (string)obj.getSetting("title"); infCategory = (string)obj.getSetting("category"); }
public void CreatePreviewInstance(StaticModel model) { StaticObject obj = new StaticObject(); obj.gameObject = GameDatabase.Instance.GetModel(model.path + "/" + model.getSetting("mesh")); obj.setSetting("RadiusOffset", (float)FlightGlobals.ActiveVessel.altitude); obj.setSetting("CelestialBody", KerbalKonstructs.instance.getCurrentBody()); obj.setSetting("Group", "Ungrouped"); obj.setSetting("RadialPosition", KerbalKonstructs.instance.getCurrentBody().transform.InverseTransformPoint(FlightGlobals.ActiveVessel.transform.position)); obj.setSetting("RotationAngle", 0f); obj.setSetting("Orientation", Vector3.up); obj.setSetting("VisibilityRange", 25000f); obj.model = model; KerbalKonstructs.instance.getStaticDB().addStatic(obj); obj.spawnObject(true, true); // KerbalKonstructs.instance.selectObject(obj, false); currPreview = obj; }
public void updateSelection(StaticModel obj) { infAuthor = (string)obj.getSetting("author"); infMesh = "" + obj.getSetting("mesh"); infManufacturer = (string)obj.getSetting("manufacturer"); infCost = obj.getSetting("cost").ToString(); infDescription = (string)obj.getSetting("description"); infTitle = (string)obj.getSetting("title"); infCategory = (string)obj.getSetting("category"); infLaunchTransform = (string)obj.getSetting("DefaultLaunchPadTransform"); infLaunchLength = obj.getSetting("DefaultLaunchSiteLength").ToString(); infLaunchWidth = obj.getSetting("DefaultLaunchSiteWidth").ToString(); infFacType = (string)obj.getSetting("DefaultFacilityType"); infFacLength = obj.getSetting("DefaultFacilityLength").ToString(); infFacWidth = obj.getSetting("DefaultFacilityWidth").ToString(); infFacHeight = obj.getSetting("DefaultFacilityHeight").ToString(); infFacMassCap = obj.getSetting("DefaultFacilityMassCapacity").ToString(); infFacCraftCap = obj.getSetting("DefaultFacilityCraftCapacity").ToString(); infStaffMax = obj.getSetting("DefaultStaffMax").ToString(); infLqFMax = obj.getSetting("LqFMax").ToString(); infOxFMax = obj.getSetting("OxFMax").ToString(); infMoFMax = obj.getSetting("MoFMax").ToString(); infECMax = obj.getSetting("ECMax").ToString(); infOreMax = obj.getSetting("OreMax").ToString(); infPrOreMax = obj.getSetting("PrOreMax").ToString(); infProdRateMax = obj.getSetting("DefaultProductionRateMax").ToString(); infScienceMax = obj.getSetting("DefaultScienceOMax").ToString(); infRepMax = obj.getSetting("DefaultRepOMax").ToString(); infFundsMax = obj.getSetting("DefaultFundsOMax").ToString(); }