From 92e2ba2f37c655954a344d7a58264116c2ddd598 Mon Sep 17 00:00:00 2001 From: Drofseh Date: Fri, 21 Jul 2023 01:04:39 -0700 Subject: [PATCH 01/24] Add grave digging --- addons/medical_gui/ui/cross_grave.paa | Bin 0 -> 5625 bytes .../ACE_Medical_Treatment_Actions.hpp | 11 ++- .../functions/fnc_canDigGrave.sqf | 21 ++++++ .../functions/fnc_placeInBodyBag.sqf | 40 ++--------- .../functions/fnc_placeInBodyBagOrGrave.sqf | 68 ++++++++++++++++++ addons/medical_treatment/initSettings.sqf | 18 +++++ addons/medical_treatment/stringtable.xml | 18 +++++ 7 files changed, 139 insertions(+), 37 deletions(-) create mode 100644 addons/medical_gui/ui/cross_grave.paa create mode 100644 addons/medical_treatment/functions/fnc_canDigGrave.sqf create mode 100644 addons/medical_treatment/functions/fnc_placeInBodyBagOrGrave.sqf diff --git a/addons/medical_gui/ui/cross_grave.paa b/addons/medical_gui/ui/cross_grave.paa new file mode 100644 index 0000000000000000000000000000000000000000..f3b7f1570c165312a10f5432fe28130ee26f3217 GIT binary patch literal 5625 zcmeI0KX21O7{*^K4f2BUKqiEm#RFd;3n1A=N)`}E&%wnhxPh>5BwbafkX7_Dp9XO^a1<%!Xu9ecPMAF6})Ij;m7iR zoE)P05-DX_(%!gr3**-8Z;q#%`nu<>fBS@Zqu)YMS;UHdF*eT-ul0L~wa}ldKR&_r z&Gjqdg`plSiG}~HpVJUQJaSwp3hhoW<)&R8kT0OR=!>6b5$c^vm09Oqs(=xp=fCF>jd&9WBy z#eZJ2^0F2BSL6S@=zQ>RJpbu9N%kGcSKW}sZwo{I+I8Cwe+tC%Jku=Nanu>t9v>x% zZ!2}|3cr|*G`E9n`Yd-R-VfbyozUfKn_Mxkg%bu`kD2FXIUd$_KVeIfD!GVwc(6CZ z#vCBB>9gF9pY85I0+-i4R;nEz-X0ka+WFDdCYwKt_P + * 1: Patient + * + * Return Value: + * Can dig + * + * Example: + * [ACE_player] call ace_trenches_fnc_canDigGrave + * + * Public: No + */ + +params ["", "_patient"]; + +_patient call EFUNC(common,canDig) diff --git a/addons/medical_treatment/functions/fnc_placeInBodyBag.sqf b/addons/medical_treatment/functions/fnc_placeInBodyBag.sqf index 87de5f35429..773ea7d7354 100644 --- a/addons/medical_treatment/functions/fnc_placeInBodyBag.sqf +++ b/addons/medical_treatment/functions/fnc_placeInBodyBag.sqf @@ -1,6 +1,6 @@ #include "script_component.hpp" /* - * Author: Glowbal + * Author: Glowbal, drofseh * Places a dead body inside a body bag. * * Arguments: @@ -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_placeInBodyBag; diff --git a/addons/medical_treatment/functions/fnc_placeInBodyBagOrGrave.sqf b/addons/medical_treatment/functions/fnc_placeInBodyBagOrGrave.sqf new file mode 100644 index 00000000000..17be2cd5701 --- /dev/null +++ b/addons/medical_treatment/functions/fnc_placeInBodyBagOrGrave.sqf @@ -0,0 +1,68 @@ +#include "script_component.hpp" +/* + * Author: Glowbal, drofseh + * Places a dead body inside a body bag. + * + * Arguments: + * 0: Medic + * 1: Patient + * 2: Body Part (not used) + * 3: Treatment (not used) + * 4: Item User (not used) + * 5: Used Item (default: "ACE_bodyBag") + * + * Return Value: + * None + * + * Example: + * [player, cursorObject, "ACE_bodyBagObject"] call ace_medical_treatment_fnc_placeInBodyBagOrGrave + * + * Public: No + */ + +params ["_medic", "_patient", "", "", "", ["_usedItem", "ACE_bodyBag"]]; +TRACE_1("placeInBodyBagOrGrave",_patient); + +private _alive = alive _patient; +private _restingPlace = "ACE_bodyBagObject"; +if (_usedItem == "ACE_EntrenchingTool") then { + _restingPlace = "Land_Grave_dirt_F"; +}; + +if (_alive && {!GVAR(allowBodyBagUnconscious) && {_restingPlace == "ACE_bodyBagObject"}}) exitWith { + [_medic, "ACE_bodyBag"] call EFUNC(common,addToInventory); // re-add slighly used bodybag? + [LSTRING(bodybagWhileStillAlive)] call EFUNC(common,displayTextStructured); +}; + +if (_alive && {!GVAR(allowGraveUnconscious) && {_restingPlace == "Land_Grave_dirt_F"}}) 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; +}; + +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 [_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; diff --git a/addons/medical_treatment/initSettings.sqf b/addons/medical_treatment/initSettings.sqf index f66868aac97..a1d83f2e8dd 100644 --- a/addons/medical_treatment/initSettings.sqf +++ b/addons/medical_treatment/initSettings.sqf @@ -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", @@ -287,6 +296,15 @@ 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", diff --git a/addons/medical_treatment/stringtable.xml b/addons/medical_treatment/stringtable.xml index e444a441bcf..b33c0996f32 100644 --- a/addons/medical_treatment/stringtable.xml +++ b/addons/medical_treatment/stringtable.xml @@ -412,6 +412,12 @@ 装入裹尸袋时间 초 단위로 시체 운반용 부대를 사용하는데 걸리는 시간을 정합니다. + + Grave Digging Time + + + Time, in seconds, required to dig a grave for a patient. + Allow Epinephrine Erlaube Epiniphrin @@ -824,6 +830,12 @@ 能够将昏迷的伤员装入尸袋中。 기절상태의 인원을 시체운반용부대에 옮겨 담을 수 있는지를 정합니다. + + Allow Unconscious Grave + + + Enables placing an unconscious patient in a grave. + Allow IV Transfusion Erlaube Bluttransfusionen @@ -4441,6 +4453,12 @@ 將屍體放入屍袋中... Vücut, ceset torbasına yerleştiriliyor... + + Dig grave for body + + + Digging grave for body... + %1 has bandaged patient %1 has vendado al paciente From 857b1e7f11492c7c482070e7b0209b2b020c3836 Mon Sep 17 00:00:00 2001 From: Drofseh Date: Fri, 21 Jul 2023 01:31:16 -0700 Subject: [PATCH 02/24] Update fnc_placeInBodyBagOrGrave.sqf --- .../functions/fnc_placeInBodyBagOrGrave.sqf | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/addons/medical_treatment/functions/fnc_placeInBodyBagOrGrave.sqf b/addons/medical_treatment/functions/fnc_placeInBodyBagOrGrave.sqf index 17be2cd5701..0ac0c789ac3 100644 --- a/addons/medical_treatment/functions/fnc_placeInBodyBagOrGrave.sqf +++ b/addons/medical_treatment/functions/fnc_placeInBodyBagOrGrave.sqf @@ -25,16 +25,18 @@ TRACE_1("placeInBodyBagOrGrave",_patient); private _alive = alive _patient; private _restingPlace = "ACE_bodyBagObject"; -if (_usedItem == "ACE_EntrenchingTool") then { - _restingPlace = "Land_Grave_dirt_F"; -}; +private _restingPlaceIsBodyBag = _restingPlace == "ACE_bodyBagObject"; -if (_alive && {!GVAR(allowBodyBagUnconscious) && {_restingPlace == "ACE_bodyBagObject"}}) exitWith { +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 (_alive && {!GVAR(allowGraveUnconscious) && {_restingPlace == "Land_Grave_dirt_F"}}) exitWith { +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); }; @@ -48,11 +50,18 @@ if (alive _patient) then { [_patient, "buried_alive", _medic] call EFUNC(medical_status,setDead); }; -private _position = (getPosASL _patient) vectorAdd [0, 0, 0.2]; +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 { + _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 From 43f0e093c30f215899b0f37730226e2921ced892 Mon Sep 17 00:00:00 2001 From: Drofseh Date: Fri, 21 Jul 2023 01:43:22 -0700 Subject: [PATCH 03/24] Update fnc_placeInBodyBagOrGrave.sqf --- addons/medical_treatment/functions/fnc_placeInBodyBagOrGrave.sqf | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/medical_treatment/functions/fnc_placeInBodyBagOrGrave.sqf b/addons/medical_treatment/functions/fnc_placeInBodyBagOrGrave.sqf index 0ac0c789ac3..96bb55d9681 100644 --- a/addons/medical_treatment/functions/fnc_placeInBodyBagOrGrave.sqf +++ b/addons/medical_treatment/functions/fnc_placeInBodyBagOrGrave.sqf @@ -60,6 +60,7 @@ 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 of with the body _direction = _direction + 90; }; From 7f70a2a7b0dd735cff029e07f7b5cbf4fb693808 Mon Sep 17 00:00:00 2001 From: Drofseh Date: Fri, 21 Jul 2023 01:43:34 -0700 Subject: [PATCH 04/24] Update fnc_placeInBodyBagOrGrave.sqf --- .../medical_treatment/functions/fnc_placeInBodyBagOrGrave.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/medical_treatment/functions/fnc_placeInBodyBagOrGrave.sqf b/addons/medical_treatment/functions/fnc_placeInBodyBagOrGrave.sqf index 96bb55d9681..cc6e7387ec4 100644 --- a/addons/medical_treatment/functions/fnc_placeInBodyBagOrGrave.sqf +++ b/addons/medical_treatment/functions/fnc_placeInBodyBagOrGrave.sqf @@ -60,7 +60,7 @@ 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 of with the body + //Orentation of the grave object needs to be rotated 90 degrees to line up with the body _direction = _direction + 90; }; From c09f7a50b84378080ada4d532e0094b952213059 Mon Sep 17 00:00:00 2001 From: Drofseh Date: Fri, 21 Jul 2023 08:23:46 -0700 Subject: [PATCH 05/24] Update addons/medical_treatment/functions/fnc_placeInBodyBag.sqf Co-authored-by: BrettMayson --- addons/medical_treatment/functions/fnc_placeInBodyBag.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/medical_treatment/functions/fnc_placeInBodyBag.sqf b/addons/medical_treatment/functions/fnc_placeInBodyBag.sqf index 773ea7d7354..26c1034aadb 100644 --- a/addons/medical_treatment/functions/fnc_placeInBodyBag.sqf +++ b/addons/medical_treatment/functions/fnc_placeInBodyBag.sqf @@ -18,4 +18,4 @@ * Deprecated */ -_this call ace_medical_treatment_fnc_placeInBodyBag; +_this call ace_medical_treatment_fnc_placeInBodyBagOrGrave; From 2f4ab4c74daf89d9c2c1d0cd285cd081bc35d4d8 Mon Sep 17 00:00:00 2001 From: Drofseh Date: Fri, 21 Jul 2023 08:40:39 -0700 Subject: [PATCH 06/24] Add setting to enable/disable --- addons/medical_treatment/functions/fnc_canDigGrave.sqf | 2 +- addons/medical_treatment/initSettings.sqf | 9 +++++++++ addons/medical_treatment/stringtable.xml | 6 ++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/addons/medical_treatment/functions/fnc_canDigGrave.sqf b/addons/medical_treatment/functions/fnc_canDigGrave.sqf index c258c95d3aa..4ce39aa1f96 100644 --- a/addons/medical_treatment/functions/fnc_canDigGrave.sqf +++ b/addons/medical_treatment/functions/fnc_canDigGrave.sqf @@ -18,4 +18,4 @@ params ["", "_patient"]; -_patient call EFUNC(common,canDig) +!GVAR(allowGaveDigging) && {_patient call EFUNC(common,canDig)} diff --git a/addons/medical_treatment/initSettings.sqf b/addons/medical_treatment/initSettings.sqf index a1d83f2e8dd..a0e3484cb8e 100644 --- a/addons/medical_treatment/initSettings.sqf +++ b/addons/medical_treatment/initSettings.sqf @@ -296,6 +296,15 @@ true ] call CBA_fnc_addSetting; +[ + QGVAR(allowGaveDigging), + "CHECKBOX", + [LSTRING(AllowGaveDigging_DisplayName), LSTRING(AllowGaveDigging_Description)], + [ELSTRING(medical,Category), LSTRING(SubCategory_Treatment)], + true, + true +] call CBA_fnc_addSetting; + [ QGVAR(allowGraveUnconscious), "CHECKBOX", diff --git a/addons/medical_treatment/stringtable.xml b/addons/medical_treatment/stringtable.xml index b33c0996f32..da4cc7fb331 100644 --- a/addons/medical_treatment/stringtable.xml +++ b/addons/medical_treatment/stringtable.xml @@ -830,6 +830,12 @@ 能够将昏迷的伤员装入尸袋中。 기절상태의 인원을 시체운반용부대에 옮겨 담을 수 있는지를 정합니다. + + Allow Grave Digging + + + Enables digging graves to dispose of corpes. + Allow Unconscious Grave From b42a139ebb443360b4254fbb0a86dff1e5c9f04a Mon Sep 17 00:00:00 2001 From: Drofseh Date: Tue, 25 Jul 2023 23:15:14 -0700 Subject: [PATCH 07/24] improvements - fix flipped bool in fnc_canDigGrave - improve fnc_placeInBodyBagOrGrave.sqf by splitting out some checks and item assignment into separate bodybag and grave functions --- .../ACE_Medical_Treatment_Actions.hpp | 3 +- .../functions/fnc_canDigGrave.sqf | 2 +- .../functions/fnc_placeInBodyBag.sqf | 11 ++-- .../functions/fnc_placeInBodyBagOrGrave.sqf | 54 ++++++------------- .../functions/fnc_placeInGrave.sqf | 25 +++++++++ 5 files changed, 53 insertions(+), 42 deletions(-) create mode 100644 addons/medical_treatment/functions/fnc_placeInGrave.sqf diff --git a/addons/medical_treatment/ACE_Medical_Treatment_Actions.hpp b/addons/medical_treatment/ACE_Medical_Treatment_Actions.hpp index b614fbc8ec2..55a42b5f9b6 100644 --- a/addons/medical_treatment/ACE_Medical_Treatment_Actions.hpp +++ b/addons/medical_treatment/ACE_Medical_Treatment_Actions.hpp @@ -249,7 +249,7 @@ class GVAR(actions) { treatmentTime = QGVAR(treatmentTimeBodyBag); items[] = {"ACE_bodyBag"}; condition = QFUNC(canPlaceInBodyBag); - callbackSuccess = QFUNC(placeInBodyBagOrGrave); + callbackSuccess = QFUNC(placeInBodyBag); consumeItem = 1; litter[] = {}; }; @@ -259,6 +259,7 @@ class GVAR(actions) { icon = QPATHTOEF(medical_gui,ui\cross_grave.paa); treatmentTime = QGVAR(treatmentTimeGrave); condition = QFUNC(fnc_canDigGrave); + callbackSuccess = QFUNC(placeInGrave); items[] = {"ACE_EntrenchingTool"}; consumeItem = 0; }; diff --git a/addons/medical_treatment/functions/fnc_canDigGrave.sqf b/addons/medical_treatment/functions/fnc_canDigGrave.sqf index 4ce39aa1f96..6eb0a1f3598 100644 --- a/addons/medical_treatment/functions/fnc_canDigGrave.sqf +++ b/addons/medical_treatment/functions/fnc_canDigGrave.sqf @@ -18,4 +18,4 @@ params ["", "_patient"]; -!GVAR(allowGaveDigging) && {_patient call EFUNC(common,canDig)} +GVAR(allowGaveDigging) && {_patient call EFUNC(common,canDig)} diff --git a/addons/medical_treatment/functions/fnc_placeInBodyBag.sqf b/addons/medical_treatment/functions/fnc_placeInBodyBag.sqf index 26c1034aadb..fece375dcb2 100644 --- a/addons/medical_treatment/functions/fnc_placeInBodyBag.sqf +++ b/addons/medical_treatment/functions/fnc_placeInBodyBag.sqf @@ -14,8 +14,13 @@ * [player, cursorObject] call ace_medical_treatment_fnc_placeInBodyBag * * Public: No - * - * Deprecated */ -_this call ace_medical_treatment_fnc_placeInBodyBagOrGrave; +private _alive = alive _patient; + +if (_alive && {!GVAR(allowBodyBagUnconscious)}) exitWith { + [_medic, "ACE_bodyBag"] call EFUNC(common,addToInventory); // re-add slighly used bodybag? + [LSTRING(bodybagWhileStillAlive)] call EFUNC(common,displayTextStructured); +}; + +[_this,"ACE_bodyBagObject"] call ace_medical_treatment_fnc_placeInBodyBagOrGrave; diff --git a/addons/medical_treatment/functions/fnc_placeInBodyBagOrGrave.sqf b/addons/medical_treatment/functions/fnc_placeInBodyBagOrGrave.sqf index cc6e7387ec4..ad07fa76128 100644 --- a/addons/medical_treatment/functions/fnc_placeInBodyBagOrGrave.sqf +++ b/addons/medical_treatment/functions/fnc_placeInBodyBagOrGrave.sqf @@ -4,12 +4,10 @@ * Places a dead body inside a body bag. * * Arguments: - * 0: Medic - * 1: Patient - * 2: Body Part (not used) - * 3: Treatment (not used) - * 4: Item User (not used) - * 5: Used Item (default: "ACE_bodyBag") + * 0: Arguments + * 0: Medic + * 1: Patient + * 1: Resting Place Object * * Return Value: * None @@ -20,26 +18,10 @@ * Public: No */ -params ["_medic", "_patient", "", "", "", ["_usedItem", "ACE_bodyBag"]]; +params ["_args", "_restingPlaceObject"]; +_args params ["_medic", "_patient"]; 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; @@ -50,18 +32,16 @@ if (alive _patient) then { [_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 +private _position = getPosASL _patient; +if (_restingPlaceObject == "Land_Grave_dirt_F") then { + //Grave object needs to be rotated 90 degrees to line up with the body _direction = _direction + 90; +} else { + //Body bag needs to be a little higher to prevent it from flipping + _position = _position vectorAdd [0, 0, 0.2]; }; // Move the body away so it won't collide with the body bag object @@ -69,10 +49,10 @@ if (_restingPlaceIsGrave) then { _patient setPosASL [-5000, -5000, 0]; // 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; +private _restingPlace = createVehicle [_restingPlaceObject, [0, 0, 0], [], 0, "NONE"]; +_restingPlace setPosASL _position; +_restingPlace 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; +// Keep event name as body bag only to avoid breaking things for others +["ace_placedInBodyBag", [_patient, _restingPlace]] call CBA_fnc_globalEvent; diff --git a/addons/medical_treatment/functions/fnc_placeInGrave.sqf b/addons/medical_treatment/functions/fnc_placeInGrave.sqf new file mode 100644 index 00000000000..167d9e80343 --- /dev/null +++ b/addons/medical_treatment/functions/fnc_placeInGrave.sqf @@ -0,0 +1,25 @@ +#include "script_component.hpp" +/* + * Author: Glowbal, drofseh + * Places a dead body inside a body bag. + * + * Arguments: + * 0: Medic + * 1: Patient + * + * Return Value: + * None + * + * Example: + * [player, cursorObject] call ace_medical_treatment_fnc_placeInGrave + * + * Public: No + */ + +private _alive = alive _patient; + +if (_alive && {!GVAR(allowGraveUnconscious)}) exitWith { + [LSTRING(bodybagWhileStillAlive)] call EFUNC(common,displayTextStructured); +}; + +[_this,"Land_Grave_dirt_F"] call ace_medical_treatment_fnc_placeInBodyBagOrGrave; From 592fdb752072b3570c210e9df09b74ecd94c24bc Mon Sep 17 00:00:00 2001 From: Drofseh Date: Wed, 26 Jul 2023 08:42:39 -0700 Subject: [PATCH 08/24] fix typo in variable --- addons/medical_treatment/functions/fnc_canDigGrave.sqf | 2 +- addons/medical_treatment/initSettings.sqf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/medical_treatment/functions/fnc_canDigGrave.sqf b/addons/medical_treatment/functions/fnc_canDigGrave.sqf index 6eb0a1f3598..1523679b93b 100644 --- a/addons/medical_treatment/functions/fnc_canDigGrave.sqf +++ b/addons/medical_treatment/functions/fnc_canDigGrave.sqf @@ -18,4 +18,4 @@ params ["", "_patient"]; -GVAR(allowGaveDigging) && {_patient call EFUNC(common,canDig)} +GVAR(allowGraveDigging) && {_patient call EFUNC(common,canDig)} diff --git a/addons/medical_treatment/initSettings.sqf b/addons/medical_treatment/initSettings.sqf index a0e3484cb8e..f1fd01b7fad 100644 --- a/addons/medical_treatment/initSettings.sqf +++ b/addons/medical_treatment/initSettings.sqf @@ -297,7 +297,7 @@ ] call CBA_fnc_addSetting; [ - QGVAR(allowGaveDigging), + QGVAR(allowGraveDigging), "CHECKBOX", [LSTRING(AllowGaveDigging_DisplayName), LSTRING(AllowGaveDigging_Description)], [ELSTRING(medical,Category), LSTRING(SubCategory_Treatment)], From 63094cdd2e965cd864233655d1578718b2613fa3 Mon Sep 17 00:00:00 2001 From: Drofseh Date: Tue, 1 Aug 2023 08:46:29 -0700 Subject: [PATCH 09/24] Apply suggestions from code review Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com> --- .../medical_treatment/ACE_Medical_Treatment_Actions.hpp | 2 +- addons/medical_treatment/functions/fnc_canDigGrave.sqf | 4 ++-- addons/medical_treatment/functions/fnc_placeInBodyBag.sqf | 7 ++++--- .../functions/fnc_placeInBodyBagOrGrave.sqf | 8 ++++---- addons/medical_treatment/functions/fnc_placeInGrave.sqf | 7 ++++--- 5 files changed, 15 insertions(+), 13 deletions(-) diff --git a/addons/medical_treatment/ACE_Medical_Treatment_Actions.hpp b/addons/medical_treatment/ACE_Medical_Treatment_Actions.hpp index 55a42b5f9b6..ea4b120e940 100644 --- a/addons/medical_treatment/ACE_Medical_Treatment_Actions.hpp +++ b/addons/medical_treatment/ACE_Medical_Treatment_Actions.hpp @@ -258,7 +258,7 @@ class GVAR(actions) { displayNameProgress = CSTRING(DiggingGrave); icon = QPATHTOEF(medical_gui,ui\cross_grave.paa); treatmentTime = QGVAR(treatmentTimeGrave); - condition = QFUNC(fnc_canDigGrave); + condition = QFUNC(canDigGrave); callbackSuccess = QFUNC(placeInGrave); items[] = {"ACE_EntrenchingTool"}; consumeItem = 0; diff --git a/addons/medical_treatment/functions/fnc_canDigGrave.sqf b/addons/medical_treatment/functions/fnc_canDigGrave.sqf index 1523679b93b..b72a4006ea1 100644 --- a/addons/medical_treatment/functions/fnc_canDigGrave.sqf +++ b/addons/medical_treatment/functions/fnc_canDigGrave.sqf @@ -4,14 +4,14 @@ * Checks if a unit can dig a grave at the position of the patient. * * Arguments: - * 0: Medic (not used) + * 0: Medic * 1: Patient * * Return Value: * Can dig * * Example: - * [ACE_player] call ace_trenches_fnc_canDigGrave + * [player, cursorObject] call ace_medical_treatment_fnc_canDigGrave * * Public: No */ diff --git a/addons/medical_treatment/functions/fnc_placeInBodyBag.sqf b/addons/medical_treatment/functions/fnc_placeInBodyBag.sqf index fece375dcb2..d69e6c0013a 100644 --- a/addons/medical_treatment/functions/fnc_placeInBodyBag.sqf +++ b/addons/medical_treatment/functions/fnc_placeInBodyBag.sqf @@ -16,11 +16,12 @@ * Public: No */ -private _alive = alive _patient; +params ["_medic", "_patient"]; +TRACE_1("placeInBodyBag",_patient); -if (_alive && {!GVAR(allowBodyBagUnconscious)}) exitWith { +if ((alive _patient) && {!GVAR(allowBodyBagUnconscious)}) exitWith { [_medic, "ACE_bodyBag"] call EFUNC(common,addToInventory); // re-add slighly used bodybag? [LSTRING(bodybagWhileStillAlive)] call EFUNC(common,displayTextStructured); }; -[_this,"ACE_bodyBagObject"] call ace_medical_treatment_fnc_placeInBodyBagOrGrave; +[_this, "ACE_bodyBagObject"] call FUNC(placeInBodyBagOrGrave); diff --git a/addons/medical_treatment/functions/fnc_placeInBodyBagOrGrave.sqf b/addons/medical_treatment/functions/fnc_placeInBodyBagOrGrave.sqf index ad07fa76128..766ab1a8db2 100644 --- a/addons/medical_treatment/functions/fnc_placeInBodyBagOrGrave.sqf +++ b/addons/medical_treatment/functions/fnc_placeInBodyBagOrGrave.sqf @@ -13,7 +13,7 @@ * None * * Example: - * [player, cursorObject, "ACE_bodyBagObject"] call ace_medical_treatment_fnc_placeInBodyBagOrGrave + * [[player, cursorObject], "ACE_bodyBagObject"] call ace_medical_treatment_fnc_placeInBodyBagOrGrave * * Public: No */ @@ -24,7 +24,7 @@ TRACE_1("placeInBodyBagOrGrave",_patient); if (!local _patient) exitWith { TRACE_1("Calling where local",local _patient); - [QGVAR(placeInGrave), [nil, _patient], _patient] call CBA_fnc_targetEvent; + [QGVAR(placeInBodyBagOrGrave), _this, _patient] call CBA_fnc_targetEvent; }; if (alive _patient) then { @@ -37,10 +37,10 @@ private _spinePos = _patient modelToWorldVisual (_patient selectionPosition "Spi private _direction = (_headPos vectorFromTo _spinePos) call CBA_fnc_vectDir; private _position = getPosASL _patient; if (_restingPlaceObject == "Land_Grave_dirt_F") then { - //Grave object needs to be rotated 90 degrees to line up with the body + // Grave object needs to be rotated 90 degrees to line up with the body _direction = _direction + 90; } else { - //Body bag needs to be a little higher to prevent it from flipping + // Body bag needs to be a little higher to prevent it from flipping _position = _position vectorAdd [0, 0, 0.2]; }; diff --git a/addons/medical_treatment/functions/fnc_placeInGrave.sqf b/addons/medical_treatment/functions/fnc_placeInGrave.sqf index 167d9e80343..a16bca8973d 100644 --- a/addons/medical_treatment/functions/fnc_placeInGrave.sqf +++ b/addons/medical_treatment/functions/fnc_placeInGrave.sqf @@ -16,10 +16,11 @@ * Public: No */ -private _alive = alive _patient; +params ["_medic", "_patient"]; +TRACE_1("placeInGrave",_patient); -if (_alive && {!GVAR(allowGraveUnconscious)}) exitWith { +if ((alive _patient) && {!GVAR(allowGraveUnconscious)}) exitWith { [LSTRING(bodybagWhileStillAlive)] call EFUNC(common,displayTextStructured); }; -[_this,"Land_Grave_dirt_F"] call ace_medical_treatment_fnc_placeInBodyBagOrGrave; +[_this, "Land_Grave_dirt_F"] call FUNC(placeInBodyBagOrGrave); From 3c535f37515c3f83dc271a7c9c29b4c242da57b8 Mon Sep 17 00:00:00 2001 From: Drofseh Date: Wed, 2 Aug 2023 19:41:09 -0700 Subject: [PATCH 10/24] Apply suggestions from code review Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com> --- addons/medical_treatment/ACE_Medical_Treatment_Actions.hpp | 2 +- addons/medical_treatment/functions/fnc_canDigGrave.sqf | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/addons/medical_treatment/ACE_Medical_Treatment_Actions.hpp b/addons/medical_treatment/ACE_Medical_Treatment_Actions.hpp index ea4b120e940..9ed1b2998e2 100644 --- a/addons/medical_treatment/ACE_Medical_Treatment_Actions.hpp +++ b/addons/medical_treatment/ACE_Medical_Treatment_Actions.hpp @@ -260,7 +260,7 @@ class GVAR(actions) { treatmentTime = QGVAR(treatmentTimeGrave); condition = QFUNC(canDigGrave); callbackSuccess = QFUNC(placeInGrave); - items[] = {"ACE_EntrenchingTool"}; + items[] = {}; consumeItem = 0; }; class CPR: BasicBandage { diff --git a/addons/medical_treatment/functions/fnc_canDigGrave.sqf b/addons/medical_treatment/functions/fnc_canDigGrave.sqf index b72a4006ea1..bf875338d03 100644 --- a/addons/medical_treatment/functions/fnc_canDigGrave.sqf +++ b/addons/medical_treatment/functions/fnc_canDigGrave.sqf @@ -16,6 +16,8 @@ * Public: No */ -params ["", "_patient"]; +params ["_medic", "_patient"]; -GVAR(allowGraveDigging) && {_patient call EFUNC(common,canDig)} +if !(["ace_trenches"] call EFUNC(common,isModLoaded)) exitWith {false}; + +GVAR(allowGraveDigging) && {_patient call EFUNC(common,canDig)} && {_medic call EFUNC(trenches,hasEntrenchingTool)} From 55427bc8ac9165621ba3779e40d4e826e243d3dc Mon Sep 17 00:00:00 2001 From: Drofseh Date: Wed, 2 Aug 2023 19:46:25 -0700 Subject: [PATCH 11/24] add to XEH_PREP and fix event for non-local patient --- addons/medical_treatment/XEH_PREP.hpp | 3 +++ addons/medical_treatment/XEH_postInit.sqf | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/medical_treatment/XEH_PREP.hpp b/addons/medical_treatment/XEH_PREP.hpp index ab128aa49cf..ee92bbe0918 100644 --- a/addons/medical_treatment/XEH_PREP.hpp +++ b/addons/medical_treatment/XEH_PREP.hpp @@ -6,6 +6,7 @@ PREP(bandageLocal); PREP(bodyCleanupLoop); PREP(canBandage); PREP(canCPR); +PREP(canDigGrave); PREP(canPlaceInBodyBag); PREP(canSplint); PREP(canStitch); @@ -47,6 +48,8 @@ PREP(medication); PREP(medicationLocal); PREP(onMedicationUsage); PREP(placeInBodyBag); +PREP(placeInBodyBagOrGrave); +PREP(placeInGrave); PREP(removeBody); PREP(scanMedicalItems); PREP(setTriageStatus); diff --git a/addons/medical_treatment/XEH_postInit.sqf b/addons/medical_treatment/XEH_postInit.sqf index 3d01cb7158b..a7884d57f40 100644 --- a/addons/medical_treatment/XEH_postInit.sqf +++ b/addons/medical_treatment/XEH_postInit.sqf @@ -25,7 +25,7 @@ if (isServer) then { [QGVAR(fullHealLocal), LINKFUNC(fullHealLocal)] call CBA_fnc_addEventHandler; [QGVAR(ivBagLocal), LINKFUNC(ivBagLocal)] call CBA_fnc_addEventHandler; [QGVAR(medicationLocal), LINKFUNC(medicationLocal)] call CBA_fnc_addEventHandler; -[QGVAR(placeInBodyBag), LINKFUNC(placeInBodyBag)] call CBA_fnc_addEventHandler; +[QGVAR(placeInBodyBagOrGrave), LINKFUNC(placeInBodyBagOrGrave)] call CBA_fnc_addEventHandler; [QGVAR(splintLocal), LINKFUNC(splintLocal)] call CBA_fnc_addEventHandler; [QGVAR(tourniquetLocal), LINKFUNC(tourniquetLocal)] call CBA_fnc_addEventHandler; From 444ed9a67d58dc1f46b7ad8f598bc7a071701f2a Mon Sep 17 00:00:00 2001 From: Drofseh Date: Thu, 3 Aug 2023 00:48:24 -0700 Subject: [PATCH 12/24] Add interaction to check name on headstone --- addons/medical_treatment/XEH_postInit.sqf | 32 +++++++++++++++++++++++ addons/medical_treatment/stringtable.xml | 3 +++ 2 files changed, 35 insertions(+) diff --git a/addons/medical_treatment/XEH_postInit.sqf b/addons/medical_treatment/XEH_postInit.sqf index a7884d57f40..4e868194dcb 100644 --- a/addons/medical_treatment/XEH_postInit.sqf +++ b/addons/medical_treatment/XEH_postInit.sqf @@ -61,3 +61,35 @@ if (isServer) then { [_toReplace, _replacements] call EFUNC(common,registerItemReplacement); } forEach (configProperties [configFile >> QEGVAR(medical,replacementItems), "isArray _x"]); }] call CBA_fnc_addEventHandler; + +if (["ace_trenches"] call EFUNC(common,isModLoaded)) then { + if (hasInterface) then { + private _checkHeadstoneAction = [ + "ACE_CheckHeadstone", + format ["%1", localize LSTRING(checkHeadstoneName)], + QPATHTOEF(medical_gui,ui\cross_grave.paa), + { + [ + [_target getVariable QGVAR(headstoneData)], + true + ] call CBA_fnc_notify; + }, + {!isNil {_target getVariable QGVAR(headstoneData)}}, + {}, + [], + [1.05,0.02,0.3] //position in centre of cross + ] call EFUNC(interact_menu,createAction); + + ["Land_Grave_dirt_F", 0, [], _checkHeadstoneAction] call EFUNC(interact_menu,addActionToClass); + }; + + if (isServer) then { + ["ace_placedInBodyBag", { + params ["_target", "_restingPlace"]; + TRACE_2("ace_placedInBodyBag eh",_target,_restingPlace); + + private _targetName = [_target, false, true] call EFUNC(common,getName); + _restingPlace setVariable [QGVAR(headstoneData), _targetName, true]; + }] call CBA_fnc_addEventHandler; + }; +}; diff --git a/addons/medical_treatment/stringtable.xml b/addons/medical_treatment/stringtable.xml index da4cc7fb331..b9cddcb08ac 100644 --- a/addons/medical_treatment/stringtable.xml +++ b/addons/medical_treatment/stringtable.xml @@ -4706,5 +4706,8 @@ 身体抽搐了一下,可能还没死! 꿈틀대는걸 보니 죽은 것 같지는 않습니다! + + Check name on headstone + From 88e4d6f4c45fd108c90bd1f743e17112386256e4 Mon Sep 17 00:00:00 2001 From: Drofseh Date: Thu, 3 Aug 2023 09:08:38 -0700 Subject: [PATCH 13/24] Update addons/medical_treatment/XEH_postInit.sqf Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com> --- addons/medical_treatment/XEH_postInit.sqf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/medical_treatment/XEH_postInit.sqf b/addons/medical_treatment/XEH_postInit.sqf index 4e868194dcb..e943b0c8c3a 100644 --- a/addons/medical_treatment/XEH_postInit.sqf +++ b/addons/medical_treatment/XEH_postInit.sqf @@ -65,8 +65,8 @@ if (isServer) then { if (["ace_trenches"] call EFUNC(common,isModLoaded)) then { if (hasInterface) then { private _checkHeadstoneAction = [ - "ACE_CheckHeadstone", - format ["%1", localize LSTRING(checkHeadstoneName)], + QGVAR(checkHeadstone), + LLSTRING(checkHeadstoneName), QPATHTOEF(medical_gui,ui\cross_grave.paa), { [ @@ -77,7 +77,7 @@ if (["ace_trenches"] call EFUNC(common,isModLoaded)) then { {!isNil {_target getVariable QGVAR(headstoneData)}}, {}, [], - [1.05,0.02,0.3] //position in centre of cross + [1.05, 0.02, 0.3] //position in centre of cross ] call EFUNC(interact_menu,createAction); ["Land_Grave_dirt_F", 0, [], _checkHeadstoneAction] call EFUNC(interact_menu,addActionToClass); From 2e9f5367cf1abd46cf9f32b13678f632bf083a6b Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Mon, 7 Aug 2023 10:51:33 -0500 Subject: [PATCH 14/24] Simplify Setting --- .../medical_treatment/functions/fnc_canDigGrave.sqf | 2 +- .../functions/fnc_placeInGrave.sqf | 2 +- addons/medical_treatment/initSettings.sqf | 13 ++----------- addons/medical_treatment/stringtable.xml | 7 ++----- 4 files changed, 6 insertions(+), 18 deletions(-) diff --git a/addons/medical_treatment/functions/fnc_canDigGrave.sqf b/addons/medical_treatment/functions/fnc_canDigGrave.sqf index bf875338d03..59157147c8a 100644 --- a/addons/medical_treatment/functions/fnc_canDigGrave.sqf +++ b/addons/medical_treatment/functions/fnc_canDigGrave.sqf @@ -20,4 +20,4 @@ params ["_medic", "_patient"]; if !(["ace_trenches"] call EFUNC(common,isModLoaded)) exitWith {false}; -GVAR(allowGraveDigging) && {_patient call EFUNC(common,canDig)} && {_medic call EFUNC(trenches,hasEntrenchingTool)} +(GVAR(allowGraveDigging) > 0) && {_patient call EFUNC(common,canDig)} && {_medic call EFUNC(trenches,hasEntrenchingTool)} diff --git a/addons/medical_treatment/functions/fnc_placeInGrave.sqf b/addons/medical_treatment/functions/fnc_placeInGrave.sqf index a16bca8973d..0ef45508138 100644 --- a/addons/medical_treatment/functions/fnc_placeInGrave.sqf +++ b/addons/medical_treatment/functions/fnc_placeInGrave.sqf @@ -19,7 +19,7 @@ params ["_medic", "_patient"]; TRACE_1("placeInGrave",_patient); -if ((alive _patient) && {!GVAR(allowGraveUnconscious)}) exitWith { +if ((alive _patient) && {GVAR(allowGraveDigging) < 2}) exitWith { [LSTRING(bodybagWhileStillAlive)] call EFUNC(common,displayTextStructured); }; diff --git a/addons/medical_treatment/initSettings.sqf b/addons/medical_treatment/initSettings.sqf index f1fd01b7fad..5bb49248d7a 100644 --- a/addons/medical_treatment/initSettings.sqf +++ b/addons/medical_treatment/initSettings.sqf @@ -298,19 +298,10 @@ [ QGVAR(allowGraveDigging), - "CHECKBOX", + "LIST", [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, + [[0, 1, 2], [ELSTRING(common,Disabled), LSTRING(AllowGaveDigging_graveOnlyDead), ELSTRING(common,Yes)], 1], true ] call CBA_fnc_addSetting; diff --git a/addons/medical_treatment/stringtable.xml b/addons/medical_treatment/stringtable.xml index b9cddcb08ac..8f134b3044a 100644 --- a/addons/medical_treatment/stringtable.xml +++ b/addons/medical_treatment/stringtable.xml @@ -836,11 +836,8 @@ Enables digging graves to dispose of corpes. - - Allow Unconscious Grave - - - Enables placing an unconscious patient in a grave. + + Only if dead Allow IV Transfusion From 1906559fa38f0a4a4253a9a9afcbcaba65b9833d Mon Sep 17 00:00:00 2001 From: Drofseh Date: Fri, 11 Aug 2023 14:48:02 -0700 Subject: [PATCH 15/24] Apply suggestions from code review Co-authored-by: jonpas --- .../medical_treatment/functions/fnc_placeInBodyBagOrGrave.sqf | 4 ++-- addons/medical_treatment/stringtable.xml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/medical_treatment/functions/fnc_placeInBodyBagOrGrave.sqf b/addons/medical_treatment/functions/fnc_placeInBodyBagOrGrave.sqf index 766ab1a8db2..c2b4267278f 100644 --- a/addons/medical_treatment/functions/fnc_placeInBodyBagOrGrave.sqf +++ b/addons/medical_treatment/functions/fnc_placeInBodyBagOrGrave.sqf @@ -5,8 +5,8 @@ * * Arguments: * 0: Arguments - * 0: Medic - * 1: Patient + * - 0: Medic + * - 1: Patient * 1: Resting Place Object * * Return Value: diff --git a/addons/medical_treatment/stringtable.xml b/addons/medical_treatment/stringtable.xml index 8f134b3044a..0c85976ca59 100644 --- a/addons/medical_treatment/stringtable.xml +++ b/addons/medical_treatment/stringtable.xml @@ -834,7 +834,7 @@ Allow Grave Digging - Enables digging graves to dispose of corpes. + Enables digging graves to dispose of corpses. Only if dead From 1a91219286a7a53c87727fb62dcc9c5cd8728c7b Mon Sep 17 00:00:00 2001 From: Drofseh Date: Fri, 11 Aug 2023 20:22:16 -0700 Subject: [PATCH 16/24] Update addons/medical_treatment/stringtable.xml Co-authored-by: jonpas --- addons/medical_treatment/stringtable.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/medical_treatment/stringtable.xml b/addons/medical_treatment/stringtable.xml index 0c85976ca59..6b404bc68c4 100644 --- a/addons/medical_treatment/stringtable.xml +++ b/addons/medical_treatment/stringtable.xml @@ -416,7 +416,7 @@ Grave Digging Time - Time, in seconds, required to dig a grave for a patient. + Time, in seconds, required to dig a grave for a body. Allow Epinephrine From 8b7f95e397878db4b2f5077b817c4170f154080e Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Fri, 25 Aug 2023 11:28:41 -0500 Subject: [PATCH 17/24] Make placeInBodyBagOrGrave more generic and use any grave class --- .../functions/fnc_placeInBodyBag.sqf | 3 ++- .../functions/fnc_placeInBodyBagOrGrave.sqf | 19 +++++++++---------- .../functions/fnc_placeInGrave.sqf | 7 ++++++- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/addons/medical_treatment/functions/fnc_placeInBodyBag.sqf b/addons/medical_treatment/functions/fnc_placeInBodyBag.sqf index d69e6c0013a..964e1b1ece9 100644 --- a/addons/medical_treatment/functions/fnc_placeInBodyBag.sqf +++ b/addons/medical_treatment/functions/fnc_placeInBodyBag.sqf @@ -24,4 +24,5 @@ if ((alive _patient) && {!GVAR(allowBodyBagUnconscious)}) exitWith { [LSTRING(bodybagWhileStillAlive)] call EFUNC(common,displayTextStructured); }; -[_this, "ACE_bodyBagObject"] call FUNC(placeInBodyBagOrGrave); +// Body bag needs to be a little higher to prevent it from flipping +[_this, "ACE_bodyBagObject", [0, 0, 0.2]] call FUNC(placeInBodyBagOrGrave); diff --git a/addons/medical_treatment/functions/fnc_placeInBodyBagOrGrave.sqf b/addons/medical_treatment/functions/fnc_placeInBodyBagOrGrave.sqf index c2b4267278f..656e97f06b4 100644 --- a/addons/medical_treatment/functions/fnc_placeInBodyBagOrGrave.sqf +++ b/addons/medical_treatment/functions/fnc_placeInBodyBagOrGrave.sqf @@ -7,7 +7,9 @@ * 0: Arguments * - 0: Medic * - 1: Patient - * 1: Resting Place Object + * 1: Resting Place Classname + * 2: Offset (default: [0,0,0]) + * 3: Rotation (default: 0) * * Return Value: * None @@ -18,7 +20,7 @@ * Public: No */ -params ["_args", "_restingPlaceObject"]; +params ["_args", "_restingPlaceClass", ["_offset", [0,0,0]], ["_rotation", 0]]; _args params ["_medic", "_patient"]; TRACE_1("placeInBodyBagOrGrave",_patient); @@ -36,20 +38,17 @@ private _headPos = _patient modelToWorldVisual (_patient selectionPosition "head private _spinePos = _patient modelToWorldVisual (_patient selectionPosition "Spine3"); private _direction = (_headPos vectorFromTo _spinePos) call CBA_fnc_vectDir; private _position = getPosASL _patient; -if (_restingPlaceObject == "Land_Grave_dirt_F") then { - // Grave object needs to be rotated 90 degrees to line up with the body - _direction = _direction + 90; -} else { - // Body bag needs to be a little higher to prevent it from flipping - _position = _position vectorAdd [0, 0, 0.2]; -}; +// apply adjustments +_position = _position vectorAdd _offset; +_direction = _direction + _rotation; + // 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 _restingPlace = createVehicle [_restingPlaceObject, [0, 0, 0], [], 0, "NONE"]; +private _restingPlace = createVehicle [_restingPlaceClass, [0, 0, 0], [], 0, "NONE"]; _restingPlace setPosASL _position; _restingPlace setDir _direction; diff --git a/addons/medical_treatment/functions/fnc_placeInGrave.sqf b/addons/medical_treatment/functions/fnc_placeInGrave.sqf index 0ef45508138..18d1b15175c 100644 --- a/addons/medical_treatment/functions/fnc_placeInGrave.sqf +++ b/addons/medical_treatment/functions/fnc_placeInGrave.sqf @@ -23,4 +23,9 @@ if ((alive _patient) && {GVAR(allowGraveDigging) < 2}) exitWith { [LSTRING(bodybagWhileStillAlive)] call EFUNC(common,displayTextStructured); }; -[_this, "Land_Grave_dirt_F"] call FUNC(placeInBodyBagOrGrave); +private _graveClassname = missionNameSpace getVariable [QGVAR(graveClassname), "Land_Grave_dirt_F"]; +// Land_Grave_dirt_F needs to be rotated 90 degrees to line up with the body +private _graveRotation = missionNameSpace getVariable [QGVAR(graveRotation), 90]; + + +[_this, _graveClassname, [0,0,0], _graveRotation] call FUNC(placeInBodyBagOrGrave); From 5c9b5cb68640f45427f17ceede91ea7e449ca26c Mon Sep 17 00:00:00 2001 From: Drofseh Date: Sat, 26 Aug 2023 00:08:10 -0700 Subject: [PATCH 18/24] Update addons/medical_treatment/functions/fnc_placeInGrave.sqf Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com> --- addons/medical_treatment/functions/fnc_placeInGrave.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/medical_treatment/functions/fnc_placeInGrave.sqf b/addons/medical_treatment/functions/fnc_placeInGrave.sqf index 18d1b15175c..2cd53bc5a5d 100644 --- a/addons/medical_treatment/functions/fnc_placeInGrave.sqf +++ b/addons/medical_treatment/functions/fnc_placeInGrave.sqf @@ -27,5 +27,5 @@ private _graveClassname = missionNameSpace getVariable [QGVAR(graveClassname), " // Land_Grave_dirt_F needs to be rotated 90 degrees to line up with the body private _graveRotation = missionNameSpace getVariable [QGVAR(graveRotation), 90]; - [_this, _graveClassname, [0,0,0], _graveRotation] call FUNC(placeInBodyBagOrGrave); + From 35f72bb415a32a74976df7f2cd7f58ebf4167c63 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Tue, 29 Aug 2023 15:41:32 -0500 Subject: [PATCH 19/24] Update medical-treatment-framework.md --- docs/wiki/framework/medical-treatment-framework.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/wiki/framework/medical-treatment-framework.md b/docs/wiki/framework/medical-treatment-framework.md index adb9cd485dd..f7680cf1f40 100644 --- a/docs/wiki/framework/medical-treatment-framework.md +++ b/docs/wiki/framework/medical-treatment-framework.md @@ -56,3 +56,10 @@ class ACE_Medical_Treatment_Actions { }; }; ``` + +### 1.4 Grave Digging Object Configuration +Grave type can be changed by setting mission variables +```cpp +ace_medical_treatment_graveClassname = "Land_Grave_11_F"; // classname, e.g. unmarked gravel (no headstone OR check actions) +ace_medical_treatment_graveRotation = 0; // rotation angle (will depend on model classname) +``` From 2b56036778c6fd43f40851ba68e26705aa191ab1 Mon Sep 17 00:00:00 2001 From: Drofseh Date: Wed, 30 Aug 2023 18:49:18 -0700 Subject: [PATCH 20/24] Update docs/wiki/framework/medical-treatment-framework.md Co-authored-by: jonpas --- docs/wiki/framework/medical-treatment-framework.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/wiki/framework/medical-treatment-framework.md b/docs/wiki/framework/medical-treatment-framework.md index f7680cf1f40..0aecee69689 100644 --- a/docs/wiki/framework/medical-treatment-framework.md +++ b/docs/wiki/framework/medical-treatment-framework.md @@ -58,7 +58,9 @@ class ACE_Medical_Treatment_Actions { ``` ### 1.4 Grave Digging Object Configuration + Grave type can be changed by setting mission variables + ```cpp ace_medical_treatment_graveClassname = "Land_Grave_11_F"; // classname, e.g. unmarked gravel (no headstone OR check actions) ace_medical_treatment_graveRotation = 0; // rotation angle (will depend on model classname) From 21ee4567b6289d9f2538dba5db323b51f378aff1 Mon Sep 17 00:00:00 2001 From: Grim <69561145+LinkIsGrim@users.noreply.github.com> Date: Sat, 23 Sep 2023 15:15:00 -0400 Subject: [PATCH 21/24] update docs --- docs/wiki/framework/medical-treatment-framework.md | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/docs/wiki/framework/medical-treatment-framework.md b/docs/wiki/framework/medical-treatment-framework.md index 0aecee69689..ca10a9878ad 100644 --- a/docs/wiki/framework/medical-treatment-framework.md +++ b/docs/wiki/framework/medical-treatment-framework.md @@ -57,11 +57,16 @@ class ACE_Medical_Treatment_Actions { }; ``` -### 1.4 Grave Digging Object Configuration +## 2. Mission Variables -Grave type can be changed by setting mission variables +### 2.1 Grave Digging Object Configuration -```cpp +The object created when digging a grave can be modified by setting the `ace_medical_treatment_graveClassname` variable. +```sqf ace_medical_treatment_graveClassname = "Land_Grave_11_F"; // classname, e.g. unmarked gravel (no headstone OR check actions) +``` + +The object's rotation can also be modified, if necessary. +```sqf ace_medical_treatment_graveRotation = 0; // rotation angle (will depend on model classname) ``` From 64c12afd6655c4a275e939632ad65660b0f0832e Mon Sep 17 00:00:00 2001 From: Grim <69561145+LinkIsGrim@users.noreply.github.com> Date: Sat, 23 Sep 2023 16:42:54 -0400 Subject: [PATCH 22/24] Update addons/medical_treatment/functions/fnc_placeInBodyBagOrGrave.sqf --- .../medical_treatment/functions/fnc_placeInBodyBagOrGrave.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/medical_treatment/functions/fnc_placeInBodyBagOrGrave.sqf b/addons/medical_treatment/functions/fnc_placeInBodyBagOrGrave.sqf index 656e97f06b4..42049511588 100644 --- a/addons/medical_treatment/functions/fnc_placeInBodyBagOrGrave.sqf +++ b/addons/medical_treatment/functions/fnc_placeInBodyBagOrGrave.sqf @@ -1,7 +1,7 @@ #include "script_component.hpp" /* * Author: Glowbal, drofseh - * Places a dead body inside a body bag. + * Places a dead body inside a body bag or grave. * * Arguments: * 0: Arguments From 036825d88282850e42d974a28948d8111334c3ed Mon Sep 17 00:00:00 2001 From: Grim <69561145+LinkIsGrim@users.noreply.github.com> Date: Sat, 23 Sep 2023 16:43:02 -0400 Subject: [PATCH 23/24] Update addons/medical_treatment/functions/fnc_placeInGrave.sqf --- addons/medical_treatment/functions/fnc_placeInGrave.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/medical_treatment/functions/fnc_placeInGrave.sqf b/addons/medical_treatment/functions/fnc_placeInGrave.sqf index 2cd53bc5a5d..d5bf59c89af 100644 --- a/addons/medical_treatment/functions/fnc_placeInGrave.sqf +++ b/addons/medical_treatment/functions/fnc_placeInGrave.sqf @@ -1,7 +1,7 @@ #include "script_component.hpp" /* * Author: Glowbal, drofseh - * Places a dead body inside a body bag. + * Places a dead body inside a grave. * * Arguments: * 0: Medic From 7e3826f15f60bdc2eb6b2298ee5cfca6ebeb0967 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Sat, 23 Sep 2023 21:19:16 -0500 Subject: [PATCH 24/24] fix includes --- addons/medical_treatment/functions/fnc_canDigGrave.sqf | 2 +- .../medical_treatment/functions/fnc_placeInBodyBagOrGrave.sqf | 2 +- addons/medical_treatment/functions/fnc_placeInGrave.sqf | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/medical_treatment/functions/fnc_canDigGrave.sqf b/addons/medical_treatment/functions/fnc_canDigGrave.sqf index 59157147c8a..85c76382ec2 100644 --- a/addons/medical_treatment/functions/fnc_canDigGrave.sqf +++ b/addons/medical_treatment/functions/fnc_canDigGrave.sqf @@ -1,4 +1,4 @@ -#include "script_component.hpp" +#include "..\script_component.hpp" /* * Author: Ruthberg, commy2, esteldunedain, drofseh * Checks if a unit can dig a grave at the position of the patient. diff --git a/addons/medical_treatment/functions/fnc_placeInBodyBagOrGrave.sqf b/addons/medical_treatment/functions/fnc_placeInBodyBagOrGrave.sqf index 42049511588..33a577da81b 100644 --- a/addons/medical_treatment/functions/fnc_placeInBodyBagOrGrave.sqf +++ b/addons/medical_treatment/functions/fnc_placeInBodyBagOrGrave.sqf @@ -1,4 +1,4 @@ -#include "script_component.hpp" +#include "..\script_component.hpp" /* * Author: Glowbal, drofseh * Places a dead body inside a body bag or grave. diff --git a/addons/medical_treatment/functions/fnc_placeInGrave.sqf b/addons/medical_treatment/functions/fnc_placeInGrave.sqf index d5bf59c89af..f9ebf582f3f 100644 --- a/addons/medical_treatment/functions/fnc_placeInGrave.sqf +++ b/addons/medical_treatment/functions/fnc_placeInGrave.sqf @@ -1,4 +1,4 @@ -#include "script_component.hpp" +#include "..\script_component.hpp" /* * Author: Glowbal, drofseh * Places a dead body inside a grave.