Skip to content

AutoDrive helper continuity - #28

Draft
SimGamerJen wants to merge 12 commits into
mainfrom
agent/fix-autodrive-helper-continuity
Draft

AutoDrive helper continuity#28
SimGamerJen wants to merge 12 commits into
mainfrom
agent/fix-autodrive-helper-continuity

Conversation

@SimGamerJen

@SimGamerJen SimGamerJen commented Aug 11, 2026

Copy link
Copy Markdown
Owner

AutoDrive helper continuity test branch based on main 2.1.0.0 plus the merged management UI fixes.

Root cause investigation showed that the earlier approaches were hooking the wrong lifecycle surfaces. V4 could not access AutoDriveStartStopEvent from HelperProfiles' runtime environment, while the existing HelperProfiles worker-appearance hook consistently receives the exact AutoDrive vehicle/helper pair through Enterable.setRandomVehicleCharacter(vehicle, helper).

V5 therefore uses HP_WorkerAppearance.vehicleAssignments as the authoritative vehicle-to-helper ownership signal. It does not depend on AutoDrive-private globals and does not guess ownership by scanning all mission vehicles.

V5 continuity flow:

  • Observe the proven worker-appearance assignment while an AutoDrive vehicle is active and reserve that exact vehicle/helper pair.
  • Intercept g_helperManager.releaseHelper(helper) and mark the reserved vehicle as pending continuity.
  • If AutoDrive synchronously becomes active again and calls getRandomHelper(), return the released reserved helper before normal HelperProfiles selection.
  • If the vehicle remains inactive into the next update frame, treat it as a genuine AutoDrive stop and clear the reservation.
  • Keep reserved helpers logically active during the short transition so normal selection/overlay state cannot steal them.

HelperPayroll bridge:

  • Adds an optional HP_AutoDrivePayrollBridge consumer of the V5 reservation lifecycle.
  • When a V5 AutoDrive reservation starts, the bridge opens a generic external worker session through HelperPayroll API v5 when available.
  • AutoDrive's internal helper release/reacquire cycles do not touch the payroll session because the V5 reservation remains intact.
  • When V5 genuinely clears the reservation, the bridge ends that external payroll session once.
  • HelperPayroll remains the owner of role/compensation snapshots, duration accounting, billing mode, call-outs, minimums, daily-rate rules and ledger persistence.
  • HelperProfiles continuity remains functional when HelperPayroll or the new external-session capability is absent.

Expected continuity diagnostics:

  • [FS25_HelperProfiles/AutoDriveV5] Source loaded (worker-assignment continuity build)
  • Driver session reserved ... helper='B' ... reason=worker-appearance-assignment
  • Driver release captured ... helper='B'
  • Driver continuity reacquire ... helper='B' ... reason=release-restart
  • [FS25_HelperProfiles] getRandomHelper -> 'B' (autodrive-worker-continuity)

Expected payroll bridge diagnostics with HelperPayroll 0.4.3.0 Alpha 2 feature branch:

  • [FS25_HelperProfiles/AutoDrivePayroll] Payroll session started ... helper='B' slot=B
  • [HelperPayroll/ExternalSession] Started ... controller=AutoDrive helperSlot=B ...
  • internal AutoDrive release/reacquire cycles produce no external-session finish/start pair
  • [HelperPayroll/ExternalSession] Finished ... helperSlot=B ... reason=autodrive-reservation-ended
  • [FS25_HelperProfiles/AutoDrivePayroll] Payroll session ended ... accepted=true

Normal HelperProfiles Selected/Next behaviour remains unchanged. This PR stays draft until the combined AutoDrive + Courseplay continuity/payroll test passes.

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.

1 participant