diff options
author | Gabriel Pérez-Cerezo <gabriel@gpcf.eu> | 2018-07-18 19:29:21 +0200 |
---|---|---|
committer | Gabriel Pérez-Cerezo <gabriel@gpcf.eu> | 2018-07-18 19:29:21 +0200 |
commit | dd13f134fbce8ab7f1cc4a8fed6af8ce28f65359 (patch) | |
tree | e0a75bc4bfb11755e0e766544f70f67bafe67f2f | |
parent | 7da845d1d71e298141cedd252007a7d9577981b2 (diff) |
Fix crash when protecting is not allowed
-rw-r--r-- | init.lua | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -337,6 +337,7 @@ local function protect_area(pos, dir, height, width, owner) areas:save() return id end + minetest.chat_send_player(owner, errMsg) return nil end @@ -449,9 +450,12 @@ minetest.register_node("towercrane:base", { if no_area_violation(owner, pos) then if dir ~= nil then if check_space(table.copy(pos), dir, height, width, owner) then - -- add protection area - meta:set_int("id", protect_area(table.copy(pos), table.copy(dir), height, width, owner)) + -- add protection area + id = protect_area(table.copy(pos), table.copy(dir), height, width, owner) + if id ~= nil then + meta:set_int("id", id) construct_crane(table.copy(pos), table.copy(dir), height, width, owner) + end else chat(owner, "area is protected or too less space to raise up the crane!") end |