ACE3/addons/medical/functions/fnc_adjustPainLevel.sqf

32 lines
692 B
Plaintext
Raw Normal View History

/*
* Author: PabstMirror
2016-12-05 20:34:20 +00:00
* Interface to allow external modules to affect the pain level
*
* Arguments:
* 0: The patient <OBJECT>
2016-12-05 20:34:20 +00:00
* 1: Desired pain level (0 .. 1) <NUMBER>
*
* Return Value:
2016-12-05 20:34:20 +00:00
* nothing
*
* Example:
* [guy, 0.5] call ace_medical_fnc_adjustPainLevel
*
* Public: Yes
*/
#include "script_component.hpp"
2016-12-05 20:34:20 +00:00
params ["_unit", "_desiredPainLevel"];
2016-12-05 20:34:20 +00:00
if (!local _unit) exitWith { ERROR("unit is not local"); };
TRACE_2("adjustPainLevel",_unit,_desiredPainLevel);
_desiredPainLevel = _desiredPainLevel * GVAR(painCoefficient);
2016-12-05 20:34:20 +00:00
private _pain = _unit getVariable [QGVAR(pain), 0];
2016-12-05 20:34:20 +00:00
_pain = 0 max (_pain max _desiredPainLevel) min 1;
2016-12-05 20:34:20 +00:00
_unit setVariable [QGVAR(pain), _pain];