Skip to content

Fix startup vehicle cleanup treating all players as offline#148

Open
alexban01 wants to merge 2 commits into
ArmaOverthrow:mainfrom
alexban01:fix/issue-143-vehicle-persistence
Open

Fix startup vehicle cleanup treating all players as offline#148
alexban01 wants to merge 2 commits into
ArmaOverthrow:mainfrom
alexban01:fix/issue-143-vehicle-persistence

Conversation

@alexban01
Copy link
Copy Markdown

@alexban01 alexban01 commented May 3, 2026

Fixes a bug where InitialVehicleCleanup was deleting the player's starting car 5 seconds after game start. The online player check was using OVT_PlayerManagerComponent.GetPlayer() which always returned null at that point due to a startup ordering issue, causing every locked vehicle to be treated as owned by an offline player. Fixed by checking connected players directly via EPF_Utils.GetPlayerUID() instead.

Should resolve #146 and part of #143

RespawnPlayerVehicles was calling EPF_PersistentWorldEntityLoader.Load
(synchronous), which always returns null. Replace with LoadAsync and
an OnVehicleLoaded callback matching the recruit manager pattern.
InitialVehicleCleanup is preserved - vehicles are still despawned on
startup when the owner is offline and respawned on player connect.

Also add null guard in FinalizePlayerPreparation for first-time players
who have no OVT_PlayerData yet.
@alexban01 alexban01 marked this pull request as draft May 3, 2026 18:04
@alexban01 alexban01 force-pushed the fix/issue-143-vehicle-persistence branch from 0b89649 to 1509506 Compare May 3, 2026 19:20
The online check used OVT_PlayerManagerComponent.GetPlayer() which always
returned null at startup - m_mPlayers is reset in Init() and SetupPlayer
is blocked by a chicken-and-egg dependency on GetPersistentIDFromPlayerID.

Replace with IsPlayerOnline() which directly queries EPF_Utils.GetPlayerUID
across all connected players, matching the authoritative EPF identity source.
@alexban01 alexban01 force-pushed the fix/issue-143-vehicle-persistence branch from 1509506 to 515ec6f Compare May 3, 2026 19:21
@alexban01 alexban01 marked this pull request as ready for review May 3, 2026 19:32
@alexban01 alexban01 changed the title Fix vehicle respawn using EPF LoadAsync instead of broken sync Load Fix startup vehicle cleanup treating all players as offline May 3, 2026
@alexban01
Copy link
Copy Markdown
Author

I'm guessing this issue isn't happening on dedicated servers (unless the player somehow manages to connect to the server in the 5 second time window from server started -> cleanup)

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.

Arma overthrow

1 participant