ACE3/addons/field_rations/functions/fnc_addStatusModifier.sqf
jonpas 742626ff1a
General - Relative script_component.hpp includes (#9378)
Co-authored-by: PabstMirror <pabstmirror@gmail.com>
2023-09-12 20:58:10 +02:00

31 lines
827 B
Plaintext

#include "..\script_component.hpp"
/*
* Author: mharis001
* Adds a status modifier. Should be called on all machines.
* Code must return a NUMBER which will be applied additively with other status changes.
*
* Arguments:
* 0: Status to modify (0 - Thirst, 1 - Hunger, 2 - Both) <NUMBER>
* 1: Code (is passed the unit <OBJECT>) <CODE>
*
* Return Value:
* None
*
* Example:
* [0, {}] call ace_field_rations_fnc_addStatusModifier
*
* Public: Yes
*/
params [["_type", -1, [0]], ["_code", {}, [{}]]];
if (_type isEqualTo -1 || {_code isEqualTo {}}) exitWith {};
if (_type isEqualTo 2) then {
GVAR(thirstModifiers) pushBack _code;
GVAR(hungerModifiers) pushBack _code;
} else {
private _modifierArray = [GVAR(thirstModifiers), GVAR(hungerModifiers)] select _type;
_modifierArray pushBack _code;
};