private void RefreshDiggableCell()
    {
        CellOffset rotatedCellOffset = vision_offset;

        if ((bool)rotatable)
        {
            rotatedCellOffset = rotatable.GetRotatedCellOffset(vision_offset);
        }
        int cell  = Grid.PosToCell(base.transform.gameObject);
        int cell2 = Grid.OffsetCell(cell, rotatedCellOffset);

        Grid.CellToXY(cell2, out int num, out int num2);
        float   num3 = 3.40282347E+38f;
        int     num4 = Grid.InvalidCell;
        Vector3 a    = Grid.CellToPos(cell2);
        bool    flag = false;

        for (int i = 0; i < height; i++)
        {
            for (int j = 0; j < width; j++)
            {
                CellOffset offset = new CellOffset(this.x + j, this.y + i);
                if ((bool)rotatable)
                {
                    offset = rotatable.GetRotatedCellOffset(offset);
                }
                int num5 = Grid.OffsetCell(cell, offset);
                if (Grid.IsValidCell(num5))
                {
                    Grid.CellToXY(num5, out int x, out int y);
                    if (Grid.IsValidCell(num5) && ValidDigCell(num5) && Grid.TestLineOfSight(num, num2, x, y, DigBlockingCB, false))
                    {
                        if (num5 == dig_cell)
                        {
                            flag = true;
                        }
                        Vector3 b    = Grid.CellToPos(num5);
                        float   num6 = Vector3.Distance(a, b);
                        if (num6 < num3)
                        {
                            num3 = num6;
                            num4 = num5;
                        }
                    }
                }
            }
        }
        if (!flag && dig_cell != num4)
        {
            dig_cell          = num4;
            rotation_complete = false;
        }
    }
Example #2
0
            public static void Postfix(ref bool __result, BuildingDef __instance, GameObject source_go, int cell, Orientation orientation, ref string fail_reason)
            {
                if (!__result || source_go == null)
                {
                    return;
                }
                List <ConduitIO> portList = MultiIOExtensions.GetAllPortsFromObject(source_go);

                if (portList.Count == 0)
                {
                    return;
                }

                foreach (ConduitIO port in portList)
                {
                    CellOffset rotatedCellOffset = Rotatable.GetRotatedCellOffset(port.CellOffset, orientation);
                    int        portCell          = Grid.OffsetCell(cell, rotatedCellOffset);
                    //fail_reason is ref, Invoke will modify this array if fail_reason is used
                    object[] parameters = new object[] { source_go, port.ConduitType, portCell, fail_reason };
                    //Debug.Log($"[MultiIO] Are Conduit Ports in Valid Positions?");
                    __result    = (bool)areConduitPortsInValidPositionsMethod.Invoke(__instance, parameters);
                    fail_reason = (string)parameters[3];
                    if (!__result)
                    {
                        return;
                    }
                }
            }
Example #3
0
    public Extents(int cell, CellOffset[] offsets, Orientation orientation)
    {
        int num  = 0;
        int num2 = 0;

        Grid.CellToXY(cell, out num, out num2);
        int num3 = num;
        int num4 = num2;

        for (int i = 0; i < offsets.Length; i++)
        {
            CellOffset rotatedCellOffset = Rotatable.GetRotatedCellOffset(offsets[i], orientation);
            int        val   = 0;
            int        val2  = 0;
            int        cell2 = Grid.OffsetCell(cell, rotatedCellOffset);
            Grid.CellToXY(cell2, out val, out val2);
            num  = Math.Min(num, val);
            num2 = Math.Min(num2, val2);
            num3 = Math.Max(num3, val);
            num4 = Math.Max(num4, val2);
        }
        x      = num;
        y      = num2;
        width  = num3 - num + 1;
        height = num4 - num2 + 1;
    }
Example #4
0
        private int GetActualCell(CellOffset offset)
        {
            Rotatable component = GetComponent <Rotatable>();

            if (component != null)
            {
                offset = component.GetRotatedCellOffset(offset);
            }
            return(Grid.OffsetCell(Grid.PosToCell(transform.GetPosition()), offset));
        }
