Exemplo n.º 1
0
 public override void OnBlockRemoved(int value, int newValue, int x, int y, int z)
 {
     if (DoorBlock.IsTopPart(base.SubsystemTerrain.Terrain, x, y, z))
     {
         base.SubsystemTerrain.ChangeCell(x, y - 1, z, 0);
     }
     if (DoorBlock.IsBottomPart(base.SubsystemTerrain.Terrain, x, y, z))
     {
         base.SubsystemTerrain.ChangeCell(x, y + 1, z, 0);
     }
 }
Exemplo n.º 2
0
        public override void OnNeighborBlockChanged(int x, int y, int z, int neighborX, int neighborY, int neighborZ)
        {
            int   cellValue = base.SubsystemTerrain.Terrain.GetCellValue(x, y, z);
            int   num       = Terrain.ExtractContents(cellValue);
            Block obj       = BlocksManager.Blocks[num];
            int   data      = Terrain.ExtractData(cellValue);

            if (!(obj is DoorBlock))
            {
                return;
            }
            if (neighborX == x && neighborY == y && neighborZ == z)
            {
                if (DoorBlock.IsBottomPart(base.SubsystemTerrain.Terrain, x, y, z))
                {
                    int value = Terrain.ReplaceData(base.SubsystemTerrain.Terrain.GetCellValue(x, y + 1, z), data);
                    base.SubsystemTerrain.ChangeCell(x, y + 1, z, value);
                }
                if (DoorBlock.IsTopPart(base.SubsystemTerrain.Terrain, x, y, z))
                {
                    int value2 = Terrain.ReplaceData(base.SubsystemTerrain.Terrain.GetCellValue(x, y - 1, z), data);
                    base.SubsystemTerrain.ChangeCell(x, y - 1, z, value2);
                }
            }
            if (DoorBlock.IsBottomPart(base.SubsystemTerrain.Terrain, x, y, z))
            {
                int cellContents = base.SubsystemTerrain.Terrain.GetCellContents(x, y - 1, z);
                if (BlocksManager.Blocks[cellContents].IsTransparent)
                {
                    base.SubsystemTerrain.DestroyCell(0, x, y, z, 0, noDrop: false, noParticleSystem: false);
                }
            }
            if (!DoorBlock.IsBottomPart(base.SubsystemTerrain.Terrain, x, y, z) && !DoorBlock.IsTopPart(base.SubsystemTerrain.Terrain, x, y, z))
            {
                base.SubsystemTerrain.DestroyCell(0, x, y, z, 0, noDrop: false, noParticleSystem: false);
            }
        }