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 - Add Grave Digging for Corpse Disposal #9276

Merged
merged 25 commits into from
Sep 24, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
92e2ba2
Add grave digging
Drofseh Jul 21, 2023
857b1e7
Update fnc_placeInBodyBagOrGrave.sqf
Drofseh Jul 21, 2023
43f0e09
Update fnc_placeInBodyBagOrGrave.sqf
Drofseh Jul 21, 2023
7f70a2a
Update fnc_placeInBodyBagOrGrave.sqf
Drofseh Jul 21, 2023
c09f7a5
Update addons/medical_treatment/functions/fnc_placeInBodyBag.sqf
Drofseh Jul 21, 2023
2f4ab4c
Add setting to enable/disable
Drofseh Jul 21, 2023
b42a139
improvements
Drofseh Jul 26, 2023
592fdb7
fix typo in variable
Drofseh Jul 26, 2023
63094cd
Apply suggestions from code review
Drofseh Aug 1, 2023
3c535f3
Apply suggestions from code review
Drofseh Aug 3, 2023
55427bc
add to XEH_PREP and fix event for non-local patient
Drofseh Aug 3, 2023
444ed9a
Add interaction to check name on headstone
Drofseh Aug 3, 2023
88e4d6f
Update addons/medical_treatment/XEH_postInit.sqf
Drofseh Aug 3, 2023
2e9f536
Simplify Setting
PabstMirror Aug 7, 2023
1906559
Apply suggestions from code review
Drofseh Aug 11, 2023
1a91219
Update addons/medical_treatment/stringtable.xml
Drofseh Aug 12, 2023
8b7f95e
Make placeInBodyBagOrGrave more generic and use any grave class
PabstMirror Aug 25, 2023
5c9b5cb
Update addons/medical_treatment/functions/fnc_placeInGrave.sqf
Drofseh Aug 26, 2023
35f72bb
Update medical-treatment-framework.md
PabstMirror Aug 29, 2023
2b56036
Update docs/wiki/framework/medical-treatment-framework.md
Drofseh Aug 31, 2023
883dcd7
Merge branch 'master' into add-grave-digging
LinkIsGrim Sep 23, 2023
21ee456
update docs
LinkIsGrim Sep 23, 2023
64c12af
Update addons/medical_treatment/functions/fnc_placeInBodyBagOrGrave.sqf
LinkIsGrim Sep 23, 2023
036825d
Update addons/medical_treatment/functions/fnc_placeInGrave.sqf
LinkIsGrim Sep 23, 2023
7e3826f
fix includes
PabstMirror Sep 24, 2023
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
Binary file added addons/medical_gui/ui/cross_grave.paa
Binary file not shown.
11 changes: 10 additions & 1 deletion addons/medical_treatment/ACE_Medical_Treatment_Actions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,10 +249,19 @@ class GVAR(actions) {
treatmentTime = QGVAR(treatmentTimeBodyBag);
items[] = {"ACE_bodyBag"};
condition = QFUNC(canPlaceInBodyBag);
callbackSuccess = QFUNC(placeInBodyBag);
callbackSuccess = QFUNC(placeInBodyBagOrGrave);
consumeItem = 1;
litter[] = {};
};
class Grave: BodyBag {
displayName = CSTRING(DigGrave);
displayNameProgress = CSTRING(DiggingGrave);
icon = QPATHTOEF(medical_gui,ui\cross_grave.paa);
treatmentTime = QGVAR(treatmentTimeGrave);
condition = QFUNC(fnc_canDigGrave);
Drofseh marked this conversation as resolved.
Show resolved Hide resolved
items[] = {"ACE_EntrenchingTool"};
Drofseh marked this conversation as resolved.
Show resolved Hide resolved
consumeItem = 0;
};
class CPR: BasicBandage {
displayName = CSTRING(Actions_CPR);
displayNameProgress = CSTRING(Actions_PerformingCPR);
Expand Down
21 changes: 21 additions & 0 deletions addons/medical_treatment/functions/fnc_canDigGrave.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#include "script_component.hpp"
/*
* Author: Ruthberg, commy2, esteldunedain, drofseh
* Checks if a unit can dig a grave at the position of the patient.
*
* Arguments:
* 0: Medic (not used) <OBJECT>
Drofseh marked this conversation as resolved.
Show resolved Hide resolved
* 1: Patient <OBJECT>
*
* Return Value:
* Can dig <BOOL>
*
* Example:
* [ACE_player] call ace_trenches_fnc_canDigGrave
Drofseh marked this conversation as resolved.
Show resolved Hide resolved
*
* Public: No
*/

params ["", "_patient"];
Drofseh marked this conversation as resolved.
Show resolved Hide resolved

!GVAR(allowGaveDigging) && {_patient call EFUNC(common,canDig)}
40 changes: 4 additions & 36 deletions addons/medical_treatment/functions/fnc_placeInBodyBag.sqf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "script_component.hpp"
/*
* Author: Glowbal
* Author: Glowbal, drofseh
* Places a dead body inside a body bag.
*
* Arguments:
Expand All @@ -14,40 +14,8 @@
* [player, cursorObject] call ace_medical_treatment_fnc_placeInBodyBag
*
* Public: No
*
* Deprecated
*/

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;
};

