public float GetWetMass() { float num = 0f; foreach (GameObject item in AttachableBuilding.GetAttachedNetwork(commandModule.GetComponent <AttachableBuilding>())) { RocketModule component = item.GetComponent <RocketModule>(); if ((Object)component != (Object)null) { FuelTank component2 = component.GetComponent <FuelTank>(); OxidizerTank component3 = component.GetComponent <OxidizerTank>(); SolidBooster component4 = component.GetComponent <SolidBooster>(); if ((Object)component2 != (Object)null) { num += component2.MassStored(); } if ((Object)component3 != (Object)null) { num += component3.MassStored(); } if ((Object)component4 != (Object)null) { num += component4.fuelStorage.MassStored(); } } } return(num); }
public override void DoPostConfigureComplete(GameObject go) { Storage storage = go.AddOrGet <Storage>(); storage.capacityKg = 2700f; storage.allowSublimation = false; storage.SetDefaultStoredItemModifiers(new List <Storage.StoredItemModifier> { Storage.StoredItemModifier.Hide, Storage.StoredItemModifier.Seal, Storage.StoredItemModifier.Insulate }); OxidizerTank oxidizerTank = go.AddOrGet <OxidizerTank>(); oxidizerTank.storage = storage; go.AddOrGet <DropToUserCapacity>(); ManualDeliveryKG manualDeliveryKG = go.AddOrGet <ManualDeliveryKG>(); manualDeliveryKG.SetStorage(storage); manualDeliveryKG.requestedItemTag = ElementLoader.FindElementByHash(SimHashes.OxyRock).tag; manualDeliveryKG.refillMass = storage.capacityKg; manualDeliveryKG.capacity = storage.capacityKg; manualDeliveryKG.operationalRequirement = FetchOrder2.OperationalRequirement.None; manualDeliveryKG.choreTypeIDHash = Db.Get().ChoreTypes.MachineFetch.IdHash; RocketModule rocketModule = go.AddOrGet <RocketModule>(); rocketModule.SetBGKAnim(Assets.GetAnim("rocket_oxidizer_tank_bg_kanim")); EntityTemplates.ExtendBuildingToRocketModule(go); }
public void RegisterRocketModule(RocketModule module) { if (!rocketModules.Contains(module)) { rocketModules.Add(module); } }
public override void DoPostConfigureComplete(GameObject go) { SolidBooster solidBooster = go.AddOrGet <SolidBooster>(); solidBooster.mainEngine = false; solidBooster.efficiency = ROCKETRY.ENGINE_EFFICIENCY.BOOSTER; solidBooster.fuelTag = ElementLoader.FindElementByHash(SimHashes.Iron).tag; Storage storage = go.AddOrGet <Storage>(); storage.SetDefaultStoredItemModifiers(Storage.StandardSealedStorage); storage.capacityKg = 800f; solidBooster.fuelStorage = storage; ManualDeliveryKG manualDeliveryKG = go.AddComponent <ManualDeliveryKG>(); manualDeliveryKG.SetStorage(storage); manualDeliveryKG.requestedItemTag = solidBooster.fuelTag; manualDeliveryKG.refillMass = storage.capacityKg / 2f; manualDeliveryKG.capacity = storage.capacityKg / 2f; manualDeliveryKG.choreTypeIDHash = Db.Get().ChoreTypes.MachineFetch.IdHash; ManualDeliveryKG manualDeliveryKG2 = go.AddComponent <ManualDeliveryKG>(); manualDeliveryKG2.SetStorage(storage); manualDeliveryKG2.requestedItemTag = ElementLoader.FindElementByHash(SimHashes.OxyRock).tag; manualDeliveryKG2.refillMass = storage.capacityKg / 2f; manualDeliveryKG2.capacity = storage.capacityKg / 2f; manualDeliveryKG2.choreTypeIDHash = Db.Get().ChoreTypes.MachineFetch.IdHash; RocketModule rocketModule = go.AddOrGet <RocketModule>(); rocketModule.SetBGKAnim(Assets.GetAnim("rocket_solid_booster_bg_kanim")); EntityTemplates.ExtendBuildingToRocketModule(go); }
public override void DoPostConfigureComplete(GameObject go) { Storage storage = go.AddOrGet <Storage>(); storage.capacityKg = 2700f; storage.allowSublimation = false; storage.SetDefaultStoredItemModifiers(new List <Storage.StoredItemModifier> { Storage.StoredItemModifier.Hide, Storage.StoredItemModifier.Seal, Storage.StoredItemModifier.Insulate }); OxidizerTank oxidizerTank = go.AddOrGet <OxidizerTank>(); oxidizerTank.storage = storage; go.AddOrGet <DropToUserCapacity>(); ConduitConsumer conduitConsumer = go.AddOrGet <ConduitConsumer>(); conduitConsumer.conduitType = ConduitType.Liquid; conduitConsumer.consumptionRate = 10f; conduitConsumer.capacityTag = ElementLoader.FindElementByHash(SimHashes.LiquidOxygen).tag; conduitConsumer.capacityKG = storage.capacityKg; conduitConsumer.forceAlwaysSatisfied = true; conduitConsumer.wrongElementResult = ConduitConsumer.WrongElementResult.Dump; RocketModule rocketModule = go.AddOrGet <RocketModule>(); rocketModule.SetBGKAnim(Assets.GetAnim("rocket_oxidizer_tank_liquid_bg_kanim")); EntityTemplates.ExtendBuildingToRocketModule(go); }
public override void ConfigureBuildingTemplate(GameObject go, Tag prefab_tag) { BuildingConfigManager.Instance.IgnoreDefaultKComponent(typeof(RequiresFoundation), prefab_tag); go.AddOrGet <LoopingSounds>(); go.GetComponent <KPrefabID>().AddTag(RoomConstraints.ConstraintTags.IndustrialMachinery, false); RocketModule rocketModule = go.AddOrGet <RocketModule>(); rocketModule.SetBGKAnim(Assets.GetAnim("rocket_command_module_bg_kanim")); LaunchConditionManager launchConditionManager = go.AddOrGet <LaunchConditionManager>(); launchConditionManager.triggerPort = "TriggerLaunch"; launchConditionManager.statusPort = "LaunchReady"; Storage storage = go.AddOrGet <Storage>(); storage.SetDefaultStoredItemModifiers(new List <Storage.StoredItemModifier> { Storage.StoredItemModifier.Hide, Storage.StoredItemModifier.Seal, Storage.StoredItemModifier.Insulate }); go.AddOrGet <CommandModule>(); go.AddOrGet <CommandModuleWorkable>(); go.AddOrGet <MinionStorage>(); go.AddOrGet <ArtifactFinder>(); go.AddOrGet <LaunchableRocket>(); }
public override void DoPostConfigureComplete(GameObject go) { FuelTank fuelTank = go.AddOrGet <FuelTank>(); fuelTank.capacityKg = fuelTank.minimumLaunchMass; fuelTank.SetDefaultStoredItemModifiers(new List <Storage.StoredItemModifier> { Storage.StoredItemModifier.Hide, Storage.StoredItemModifier.Seal, Storage.StoredItemModifier.Insulate }); go.AddOrGet <DropToUserCapacity>(); ManualDeliveryKG manualDeliveryKG = go.AddOrGet <ManualDeliveryKG>(); manualDeliveryKG.SetStorage(fuelTank); manualDeliveryKG.refillMass = fuelTank.capacityKg; manualDeliveryKG.capacity = fuelTank.capacityKg; manualDeliveryKG.operationalRequirement = FetchOrder2.OperationalRequirement.None; manualDeliveryKG.choreTypeIDHash = Db.Get().ChoreTypes.MachineFetch.IdHash; ConduitConsumer conduitConsumer = go.AddOrGet <ConduitConsumer>(); conduitConsumer.conduitType = ConduitType.Liquid; conduitConsumer.consumptionRate = 10f; conduitConsumer.capacityTag = GameTags.Liquid; conduitConsumer.capacityKG = fuelTank.capacityKg; conduitConsumer.forceAlwaysSatisfied = true; conduitConsumer.wrongElementResult = ConduitConsumer.WrongElementResult.Store; RocketModule rocketModule = go.AddOrGet <RocketModule>(); rocketModule.SetBGKAnim(Assets.GetAnim("rocket_liquid_fuel_tank_bg_kanim")); EntityTemplates.ExtendBuildingToRocketModule(go); }
private bool CheckHydrogenRocket() { RocketModule rocketModule = target.rocketModules.Find((RocketModule match) => match.GetComponent <RocketEngine>()); if ((UnityEngine.Object)rocketModule != (UnityEngine.Object)null) { return(rocketModule.GetComponent <RocketEngine>().fuelTag == ElementLoader.FindElementByHash(SimHashes.LiquidHydrogen).tag); } return(false); }
public override void DoPostConfigureComplete(GameObject go) { RocketEngine rocketEngine = go.AddOrGet <RocketEngine>(); rocketEngine.fuelTag = ElementLoader.FindElementByHash(SimHashes.Petroleum).tag; rocketEngine.efficiency = ROCKETRY.ENGINE_EFFICIENCY.MEDIUM; rocketEngine.explosionEffectHash = SpawnFXHashes.MeteorImpactDust; EntityTemplates.ExtendBuildingToRocketModule(go); RocketModule rocketModule = go.AddOrGet <RocketModule>(); rocketModule.SetBGKAnim(Assets.GetAnim("rocket_petroleum_engine_bg_kanim")); }
public float GetDryMass() { float num = 0f; foreach (GameObject item in AttachableBuilding.GetAttachedNetwork(commandModule.GetComponent <AttachableBuilding>())) { RocketModule component = item.GetComponent <RocketModule>(); if ((Object)component != (Object)null) { num += component.GetComponent <PrimaryElement>().Mass; } } return(num); }
public override void DoPostConfigureComplete(GameObject go) { CargoBay cargoBay = go.AddOrGet <CargoBay>(); cargoBay.storage = go.AddOrGet <Storage>(); cargoBay.storageType = CargoBay.CargoType.solids; cargoBay.storage.capacityKg = 1000f; cargoBay.storage.SetDefaultStoredItemModifiers(Storage.StandardSealedStorage); RocketModule rocketModule = go.AddOrGet <RocketModule>(); rocketModule.SetBGKAnim(Assets.GetAnim("rocket_storage_solid_bg_kanim")); EntityTemplates.ExtendBuildingToRocketModule(go); go.AddOrGet <SolidConduitDispenser>(); }
public override void DoPostConfigureComplete(GameObject go) { RocketEngine rocketEngine = go.AddOrGet <RocketEngine>(); rocketEngine.fuelTag = ElementLoader.FindElementByHash(SimHashes.LiquidHydrogen).tag; rocketEngine.efficiency = ROCKETRY.ENGINE_EFFICIENCY.STRONG; rocketEngine.explosionEffectHash = SpawnFXHashes.MeteorImpactDust; rocketEngine.exhaustElement = SimHashes.Steam; rocketEngine.exhaustTemperature = 2000f; EntityTemplates.ExtendBuildingToRocketModule(go); RocketModule rocketModule = go.AddOrGet <RocketModule>(); rocketModule.SetBGKAnim(Assets.GetAnim("rocket_hydrogen_engine_bg_kanim")); }
public override void ConfigureBuildingTemplate(GameObject go, Tag prefab_tag) { BuildingConfigManager.Instance.IgnoreDefaultKComponent(typeof(RequiresFoundation), prefab_tag); go.AddOrGet <LoopingSounds>(); go.GetComponent <KPrefabID>().AddTag(RoomConstraints.ConstraintTags.IndustrialMachinery, false); RocketModule rocketModule = go.AddOrGet <RocketModule>(); rocketModule.SetBGKAnim(Assets.GetAnim("rocket_research_module_bg_kanim")); go.AddOrGet <ResearchModule>(); BuildingAttachPoint buildingAttachPoint = go.AddOrGet <BuildingAttachPoint>(); buildingAttachPoint.points = new BuildingAttachPoint.HardPoint[1] { new BuildingAttachPoint.HardPoint(new CellOffset(0, 5), GameTags.Rocket, null) }; }
public static Rocket CreateRocket(List <int> masses) { var rocket = new Rocket { Modules = new List <RocketModule>() }; foreach (var mass in masses) { var newModule = new RocketModule { Mass = mass }; rocket.Modules.Add(newModule); } return(rocket); }
public override void DoPostConfigureComplete(GameObject go) { CargoBay cargoBay = go.AddOrGet <CargoBay>(); cargoBay.storage = go.AddOrGet <Storage>(); cargoBay.storageType = CargoBay.CargoType.liquids; cargoBay.storage.capacityKg = 1000f; cargoBay.storage.SetDefaultStoredItemModifiers(Storage.StandardSealedStorage); RocketModule rocketModule = go.AddOrGet <RocketModule>(); rocketModule.SetBGKAnim(Assets.GetAnim("rocket_storage_liquid_bg_kanim")); ConduitDispenser conduitDispenser = go.AddOrGet <ConduitDispenser>(); conduitDispenser.conduitType = ConduitType.Liquid; conduitDispenser.storage = cargoBay.storage; }
public void FindModules() { List <GameObject> attachedNetwork = AttachableBuilding.GetAttachedNetwork(GetComponent <AttachableBuilding>()); foreach (GameObject item in attachedNetwork) { RocketModule component = item.GetComponent <RocketModule>(); if ((UnityEngine.Object)component != (UnityEngine.Object)null && (UnityEngine.Object)component.conditionManager == (UnityEngine.Object)null) { component.conditionManager = this; component.RegisterWithConditionManager(); } } Spacecraft spacecraftFromLaunchConditionManager = SpacecraftManager.instance.GetSpacecraftFromLaunchConditionManager(this); if (spacecraftFromLaunchConditionManager != null) { spacecraftFromLaunchConditionManager.moduleCount = attachedNetwork.Count; } }
protected override void OnSpawn() { base.OnSpawn(); storage = GetComponent <Storage>(); assignable = GetComponent <Assignable>(); assignable.AddAssignPrecondition(CanAssignTo); base.smi.StartSM(); int cell = Grid.PosToCell(base.gameObject); partitionerEntry = GameScenePartitioner.Instance.Add("CommandModule.gantryChanged", base.gameObject, cell, GameScenePartitioner.Instance.validNavCellChangedLayer, OnGantryChanged); OnGantryChanged(null); RocketModule component = GetComponent <RocketModule>(); reachable = (ConditionDestinationReachable)component.AddLaunchCondition(new ConditionDestinationReachable(this)); hasAstronaut = (ConditionHasAstronaut)component.AddLaunchCondition(new ConditionHasAstronaut(this)); hasSuit = (ConditionHasAtmoSuit)component.AddLaunchCondition(new ConditionHasAtmoSuit(this)); cargoEmpty = (CargoBayIsEmpty)component.AddLaunchCondition(new CargoBayIsEmpty(this)); destHasResources = (ConditionHasMinimumMass)component.AddLaunchCondition(new ConditionHasMinimumMass(this)); flightPathIsClear = (ConditionFlightPathIsClear)component.AddFlightCondition(new ConditionFlightPathIsClear(base.gameObject, 1)); }
public Type[] GetModules() { var modules = new List <Type> (); foreach (var assembly in GetAssemblies()) { try { foreach (var type in assembly.GetTypes()) { if (RocketModule.IsRocketModule(type)) { modules.AddIfNotContains(type); } } } catch (Exception ex) { throw new RocketException("Could not get module types from assembly: " + assembly.FullName, ex); } } return(modules.ToArray()); }
public Type[] GetModules() { var modules = new List <Type> (); foreach (var filePath in FilePaths) { var assembly = AssemblyLoadContext.Default.LoadFromAssemblyPath(filePath); try { foreach (var type in assembly.GetTypes()) { if (RocketModule.IsRocketModule(type)) { modules.AddIfNotContains(type); } } } catch (Exception ex) { throw new RocketException("Could not get module types from assembly: " + assembly.FullName, ex); } } return(modules.ToArray()); }
public void UnregisterRocketModule(RocketModule module) { rocketModules.Remove(module); }
private int GetTotalFuelAmount(int mass) { var module = new RocketModule(mass); return(module.TotalFuelRequired); }