1
0
mirror of https://github.com/mt-mods/pipeworks.git synced 2025-06-29 14:50:41 +02:00

add ownership/protection handling for device configuration

take any available ownership into account before deciding on area protection
This commit is contained in:
Tim
2015-03-05 11:14:30 +01:00
parent 86ee58b17c
commit d167aacf4d
7 changed files with 45 additions and 17 deletions

View File

@ -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