client/addons/garage/functions/fnc_fetchNearby.sqf
2025-01-04 19:26:35 -06:00

46 lines
1.8 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 _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;