diff options
Diffstat (limited to 'deployer.lua')
-rw-r--r-- | deployer.lua | 55 |
1 files changed, 50 insertions, 5 deletions
diff --git a/deployer.lua b/deployer.lua index f65742e..b1b20a0 100644 --- a/deployer.lua +++ b/deployer.lua @@ -92,12 +92,15 @@ local function deployer_on(pos, node) set_detach = delay(), set_bone_position = delay(), } - local stack2 = minetest.item_place(stack, placer, {type="node", under=pos_under, above=pos_above}) - if minetest.setting_getbool("creative_mode") and not minetest.get_modpath("unified_inventory") then --infinite stacks ahoy! - stack2:take_item() + local pointed_thing = {type="node", under=pos_under, above=pos_above} + local stack2 + if minetest.registered_items[stack:get_name()] and minetest.registered_items[stack:get_name()] then + stack2 = minetest.registered_items[stack:get_name()].on_place(stack, placer, pointed_thing) end - invlist[i] = stack2 - inv:set_list("main", invlist) + --if minetest.setting_getbool("creative_mode") and not minetest.get_modpath("unified_inventory") then --infinite stacks ahoy! + -- stack2:take_item() + --end + inv:set_stack("main", i, stack2) return end end @@ -170,6 +173,27 @@ minetest.register_node("pipeworks:deployer_off", { minetest.get_meta(pos):set_string("owner", placer:get_player_name()) end, after_dig_node = pipeworks.scan_for_tube_objects, + 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 + 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 + return stack:get_count() + end }) minetest.register_node("pipeworks:deployer_on", { @@ -234,4 +258,25 @@ minetest.register_node("pipeworks:deployer_on", { minetest.get_meta(pos):set_string("owner", placer:get_player_name()) end, after_dig_node = pipeworks.scan_for_tube_objects, + 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 + 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 + return stack:get_count() + end }) |