summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHybridDog <ovvv@web.de>2015-11-17 09:09:07 +0100
committerVanessa Ezekowitz <vanessaezekowitz@gmail.com>2015-11-17 07:52:20 -0500
commit352e23cfb12c00b89e4d2b382b7821555203ae4c (patch)
treed55c6c4a1439dcf022be4cfc5f0a0596542bcc06
parent17a83d0474809e8af82c336464ba515bd0ddce7a (diff)
downloadpipeworks-352e23cfb12c00b89e4d2b382b7821555203ae4c.tar
pipeworks-352e23cfb12c00b89e4d2b382b7821555203ae4c.tar.gz
pipeworks-352e23cfb12c00b89e4d2b382b7821555203ae4c.tar.bz2
pipeworks-352e23cfb12c00b89e4d2b382b7821555203ae4c.tar.xz
pipeworks-352e23cfb12c00b89e4d2b382b7821555203ae4c.zip
fix crash caused by deprecated usage of minetest.item_drop, fixes #122
-rw-r--r--item_transport.lua22
1 files changed, 11 insertions, 11 deletions
diff --git a/item_transport.lua b/item_transport.lua
index 0bb315d..e38125d 100644
--- a/item_transport.lua
+++ b/item_transport.lua
@@ -78,7 +78,7 @@ local function go_next(pos, velocity, stack)
if not next_positions[1] then
return false, nil
end
-
+
local n = (cmeta:get_int("tubedir") % (#next_positions)) + 1
if pipeworks.enable_cyclic_mode then
cmeta:set_int("tubedir", n)
@@ -183,7 +183,7 @@ luaentity.register_entity("pipeworks:tubed_item", {
self.itemstring = itemstring
self.item_entity = self:add_attached_entity("pipeworks:tubed_item", itemstring)
end,
-
+
set_color = function(self, color)
if self.color == color then
return
@@ -205,13 +205,13 @@ luaentity.register_entity("pipeworks:tubed_item", {
self.start_pos = vector.round(pos)
self:setpos(pos)
end
-
+
local pos = self:getpos()
local stack = ItemStack(self.itemstring)
local drop_pos
-
+
local velocity = self:getvelocity()
-
+
local moved = false
local speed = math.abs(velocity.x + velocity.y + velocity.z)
if speed == 0 then
@@ -219,12 +219,12 @@ luaentity.register_entity("pipeworks:tubed_item", {
moved = true
end
local vel = {x = velocity.x / speed, y = velocity.y / speed, z = velocity.z / speed, speed = speed}
-
+
if vector.distance(pos, self.start_pos) >= 1 then
self.start_pos = vector.add(self.start_pos, vel)
moved = true
end
-
+
minetest.load_position(self.start_pos)
local node = minetest.get_node(self.start_pos)
if moved and minetest.get_item_group(node.name, "tubedevice_receiver") == 1 then
@@ -243,18 +243,18 @@ luaentity.register_entity("pipeworks:tubed_item", {
self:set_item(leftover:to_string())
return
end
-
+
if moved then
local found_next, new_velocity = go_next(self.start_pos, velocity, stack) -- todo: color
if not found_next then
drop_pos = minetest.find_node_near(vector.add(self.start_pos, velocity), 1, "air")
- if drop_pos then
- minetest.item_drop(stack, "", drop_pos)
+ if drop_pos then
+ minetest.item_drop(stack, nil, drop_pos)
self:remove()
return
end
end
-
+
if new_velocity and not vector.equals(velocity, new_velocity) then
self:setpos(self.start_pos)
self:setvelocity(new_velocity)