ACE3/addons/medical_treatment/XEH_postInit.sqf
Drofseh 94f3b301e0
Medical Treatment - Add Grave Digging for Corpse Disposal (#9276)
* Add grave digging

* Update fnc_placeInBodyBagOrGrave.sqf

* Update fnc_placeInBodyBagOrGrave.sqf

* Update fnc_placeInBodyBagOrGrave.sqf

* Update addons/medical_treatment/functions/fnc_placeInBodyBag.sqf

Co-authored-by: BrettMayson <brett@mayson.io>

* Add setting to enable/disable

* 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

* fix typo in variable

* Apply suggestions from code review

Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>

* add to XEH_PREP and fix event for non-local patient

* Add interaction to check name on headstone

* Update addons/medical_treatment/XEH_postInit.sqf

Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>

* Simplify Setting

* Apply suggestions from code review

Co-authored-by: jonpas <jonpas33@gmail.com>

* Update addons/medical_treatment/stringtable.xml

Co-authored-by: jonpas <jonpas33@gmail.com>

* Make placeInBodyBagOrGrave more generic and use any grave class

* Update addons/medical_treatment/functions/fnc_placeInGrave.sqf

Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>

* Update medical-treatment-framework.md

* Update docs/wiki/framework/medical-treatment-framework.md

Co-authored-by: jonpas <jonpas33@gmail.com>

* update docs

* Update addons/medical_treatment/functions/fnc_placeInBodyBagOrGrave.sqf

* Update addons/medical_treatment/functions/fnc_placeInGrave.sqf

* fix includes

---------

Co-authored-by: BrettMayson <brett@mayson.io>
Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>
Co-authored-by: PabstMirror <pabstmirror@gmail.com>
Co-authored-by: jonpas <jonpas33@gmail.com>
Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com>
2023-09-24 15:57:08 -04:00

96 lines
3.8 KiB
Plaintext

#include "script_component.hpp"
[QEGVAR(medical_status,initialized), {
params ["_unit"];
// Clear all saved medical logs
{
_unit setVariable [_x, nil, true];
} forEach (_unit getVariable [QEGVAR(medical,allLogs), []]);
_unit setVariable [QEGVAR(medical,allLogs), [], true];
}] call CBA_fnc_addEventHandler;
// Handle body removal and litter on server
if (isServer) then {
[QGVAR(createLitterServer), LINKFUNC(createLitterServer)] call CBA_fnc_addEventHandler;
["ace_placedInBodyBag", LINKFUNC(removeBody)] call CBA_fnc_addEventHandler;
};
// Treatment events
[QGVAR(bandageLocal), LINKFUNC(bandageLocal)] call CBA_fnc_addEventHandler;
[QGVAR(checkBloodPressureLocal), LINKFUNC(checkBloodPressureLocal)] call CBA_fnc_addEventHandler;
[QGVAR(checkPulseLocal), LINKFUNC(checkPulseLocal)] call CBA_fnc_addEventHandler;
[QGVAR(cprLocal), LINKFUNC(cprLocal)] call CBA_fnc_addEventHandler;
[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(placeInBodyBagOrGrave), LINKFUNC(placeInBodyBagOrGrave)] call CBA_fnc_addEventHandler;
[QGVAR(splintLocal), LINKFUNC(splintLocal)] call CBA_fnc_addEventHandler;
[QGVAR(tourniquetLocal), LINKFUNC(tourniquetLocal)] call CBA_fnc_addEventHandler;
// Logging events
[QGVAR(addToLog), LINKFUNC(addToLog)] call CBA_fnc_addEventHandler;
[QGVAR(addToTriageCard), LINKFUNC(addToTriageCard)] call CBA_fnc_addEventHandler;
// replace medical items with their ACE equivalents
["CBA_settingsInitialized", {
TRACE_1("CBA_settingsInitialized EH",GVAR(convertItems)); // 0: Enabled 1: RemoveOnly 2:Disabled
if (GVAR(convertItems) == 2) exitWith {};
{
// turn [["stuff", 2], ...] into ["stuff", "stuff", ...]
private _replacements = [];
if (GVAR(convertItems) == 0) then {
{
_x params ["_item", "_count"];
for "_i" from 1 to _count do {
_replacements pushBack _item;
};
} forEach getArray _x;
};
// check if replacement is for item type or class name
private _configName = configName _x;
private _toReplace = if ((_configName select [0,9]) == "ItemType_") then {
parseNumber (_configName select [9])
} else {
_configName
};
// register replacement
[_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 = [
QGVAR(checkHeadstone),
LLSTRING(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;
};
};