Example #5
0
    public HandleVector <int> .Handle Add(GameObject go)
    {
        BuildingDef def  = go.GetComponent <Building>().Def;
        int         cell = Grid.PosToCell(go.transform.GetPosition());
        Data        data = default(Data);

        data.cell      = cell;
        data.width     = def.WidthInCells;
        data.height    = def.HeightInCells;
        data.buildRule = def.BuildLocationRule;
        data.solid     = true;
        data.go        = go;
        Data data2 = data;

        HandleVector <int> .Handle h = Add(go, data2);
        if (def.ContinuouslyCheckFoundation)
        {
            Action <object> event_callback = delegate
            {
                OnSolidChanged(h);
            };
            Rotatable   component   = data2.go.GetComponent <Rotatable>();
            Orientation orientation = ((UnityEngine.Object)component != (UnityEngine.Object)null) ? component.GetOrientation() : Orientation.Neutral;
            int         num         = -(def.WidthInCells - 1) / 2;
            int         num2        = def.WidthInCells / 2;
            List <int>  list        = new List <int>();
            for (int i = num; i <= num2; i++)
            {
                CellOffset offset = new CellOffset(i, -1);
                if (def.BuildLocationRule == BuildLocationRule.OnWall)
                {
                    offset = new CellOffset(i - 1, 0);
                }
                else if (def.BuildLocationRule == BuildLocationRule.OnCeiling || def.BuildLocationRule == BuildLocationRule.InCorner)
                {
                    offset = new CellOffset(i, def.HeightInCells);
                }
                CellOffset rotatedCellOffset = Rotatable.GetRotatedCellOffset(offset, orientation);
                int        item = Grid.OffsetCell(cell, rotatedCellOffset);
                list.Add(item);
            }
            Vector2I vector2I  = Grid.CellToXY(list[0]);
            Vector2I vector2I2 = Grid.CellToXY(list[list.Count - 1]);
            float    xmin      = (float)((vector2I.x <= vector2I2.x) ? vector2I.x : vector2I2.x);
            float    xmax      = (float)((vector2I.x >= vector2I2.x) ? vector2I.x : vector2I2.x);
            float    ymin      = (float)((vector2I.y <= vector2I2.y) ? vector2I.y : vector2I2.y);
            float    ymax      = (float)((vector2I.y >= vector2I2.y) ? vector2I.y : vector2I2.y);
            Rect     rect      = Rect.MinMaxRect(xmin, ymin, xmax, ymax);
            data2.solidPartitionerEntry    = GameScenePartitioner.Instance.Add("RequiresFoundation.Add", go, (int)rect.x, (int)rect.y, (int)rect.width + 1, (int)rect.height + 1, GameScenePartitioner.Instance.solidChangedLayer, event_callback);
            data2.buildingPartitionerEntry = GameScenePartitioner.Instance.Add("RequiresFoundation.Add", go, (int)rect.x, (int)rect.y, (int)rect.width + 1, (int)rect.height + 1, GameScenePartitioner.Instance.objectLayers[1], event_callback);
            SetData(h, data2);
            OnSolidChanged(h);
        }
        return(h);
    }
Example #6
0
 public static void Postfix(BuildingDef __instance, int cell, Orientation orientation, ObjectLayer layer, GameObject go)
 {
     foreach (PortDisplay2 portDisplay in __instance.BuildingComplete.GetComponents <PortDisplay2>())
     {
         ConduitType secondaryConduitType2      = portDisplay.type;
         ObjectLayer objectLayerForConduitType4 = Grid.GetObjectLayerForConduitType(secondaryConduitType2);
         CellOffset  rotatedCellOffset8         = Rotatable.GetRotatedCellOffset(portDisplay.offset, orientation);
         int         cell11 = Grid.OffsetCell(cell, rotatedCellOffset8);
         __instance.MarkOverlappingPorts(Grid.Objects[cell11, (int)objectLayerForConduitType4], go);
         Grid.Objects[cell11, (int)objectLayerForConduitType4] = go;
     }
 }
