ACE3/addons/medical/functions/fnc_adjustPainLevel.sqf
Dedmen Miller 81e02a7336 Refactor private ARRAY to private keyword (#5598)
* Everything

* Fixed missing ;

* Fix missing ; and double private

* Fixed cannot isNull on number

* Turn _temparture back to isNil

* Fix error from merge
2017-10-10 09:39:59 -05:00

35 lines
841 B
Plaintext

/*
* Author: PabstMirror
* Interface to allow external modules to safely adjust pain levels.
*
* Arguments:
* 0: The patient <OBJECT>
* 1: Added ammount of pain (can be negative) <NUMBER>
*
* Return Value:
* The new pain level <NUMBER>
*
* Example:
* [guy, 0.5] call ace_medical_fnc_adjustPainLevel
*
* Public: Yes
*/
#include "script_component.hpp"
params ["_unit", "_addedPain"];
//Only run on local units:
if (!local _unit) exitWith {ERROR("unit is not local");};
TRACE_3("ACE_DEBUG: adjustPainLevel Called",_unit, _pain, _addedPain);
//Ignore if medical system disabled:
if (GVAR(level) == 0) exitWith {};
private _pain = ((_unit getVariable [QGVAR(pain), 0]) + _addedPain) max 0;
_unit setVariable [QGVAR(pain), _pain];
//Start up the vital watching (if not already running)
[_unit] call FUNC(addVitalLoop);
_pain;