Added 3D treatment actions

This commit is contained in:
BaerMitUmlaut 2016-09-21 14:36:00 +02:00
parent 236d1f9669
commit 7d2d40ee55
5 changed files with 97 additions and 22 deletions

View File

@ -1,18 +1,17 @@
PREP(onMenuOpen);
PREP(onMenuClose);
PREP(openMenu);
PREP(canOpenMenu);
PREP(updateIcons);
PREP(updateUIInfo);
PREP(collectActions);
PREP(collectActions3D);
PREP(getTreatmentOptions);
PREP(handleUI_DisplayOptions);
PREP(handleUI_dropDownTriageCard);
PREP(getTreatmentOptions);
PREP(updateActivityLog);
PREP(updateQuickViewLog);
PREP(updateBodyImage);
PREP(updateInformationLists);
PREP(setTriageStatus);
PREP(collectActions);
PREP(module);
PREP(onMenuClose);
PREP(onMenuOpen);
PREP(openMenu);
PREP(setTriageStatus);
PREP(updateActivityLog);
PREP(updateBodyImage);
PREP(updateIcons);
PREP(updateInformationLists);
PREP(updateQuickViewLog);
PREP(updateUIInfo);

View File

@ -6,6 +6,12 @@ GVAR(MenuPFHID) = -1;
GVAR(lastOpenedOn) = -1;
GVAR(pendingReopen) = false;
["ace_settingsInitialized", {
if (EGVAR(medical,level) > 0 && {EGVAR(medical,menuTypeStyle) == 0}) then {
[] call FUNC(collectActions3D);
};
}] call CBA_fnc_addEventHandler;
["ace_treatmentSucceded", {
if (GVAR(openAfterTreatment) && {GVAR(pendingReopen)}) then {
GVAR(pendingReopen) = false;
@ -15,8 +21,7 @@ GVAR(pendingReopen) = false;
};
}] call CBA_fnc_addEventHandler;
["ACE3 Common", QGVAR(displayMenuKeyPressed), localize LSTRING(DisplayMenuKey),
{
["ACE3 Common", QGVAR(displayMenuKeyPressed), localize LSTRING(DisplayMenuKey), {
private _target = cursorTarget;
if (!((_target isKindOf "CAManBase") && {[ACE_player, _target] call FUNC(canOpenMenu)})) then {_target = ACE_player};
@ -27,11 +32,9 @@ GVAR(pendingReopen) = false;
// Statement
[_target] call FUNC(openMenu);
false
},
{
}, {
if (CBA_missionTime - GVAR(lastOpenedOn) > 0.5) exitWith {
[objNull] call FUNC(openMenu);
};
false
},
[35, [false, false, false]], false, 0] call CBA_fnc_addKeybind;
}, [35, [false, false, false]], false, 0] call CBA_fnc_addKeybind;

View File

@ -6,7 +6,7 @@ class CfgPatches {
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ace_medical_treatment"};
requiredAddons[] = {"ace_medical_treatment", "ace_interact_menu"};
author = ECSTRING(common,ACETeam);
authors[] = {"Glowbal"};
url = ECSTRING(main,URL);

View File

@ -0,0 +1,73 @@
/*
* Author: BaerMitUmlaut
* Creates actions for the given treatments and adds them to the interaction menu.
*
* Arguments:
* None
*
* Return Value:
* None
*
* Example:
* [] call ace_medical_menu_fnc_collectActions3D
*
* Public: No
*/
#include "script_component.hpp"
private _actionsConfig = [nil, configFile >> "ACE_Medical_Treatment_Actions" >> "Basic", configFile >> "ACE_Medical_Treatment_Actions" >> "Advanced"] select EGVAR(medical,level);
private _allAllowedSelections = ["head", "body", "hand_l", "hand_r", "leg_l", "leg_r"];
private _actionPaths = ["ACE_Head", "ACE_Torso", "ACE_ArmLeft", "ACE_ArmRight", "ACE_LegLeft", "ACE_LegRight"];
private _actionPathTexts = [
localize ELSTRING(interaction,Head), localize ELSTRING(interaction,Torso),
localize ELSTRING(interaction,ArmLeft), localize ELSTRING(interaction,ArmRight),
localize ELSTRING(interaction,LegLeft), localize ELSTRING(interaction,LegRight)
];
private _actionPathPositions = ["spine3", "pilot", "LeftForeArm", "RightForeArm", "LKnee", "RKnee"];
// - Create base nodes --------------------------------------------------------
{
private _action = [_x, _actionPathTexts select _forEachIndex, QPATHTOEF(medical,UI\icons\medical_cross.paa), {
[_target, true, _this] call EFUNC(medical,displayPatientInformation);
}, {true}, {}, _forEachIndex, _actionPathPositions select _forEachIndex, 2, [false, true, false, false, false], {
[_target, _player, _this select 2, _this select 3] call EFUNC(medical_treatment,modifyMedicalAction);
}] call EFUNC(interact_menu,createAction);
["CAManBase", 0, ["ACE_MainActions"], _action, true] call EFUNC(interact_menu,addActionToClass);
["CAManBase", 1, ["ACE_SelfActions"], _action, true] call EFUNC(interact_menu,addActionToClass);
} forEach _actionPaths;
// - Create treatment actions -------------------------------------------------
{
private _config = _x;
private _actionName = QUOTE(ADDON) + "_" + configName _config;
private _displayName = getText (_config >> "displayName");
private _icon = switch (getText (_config >> "category")) do {
case "bandage": {QPATHTOEF(medical,UI\icons\bandage.paa)};
case "medication": {QPATHTOEF(medical,UI\icons\autoInjector.paa)};
// Currently category advanced which includes body bag :/
// case "iv": {QPATHTOF(UI\icons\iv.paa)};
default {""};
};
private _allowedSelections = getArray (_config >> "allowedSelections");
_allowedSelections = _allowedSelections apply {toLower _x};
if (_allowedSelections isEqualTo ["all"]) then {
_allowedSelections = _allAllowedSelections;
};
{
private _selection = _x;
private _actionPath = _actionPaths select (_allAllowedSelections find _selection);
private _statement = {[_player, _target, _selection, _this select 2] call EFUNC(medical_treatment,treatment)};
private _condition = {[_player, _target, _selection, _this select 2] call EFUNC(medical_treatment,canTreatCached)};
private _action = [
_actionName, _displayName, _icon, _statement, _condition, {}, configName _config, [0, 0, 0], 2, [false, true, false, false, false]
] call EFUNC(interact_menu,createAction);
diag_log formatText ["ACTIONS LOL: %1", [_actionName, _displayName, _icon, _statement, _condition]];
["CAManBase", 0, ["ACE_MainActions", _actionPath], _action, true] call EFUNC(interact_menu,addActionToClass);
["CAManBase", 1, ["ACE_SelfActions", _actionPath], _action, true] call EFUNC(interact_menu,addActionToClass);
} forEach _allowedSelections;
} forEach configProperties [_actionsConfig, "isClass _x"];

View File

@ -3,7 +3,7 @@
#include "\z\ace\addons\main\script_mod.hpp"
// #define DEBUG_MODE_FULL
// #define DISABLE_COMPILE_CACHE
#define DISABLE_COMPILE_CACHE
// #define CBA_DEBUG_SYNCHRONOUS
// #define ENABLE_PERFORMANCE_COUNTERS