Пример #1
0
        public override void OnNeighborBlockChanged(int x, int y, int z, int neighborX, int neighborY, int neighborZ)
        {
            int   cellValueFast = base.SubsystemTerrain.Terrain.GetCellValueFast(x, y, z);
            int   num           = Terrain.ExtractContents(cellValueFast);
            int   data          = Terrain.ExtractData(cellValueFast);
            Block block         = BlocksManager.Blocks[num];

            if (block is AttachedSignBlock)
            {
                Point3 point        = CellFace.FaceToPoint3(AttachedSignBlock.GetFace(data));
                int    x2           = x - point.X;
                int    y2           = y - point.Y;
                int    z2           = z - point.Z;
                int    cellContents = base.SubsystemTerrain.Terrain.GetCellContents(x2, y2, z2);
                if (!BlocksManager.Blocks[cellContents].IsCollidable)
                {
                    base.SubsystemTerrain.DestroyCell(0, x, y, z, 0, noDrop: false, noParticleSystem: false);
                }
            }
            else if (block is PostedSignBlock)
            {
                int num2 = PostedSignBlock.GetHanging(data) ? base.SubsystemTerrain.Terrain.GetCellContents(x, y + 1, z) : base.SubsystemTerrain.Terrain.GetCellContents(x, y - 1, z);
                if (!BlocksManager.Blocks[num2].IsCollidable)
                {
                    base.SubsystemTerrain.DestroyCell(0, x, y, z, 0, noDrop: false, noParticleSystem: false);
                }
            }
        }
Пример #2
0
        public override void GetDropValues(SubsystemTerrain subsystemTerrain, int oldValue, int newValue, int toolLevel, List <BlockDropValue> dropValues, out bool showDebris)
        {
            showDebris = true;
            int?color = GetColor(Terrain.ExtractData(oldValue));
            int data  = PostedSignBlock.SetColor(0, color);

            dropValues.Add(new BlockDropValue
            {
                Value = Terrain.MakeBlockValue(m_postedSignBlockIndex, 0, data),
                Count = 1
            });
        }