TrySpawnLaserFencePylonAt() public static method

public static TrySpawnLaserFencePylonAt ( IntVec3 position, OG_OutpostData &outpostData ) : LaserFence.Building_LaserFencePylon
position IntVec3
outpostData OG_OutpostData
return LaserFence.Building_LaserFencePylon
Beispiel #1
0
        private static void SpawnLaserFenceTwoPylons(IntVec3 laserFenceLeftOrigin, Rot4 rotation, int distanceBetweenPylons, ref OG_OutpostData outpostData)
        {
            OG_Common.TrySpawnLaserFencePylonAt(laserFenceLeftOrigin, ref outpostData);
            OG_Common.TrySpawnLaserFencePylonAt(laserFenceLeftOrigin + new IntVec3(0, 0, distanceBetweenPylons + 1).RotatedBy(rotation), ref outpostData);

            for (int zOffset = 0; zOffset <= 5; zOffset++)
            {
                IntVec3 position = laserFenceLeftOrigin + new IntVec3(0, 0, zOffset).RotatedBy(rotation);
                OG_Common.SpawnFireproofPowerConduitAt(position, ref outpostData);
                Find.TerrainGrid.SetTerrain(position, TerrainDefOf.Concrete);
            }
        }
Beispiel #2
0
 private static void SpawnLaserFenceWithoutEntrance(IntVec3 laserFenceLeftOrigin, Rot4 rotation, ref OG_OutpostData outpostData)
 {
     // Note: the fence is orthogonal to the parameter rotation.
     for (int xOffset = 0; xOffset < Genstep_GenerateOutpost.zoneSideSize; xOffset++)
     {
         IntVec3 position = laserFenceLeftOrigin + new IntVec3(xOffset, 0, 0).RotatedBy(new Rot4(rotation.AsInt));
         if ((xOffset == 0) ||
             (xOffset == Genstep_GenerateOutpost.zoneSideCenterOffset) ||
             (xOffset == Genstep_GenerateOutpost.zoneSideSize - 1))
         {
             OG_Common.TrySpawnLaserFencePylonAt(position, ref outpostData);
         }
         OG_Common.SpawnFireproofPowerConduitAt(position, ref outpostData);
         Find.TerrainGrid.SetTerrain(position, TerrainDefOf.Concrete);
     }
 }
Beispiel #3
0
        private static void SpawnLaserFenceWithEntrance(IntVec3 laserFenceLeftOrigin, Rot4 rotation, int entranceWidth, ref OG_OutpostData outpostData)
        {
            // Note1: the fence is orthogonal to the parameter rotation.
            // Note2: the entrance width must be an odd number.
            int entranceWidthOffset = 1 + (entranceWidth / 2);

            for (int xOffset = 0; xOffset < Genstep_GenerateOutpost.zoneSideSize; xOffset++)
            {
                IntVec3 position = laserFenceLeftOrigin + new IntVec3(xOffset, 0, 0).RotatedBy(new Rot4(rotation.AsInt));
                if ((xOffset == 0) ||
                    (xOffset == Genstep_GenerateOutpost.zoneSideCenterOffset - entranceWidthOffset) ||
                    (xOffset == Genstep_GenerateOutpost.zoneSideCenterOffset + entranceWidthOffset) ||
                    (xOffset == Genstep_GenerateOutpost.zoneSideSize - 1))
                {
                    LaserFence.Building_LaserFencePylon pylon = OG_Common.TrySpawnLaserFencePylonAt(position, ref outpostData);
                    if (pylon != null)
                    {
                        if (xOffset == Genstep_GenerateOutpost.zoneSideCenterOffset - entranceWidthOffset)
                        {
                            if (rotation == Rot4.North)
                            {
                                pylon.ToggleEastFenceStatus();
                            }
                            else if (rotation == Rot4.East)
                            {
                                pylon.ToggleSouthFenceStatus();
                            }
                            else if (rotation == Rot4.South)
                            {
                                pylon.ToggleWestFenceStatus();
                            }
                            else if (rotation == Rot4.West)
                            {
                                pylon.ToggleNorthFenceStatus();
                            }
                            pylon.SwitchLaserFence();
                        }
                        if (xOffset == Genstep_GenerateOutpost.zoneSideCenterOffset + entranceWidthOffset)
                        {
                            if (rotation == Rot4.North)
                            {
                                pylon.ToggleWestFenceStatus();
                            }
                            else if (rotation == Rot4.East)
                            {
                                pylon.ToggleNorthFenceStatus();
                            }
                            else if (rotation == Rot4.South)
                            {
                                pylon.ToggleEastFenceStatus();
                            }
                            else if (rotation == Rot4.West)
                            {
                                pylon.ToggleSouthFenceStatus();
                            }
                            pylon.SwitchLaserFence();
                        }
                    }
                }
                OG_Common.SpawnFireproofPowerConduitAt(position, ref outpostData);
                Find.TerrainGrid.SetTerrain(position, TerrainDefOf.Concrete);
                if (xOffset == Genstep_GenerateOutpost.zoneSideCenterOffset)
                {
                    Find.TerrainGrid.SetTerrain(position, TerrainDef.Named("PavedTile"));
                }
            }
        }