Esempio 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));
        }
Esempio 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);
        }
Esempio n. 3
0
        internal static bool C4(Player p, byte block, ushort x, ushort y, ushort z)
        {
            if (p.level.physics == 0 || p.level.physics == 5)
            {
                p.RevertBlock(x, y, z); return(false);
            }

            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, Block.c4, 0); return(false);
        }
Esempio n. 4
0
        internal static ChangeResult C4Det(Player p, BlockID block, ushort x, ushort y, ushort z)
        {
            if (p.level.physics == 0 || p.level.physics == 5)
            {
                p.c4circuitNumber = -1;
                return(ChangeResult.Unchanged);
            }

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

            if (c4 != null)
            {
                c4.detIndex = p.level.PosToInt(x, y, z);
            }
            p.c4circuitNumber = -1;
            return(p.ChangeBlock(x, y, z, Block.C4Detonator));
        }
Esempio n. 5
0
        internal static void C4Det(Player p, ExtBlock block, ushort x, ushort y, ushort z)
        {
            if (p.level.physics == 0 || p.level.physics == 5)
            {
                p.c4circuitNumber = -1;
                p.RevertBlock(x, y, z); return;
            }

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

            if (c4 != null)
            {
                c4.detIndex = p.level.PosToInt(x, y, z);
            }
            p.c4circuitNumber = -1;
            p.ChangeBlock(x, y, z, (ExtBlock)Block.C4Detonator);
        }