Beispiel #1
0
        static bool Prefix(BaseFoundationPiece __instance)
        {
            if (!__instance.gameObject.GetComponentInParent <HabitatPlatform.Tag>())
            {
                return(true);
            }

            __instance.pillars.ForEach(pillar => pillar.root.SetActive(false));
            return(false);
        }
Beispiel #2
0
 public static void Prefix(Base __instance)
 {
     if (__instance.gameObject.transform.parent?.name.Contains("(Clone)") ?? false)
     {
         if (__instance.isGhost)
         {
             return;
         }
         Int3.Bounds bounds = __instance.Bounds;
         Int3        mins   = bounds.mins;
         Int3        maxs   = bounds.maxs;
         Int3        cell   = default(Int3);
         for (int i = mins.z; i <= maxs.z; i++)
         {
             cell.z = i;
             for (int j = mins.x; j <= maxs.x; j++)
             {
                 cell.x = j;
                 int k = mins.y;
                 while (k <= maxs.y)
                 {
                     cell.y = k;
                     if (__instance.GetCell(cell) != Base.CellType.Empty)
                     {
                         BaseFoundationPiece componentInChildren = __instance.GetCellObject(cell).GetComponentInChildren <BaseFoundationPiece>();
                         if (componentInChildren != null)
                         {
                             componentInChildren.maxPillarHeight = 0f;
                             break;
                         }
                         break;
                     }
                     else
                     {
                         k++;
                     }
                 }
             }
         }
     }
 }
Beispiel #3
0
        public static void Prefix(BaseFoundationPiece __instance)
        {
            float 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;
        }
Beispiel #4
0
        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;
        }