client/addons/garage/functions/fnc_fetchNearby.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

62 lines
1.9 KiB
Plaintext

#include "..\script_component.hpp"
/*
* Author: IDSolutions
* Fetches the nearby vehicles
*
* Arguments:
* None
*
* Return Value:
* None
*
* Example:
* None
*
* Public: No
*/
private _display = findDisplay IDD_GARAGEDIALOG;
private _vehicleList = _display displayCtrl IDC_VEHICLELIST;
lbClear _vehicleList;
private _temp = [];
private _locations = (missionConfigFile >> "CfgGarages" >> "locations") call BFUNC(getCfgData);
{
if ((getPosATLVisual player) distance (_x select 1) < 20) then {
{
// private _vehType = _x getVariable ["FORGE_VehicleType", ""];
private _vehType = GETVAR(_x,FORGE_VehicleType,"");
// private _hitPointsData = getAllHitPointsDamage _x;
if (_vehType != "") then {
// private _vehData = [
// fuel _x,
// damage _x,
// str _hitPointsData
// ];
// _temp pushBackUnique [_vehType, typeOf _x, _vehData, netId _x];
_temp pushBackUnique [_vehType, typeOf _x, netId _x];
} else {
["This vehicle was not spawned from the garage and cannot be stored.", "warning", 3, "right"] call EFUNC(misc,notify);
};
} forEach (nearestObjects [(_x select 1), ["Land", "Air", "Ship"], 5]) - [player];
};
} forEach _locations;
{
// _x params ["_vehType", "_className", "_vehData", "_netID"];
_x params ["_vehType", "_className", "_netID"];
private _index = -1;
private _displayName = getText (configFile >> "CfgVehicles" >> _className >> "displayName");
private _picture = getText (configFile >> "CfgVehicles" >> _className >> "picture");
_index = _vehicleList lbAdd _displayName;
// _vehicleList lbSetData [_index, str [_vehType, _className, _vehData, _netID]];
_vehicleList lbSetData [_index, str [_vehType, _className, _netID]];
_vehicleList lbSetPicture [_index, _picture];
} forEach _temp;