summaryrefslogtreecommitdiff
path: root/pipeworks
diff options
context:
space:
mode:
Diffstat (limited to 'pipeworks')
-rw-r--r--pipeworks/devices.lua2
-rw-r--r--pipeworks/filter-injector.lua19
-rw-r--r--pipeworks/signal_tubes.lua8
3 files changed, 21 insertions, 8 deletions
diff --git a/pipeworks/devices.lua b/pipeworks/devices.lua
index 52f3002..e4c5f43 100644
--- a/pipeworks/devices.lua
+++ b/pipeworks/devices.lua
@@ -3,7 +3,7 @@
local pipereceptor_on = nil
local pipereceptor_off = nil
-if mesecon then
+if minetest.get_modpath("mesecons") then
pipereceptor_on = {
receptor = {
state = mesecon.state.on,
diff --git a/pipeworks/filter-injector.lua b/pipeworks/filter-injector.lua
index bcfcbc9..4c407f6 100644
--- a/pipeworks/filter-injector.lua
+++ b/pipeworks/filter-injector.lua
@@ -12,6 +12,13 @@ end
local function set_filter_formspec(data, meta)
local itemname = data.wise_desc.." Filter-Injector"
+ local exmatch_button = ""
+ if data.stackwise then
+ exmatch_button =
+ fs_helpers.cycling_button(meta, "button[4,3.5;4,1", "exmatch_mode",
+ {"Exact match - off",
+ "Exact match - on "})
+ end
local formspec = "size[8,8.5]"..
"item_image[0,0;1,1;pipeworks:"..data.name.."]"..
"label[1,0;"..minetest.formspec_escape(itemname).."]"..
@@ -21,12 +28,13 @@ local function set_filter_formspec(data, meta)
{"Sequence slots by Priority",
"Sequence slots Randomly",
"Sequence slots by Rotation"})..
+ exmatch_button..
"list[current_player;main;0,4.5;8,4;]"
meta:set_string("formspec", formspec)
end
-- todo SOON: this function has *way too many* parameters
-local function grabAndFire(data,slotseq_mode,filtmeta,frominv,frominvname,frompos,fromnode,filterfor,fromtube,fromdef,dir,fakePlayer,all)
+local function grabAndFire(data,slotseq_mode,exmatch_mode,filtmeta,frominv,frominvname,frompos,fromnode,filterfor,fromtube,fromdef,dir,fakePlayer,all)
local sposes = {}
for spos,stack in ipairs(frominv:get_list(frominvname)) do
local matches
@@ -79,7 +87,11 @@ local function grabAndFire(data,slotseq_mode,filtmeta,frominv,frominvname,frompo
if all then
count = math.min(stack:get_count(), doRemove)
if filterfor.count and filterfor.count > 1 then
- count = math.min(filterfor.count, count)
+ if exmatch_mode ~= 0 and filterfor.count > count then
+ return false
+ else
+ count = math.min(filterfor.count, count)
+ end
end
else
count = 1
@@ -127,13 +139,14 @@ local function punch_filter(data, filtpos, filtnode)
end
if #filters == 0 then table.insert(filters, "") end
local slotseq_mode = filtmeta:get_int("slotseq_mode")
+ local exact_match = filtmeta:get_int("exmatch_mode")
local frommeta = minetest.get_meta(frompos)
local frominv = frommeta:get_inventory()
if fromtube.before_filter then fromtube.before_filter(frompos) end
for _, frominvname in ipairs(type(fromtube.input_inventory) == "table" and fromtube.input_inventory or {fromtube.input_inventory}) do
local done = false
for _, filterfor in ipairs(filters) do
- if grabAndFire(data, slotseq_mode, filtmeta, frominv, frominvname, frompos, fromnode, filterfor, fromtube, fromdef, dir, fakePlayer, data.stackwise) then
+ if grabAndFire(data, slotseq_mode, exact_match, filtmeta, frominv, frominvname, frompos, fromnode, filterfor, fromtube, fromdef, dir, fakePlayer, data.stackwise) then
done = true
break
end
diff --git a/pipeworks/signal_tubes.lua b/pipeworks/signal_tubes.lua
index bfce14a..c7b61ec 100644
--- a/pipeworks/signal_tubes.lua
+++ b/pipeworks/signal_tubes.lua
@@ -58,10 +58,10 @@ if pipeworks.enable_detector_tube then
})
minetest.register_craft( {
- output = "pipeworks:conductor_tube_off_1 6",
+ output = "pipeworks:detector_tube_off_1 2",
recipe = {
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" },
- { "mesecons:mesecon", "mesecons:mesecon", "mesecons:mesecon" },
+ { "mesecons:mesecon", "mesecons_materials:silicon", "mesecons:mesecon" },
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" }
},
})
@@ -99,10 +99,10 @@ if pipeworks.enable_conductor_tube then
})
minetest.register_craft( {
- output = "pipeworks:detector_tube_off_1 2",
+ output = "pipeworks:conductor_tube_off_1 6",
recipe = {
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" },
- { "mesecons:mesecon", "mesecons_materials:silicon", "mesecons:mesecon" },
+ { "mesecons:mesecon", "mesecons:mesecon", "mesecons:mesecon" },
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" }
},
})