if (alive _patient) then {
TRACE_1("Manually killing with setDead",_patient);
[_patient, "buried_alive", _medic] call EFUNC(medical_status,setDead);
};

private _position = (getPosASL _patient) vectorAdd [0, 0, 0.2];

private _headPos = _patient modelToWorldVisual (_patient selectionPosition "head");
private _spinePos = _patient modelToWorldVisual (_patient selectionPosition "Spine3");
private _direction = (_headPos vectorFromTo _spinePos) call CBA_fnc_vectDir;

// Move the body away so it won't collide with the body bag object
// This setPosASL seems to need to be called where the unit is local
_patient setPosASL [-5000, -5000, 0];

// Create the body bag object, set its position to prevent it from flipping
private _bodyBag = createVehicle ["ACE_bodyBagObject", [0, 0, 0], [], 0, "NONE"];
_bodyBag setPosASL _position;
_bodyBag setDir _direction;

// Server will handle hiding and deleting the body
["ace_placedInBodyBag", [_patient, _bodyBag]] call CBA_fnc_globalEvent;
_this call ace_medical_treatment_fnc_placeInBodyBagOrGrave;
78 changes: 78 additions & 0 deletions addons/medical_treatment/functions/fnc_placeInBodyBagOrGrave.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
#include "script_component.hpp"
/*
* Author: Glowbal, drofseh
* Places a dead body inside a body bag.
LinkIsGrim marked this conversation as resolved.
Show resolved Hide resolved
*
* Arguments:
* 0: Medic <OBJECT>
* 1: Patient <OBJECT>
* 2: Body Part (not used) <STRING>
* 3: Treatment (not used) <STRING>
* 4: Item User (not used) <OBJECT>
* 5: Used Item (default: "ACE_bodyBag") <STRING>
*
* Return Value:
* None
*
* Example:
* [player, cursorObject, "ACE_bodyBagObject"] call ace_medical_treatment_fnc_placeInBodyBagOrGrave
Drofseh marked this conversation as resolved.
Show resolved Hide resolved
*
* Public: No
*/

params ["_medic", "_patient", "", "", "", ["_usedItem", "ACE_bodyBag"]];
TRACE_1("placeInBodyBagOrGrave",_patient);

private _alive = alive _patient;
private _restingPlace = "ACE_bodyBagObject";
private _restingPlaceIsBodyBag = _restingPlace == "ACE_bodyBagObject";

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

if (_usedItem == "ACE_EntrenchingTool") then {
_restingPlace = "Land_Grave_dirt_F";
_restingPlaceIsGrave = _restingPlace == "Land_Grave_dirt_F";
};
if (_alive && {!GVAR(allowGraveUnconscious) && {_restingPlaceIsGrave}}) exitWith {
[LSTRING(bodybagWhileStillAlive)] call EFUNC(common,displayTextStructured);
};

if (!local _patient) exitWith {
TRACE_1("Calling where local",local _patient);
[QGVAR(placeInGrave), [nil, _patient], _patient] call CBA_fnc_targetEvent;
Drofseh marked this conversation as resolved.
Show resolved Hide resolved
};

if (alive _patient) then {
TRACE_1("Manually killing with setDead",_patient);
[_patient, "buried_alive", _medic] call EFUNC(medical_status,setDead);
};

private _position = getPosASL _patient;
if (_restingPlaceIsBodyBag) then {
//Body bag needs to be a little higher than grave
_position = _position vectorAdd [0, 0, 0.2];
};

private _headPos = _patient modelToWorldVisual (_patient selectionPosition "head");
private _spinePos = _patient modelToWorldVisual (_patient selectionPosition "Spine3");
private _direction = (_headPos vectorFromTo _spinePos) call CBA_fnc_vectDir;
if (_restingPlaceIsGrave) then {
//Orentation of the grave object needs to be rotated 90 degrees to line up with the body
_direction = _direction + 90;
};

// Move the body away so it won't collide with the body bag object
// This setPosASL seems to need to be called where the unit is local
_patient setPosASL [-5000, -5000, 0];
Drofseh marked this conversation as resolved.
Show resolved Hide resolved

