2015-04-12 02:21:33 +00:00
|
|
|
/*
|
|
|
|
* Author: PabstMirror
|
2016-12-05 20:34:20 +00:00
|
|
|
* Interface to allow external modules to affect the pain level
|
2015-04-12 02:21:33 +00:00
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: The patient <OBJECT>
|
2016-12-05 20:34:20 +00:00
|
|
|
* 1: Desired pain level (0 .. 1) <NUMBER>
|
2015-04-12 02:21:33 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
2016-12-05 20:34:20 +00:00
|
|
|
* nothing
|
2015-04-12 02:21:33 +00:00
|
|
|
*
|
|
|
|
* 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"];
|
2015-04-12 02:21:33 +00:00
|
|
|
|
2016-12-05 20:34:20 +00:00
|
|
|
if (!local _unit) exitWith { ERROR("unit is not local"); };
|
2015-04-12 02:21:33 +00:00
|
|
|
|
2017-04-22 15:57:32 +00:00
|
|
|
TRACE_2("adjustPainLevel",_unit,_desiredPainLevel);
|
2015-04-12 02:21:33 +00:00
|
|
|
|
2016-12-14 19:44:06 +00:00
|
|
|
_desiredPainLevel = _desiredPainLevel * GVAR(painCoefficient);
|
|
|
|
|
2016-12-05 20:34:20 +00:00
|
|
|
private _pain = _unit getVariable [QGVAR(pain), 0];
|
2015-04-12 02:21:33 +00:00
|
|
|
|
2016-12-05 20:34:20 +00:00
|
|
|
_pain = 0 max (_pain max _desiredPainLevel) min 1;
|
2015-04-12 02:21:33 +00:00
|
|
|
|
2016-12-05 20:34:20 +00:00
|
|
|
_unit setVariable [QGVAR(pain), _pain];
|