hey! ran into something recently on our dedicated server and was digging through the code to see what happened, but wanted to ask here in case i'm misunderstanding how this works.
sometimes when a player's game crashes, they log back in and find themselves teleported all the way back to their bed or world spawn instead of near where they were when they crashed (even though their inventory and skills saved fine from the auto-save).
i was looking at ClientSide.cs and saw the ForceSavingPosition patch on Game.SavePlayerProfile:
if (ZNet.m_world == null || __instance.m_playerProfile.HaveLogoutPoint())
{
originalValue = true;
return;
}
i might be mistaken, but isn't ZNet.m_world always null on clients when connected to a dedicated server?
if that's the case, wouldn't this check always return early on clients during periodic auto-saves, meaning setLogoutPoint = true never actually happens? and then if the client crashes (so normal clean logout never runs), the server never gets their field position and valheim just defaults to sending them back to their bed?
would changing ZNet.m_world == null to something like Player.m_localPlayer == null make it so auto-saves actually save their position in case of a crash? or was ZNet.m_world == null checking for something specific here that i'm missing?
thanks a bunch for the mod!
hey! ran into something recently on our dedicated server and was digging through the code to see what happened, but wanted to ask here in case i'm misunderstanding how this works.
sometimes when a player's game crashes, they log back in and find themselves teleported all the way back to their bed or world spawn instead of near where they were when they crashed (even though their inventory and skills saved fine from the auto-save).
i was looking at
ClientSide.csand saw theForceSavingPositionpatch onGame.SavePlayerProfile:i might be mistaken, but isn't ZNet.m_world always null on clients when connected to a dedicated server?
if that's the case, wouldn't this check always return early on clients during periodic auto-saves, meaning setLogoutPoint = true never actually happens? and then if the client crashes (so normal clean logout never runs), the server never gets their field position and valheim just defaults to sending them back to their bed?
would changing ZNet.m_world == null to something like Player.m_localPlayer == null make it so auto-saves actually save their position in case of a crash? or was ZNet.m_world == null checking for something specific here that i'm missing?
thanks a bunch for the mod!