client/addons/garage/functions/fnc_fetchNearby.sqf
Jacob Schmidt c6daf95415
All checks were successful
Build / Build (push) Successful in 53s
Initial Repo Setup
2025-01-01 14:35:12 -06:00

42 lines
1.6 KiB
Plaintext

#include "..\script_component.hpp"
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 _isGarageVehicle = _x getVariable ["FORGE_GarageVehicle", false];
private _isGarageVehicle = GETVAR(_x,FORGE_GarageVehicle,false);
if (_isGarageVehicle) then {
private _vehData = [
getAllHitPointsDamage _x,
fuel _x,
damage _x
];
_temp pushBackUnique [_isGarageVehicle, typeOf _x, _vehData, 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 ["_isGarageVehicle", "_className", "_vehData", "_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 [_isGarageVehicle, _className, _vehData, _netID]];
_vehicleList lbSetPicture [_index, _picture];
} forEach _temp;