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 /autocrafter.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 'autocrafter.lua')
-rw-r--r-- | autocrafter.lua | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/autocrafter.lua b/autocrafter.lua index 89559ba..3609068 100644 --- a/autocrafter.lua +++ b/autocrafter.lua @@ -266,6 +266,7 @@ minetest.register_node("pipeworks:autocrafter", { update_meta(meta, false) end, on_receive_fields = function(pos, formname, fields, sender) + if not pipeworks.may_configure(pos, sender) then return end local meta = minetest.get_meta(pos) if fields.on then update_meta(meta, false) @@ -290,6 +291,7 @@ minetest.register_node("pipeworks:autocrafter", { autocrafterCache[minetest.hash_node_position(pos)] = nil end, allow_metadata_inventory_put = function(pos, listname, index, stack, player) + if not pipeworks.may_configure(pos, player) then return 0 end upgrade_autocrafter(pos) local inv = minetest.get_meta(pos):get_inventory() if listname == "recipe" then @@ -305,6 +307,10 @@ minetest.register_node("pipeworks:autocrafter", { return stack:get_count() end, allow_metadata_inventory_take = function(pos, listname, index, stack, player) + if not pipeworks.may_configure(pos, player) then + minetest.log("action", string.format("%s attempted to take from autocrafter at %s", player:get_player_name(), minetest.pos_to_string(pos))) + return 0 + end upgrade_autocrafter(pos) local inv = minetest.get_meta(pos):get_inventory() if listname == "recipe" then @@ -319,6 +325,7 @@ minetest.register_node("pipeworks:autocrafter", { 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 upgrade_autocrafter(pos) local inv = minetest.get_meta(pos):get_inventory() local stack = inv:get_stack(from_list, from_index) |