Add legacy code for items in tubes
authorNovatux <nathanael.courant@laposte.net>
Thu, 14 Aug 2014 19:18:48 +0000 (21:18 +0200)
committerNovatux <nathanael.courant@laposte.net>
Thu, 14 Aug 2014 19:18:48 +0000 (21:18 +0200)
item_transport.lua

index db4ffb0725167ad713f0bf9448dc0c1a7c2637ae..3a1821746c558472588ecc1be25dbc9ef77140d4 100755 (executable)
@@ -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", {