mirror of
https://github.com/minetest-mods/more_chests.git
synced 2025-01-09 08:50:18 +01:00
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:
parent
109e6b1fdc
commit
61db871d3f
@ -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)
|
-- pipeworks support (we need to override what is created by gen_def because too generic)
|
||||||
wifi.tube = pipeworks_enabled and {
|
wifi.tube = pipeworks_enabled and {
|
||||||
insert_object = function(pos, node, stack, direction, owner)
|
insert_object = function(pos, node, stack, direction, owner)
|
||||||
|
local wifi_chest_owner
|
||||||
if not owner then
|
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
|
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
|
if not player then
|
||||||
return stack
|
return stack
|
||||||
end
|
end
|
||||||
@ -33,10 +41,18 @@ wifi.tube = pipeworks_enabled and {
|
|||||||
return inv:add_item("more_chests:wifi", stack)
|
return inv:add_item("more_chests:wifi", stack)
|
||||||
end,
|
end,
|
||||||
can_insert = function(pos, node, stack, direction, owner)
|
can_insert = function(pos, node, stack, direction, owner)
|
||||||
|
local wifi_chest_owner
|
||||||
if not owner then
|
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
|
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
|
if not player then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user