Minecarts: Save _railtype in staticdata

This commit is contained in:
Wuzzy 2019-01-30 02:04:12 +01:00
parent b9c197565a
commit 5a1cafa5dd

@ -31,6 +31,10 @@ local function register_entity(entity_id, mesh, textures, drop, on_rightclick)
}
function cart:on_activate(staticdata, dtime_s)
local data = minetest.deserialize(staticdata)
if type(data) == "table" then
self._railtype = data._railtype
end
self.object:set_armor_groups({immortal=1})
end
@ -290,7 +294,7 @@ local function register_entity(entity_id, mesh, textures, drop, on_rightclick)
end
function cart:get_staticdata()
return ""
return minetest.serialize({_railtype = self._railtype})
end
minetest.register_entity(entity_id, cart)