Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Medical Treatment - Change stitching when wound reopening disabled #8912

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion addons/medical_treatment/ACE_Medical_Treatment_Actions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ class GVAR(actions) {
medicRequired = QGVAR(medicSurgicalKit);
treatmentTime = QFUNC(getStitchTime);
condition = QFUNC(canStitch);
callbackSuccess = "";
callbackSuccess = QFUNC(surgicalKitSuccess);
callbackProgress = QFUNC(surgicalKitProgress);
consumeItem = QGVAR(consumeSurgicalKit);
animationMedic = "AinvPknlMstpSnonWnonDnon_medic1";
Expand Down
1 change: 1 addition & 0 deletions addons/medical_treatment/XEH_PREP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ PREP(setTriageStatus);
PREP(splint);
PREP(splintLocal);
PREP(surgicalKitProgress);
PREP(surgicalKitSuccess);
PREP(tourniquet);
PREP(tourniquetLocal);
PREP(tourniquetRemove);
Expand Down
11 changes: 10 additions & 1 deletion addons/medical_treatment/functions/fnc_canStitch.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,13 @@

params ["", "_patient"];

(_patient call FUNC(getStitchableWounds) isNotEqualTo [])
(_patient call FUNC(getStitchableWounds) isNotEqualTo []) ||
{ // Allow stitching if "Clear Trauma" is set to "After Stitch",
// but wound reopening is disabled
GVAR(clearTrauma) isEqualTo 1 &&
{!IS_BLEEDING(_patient)} &&
{(_patient getVariable [
QEGVAR(medical,bodyPartDamage),
[0,0,0,0,0,0]
]) isNotEqualTo [0,0,0,0,0,0]}
}
23 changes: 22 additions & 1 deletion addons/medical_treatment/functions/fnc_getStitchTime.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,26 @@
*/

params ["", "_patient"];
private _time = 0;

if (GVAR(advancedBandages) == 2) then {
_time = count (_patient call FUNC(getStitchableWounds)) * GVAR(woundStitchTime)
} else {
// Allow stitching if "Clear Trauma" is set to "After Stitch",
// but wound reopening is disabled
if (GVAR(clearTrauma) == 1) then {
private _bodyPartDamage = _patient getVariable [
QEGVAR(medical,bodyPartDamage),
[0,0,0,0,0,0]
];

{
ADD(_time, _x * GVAR(woundStitchTime));
} forEach _bodyPartDamage;

_time = _time max GVAR(woundStitchTime);
};
};

_time

count (_patient call FUNC(getStitchableWounds)) * GVAR(woundStitchTime)
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ _args params ["", "_patient"];

private _stitchableWounds = _patient call FUNC(getStitchableWounds);

// Stop treatment if there are no wounds that can be stitched remaining
if (_stitchableWounds isEqualTo []) exitWith {false};
// Stop treatment if there are no wounds that can be stitched remaining,
// except when clear trauma on stitch is enabled
if (_stitchableWounds isEqualTo []) exitWith {GVAR(clearTrauma) == 1};

// Not enough time has elapsed to stitch a wound
if (_totalTime - _elapsedTime > (count _stitchableWounds - 1) * GVAR(woundStitchTime)) exitWith {true};
Expand Down
29 changes: 29 additions & 0 deletions addons/medical_treatment/functions/fnc_surgicalKitSuccess.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#include "script_component.hpp"
/*
* Author: Freddo
* Handles the surgical kit treatment by resetting bodypart damage.
*
* Arguments:
* 0: Medic (not used) <OBJECT>
* 1: Patient <OBJECT>
*
* Return Value:
* None
*
* Example:
* [player, player] call ace_medical_treatment_fnc_surgicalKitSuccess
*
* Public: No
*/

params ["_medic", "_patient"];

if (GVAR(clearTrauma) == 1 && {GVAR(advancedBandages) != 2}) then {
TRACE_2("clearTrauma - clearing trauma after stitching (no reopening)",_medic,_patient);
_patient setVariable [QEGVAR(medical,bodyPartDamage), [0,0,0,0,0,0], true];

[_patient, true, true, true, true] call EFUNC(medical_engine,updateBodyPartVisuals);
};


nil