Skip to content

Fix NPC vehicle death and respawn events - #1279

Open
AmyrAhmady wants to merge 2 commits into
masterfrom
pr-1213-npc-vehicle-death
Open

AmyrAhmady wants to merge 2 commits into
masterfrom
pr-1213-npc-vehicle-death

Conversation

@AmyrAhmady

Copy link
Copy Markdown
Member

Continues the NPC vehicle work from #1213 as a separate review. This branch preserves the contributor's original NPC commit.

The current change bypasses the occupied check for a dead vehicle with an NPC driver and no passengers. Before merging, please address the remaining cases found in review:

  • A vehicle set to low nonzero health (for example 150 HP in NPC doesn't call vehicle events like death or respawn #1196) can explode on clients without the server marking it dead. The NPC continues syncing its stored health.
  • Bot passengers keep the vehicle occupied, so the death and respawn path still does not run.

Related discussion: #1213. Related report: #1196.

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 #1196
@AmyrAhmady
AmyrAhmady changed the base branch from pr-1213-paintjob-cookie to master October 9, 2026 01:12
@AmyrAhmady
AmyrAhmady marked this pull request as ready for review October 9, 2026 01:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants