2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2021-10-14 15:46:43 +00:00
|
|
|
/*
|
|
|
|
* Author: mharis001, Glowbal, PabstMirror
|
|
|
|
* Checks whether the player can refill an item from given water source.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Water source <OBJECT>
|
|
|
|
* 1: Player <OBJECT>
|
2022-09-06 11:21:45 +00:00
|
|
|
* 2: Item data <ARRAY>
|
|
|
|
* 0: Item classname <STRING>
|
|
|
|
* 1: Item config <CONFIG>
|
|
|
|
* 2: Is item magazine <BOOL>
|
2021-10-14 15:46:43 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* Can refill item <BOOL>
|
|
|
|
*
|
|
|
|
* Example:
|
2022-09-06 11:21:45 +00:00
|
|
|
* [_source, _player, ["ACE_WaterBottle_Empty", configFile >> "CfgWeapons" >> "ACE_WaterBottle_Empty", false]] call ace_field_rations_fnc_canRefillItem
|
2021-10-14 15:46:43 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
|
2022-09-06 11:21:45 +00:00
|
|
|
params ["_source", "_player", "_itemData"];
|
|
|
|
_itemData params ["_item", "_itemConfig", "_isMagazine"];
|
2021-10-14 15:46:43 +00:00
|
|
|
|
|
|
|
alive _source
|
|
|
|
&& {XGVAR(waterSourceActions) != 0}
|
2022-09-06 11:21:45 +00:00
|
|
|
&& {
|
|
|
|
(_isMagazine && {_item in magazines _player})
|
|
|
|
|| {_item in (_player call EFUNC(common,uniqueItems))}
|
|
|
|
}
|
2021-10-14 15:46:43 +00:00
|
|
|
&& {
|
|
|
|
private _water = _source call FUNC(getRemainingWater);
|
2022-09-06 11:21:45 +00:00
|
|
|
_water == REFILL_WATER_INFINITE || {_water >= getNumber (_itemConfig >> QXGVAR(refillAmount))}
|
2021-10-14 15:46:43 +00:00
|
|
|
}
|