Medical Treatement - Add Grave Digging To Body Bags (#9442)

* add grave digging to body bags

* move buryBodyBag action to config, change grave ui icon to headstone

* improvements from code review

* switch direction check to man instead of bodybag, nominally allowing anything to be buried

---------

Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com>
This commit is contained in:
Drofseh 2023-10-01 11:55:13 -07:00 committed by GitHub
parent 66deb59037
commit 8bf0772558
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 57 additions and 12 deletions

Binary file not shown.

View File

@ -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);

View File

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

View File

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

View File

@ -0,0 +1,30 @@
#include "..\script_component.hpp"
/*
* Author: drofseh
* Places a body bag inside a grave.
*
* Arguments:
* 0: Medic <OBJECT>
* 1: Patient <OBJECT>
*
* 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);

View File

@ -34,10 +34,17 @@ if (alive _patient) then {
[_patient, "buried_alive", _medic] call EFUNC(medical_status,setDead);
};
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");
private _direction = (_headPos vectorFromTo _spinePos) call CBA_fnc_vectDir;
private _position = getPosASL _patient;
_direction = (_headPos vectorFromTo _spinePos) call CBA_fnc_vectDir;
} else {
_direction getDir _patient;
};
// apply adjustments
_position = _position vectorAdd _offset;
_direction = _direction + _rotation;

View File

@ -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"];