// Create the body bag object, set its position to prevent it from flipping
private _bodyBag = createVehicle [_restingPlace, [0, 0, 0], [], 0, "NONE"];
_bodyBag setPosASL _position;
_bodyBag setDir _direction;

// Server will handle hiding and deleting the body
//keep event name as body bag only to avoid breaking things for others
["ace_placedInBodyBag", [_patient, _bodyBag]] call CBA_fnc_globalEvent;
27 changes: 27 additions & 0 deletions addons/medical_treatment/initSettings.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,15 @@
true
] call CBA_fnc_addSetting;

[
QGVAR(treatmentTimeGrave),
"SLIDER",
[LSTRING(TreatmentTimeGrave_DisplayName), LSTRING(TreatmentTimeGrave_Description)],
[ELSTRING(medical,Category), LSTRING(SubCategory_Treatment)],
[0.1, 120, 30, 1],
true
] call CBA_fnc_addSetting;

[
QGVAR(medicEpinephrine),
"LIST",
Expand Down Expand Up @@ -287,6 +296,24 @@
true
] call CBA_fnc_addSetting;

[
QGVAR(allowGaveDigging),
Drofseh marked this conversation as resolved.
Show resolved Hide resolved
"CHECKBOX",
[LSTRING(AllowGaveDigging_DisplayName), LSTRING(AllowGaveDigging_Description)],
[ELSTRING(medical,Category), LSTRING(SubCategory_Treatment)],
true,
true
] call CBA_fnc_addSetting;

[
QGVAR(allowGraveUnconscious),
"CHECKBOX",
[LSTRING(AllowGraveUnconscious_DisplayName), LSTRING(AllowGraveUnconscious_Description)],
[ELSTRING(medical,Category), LSTRING(SubCategory_Treatment)],
false,
true
] call CBA_fnc_addSetting;

[
QGVAR(holsterRequired),
"LIST",
Expand Down
24 changes: 24 additions & 0 deletions addons/medical_treatment/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,12 @@
<Chinesesimp>装入裹尸袋时间</Chinesesimp>
<Korean>초 단위로 시체 운반용 부대를 사용하는데 걸리는 시간을 정합니다.</Korean>
</Key>
<Key ID="STR_ACE_Medical_Treatment_TreatmentTimeGrave_DisplayName">
<English>Grave Digging Time</English>
</Key>
<Key ID="STR_ACE_Medical_Treatment_TreatmentTimeGrave_Description">
<English>Time, in seconds, required to dig a grave for a patient.</English>
Drofseh marked this conversation as resolved.
Show resolved Hide resolved
</Key>
<Key ID="STR_ACE_Medical_Treatment_MedicEpinephrine_DisplayName">
<English>Allow Epinephrine</English>
<German>Erlaube Epiniphrin</German>
Expand Down Expand Up @@ -824,6 +830,18 @@
<Chinesesimp>能够将昏迷的伤员装入尸袋中。</Chinesesimp>
<Korean>기절상태의 인원을 시체운반용부대에 옮겨 담을 수 있는지를 정합니다.</Korean>
</Key>
<Key ID="STR_ACE_Medical_Treatment_AllowGaveDigging_DisplayName">
<English>Allow Grave Digging</English>
</Key>
<Key ID="STR_ACE_Medical_Treatment_AllowGaveDigging_Description">
<English>Enables digging graves to dispose of corpes.</English>
Drofseh marked this conversation as resolved.
Show resolved Hide resolved
</Key>
<Key ID="STR_ACE_Medical_Treatment_AllowGraveUnconscious_DisplayName">
<English>Allow Unconscious Grave</English>
</Key>
<Key ID="STR_ACE_Medical_Treatment_AllowGraveUnconscious_Description">
<English>Enables placing an unconscious patient in a grave.</English>
</Key>
<Key ID="STR_ACE_Medical_Treatment_MedicIV_DisplayName">
<English>Allow IV Transfusion</English>
<German>Erlaube Bluttransfusionen</German>
Expand Down Expand Up @@ -4441,6 +4459,12 @@
<Chinese>將屍體放入屍袋中...</Chinese>
<Turkish>Vücut, ceset torbasına yerleştiriliyor...</Turkish>
</Key>
<Key ID="STR_ACE_Medical_Treatment_DigGrave">
<English>Dig grave for body</English>
</Key>
<Key ID="STR_ACE_Medical_Treatment_DiggingGrave">
<English>Digging grave for body...</English>
</Key>
<Key ID="STR_ACE_Medical_Treatment_Activity_bandagedPatient">
<English>%1 has bandaged patient</English>
<Spanish>%1 has vendado al paciente</Spanish>
Expand Down