From c2f9351db8cdc6543ac0135c352870e734853580 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Mon, 4 Nov 2019 15:29:37 -0600 Subject: [PATCH] Fix painSupp double setVar --- addons/medical/dev/watchVariable.sqf | 12 ++++++------ addons/medical_vitals/functions/fnc_updatePain.sqf | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/addons/medical/dev/watchVariable.sqf b/addons/medical/dev/watchVariable.sqf index b09a0f7144..d01484d201 100644 --- a/addons/medical/dev/watchVariable.sqf +++ b/addons/medical/dev/watchVariable.sqf @@ -94,24 +94,24 @@ GVAR(dev_watchVariableRunning) = true; _return pushBack "------- Open Wounds: -------"; private _wounds = GET_OPEN_WOUNDS(_unit); { - _x params ["_xClassID", "_xBodyPartN", "_xAmountOf", "_xBleeding", "_xDamage"]; - _return pushBack format ["%1: [%2] [x%3] [Bld: %4] [Dmg: %5]", ALL_SELECTIONS select _xBodyPartN, _xClassID, _xAmountOf toFixed 1, _xBleeding toFixed 4, _xDamage toFixed 2]; + _x params ["_xClassID", "_xBodyPartN", "_xAmountOf", "_xBleeding", "_xDamage", "_xPain"]; + _return pushBack format ["%1: [%2] [x%3] [B: %4] [D: %5] [P: %6]", ALL_SELECTIONS select _xBodyPartN, _xClassID, _xAmountOf toFixed 1, _xBleeding toFixed 4, _xDamage toFixed 2, _xPain toFixed 2]; } forEach _wounds; // Bandaged Wounds: _return pushBack "------- Bandaged Wounds: -------"; private _wounds = GET_BANDAGED_WOUNDS(_unit); { - _x params ["_xClassID", "_xBodyPartN", "_xAmountOf", "_xBleeding", "_xDamage"]; - _return pushBack format ["%1: [%2] [x%3] [Bld: %4] [Dmg: %5]", ALL_SELECTIONS select _xBodyPartN, _xClassID, _xAmountOf toFixed 1, _xBleeding toFixed 4, _xDamage toFixed 2]; + _x params ["_xClassID", "_xBodyPartN", "_xAmountOf", "_xBleeding", "_xDamage", "_xPain"]; + _return pushBack format ["%1: [%2] [x%3] [B: %4] [D: %5] [P: %6]", ALL_SELECTIONS select _xBodyPartN, _xClassID, _xAmountOf toFixed 1, _xBleeding toFixed 4, _xDamage toFixed 2, _xPain toFixed 2]; } forEach _wounds; // Stitched Wounds: _return pushBack "------- Stitched Wounds: -------"; private _wounds = GET_STITCHED_WOUNDS(_unit); { - _x params ["_xClassID", "_xBodyPartN", "_xAmountOf", "_xBleeding", "_xDamage"]; - _return pushBack format ["%1: [%2] [x%3] [Bld: %4] [Dmg: %5]", ALL_SELECTIONS select _xBodyPartN, _xClassID, _xAmountOf toFixed 1, _xBleeding toFixed 4, _xDamage toFixed 2]; + _x params ["_xClassID", "_xBodyPartN", "_xAmountOf", "_xBleeding", "_xDamage", "_xPain"]; + _return pushBack format ["%1: [%2] [x%3] [B: %4] [D: %5] [P: %6]", ALL_SELECTIONS select _xBodyPartN, _xClassID, _xAmountOf toFixed 1, _xBleeding toFixed 4, _xDamage toFixed 2, _xPain toFixed 2]; } forEach _wounds; // IVs: diff --git a/addons/medical_vitals/functions/fnc_updatePain.sqf b/addons/medical_vitals/functions/fnc_updatePain.sqf index 7190b7fa30..e0ea2d4172 100644 --- a/addons/medical_vitals/functions/fnc_updatePain.sqf +++ b/addons/medical_vitals/functions/fnc_updatePain.sqf @@ -13,15 +13,13 @@ * None * * Example: - * [player, 0, 1, false] call ace_medical_vitals_fnc_updatePainSuppress + * [player, 0, 1, false] call ace_medical_vitals_fnc_updatePain * * Public: No */ params ["_unit", "_painSupressAdjustment", "_deltaT", "_syncValue"]; -_unit setVariable [VAR_PAIN_SUPP, 0 max _painSupressAdjustment, _syncValue]; - // Pain value formula: maximum of // - most painful open wound * (1 + 0.1 * count of open wounds) // - most painful bandaged wound * (1 + 0.1 * count of bandaged wounds) @@ -79,7 +77,9 @@ private _customPain = _unit getVariable [QGVAR(customPain), []]; // Handles simple medication pain supppression -if (isNil QEGVAR(medical_treatment,advancedMedication) || {!EGVAR(medical_treatment,advancedMedication)}) then { +if (missionNamespace getVariable [QEGVAR(medical_treatment,advancedMedication), false]) then { + _unit setVariable [VAR_PAIN_SUPP, 0 max _painSupressAdjustment, _syncValue]; +} else { private _painSupress = _unit getVariable [VAR_PAIN_SUPP, 0]; _painSupress = _painSupress - _deltaT / PAIN_SUPPRESSION_FADE_TIME; _unit setVariable [VAR_PAIN_SUPP, 0 max _painSupress, _syncValue];