forked from VoxeLibre/VoxeLibre
Tune respawn distance limit
This commit is contained in:
parent
cdc2310e23
commit
8eee894429
|
@ -1198,9 +1198,9 @@ function mcl_util.assign_uuid(obj)
|
|||
assert(obj)
|
||||
|
||||
local le = obj:get_luaentity()
|
||||
if le._uuid then return le._uuid end
|
||||
|
||||
if not le._uuid then
|
||||
le._uuid = mcl_util.gen_uuid()
|
||||
end
|
||||
|
||||
-- Update the cache with this new id
|
||||
aoid = mcl_util.get_active_object_id(obj)
|
||||
|
|
|
@ -470,21 +470,20 @@ local function respawn_cart(cart)
|
|||
local d = vector.distance(player:get_pos(), pos)
|
||||
if not distance or d < distance then distance = d end
|
||||
end
|
||||
if not distance or distance > 115 then return end
|
||||
if not distance or distance > 90 then return end
|
||||
|
||||
print("Respawning cart #"..cart.uuid.." at "..tostring(pos)..",distance="..distance)
|
||||
print("Respawning cart #"..cart.uuid.." at "..tostring(pos)..",distance="..distance..",node="..minetest.get_node(pos).name)
|
||||
|
||||
-- Update sequence so that old cart entities get removed
|
||||
cart.seq = (cart.seq or 1) + 1
|
||||
save_cart_data(cart.uuid)
|
||||
|
||||
-- Create the new entity
|
||||
-- Create the new entity and refresh caches
|
||||
local sd = minetest.serialize({ uuid=cart.uuid, seq=cart.seq })
|
||||
local entity = minetest.add_entity(pos, cart_type, sd)
|
||||
local le = entity:get_luaentity()
|
||||
le._seq = cart.seq
|
||||
le._uuid = cart.uuid
|
||||
le._staticdata = cart
|
||||
mcl_util.assign_uuid(entity)
|
||||
|
||||
-- We intentionally don't call the normal hooks because this minecart was already there
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue