public GameObject CreatePrefab() { GameObject gameObject = EntityTemplates.CreatePlacedEntity("Geyser", STRINGS.CREATURES.SPECIES.GEYSER.NAME, STRINGS.CREATURES.SPECIES.GEYSER.DESC, 2000f, Assets.GetAnim("geyser_side_steam_kanim"), "inactive", Grid.SceneLayer.BuildingBack, 4, 2, TUNING.BUILDINGS.DECOR.BONUS.TIER1, NOISE_POLLUTION.NOISY.TIER6, SimHashes.Creature, null, 293f); gameObject.GetComponent <KPrefabID>().AddTag(GameTags.DeprecatedContent, false); PrimaryElement component = gameObject.GetComponent <PrimaryElement>(); component.SetElement(SimHashes.IgneousRock); component.Temperature = 372.15f; Geyser geyser = gameObject.AddOrGet <Geyser>(); geyser.outputOffset = new Vector2I(0, 1); GeyserConfigurator geyserConfigurator = gameObject.AddOrGet <GeyserConfigurator>(); geyserConfigurator.presetType = "steam"; geyserConfigurator.presetMin = 0.5f; geyserConfigurator.presetMax = 0.75f; Studyable studyable = gameObject.AddOrGet <Studyable>(); studyable.meterTrackerSymbol = "geotracker_target"; studyable.meterAnim = "tracker"; gameObject.AddOrGet <LoopingSounds>(); SoundEventVolumeCache.instance.AddVolume("geyser_side_steam_kanim", "Geyser_shake_LP", NOISE_POLLUTION.NOISY.TIER5); SoundEventVolumeCache.instance.AddVolume("geyser_side_steam_kanim", "Geyser_erupt_LP", NOISE_POLLUTION.NOISY.TIER6); return(gameObject); }
public GameObject CreateGeyser(string id, string anim, int width, int height, string name, string desc, HashedString presetType) { float mass = 2000f; GameObject gameObject = EntityTemplates.CreatePlacedEntity(id, name, desc, mass, Assets.GetAnim(anim), "inactive", Grid.SceneLayer.BuildingBack, width, height, BUILDINGS.DECOR.BONUS.TIER1, NOISE_POLLUTION.NOISY.TIER6, SimHashes.Creature, null, 293f); gameObject.AddOrGet <OccupyArea>().objectLayers = new ObjectLayer[1] { ObjectLayer.Building }; PrimaryElement component = gameObject.GetComponent <PrimaryElement>(); component.SetElement(SimHashes.Katairite); component.Temperature = 372.15f; gameObject.AddOrGet <Prioritizable>(); gameObject.AddOrGet <Uncoverable>(); Geyser geyser = gameObject.AddOrGet <Geyser>(); geyser.outputOffset = new Vector2I(0, 1); GeyserConfigurator geyserConfigurator = gameObject.AddOrGet <GeyserConfigurator>(); geyserConfigurator.presetType = presetType; Studyable studyable = gameObject.AddOrGet <Studyable>(); studyable.meterTrackerSymbol = "geotracker_target"; studyable.meterAnim = "tracker"; gameObject.AddOrGet <LoopingSounds>(); SoundEventVolumeCache.instance.AddVolume("geyser_side_steam_kanim", "Geyser_shake_LP", NOISE_POLLUTION.NOISY.TIER5); SoundEventVolumeCache.instance.AddVolume("geyser_side_steam_kanim", "Geyser_erupt_LP", NOISE_POLLUTION.NOISY.TIER6); return(gameObject); }
public List <Descriptor> GetDescriptors(GameObject go) { List <Descriptor> list = new List <Descriptor>(); Element element = ElementLoader.FindElementByHash(configuration.GetElement()); string arg = element.tag.ProperName(); list.Add(new Descriptor(string.Format(UI.BUILDINGEFFECTS.GEYSER_PRODUCTION, arg, GameUtil.GetFormattedMass(configuration.GetEmitRate(), GameUtil.TimeSlice.PerSecond, GameUtil.MetricMassFormat.UseThreshold, true, "{0:0.#}"), GameUtil.GetFormattedTemperature(configuration.GetTemperature(), GameUtil.TimeSlice.None, GameUtil.TemperatureInterpretation.Absolute, true, false)), string.Format(UI.BUILDINGEFFECTS.TOOLTIPS.GEYSER_PRODUCTION, configuration.GetElement().ToString(), GameUtil.GetFormattedMass(configuration.GetEmitRate(), GameUtil.TimeSlice.PerSecond, GameUtil.MetricMassFormat.UseThreshold, true, "{0:0.#}"), GameUtil.GetFormattedTemperature(configuration.GetTemperature(), GameUtil.TimeSlice.None, GameUtil.TemperatureInterpretation.Absolute, true, false)), Descriptor.DescriptorType.Effect, false)); if (configuration.GetDiseaseIdx() != 255) { list.Add(new Descriptor(string.Format(UI.BUILDINGEFFECTS.GEYSER_DISEASE, GameUtil.GetFormattedDiseaseName(configuration.GetDiseaseIdx(), false)), string.Format(UI.BUILDINGEFFECTS.TOOLTIPS.GEYSER_DISEASE, GameUtil.GetFormattedDiseaseName(configuration.GetDiseaseIdx(), false)), Descriptor.DescriptorType.Effect, false)); } list.Add(new Descriptor(string.Format(UI.BUILDINGEFFECTS.GEYSER_PERIOD, GameUtil.GetFormattedTime(configuration.GetOnDuration()), GameUtil.GetFormattedTime(configuration.GetIterationLength())), string.Format(UI.BUILDINGEFFECTS.TOOLTIPS.GEYSER_PERIOD, GameUtil.GetFormattedTime(configuration.GetOnDuration()), GameUtil.GetFormattedTime(configuration.GetIterationLength())), Descriptor.DescriptorType.Effect, false)); Studyable component = GetComponent <Studyable>(); if ((bool)component && !component.Studied) { list.Add(new Descriptor(string.Format(UI.BUILDINGEFFECTS.GEYSER_YEAR_UNSTUDIED), string.Format(UI.BUILDINGEFFECTS.TOOLTIPS.GEYSER_YEAR_UNSTUDIED), Descriptor.DescriptorType.Effect, false)); } else { list.Add(new Descriptor(string.Format(UI.BUILDINGEFFECTS.GEYSER_YEAR_PERIOD, GameUtil.GetFormattedCycles(configuration.GetYearOnDuration(), "F1"), GameUtil.GetFormattedCycles(configuration.GetYearLength(), "F1")), string.Format(UI.BUILDINGEFFECTS.TOOLTIPS.GEYSER_YEAR_PERIOD, GameUtil.GetFormattedCycles(configuration.GetYearOnDuration(), "F1"), GameUtil.GetFormattedCycles(configuration.GetYearLength(), "F1")), Descriptor.DescriptorType.Effect, false)); if (base.smi.IsInsideState(base.smi.sm.dormant)) { list.Add(new Descriptor(string.Format(UI.BUILDINGEFFECTS.GEYSER_YEAR_NEXT_ACTIVE, GameUtil.GetFormattedCycles(RemainingDormantTime(), "F1")), string.Format(UI.BUILDINGEFFECTS.TOOLTIPS.GEYSER_YEAR_NEXT_ACTIVE, GameUtil.GetFormattedCycles(RemainingDormantTime(), "F1")), Descriptor.DescriptorType.Effect, false)); } else { list.Add(new Descriptor(string.Format(UI.BUILDINGEFFECTS.GEYSER_YEAR_NEXT_DORMANT, GameUtil.GetFormattedCycles(RemainingActiveTime(), "F1")), string.Format(UI.BUILDINGEFFECTS.TOOLTIPS.GEYSER_YEAR_NEXT_DORMANT, GameUtil.GetFormattedCycles(RemainingActiveTime(), "F1")), Descriptor.DescriptorType.Effect, false)); } } return(list); }
public void CheckStudyable() { if (!KMonoBehaviour.isLoadingScene) { Studyable s = geyser.GetComponent <Studyable>(); if (s != null && s.Studied) { if (s != null) { s.Refresh(); } // add delivery task ManualDeliveryKG deliver = geyser.gameObject.AddOrGet <ManualDeliveryKG>(); deliver.SetStorage(geyser.GetComponent <Storage>()); deliver.requestedItemTag = ElementLoader.FindElementByName("Sulfur").tag; deliver.refillMass = SingletonOptions <ConfigData> .Instance.KgPerCrack; deliver.capacity = SingletonOptions <ConfigData> .Instance.KgPerCrack; // deliver.choreTags = GameTags.ChoreTypes.ResearchChores; deliver.choreTypeIDHash = Db.Get().ChoreTypes.ResearchFetch.IdHash; button = geyser.gameObject.AddOrGet <CrackableButton>(); button.crackable = this; UpdateUI(); return; } } Invoke("CheckStudyable", 1f); }
public static void Postfix(Studyable __instance) { int aTime = config.AnaylsisTime; if (aTime <= 0 || aTime > 10000) { LogManager.LogException("Anaylsis time is invalid (less than 0 or greater then 10000) in the config: " + aTime, new ArgumentException("AnaylsisTime:" + aTime)); } else if (aTime != 3600) { __instance.SetWorkTime(aTime); } }
private static void Postfix(ref Geyser __instance, GameObject go, ref List <Descriptor> __result) { Studyable component = __instance.GetComponent <Studyable>(); if (component && !component.Studied) { __result.Add(new Descriptor(GeyserAvgOutputAnalyse, GeyserAvgOutputAnalyseTooltip)); } else { var emissionRate = __instance.configuration.GetEmitRate() * 1000; var eruptionActive = __instance.configuration.GetOnDuration(); var eruptionTotal = __instance.configuration.GetIterationLength(); var cyclesActive = __instance.configuration.GetYearOnDuration() / 600; var cyclesTotal = __instance.configuration.GetYearLength() / 600; var avg = (eruptionActive / eruptionTotal) * (cyclesActive / cyclesTotal) * emissionRate; var avgStr = avg.ToString("0.00"); __result.Add(new Descriptor(String.Format(GeyserAvgOutput, avgStr), String.Format(GeyserAvgOutputTooltip, avgStr))); } }