Skip to content

Commit

Permalink
Medical - Allow placing unconscious in a body bag (#7941)
Browse files Browse the repository at this point in the history
* medical: allow placing unconscious in a bodybag

* Always show body bag action on non-awake units

Co-authored-by: PabstMirror <pabstmirror@gmail.com>
  • Loading branch information
BrettMayson and PabstMirror authored Oct 29, 2020
1 parent ef56a2d commit 9e3409f
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 5 deletions.
4 changes: 1 addition & 3 deletions addons/medical_treatment/ACE_Medical_Treatment_Actions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,7 @@ class GVAR(actions) {
medicRequired = 0;
treatmentTime = QGVAR(treatmentTimeBodyBag);
items[] = {"ACE_bodyBag"};
// 'vehicle _patient' always returns the body
// '_patient in _patient' always false for body
condition = QUOTE(!alive _patient && {isNull objectParent _patient});
condition = QFUNC(canPlaceInBodyBag);
callbackSuccess = QFUNC(placeInBodyBag);
consumeItem = 1;
litter[] = {};
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 @@ -6,6 +6,7 @@ PREP(bandageLocal);
PREP(bodyCleanupLoop);
PREP(canBandage);
PREP(canCPR);
PREP(canPlaceInBodyBag);
PREP(canSplint);
PREP(canStitch);
PREP(canTreat);
Expand Down
24 changes: 24 additions & 0 deletions addons/medical_treatment/functions/fnc_canPlaceInBodyBag.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include "script_component.hpp"
/*
* Author: SynixeBrett
* Checks if the patient can be placed in a bodybag.
*
* 'vehicle _patient' always returns the body
* '_patient in _patient' always false for body
*
* Arguments:
* 0: Medic (not used) <OBJECT>
* 1: Patient <OBJECT>
*
* Return Value:
* Can Place in Bodybag <BOOL>
*
* Example:
* [player, cursorObject] call ace_medical_treatment_fnc_canPlaceInBodybag
*
* Public: No
*/

params ["", "_patient"];

(isNull objectParent _patient) && {!(_patient call EFUNC(common,isAwake))}
9 changes: 7 additions & 2 deletions addons/medical_treatment/functions/fnc_placeInBodyBag.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Places a dead body inside a body bag.
*
* Arguments:
* 0: Medic (not used) <OBJECT>
* 0: Medic <OBJECT>
* 1: Patient <OBJECT>
*
* Return Value:
Expand All @@ -16,9 +16,14 @@
* Public: No
*/

params ["", "_patient"];
params ["_medic", "_patient"];
TRACE_1("placeInBodyBag",_patient);

if ((alive _patient) && {!GVAR(allowBodyBagUnconscious)}) exitWith {
[_medic, "ACE_bodyBag"] call EFUNC(common,addToInventory); // re-add slighly used bodybag?
[LSTRING(bodybagWhileStillAlive)] call EFUNC(common,displayTextStructured);
};

if (!local _patient) exitWith {
TRACE_1("Calling where local",local _patient);
[QGVAR(placeInBodyBag), [nil, _patient], _patient] call CBA_fnc_targetEvent;
Expand Down
9 changes: 9 additions & 0 deletions addons/medical_treatment/initSettings.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,15 @@
true
] call CBA_settings_fnc_init;

[
QGVAR(allowBodyBagUnconscious),
"CHECKBOX",
[LSTRING(AllowBodyBagUnconscious_DisplayName), LSTRING(AllowBodyBagUnconscious_Description)],
[ELSTRING(medical,Category), LSTRING(SubCategory_Treatment)],
false,
true
] call CBA_settings_fnc_init;

[
QGVAR(cprSuccessChance),
"SLIDER",
Expand Down
9 changes: 9 additions & 0 deletions addons/medical_treatment/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,12 @@
<Polish>Pozwala przetoczyć płyny IV samemu sobie</Polish>
<Italian>Abilita la trasfusione in endovena su se stessi.</Italian>
</Key>
<Key ID="STR_ACE_Medical_Treatment_AllowBodyBagUnconscious_DisplayName">
<English>Allow Unconscious Body Bag</English>
</Key>
<Key ID="STR_ACE_Medical_Treatment_AllowBodyBagUnconscious_Description">
<English>Enables placing an unconscious patient in a body bag.</English>
</Key>
<Key ID="STR_ACE_Medical_Treatment_MedicIV_DisplayName">
<English>Allow IV Transfusion</English>
<German>Erlaube Bluttransfusionen</German>
Expand Down Expand Up @@ -4282,5 +4288,8 @@
<Chinese>這部位沒有止血帶!</Chinese>
<Turkish>Bu vücut kısmında turnike yok!</Turkish>
</Key>
<Key ID="STR_ACE_Medical_Treatment_bodybagWhileStillAlive">
<English>The body twitched and may not be dead!</English>
</Key>
</Package>
</Project>

0 comments on commit 9e3409f

Please sign in to comment.