2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2019-03-24 22:17:48 +00:00
|
|
|
/*
|
|
|
|
* Author: BaerMitUmlaut, mharis001
|
|
|
|
* Creates actions for treatments from config and adds them to the interaction menu.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Example:
|
2019-04-01 14:40:02 +00:00
|
|
|
* [] call ace_medical_gui_fnc_addTreatmentActions
|
2019-03-24 22:17:48 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
|
|
|
|
private _actionsConfig = configFile >> QEGVAR(medical_treatment,actions);
|
|
|
|
private _actionPaths = ["ACE_Head", "ACE_Torso", "ACE_ArmLeft", "ACE_ArmRight", "ACE_LegLeft", "ACE_LegRight"];
|
|
|
|
|
|
|
|
private _fnc_statement = {
|
|
|
|
params ["_target", "_player", "_args"];
|
|
|
|
_args params ["_bodyPart", "_treatmentName"];
|
|
|
|
[_player, _target, _bodyPart, _treatmentName] call EFUNC(medical_treatment,treatment);
|
|
|
|
};
|
|
|
|
|
|
|
|
private _fnc_condition = {
|
|
|
|
params ["_target", "_player", "_args"];
|
|
|
|
_args params ["_bodyPart", "_treatmentName"];
|
|
|
|
[_player, _target, _bodyPart, _treatmentName] call EFUNC(medical_treatment,canTreatCached);
|
|
|
|
};
|
|
|
|
|
|
|
|
{
|
|
|
|
private _configName = configName _x;
|
|
|
|
private _actionName = format [QGVAR(_%1), _configName];
|
|
|
|
private _displayName = getText (_x >> "displayName");
|
|
|
|
private _icon = getText (_x >> "icon");
|
|
|
|
|
2024-03-07 21:08:13 +00:00
|
|
|
private _allowedBodyParts = getArray (_x >> "allowedSelections") apply {toLowerANSI _x};
|
2019-03-24 22:17:48 +00:00
|
|
|
if (_allowedBodyParts isEqualTo ["all"]) then {
|
2024-03-07 21:08:13 +00:00
|
|
|
_allowedBodyParts = ALL_BODY_PARTS apply {toLowerANSI _x};
|
2019-03-24 22:17:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
{
|
|
|
|
private _bodyPart = _x;
|
2024-03-07 21:08:13 +00:00
|
|
|
private _actionPath = _actionPaths select (ALL_BODY_PARTS find toLowerANSI _bodyPart);
|
2019-03-24 22:17:48 +00:00
|
|
|
|
|
|
|
private _action = [
|
|
|
|
_actionName,
|
|
|
|
_displayName,
|
|
|
|
_icon,
|
|
|
|
_fnc_statement,
|
|
|
|
_fnc_condition,
|
|
|
|
{},
|
|
|
|
[_bodyPart, _configName],
|
|
|
|
{[0, 0, 0]},
|
|
|
|
2,
|
|
|
|
[false, true, false, false, false]
|
|
|
|
] call EFUNC(interact_menu,createAction);
|
|
|
|
|
|
|
|
["CAManBase", 0, [_actionPath], _action, true] call EFUNC(interact_menu,addActionToClass);
|
|
|
|
["CAManBase", 0, ["ACE_MainActions", "ACE_Medical_Radial", _actionPath], _action, true] call EFUNC(interact_menu,addActionToClass);
|
2019-04-01 14:40:02 +00:00
|
|
|
GVAR(selfInteractionActions) pushBack ["", 1, ["ACE_SelfActions", "ACE_Medical", _actionPath], _action];
|
2019-03-24 22:17:48 +00:00
|
|
|
} forEach _allowedBodyParts;
|
|
|
|
} forEach configProperties [_actionsConfig, "isClass _x"];
|