๐ Server mount removal - Horses, Dragons disappear on rejoin server
Krutoy242 opened this issue ยท 4 comments
If player leave server being mounted an entity, this entity would just disappear.
- This doesn't happen if UT mod is disabled.
- This doesnt happen on single player.
- Tested on Horses, Hippogryphs, Dragons.
- Setting this two options to
false
doesnt help:Entity Tracker
,Mount Desync
. - This is not recent bug - its about half year old or even older.
- Was very sad to lost my dragon friend. It was my first dragon, so I called him
LostDragon01
๐ฅ
My UT configuration: https://github.com/Krutoy242/Enigmatica2Expert-Extended/blob/master/config/Universal%20Tweaks%20-%20Tweaks.cfg
javaw_YsyhAiG3E0.mp4
I can confirm this happens only when Disconnect Dupe=true
and only on dedicated servers. From debugging, this happens because there exist two consecutive states of player data, where one ends up overwriting the other in UTDisconnectDupe
.
The first state is the player data immediately when the player logs out. This player data passed into PlayerList#playerLoggedOut()
is the correct one, in which player.ridingEntity
still exists and is not null. In that method, the player data with its mount data is correctly saved to disk.
The second state is sometime after playerLoggedOut()
is done executing, which was scheduled to be written to disk here. Because playerLoggedOut()
dismounts the player from its mount, the player data in this state will have player.ridingEntity=null
. This new state of player data is then saved to disk, overwriting the first state. So when the player rejoins, this player data will be read and their mount will be gone.
In other words, the Disconnect Dupe
config option should be default disabled for now as it needs to be reworked. This overwriting of player data corrects a dupe where the player drops item(s) and disconnects while the server is lagging, but it results in a loss of player data as seen here. I assume the data of nanomachines in #398 is also lost because of this.
In the future, one fix for UTDisconnectDupe
may be to only schedule a rewrite of the player's inventory data to disk, so the dupe is prevented, but no other player data is lost.
Thanks for the detailed analysis, the tweak needs to be reworked indeed. Limited to client side for now.