2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
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
|
2019-08-06 13:10:33 +00:00
|
|
|
* Sets the new pain level to the max between the input and current 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:
|
2019-03-30 16:07:54 +00:00
|
|
|
* None
|
2015-04-12 02:21:33 +00:00
|
|
|
*
|
|
|
|
* Example:
|
2018-08-06 16:08:43 +00:00
|
|
|
* [guy, 0.5] call ace_medical_status_fnc_adjustPainLevel
|
2015-04-12 02:21:33 +00:00
|
|
|
*
|
2018-08-06 16:08:43 +00:00
|
|
|
* Public: No
|
2015-04-12 02:21:33 +00:00
|
|
|
*/
|
|
|
|
|
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
|
|
|
|
2018-08-06 16:08:43 +00:00
|
|
|
_desiredPainLevel = _desiredPainLevel * EGVAR(medical,painCoefficient);
|
2016-12-14 19:44:06 +00:00
|
|
|
|
2018-05-11 14:28:25 +00:00
|
|
|
private _pain = GET_PAIN(_unit);
|
|
|
|
_pain = 0 max (_pain max _desiredPainLevel) min 1;
|
2015-04-12 02:21:33 +00:00
|
|
|
|
2018-05-11 14:28:25 +00:00
|
|
|
_unit setVariable [VAR_PAIN, _pain];
|