Insertion with vacuum pipes

Insertion is now done into the wifi-chest of the player who placed the
wifi chest when the item to be inserted has no owner yet (otherwise, it
is inserted into the wifi-chest of the player who own the item).
This commit is contained in:
Louis 2021-03-06 17:58:27 +01:00
parent 109e6b1fdc
commit 61db871d3f
1 changed files with 20 additions and 4 deletions

View File

@ -22,10 +22,18 @@ wifi.can_dig = function(pos, player) return true end
-- pipeworks support (we need to override what is created by gen_def because too generic)
wifi.tube = pipeworks_enabled and {
insert_object = function(pos, node, stack, direction, owner)
local wifi_chest_owner
if not owner then
return stack
local wifi_chest = minetest.get_meta(pos)
if not wifi_chest then
return stack
end
wifi_chest_owner = wifi_chest:get_string("owner")
if not wifi_chest_owner then
return stack
end
end
local player = minetest.get_player_by_name(owner)
local player = minetest.get_player_by_name(owner or wifi_chest_owner)
if not player then
return stack
end
@ -33,10 +41,18 @@ wifi.tube = pipeworks_enabled and {
return inv:add_item("more_chests:wifi", stack)
end,
can_insert = function(pos, node, stack, direction, owner)
local wifi_chest_owner
if not owner then
return false
local wifi_chest = minetest.get_meta(pos)
if not wifi_chest then
return stack
end
wifi_chest_owner = wifi_chest:get_string("owner")
if not wifi_chest_owner then
return false
end
end
local player = minetest.get_player_by_name(owner)
local player = minetest.get_player_by_name(owner or wifi_chest_owner)
if not player then
return false
end