Exemplo n.º 1
0
        static bool ParseCoords(Player p, string parts, ref byte x, ref byte y, ref byte z)
        {
            string[] coords = parts.SplitSpaces();
            if (coords.Length != 3)
            {
                return(false);
            }

            // TODO: Having to cast to sbyte here is yucky. blockdefs code should be fixed instead
            Vec3S32 P = new Vec3S32((sbyte)x, (sbyte)z, (sbyte)y); // blockdef files have z being height, we use y being height

            if (!CommandParser.GetCoords(p, coords, 0, ref P))
            {
                return(false);
            }

            if (!CommandParser.CheckRange(p, P.X, "X", -127, 127))
            {
                return(false);
            }
            if (!CommandParser.CheckRange(p, P.Y, "Y", -127, 127))
            {
                return(false);
            }
            if (!CommandParser.CheckRange(p, P.Z, "Z", -127, 127))
            {
                return(false);
            }

            // TODO: Improve output message with relative coords (currently shows "Set max for Stone to ~ ~8 ~")
            x = (byte)P.X; z = (byte)P.Y; y = (byte)P.Z; // blockdef files have z being height, we use y being height
            return(true);
        }