ACE3/addons/medical_status/functions/fnc_updateWoundBloodLoss.sqf
PabstMirror 847d2d4179
Medical - Improve adjustment calcs / wound blood loss / medications (#6910)
* Improve adjustment calcs / wound blood loss / medications

fix func descriptions

Calc wound blood loss on events

reorder includes so scritpmacroMed has global effect

trivial optimization for getCardiacOutput

Fix var

Fix wounds not reopening (nil _category)

Fix surgical kit inherting canBandage conditional

debug hitpoints

Update ACE_Medical_Treatment_Actions.hpp

Use woundBleeding for IS_BLEEDING macro

rework medication vars

comments

Reset var in init / fullHeal

Update addons/medical_treatment/functions/fnc_onMedicationUsage.sqf

Co-Authored-By: PabstMirror <pabstmirror@gmail.com>

* Update addons/medical_treatment/functions/fnc_onMedicationUsage.sqf

Co-Authored-By: PabstMirror <pabstmirror@gmail.com>
2019-04-27 14:12:11 -05:00

43 lines
1.5 KiB
Plaintext

#include "script_component.hpp"
/*
* Author: Glowbal
* Update total wound bleeding based on open wounds and tourniquets
*
* Arguments:
* 0: The Unit <OBJECT>
*
* Return Value:
* Nothing
*
* Example:
* [player] call ace_medical_status_fnc_updateWoundBloodLoss
*
* Public: No
*/
params ["_unit"];
private _tourniquets = GET_TOURNIQUETS(_unit);
private _bodyPartBleeding = [0,0,0,0,0,0];
{
_x params ["", "", "_bodyPart", "_amountOf", "_bleeeding"];
if (_tourniquets select _bodyPart == 0) then {
_bodyPartBleeding set [_bodyPart, (_bodyPartBleeding select _bodyPart) + (_amountOf * _bleeeding)];
};
} forEach (_unit getVariable [QEGVAR(medical,openWounds), []]);
if (_bodyPartBleeding isEqualTo [0,0,0,0,0,0]) then {
TRACE_1("updateWoundBloodLoss-none",_unit);
_unit setVariable [VAR_WOUND_BLEEDING, 0, true];
} else {
_bodyPartBleeding params ["_headBleeding", "_bodyBleeding", "_leftArmBleeding", "_rightArmBleeding", "_leftLegBleeding", "_rightLegBleeding"];
private _bodyBleedingRate = ((_headBleeding min 0.9) + (_bodyBleeding min 1.0)) min 1.0;
private _limbBleedingRate = ((_leftArmBleeding min 0.3) + (_rightArmBleeding min 0.3) + (_leftLegBleeding min 0.5) + (_rightLegBleeding min 0.5)) min 1.0;
// limb bleeding is scaled down based on the amount of body bleeding
_limbBleedingRate = _limbBleedingRate * (1 - _bodyBleedingRate);
TRACE_3("updateWoundBloodLoss-bleeding",_unit,_bodyBleedingRate,_limbBleedingRate);
_unit setVariable [VAR_WOUND_BLEEDING, _bodyBleedingRate + _limbBleedingRate, true];
};