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 static void Postfix(ref Geyser __instance, ref List <Descriptor> __result) { const float secondsInCycle = 600f; var 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() / secondsInCycle; var cyclesTotal = __instance.configuration.GetYearLength() / secondsInCycle; var avg = (eruptionActive / eruptionTotal) * (cyclesActive / cyclesTotal) * emissionRate; var units = "g/s"; if (avg > 1000) { avg /= 1000; units = "kg/s"; } var avgStr = avg.ToString("0.00"); __result.Add(new Descriptor(string.Format(GeyserAvgOutput, avgStr, units), string.Format(GeyserAvgOutputTooltip, avgStr, units))); } }
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 static void Postfix(Geyser __instance) { if (__instance.GetType() != typeof(Geyser)) { DestructibleWorkable destWorkable = __instance.GetComponent <DestructibleWorkable>(); if ((UnityEngine.Object)destWorkable != (UnityEngine.Object)null) { UnityEngine.Object.Destroy(__instance.GetComponent <DestructibleWorkable>()); } return; } else { DestructibleWorkable destWorkable = __instance.FindOrAddComponent <DestructibleWorkable>(); int dTime = config.DeconstructTime; if (dTime <= 0 || dTime > 10000) { LogManager.LogException("Deconstruct time is invalid (less than 0 or greater then 10000) in the config: " + dTime, new ArgumentException("DeconstructTime:" + dTime)); } else if (dTime != 1800) { destWorkable.SetWorkTime(dTime); } } }
static private void CleanUnusedParticleSystemObjects(Geyser geyser, ParticleSystem smokeEmitter, ParticleSystem eruptEmitter) { Logger.Info(string.Format("Currently {0} child transforms", geyser.transform.childCount)); int count = 0; foreach (Transform childTransform in geyser.transform) { ParticleSystem particleSystemComponent = childTransform.GetComponent <ParticleSystem>(); if (particleSystemComponent) { if (particleSystemComponent != smokeEmitter && particleSystemComponent != eruptEmitter) { if (particleSystemComponent.gameObject) { UnityEngine.Object.Destroy(particleSystemComponent.gameObject); count++; } } } } if (count > 0) { Logger.Warning(string.Format("{0} redundant particle system objects destroyed at geyser {1}", count, geyser.transform.position)); } }
public static void Prefix(Geyser __instance) { #if DEBUG_1 Debug.Log("[CustomizeGeyser] Geyser.OnSpawn " + __instance.GetComponent <GeyserConfigurator>().presetType.ConvertGeyserId()); #endif // if (RandomizerTable.geysers == null) RandomizerTable.Initialize(); // // if (CustomizeGeyserState.StateManager.State.RandomizerEnabled && (__instance.configuration == null || __instance.configuration.typeId == HashedString.Invalid)) // { // var config = __instance.GetComponent<GeyserConfigurator>(); // // config.presetType = RandomizerTable.GetRandomGeyserType(CustomizeGeyserState.StateManager.State.RandomizerUsesMapSeed ? __instance.transform : null); // // if (isFirst) // config.presetType = GeyserInfo.GeyserTypes.Find(x => x.id == CustomizeGeyserState.StateManager.State.RandomizerSetFirstGeyser)?.id ?? config.presetType; //#if DEBUG_1 // Debug.Log("[CustomizeGeyser] Changed geyser to: " + __instance.GetComponent<GeyserConfigurator>().presetType.ConvertGeyserId()); //#endif // if (CustomizeGeyserState.StateManager.State.RandomizerPopupGeyserDiscoveryInfo) // { // KMod.Manager.Dialog(null, "Geysers discovered", "You just discovered a geyser: " + __instance.GetComponent<GeyserConfigurator>().presetType.ConvertGeyserId()); // } // } // // isFirst = false; }
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))); } }
void Start() { if (gameObject.GetComponent <Geyser>() != null) { myGeyser = gameObject.GetComponent <Geyser>(); myGeyser.enabled = false; } blindGuyTutorial = GameObject.FindWithTag("Blindguy").GetComponent <BlindGuyTutorial>(); blindGuyTransform = blindGuyTutorial.transform; myTransform = gameObject.transform; startPos = myTransform.position; if (type == objectType.pullable) { myTag = gameObject.tag; gameObject.tag = "Untagged"; } else { GetComponent <Collider2D>().enabled = false; } }
private static void Postfix(Geyser __instance) { __instance.Subscribe <Geyser>(493375141, OnRefreshUserMenuDelegate); }
static void Postfix(Geyser __instance, ParticleSystem ___warningSmokeEmitter, ParticleSystem ___eruptionEmitter) { CleanUnusedParticleSystemObjects(__instance, ___warningSmokeEmitter, ___eruptionEmitter); }
public void StartEvent(Geyser eventGeyser) { pullEvent = false; this.eventGeyser = eventGeyser; myState = states.pause; }