mirror of
https://github.com/minetest-mods/drawers.git
synced 2024-11-25 08:03:45 +01:00
Adjust pipeworks support (on insert object) for 2x2 drawers
This commit is contained in:
parent
03e692d72a
commit
ad3bbe8664
@ -109,10 +109,13 @@ function drawers.drawer_on_dig(pos, node, player)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function drawers.drawer_insert_object(pos, node, stack, direction)
|
function drawers.drawer_insert_object(pos, node, stack, direction)
|
||||||
local drawer_visual = drawers.drawer_visuals[core.serialize(pos)]
|
local drawer_visuals = drawers.drawer_visuals[core.serialize(pos)]
|
||||||
if not drawer_visual then return stack end
|
if not drawer_visuals then return stack end
|
||||||
|
|
||||||
local leftover = drawer_visual.try_insert_stack(drawer_visual, stack, true)
|
local leftover = stack
|
||||||
|
for _, visual in pairs(drawer_visuals) do
|
||||||
|
leftover = visual.try_insert_stack(visual, leftover, true)
|
||||||
|
end
|
||||||
return leftover
|
return leftover
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -70,9 +70,17 @@ core.register_entity("drawers:visual", {
|
|||||||
|
|
||||||
-- add self to public drawer visuals
|
-- add self to public drawer visuals
|
||||||
-- this is needed because there is no other way to get this class
|
-- this is needed because there is no other way to get this class
|
||||||
-- only the underlying ObjectRef
|
-- only the underlying LuaEntitySAO
|
||||||
-- PLEASE contact me, if this is wrong
|
-- PLEASE contact me, if this is wrong
|
||||||
drawers.drawer_visuals[core.serialize(self.drawer_pos)] = self
|
local vId = self.visualId
|
||||||
|
if vId == "" then vId = 1 end
|
||||||
|
local posstr = core.serialize(self.drawer_pos)
|
||||||
|
if not drawers.drawer_visuals[posstr] then
|
||||||
|
drawers.drawer_visuals[posstr] = {[vId] = self}
|
||||||
|
else
|
||||||
|
drawers.drawer_visuals[posstr][vId] = self
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
local node = core.get_node(self.drawer_pos)
|
local node = core.get_node(self.drawer_pos)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user