Example #7
0
        //In essence, marks all the locations on a layer specific to each port so that other ports cannot be placed in the same location.
        //(i.e. A gas bridge's input/output cannot be in the same cell of one of these ports if they are a gas port)
        internal void MarkAreas(int cell, Orientation orientation, GameObject go, Action <GameObject, GameObject> overlapCallback)
        {
            List <T> ports = PortList;

            foreach (T port in ports)
            {
                ObjectLayer layer         = Grid.GetObjectLayerForConduitType(port.ConduitType);
                CellOffset  rotatedOffset = Rotatable.GetRotatedCellOffset(port.CellOffset, orientation);
                int         portCell      = Grid.OffsetCell(cell, rotatedOffset);
                overlapCallback(Grid.Objects[portCell, (int)layer], go);
                Grid.Objects[portCell, (int)layer] = go;
            }
        }
Example #8
0
        public void Sim200ms(float dt)
        {
            if (_choreRangeVisualizer.width == Range)
            {
                return;
            }

            _choreRangeVisualizer.x      = -Range / 2;
            _choreRangeVisualizer.y      = 0;
            _choreRangeVisualizer.width  = Range;
            _choreRangeVisualizer.height = Range;

            if (_selectable.IsSelected)
            {
                Traverse.Create(_choreRangeVisualizer).Method("UpdateVisualizers").GetValue();
            }

            var xy     = Grid.CellToXY(this.NaturalBuildingCell());
            var cell   = Grid.XYToCell(xy.x, xy.y + Range / 2);
            var offset = new CellOffset(0, Range / 2);

            if (_rotatable)
            {
                var rotatedCellOffset = _rotatable.GetRotatedCellOffset(offset);
                if (Grid.IsCellOffsetValid(this.NaturalBuildingCell(), rotatedCellOffset))
                {
                    cell = Grid.OffsetCell(this.NaturalBuildingCell(), rotatedCellOffset);
                }
            }

            var extents = new Extents(cell, Range / 2);

            var sensor = Traverse.Create(_logicDuplicantSensor);

            sensor.Field("pickupableExtents").SetValue(extents);
            sensor.Field("pickupRange").SetValue(Range);

            var handle = sensor.Field("pickupablesChangedEntry").GetValue <HandleVector <int> .Handle>();

            GameScenePartitioner.Instance.Free(ref handle);

            sensor.Field("pickupablesChangedEntry").SetValue(GameScenePartitioner.Instance.Add("DuplicantSensor.PickupablesChanged",
                                                                                               gameObject, extents, GameScenePartitioner.Instance.pickupablesChangedLayer, Stuff));

            sensor.Field("pickupablesDirty").SetValue(true);

            void Stuff(object data)
            {
                sensor.Method("OnPickupablesChanged", data).GetValue(data);
            }
        }
    protected override void OnSpawn()
    {
        base.OnSpawn();
        base.OnToggle += OnSwitchToggled;
        UpdateLogicCircuit();
        UpdateVisualState(true);
        RefreshReachableCells();
        wasOn = switchedOn;
        Vector2I   vector2I = Grid.CellToXY(this.NaturalBuildingCell());
        int        cell     = Grid.XYToCell(vector2I.x, vector2I.y + pickupRange / 2);
        CellOffset offset   = new CellOffset(0, pickupRange / 2);

        if ((bool)rotatable)
        {
            offset = rotatable.GetRotatedCellOffset(offset);
            if (Grid.IsCellOffsetValid(this.NaturalBuildingCell(), offset))
            {
                cell = Grid.OffsetCell(this.NaturalBuildingCell(), offset);
            }
        }
        pickupableExtents       = new Extents(cell, pickupRange / 2);
        pickupablesChangedEntry = GameScenePartitioner.Instance.Add("DuplicantSensor.PickupablesChanged", base.gameObject, pickupableExtents, GameScenePartitioner.Instance.pickupablesChangedLayer, OnPickupablesChanged);
        pickupablesDirty        = true;
    }
