Fix painSupp double setVar

This commit is contained in:
PabstMirror 2019-11-04 15:29:37 -06:00
parent f11a8848e3
commit c2f9351db8
2 changed files with 10 additions and 10 deletions

View File

@ -94,24 +94,24 @@ GVAR(dev_watchVariableRunning) = true;
_return pushBack "------- Open Wounds: -------"; _return pushBack "------- Open Wounds: -------";
private _wounds = GET_OPEN_WOUNDS(_unit); private _wounds = GET_OPEN_WOUNDS(_unit);
{ {
_x params ["_xClassID", "_xBodyPartN", "_xAmountOf", "_xBleeding", "_xDamage"]; _x params ["_xClassID", "_xBodyPartN", "_xAmountOf", "_xBleeding", "_xDamage", "_xPain"];
_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]; _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; } forEach _wounds;
// Bandaged Wounds: // Bandaged Wounds:
_return pushBack "------- Bandaged Wounds: -------"; _return pushBack "------- Bandaged Wounds: -------";
private _wounds = GET_BANDAGED_WOUNDS(_unit); private _wounds = GET_BANDAGED_WOUNDS(_unit);
{ {
_x params ["_xClassID", "_xBodyPartN", "_xAmountOf", "_xBleeding", "_xDamage"]; _x params ["_xClassID", "_xBodyPartN", "_xAmountOf", "_xBleeding", "_xDamage", "_xPain"];
_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]; _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; } forEach _wounds;
// Stitched Wounds: // Stitched Wounds:
_return pushBack "------- Stitched Wounds: -------"; _return pushBack "------- Stitched Wounds: -------";
private _wounds = GET_STITCHED_WOUNDS(_unit); private _wounds = GET_STITCHED_WOUNDS(_unit);
{ {
_x params ["_xClassID", "_xBodyPartN", "_xAmountOf", "_xBleeding", "_xDamage"]; _x params ["_xClassID", "_xBodyPartN", "_xAmountOf", "_xBleeding", "_xDamage", "_xPain"];
_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]; _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; } forEach _wounds;
// IVs: // IVs:

View File

@ -13,15 +13,13 @@
* None * None
* *
* Example: * Example:
* [player, 0, 1, false] call ace_medical_vitals_fnc_updatePainSuppress * [player, 0, 1, false] call ace_medical_vitals_fnc_updatePain
* *
* Public: No * Public: No
*/ */
params ["_unit", "_painSupressAdjustment", "_deltaT", "_syncValue"]; params ["_unit", "_painSupressAdjustment", "_deltaT", "_syncValue"];
_unit setVariable [VAR_PAIN_SUPP, 0 max _painSupressAdjustment, _syncValue];
// Pain value formula: maximum of // Pain value formula: maximum of
// - most painful open wound * (1 + 0.1 * count of open wounds) // - most painful open wound * (1 + 0.1 * count of open wounds)
// - most painful bandaged wound * (1 + 0.1 * count of bandaged 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 // 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]; private _painSupress = _unit getVariable [VAR_PAIN_SUPP, 0];
_painSupress = _painSupress - _deltaT / PAIN_SUPPRESSION_FADE_TIME; _painSupress = _painSupress - _deltaT / PAIN_SUPPRESSION_FADE_TIME;
_unit setVariable [VAR_PAIN_SUPP, 0 max _painSupress, _syncValue]; _unit setVariable [VAR_PAIN_SUPP, 0 max _painSupress, _syncValue];