Cleanup debug prints

This commit is contained in:
teknomunk 2024-04-12 19:09:23 +00:00
parent 35bc1b6be4
commit 0ad7ddf2c6
2 changed files with 1 additions and 7 deletions

View file

@ -616,36 +616,30 @@ minetest.register_on_joinplayer(function(player)
local meta = mcl_playerinfo.get_mod_meta(player_name, modname)
local cart_uuid = meta.attached_to
if cart_uuid then
print("Trying to reattach "..player_name.." to cart #"..cart_uuid)
local cartdata = get_cart_data(cart_uuid)
-- Can't get into a cart that was destroyed
if not cartdata then
print("Failed to get cartdata")
return
end
-- Don't reattach players if someone else got in the cart
if cartdata.last_player ~= player_name then
print("Somebody else got in the cart while you were gone")
return
end
minetest.after(0.2,function(player_name, cart_uuid)
local player = minetest.get_player_by_name(player_name)
if not player then
print("Can't get an ObjectRef for "..player_name)
return
end
local cart = mcl_util.get_luaentity_from_uuid(cart_uuid)
if not cart then
print("Can't find the luaentity for cart #"..cart_uuid)
return
end
mod.attach_driver(cart, player)
end, player_name, cart_uuid)
end
end)

View file

@ -33,7 +33,7 @@ mod.detach_minecart = detach_minecart
local function try_detach_minecart(staticdata)
if not staticdata or not staticdata.connected_at then return end
if not mod:is_rail(staticdata.connected_at) then
print("Detaching minecart #"..tostring(staticdata.uuid))
mcl_debug("Detaching minecart #"..tostring(staticdata.uuid))
detach_minecart(staticdata)
end
end