diff options
author | Tim <t4im@users.noreply.github.com> | 2015-03-05 11:14:30 +0100 |
---|---|---|
committer | Tim <t4im@users.noreply.github.com> | 2015-03-11 19:36:41 +0100 |
commit | d167aacf4d2cdcc98914cd05153b81e709e0eaa7 (patch) | |
tree | 5442649cd3416487bfb5e33faa9576884692866f /wielder.lua | |
parent | 86ee58b17c2ec9ad303116cf76cfac354cf0f484 (diff) |
add ownership/protection handling for device configuration
take any available ownership into account before deciding on area protection
Diffstat (limited to 'wielder.lua')
-rw-r--r-- | wielder.lua | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/wielder.lua b/wielder.lua index 88f8e67..8a0e45b 100644 --- a/wielder.lua +++ b/wielder.lua @@ -230,27 +230,18 @@ local function register_wielder(data) pipeworks.scan_for_tube_objects(pos) end, on_punch = data.fixup_node, - allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) - local meta = minetest.get_meta(pos) - if player:get_player_name() ~= meta:get_string("owner") and meta:get_string("owner") ~= "" then - return 0 - end - return count - end, allow_metadata_inventory_put = function(pos, listname, index, stack, player) - local meta = minetest.get_meta(pos) - if player:get_player_name() ~= meta:get_string("owner") and meta:get_string("owner") ~= "" then - return 0 - end + if not pipeworks.may_configure(pos, player) then return 0 end return stack:get_count() end, allow_metadata_inventory_take = function(pos, listname, index, stack, player) - local meta = minetest.get_meta(pos) - if player:get_player_name() ~= meta:get_string("owner") and meta:get_string("owner") ~= "" then - return 0 - end + if not pipeworks.may_configure(pos, player) then return 0 end return stack:get_count() end, + allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) + if not pipeworks.may_configure(pos, player) then return 0 end + return count + end }) end end |