Example #10
0
        //Frees space for the other ports to be placed
        internal void UnmarkAreas(int cell, Orientation orientation, GameObject go, Action <GameObject, GameObject> overlapCallback)
        {
            List <T> ports = PortList;

            foreach (T port in ports)
            {
                ObjectLayer layer    = Grid.GetObjectLayerForConduitType(port.ConduitType); //Grid.GetObjectLayerForConduitType(port.ConduitType)
                CellOffset  offset   = Rotatable.GetRotatedCellOffset(port.CellOffset, orientation);
                int         portCell = Grid.OffsetCell(cell, offset);
                if (Grid.Objects[portCell, (int)layer] == go)
                {
                    Grid.Objects[portCell, (int)layer] = null;
                }
            }
        }
Example #11
0
 public static void Postfix(BuildingDef __instance, ref bool __result, GameObject source_go, int cell, Orientation orientation, ref string fail_reason)
 {
     if (__result)
     {
         foreach (PortDisplay2 portDisplay in __instance.BuildingComplete.GetComponents <PortDisplay2>())
         {
             CellOffset rotatedCellOffset = Rotatable.GetRotatedCellOffset(portDisplay.offset, orientation);
             int        utility_cell      = Grid.OffsetCell(cell, rotatedCellOffset);
             __result = (bool)NightLib.ReadPrivate.Call(__instance, "IsValidConduitConnection", source_go, portDisplay.type, utility_cell, ref fail_reason);
             if (!__result)
             {
                 return;
             }
         }
     }
 }
 public void DropHeldItems()
 {
     while (storage.Count > 0)
     {
         GameObject gameObject = storage.Drop(storage.items[0], true);
         if ((UnityEngine.Object)rotatable != (UnityEngine.Object)null)
         {
             gameObject.transform.SetPosition(base.transform.GetPosition() + rotatable.GetRotatedCellOffset(dropOffset).ToVector3());
         }
         else
         {
             gameObject.transform.SetPosition(base.transform.GetPosition() + dropOffset.ToVector3());
         }
     }
     smi.GetMaster().GetComponent <Storage>().DropAll(false, false, default(Vector3), true);
 }
Example #13
0
        private bool CanReplace(int cell)
        {
            CellOffset[] placementOffsets = buildingConfig.BuildingDef.PlacementOffsets;

            for (int index = 0; index < placementOffsets.Length; ++index)
            {
                CellOffset rotatedCellOffset = Rotatable.GetRotatedCellOffset(placementOffsets[index], buildingConfig.Orientation);
                int        offsetCell        = Grid.OffsetCell(cell, rotatedCellOffset);

                if (!Grid.IsValidBuildingCell(cell) || Grid.Objects[offsetCell, (int)buildingConfig.BuildingDef.ObjectLayer] == null || Grid.Objects[offsetCell, (int)buildingConfig.BuildingDef.ReplacementLayer] != null)
                {
                    return(false);
                }
            }

            return(true);
        }
Example #14
0
 public static void Postfix(BuildingDef __instance, ref bool __state, ref bool __result, GameObject source_go, int cell, Orientation orientation, ObjectLayer layer, ObjectLayer tile_layer, bool replace_tile, ref string fail_reason)
 {
     if ((layer == ObjectLayer.Gantry || __instance.BuildLocationRule == BuildLocationRule.Tile || __instance.BuildLocationRule == BuildLocationRule.HighWattBridgeTile) &&
         __result)
     {
         for (int i = 0; i < __instance.PlacementOffsets.Length; i++)
         {
             CellOffset offset            = __instance.PlacementOffsets[i];
             CellOffset rotatedCellOffset = Rotatable.GetRotatedCellOffset(offset, orientation);
             int        num = Grid.OffsetCell(cell, rotatedCellOffset);
             if (MyGrid.IsScaffolding(num))
             {
                 __result = false;
                 break;
             }
         }
     }
     else
     {
         if (!__state)
         {
             return;
         }
         if (__result)
         {
             if (Grid.Objects[cell, (int)ObjectLayer.Gantry] != null)
             {
                 __result = false;
             }
         }
     }
     if (!__result)
     {
         fail_reason = UI.TOOLTIPS.HELP_BUILDLOCATION_OCCUPIED;
     }
 }
