Exemplo n.º 1
0
    public void OnDelete(int x, int y, int z)
    {
        switch (ID)
        {
        case BlockID.Water:
            if (Map.GetBlockSafe(x, y + 1, z).IsFluid())
            {
                Map.SetBlock(x, y, z, new Block(BlockID.Water, FluidSimulator.MaxFluidLevel));
                return;
            }
            else
            {
                FluidSimulator.RemoveFluidAndUnflow(x, y, z, this);
                break;
            }

        default:
            for (int i = 0; i < Vector3i.directions.Length; i++)
            {
                Vector3i dir = Vector3i.directions[i];

                int facing;

                Block block = Map.GetBlockSafe(x + dir.x, y + dir.y, z + dir.z);

                if (block.IsAttached(out facing))
                {
                    if (dir.GetNormalDirection() == facing)
                    {
                        Map.SetBlock(x + dir.x, y + dir.y, z + dir.z, new Block(BlockID.Air));
                    }
                }
            }

            FluidSimulator.TryFlowSurrounding(x, y, z);
            break;
        }
    }