client/addons/locker/functions/fnc_initLocker.sqf
Jacob Schmidt d474b3676a
All checks were successful
Build / Build (push) Successful in 28s
Refactor: Standardize function descriptions and variable handling
This commit refactors several client-side functions to improve code consistency and readability.

- Standardizes function descriptions by removing redundant "Function: forge_client..." prefixes and "[Description]" sections, focusing on concise descriptions of the function's purpose.
- Updates variable handling in arsenal functions to use GVAR and EGVARS for default values, improving consistency and reducing code duplication.
- Removes the bank init function as it is no longer needed.
- Adds a done variable to the preinit file.
2025-05-25 11:30:26 -05:00

47 lines
1.5 KiB
Plaintext

#include "..\script_component.hpp"
/*
* Author: IDSolutions
* Initializes the lockers
*
* Arguments:
* N/A
*
* Return Value:
* N/A
*
* Examples:
* [] call forge_client_locker_fnc_initLocker;
*
* Public: Yes
*/
{
private _configName = configName(_x);
private _className = (missionConfigFile >> "CfgLockers" >> "lockers" >> _configName >> "className") call BFUNC(getCfgData);
private _pos = (missionConfigFile >> "CfgLockers" >> "lockers" >> _configName >> "pos") call BFUNC(getCfgData);
private _dir = (missionConfigFile >> "CfgLockers" >> "lockers" >> _configName >> "dir") call BFUNC(getCfgData);
private _type = (missionConfigFile >> "CfgLockers" >> "lockers" >> _configName >> "type") call BFUNC(getCfgData);
if (_type == "object") then {
private _locker = createSimpleObject [_className, [0, 0, 0]];
_locker setPosATL _pos;
_locker setDir _dir;
_locker allowDamage false;
_locker setVariable ["isLocker", true, true];
} else {
private _group = createGroup civilian;
private _locker = _group createUnit [_className, [0, 0, 0], [], 0, "NONE"];
_locker disableAI "MOVE";
_locker setPosATL _pos;
_locker setDir _dir;
_locker allowDamage false;
_locker setVariable ["isLocker", true, true];
_locker setVariable ["BIS_enableRandomization", false];
};
diag_log text format ["[FORGE Locker] ClassName: '%1' Pos: '%2' Dir: '%3' Type: '%4'", _className, _pos, _dir, _type];
} forEach ("true" configClasses (missionConfigFile >> "CfgLockers" >> "lockers"));