Policy merge, arsenal build, restore
Wardrobe and loadout policy internals
A server-published policy plus a client-side arsenal builder. Missions can offer a full arsenal, a curated one or the mission loadout, with electronics filtering and loadout preservation on re-entry.
1. Policy resolution
wardrobeGetConfig starts from hard defaults, then merges, in order:
server-published FF_horror_wardrobePolicy, mission FF_horror_wardrobeConfig, and local
overrides passed by the caller. Every key is type-checked against its default, so a malformed mission value is ignored
instead of breaking the wardrobe. Aliases are normalized (restricted → mission,
all → full, booleans → once/never).
wardrobeSetConfig publishes a policy from the server and raises the revision counter; clients clear their
caches and re-apply starting gear. wardrobeReset does the same locally.
2. Opening
wardrobeOpen runs with spawn: it validates the destination, plays the optional VR effect,
blackouts for blackout seconds, teleports the player, optionally restores a saved loadout, sanitizes
electronics, builds the item list and opens ACE Arsenal. Any exit path restores blackout and re-enables entry.
3. Item list construction
autoCompatible keeps only items that fit the current weapon and slot set, which prevents the arsenal from
offering unusable magazines. In mission mode the mission loadout, NATO defaults and (optionally) custom
gear form the pool. Electronics restrictions remove configured classes, prefixes and their exceptions.
4. Handlers and saved state
wardrobeRegisterHandlers installs the ACE arsenal close handler and self-actions. Saved loadouts are kept
in mission namespace so preserveLoadout can be never, once or
always. The refresh script keeps the arsenal in sync when a policy changes mid-session.
5. Extension points
itemFilter— code returning false to hide a class (rank checks, story gates).canEnter— code returning false to refuse entry (time of day, location, alive helpers).defaultDestination— position array or marker name; the default is the player's current position.moduleWardrobefor an editor access point;moduleWardrobeSettingsfor a one-per-mission policy.
Related functions
FF_utils_fnc_wardrobeGetConfig— Returns the effective wardrobe policy for the local machine.FF_utils_fnc_wardrobeSetConfig— Merges wardrobe overrides into the local mission configuration.FF_utils_fnc_wardrobeOpen— Opens the wardrobe for the local player. Call with spawn.FF_utils_fnc_wardrobeBuildArsenal— Builds the wardrobe item list from the effective policy.FF_utils_fnc_wardrobeSanitize— Removes restricted electronics from a local unit.FF_utils_fnc_wardrobeReset— Clears cached wardrobe item lists after a policy change.