Exemplo n.º 1
0
        internal static ChangeResult C4(Player p, BlockID block, ushort x, ushort y, ushort z)
        {
            if (p.level.physics == 0 || p.level.physics == 5)
            {
                return(ChangeResult.Unchanged);
            }

            // Use red wool to detonate c4
            BlockID held = p.BlockBindings[p.ClientHeldBlock];

            if (held == Block.Red)
            {
                p.Message("Placed detonator block, delete it to detonate.");
                return(C4Det(p, Block.C4Detonator, x, y, z));
            }

            if (p.c4circuitNumber == -1)
            {
                sbyte num = C4Physics.NextCircuit(p.level);
                p.level.C4list.Add(new C4Data(num));
                p.c4circuitNumber = num;

                string detonatorName = Block.GetName(p, Block.Red);
                p.Message("Place more blocks for more c4, then place a &c{0} &Sblock for the detonator.",
                          detonatorName);
            }

            C4Data c4 = C4Physics.Find(p.level, p.c4circuitNumber);

            if (c4 != null)
            {
                c4.list.Add(p.level.PosToInt(x, y, z));
            }
            return(p.ChangeBlock(x, y, z, Block.C4));
        }
Exemplo n.º 2
0
        internal static void C4(Player p, ExtBlock block, ushort x, ushort y, ushort z)
        {
            if (p.level.physics == 0 || p.level.physics == 5)
            {
                p.RevertBlock(x, y, z); return;
            }

            // Use red wool to detonate c4
            ExtBlock held = p.BlockBindings[p.RawHeldBlock.RawID];

            if (held.BlockID == Block.Red)
            {
                Player.Message(p, "Placed detonator block, delete it to detonate.");
                C4Det(p, (ExtBlock)Block.C4Detonator, x, y, z); return;
            }

            if (p.c4circuitNumber == -1)
            {
                sbyte num = C4Physics.NextCircuit(p.level);
                p.level.C4list.Add(new C4Data(num));
                p.c4circuitNumber = num;

                string detonatorName = p.level.BlockName((ExtBlock)Block.Red);
                Player.Message(p, "Place more blocks for more c4, then place a &c{0} %Sblock for the detonator.",
                               detonatorName);
            }

            C4Data c4 = C4Physics.Find(p.level, p.c4circuitNumber);

            if (c4 != null)
            {
                c4.list.Add(p.level.PosToInt(x, y, z));
            }
            p.ChangeBlock(x, y, z, (ExtBlock)Block.C4);
        }
Exemplo n.º 3
0
        public override void Use(Player p, string message)
        {
            if (Player.IsSuper(p))
            {
                MessageInGameOnly(p); return;
            }

            if (p.level.physics >= 1 && p.level.physics < 5)
            {
                sbyte  numb = C4Physics.NextCircuit(p.level);
                C4Data c4   = new C4Data(numb);
                p.level.C4list.Add(c4);
                p.c4circuitNumber = numb;
                Player.Message(p, "Place any block for c4 and place a &cred %Sblock for the detonator!");
                p.Blockchange += PlacedNext;
            }
            else
            {
                Player.Message(p, "To use c4, the physics level must be 1, 2, 3 or 4");
            }
        }
Exemplo n.º 4
0
        public override void Use(Player p, string message)
        {
            if (p == null)
            {
                MessageInGameOnly(p); return;
            }

            if (p.level.physics >= 1 && p.level.physics < 5)
            {
                sbyte  numb = C4Physics.NextCircuit(p.level);
                C4Data c4   = new C4Data(numb);
                p.level.C4list.Add(c4);
                p.c4circuitNumber = numb;
                Player.SendMessage(p, "Place any block for c4 and place a " + Colors.red + "red" + Server.DefaultColor + " block for the detonator!");
                p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
            }
            else
            {
                Player.SendMessage(p, "To use c4, the physics level must be 1, 2, 3 or 4");
            }
        }