Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🏇 Server mount removal - Horses, Dragons disappear on rejoin server #397

Closed
Krutoy242 opened this issue Mar 13, 2024 · 4 comments · Fixed by #459
Closed

🏇 Server mount removal - Horses, Dragons disappear on rejoin server #397

Krutoy242 opened this issue Mar 13, 2024 · 4 comments · Fixed by #459
Labels
bug Something isn't working

Comments

@Krutoy242
Copy link

Krutoy242 commented Mar 13, 2024

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

server debug.log

@Krutoy242
Copy link
Author

After 4 hours of of restarting and rejoining server, i finally found the config option.

Discord_uhaf5TLhLN

It was

# Fixes item duplications when players are dropping items and disconnecting
B:"Disconnect Dupe"=true

When this option set to true, mount entities and Nanomachines will be removed on disconnect.

@ACGaming ACGaming added the bug Something isn't working label Mar 13, 2024
@jchung01
Copy link
Contributor

jchung01 commented Mar 13, 2024

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.

@ACGaming
Copy link
Owner

Thanks for the detailed analysis, the tweak needs to be reworked indeed. Limited to client side for now.

@Krutoy242
Copy link
Author

Accidentally closed issue with commit comment. Issue is still actual.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants