Example #1
0
        public void OnBlockPlaced(int x, int y, int z, byte block)
        {
            if (!Enabled)
            {
                return;
            }

            int index = (y * length + z) * width + x;

            if (block == (byte)Block.Lava)
            {
                Lava.Enqueue(defLavaTick | (uint)index);
            }
            else if (block == (byte)Block.Water)
            {
                Water.Enqueue(defWaterTick | (uint)index);
            }
            else if (block == (byte)Block.Sand || block == (byte)Block.Gravel)
            {
                Falling.Enqueue(defFallingTick | (uint)index);
            }
            else if (block == (byte)Block.TNT)
            {
                Explode(4, x, y, z);
            }
            else if (block == (byte)Block.Sapling)
            {
                GrowTree(x, y, z);
            }
            else if (block == (byte)Block.Sponge)
            {
                PlaceSponge(x, y, z);
            }
        }
        public LiquidPhysics(Game game, Physics physics)
        {
            this.game = game;
            map       = game.World;
            info      = game.BlockInfo;

            physics.OnPlace[Block.Lava] =
                (index, b) => Lava.Enqueue(defLavaTick | (uint)index);
            physics.OnPlace[Block.Water] =
                (index, b) => Water.Enqueue(defWaterTick | (uint)index);
            physics.OnPlace[Block.Sponge]  = PlaceSponge;
            physics.OnDelete[Block.Sponge] = DeleteSponge;

            physics.OnActivate[Block.Water]      = ActivateWater;
            physics.OnActivate[Block.StillWater] = ActivateWater;
            physics.OnActivate[Block.Lava]       = ActivateLava;
            physics.OnActivate[Block.StillLava]  = ActivateLava;
        }
Example #3
0
 void OnPlaceLava(int index, BlockID b)
 {
     Lava.Enqueue(defLavaTick | (uint)index);
 }