Fix inverted seat guard in Native_PlayerExitDrone#6
Closed
brandons209 wants to merge 1 commit into
Closed
Conversation
Native_PlayerExitDrone guarded PlayerExitVehicle with `if (!seat.Occupied && !seat.AIControlled)` — copy-pasted from the enter native. A seated player has seat.Occupied == true, so the guard was always false and PlayerExitVehicle never ran: the player was never properly removed from the drone and the resupply/respawn that restores their weapons never fired. Exit should run when the seat IS occupied by a human, so the condition should be `seat.Occupied && !seat.AIControlled`. In-game callers that exit via PlayerExitVehicle directly were unaffected; this only bit consumers using the PlayerExitDrone native to leave a seat. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Problem
Native_PlayerExitDroneguards the exit with the same condition as the enter native:A seated player has
seat.Occupied == true(set byPlayerEnterVehicle), so!seat.Occupiedis alwaysfalseon exit andPlayerExitVehiclenever runs. The player is never properly removed from the seat, and the resupply/respawn thatPlayerExitVehicleschedules (which restores the player's weapons) never fires — the player is left weaponless.This only affects callers that leave a seat through the
PlayerExitDronenative; in-game paths that callPlayerExitVehicledirectly (death,+inspect_server, drone destruction) were unaffected, which is why it went unnoticed.Fix
Exit should run when the seat is occupied by a human:
One-character/condition fix, mirrors the correct intent of the enter native (which correctly requires the seat to be free).
Testing
Reproduced and verified the fix with a plugin that pilots a drone via the natives (a map prop editor): before, exiting via the native left the pilot with no weapons; after, weapons are restored on exit as expected. Normal drone gameplay (direct-exit paths) is unchanged.