Example #15
0
    public void RefreshCells()
    {
        placementCells = new int[Def.PlacementOffsets.Length];
        int         cell        = Grid.PosToCell(this);
        Orientation orientation = Orientation;

        for (int i = 0; i < Def.PlacementOffsets.Length; i++)
        {
            CellOffset offset            = Def.PlacementOffsets[i];
            CellOffset rotatedCellOffset = Rotatable.GetRotatedCellOffset(offset, orientation);
            int        num = Grid.OffsetCell(cell, rotatedCellOffset);
            placementCells[i] = num;
        }
        int x = 0;
        int y = 0;

        Grid.CellToXY(placementCells[0], out x, out y);
        int num2 = x;
        int num3 = y;

        int[] array = placementCells;
        foreach (int cell2 in array)
        {
            int x2 = 0;
            int y2 = 0;
            Grid.CellToXY(cell2, out x2, out y2);
            x    = Math.Min(x, x2);
            y    = Math.Min(y, y2);
            num2 = Math.Max(num2, x2);
            num3 = Math.Max(num3, y2);
        }
        extents.x      = x;
        extents.y      = y;
        extents.width  = num2 - x + 1;
        extents.height = num3 - y + 1;
    }
Example #16
0
 public CellOffset GetRotatedOffset(CellOffset offset)
 {
     return((!((UnityEngine.Object)rotatable != (UnityEngine.Object)null)) ? offset : rotatable.GetRotatedCellOffset(offset));
 }
