mirror of
https://github.com/luanti-org/minetest_game.git
synced 2025-05-21 06:43:17 -04:00
Update can_interact_with_node function
This change has the can_interact_with_node function check for both owner and protector, this way nodes like doors and chests could be protected as well and opened by many defined players instead of using keys (which still work too :)
This commit is contained in:
parent
0a96bac46d
commit
26bf531096
1 changed files with 10 additions and 2 deletions
|
@ -666,10 +666,18 @@ function default.can_interact_with_node(player, pos)
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local player_name = player:get_player_name()
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local owner = meta:get_string("owner")
|
local owner = meta:get_string("owner") or ""
|
||||||
|
local prot = meta:get_string("protector") or ""
|
||||||
|
|
||||||
if not owner or owner == "" or owner == player:get_player_name() then
|
-- Interaction with protected node
|
||||||
|
if prot ~= "" and owner == "" and not minetest.is_protected(pos, player_name) then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Interaction with owned node
|
||||||
|
if prot = "" and (owner == "" or owner == player_name) then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue