The garage is not one view or one background. It is a lobby route, an engine space, a selected-vehicle presentation, a set of native scene groups, and several CGF systems with separate readiness and teardown. Reliable hangar work identifies which layer owns the state being changed.
Hangar ownership layers
| Layer | Owns | Do not confuse it with |
|---|---|---|
| Lobby state machine | The visible garage route, overlays, and transitions to other lobby scenes. | Proof that the engine space or vehicle model is ready. |
IHangarSpace | The current hangar-space lifecycle, space ID, selected vehicle, readiness events, and input over the 3D scene. | The native
Scaleform Hangar view or the native Hangar engine module. |
| Client hangar space | Space creation, geometry mapping, visibility mask,
hangar configuration, the HangarVehicle entity, and world reveal. | A native subhangar scene group inside that space. |
| Subhangar observer | Route-owned group activation, environment selection, and default-camera handoff. | A replacement hangar path. |
| CGF systems | Cameras, transforms, selectable objects, feature vehicles, lighting helpers, and other scene behavior. | Static geometry alone. |
| Inventory and current-vehicle owners | The selected garage vehicle and its configured descriptor. | The temporary hangar entity or a feature display vehicle. |
Readiness is a conjunction
The current HangarSpace deliberately exposes separate signals. Its service can be
initialized while geometry is loading; the space can exist while the vehicle model is still
rebuilding; a scene group can be active before its CGF anchors or camera components appear.
| Question | Current evidence | Typical gate |
|---|---|---|
| Does the service exist? | IHangarSpace.inited | Dependency resolution only. |
| Can space-owned work run? | spaceInited, a non-null
spaceID, and no active space load. | onSpaceCreate or a
direct current-state check. |
| Is the selected vehicle usable? | isModelLoaded, the vehicle
entity, appearance, collisions, or model required by the task. |
onVehicleChanged plus the exact representation gate. |
| Is a subhangar feature usable? | The group is active and the required CGF system, camera, game object, or transform is present and valid. | A native feature-ready event or a bounded, stale-context-aware retry. |
Space and vehicle lifecycle
Current source fires onSpaceCreating after starting creation. When the engine-space
completion callback runs, it marks spaceInited, fires onSpaceCreate,
reports the hangar-ready milestone, and then completes any separately requested vehicle work.
Vehicle recreation clears isModelLoaded; the vehicle-loaded callback restores it
and fires onVehicleChanged.
- Subscribe once and first inspect the current state so a late subscriber does not miss an already-completed load.
- Bind pending work to the current space ID, selected vehicle identity, and visible route.
- Cancel callbacks before space destruction, account exit, or feature shutdown.
- On a space refresh, discard camera, CGF, entity, appearance, collision, and model references from the previous space.
# Pseudocode — private names are build-dependent.
def try_apply(context):
space = dependency.instance(IHangarSpace)
if not space or not space.spaceInited or space.spaceLoading():
return RETRY
if context.space_id != space.spaceID or not context.route_is_owned():
return STALE
if context.needs_vehicle_model and not space.isModelLoaded:
return RETRY
return apply_to_current_space(space)
Native subhangar groups
Native lobby scenes commonly reuse the current hangar space by activating named groups. The
current SubhangarObserver derives groups from entered lobby-state groups, queues
activation and deactivation, waits for the hangar space, updates the environment, calls the
native Hangar.activateGroup or Hangar.deactivateGroup functions, and
then hands the configured camera to HangarCameraSystem.
- Borrow an existing group only through the current space and route lifecycle; do not infer a standalone space path from a group or feature name.
- Group activation proves only that the activation request ran. Verify any required camera, game object, selection component, or transform separately.
- Keep a native group only while the feature owns the visible scene. A global deactivation block can break the native feature that owns the same group.
- Restore hidden or moved native objects before returning ownership. They may participate in click, preview, camera, or progression behavior.
Route ownership and handoffs
The visible route decides which scene owner should win, but release may need to happen before the destination becomes visible. Customization, Vehicle Hub, armor inspection, missions, previews, and post-battle results may read the normal vehicle bounding box or activate their camera, lighting, environment, and scene groups during the transition.
Garage-owned contexts
The normal hangar and overlays that retain its background can usually keep garage-owned scene state, provided they do not activate another native scene owner.
Native-scene destinations
Release borrowed groups, restore the selected vehicle, and return hidden native objects before the destination consumes hangar state.
Bridge routes
A transition surface may intentionally retain visuals briefly, but only when runtime evidence proves that the destination still receives its full native initialization.
When the visible-route callback is too late, inspect the lobby state machine's navigation request and the destination state's entry path. Patch the narrowest owner and preserve unknown routes, parameters, return values, and other wrappers.
Replacement and synthetic spaces
A replacement garage is a different integration from a native subhangar. Current space creation
resolves the configured default or event path, reads hangar settings, chooses a visibility mask,
creates a hangar BigWorld space and HangarVehicle, maps geometry, initializes
camera state, and reveals the world through the loading flow.
- Apply a default-space override before the account GUI resolves its first hangar; a late override may affect only a later refresh.
- Keep every default-space owner consistent. Another switch controller or event path can restore the native scene during vehicle loading.
- Start from the current default configuration and replace only fields the feature owns, rather than inventing camera, visibility, or vehicle-anchor defaults.
- Use the target mode's intended visibility mask; enabling every layer can reveal incompatible objects.
- Return to a native hangar before routes that require native camera, collision, selection, or feature CGF systems.
Selected vehicle, cameras, and CGF
- The inventory vehicle owns configuration; the hangar entity owns current presentation; a feature display vehicle is a separate CGF object.
- Snapshot the selected vehicle's original transform before moving it and restore it before a native destination computes bounds or placement.
- Resolve
HangarCameraSystemfor the current space only after its mapping is loaded. Its mapping-unload path removes input listeners, camera components, idle/parallax helpers, FOV subscriptions, and retained state. - Check that a named camera exists before switching. Camera names, modes, orbit components, and private parameters are build-dependent.
- Treat CGF game-object validity and required components as separate readiness checks; never retain objects across space destruction.
Cleanup contract
- Cancel every pending callback and invalidate its captured space, route, and vehicle context.
- Unsubscribe space, vehicle, route, input, and camera events with the same handler objects.
- Deactivate only groups owned by the feature and do not remove native groups owned by the destination route.
- Restore vehicle transforms, native-object activity, environment state, visibility masks, camera state, and wrappers only when still owned.
- Make repeated release, refresh, logout, and shutdown paths idempotent.
Hangar diagnostics
| Symptom | Likely ownership error | Inspect |
|---|---|---|
| Scene loads and then snaps back | Only one default-space owner was changed. | Event paths, switch-controller defaults, initial account-GUI resolve, and refresh. |
| Wrong lighting after returning | A previous group released late or new camera work ran before native teardown settled. | Route entry/exit order, group sets, environment, and pending callbacks. |
| Vehicle overlaps a feature vehicle | Selected entity and native CGF display object were treated as the same object. | Both transforms, object activity, and restoration order. |
| Customization or armor view is blank | The destination initialized while a replacement or borrowed scene still owned required hangar state. | Navigation request timing, native space readiness, vehicle AABB, and destination groups. |
| Camera switch silently fails | The camera component is absent or belongs to another space mapping. | Current space ID, camera system, named-camera existence, and mapping lifecycle. |
| Feature works only after reopening | The first attempt ran before CGF objects or vehicle/model readiness. | Ready event, bounded retry, stale-context checks, and the exact missing component. |
Verification checklist
- Trace current space-path selection and the exact readiness event.
- Trace lobby state registration, navigation request, entered states, and visible-route change.
- Inspect subhangar group configuration, activation/deactivation callers, environment, and camera ownership.
- Verify selected-vehicle identity, model, appearance, collisions, and transform separately.
- Exercise cold login, warm refresh, vehicle change, every native scene destination, battle return, logout, and shutdown.
- Label group names, route IDs, cameras, CGF components, and private hooks as version-sensitive.