Order of OnOwnershipTransferred() and OnPlayerLeft() when another player leaves the instance is now inconsistent
tracked
Sacchan
My vehicles relied on OnOwnershipTransferred() running before OnPlayerLeft() to turn the engines off when a player left the game while piloting.
The way it worked was:
If the master takes ownership while Occupied=true (set false in OnPlayerLeft()) they would know to turn the engine off
This used to be reliable, but now it seems to be random (Only working sometimes), I can find a workaround, but I think this should be consistant, one way or the other.
Suggested fix:
Ownership of all a player's objects should be transferred either before or after the OnPlayerLeft() event is run.
I prefer before, because it lets me know what they were doing when they left.
Additionally, me using OnPlayerLeft() in the first place was a workaround for OnStationExited() not firing when a player leaves while in a station.
canny here:
WORLD FOR TESTING:
wrld_c98d4f48-afb4-4f80-ac86-3f746bc0dcae
Log In
This post was marked as
tracked
Sacchan
This is worse than I thought because there's a brief state where the object has no owner(the playerleft event has run, but the takeownership event hasnt run), so it's impossible to reset synced variables straight away without everyone setting a flag to check when/if they do become owner.
My work around at the moment is to keep the old method I was using before,
+ add bool flag that stays true for one frame when the owner quits and check if it's true when ownership is taken.
One case for each event order, it's a bit silly.