Esempio n. 1
0
        internal static ChangeResult RocketStart(Player p, BlockID old, ushort x, ushort y, ushort z)
        {
            if (p.level.physics < 2 || p.level.physics == 5)
            {
                return(ChangeResult.Unchanged);
            }

            int dx = 0, dy = 0, dz = 0;

            DirUtils.EightYaw(p.Rot.RotY, out dx, out dz);
            DirUtils.Pitch(p.Rot.HeadX, out dy);

            // Looking straight up or down
            byte pitch = p.Rot.HeadX;

            if (pitch >= 192 && pitch <= 196 || pitch >= 60 && pitch <= 64)
            {
                dx = 0; dz = 0;
            }
            Vec3U16 head = new Vec3U16((ushort)(x + dx * 2), (ushort)(y + dy * 2), (ushort)(z + dz * 2));
            Vec3U16 tail = new Vec3U16((ushort)(x + dx), (ushort)(y + dy), (ushort)(z + dz));

            bool headFree = p.level.IsAirAt(head.X, head.Y, head.Z) && p.level.CheckClear(head.X, head.Y, head.Z);
            bool tailFree = p.level.IsAirAt(tail.X, tail.Y, tail.Z) && p.level.CheckClear(tail.X, tail.Y, tail.Z);

            if (headFree && tailFree)
            {
                p.level.Blockchange(head.X, head.Y, head.Z, Block.RocketHead);
                p.level.Blockchange(tail.X, tail.Y, tail.Z, Block.LavaFire);
            }
            return(ChangeResult.Unchanged);
        }
Esempio n. 2
0
        internal static bool RocketStart(Player p, byte block, ushort x, ushort y, ushort z)
        {
            if (p.level.physics < 2 || p.level.physics == 5)
            {
                p.RevertBlock(x, y, z); return(true);
            }

            int dx = 0, dy = 0, dz = 0;

            p.RevertBlock(x, y, z);
            DirUtils.EightYaw(p.rot[0], out dx, out dz);
            DirUtils.Pitch(p.rot[1], out dy);

            // Looking straight up or down
            if (p.rot[1] >= 192 && p.rot[1] <= 196 || p.rot[1] >= 60 && p.rot[1] <= 64)
            {
                dx = 0; dz = 0;
            }

            byte b1 = p.level.GetTile((ushort)(x + dx * 2), (ushort)(y + dy * 2), (ushort)(z + dz * 2));
            byte b2 = p.level.GetTile((ushort)(x + dx), (ushort)(y + dy), (ushort)(z + dz));

            if (b1 == Block.air && b2 == Block.air && p.level.CheckClear((ushort)(x + dx * 2), (ushort)(y + dy * 2), (ushort)(z + dz * 2)) &&
                p.level.CheckClear((ushort)(x + dx), (ushort)(y + dy), (ushort)(z + dz)))
            {
                p.level.Blockchange((ushort)(x + dx * 2), (ushort)(y + dy * 2), (ushort)(z + dz * 2), Block.rockethead);
                p.level.Blockchange((ushort)(x + dx), (ushort)(y + dy), (ushort)(z + dz), Block.lava_fire);
            }
            return(true);
        }
Esempio n. 3
0
        public static void FirstTouch(Player player, byte yaw)
        {
            int VelX;
            int VelZ;

            DirUtils.EightYaw(yaw, out VelX, out VelZ);
            Core.Ball.Kick(new Vector3d(VelX * 4 * 2.5,
                                        VelZ * 4 * 2.5, 0), new Vector3d(0, 0, 0), player);
            if ((int)player.ExtraData["InControl"] < 2)
            {
                player.ExtraData.ChangeOrCreate("InControl", (int)player.ExtraData["InControl"] + 1);
            }
        }
Esempio n. 4
0
        public override void Use(Player p, string message)
        {
            if (Player.IsSuper(p))
            {
                MessageInGameOnly(p); return;
            }
            if (p.level.permissionbuild > p.Rank)
            {
                Player.Message(p, "You cannot build on this map!"); return;
            }

            Level  lvl = p.level;
            ushort x = (ushort)(p.pos[0] / 32), y = (ushort)(p.pos[1] / 32), z = (ushort)(p.pos[2] / 32);

            if (x >= lvl.Width || z >= lvl.Length)
            {
                Player.Message(p, "You must be inside the map to use this command."); return;
            }

            int dirX = 0, dirZ = 0;

            DirUtils.EightYaw(p.rot[0], out dirX, out dirZ);
            DoChain(p, x, y, z, dirX, dirZ);
        }