Skip to content

Commit

Permalink
Merge pull request #608 from KillahPotatoes/v0.97S13-603-2
Browse files Browse the repository at this point in the history
fixed cf recognizing "Ground" as inventory
  • Loading branch information
Dubjunk authored May 11, 2019
2 parents 351e7ac + 559d699 commit fca8db5
Showing 1 changed file with 19 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
File: fn_cratefiller_getNearStorages.sqf
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2019-04-06
Last Update: 2019-05-04
Last Update: 2019-05-11
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
Public: No
Expand All @@ -30,44 +30,40 @@ lbClear _ctrlStorage;
private _nearFOB = [] call KPLIB_fnc_common_getPlayerFob;
private _type = objNull;
private _config = "";
private _number= 0;
private _number = 0;
private _index = 0;
private _picture = "";
private _storages = [];
private _blacklist = [
KPLIB_preset_crateSupplyE,
KPLIB_preset_crateSupplyF,
KPLIB_preset_crateAmmoE,
KPLIB_preset_crateAmmoF,
KPLIB_preset_crateFuelE,
KPLIB_preset_crateFuelF,
KPLIB_logistic_building
KPLIB_logistic_building,
"GroundWeaponHolder",
"WeaponHolderSimulated",
""
];
private _objects = (getMarkerPos _nearFOB) nearObjects KPLIB_param_fobRange;

// Get near objects and check for storage capacity
{
_type = typeOf _x;
if (_type != "GroundWeaponHolder") then {
_config = [_type] call KPLIB_fnc_cratefiller_getConfigPath;
_number = getNumber (_config >> "maximumLoad");
if (_number > 0) then {
_storages pushBack _x;
_config = [_type] call KPLIB_fnc_cratefiller_getConfigPath;
_number = getNumber (_config >> "maximumLoad");
// If the object has an inventory add it to the list
if (_number > 0) then {
_index = _ctrlStorage lbAdd format ["%1m - %2", round ((getMarkerPos _nearFOB) distance2D _x), getText (_config >> "displayName")];
_ctrlStorage lbSetData [_index, netId _x];
_picture = getText (_config >> "picture");
if (_picture isEqualTo "pictureThing") then {
_ctrlStorage lbSetPicture [_index, "KPGUI\res\icon_help.paa"];
} else {
_ctrlStorage lbSetPicture [_index, _picture];
};
};
} forEach (((getMarkerPos _nearFOB) nearObjects KPLIB_param_fobRange) select {!(typeOf _x in _blacklist)});
} forEach (_objects select {!(typeOf _x in _blacklist) && !((typeOf _x select [0,1]) isEqualTo "#") && !(_x isKindOf "Building")});

// Fill the list
{
_type = typeOf _x;
_config = [_type] call KPLIB_fnc_cratefiller_getConfigPath;
_index = _ctrlStorage lbAdd format ["%1m - %2", round ((getMarkerPos _nearFOB) distance2D _x), getText (_config >> "displayName")];
_ctrlStorage lbSetData [_index, netId _x];
_picture = getText (_config >> "picture");
if (_picture isEqualTo "pictureThing") then {
_ctrlStorage lbSetPicture [_index, "KPGUI\res\icon_help.paa"];
} else {
_ctrlStorage lbSetPicture [_index, _picture];
};
} forEach _storages;

true

0 comments on commit fca8db5

Please sign in to comment.