vehicle paintjob reset on respawn, SeedCookie timing, and NPC vehicle death events#1213
Open
Aesir1337 wants to merge 3 commits intoopenmultiplayer:masterfrom
Open
vehicle paintjob reset on respawn, SeedCookie timing, and NPC vehicle death events#1213Aesir1337 wants to merge 3 commits intoopenmultiplayer:masterfrom
Aesir1337 wants to merge 3 commits intoopenmultiplayer:masterfrom
Conversation
Vehicle paintjob was not being cleared in _respawn() while all other modifications (mods, colours, damage) were properly reset, causing the paintjob to persist after vehicle respawn. Fixes openmultiplayer#1212
… failures RakPeer::Start() internally calls RakPeer::Disconnect() which resets RakNet internal state. SeedCookie() was called before Start(), meaning the seeded cookie was discarded. Clients connecting in the window between server start and the first onTick() re-seed would fail cookie validation and have their packets silently ignored (issue openmultiplayer#1211). Also adds an explanatory comment to the paintjob reset fix.
NPC players have no game client to send vehicle exit or death RPCs, so their vehicles remained permanently "occupied" after dying. The onTick death/respawn path was gated behind !isOccupied(), causing OnVehicleDeath and OnVehicleSpawn to never fire for NPC-driven vehicles. Detect the NPC-only occupied dead case and bypass the occupation check, allowing death events and respawn to proceed normally (respawn already clears the driver pointer via _respawn()). Fixes openmultiplayer#1196
|
@Aesir1337 Thanks a lot, I implemented your SeedCookie solution and so far I haven’t noticed any complaints about connection issues. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
1. Reset paintjob on vehicle respawn (closes #1212)
Vehicle paintjob was not being cleared in
_respawn()alongside other visual properties (mods, colours). After respawn the paintjob persisted, causing a desync between the vehicle's visual state and its server-side data.Fix: Added
paintJob = 0toVehicle::_respawn()invehicle.cpp.2. Move SeedCookie after rakNetServer.Start() (closes #1211)
SeedCookiewas being set before the RakNet server started, which could cause connection failures in certain scenarios.Fix: Moved
SeedCookiecall to afterrakNetServer.Start().3. Fix OnVehicleDeath / OnVehicleSpawn not firing for NPC-driven vehicles (closes #1196)
NPCs don’t send exit/death RPCs, so vehicles stay permanently occupied. This blocks the
onTickrespawn logic and preventsOnVehicleDeath/Spawn, leaving vehicles in a zombie state.Fix: In
VehiclesComponent::onTick()(vehicles_impl.hpp), detect the case where a dead vehicle's only occupant is an NPC driver and bypass the occupation check. The existing_respawn()already clears the driver pointer, so no further changes are needed.