client/addons/arsenal/functions/fnc_addVirtualVehicles.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

60 lines
1.9 KiB
Plaintext

#include "..\script_component.hpp"
/*
* Author: IDSolutions
* Adds vehicles to virtual garage and categorizes them by type
*
* Arguments:
* 0: Vehicles <ARRAY> - Array of vehicle classnames
*
* Return Value:
* None
*
* Examples:
* ["B_T_LSV_01_unarmed_F", "car"] call forge_client_arsenal_fnc_addVirtualVehicles
*
* Public: Yes
*/
params [["_vehicles", [], [[]]]];
private _garage_unlocks = GETVAR(player,Garage_Unlocks,GVAR(default_garage));
_garage_unlocks params ["_cars", "_armor", "_helis", "_planes", "_naval", "_static"];
{
switch true do {
case (_x isKindOf "Car"): {
if ((_x isKindOf "Tank") || (_x isKindOf "Wheeled_APC_F")) exitWith {};
_cars pushBackUnique _x;
};
case (_x isKindOf "Tank"): { _armor pushBackUnique _x; };
case (_x isKindOf "Helicopter"): { _helis pushBackUnique _x; };
case (_x isKindOf "Plane"): { _planes pushBackUnique _x; };
case (_x isKindOf "Ship"): { _naval pushBackUnique _x; };
case (_x isKindOf "Static"): { _static pushBackUnique _x; };
};
} forEach _vehicles;
{
GVAR(car_unlocks) append [getText(configFile >> "CfgVehicles" >> _x >> "model"),[configFile >> "CfgVehicles" >> _x]];
} forEach _cars;
{
GVAR(armor_unlocks) append [getText(configFile >> "CfgVehicles" >> _x >> "model"),[configFile >> "CfgVehicles" >> _x]];
} forEach _armor;
{
GVAR(heli_unlocks) append [getText(configFile >> "CfgVehicles" >> _x >> "model"),[configFile >> "CfgVehicles" >> _x]];
} forEach _helis;
{
GVAR(plane_unlocks) append [getText(configFile >> "CfgVehicles" >> _x >> "model"),[configFile >> "CfgVehicles" >> _x]];
} forEach _planes;
{
GVAR(naval_unlocks) append [getText(configFile >> "CfgVehicles" >> _x >> "model"),[configFile >> "CfgVehicles" >> _x]];
} forEach _naval;
{
GVAR(static_unlocks) append [getText(configFile >> "CfgVehicles" >> _x >> "model"),[configFile >> "CfgVehicles" >> _x]];
} forEach _static;