ACE3/addons/medical_menu/functions/fnc_collectActions.sqf

64 lines
2.6 KiB
Plaintext
Raw Normal View History

/*
* Author: Glowbal
* Collect treatment actions from medical config
*
* Arguments:
2015-08-07 03:37:41 +00:00
* None
*
* Return Value:
2015-08-07 03:37:41 +00:00
* None
*
* Example:
* [] call ace_medical_menu_fnc_collectActions
*
* Public: No
*/
#include "script_component.hpp"
2016-06-13 10:49:35 +00:00
private _configBasic = (configFile >> "ACE_Medical_Actions" >> "Basic");
private _configAdvanced = (configFile >> "ACE_Medical_Actions" >> "Advanced");
2016-06-13 10:49:35 +00:00
private _fnc_compileActionsLevel = {
2015-08-07 03:37:41 +00:00
params ["_config"];
2016-06-13 10:49:35 +00:00
private _actions = [];
2015-08-07 03:37:41 +00:00
{
if (isClass _x) then {
2016-06-13 10:49:35 +00:00
private _displayName = getText (_x >> "displayName");
private _category = getText (_x >> "category");
private _condition = format[QUOTE([ARR_4(ACE_player, GVAR(INTERACTION_TARGET), EGVAR(medical,SELECTIONS) select GVAR(selectedBodyPart), '%1')] call DEFUNC(medical,canTreatCached)), configName _x];
private _statement = format[QUOTE([ARR_4(ACE_player, GVAR(INTERACTION_TARGET), EGVAR(medical,SELECTIONS) select GVAR(selectedBodyPart), '%1')] call DEFUNC(medical,treatment)), configName _x];
2015-08-07 03:37:41 +00:00
_actions pushBack [_displayName, _category, compile _condition, compile _statement];
};
2015-08-07 03:37:41 +00:00
nil
2015-08-22 20:33:15 +00:00
} count ("true" configClasses _config);
2015-08-07 03:37:41 +00:00
2016-06-13 10:49:35 +00:00
_actions;
};
2015-08-07 03:37:41 +00:00
GVAR(actionsBasic) = [_configBasic] call _fnc_compileActionsLevel;
GVAR(actionsAdvanced) = [_configAdvanced] call _fnc_compileActionsLevel;
2015-10-13 07:20:19 +00:00
//Manually add the drag actions, if dragging exists.
if (["ace_dragging"] call EFUNC(common,isModLoaded)) then {
2016-06-13 10:49:35 +00:00
private _condition = {
2015-10-13 07:20:19 +00:00
(ACE_player != GVAR(INTERACTION_TARGET)) && {[ACE_player, GVAR(INTERACTION_TARGET)] call EFUNC(dragging,canDrag)}
};
2016-06-13 10:49:35 +00:00
private _statement = {
2015-10-13 07:20:19 +00:00
GVAR(pendingReopen) = false; //No medical_treatmentSuccess event after drag, so don't want this true
[ACE_player, GVAR(INTERACTION_TARGET)] call EFUNC(dragging,startDrag);
};
GVAR(actionsBasic) pushBack [localize ELSTRING(dragging,Drag), "drag", _condition, _statement];
GVAR(actionsAdvanced) pushBack [localize ELSTRING(dragging,Drag), "drag", _condition, _statement];
2016-06-13 10:49:35 +00:00
private _condition = {
2015-10-13 07:20:19 +00:00
(ACE_player != GVAR(INTERACTION_TARGET)) && {[ACE_player, GVAR(INTERACTION_TARGET)] call EFUNC(dragging,canCarry)}
};
2016-06-13 10:49:35 +00:00
private _statement = {
2015-10-13 07:20:19 +00:00
GVAR(pendingReopen) = false; //No medical_treatmentSuccess event after drag, so don't want this true
[ACE_player, GVAR(INTERACTION_TARGET)] call EFUNC(dragging,startCarry);
};
GVAR(actionsBasic) pushBack [localize ELSTRING(dragging,Carry), "drag", _condition, _statement];
GVAR(actionsAdvanced) pushBack [localize ELSTRING(dragging,Carry), "drag", _condition, _statement];
};