2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2015-08-10 21:07:47 +00:00
|
|
|
/*
|
|
|
|
* Author: Glowbal
|
2015-08-16 20:41:35 +00:00
|
|
|
* Validate the vehicle cargo space.
|
2015-08-10 21:07:47 +00:00
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Object <OBJECT>
|
|
|
|
*
|
2016-06-18 09:50:41 +00:00
|
|
|
* Return Value:
|
2015-08-10 21:07:47 +00:00
|
|
|
* None
|
|
|
|
*
|
2015-08-16 20:41:35 +00:00
|
|
|
* Example:
|
|
|
|
* [object] call ace_cargo_fnc_validateCargoSpace
|
|
|
|
*
|
2015-08-10 21:07:47 +00:00
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
|
|
|
|
params ["_vehicle"];
|
2016-01-19 03:53:48 +00:00
|
|
|
TRACE_1("params",_vehicle);
|
2015-08-16 20:41:35 +00:00
|
|
|
|
2016-01-19 03:53:48 +00:00
|
|
|
private _loaded = _vehicle getVariable [QGVAR(loaded), []];
|
2015-08-16 20:41:35 +00:00
|
|
|
|
2016-01-19 03:53:48 +00:00
|
|
|
private _newLoaded = [];
|
|
|
|
private _totalSpaceOccupied = 0;
|
2015-08-10 21:07:47 +00:00
|
|
|
{
|
2015-11-20 17:40:31 +00:00
|
|
|
if ((_x isEqualType "") || {!isNull _x}) then {
|
2015-08-10 21:07:47 +00:00
|
|
|
_newLoaded pushback _x;
|
|
|
|
_totalSpaceOccupied = _totalSpaceOccupied + ([_x] call FUNC(getSizeItem));
|
|
|
|
};
|
2015-08-14 16:07:31 +00:00
|
|
|
true
|
|
|
|
} count _loaded;
|
2015-08-10 21:07:47 +00:00
|
|
|
|
|
|
|
if (count _loaded != count _newLoaded) then {
|
2015-08-16 20:41:35 +00:00
|
|
|
_vehicle setVariable [QGVAR(loaded), _newLoaded, true];
|
2015-08-10 21:07:47 +00:00
|
|
|
};
|
2015-08-16 20:41:35 +00:00
|
|
|
|
2021-02-18 18:58:08 +00:00
|
|
|
_vehicle setVariable [QGVAR(space), getNumber (configOf _vehicle >> QGVAR(space)) - _totalSpaceOccupied, true];
|