diff options
author | Weblate <noreply@weblate.org> | 2017-10-27 15:27:05 +0200 |
---|---|---|
committer | Weblate <noreply@weblate.org> | 2017-10-27 15:27:05 +0200 |
commit | 224b146271b2759a2738660c2aa22f5caf1e42af (patch) | |
tree | 56479e2718ba03bb738f1884b0b8c3d0d455153a | |
parent | ea4b968368481f39ed0f4f3a351061e7ae7a7124 (diff) | |
parent | 7d69f7d1a9e81fa76fae93172177e47bc8ac2637 (diff) |
Merge remote-tracking branch 'origin/master'
-rwxr-xr-x | lua/api.lua | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/lua/api.lua b/lua/api.lua index ad32a3f..2bca40c 100755 --- a/lua/api.lua +++ b/lua/api.lua @@ -185,6 +185,17 @@ function drawers.drawer_insert_object(pos, node, stack, direction) return leftover end +function drawers.drawer_can_insert_object(pos, node, stack, direction) + local drawer_visuals = drawers.drawer_visuals[core.serialize(pos)] + if not drawer_visuals then return false end + + local leftover = stack + for _, visual in pairs(drawer_visuals) do + leftover = visual:try_insert_stack(leftover, true) + end + return not (leftover == stack) +end + function drawers.register_drawer(name, def) def.description = def.description or S("Wooden") def.drawtype = "nodebox" @@ -215,7 +226,10 @@ function drawers.register_drawer(name, def) def.groups.tubedevice_receiver = 1 def.tube = def.tube or {} def.tube.insert_object = def.tube.insert_object or - drawers.drawer_insert_object + drawers.drawer_insert_object + def.tube.can_insert = def.tube.can_insert or + drawers.drawer_can_insert_object + def.tube.connect_sides = {left = 1, right = 1, back = 1, top = 1, bottom = 1} def.after_place_node = pipeworks.after_place |