Skip to content

Commit

Permalink
Merge pull request #243 from BlueTheKing/dev
Browse files Browse the repository at this point in the history
Fix internal bleeding, fix no sound playing when treating, fix pneumothoraxDamageThreshold being ignored
  • Loading branch information
Tomcat-SG authored Feb 5, 2023
2 parents 93fd8a5 + fcebc8c commit ebdde10
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion addons/breathing/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ PREP_RECOMPILE_END;
"SLIDER",
[LLSTRING(PNEUMOTHORAX_DAMAGE_THRESHOLD), LLSTRING(PNEUMOTHORAX_DAMAGE_THRESHOLD_DESCRIPTION)],
[CBA_SETTINGS_CAT, LSTRING(SubCategory_ThoraxInjuries)],
[0, 1, 0.4, 1],
[0, 1, 0.4, 2],
true
] call CBA_Settings_fnc_init;

Expand Down
2 changes: 1 addition & 1 deletion addons/breathing/functions/fnc_handlePulmoHit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

if (!(GVAR(enable)) || !(_bodyPart isEqualTo "Body") || !(_ammo isKindOF "BulletBase")) exitWith {};
//Other mods can utilise KAT_Pneumothorax_Exclusion variable to prevent Pneumothorax from happening
if ((_damage < GVAR(pneumothoraxDamageThreshold)) || (GVAR(pneumothorax) isEqualTo 0) || (_unit getVariable ["KAT_Pneumothorax_Exclusion", false])) exitWith {};
if ((_damage < GVAR(pneumothoraxDamageThreshold)) || (_unit getVariable ["KAT_Pneumothorax_Exclusion", false])) exitWith {};

private _hemo = _unit getVariable [QGVAR(hemopneumothorax), false];
private _tension = _unit getVariable [QGVAR(tensionpneumothorax), false];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ params ["_medic", "_patient"];
if !(GVAR(tensionhemothorax_hardcore)) exitWith {
if ((_patient getVariable [QGVAR(hemopneumothorax), false]) && {_patient getVariable [QGVAR(activeChestSeal), false]}) then {
_patient setVariable [QGVAR(hemopneumothorax), false, true];
[_patient] call EFUNC(circulation,updateInternalBleeding);
if (!(_patient getVariable [QGVAR(pneumothorax), false]) && {!(_patient getVariable [QGVAR(hemopneumothorax), false]) && {!(_patient getVariable [QGVAR(tensionpneumothorax), false])}}) then {
_patient setVariable [QGVAR(activeChestSeal), false, true];
};
Expand Down
2 changes: 1 addition & 1 deletion addons/circulation/functions/fnc_treatment.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ if (vehicle _medic == _medic && {_medicAnim != ""}) then {

// Play a random treatment sound globally if defined
// Don't attempt to play if sounds array is empty
if (isArray (_config >> "sounds") && count (_config >> "sounds") != 0) then {
if (isArray (_config >> "sounds") && count getArray (_config >> "sounds") != 0) then {
selectRandom getArray (_config >> "sounds") params ["_file", ["_volume", 1], ["_pitch", 1], ["_distance", 10]];
playSound3D [_file, objNull, false, getPosASL _medic, _volume, _pitch, _distance];
};
Expand Down
4 changes: 3 additions & 1 deletion addons/circulation/functions/fnc_updateInternalBleeding.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@

params ["_unit"];

private _cardiacOutput = [_unit] call ACEFUNC(medical_status,getCardiacOutput);
private _alphaAction = _unit getVariable [QGVAR(alphaAction), 1];
private _internalBleeding = 0;

if (_unit getVariable [QEGVAR(breathing,hemopneumothorax), false]) then {
_internalBleeding = _internalBleeding + EGVAR(breathing,HPTXBleedAmount);
};

_unit setVariable [VAR_INTERNAL_BLEEDING, _internalBleeding, true];
_unit setVariable [VAR_INTERNAL_BLEEDING, _internalBleeding * (_cardiacOutput max 0.05) * ACEGVAR(medical,bleedingCoefficient) * _alphaAction, true];
5 changes: 2 additions & 3 deletions addons/pharma/functions/fnc_getBloodLoss.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@
params ["_unit"];

private _woundBleeding = GET_WOUND_BLEEDING(_unit);
private _internalBleeding = GET_INTERNAL_BLEEDING(_unit);
if (_woundBleeding + _internalBleeding == 0) exitWith {0};
if (_woundBleeding == 0) exitWith {0};

private _cardiacOutput = [_unit] call ACEFUNC(medical_status,getCardiacOutput);
private _alphaAction = _unit getVariable [QGVAR(alphaAction), 1];

// even if heart stops blood will still flow slowly (gravity)
((_woundBleeding + _internalBleeding) * (_cardiacOutput max 0.05) * ACEGVAR(medical,bleedingCoefficient) * _alphaAction)
(_woundBleeding * (_cardiacOutput max 0.05) * ACEGVAR(medical,bleedingCoefficient) * _alphaAction)
3 changes: 2 additions & 1 deletion addons/pharma/functions/fnc_getBloodVolumeChange.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
params ["_unit", "_deltaT", "_syncValues"];

private _bloodLoss = [_unit] call EFUNC(pharma,getBloodLoss);
private _bloodVolumeChange = -_deltaT * _bloodLoss;
private _internalBleeding = GET_INTERNAL_BLEEDING(_unit);
private _bloodVolumeChange = -_deltaT * (_bloodLoss + _internalBleeding);

if (!isNil {_unit getVariable [QACEGVAR(medical,ivBags),[]]}) then {
private _bloodBags = _unit getVariable [QACEGVAR(medical,ivBags), []];
Expand Down

0 comments on commit ebdde10

Please sign in to comment.