summaryrefslogtreecommitdiff
path: root/filter-injector.lua
diff options
context:
space:
mode:
authorDS <vorunbekannt75@web.de>2017-08-21 00:05:08 +0200
committerVanessa Ezekowitz <vanessaezekowitz@gmail.com>2017-08-20 18:05:08 -0400
commita5e1bfa0e824ab70877803d087c97440ff729cac (patch)
treebe1d7071868d22a23671370f44bb056ae7b14e0b /filter-injector.lua
parentc57a35d5bd5110f0de811c2a9871acf71db72060 (diff)
downloadpipeworks-a5e1bfa0e824ab70877803d087c97440ff729cac.tar
pipeworks-a5e1bfa0e824ab70877803d087c97440ff729cac.tar.gz
pipeworks-a5e1bfa0e824ab70877803d087c97440ff729cac.tar.bz2
pipeworks-a5e1bfa0e824ab70877803d087c97440ff729cac.tar.xz
pipeworks-a5e1bfa0e824ab70877803d087c97440ff729cac.zip
give more possibilities to mods (#194)
* add owner to tubed items * allow custom inventories
Diffstat (limited to 'filter-injector.lua')
-rw-r--r--filter-injector.lua15
1 files changed, 12 insertions, 3 deletions
diff --git a/filter-injector.lua b/filter-injector.lua
index 45b27c4..1f6a90a 100644
--- a/filter-injector.lua
+++ b/filter-injector.lua
@@ -156,7 +156,7 @@ local function grabAndFire(data,slotseq_mode,exmatch_mode,filtmeta,frominv,fromi
end
local pos = vector.add(frompos, vector.multiply(dir, 1.4))
local start_pos = vector.add(frompos, dir)
- local item1 = pipeworks.tube_inject_item(pos, start_pos, dir, item)
+ local item1 = pipeworks.tube_inject_item(pos, start_pos, dir, item, fakePlayer:get_player_name())
return true-- only fire one item, please
end
end
@@ -317,8 +317,17 @@ local function punch_filter(data, filtpos, filtnode, msg)
exact_match = filtmeta:get_int("exmatch_mode")
end
- local frommeta = minetest.get_meta(frompos)
- local frominv = frommeta:get_inventory()
+ local frominv
+ if fromtube.return_input_invref then
+ local pos = vector.add(filtpos, vector.multiply(dir, -1))
+ frominv = fromtube.return_input_invref(pos, fromnode, dir, owner)
+ if not frominv then
+ return
+ end
+ else
+ local frommeta = minetest.get_meta(frompos)
+ frominv = frommeta:get_inventory()
+ end
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