1
0
Fork 0

Minecarts: Save _railtype in staticdata

This commit is contained in:
Wuzzy 2019-01-30 02:04:12 +01:00
parent b9c197565a
commit 5a1cafa5dd
1 changed files with 5 additions and 1 deletions

View File

@ -31,6 +31,10 @@ local function register_entity(entity_id, mesh, textures, drop, on_rightclick)
} }
function cart:on_activate(staticdata, dtime_s) 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}) self.object:set_armor_groups({immortal=1})
end end
@ -290,7 +294,7 @@ local function register_entity(entity_id, mesh, textures, drop, on_rightclick)
end end
function cart:get_staticdata() function cart:get_staticdata()
return "" return minetest.serialize({_railtype = self._railtype})
end end
minetest.register_entity(entity_id, cart) minetest.register_entity(entity_id, cart)