Prevent model restoration in unloaded areas

This commit is contained in:
stujones11 2017-02-11 19:25:19 +00:00
parent e228ede531
commit 84fe9864a3
2 changed files with 5 additions and 1 deletions

View File

@ -315,6 +315,9 @@ meshnode.restore_all = function(parent, name)
local nodedata = {}
for _, ref in pairs(parent.nodes) do
local pos = meshnode.get_map_pos(ref, parent)
if not minetest.get_node_or_nil(pos) then
return
end
if name and minetest.is_protected(pos, name) then
return
end

View File

@ -517,7 +517,8 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
entity.mesh_id = minetest.pos_to_string(pos)
entity:set_activated(false)
else
minetest.chat_send_player(name, S("Protected area").."!")
local msg = S("Protected or unloaded area")
minetest.chat_send_player(name, msg.."!")
end
end
end