forge/docs/CLIENT_GARAGE_USAGE_GUIDE.md
Jacob Schmidt 89169f1e84 Update documentation and add new client usage guides
- Revised README.md for the Forge Client Example Addon to clarify its purpose as a template.
- Enhanced MODULE_REFERENCE.md to categorize guides into Server and Extension guides and Client guides.
- Created detailed usage guides for various client addons including Actor, Bank, CAD, Garage, Locker, Notifications, Organization, Phone, and Store.
- Added a Client Common Usage Guide to outline shared browser UI bridge patterns.
- Introduced a Client Main Usage Guide to define the foundational elements for client addons.
- Established authoritative state notes and usage rules across new guides to ensure clarity on server ownership and client responsibilities.
2026-04-18 13:04:01 -05:00

2.6 KiB

Client Garage Usage Guide

The client garage addon provides player vehicle storage UI, vehicle store/retrieve actions, vehicle context building, and the virtual garage view.

Open Garage UI

call forge_client_garage_fnc_openUI;

The garage UI opens RscGarage, loads ui/_site/index.html, and routes browser events through forge_client_garage_fnc_handleUIEvents.

Open Virtual Garage

call forge_client_garage_fnc_openVG;

The virtual garage uses mission-configured FORGE_CfgGarages locations to set the spawn/preview position, opens the BIS garage interface, and restricts the available vehicle lists from the virtual garage repository.

Client Services

Service Purpose
GarageRepository Player garage view state.
VGRepository Virtual garage unlock view state.
GarageHelperService Vehicle names, hit points, and payload helpers.
GarageContextService Nearby/current vehicle context.
GaragePayloadService Browser hydrate payload construction.
GarageActionService Store/retrieve request handling.
GarageUIBridge Browser ready, hydrate, and sync delivery.

Browser Events

Event Client behavior
garage::ready Mark browser ready and send garage::hydrate.
garage::refresh Send current garage payload as garage::sync.
garage::vehicle::retrieve::request Forward retrieve request through the action service.
garage::vehicle::store::request Forward store request through the action service.
garage::close Dispose bridge screen state and close the display.

Browser Response Events

Event Purpose
garage::hydrate Initial vehicle and session payload.
garage::sync Refreshed vehicle payload.

Server action responses are handled by the action service and notification flow.

Mission Setup

Garage interactions are normally surfaced through the actor menu when nearby objects have garage variables such as:

_object setVariable ["isGarage", true, true];
_object setVariable ["garageType", "cars", true];

Virtual garage access also requires configured garage locations in mission config so the preview/spawn position can be resolved.

Authoritative State

The client gathers vehicle context and sends store/retrieve requests. Stored vehicle state, validation, spawning, removal, and persistence are owned by the server garage addon and extension.