示例#1
0
        static void DoTntLavaEffect(int prob1, int prob2, Vector3I pos, Block target)
        {
            int effect = rnd.Next(100);

            if (effect >= prob1)
            {
                map.QueueUpdate(new BlockUpdate(Player.Console, pos, Block.Lava));
                lock (lavaLock)
                    Lava.Add(pos);
            }
            else if (effect >= prob2)
            {
                map.QueueUpdate(new BlockUpdate(Player.Console, pos, target));
            }
        }
示例#2
0
        static void HandleTNT(Player player, Vector3I coords)
        {
            for (int i = 0; i < 20; i++)
            {
                int      rndX = rnd.Next(-2, 3), rndY = rnd.Next(-2, 3), rndZ = rnd.Next(-2, 3);
                Vector3I pos = new Vector3I(coords.X + rndX, coords.Y + rndY, coords.Z + rndZ);
                if (pos == RedTeam.FlagPos)
                {
                    continue;
                }
                if (pos == BlueTeam.FlagPos)
                {
                    continue;
                }
                Block block = world.map.GetBlock(pos);
                if (block == Block.Water || block == Block.None)
                {
                    continue;
                }

                if (i < 3)
                {
                    if (block == RedTeam.FlagBlock || block == BlueTeam.FlagBlock)
                    {
                        DoTntLavaEffect(99, 75, pos, Block.Stone);
                    }
                    else if (block == Block.Stone)
                    {
                        DoTntLavaEffect(99, 75, pos, Block.Cobblestone);
                    }
                    else if (block == Block.Cobblestone)
                    {
                        DoTntLavaEffect(99, 75, pos, Block.Gravel);
                    }
                    else if (block == Block.Gravel)
                    {
                        DoTntLavaEffect(99, 75, pos, Block.Air);
                    }
                    else if (block == Block.Grass)
                    {
                        DoTntLavaEffect(75, 25, pos, Block.Dirt);
                    }
                    else if (!(block == Block.Water || block == Block.Lava))
                    {
                        world.Map.QueueUpdate(new BlockUpdate(Player.Console, pos, Block.Lava));
                        lock (lavaLock)
                            Lava.Add(pos);
                    }
                }
                else
                {
                    if (block == RedTeam.FlagBlock || block == BlueTeam.FlagBlock)
                    {
                        DoTntEffect(99, pos, Block.Stone);
                    }
                    else if (block == Block.Stone)
                    {
                        DoTntEffect(99, pos, Block.Cobblestone);
                    }
                    else if (block == Block.Cobblestone)
                    {
                        DoTntEffect(99, pos, Block.Gravel);
                    }
                    else if (block == Block.Gravel)
                    {
                        DoTntEffect(99, pos, Block.Air);
                    }
                    else if (block == Block.Grass)
                    {
                        DoTntEffect(33, pos, Block.Dirt);
                    }
                }
            }
            KillExplosion(player, coords);
            world.Map.QueueUpdate(new BlockUpdate(Player.Console, coords, Block.Air));
            world.Map.ProcessUpdates();
        }