summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZefram <zefram@fysh.org>2014-08-14 22:12:53 +0100
committerNovatux <nathanael.courant@laposte.net>2014-08-15 13:23:41 +0200
commit049129d9b8010f2199f19c5cf3c2cded3262767d (patch)
tree3b4219cf27a6ca77127bc736d843004e19c3141e
parent772c21cb04f647bcd9a75e06162db9db185e499d (diff)
Handle both pipeworks APIs
The new API function is now renamed to pipeworks.tube_inject_item(), so use it under that name. If it is not available, synthesise the new API in terms of the old one.
-rw-r--r--technic/init.lua7
-rw-r--r--technic/machines/HV/quarry.lua2
-rw-r--r--technic/machines/other/injector.lua4
-rw-r--r--technic/machines/register/common.lua2
4 files changed, 11 insertions, 4 deletions
diff --git a/technic/init.lua b/technic/init.lua
index fcd1cd9..28427da 100644
--- a/technic/init.lua
+++ b/technic/init.lua
@@ -4,6 +4,13 @@
technic = technic or {}
+technic.tube_inject_item = pipeworks.tube_inject_item or function (pos, start_pos, velocity, item)
+ local tubed = pipeworks.tube_item(vector.new(pos), item)
+ tubed:get_luaentity().start_pos = vector.new(start_pos)
+ tubed:setvelocity(velocity)
+ tubed:setacceleration(vector.new(0, 0, 0))
+end
+
local load_start = os.clock()
local modpath = minetest.get_modpath("technic")
technic.modpath = modpath
diff --git a/technic/machines/HV/quarry.lua b/technic/machines/HV/quarry.lua
index d75a9e3..10c0ee0 100644
--- a/technic/machines/HV/quarry.lua
+++ b/technic/machines/HV/quarry.lua
@@ -119,7 +119,7 @@ end
local function send_items(items, pos, node)
for _, item in pairs(items) do
- pipeworks.tube_item(pos, pos, vector.new(0, 1, 0), item)
+ technic.tube_inject_item(pos, pos, vector.new(0, 1, 0), item)
end
end
diff --git a/technic/machines/other/injector.lua b/technic/machines/other/injector.lua
index 485974c..eb63987 100644
--- a/technic/machines/other/injector.lua
+++ b/technic/machines/other/injector.lua
@@ -13,7 +13,7 @@ local function inject_items (pos)
local item0=stack:to_table()
if item0 then
item0["count"] = "1"
- pipeworks.tube_item(pos, pos, vector.new(0, -1, 0), item0)
+ technic.tube_inject_item(pos, pos, vector.new(0, -1, 0), item0)
stack:take_item(1)
inv:set_stack("main", i, stack)
return
@@ -28,7 +28,7 @@ local function inject_items (pos)
if stack then
local item0=stack:to_table()
if item0 then
- pipeworks.tube_item(pos, pos, vector.new(0, -1, 0), item0)
+ technic.tube_inject_item(pos, pos, vector.new(0, -1, 0), item0)
stack:clear()
inv:set_stack("main", i, stack)
return
diff --git a/technic/machines/register/common.lua b/technic/machines/register/common.lua
index 366009c..9e847c4 100644
--- a/technic/machines/register/common.lua
+++ b/technic/machines/register/common.lua
@@ -52,7 +52,7 @@ function technic.send_items(pos, x_velocity, z_velocity, output_name)
local item0 = stack:to_table()
if item0 then
item0["count"] = "1"
- pipeworks.tube_item(pos, pos, vector.new(x_velocity, 0, z_velocity), item0)
+ technic.tube_inject_item(pos, pos, vector.new(x_velocity, 0, z_velocity), item0)
stack:take_item(1)
inv:set_stack(output_name, i, stack)
return