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 Treatement - Add Grave Digging To Body Bags #9442

Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
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/grave.paa
Binary file not shown.
2 changes: 1 addition & 1 deletion addons/medical_treatment/ACE_Medical_Treatment_Actions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
7 changes: 7 additions & 0 deletions addons/medical_treatment/CfgVehicles.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ class CfgVehicles {
statement = "";
icon = "\a3\ui_f\data\IGUI\Cfg\Actions\eject_ca.paa";
selection = "";
class GVAR(buryBodyBag) {
displayName = CSTRING(DigGrave);
distance = HANDCUFFS_DISTANCE;
Drofseh marked this conversation as resolved.
Show resolved Hide resolved
condition = QUOTE([_this#1] call FUNC(canDigGrave));
Drofseh marked this conversation as resolved.
Show resolved Hide resolved
statement = QUOTE(_this call FUNC(placeBodyBagInGrave));
icon = QPATHTOEF(medical_gui,ui\grave.paa);
};
};
};
};
Expand Down
17 changes: 10 additions & 7 deletions addons/medical_treatment/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -67,28 +67,31 @@ 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);

["Land_Grave_dirt_F", 0, [], _checkHeadstoneAction] call EFUNC(interact_menu,addActionToClass);
[missionNameSpace getVariable [QGVAR(graveClassname), "ACE_Grave"], 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);
private _targetName = "";
if (_patient isKindOf "ACE_bodyBagObject") then {
Drofseh marked this conversation as resolved.
Show resolved Hide resolved
_targetName = _target getVariable [QGVAR(headstoneData), ""];
} else {
_targetName = [_target, false, true] call EFUNC(common,getName);
};

_restingPlace setVariable [QGVAR(headstoneData), _targetName, true];
}] call CBA_fnc_addEventHandler;
};
Expand Down
30 changes: 30 additions & 0 deletions addons/medical_treatment/functions/fnc_placeBodyBagInGrave.sqf
Original file line number Diff line number Diff line change
@@ -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);
13 changes: 10 additions & 3 deletions addons/medical_treatment/functions/fnc_placeInBodyBagOrGrave.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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 "ACE_bodyBagObject") then {
_direction getDir _patient;
} else {
private _headPos = _patient modelToWorldVisual (_patient selectionPosition "head");
private _spinePos = _patient modelToWorldVisual (_patient selectionPosition "Spine3");
_direction = (_headPos vectorFromTo _spinePos) call CBA_fnc_vectDir;
};

// apply adjustments
_position = _position vectorAdd _offset;
_direction = _direction + _rotation;
Expand Down
1 change: 0 additions & 1 deletion addons/medical_treatment/functions/fnc_placeInGrave.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,3 @@ private _graveClassname = missionNameSpace getVariable [QGVAR(graveClassname), "
private _graveRotation = missionNameSpace getVariable [QGVAR(graveRotation), 90];

[_this, _graveClassname, [0,0,0], _graveRotation] call FUNC(placeInBodyBagOrGrave);