summaryrefslogtreecommitdiff
path: root/item_transport.lua
diff options
context:
space:
mode:
authorZefram <zefram@fysh.org>2014-08-14 21:59:15 +0100
committerNovatux <nathanael.courant@laposte.net>2014-08-15 13:24:52 +0200
commit7915e7f51e8aef77b52c6ad94c5e709456d4958d (patch)
tree7ef9f430b27d26419f3e538fbf8ed113521f2be8 /item_transport.lua
parentb77146f29cd1456dff4a3b9e023e6067e9580318 (diff)
downloadpipeworks-7915e7f51e8aef77b52c6ad94c5e709456d4958d.tar
pipeworks-7915e7f51e8aef77b52c6ad94c5e709456d4958d.tar.gz
pipeworks-7915e7f51e8aef77b52c6ad94c5e709456d4958d.tar.bz2
pipeworks-7915e7f51e8aef77b52c6ad94c5e709456d4958d.tar.xz
pipeworks-7915e7f51e8aef77b52c6ad94c5e709456d4958d.zip
Rename tube_item() to tube_inject_item()
The new function has no API compatibility with the old one, so give it a different name to avoid confusion among caller mods, which need to change their usage. Have a function under the old name that outputs a helpful error message.
Diffstat (limited to 'item_transport.lua')
-rwxr-xr-xitem_transport.lua10
1 files changed, 7 insertions, 3 deletions
diff --git a/item_transport.lua b/item_transport.lua
index 3e0f3b8..02ef5f8 100755
--- a/item_transport.lua
+++ b/item_transport.lua
@@ -4,7 +4,11 @@ local fakePlayer = {
-- perhaps a custom metaclass that errors specially when fakePlayer.<property> is not found?
}
-function pipeworks.tube_item(pos, start_pos, velocity, item)
+function pipeworks.tube_item(pos, item)
+ error("obsolete pipeworks.tube_item() called; change caller to use pipeworks.tube_inject_item() instead")
+end
+
+function pipeworks.tube_inject_item(pos, start_pos, velocity, item)
-- Take item in any format
local stack = ItemStack(item)
local obj = luaentity.add_entity(pos, "pipeworks:tubed_item")
@@ -112,7 +116,7 @@ local function grabAndFire(data,slotseq_mode,filtmeta,frominv,frominvname,frompo
end
local pos = vector.add(frompos, vector.multiply(dir, 1.4))
local start_pos = vector.add(frompos, dir)
- local item1 = pipeworks.tube_item(pos, start_pos, dir, item)
+ local item1 = pipeworks.tube_inject_item(pos, start_pos, dir, item)
return true-- only fire one item, please
end
end
@@ -322,7 +326,7 @@ minetest.register_entity("pipeworks:tubed_item", {
return
end
local item = minetest.deserialize(staticdata)
- pipeworks.tube_item(self.object:getpos(), item.start_pos, item.velocity, item.itemstring)
+ pipeworks.tube_inject_item(self.object:getpos(), item.start_pos, item.velocity, item.itemstring)
self.object:remove()
end,
})