Ejemplo n.º 1
0
        public override void OnBlockRemoved(int value, int newValue, int x, int y, int z)
        {
            int num  = Terrain.ExtractContents(value);
            int data = Terrain.ExtractData(value);

            switch (num)
            {
            case 237:
            {
                StopPiston(new Point3(x, y, z));
                int    face2      = PistonBlock.GetFace(data);
                Point3 point2     = CellFace.FaceToPoint3(face2);
                int    cellValue3 = m_subsystemTerrain.Terrain.GetCellValue(x + point2.X, y + point2.Y, z + point2.Z);
                int    num4       = Terrain.ExtractContents(cellValue3);
                int    data4      = Terrain.ExtractData(cellValue3);
                if (num4 == 238 && PistonHeadBlock.GetFace(data4) == face2)
                {
                    m_subsystemTerrain.DestroyCell(0, x + point2.X, y + point2.Y, z + point2.Z, 0, noDrop: false, noParticleSystem: false);
                }
                break;
            }

            case 238:
                if (!m_allowPistonHeadRemove)
                {
                    int    face       = PistonHeadBlock.GetFace(data);
                    Point3 point      = CellFace.FaceToPoint3(face);
                    int    cellValue  = m_subsystemTerrain.Terrain.GetCellValue(x + point.X, y + point.Y, z + point.Z);
                    int    cellValue2 = m_subsystemTerrain.Terrain.GetCellValue(x - point.X, y - point.Y, z - point.Z);
                    int    num2       = Terrain.ExtractContents(cellValue);
                    int    num3       = Terrain.ExtractContents(cellValue2);
                    int    data2      = Terrain.ExtractData(cellValue);
                    int    data3      = Terrain.ExtractData(cellValue2);
                    if (num2 == 238 && PistonHeadBlock.GetFace(data2) == face)
                    {
                        m_subsystemTerrain.DestroyCell(0, x + point.X, y + point.Y, z + point.Z, 0, noDrop: false, noParticleSystem: false);
                    }
                    if (num3 == 237 && PistonBlock.GetFace(data3) == face)
                    {
                        m_subsystemTerrain.DestroyCell(0, x - point.X, y - point.Y, z - point.Z, 0, noDrop: false, noParticleSystem: false);
                    }
                    else if (num3 == 238 && PistonHeadBlock.GetFace(data3) == face)
                    {
                        m_subsystemTerrain.DestroyCell(0, x - point.X, y - point.Y, z - point.Z, 0, noDrop: false, noParticleSystem: false);
                    }
                }
                break;
            }
        }