mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
68ed19911a
* configOf lookups * forEach, missed configOf * revert handcuff distance change Co-authored-by: Filip Maciejewski <veteran29@users.noreply.github.com> * optimize condition Co-authored-by: Filip Maciejewski <veteran29@users.noreply.github.com> * capitalization Co-authored-by: Filip Maciejewski <veteran29@users.noreply.github.com> * use object in getVehicleIcon Co-authored-by: Filip Maciejewski <veteran29@users.noreply.github.com> * add return comment Co-authored-by: Filip Maciejewski <veteran29@users.noreply.github.com> * remove extra brackets Co-authored-by: Filip Maciejewski <veteran29@users.noreply.github.com> * add missing brackets Co-authored-by: Filip Maciejewski <veteran29@users.noreply.github.com> * add return comment pt2 Co-authored-by: Filip Maciejewski <veteran29@users.noreply.github.com> * revert to cursorTarget Co-authored-by: Filip Maciejewski <veteran29@users.noreply.github.com> Co-authored-by: PabstMirror <pabstmirror@gmail.com>
45 lines
1.2 KiB
Plaintext
45 lines
1.2 KiB
Plaintext
#include "script_component.hpp"
|
|
/*
|
|
* 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 {
|
|
private _configOf = configOf _source;
|
|
if !(isNull _configOf) then {
|
|
// Check for waterSupply entry since we have valid typeOf
|
|
_water = getNumber (_configOf >> QXGVAR(waterSupply));
|
|
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
|