Prevent model restoration in unloaded areas
This commit is contained in:
parent
e228ede531
commit
84fe9864a3
3
api.lua
3
api.lua
|
@ -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
|
||||
|
|
3
init.lua
3
init.lua
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue