diff --git a/addons/medical_gui/ui/grave.paa b/addons/medical_gui/ui/grave.paa new file mode 100644 index 0000000000..ccd786d73c Binary files /dev/null and b/addons/medical_gui/ui/grave.paa differ diff --git a/addons/medical_treatment/ACE_Medical_Treatment_Actions.hpp b/addons/medical_treatment/ACE_Medical_Treatment_Actions.hpp index 9ed1b2998e..b7fd0ac3bd 100644 --- a/addons/medical_treatment/ACE_Medical_Treatment_Actions.hpp +++ b/addons/medical_treatment/ACE_Medical_Treatment_Actions.hpp @@ -256,7 +256,7 @@ class GVAR(actions) { class Grave: BodyBag { displayName = CSTRING(DigGrave); displayNameProgress = CSTRING(DiggingGrave); - icon = QPATHTOEF(medical_gui,ui\cross_grave.paa); + icon = QPATHTOEF(medical_gui,ui\grave.paa); treatmentTime = QGVAR(treatmentTimeGrave); condition = QFUNC(canDigGrave); callbackSuccess = QFUNC(placeInGrave); diff --git a/addons/medical_treatment/CfgVehicles.hpp b/addons/medical_treatment/CfgVehicles.hpp index c3e119b90c..27e4617b0a 100644 --- a/addons/medical_treatment/CfgVehicles.hpp +++ b/addons/medical_treatment/CfgVehicles.hpp @@ -29,6 +29,12 @@ class CfgVehicles { statement = ""; icon = "\a3\ui_f\data\IGUI\Cfg\Actions\eject_ca.paa"; selection = ""; + class GVAR(buryBodyBag) { + displayName = CSTRING(DigGrave); + condition = QUOTE([_this#1] call FUNC(canDigGrave)); + statement = QUOTE(_this call FUNC(placeBodyBagInGrave)); + icon = QPATHTOEF(medical_gui,ui\grave.paa); + }; }; }; }; diff --git a/addons/medical_treatment/XEH_postInit.sqf b/addons/medical_treatment/XEH_postInit.sqf index edab6121cc..70d45e991c 100644 --- a/addons/medical_treatment/XEH_postInit.sqf +++ b/addons/medical_treatment/XEH_postInit.sqf @@ -67,20 +67,17 @@ if (["ace_trenches"] call EFUNC(common,isModLoaded)) then { private _checkHeadstoneAction = [ QGVAR(checkHeadstone), LLSTRING(checkHeadstoneName), - QPATHTOEF(medical_gui,ui\cross_grave.paa), + QPATHTOEF(medical_gui,ui\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 + {!isNil {_target getVariable QGVAR(headstoneData)}} ] call EFUNC(interact_menu,createAction); - ["ACE_Grave", 0, [], _checkHeadstoneAction] call EFUNC(interact_menu,addActionToClass); + [missionNameSpace getVariable [QGVAR(graveClassname), "ACE_Grave"], 0, [], _checkHeadstoneAction] call EFUNC(interact_menu,addActionToClass); }; if (isServer) then { @@ -88,7 +85,13 @@ if (["ace_trenches"] call EFUNC(common,isModLoaded)) then { params ["_target", "_restingPlace"]; TRACE_2("ace_placedInBodyBag eh",_target,_restingPlace); - private _targetName = [_target, false, true] call EFUNC(common,getName); + private _targetName = ""; + if (_target isKindOf "ACE_bodyBagObject") then { + _targetName = _target getVariable [QGVAR(headstoneData), ""]; + } else { + _targetName = [_target, false, true] call EFUNC(common,getName); + }; + _restingPlace setVariable [QGVAR(headstoneData), _targetName, true]; }] call CBA_fnc_addEventHandler; }; diff --git a/addons/medical_treatment/functions/fnc_placeBodyBagInGrave.sqf b/addons/medical_treatment/functions/fnc_placeBodyBagInGrave.sqf new file mode 100644 index 0000000000..87a80a45e3 --- /dev/null +++ b/addons/medical_treatment/functions/fnc_placeBodyBagInGrave.sqf @@ -0,0 +1,30 @@ +#include "..\script_component.hpp" +/* + * Author: drofseh + * Places a body bag inside a grave. + * + * Arguments: + * 0: Medic + * 1: Patient + * + * Return Value: + * None + * + * Example: + * [cursorObject, player] call ace_medical_treatment_fnc_placeBodyBagInGrave + * + * Public: No + */ + +params ["_bodybag"]; +TRACE_1("placeBodyBagInGrave",_bodybag); + +[ + QGVAR(treatmentTimeGrave), + _this, + { + [[_this#1, _this#0], missionNameSpace getVariable [QGVAR(graveClassname), "ACE_Grave"], [0,0,0], missionNameSpace getVariable [QGVAR(graveRotation), 0]] call FUNC(placeInBodyBagOrGrave); + }, + {}, + LLSTRING(DiggingGrave) +] call EFUNC(common,progressBar); diff --git a/addons/medical_treatment/functions/fnc_placeInBodyBagOrGrave.sqf b/addons/medical_treatment/functions/fnc_placeInBodyBagOrGrave.sqf index 850850e631..40fb8afabd 100644 --- a/addons/medical_treatment/functions/fnc_placeInBodyBagOrGrave.sqf +++ b/addons/medical_treatment/functions/fnc_placeInBodyBagOrGrave.sqf @@ -34,10 +34,17 @@ if (alive _patient) then { [_patient, "buried_alive", _medic] call EFUNC(medical_status,setDead); }; -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; +private _direction = 0; + +if (_patient isKindOf "CaManBase") then { + private _headPos = _patient modelToWorldVisual (_patient selectionPosition "head"); + private _spinePos = _patient modelToWorldVisual (_patient selectionPosition "Spine3"); + _direction = (_headPos vectorFromTo _spinePos) call CBA_fnc_vectDir; +} else { + _direction getDir _patient; +}; + // apply adjustments _position = _position vectorAdd _offset; _direction = _direction + _rotation; diff --git a/addons/medical_treatment/functions/fnc_placeInGrave.sqf b/addons/medical_treatment/functions/fnc_placeInGrave.sqf index b0c8fc3699..8ba67f5172 100644 --- a/addons/medical_treatment/functions/fnc_placeInGrave.sqf +++ b/addons/medical_treatment/functions/fnc_placeInGrave.sqf @@ -23,7 +23,6 @@ if ((alive _patient) && {GVAR(allowGraveDigging) < 2}) exitWith { [LSTRING(bodybagWhileStillAlive)] call EFUNC(common,displayTextStructured); }; - private _graveClassname = ""; if (GVAR(graveDiggingMarker)) then { _graveClassname = missionNamespace getVariable [QGVAR(graveClassname), "ACE_Grave"];