2016-09-18 17:48:49 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2024-08-22 03:48:36 +00:00
|
|
|
// Pain killers item to magazine
|
|
|
|
["ACE_painkillers_Item", "ACE_painkillers"] call EFUNC(common,registerItemReplacement);
|
|
|
|
|
2019-06-03 15:31:46 +00:00
|
|
|
[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
|
2016-09-19 08:05:16 +00:00
|
|
|
if (isServer) then {
|
2019-06-12 00:25:05 +00:00
|
|
|
[QGVAR(createLitterServer), LINKFUNC(createLitterServer)] call CBA_fnc_addEventHandler;
|
|
|
|
["ace_placedInBodyBag", LINKFUNC(removeBody)] call CBA_fnc_addEventHandler;
|
2016-09-19 08:05:16 +00:00
|
|
|
};
|
2016-10-05 22:54:57 +00:00
|
|
|
|
2019-06-03 15:31:46 +00:00
|
|
|
// Treatment events
|
2019-06-12 00:25:05 +00:00
|
|
|
[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;
|
2023-09-24 19:57:08 +00:00
|
|
|
[QGVAR(placeInBodyBagOrGrave), LINKFUNC(placeInBodyBagOrGrave)] call CBA_fnc_addEventHandler;
|
2019-06-12 00:25:05 +00:00
|
|
|
[QGVAR(splintLocal), LINKFUNC(splintLocal)] call CBA_fnc_addEventHandler;
|
|
|
|
[QGVAR(tourniquetLocal), LINKFUNC(tourniquetLocal)] call CBA_fnc_addEventHandler;
|
2019-06-03 15:31:46 +00:00
|
|
|
|
|
|
|
// Logging events
|
2019-06-12 00:25:05 +00:00
|
|
|
[QGVAR(addToLog), LINKFUNC(addToLog)] call CBA_fnc_addEventHandler;
|
|
|
|
[QGVAR(addToTriageCard), LINKFUNC(addToTriageCard)] call CBA_fnc_addEventHandler;
|
2019-10-11 20:00:25 +00:00
|
|
|
|
|
|
|
// replace medical items with their ACE equivalents
|
2021-10-11 20:48:30 +00:00
|
|
|
["CBA_settingsInitialized", {
|
|
|
|
TRACE_1("CBA_settingsInitialized EH",GVAR(convertItems)); // 0: Enabled 1: RemoveOnly 2:Disabled
|
2019-10-11 20:00:25 +00:00
|
|
|
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;
|
2023-09-24 19:57:08 +00:00
|
|
|
|
|
|
|
if (["ace_trenches"] call EFUNC(common,isModLoaded)) then {
|
|
|
|
if (hasInterface) then {
|
|
|
|
private _checkHeadstoneAction = [
|
|
|
|
QGVAR(checkHeadstone),
|
|
|
|
LLSTRING(checkHeadstoneName),
|
2023-10-01 18:55:13 +00:00
|
|
|
QPATHTOEF(medical_gui,ui\grave.paa),
|
2023-09-24 19:57:08 +00:00
|
|
|
{
|
|
|
|
[
|
|
|
|
[_target getVariable QGVAR(headstoneData)],
|
|
|
|
true
|
|
|
|
] call CBA_fnc_notify;
|
|
|
|
},
|
2023-10-01 18:55:13 +00:00
|
|
|
{!isNil {_target getVariable QGVAR(headstoneData)}}
|
2023-09-24 19:57:08 +00:00
|
|
|
] call EFUNC(interact_menu,createAction);
|
|
|
|
|
2023-10-01 18:55:13 +00:00
|
|
|
[missionNameSpace getVariable [QGVAR(graveClassname), "ACE_Grave"], 0, [], _checkHeadstoneAction] call EFUNC(interact_menu,addActionToClass);
|
2023-09-24 19:57:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
if (isServer) then {
|
|
|
|
["ace_placedInBodyBag", {
|
|
|
|
params ["_target", "_restingPlace"];
|
|
|
|
TRACE_2("ace_placedInBodyBag eh",_target,_restingPlace);
|
2023-10-02 15:05:56 +00:00
|
|
|
if (isNull _restingPlace) exitWith {};
|
2023-09-24 19:57:08 +00:00
|
|
|
|
2023-10-01 18:55:13 +00:00
|
|
|
private _targetName = "";
|
|
|
|
if (_target isKindOf "ACE_bodyBagObject") then {
|
|
|
|
_targetName = _target getVariable [QGVAR(headstoneData), ""];
|
|
|
|
} else {
|
|
|
|
_targetName = [_target, false, true] call EFUNC(common,getName);
|
|
|
|
};
|
|
|
|
|
2023-10-02 15:05:56 +00:00
|
|
|
if (_targetName == "") exitWith {};
|
2023-09-24 19:57:08 +00:00
|
|
|
_restingPlace setVariable [QGVAR(headstoneData), _targetName, true];
|
|
|
|
}] call CBA_fnc_addEventHandler;
|
|
|
|
};
|
|
|
|
};
|