diff options
Diffstat (limited to 'pipeworks')
-rw-r--r-- | pipeworks/default_settings.txt | 1 | ||||
-rw-r--r-- | pipeworks/filter-injector.lua | 19 | ||||
-rw-r--r-- | pipeworks/item_transport.lua | 25 |
3 files changed, 37 insertions, 8 deletions
diff --git a/pipeworks/default_settings.txt b/pipeworks/default_settings.txt index 41a3f7a..b1aa331 100644 --- a/pipeworks/default_settings.txt +++ b/pipeworks/default_settings.txt @@ -19,5 +19,6 @@ pipeworks.enable_mese_sand_tube = true pipeworks.enable_one_way_tube = true pipeworks.enable_priority_tube = true pipeworks.enable_cyclic_mode = true +pipeworks.drop_on_routing_fail = false pipeworks.delete_item_on_clearobject = true diff --git a/pipeworks/filter-injector.lua b/pipeworks/filter-injector.lua index 3427894..6f3271f 100644 --- a/pipeworks/filter-injector.lua +++ b/pipeworks/filter-injector.lua @@ -175,6 +175,25 @@ local function punch_filter(data, filtpos, filtnode, msg) local fromdef = minetest.registered_nodes[fromnode.name] if not fromdef then return end local fromtube = fromdef.tube + local input_special_cases = { + ["technic:mv_furnace"] = "dst", + ["technic:mv_furnace_active"] = "dst", + ["technic:mv_electric_furnace"] = "dst", + ["technic:mv_electric_furnace_active"] = "dst", + ["technic:mv_alloy_furnace"] = "dst", + ["technic:mv_alloy_furnace_active"] = "dst", + ["technic:mv_centrifuge"] = "dst", + ["technic:mv_centrifuge_active"] = "dst", + ["technic:mv_compressor"] = "dst", + ["technic:mv_compressor_active"] = "dst", + ["technic:mv_extractor"] = "dst", + ["technic:mv_extractor_active"] = "dst", + ["technic:mv_grinder"] = "dst", + ["technic:mv_grinder_active"] = "dst", + ["technic:tool_workshop"] = "src", + } + + if fromtube then fromtube.input_inventory = input_special_cases[fromnode.name] or fromtube.input_inventory end if not (fromtube and fromtube.input_inventory) then return end local slotseq_mode diff --git a/pipeworks/item_transport.lua b/pipeworks/item_transport.lua index ee17611..ab1ce55 100644 --- a/pipeworks/item_transport.lua +++ b/pipeworks/item_transport.lua @@ -246,15 +246,24 @@ luaentity.register_entity("pipeworks:tubed_item", { if moved then local found_next, new_velocity = go_next(self.start_pos, velocity, stack) -- todo: color + local rev_vel = vector.multiply(velocity, -1) + local rev_dir = vector.direction(self.start_pos,vector.add(self.start_pos,rev_vel)) + local rev_node = minetest.get_node(vector.round(vector.add(self.start_pos,rev_dir))) + local tube_present = minetest.get_item_group(rev_node.name,"tubedevice") == 1 if not found_next then - drop_pos = minetest.find_node_near(vector.add(self.start_pos, velocity), 1, "air") - if drop_pos then - -- Using add_item instead of item_drop since this makes pipeworks backward - -- compatible with Minetest 0.4.13. - -- Using item_drop here makes Minetest 0.4.13 crash. - minetest.add_item(drop_pos, stack) - self:remove() - return + if pipeworks.drop_on_routing_fail or not tube_present then + drop_pos = minetest.find_node_near(vector.add(self.start_pos, velocity), 1, "air") + if drop_pos then + -- Using add_item instead of item_drop since this makes pipeworks backward + -- compatible with Minetest 0.4.13. + -- Using item_drop here makes Minetest 0.4.13 crash. + minetest.add_item(drop_pos, stack) + self:remove() + return + end + else + velocity = vector.multiply(velocity, -1) + self:setvelocity(velocity) end end |