From: Novatux Date: Thu, 14 Aug 2014 19:18:48 +0000 (+0200) Subject: Add legacy code for items in tubes X-Git-Url: http://81.2.79.47:8989/gitweb/?a=commitdiff_plain;h=d4e14bc8916e18457f3f3960f5272836d3d65c60;p=zefram%2Fminetest%2Fpipeworks.git Add legacy code for items in tubes --- diff --git a/item_transport.lua b/item_transport.lua index db4ffb0..3a18217 100755 --- a/item_transport.lua +++ b/item_transport.lua @@ -313,7 +313,18 @@ minetest.register_entity("pipeworks:tubed_item", { end, get_staticdata = luaentity.get_staticdata, - on_activate = luaentity.on_activate, + on_activate = function(self, staticdata) -- Legacy code, should be replaced later by luaentity.on_activate + if staticdata == "" or staticdata == nil then + return + end + if staticdata == "toremove" then + self.object:remove() + return + end + local item = minetest.deserialize(staticdata) + pipeworks.tube_item(self.object:getpos(), item.start_pos, item.velocity, item.itemstring) + self.object:remove() + end, }) minetest.register_entity("pipeworks:color_entity", {