avoid crash on searching invalid nodes

pull/1/head
capitalthree 1 year ago
parent 30868bec31
commit 89e1b8891d
  1. 6
      rules.lua

@ -37,16 +37,18 @@ function check_position(pos)
end
local ret = _check_position_uncached(pos)
print(ret) -- todo: remove this
cache[hash] = ret
return ret
end
function _check_position_uncached(pos)
local node = minetest.get_node(pos)
local reg_item = minetest.registered_items[node.name]
if not reg_item then
return "W"
end
if reg_item.groups and reg_item.groups.go_stone then
return "S" .. reg_item.go_team
end

Loading…
Cancel
Save