fix(profile): persist vehicle camouflage, loadout, and trim preferences

Accept the full client-writable hangar/<vehicle> field set emitted by AircraftInfo::serialize (mode 0x20/0x80) in cln_update for owned vehicles: lastSkin, lastWeapon, lastBullets0..5 (strings), and aileronTrim/elevatorTrim/rudderTrim (finite reals). Ownership and server-authoritative hangar fields remain untouched, matching the stock chard guard (2.61.0.37 0x938081) and serializer (2.61.0.37 0x940510, 2.61.0.58 0x942f80).

Extends the camouflage persistence fix from PR #17 to cover weapon presets, ammo belts, and flight trims reported on the same cln_update path. Verified root and launcher typecheck and SaveStore + clientProfile round-trip persistence. In-game acceptance is pending.

Co-authored-by: duduyagame <[email protected]>
This commit is contained in:
N0VAN0M4LYandduduyagame committed 2026-12-04 17:47:09 +08:00
1 parent bc35cc89ab
commit f2e73c1cfe
3 files changed
+52 -2

No files matched your search

@@ -31,6 +31,12 @@ export function addOwnedVehicle(profile: BlkBlock, vehicle: string): void {
if (!hangar.blocks.some((owned) => owned.name === vehicle)) hangar.blocks.push({ name: vehicle, params: [], blocks: [] });
}
/** Update an owned vehicle's hangar entry in place; ignores vehicles the player does not own. */
export function updateOwnedVehicle(profile: BlkBlock, vehicle: string, update: (entry: BlkBlock) => void): void {
const entry = ownedVehicle(profile, vehicle);
if (entry) update(entry);
}
/** The stock client uses the base rank until it has a non-negative selection. */
export function vehicleMrankDelta(profile: BlkBlock, vehicle: string): number {
return Math.max(0, intField(ownedVehicle(profile, vehicle), MRANK_DELTA));