forge/arma/server/addons/garage/XEH_postInit.sqf
Jacob Schmidt 27c3c5e502 Route sync and notifications through event bus
- add EventBus-backed notification and sync requests with direct RPC fallback
- centralize org notification/sync dispatch and reuse notification helpers
- update economy, store, garage, locker, bank, and CAD flows to emit events
2026-05-15 20:17:19 -05:00

25 lines
798 B
Plaintext

#include "script_component.hpp"
call FUNC(initGarage);
if (isNil QEGVAR(common,EventBus)) then { call EFUNC(common,eventBus); };
if (isNil QGVAR(SyncEventTokens)) then {
private _sendVGarageSync = {
params ["_event"];
private _uid = _event getOrDefault ["uid", ""];
private _patch = _event getOrDefault ["patch", createHashMap];
if (_uid isEqualTo "" || { _patch isEqualTo createHashMap }) exitWith {};
private _player = [_uid] call EFUNC(common,getPlayer);
if (isNull _player) exitWith {};
[CRPC(garage,responseSyncVG), [_patch], _player] call CFUNC(targetEvent);
};
GVAR(SyncEventTokens) = [
EGVAR(common,EventBus) call ["on", ["garage.vgarage.sync.requested", _sendVGarageSync, "garage.vgarage.sync"]]
];
};