fixed crash when picking block outside map
This commit is contained in:
parent
544745cc42
commit
0c5c69e695
@ -438,7 +438,9 @@ end
|
|||||||
function map_block_pick(x,y,z)
|
function map_block_pick(x,y,z)
|
||||||
local xlen,ylen,zlen
|
local xlen,ylen,zlen
|
||||||
xlen,ylen,zlen = common.map_get_dims()
|
xlen,ylen,zlen = common.map_get_dims()
|
||||||
|
if x < 0 or x >= xlen then return end
|
||||||
if y < 0 or y >= ylen then return end
|
if y < 0 or y >= ylen then return end
|
||||||
|
if z < 0 or z >= zlen then return end
|
||||||
|
|
||||||
local t = map_pillar_raw_get(x,z)
|
local t = map_pillar_raw_get(x,z)
|
||||||
local c = t[y+1]
|
local c = t[y+1]
|
||||||
|
@ -714,10 +714,12 @@ function new_player(settings)
|
|||||||
if this.tool == TOOL_BLOCK and this.blx3 and this.alive then
|
if this.tool == TOOL_BLOCK and this.blx3 and this.alive then
|
||||||
local ct,cr,cg,cb
|
local ct,cr,cg,cb
|
||||||
ct,cr,cg,cb = map_block_pick(this.blx3, this.bly3, this.blz3)
|
ct,cr,cg,cb = map_block_pick(this.blx3, this.bly3, this.blz3)
|
||||||
this.blk_color = {cr,cg,cb}
|
if ct ~= nil then
|
||||||
common.net_send(nil, common.net_pack("BBBBB",
|
this.blk_color = {cr,cg,cb}
|
||||||
0x18, 0x00,
|
common.net_send(nil, common.net_pack("BBBBB",
|
||||||
this.blk_color[1],this.blk_color[2],this.blk_color[3]))
|
0x18, 0x00,
|
||||||
|
this.blk_color[1],this.blk_color[2],this.blk_color[3]))
|
||||||
|
end
|
||||||
this.ev_rmb = false
|
this.ev_rmb = false
|
||||||
elseif this.tool == TOOL_SPADE and this.blx2 and this.alive then
|
elseif this.tool == TOOL_SPADE and this.blx2 and this.alive then
|
||||||
if (not this.t_newspade2) then
|
if (not this.t_newspade2) then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user