public static void Postfix(Constructable __instance) { if (!__instance.TryGetComponent(out Rigidbody rigidbody)) { return; } Vehicle vehicle = __instance.GetComponentInParent <Vehicle>(); if (vehicle != null) { rigidbody.collisionDetectionMode = CollisionDetectionMode.ContinuousSpeculative; return; } Creature creature = __instance.GetComponentInParent <Creature>(); if (creature != null) { rigidbody.collisionDetectionMode = CollisionDetectionMode.ContinuousSpeculative; return; } #if BZ SeaTruckSegment truckSegment = __instance.GetComponentInParent <SeaTruckSegment>(); if (truckSegment != null) { rigidbody.collisionDetectionMode = CollisionDetectionMode.ContinuousSpeculative; return; } #endif }
public void Start() { powerRelay = gameObject.GetComponent <PowerRelay>(); powerRelay.maxOutboundDistance = Main.config.BlueBeamRange; constructable = gameObject.GetComponent <Constructable>(); vehicle = gameObject.GetComponentInParent <Vehicle>(); subRoot = gameObject.GetComponentInParent <SubRoot>(); if (subRoot != null) { if (!subRoot.name.Contains("Cyclops")) { baseConnectionsDisabled = false; } } #if BZ truckSegment = gameObject.GetComponentInParent <SeaTruckSegment>(); #endif if ((vehicle != null || subRoot != null #if BZ || truckSegment != null #endif ) && gameObject.TryGetComponent(out Rigidbody rigidbody)) { GameObject.Destroy(rigidbody); } }
public static void Prefix(SeaTruckSegment __instance) { if (__instance.IsFront() && __instance != lastDestroyed) { lastDestroyed = __instance; List <InventoryItem> equipment = __instance.motor?.upgrades?.modules?.equipment?.Values?.Where((e) => e != null).ToList() ?? new List <InventoryItem>(); Vector3 position = __instance.gameObject.transform.position; Main.SpawnModuleNearby(equipment, position); } }
public static bool Prefix(SeaTruckSegment __instance) { if (__instance.TryGetComponent(out FlyManager manager)) { if (manager.helper.MainCab.transform.position.y > 0) { return(false); } } return(true); }
public static void Prefix(SeaTruckSegment __instance) { //ErrorMessage.AddMessage($"{__instance} {__instance.GetInstanceID()}"); if (__instance.IsFront() && __instance != lastDestroyed) { lastDestroyed = __instance; List <InventoryItem> equipment = __instance.motor?.upgrades?.modules?.equipment.Values?.Where((e) => e != null).ToList() ?? new List <InventoryItem>(); foreach (InventoryItem item in equipment) { GameObject gameObject = CraftData.InstantiateFromPrefab(item.item.GetTechType()); Vector3 position = __instance.gameObject.transform.position; gameObject.transform.position = new Vector3(position.x + UnityEngine.Random.Range(-3, 3), position.y + UnityEngine.Random.Range(5, 8), position.z + UnityEngine.Random.Range(-3, 3)); gameObject.SetActive(true); } } }
internal static void Postfix(SeaTruckSegment __instance) { __instance.gameObject.AddIfNeedComponent <SeaTruckOverDrive>(); }
public static void Prefix(BaseFoundationPiece __instance) { var target = __instance.GetComponentInParent <Base>().gameObject; GameObject finalTarget = null; if (target != null) { var pickupable = target.GetComponentInParent <Pickupable>(); if (pickupable != null) { finalTarget = pickupable.gameObject; } else { var creature = target.GetComponentInParent <Creature>(); if (creature != null) { finalTarget = creature.gameObject; } else { var parent = target.transform.parent; var subRoot = parent != null?parent.GetComponentInParent <SubRoot>() : null; if (subRoot != null) { finalTarget = subRoot.modulesRoot.gameObject; } else { var vehicle = target.GetComponentInParent <Vehicle>(); if (vehicle != null) { finalTarget = vehicle.modulesRoot.gameObject; } else { Component lifePod = #if SN1 target.GetComponentInParent <EscapePod>(); #elif BZ placementTarget.GetComponentInParent <LifepodDrop>(); #endif if (lifePod != null) { finalTarget = lifePod.gameObject; } #if BZ else { SeaTruckSegment seaTruck = placementTarget.GetComponentInParent <SeaTruckSegment>(); if (seaTruck != null) { finalTarget = seaTruck.gameObject; } } #endif } } } } } if (finalTarget != null) { return; } var maxHeight = 0f; var config = Main.Config; switch (__instance.name) { case "BaseRoomAdjustableSupport(Clone)": maxHeight = config.RoomLegs ? 0 : 20f; break; case "BaseMoonpool(Clone)": maxHeight = config.MoonPoolLegs ? 0 : 20f; break; case "BaseFoundationPiece(Clone)": maxHeight = config.FoundationLegs ? 0 : 20f; break; case "BaseCorridorXShapeAdjustableSupport(Clone)": maxHeight = config.XCorridor ? 0 : 20f; break; case "BaseCorridorTShapeAdjustableSupport(Clone)": maxHeight = config.TCorridor ? 0 : 20f; break; case "BaseCorridorLShapeAdjustableSupport(Clone)": maxHeight = config.LCorridor ? 0 : 20f; break; case "BaseCorridorIShapeAdjustableSupport(Clone)": maxHeight = config.ICorridor ? 0 : 20f; break; } __instance.maxPillarHeight = maxHeight; }
public void Awake() { Instance = gameObject.GetComponent <SeaTruckOverDrive>(); ThisSeaTruckSegment = Instance.GetComponent <SeaTruckSegment>(); }