mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2025-01-09 16:49:35 +01:00
Fix conversion of cart inventories to mod storage without duplicating items
This commit is contained in:
parent
a694675b87
commit
bf3b98021f
1 changed files with 10 additions and 0 deletions
|
@ -178,6 +178,13 @@ function DEFAULT_CART_DEF:on_activate(staticdata, dtime_s)
|
|||
local data = minetest.deserialize(staticdata) or {}
|
||||
if not data.uuid then
|
||||
data.uuid = mcl_util.assign_uuid(self.object)
|
||||
|
||||
if data._items then
|
||||
data.inventory = data._items
|
||||
data._items = nil
|
||||
data._inv_id = nil
|
||||
data._inv_size = nil
|
||||
end
|
||||
end
|
||||
self._seq = data.seq or 1
|
||||
|
||||
|
@ -283,6 +290,9 @@ function DEFAULT_CART_DEF:on_step(dtime)
|
|||
staticdata = make_staticdata()
|
||||
self._staticdata = staticdata
|
||||
end
|
||||
if self._items then
|
||||
self._items = nil
|
||||
end
|
||||
|
||||
-- Update entity position
|
||||
local pos = mod.get_cart_position(staticdata)
|
||||
|
|
Loading…
Reference in a new issue