2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2021-10-14 15:46:43 +00:00
|
|
|
/*
|
|
|
|
* Author: mharis001, PabstMirror
|
|
|
|
* Returns the remaining water in a source.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Water source <OBJECT>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* Remaining water <NUMBER>
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [_source] call ace_field_rations_fnc_getRemainingWater
|
|
|
|
*
|
|
|
|
* Public: Yes
|
|
|
|
*/
|
|
|
|
|
|
|
|
params [["_source", objNull, [objNull]]];
|
|
|
|
|
|
|
|
if (!alive _source) exitWith {0};
|
|
|
|
|
|
|
|
private _water = _source getVariable QGVAR(currentWaterSupply);
|
|
|
|
|
|
|
|
if (isNil "_water") then {
|
2022-03-09 03:41:21 +00:00
|
|
|
private _configOf = configOf _source;
|
|
|
|
if !(isNull _configOf) then {
|
2021-10-14 15:46:43 +00:00
|
|
|
// Check for waterSupply entry since we have valid typeOf
|
2022-03-09 03:41:21 +00:00
|
|
|
_water = getNumber (_configOf >> QXGVAR(waterSupply));
|
2021-10-14 15:46:43 +00:00
|
|
|
if (_water == 0) then {_water = REFILL_WATER_DISABLED};
|
|
|
|
|
|
|
|
if (_water != REFILL_WATER_DISABLED) then {
|
|
|
|
if (_source call CBA_fnc_isTerrainObject) then {
|
|
|
|
_water = REFILL_WATER_INFINITE;
|
|
|
|
} else {
|
|
|
|
_source setVariable [QGVAR(currentWaterSupply), _water, true];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
} else {
|
|
|
|
// Check the p3d name against list
|
|
|
|
_water = if ((getModelInfo _source select 0) in GVAR(waterSourceP3ds)) then {REFILL_WATER_INFINITE} else {REFILL_WATER_DISABLED};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
_water
|