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 { class Grave: BodyBag {
displayName = CSTRING(DigGrave); displayName = CSTRING(DigGrave);
displayNameProgress = CSTRING(DiggingGrave); displayNameProgress = CSTRING(DiggingGrave);
icon = QPATHTOEF(medical_gui,ui\cross_grave.paa); icon = QPATHTOEF(medical_gui,ui\grave.paa);
treatmentTime = QGVAR(treatmentTimeGrave); treatmentTime = QGVAR(treatmentTimeGrave);
condition = QFUNC(canDigGrave); condition = QFUNC(canDigGrave);
callbackSuccess = QFUNC(placeInGrave); callbackSuccess = QFUNC(placeInGrave);

View File

@ -29,6 +29,12 @@ class CfgVehicles {
statement = ""; statement = "";
icon = "\a3\ui_f\data\IGUI\Cfg\Actions\eject_ca.paa"; icon = "\a3\ui_f\data\IGUI\Cfg\Actions\eject_ca.paa";
selection = ""; 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 = [ private _checkHeadstoneAction = [
QGVAR(checkHeadstone), QGVAR(checkHeadstone),
LLSTRING(checkHeadstoneName), LLSTRING(checkHeadstoneName),
QPATHTOEF(medical_gui,ui\cross_grave.paa), QPATHTOEF(medical_gui,ui\grave.paa),
{ {
[ [
[_target getVariable QGVAR(headstoneData)], [_target getVariable QGVAR(headstoneData)],
true true
] call CBA_fnc_notify; ] call CBA_fnc_notify;
}, },
{!isNil {_target getVariable QGVAR(headstoneData)}}, {!isNil {_target getVariable QGVAR(headstoneData)}}
{},
[],
[1.05, 0.02, 0.3] //position in centre of cross
] call EFUNC(interact_menu,createAction); ] 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 { if (isServer) then {
@ -88,7 +85,13 @@ if (["ace_trenches"] call EFUNC(common,isModLoaded)) then {
params ["_target", "_restingPlace"]; params ["_target", "_restingPlace"];
TRACE_2("ace_placedInBodyBag eh",_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]; _restingPlace setVariable [QGVAR(headstoneData), _targetName, true];
}] call CBA_fnc_addEventHandler; }] 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); [_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 _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 // apply adjustments
_position = _position vectorAdd _offset; _position = _position vectorAdd _offset;
_direction = _direction + _rotation; _direction = _direction + _rotation;

View File

@ -23,7 +23,6 @@ if ((alive _patient) && {GVAR(allowGraveDigging) < 2}) exitWith {
[LSTRING(bodybagWhileStillAlive)] call EFUNC(common,displayTextStructured); [LSTRING(bodybagWhileStillAlive)] call EFUNC(common,displayTextStructured);
}; };
private _graveClassname = ""; private _graveClassname = "";
if (GVAR(graveDiggingMarker)) then { if (GVAR(graveDiggingMarker)) then {
_graveClassname = missionNamespace getVariable [QGVAR(graveClassname), "ACE_Grave"]; _graveClassname = missionNamespace getVariable [QGVAR(graveClassname), "ACE_Grave"];