Example #17
0
        private static void Postfix(BuildingDef __instance, ref bool __result, GameObject source_go, int cell, Orientation orientation, ObjectLayer layer, ObjectLayer tile_layer, ref string fail_reason)
        {
            if (!Grid.IsValidCell(cell))
            {
                Debug.Log(" === BuildOverFacilities_BuildingDef_IsAreaClear: cell(cell) not valid = " + cell);
                return;
            }

            bool flag = true;

            //fail_reason = null;
            switch (__instance.BuildLocationRule)
            {
            case BuildLocationRule.Conduit:
            case BuildLocationRule.LogicBridge:
            case BuildLocationRule.NotInTiles:
                return;

            default:
                break;
            }

            if (fail_reason == null ||
                fail_reason != UI.TOOLTIPS.HELP_BUILDLOCATION_OCCUPIED)
            {
                return;
            }

            for (int i = 0; i < __instance.PlacementOffsets.Length; i++)
            {
                CellOffset offset            = __instance.PlacementOffsets[i];
                CellOffset rotatedCellOffset = Rotatable.GetRotatedCellOffset(offset, orientation);
                int        num = Grid.OffsetCell(cell, rotatedCellOffset);

                /*
                 * if (!Grid.IsValidBuildingCell(num))
                 * {
                 *  fail_reason = UI.TOOLTIPS.HELP_BUILDLOCATION_INVALID_CELL;
                 *  flag = false;
                 *  break;
                 * }
                 * if (Grid.Element[num].id == SimHashes.Unobtanium)
                 * {
                 *  fail_reason = null;
                 *  flag = false;
                 *  break;
                 * }
                 */
                if (!Grid.IsValidCell(num))
                {
                    Debug.Log(" === BuildOverFacilities_BuildingDef_IsAreaClear: cell(num) not valid = " + num);
                    return;
                }

                GameObject gameObject = Grid.Objects[num, (int)layer];
                if ((UnityEngine.Object)gameObject != (UnityEngine.Object)null)
                {
                    //Debug.Log(gameObject.PrefabID().ToString());

                    if (!((UnityEngine.Object)gameObject.GetComponent <Wire>() == (UnityEngine.Object)null) && !((UnityEngine.Object)__instance.BuildingComplete.GetComponent <Wire>() == (UnityEngine.Object)null))
                    {
                        break;
                    }
                    //Debug.Log("Flag 1");
                    bool flag2 = false;
                    switch (gameObject.PrefabID().ToString())
                    {
                    case "PropClock":
                    case "PropDesk":
                    case "PropElevator":
                    case "PropFacilityChair":
                    case "PropFacilityChairFlip":
                    case "PropFacilityChandelier":
                    case "PropFacilityCouch":
                    case "PropFacilityDesk":
                    case "PropFacilityDisplay":
                    case "PropFacilityDisplay2":
                    case "PropFacilityDisplay3":
                    case "PropFacilityGlobeDroors":
                    case "PropFacilityHangingLight":
                    case "PropFacilityPainting":
                    case "PropFacilityStatue":
                    case "PropFacilityTable":
                    case "PropFacilityWallDegree":
                    case "PropLight":
                    case "PropReceptionDesk":
                    case "PropSkeleton":
                    case "PropSurfaceSatellite1":
                    case "PropSurfaceSatellite2":
                    case "PropSurfaceSatellite3":
                    case "PropTable":
                    case "PropTallPlant":
                        //__result = true;
                        //fail_reason = null;
                        flag2 = true;
                        break;

                    default:
                        //fail_reason = UI.TOOLTIPS.HELP_BUILDLOCATION_OCCUPIED;
                        //__result = false;
                        flag = false;
                        break;
                    }
                    //fail_reason = UI.TOOLTIPS.HELP_BUILDLOCATION_OCCUPIED;
                    //flag = false;
                    if (!flag2)
                    {
                        break;
                    }
                }
                if (tile_layer != ObjectLayer.NumLayers && (UnityEngine.Object)Grid.Objects[num, (int)tile_layer] != (UnityEngine.Object)null && (UnityEngine.Object)Grid.Objects[num, (int)tile_layer].GetComponent <BuildingPreview>() == (UnityEngine.Object)null)
                {
                    //fail_reason = UI.TOOLTIPS.HELP_BUILDLOCATION_OCCUPIED;
                    //Debug.Log("Flag 2");
                    flag = false;
                    break;
                }
            }

            //Debug.Log("__result: "+ __result+ ", fail_reason:" + fail_reason+", flag: "+flag);

            if (flag)
            {
                __result    = true;
                fail_reason = null;
            }

            //__result = flag && __instance.IsValidConduitLocation(source_go, cell, orientation, out fail_reason) && __instance.AreLogicPortsInValidPositions(source_go, cell, out fail_reason);
        }
    private void UpdateEndCaps()
    {
        int  cell        = Grid.PosToCell(this);
        bool is_visible  = true;
        bool is_visible2 = true;
        bool is_visible3 = true;
        bool is_visible4 = true;

        Grid.CellToXY(cell, out int x, out int y);
        CellOffset offset    = new CellOffset(extents.x - x - 1, 0);
        CellOffset offset2   = new CellOffset(extents.x - x + extents.width, 0);
        CellOffset offset3   = new CellOffset(0, extents.y - y + extents.height);
        CellOffset offset4   = new CellOffset(0, extents.y - y - 1);
        Rotatable  component = GetComponent <Rotatable>();

        if ((bool)component)
        {
            offset  = component.GetRotatedCellOffset(offset);
            offset2 = component.GetRotatedCellOffset(offset2);
            offset3 = component.GetRotatedCellOffset(offset3);
            offset4 = component.GetRotatedCellOffset(offset4);
        }
        int num  = Grid.OffsetCell(cell, offset);
        int num2 = Grid.OffsetCell(cell, offset2);
        int num3 = Grid.OffsetCell(cell, offset3);
        int num4 = Grid.OffsetCell(cell, offset4);

        if (Grid.IsValidCell(num))
        {
            is_visible = !HasTileableNeighbour(num);
        }
        if (Grid.IsValidCell(num2))
        {
            is_visible2 = !HasTileableNeighbour(num2);
        }
        if (Grid.IsValidCell(num3))
        {
            is_visible3 = !HasTileableNeighbour(num3);
        }
        if (Grid.IsValidCell(num4))
        {
            is_visible4 = !HasTileableNeighbour(num4);
        }
        KBatchedAnimController[] componentsInChildren = GetComponentsInChildren <KBatchedAnimController>();
        KBatchedAnimController[] array = componentsInChildren;
        foreach (KBatchedAnimController kBatchedAnimController in array)
        {
            KAnimHashedString[] array2 = leftSymbols;
            foreach (KAnimHashedString symbol in array2)
            {
                kBatchedAnimController.SetSymbolVisiblity(symbol, is_visible);
            }
            KAnimHashedString[] array3 = rightSymbols;
            foreach (KAnimHashedString symbol2 in array3)
            {
                kBatchedAnimController.SetSymbolVisiblity(symbol2, is_visible2);
            }
            KAnimHashedString[] array4 = topSymbols;
            foreach (KAnimHashedString symbol3 in array4)
            {
                kBatchedAnimController.SetSymbolVisiblity(symbol3, is_visible3);
            }
            KAnimHashedString[] array5 = bottomSymbols;
            foreach (KAnimHashedString symbol4 in array5)
            {
                kBatchedAnimController.SetSymbolVisiblity(symbol4, is_visible4);
            }
        }
    }
