private static void RetriggerOnUpdateRoom(this BuildingAttachPoint buildingAttachPoint, object data) { for (int i = 0; i < buildingAttachPoint.points.Length; i++) { buildingAttachPoint.points[i].attachedBuilding?.Trigger((int)GameHashes.UpdateRoom, data); } }
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); BuildingAttachPoint buildingAttachPoint = go.AddOrGet <BuildingAttachPoint>(); buildingAttachPoint.points = new BuildingAttachPoint.HardPoint[1] { new BuildingAttachPoint.HardPoint(new CellOffset(0, 5), GameTags.Rocket, null) }; }
public override void ConfigureBuildingTemplate(GameObject go, Tag prefab_tag) { BuildingConfigManager.Instance.IgnoreDefaultKComponent(typeof(RequiresFoundation), prefab_tag); go.AddOrGet <LoopingSounds>(); BuildingAttachPoint buildingAttachPoint = go.AddOrGet <BuildingAttachPoint>(); buildingAttachPoint.points = new BuildingAttachPoint.HardPoint[1] { new BuildingAttachPoint.HardPoint(new CellOffset(0, 5), "MonumentTop", null) }; MonumentPart monumentPart = go.AddOrGet <MonumentPart>(); monumentPart.part = MonumentPart.Part.Middle; }
public GameObject CreatePrefab() { GameObject gameObject = EntityTemplates.CreatePlacedEntity("OilWell", STRINGS.CREATURES.SPECIES.OIL_WELL.NAME, STRINGS.CREATURES.SPECIES.OIL_WELL.DESC, 2000f, Assets.GetAnim("geyser_side_oil_kanim"), "off", Grid.SceneLayer.BuildingBack, 4, 2, TUNING.BUILDINGS.DECOR.BONUS.TIER1, NOISE_POLLUTION.NOISY.TIER5, SimHashes.Creature, null, 293f); OccupyArea component = gameObject.GetComponent <OccupyArea>(); component.objectLayers = new ObjectLayer[1] { ObjectLayer.Building }; PrimaryElement component2 = gameObject.GetComponent <PrimaryElement>(); component2.SetElement(SimHashes.SedimentaryRock); component2.Temperature = 372.15f; BuildingAttachPoint buildingAttachPoint = gameObject.AddOrGet <BuildingAttachPoint>(); buildingAttachPoint.points = new BuildingAttachPoint.HardPoint[1] { new BuildingAttachPoint.HardPoint(new CellOffset(0, 0), GameTags.OilWell, null) }; SoundEventVolumeCache.instance.AddVolume("geyser_side_methane_kanim", "GeyserMethane_shake_LP", NOISE_POLLUTION.NOISY.TIER5); SoundEventVolumeCache.instance.AddVolume("geyser_side_methane_kanim", "GeyserMethane_erupt_LP", NOISE_POLLUTION.NOISY.TIER6); return(gameObject); }
public void FixSorting() { int num = 0; AttachableBuilding component = GetComponent <AttachableBuilding>(); while ((UnityEngine.Object)component != (UnityEngine.Object)null) { BuildingAttachPoint attachedTo = component.GetAttachedTo(); if (!((UnityEngine.Object)attachedTo != (UnityEngine.Object)null)) { break; } component = attachedTo.GetComponent <AttachableBuilding>(); num++; } Vector3 localPosition = base.transform.GetLocalPosition(); localPosition.z = Grid.GetLayerZ(Grid.SceneLayer.BuildingFront) - (float)num * 0.01f; base.transform.SetLocalPosition(localPosition); KBatchedAnimController component2 = GetComponent <KBatchedAnimController>(); component2.enabled = false; component2.enabled = true; }
public static List <GameObject> GetAttachedNetwork(AttachableBuilding tip) { List <GameObject> list = new List <GameObject>(); list.Add(tip.gameObject); AttachableBuilding attachableBuilding = tip; while ((UnityEngine.Object)attachableBuilding != (UnityEngine.Object)null) { BuildingAttachPoint attachedTo = attachableBuilding.GetAttachedTo(); attachableBuilding = null; if ((UnityEngine.Object)attachedTo != (UnityEngine.Object)null) { list.Add(attachedTo.gameObject); attachableBuilding = attachedTo.GetComponent <AttachableBuilding>(); } } BuildingAttachPoint buildingAttachPoint = tip.GetComponent <BuildingAttachPoint>(); while ((UnityEngine.Object)buildingAttachPoint != (UnityEngine.Object)null) { bool flag = false; BuildingAttachPoint.HardPoint[] points = buildingAttachPoint.points; for (int i = 0; i < points.Length; i++) { BuildingAttachPoint.HardPoint hardPoint = points[i]; if (flag) { break; } if ((UnityEngine.Object)hardPoint.attachedBuilding != (UnityEngine.Object)null) { IEnumerator enumerator = Components.AttachableBuildings.GetEnumerator(); try { while (enumerator.MoveNext()) { AttachableBuilding attachableBuilding2 = (AttachableBuilding)enumerator.Current; if ((UnityEngine.Object)attachableBuilding2 == (UnityEngine.Object)hardPoint.attachedBuilding) { list.Add(attachableBuilding2.gameObject); buildingAttachPoint = attachableBuilding2.GetComponent <BuildingAttachPoint>(); flag = true; } } } finally { IDisposable disposable; if ((disposable = (enumerator as IDisposable)) != null) { disposable.Dispose(); } } } } if (!flag) { buildingAttachPoint = null; } } return(list); }
private static void Postfix(BuildingAttachPoint __instance) { __instance.Unsubscribe((int)GameHashes.UpdateRoom, __instance.RetriggerOnUpdateRoom); }
private static void Prefix(BuildingAttachPoint __instance) { __instance.Unsubscribe((int)GameHashes.UpdateRoom, OnUpdateRoomDelegate); }