well that should fix /goto

This commit is contained in:
Ben Russell (300178622) 2013-02-01 17:57:08 +13:00
parent 2bf50a379a
commit 69cfacf795

View File

@ -172,15 +172,15 @@ command_register({
prms[1] = tostring(prms[1]) prms[1] = tostring(prms[1])
local x, z local x, z
local success = pcall(function() local success = pcall(function()
x = (string.byte(prms[1]:lower()) - 97) * 64 x = (string.byte(prms[1]:lower()) - 97) * 64 + 32
z = (tonumber(prms[1]:sub(2, 2)) - 1) * 64 z = (tonumber(prms[1]:sub(2, 2)) - 1) * 64 + 32
end) end)
local xlen, _, zlen = common.map_get_dims() local xlen, _, zlen = common.map_get_dims()
if (success and x >= 0 and x < xlen and z >= 0 and z < zlen) then if (success and x >= 0 and x < xlen and z >= 0 and z < zlen) then
local y = common.map_pillar_get(x, z)[1+1] local y = common.map_pillar_get(x, z)[1+1] - 3
plr.set_pos_recv(x, y, z) plr.set_pos_recv(x, y, z)
net_broadcast(nil, common.net_pack("BBhhh", net_broadcast(nil, common.net_pack("BBhhh",
0x03, plrid, x * 32.0, y * 32.0, z * 32.0)) 0x03, plrid, x * 32.0 + 16, y * 32.0, z * 32.0 + 16))
else else
common.net_send(sockfd, common.net_pack("BIz", 0x0E, command_colour_error, "Error: Invalid coordinates")) common.net_send(sockfd, common.net_pack("BIz", 0x0E, command_colour_error, "Error: Invalid coordinates"))
end end
@ -228,4 +228,4 @@ command_register({
commands["help"].func(plr, plrid, sockfd, {"login"}) commands["help"].func(plr, plrid, sockfd, {"login"})
end end
end end
}) })