2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2016-12-06 19:42:10 +00:00
|
|
|
/*
|
|
|
|
* Author: Glowbal
|
|
|
|
* Update the pain suppression
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: The Unit <OBJECT>
|
2019-04-27 19:12:11 +00:00
|
|
|
* 1: Pain Suppress Adjustments <NUMBER>
|
|
|
|
* 2: Time since last update <NUMBER>
|
|
|
|
* 3: Sync value? <BOOL>
|
2016-12-06 19:42:10 +00:00
|
|
|
*
|
2018-05-08 08:17:47 +00:00
|
|
|
* Return Value:
|
|
|
|
* None
|
2016-12-06 19:42:10 +00:00
|
|
|
*
|
2019-04-27 19:12:11 +00:00
|
|
|
* Example:
|
|
|
|
* [player, 0, 1, false] call ace_medical_vitals_fnc_updatePainSuppress
|
|
|
|
*
|
2016-12-06 19:42:10 +00:00
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
|
2019-04-27 19:12:11 +00:00
|
|
|
params ["_unit", "_painSupressAdjustment", "_deltaT", "_syncValue"];
|
2016-12-06 19:42:10 +00:00
|
|
|
|
2016-12-15 11:58:06 +00:00
|
|
|
// Handle continuous pain reduction
|
2018-05-11 14:28:25 +00:00
|
|
|
private _pain = GET_PAIN(_unit);
|
2019-04-27 19:12:11 +00:00
|
|
|
_unit setVariable [VAR_PAIN, 0 max (_pain - _deltaT / PAIN_FADE_TIME), _syncValue];
|
2016-12-15 11:58:06 +00:00
|
|
|
|
2018-08-06 16:08:43 +00:00
|
|
|
if (isNil QEGVAR(medical_treatment,advancedMedication) || {!EGVAR(medical_treatment,advancedMedication)}) then {
|
2020-01-07 19:35:22 +00:00
|
|
|
// Handles simple medication
|
2018-05-11 14:28:25 +00:00
|
|
|
private _painSupress = _unit getVariable [VAR_PAIN_SUPP, 0];
|
2016-12-15 11:58:06 +00:00
|
|
|
_painSupress = _painSupress - _deltaT / PAIN_SUPPRESSION_FADE_TIME;
|
2018-05-11 14:28:25 +00:00
|
|
|
_unit setVariable [VAR_PAIN_SUPP, 0 max _painSupress, _syncValue];
|
2020-01-07 19:35:22 +00:00
|
|
|
} else {
|
|
|
|
// Handle advanced medication
|
|
|
|
_unit setVariable [VAR_PAIN_SUPP, 0 max _painSupressAdjustment, _syncValue];
|
2016-12-15 11:58:06 +00:00
|
|
|
};
|