Example #19
0
        private void UpdateEndCaps()
        {
            int  cell       = Grid.PosToCell(base.gameObject);
            bool is_visible = true;
            //bool is_visible2 = true;
            bool is_visible3 = true;

            //bool is_visible4 = true;
            Grid.CellToXY(cell, out int num, out int num2);
            CellOffset rotatedCellOffset = new CellOffset(this.extents.x - num - 1, 0);
            //CellOffset rotatedCellOffset2 = new CellOffset(this.extents.x - num + this.extents.width, 0);
            CellOffset rotatedCellOffset3 = new CellOffset(0, this.extents.y - num2 + this.extents.height);
            //CellOffset rotatedCellOffset4 = new CellOffset(0, this.extents.y - num2 - 1);
            Rotatable component = base.GetComponent <Rotatable>();

            if (component)
            {
                rotatedCellOffset = component.GetRotatedCellOffset(rotatedCellOffset);
                //rotatedCellOffset2 = component.GetRotatedCellOffset(rotatedCellOffset2);
                rotatedCellOffset3 = component.GetRotatedCellOffset(rotatedCellOffset3);
                //rotatedCellOffset4 = component.GetRotatedCellOffset(rotatedCellOffset4);
            }
            int num3 = Grid.OffsetCell(cell, rotatedCellOffset);
            //int num4 = Grid.OffsetCell(cell, rotatedCellOffset2);
            int num5 = Grid.OffsetCell(cell, rotatedCellOffset3);

            //int num6 = Grid.OffsetCell(cell, rotatedCellOffset4);
            if (Grid.IsValidCell(num5))
            {
                is_visible3 = this.HasTileableNeighbour(num5);
            }
            if (!is_visible3)
            {
                if (Grid.IsValidCell(num3))
                {
                    is_visible = !this.HasTileableNeighbour(num3);
                }
                //if (Grid.IsValidCell(num4))
                //{
                //	is_visible2 = !this.HasTileableNeighbour(num4);
                //}
            }
            else
            {
                is_visible = false;
                //is_visible2 = false;
            }
            if (MyGrid.IsStair(cell))
            {
                if (is_visible)
                {
                    MyGrid.Masks[cell] |= MyGrid.Flags.Walkable;
                }
                else
                {
                    MyGrid.Masks[cell] &= ~MyGrid.Flags.Walkable;
                }
            }
            foreach (KBatchedAnimController kbatchedAnimController in base.GetComponentsInChildren <KBatchedAnimController>())
            {
                foreach (KAnimHashedString symbol in leftSymbols)
                {
                    kbatchedAnimController.SetSymbolVisiblity(symbol, is_visible);
                }
                foreach (KAnimHashedString symbol3 in leftSymbols2)
                {
                    kbatchedAnimController.SetSymbolVisiblity(symbol3, !is_visible);
                }
            }
        }