diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000000..0deca3d2ab --- /dev/null +++ b/.editorconfig @@ -0,0 +1,13 @@ +root = true + +[*] +end_of_line = crlf +insert_final_newline = true +charset = utf-8 +indent_style = space +indent_size = 4 +trim_trailing_whitespace = true + +[*.md] +trim_trailing_whitespace = false + diff --git a/TO_MERGE/cse/sys_misc/functions/fn_moduleAmbianceSoundLoop.sqf b/TO_MERGE/cse/sys_misc/functions/fn_moduleAmbianceSoundLoop.sqf deleted file mode 100644 index 4b4d93d453..0000000000 --- a/TO_MERGE/cse/sys_misc/functions/fn_moduleAmbianceSoundLoop.sqf +++ /dev/null @@ -1,98 +0,0 @@ -/** - * fn_moduleAmbianceSoundLoop.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - -private ["_logic", "_units", "_activated","_ambianceSounds", "_soundFiles", "_minimalDistance","_maximalDistance", "_minimalDistance", "_maxDelayBetweenSounds", "_allUnits", "_newPos", "_targetUnit", "_soundToPlay", "_soundPath", "_unparsedSounds", "_list", "_splittedList", "_nilCheckPassedList"]; -_logic = [_this,0,objNull,[objNull]] call BIS_fnc_param; -_units = [_this,1,[],[[]]] call BIS_fnc_param; -_activated = [_this,2,true,[true]] call BIS_fnc_param; - -if (_activated && isServer) then { - _ambianceSounds = []; - _unparsedSounds = _logic getvariable ["soundFiles", ""]; - _minimalDistance = (_logic getvariable ["minimalDistance", 400]) max 1; - _maximalDistance = (_logic getvariable ["maximalDistance", 10]) max _minimalDistance; - _minDelayBetweensounds = (_logic getvariable ["minimalDelay", 10]) max 1; - _maxDelayBetweenSounds = (_logic getvariable ["maximalDelay", 170]) max _minDelayBetweensounds; - _volume = (_logic getvariable ["soundVolume", 30]) max 1; - _followPlayers = _logic getvariable ["followPlayers", false]; - - _splittedList = [_unparsedSounds, ","] call BIS_fnc_splitString; - - _nilCheckPassedList = ""; - { - _x = [_x] call cse_fnc_string_removeWhiteSpace; - _splittedList set [_foreachIndex, _x]; - }foreach _splittedList; - - _soundPath = [(str missionConfigFile), 0, -15] call BIS_fnc_trimString; - { - if (isclass (missionConfigFile >> "CfgSounds" >> _x)) then { - _ambianceSounds pushback (_soundPath + (getArray(missionConfigFile >> "CfgSounds" >> _x >> "sound") select 0)); - } else { - if (isclass (configFile >> "CfgSounds" >> _x)) then { - _ambianceSounds pushback ((getArray(configFile >> "CfgSounds" >> _x >> "sound") select 0)); - }; - }; - }foreach _splittedList; - - if (count _ambianceSounds == 0) exitwith { - [format["No Ambiance sounds available"]] call cse_fnc_debug; - }; - { - if !([".", _x, true] call BIS_fnc_inString) then { - [format["Ambiance soundfile does not contain a file extension %1", _x]] call cse_fnc_debug; - _ambianceSounds set [_foreachIndex, _x + ".wss"]; - }; - }foreach _ambianceSounds; - [format["Ambiance sounds %1", _ambianceSounds]] call cse_fnc_debug; - - while {alive _logic} do { - _allUnits = switch (true) do { - case isMultiplayer: {playableUnits}; - case isDedicated: {[_logic]}; - default {[player]}; - }; - - if (count _allUnits > 0) then { - _targetUnit = _allUnits select (round(random((count _allUnits)-1))); - - _newPos = (getPos _targetUnit); - if (!_followPlayers) then { - _newPos = getPos _logic; - }; - - if (random(1) >= 0.5) then { - if (random(1) >= 0.5) then { - _newPos set [0, (_newPos select 0) + (_minimalDistance + random(_maximalDistance))]; - } else { - _newPos set [0, (_newPos select 0) - (_minimalDistance + random(_maximalDistance))]; - }; - } else { - if (random(1) >= 0.5) then { - _newPos set [1, (_newPos select 1) + (_minimalDistance + random(_maximalDistance))]; - } else { - _newPos set [1, (_newPos select 1) - (_minimalDistance + random(_maximalDistance))]; - }; - }; - - if ({(_newPos distance _x < (_minimalDistance / 2))}count _allUnits == 0) then { - - _soundToPlay = _ambianceSounds select (round(random((count _ambianceSounds)-1))); - playSound3D [_soundToPlay, _targetUnit, false, _newPos, _volume, 1, 1000]; - - [format["Played a sound %1", _soundToPlay]] call cse_fnc_debug; - - sleep (_minDelayBetweensounds + random(_maxDelayBetweenSounds)) min _maxDelayBetweenSounds; - }; - }; - }; -}; - -true; \ No newline at end of file diff --git a/addons/aircraft/CfgVehicles.hpp b/addons/aircraft/CfgVehicles.hpp index 5f419506c0..e9fb90e61e 100644 --- a/addons/aircraft/CfgVehicles.hpp +++ b/addons/aircraft/CfgVehicles.hpp @@ -217,9 +217,8 @@ class CfgVehicles { };*/ }; - class I_Heli_Transport_02_F: Heli_Transport_02_base_F {}; - - class I_Heli_light_03_base_F: Helicopter_Base_F { + class Heli_light_03_base_F: Helicopter_Base_F {}; + class I_Heli_light_03_base_F: Heli_light_03_base_F { lockDetectionSystem = 0; incomingMissileDetectionSystem = 16; driverCanEject = 1; @@ -242,15 +241,15 @@ class CfgVehicles { }; }; - class I_Heli_light_03_F: I_Heli_light_03_base_F { + class I_Heli_light_03_F: Heli_light_03_base_F { class Turrets: Turrets { class MainTurret: MainTurret {}; }; }; - class I_Heli_light_03_unarmed_base_F: I_Heli_light_03_base_F {}; + class Heli_light_03_unarmed_base_F: Heli_light_03_base_F {}; - class I_Heli_light_03_unarmed_F: I_Heli_light_03_unarmed_base_F {}; + class I_Heli_light_03_unarmed_F: Heli_light_03_unarmed_base_F {}; class Plane_CAS_01_base_F: Plane_Base_F { lockDetectionSystem = 12; @@ -303,7 +302,8 @@ class CfgVehicles { };*/ }; - class B_Heli_Transport_03_base_F: Helicopter_Base_H { + class Heli_Transport_03_base_F: Helicopter_Base_H {}; + class B_Heli_Transport_03_base_F: Heli_Transport_03_base_F { lockDetectionSystem = 12; incomingMissileDetectionSystem = 16; driverCanEject = 1; @@ -317,7 +317,7 @@ class CfgVehicles { }; }; - class B_Heli_Transport_03_unarmed_base_F: B_Heli_Transport_03_base_F { + class B_Heli_Transport_03_unarmed_base_F: Heli_Transport_03_base_F { class Turrets: Turrets { class CopilotTurret: CopilotTurret { canEject = 1; diff --git a/addons/attach/CfgVehicles.hpp b/addons/attach/CfgVehicles.hpp index 1cd65127a6..047549dfba 100644 --- a/addons/attach/CfgVehicles.hpp +++ b/addons/attach/CfgVehicles.hpp @@ -1,25 +1,27 @@ #define MACRO_ATTACHTOVEHICLE \ class ACE_Actions { \ - class GVAR(AttachVehicle) { \ - displayName = "$STR_ACE_Attach_AttachDetach"; \ - condition = QUOTE(([ARR_3(_player, _target, '')] call FUNC(canAttach))); \ - statement = QUOTE( [ARR_2(_player, _target)] call FUNC(openAttachUI);); \ - exceptions[] = {"ACE_Drag_isNotDragging"}; \ - showDisabled = 0; \ - priority = 0; \ - icon = PATHTOF(UI\attach_ca.paa); \ - distance = 4; \ - }; \ - class GVAR(DetachVehicle) { \ - displayName = "$STR_ACE_Attach_Detach"; \ - condition = QUOTE(([ARR_2(_player, _target)] call FUNC(canDetach))); \ - statement = QUOTE( [ARR_2(_player, _target)] call FUNC(detach) ); \ - exceptions[] = {"ACE_Drag_isNotDragging"}; \ - showDisabled = 0; \ - priority = 0; \ - icon = PATHTOF(UI\detach_ca.paa); \ - distance = 4; \ + class ACE_MainActions { \ + class GVAR(AttachVehicle) { \ + displayName = "$STR_ACE_Attach_AttachDetach"; \ + condition = QUOTE(([ARR_3(_player, _target, '')] call FUNC(canAttach))); \ + statement = QUOTE( [ARR_2(_player, _target)] call FUNC(openAttachUI);); \ + exceptions[] = {"ACE_Drag_isNotDragging"}; \ + showDisabled = 0; \ + priority = 0; \ + icon = PATHTOF(UI\attach_ca.paa); \ + distance = 4; \ + }; \ + class GVAR(DetachVehicle) { \ + displayName = "$STR_ACE_Attach_Detach"; \ + condition = QUOTE(([ARR_2(_player, _target)] call FUNC(canDetach))); \ + statement = QUOTE( [ARR_2(_player, _target)] call FUNC(detach) ); \ + exceptions[] = {"ACE_Drag_isNotDragging"}; \ + showDisabled = 0; \ + priority = 0; \ + icon = PATHTOF(UI\detach_ca.paa); \ + distance = 4; \ + }; \ }; \ }; diff --git a/addons/attach/functions/fnc_openAttachUI.sqf b/addons/attach/functions/fnc_openAttachUI.sqf index 5533956bb6..1b95be9b84 100644 --- a/addons/attach/functions/fnc_openAttachUI.sqf +++ b/addons/attach/functions/fnc_openAttachUI.sqf @@ -62,6 +62,5 @@ _attachables = items _unit; }, { call EFUNC(interaction,hideMenu); - if !(profileNamespace getVariable [QEGVAR(interaction,AutoCloseMenu), false]) then {"Default" call EFUNC(interaction,openMenuSelf)}; } ] call EFUNC(interaction,openSelectMenu); diff --git a/addons/captives/CfgEventHandlers.hpp b/addons/captives/CfgEventHandlers.hpp index 722750f915..0ce09280a7 100644 --- a/addons/captives/CfgEventHandlers.hpp +++ b/addons/captives/CfgEventHandlers.hpp @@ -9,7 +9,6 @@ class Extended_PostInit_EventHandlers { init = QUOTE(call COMPILE_FILE(XEH_postInit)); }; }; - //release escorted captive when entering a vehicle class Extended_GetIn_EventHandlers { class All { @@ -18,7 +17,6 @@ class Extended_GetIn_EventHandlers { }; }; }; - //reset captive animation after leaving vehicle class Extended_GetOut_EventHandlers { class All { @@ -27,7 +25,6 @@ class Extended_GetOut_EventHandlers { }; }; }; - //reset captivity and escorting status when getting killed class Extended_Killed_EventHandlers { class CAManBase { @@ -36,7 +33,6 @@ class Extended_Killed_EventHandlers { }; }; }; - //mission start class Extended_InitPost_EventHandlers { class CAManBase { @@ -45,4 +41,3 @@ class Extended_InitPost_EventHandlers { }; }; }; - diff --git a/addons/captives/CfgMoves.hpp b/addons/captives/CfgMoves.hpp index 6e67f3615b..d60fab5a33 100644 --- a/addons/captives/CfgMoves.hpp +++ b/addons/captives/CfgMoves.hpp @@ -72,7 +72,7 @@ class CfgMovesMaleSdr: CfgMovesBasic { InterpolateTo[] = {"Unconscious",0.01}; }; class ACE_AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon: ACE_AmovPercMstpSnonWnonDnon_AmovPercMstpSsurWnonDnon { - speed = 0.333; //for gameplay reasons, slow this down + speed = 0.5; //for gameplay reasons, slow this down actions = "CivilStandActions"; file = "\A3\anims_f\Data\Anim\Sdr\mov\erc\stp\sur\non\AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon"; ConnectTo[] = {"AmovPercMstpSnonWnonDnon",0.1}; diff --git a/addons/captives/CfgVehicles.hpp b/addons/captives/CfgVehicles.hpp index d292402bcf..b6f9edd576 100644 --- a/addons/captives/CfgVehicles.hpp +++ b/addons/captives/CfgVehicles.hpp @@ -2,70 +2,70 @@ class CfgVehicles { class Man; class CAManBase: Man { class ACE_Actions { + class ACE_ApplyHandcuffs { displayName = "$STR_ACE_Captives_SetCaptive"; - distance = 4; + selection = "righthand"; + distance = 2; condition = QUOTE([ARR_2(_player, _target)] call FUNC(canApplyHandcuffs)); statement = QUOTE([ARR_2(_player, _target)] call FUNC(doApplyHandcuffs)); exceptions[] = {}; - showDisabled = 0; - priority = 2.4; icon = QUOTE(PATHTOF(UI\handcuff_ca.paa)); - hotkey = "C"; }; class ACE_RemoveHandcuffs { displayName = "$STR_ACE_Captives_ReleaseCaptive"; - distance = 4; + selection = "righthand"; + distance = 2; condition = QUOTE([ARR_2(_player, _target)] call FUNC(canRemoveHandcuffs)); statement = QUOTE([ARR_2(_player, _target)] call FUNC(doRemoveHandcuffs)); exceptions[] = {}; - showDisabled = 0; - priority = 2.4; icon = QUOTE(PATHTOF(UI\handcuff_ca.paa)); - hotkey = "R"; }; - class ACE_EscortCaptive { - displayName = "$STR_ACE_Captives_EscortCaptive"; - distance = 4; - condition = QUOTE([ARR_2(_player, _target)] call FUNC(canEscortCaptive)); - statement = QUOTE([ARR_3(_player, _target, true)] call FUNC(doEscortCaptive)); - exceptions[] = {}; - showDisabled = 0; - icon = QUOTE(PATHTOF(UI\captive_ca.paa)); - priority = 2.3; - hotkey = "E"; - }; - class ACE_StopEscorting { - displayName = "$STR_ACE_Captives_StopEscorting"; - distance = 4; - condition = QUOTE([ARR_2(_player, _target)] call FUNC(canStopEscorting)); - statement = QUOTE([ARR_3(_player,_target, false)] call FUNC(doEscortCaptive)); - exceptions[] = {QGVAR(isNotEscorting)}; - showDisabled = 0; - icon = QUOTE(PATHTOF(UI\captive_ca.paa)); - priority = 2.3; - hotkey = "E"; - }; - class ACE_LoadCaptive { - displayName = "$STR_ACE_Captives_LoadCaptive"; - distance = 4; - condition = QUOTE([ARR_3(_player, _target, objNull)] call FUNC(canLoadCaptive)); - statement = QUOTE([ARR_3(_player, _target, objNull)] call FUNC(doLoadCaptive)); - exceptions[] = {QGVAR(isNotEscorting)}; - showDisabled = 0; - icon = QUOTE(PATHTOF(UI\captive_ca.paa)); - priority = 2.2; - hotkey = "L"; - }; - class ACE_FriskPerson { - displayName = "$STR_ACE_Captives_FriskPerson"; - distance = 2; - condition = QUOTE([ARR_2(_player, _target)] call FUNC(canFriskPerson)); - statement = QUOTE([ARR_2(_player, _target)] call FUNC(doFriskPerson)); - showDisabled = 0; - //icon = ""; //@todo - priority = 3; - hotkey = "F"; + + class ACE_MainActions { + class ACE_EscortCaptive { + displayName = "$STR_ACE_Captives_EscortCaptive"; + distance = 4; + condition = QUOTE([ARR_2(_player, _target)] call FUNC(canEscortCaptive)); + statement = QUOTE([ARR_3(_player, _target, true)] call FUNC(doEscortCaptive)); + exceptions[] = {}; + showDisabled = 0; + icon = QUOTE(PATHTOF(UI\captive_ca.paa)); + priority = 2.3; + hotkey = "E"; + }; + class ACE_StopEscorting { + displayName = "$STR_ACE_Captives_StopEscorting"; + distance = 4; + condition = QUOTE([ARR_2(_player, _target)] call FUNC(canStopEscorting)); + statement = QUOTE([ARR_3(_player,_target, false)] call FUNC(doEscortCaptive)); + exceptions[] = {QGVAR(isNotEscorting)}; + showDisabled = 0; + icon = QUOTE(PATHTOF(UI\captive_ca.paa)); + priority = 2.3; + hotkey = "E"; + }; + class ACE_LoadCaptive { + displayName = "$STR_ACE_Captives_LoadCaptive"; + distance = 4; + condition = QUOTE([ARR_3(_player, _target, objNull)] call FUNC(canLoadCaptive)); + statement = QUOTE([ARR_3(_player, _target, objNull)] call FUNC(doLoadCaptive)); + exceptions[] = {QGVAR(isNotEscorting)}; + showDisabled = 0; + icon = QUOTE(PATHTOF(UI\captive_ca.paa)); + priority = 2.2; + hotkey = "L"; + }; + class ACE_FriskPerson { + displayName = "$STR_ACE_Captives_FriskPerson"; + distance = 2; + condition = QUOTE([ARR_2(_player, _target)] call FUNC(canFriskPerson)); + statement = QUOTE([ARR_2(_player, _target)] call FUNC(doFriskPerson)); + showDisabled = 0; + //icon = ""; //@todo + priority = 3; + hotkey = "F"; + }; }; }; @@ -82,7 +82,7 @@ class CfgVehicles { class ACE_StartSurrenderingSelf { displayName = "$STR_ACE_Captives_StartSurrendering"; condition = QUOTE([ARR_2(_player, true)] call FUNC(canSurrender)); - statement = QUOTE([ARR_2(_player, true)] call FUNC(surrender)); + statement = QUOTE([ARR_2(_player, true)] call FUNC(setSurrendered)); exceptions[] = {}; showDisabled = 0; priority = 0; @@ -90,7 +90,7 @@ class CfgVehicles { class ACE_StopSurrenderingSelf { displayName = "$STR_ACE_Captives_StopSurrendering"; condition = QUOTE([ARR_2(_player, false)] call FUNC(canSurrender)); - statement = QUOTE([ARR_2(_player, false)] call FUNC(surrender)); + statement = QUOTE([ARR_2(_player, false)] call FUNC(setSurrendered)); exceptions[] = {QGVAR(isNotSurrendering)}; showDisabled = 0; priority = 0; @@ -100,24 +100,27 @@ class CfgVehicles { #define MACRO_LOADUNLOADCAPTIVE \ class ACE_Actions { \ - class ACE_LoadCaptive { \ - displayName = "$STR_ACE_Captives_LoadCaptive"; \ - distance = 4; \ - condition = QUOTE([ARR_3(_player, objNull, _target)] call FUNC(canLoadCaptive)); \ - statement = QUOTE([ARR_3(_player, objNull, _target)] call FUNC(doLoadCaptive)); \ - exceptions[] = {QGVAR(isNotEscorting)}; \ - showDisabled = 0; \ - priority = 1.2; \ - hotkey = "L"; \ - }; \ - class ACE_UnloadCaptive { \ - displayName = "$STR_ACE_Captives_UnloadCaptive"; \ - distance = 4; \ - condition = QUOTE([ARR_2(_player, _target)] call FUNC(canUnloadCaptive)); \ - statement = QUOTE([ARR_2(_player, _target)] call FUNC(doUnloadCaptive)); \ - showDisabled = 0; \ - priority = 1.2; \ - hotkey = "C"; \ + class ACE_MainActions { \ + selection = ""; \ + class ACE_LoadCaptive { \ + displayName = "$STR_ACE_Captives_LoadCaptive"; \ + distance = 4; \ + condition = QUOTE([ARR_3(_player, objNull, _target)] call FUNC(canLoadCaptive)); \ + statement = QUOTE([ARR_3(_player, objNull, _target)] call FUNC(doLoadCaptive)); \ + exceptions[] = {QGVAR(isNotEscorting)}; \ + showDisabled = 0; \ + priority = 1.2; \ + hotkey = "L"; \ + }; \ + class ACE_UnloadCaptive { \ + displayName = "$STR_ACE_Captives_UnloadCaptive"; \ + distance = 4; \ + condition = QUOTE([ARR_2(_player, _target)] call FUNC(canUnloadCaptive)); \ + statement = QUOTE([ARR_2(_player, _target)] call FUNC(doUnloadCaptive)); \ + showDisabled = 0; \ + priority = 1.2; \ + hotkey = "C"; \ + }; \ }; \ }; diff --git a/addons/captives/XEH_postInit.sqf b/addons/captives/XEH_postInit.sqf index 9d1a242d4d..ac86d71915 100644 --- a/addons/captives/XEH_postInit.sqf +++ b/addons/captives/XEH_postInit.sqf @@ -1,12 +1,9 @@ #include "script_component.hpp" -["playerChanged", {_this call FUNC(handlePlayerChanged)}] call EFUNC(common,addEventhandler); -["MoveInCaptive", {_this call FUNC(vehicleCaptiveMoveIn)}] call EFUNC(common,addEventHandler); -["MoveOutCaptive", {_this call FUNC(vehicleCaptiveMoveOut)}] call EFUNC(common,addEventHandler); -["SetHandcuffed", {_this call FUNC(setHandcuffed)}] call EFUNC(common,addEventHandler); //Handles when someone starts escorting and then disconnects, leaving the captive attached //This is normaly handled by the PFEH in doEscortCaptive, but that won't be running if they DC + if (isServer) then { addMissionEventHandler ["HandleDisconnect", { PARAMS_1(_disconnectedPlayer); @@ -21,6 +18,15 @@ if (isServer) then { }]; }; +["playerVehicleChanged", {_this call FUNC(handleVehicleChanged)}] call EFUNC(common,addEventHandler); +["zeusDisplayChanged", {_this call FUNC(handleZeusDisplayChanged)}] call EFUNC(common,addEventHandler); +["playerChanged", {_this call FUNC(handlePlayerChanged)}] call EFUNC(common,addEventhandler); +["MoveInCaptive", {_this call FUNC(vehicleCaptiveMoveIn)}] call EFUNC(common,addEventHandler); +["MoveOutCaptive", {_this call FUNC(vehicleCaptiveMoveOut)}] call EFUNC(common,addEventHandler); + +["SetHandcuffed", {_this call FUNC(setHandcuffed)}] call EFUNC(common,addEventHandler); +["SetSurrendered", {_this call FUNC(setSurrendered)}] call EFUNC(common,addEventHandler); + //TODO: Medical Integration Events??? // [_unit, "knockedOut", { diff --git a/addons/captives/XEH_preInit.sqf b/addons/captives/XEH_preInit.sqf index 75ee77e9bc..34c9bca910 100644 --- a/addons/captives/XEH_preInit.sqf +++ b/addons/captives/XEH_preInit.sqf @@ -23,9 +23,10 @@ PREP(handleKnockedOut); PREP(handlePlayerChanged); PREP(handleUnitInitPost); PREP(handleWokeUp); +PREP(handleZeusDisplayChanged); PREP(moduleSurrender); PREP(setHandcuffed); -PREP(surrender); +PREP(setSurrendered); PREP(vehicleCaptiveMoveIn); PREP(vehicleCaptiveMoveOut); diff --git a/addons/captives/functions/fnc_canStopEscorting.sqf b/addons/captives/functions/fnc_canStopEscorting.sqf index e6a5a0e568..56065a43fc 100644 --- a/addons/captives/functions/fnc_canStopEscorting.sqf +++ b/addons/captives/functions/fnc_canStopEscorting.sqf @@ -19,22 +19,10 @@ PARAMS_1(_unit); DEFAULT_PARAM(1,_target,objNull); -private ["_isAttached"]; - if (isNull _target) then { _target = _unit getVariable [QGVAR(escortedUnit), objNull]; }; -if (isNull _target) exitWith { - ERROR("Null Target (no ACE_escortedUnit)"); - false -}; +if (isNull _target) exitWith {false}; -_isAttached = _target in (attachedObjects _unit); - -if (_isAttached && (!(_target getVariable [QGVAR(isHandcuffed), false]))) exitWith { - ERROR("Attached But Not Captive"); - false -}; - -_isAttached +(_target in (attachedObjects _unit)) && {_target getVariable [QGVAR(isHandcuffed), false]} diff --git a/addons/captives/functions/fnc_canSurrender.sqf b/addons/captives/functions/fnc_canSurrender.sqf index 238087c62b..3ee687cfc1 100644 --- a/addons/captives/functions/fnc_canSurrender.sqf +++ b/addons/captives/functions/fnc_canSurrender.sqf @@ -18,5 +18,12 @@ PARAMS_2(_unit,_newSurrenderState); -//TODO: any other conditions?? -(!((_unit getVariable [QGVAR(isSurrendering), false]) isEqualTo _newSurrenderState)) +private "_returnValue"; + +_returnValue = if (_newSurrenderState) then { + !(_unit getVariable [QGVAR(isSurrendering), false]); //Not currently surrendering +} else { + (_unit getVariable [QGVAR(isSurrendering), false]); //is Surrendering +}; + +_returnValue diff --git a/addons/captives/functions/fnc_handleGetIn.sqf b/addons/captives/functions/fnc_handleGetIn.sqf index 54133e2362..cf7d2c7271 100644 --- a/addons/captives/functions/fnc_handleGetIn.sqf +++ b/addons/captives/functions/fnc_handleGetIn.sqf @@ -19,6 +19,12 @@ PARAMS_3(_vehicle,_dontcare,_unit); -if ((local _unit) && (_unit getVariable [QGVAR(isEscorting), false])) then { - _unit setVariable [QGVAR(isEscorting), false, true]; +if (local _unit) then { + if (_unit getVariable [QGVAR(isEscorting), false]) then { + _unit setVariable [QGVAR(isEscorting), false, true]; + }; + + if (_unit getVariable [QGVAR(isSurrendering), false]) then { + [_unit, false] call FUNC(setSurrender); + }; }; diff --git a/addons/captives/functions/fnc_handleKnockedOut.sqf b/addons/captives/functions/fnc_handleKnockedOut.sqf index 3257d544ca..1cd969807d 100644 --- a/addons/captives/functions/fnc_handleKnockedOut.sqf +++ b/addons/captives/functions/fnc_handleKnockedOut.sqf @@ -1,2 +1,25 @@ -// by commy2 +/* + * Author: commy2, PabstMirror + * Handles when a unit gets knocked out. Ends surrendering. + * + * Arguments: + * 0: Unit + * + * Return Value: + * Nothing + * + * Example: + * [bob, true] call ACE_captives_fnc_handleKnockedOut + * + * Public: No + */ +#include "script_component.hpp" + +//ToDo: Waiting on medical integration + +PARAMS_1(_unit); + +if (_unit getVariable [QGVAR(isSurrendering), false]) then { //If surrendering, stop + [_unit, false] call FUNC(setSurrendered); +}; diff --git a/addons/captives/functions/fnc_handlePlayerChanged.sqf b/addons/captives/functions/fnc_handlePlayerChanged.sqf index 13e284ef80..21fd1e1ec3 100644 --- a/addons/captives/functions/fnc_handlePlayerChanged.sqf +++ b/addons/captives/functions/fnc_handlePlayerChanged.sqf @@ -18,10 +18,16 @@ PARAMS_2(_newUnit,_oldUnit); +//set showHUD based on new unit status: if ((_newUnit getVariable [QGVAR(isHandcuffed), false]) || {_newUnit getVariable [QGVAR(isSurrendering), false]}) then { TRACE_1("Player Change (showHUD false)",_newUnit); - showHUD false; + showHUD false; } else { TRACE_1("Player Change (showHUD true)",_newUnit); showHUD true; }; + +//If old player was escorting, stop +if (_oldUnit getVariable [QGVAR(isEscorting), false]) then { + _oldUnit setVariable [QGVAR(isEscorting), false, true]; +}; diff --git a/addons/captives/functions/fnc_handleUnitInitPost.sqf b/addons/captives/functions/fnc_handleUnitInitPost.sqf index 1a5a8f2ecd..a8b601300a 100644 --- a/addons/captives/functions/fnc_handleUnitInitPost.sqf +++ b/addons/captives/functions/fnc_handleUnitInitPost.sqf @@ -29,6 +29,6 @@ if (local _unit) then { if (_unit getVariable [QGVAR(isSurrendering), false]) then { _unit setVariable [QGVAR(isSurrendering), false]; - [_unit, true] call FUNC(surrender); + [_unit, true] call FUNC(setSurrendered); }; }; diff --git a/addons/captives/functions/fnc_handleZeusDisplayChanged.sqf b/addons/captives/functions/fnc_handleZeusDisplayChanged.sqf new file mode 100644 index 0000000000..84b90e78c2 --- /dev/null +++ b/addons/captives/functions/fnc_handleZeusDisplayChanged.sqf @@ -0,0 +1,31 @@ +/* + * Author: PabstMirror + * Handles ZeusDisplayChanged event + * Need to reset showHUD after closing zeus + * + * Arguments: + * 0: Unit + * 1: Display is now open + * + * Return Value: + * Nothing + * + * Example: + * [bob1, false] call ACE_captives_fnc_handleZeusDisplayChanged + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_2(_unit,_zeusIsOpen); + +//set showHUD based on unit status: +if (!_zeusIsOpen) then { + if ((_unit getVariable [QGVAR(isHandcuffed), false]) || {_unit getVariable [QGVAR(isSurrendering), false]}) then { + TRACE_1("Player Change (showHUD false)",_unit); + showHUD false; + } else { + TRACE_1("Player Change (showHUD true)",_unit); + showHUD true; + }; +}; diff --git a/addons/captives/functions/fnc_moduleSurrender.sqf b/addons/captives/functions/fnc_moduleSurrender.sqf index 5cbf43aacc..1a335131a8 100644 --- a/addons/captives/functions/fnc_moduleSurrender.sqf +++ b/addons/captives/functions/fnc_moduleSurrender.sqf @@ -27,19 +27,31 @@ if (local _logic) then { if ((count _bisMouseOver) == 2) then {//check what mouse was over before the module was placed _mouseOverObject = _bisMouseOver select 1; if ((_mouseOverObject isKindOf "CAManBase") && {(vehicle _mouseOverObject) == _mouseOverObject}) then { - systemChat format ["Debug - module surrendering %1", (name _mouseOverObject)]; - [_mouseOverObject, true] call FUNC(surrender); + TRACE_2("Debug - module surrendering %1",_mouseOverObject,(name _mouseOverObject)); + if (alive _mouseOverObject) then { + if (!(_mouseOverObject getVariable [QGVAR(isSurrendering), false])) then { + ["SetSurrendered", [_mouseOverObject], [_mouseOverObject, true]] call EFUNC(common,targetEvent); + } else { + ["SetSurrendered", [_mouseOverObject], [_mouseOverObject, false]] call EFUNC(common,targetEvent); + }; + } else { + ["STR_ACE_Captives_Zeus_OnlyAlive"] call EFUNC(common,displayTextStructured); + }; } else { - systemChat format ["Only use on dismounted inf"]; + ["STR_ACE_Captives_Zeus_OnlyInfentry"] call EFUNC(common,displayTextStructured); }; } else { - systemChat format ["Nothing under mouse"]; + ["STR_ACE_Captives_Zeus_NothingSelected"] call EFUNC(common,displayTextStructured); }; - } else {//an editor module - { - systemChat format ["Debug - module surrendering %1", (name _x)]; - [_x, true] call FUNC(surrender); - } forEach _units; + } else { + //an editor module + //Modules run before postInit can instal the event handler, so we need to wait a little bit + [{ + PARAMS_1(_units); + { + ["SetSurrendered", [_x], [_x, true]] call EFUNC(common,targetEvent); + } forEach _units; + }, [_units], 0.05, 0.05]call EFUNC(common,waitAndExecute); }; deleteVehicle _logic; diff --git a/addons/captives/functions/fnc_setHandcuffed.sqf b/addons/captives/functions/fnc_setHandcuffed.sqf index 912b00662f..0deb68dc8b 100644 --- a/addons/captives/functions/fnc_setHandcuffed.sqf +++ b/addons/captives/functions/fnc_setHandcuffed.sqf @@ -18,19 +18,23 @@ PARAMS_2(_unit,_state); -// We only want this function to work on local machines -if (!local _unit) exitwith { - [_this, QUOTE(FUNC(setHandcuffed)), _unit] call EFUNC(common,execRemoteFnc); - TRACE_2("running setHandcuffed on remote unit",_unit,_state); -}; -if (_state isEqualTo (_unit getVariable [QGVAR(isHandcuffed), false])) then { - LOG("setHandcuffed: current state same as new"); +if (!local _unit) exitwith { + ERROR("running setHandcuffed on remote unit"); +}; +if ((_unit getVariable [QGVAR(isHandcuffed), false]) isEqualTo _state) exitWith { + ERROR("setHandcuffed: current state same as new"); }; if (_state) then { _unit setVariable [QGVAR(isHandcuffed), true, true]; [_unit, QGVAR(Handcuffed), true] call EFUNC(common,setCaptivityStatus); + + if (_unit getVariable [QGVAR(isSurrendering), false]) then { //If surrendering, stop + [_unit, false] call FUNC(setSurrendered); + }; + + //Set unit cargoIndex (will be -1 if dismounted) _unit setVariable [QGVAR(CargoIndex), ((vehicle _unit) getCargoIndex _unit), true]; if (_unit == ACE_player) then { @@ -43,11 +47,30 @@ if (_state) then { if (_unit getVariable [QGVAR(isHandcuffed), false] && {vehicle _unit == _unit}) then { [_unit] call EFUNC(common,fixLoweredRifleAnimation); [_unit, "ACE_AmovPercMstpScapWnonDnon", 1] call EFUNC(common,doAnimation); + + //Adds an animation changed eh + //If we get a change in animation then redo the animation (handles people vaulting to break the animation chain) + _animChangedEHID = _unit addEventHandler ["AnimChanged", { + PARAMS_2(_unit,_newAnimation); + if ((_newAnimation != "ACE_AmovPercMstpSsurWnonDnon") && (_newAnimation != "Unconscious")) then { + ERROR("Handcuff animation interrupted"); + systemChat format ["debug %2: new %1", _newAnimation, time]; + [_unit, "ACE_AmovPercMstpScapWnonDnon", 1] call EFUNC(common,doAnimation); + }; + }]; + _unit setVariable [QGVAR(handcuffAnimEHID), _animChangedEHID]; + }; }, [_unit], 0.01, 0] call EFUNC(common,waitAndExecute); } else { _unit setVariable [QGVAR(isHandcuffed), false, true]; [_unit, QGVAR(Handcuffed), false] call EFUNC(common,setCaptivityStatus); + + //remove AnimChanged EH + _animChangedEHID = _unit getVariable [QGVAR(handcuffAnimEHID), -1]; + _unit removeEventHandler ["AnimChanged", _animChangedEHID]; + _unit setVariable [QGVAR(handcuffAnimEHID), -1]; + if ((vehicle _unit) == _unit) then { //Break out of hands up animation loop (doAnimation handles Unconscious prioity) [_unit, "ACE_AmovPercMstpScapWnonDnon_AmovPercMstpSnonWnonDnon", 2] call EFUNC(common,doAnimation); diff --git a/addons/captives/functions/fnc_setSurrendered.sqf b/addons/captives/functions/fnc_setSurrendered.sqf new file mode 100644 index 0000000000..e49c6e9453 --- /dev/null +++ b/addons/captives/functions/fnc_setSurrendered.sqf @@ -0,0 +1,101 @@ +/* + * Author: commy2 PabstMirror + * Lets a unit surrender + * + * Arguments: + * 0: Unit + * 1: True to surrender, false to un-surrender + * + * Return Value: + * Nothing + * + * Example: + * [Pierre, true] call ACE_captives_fnc_setSurrendered; + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_2(_unit,_state); + + +if (!local _unit) exitwith { + ERROR("running surrender on remote unit"); +}; + +if ((_unit getVariable [QGVAR(isSurrendering), false]) isEqualTo _state) exitWith { + ERROR("Surrender: current state same as new"); +}; + +if (_state) then { + if ((vehicle _unit) != _unit) exitWith {ERROR("Cannot surrender while mounted");}; + if (_unit getVariable [QGVAR(isHandcuffed), false]) exitWith {ERROR("Cannot surrender while handcuffed");}; + + _unit setVariable [QGVAR(isSurrendering), true, true]; + + [_unit, QGVAR(Surrendered), true] call EFUNC(common,setCaptivityStatus); + + if (_unit == ACE_player) then { + showHUD false; + }; + + [_unit] call EFUNC(common,fixLoweredRifleAnimation); + [_unit, "ACE_AmovPercMstpSsurWnonDnon", 1] call EFUNC(common,doAnimation); + + // fix anim on mission start (should work on dedicated servers) + [{ + PARAMS_1(_unit); + if (_unit getVariable [QGVAR(isSurrendering), false] && {(vehicle _unit) == _unit}) then { + //Adds an animation changed eh + //If we get a change in animation then redo the animation (handles people vaulting to break the animation chain) + _animChangedEHID = _unit addEventHandler ["AnimChanged", { + PARAMS_2(_unit,_newAnimation); + if ((_newAnimation != "ACE_AmovPercMstpSsurWnonDnon") && (_newAnimation != "Unconscious")) then { + ERROR("Surrender animation interrupted"); + systemChat format ["debug %2: new %1", _newAnimation, time]; + [_unit, "ACE_AmovPercMstpSsurWnonDnon", 1] call EFUNC(common,doAnimation); + }; + }]; + _unit setVariable [QGVAR(surrenderAnimEHID), _animChangedEHID]; + }; + }, [_unit], 0.01, 0] call EFUNC(common,waitAndExecute); +} else { + _unit setVariable [QGVAR(isSurrendering), false, true]; + [_unit, QGVAR(Surrendered), false] call EFUNC(common,setCaptivityStatus); + + //remove AnimChanged EH + _animChangedEHID = _unit getVariable [QGVAR(surrenderAnimEHID), -1]; + _unit removeEventHandler ["AnimChanged", _animChangedEHID]; + _unit setVariable [QGVAR(surrenderAnimEHID), -1]; + + if (_unit == ACE_player) then { + //only re-enable HUD if not handcuffed + if (!(_unit getVariable [QGVAR(isHandcuffed), false])) then { + showHUD true; + }; + }; + + if (_unit getVariable ["ACE_isUnconscious", false]) exitWith {}; //don't touch animations if unconscious + + //if we are in "hands up" animationState, crack it now + if (((vehicle _unit) == _unit) && {(animationState _unit) == "ACE_AmovPercMstpSsurWnonDnon"}) then { + [_unit, "ACE_AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon", 2] call EFUNC(common,doAnimation); + } else { + //spin up a PFEH, to watching animationState for the next 20 seconds to make sure we don't enter "hands up" + //Handles long animation chains + [{ + PARAMS_2(_args,_pfID); + EXPLODE_2_PVT(_args,_unit,_maxTime); + //If waited long enough or they re-surrendered or they are unconscious, exit loop + if ((time > _maxTime) || {_unit getVariable [QGVAR(isSurrendering), false]} || {_unit getVariable ["ACE_isUnconscious", false]}) exitWith { + [_pfID] call CBA_fnc_removePerFrameHandler; + }; + //Only break animation if they are actualy the "hands up" animation (because we are using switchmove there won't be an transition) + if (((vehicle _unit) == _unit) && {(animationState _unit) == "ACE_AmovPercMstpSsurWnonDnon"}) exitWith { + [_pfID] call CBA_fnc_removePerFrameHandler; + //Break out of hands up animation loop + [_unit, "ACE_AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon", 2] call EFUNC(common,doAnimation); + }; + }, 0, [_unit, (time + 20)]] call CBA_fnc_addPerFrameHandler; + }; +}; diff --git a/addons/captives/functions/fnc_surrender.sqf b/addons/captives/functions/fnc_surrender.sqf deleted file mode 100644 index 1f0e232926..0000000000 --- a/addons/captives/functions/fnc_surrender.sqf +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Author: commy2 PabstMirror - * Lets a unit surrender - * - * Arguments: - * 0: Unit - * 1: State - * - * Return Value: - * Nothing - * - * Example: - * [Pierre, true] call ACE_captives_fnc_surrender; - * - * Public: No - */ -#include "script_component.hpp" - -PARAMS_2(_unit,_state); - -// We only want this function to work on local machines -if (!local _unit) exitwith { - [_this, QUOTE(FUNC(surrender)), _unit] call EFUNC(common,execRemoteFnc); - TRACE_2("running surrender on remote unit",_unit,_state); -}; - -if ((_unit getVariable [QGVAR(isSurrendering), false]) isEqualTo _state) then { - LOG("Surrender: current state same as new"); -}; - -if (_state) then { - _unit setVariable [QGVAR(isSurrendering), true, true]; - [_unit, QGVAR(Surrendered), true] call EFUNC(common,setCaptivityStatus); - - if (_unit == ACE_player) then { - showHUD false; - }; - - // fix anim on mission start (should work on dedicated servers) - [{ - PARAMS_1(_unit); - if (_unit getVariable [QGVAR(isSurrendering), false] && {vehicle _unit == _unit}) then { - [_unit] call EFUNC(common,fixLoweredRifleAnimation); - [_unit, "ACE_AmovPercMstpSsurWnonDnon", 1] call EFUNC(common,doAnimation); - }; - }, [_unit], 0.01, 0] call EFUNC(common,waitAndExecute); - - //PFEH - (TODO: move to event system?) - [{ - EXPLODE_1_PVT((_this select 0),_unit); - if (_unit getVariable [QGVAR(isSurrendering), false]) then { - //If unit dies, gets knocked out, or is handcuffed then end surrender - if ((!alive _unit) || {_unit getVariable ["ACE_isUnconscious", false]} || {_unit getVariable [QGVAR(isHandcuffed), false]}) then { - [_unit, false] call FUNC(surrender); - [(_this select 1)] call CBA_fnc_removePerFrameHandler; - }; - } else { - [(_this select 1)] call cba_fnc_removePerFrameHandler; - }; - }, 0.0, [_unit]] call CBA_fnc_addPerFrameHandler; -} else { - _unit setVariable [QGVAR(isSurrendering), false, true]; - [_unit, QGVAR(Surrendered), false] call EFUNC(common,setCaptivityStatus); - - if ((vehicle _unit) == _unit) then { - //Break out of hands up animation loop (doAnimation handles Unconscious prioity) - [_unit, "ACE_AmovPercMstpSsurWnonDnon_AmovPercMstpSnonWnonDnon", 2] call EFUNC(common,doAnimation); - }; - - if (_unit == ACE_player) then { - //only re-enable HUD if not handcuffed - if (!(_unit getVariable [QGVAR(isHandcuffed), false])) then { - showHUD true; - }; - }; -}; diff --git a/addons/captives/stringtable.xml b/addons/captives/stringtable.xml index 7d8096b3e6..f03f30a113 100644 --- a/addons/captives/stringtable.xml +++ b/addons/captives/stringtable.xml @@ -1,5 +1,5 @@  - + @@ -136,5 +136,14 @@ Stop Surrendering + + Only use on alive units + + + Only use on dismounted inf + + + Nothing under mouse + \ No newline at end of file diff --git a/addons/common/CfgEventHandlers.hpp b/addons/common/CfgEventHandlers.hpp index b9c5d7e4ce..522df03d4f 100644 --- a/addons/common/CfgEventHandlers.hpp +++ b/addons/common/CfgEventHandlers.hpp @@ -38,7 +38,7 @@ class Extended_Respawn_EventHandlers { respawn = QUOTE(_this call FUNC(setName)); }; class GVAR(RESETDefaults) { - respawn = QUOTE(_this call FUNC(resetAllDefaults_F)); + respawn = QUOTE(_this call FUNC(resetAllDefaults)); }; }; }; diff --git a/addons/common/HintConfig.hpp b/addons/common/HintConfig.hpp index 3e3493a8ba..5dc0e6384a 100644 --- a/addons/common/HintConfig.hpp +++ b/addons/common/HintConfig.hpp @@ -17,14 +17,15 @@ class RscTitles { class HintBox: RscStructuredText { idc = 1; text = ""; - size = "1 / 40 / (getResolution select 5)"; - sizeEx = 1; + //size = "1 / 40 / (getResolution select 5)"; + SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; colorText[] = {1, 1, 1, 1}; colorBackground[] = {0, 0, 0, 0.5}; x = safeZoneW + safeZoneX - 0 * safezoneW; //safeZoneW + safeZoneX - 0.2 * safezoneW; y = safeZoneY + 0.2 * safezoneH; w = 0.2 * safeZoneW; h = 0.1 * SafeZoneH; + font = "PuristaMedium"; }; }; }; @@ -36,13 +37,12 @@ class RscTitles { fadeIn = 0.2; fadeOut = 0.2; name = "ACE_RscErrorHint"; - class controls { class HintBox: RscStructuredText { idc = 1; text = ""; - size = "1 / 40 / (getResolution select 5)"; - sizeEx = 1; + //size = "1 / 40 / (getResolution select 5)"; + SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; colorText[] = {1, 1, 1, 1}; colorBackground[] = {0.8, 0, 0, 0.5}; x = 0.3 * safeZoneW + safeZoneX; @@ -52,6 +52,7 @@ class RscTitles { }; }; }; + class ACE_EventHandlerHelper: ACE_Rsc_Display_Base { idd = -1; class controls { diff --git a/addons/common/ProgressScreen.hpp b/addons/common/ProgressScreen.hpp index 31184f00f4..751d48af9f 100644 --- a/addons/common/ProgressScreen.hpp +++ b/addons/common/ProgressScreen.hpp @@ -1,6 +1,3 @@ -class ACE_gui_RscProgress; -class ACE_gui_staticBase; - class GVAR(ProgressBar_Dialog) { idd = -1; @@ -20,7 +17,7 @@ class GVAR(ProgressBar_Dialog) { type = 0; style = 0; size = 1; - colorBackground[] = {0, 0, 0, 0.1}; + colorBackground[] = {0, 0, 0, 0.0}; colorText[] = {0, 0, 0, 0}; x = "safezoneX"; y = "safezoneY"; @@ -34,7 +31,7 @@ class GVAR(ProgressBar_Dialog) { y = "0.1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; w = "38 * (((safezoneW / safezoneH) min 1.2) / 40)"; h = ".8 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - colorFrame[] = {0,0,0,0.025}; + colorFrame[] = {0,0,0,0.0}; colorBar[] = {0.27,0.5,0.31,0.8}; texture = "#(argb,8,8,3)color(1,1,1,0.7)"; }; diff --git a/addons/common/RscInfoType.hpp b/addons/common/RscInfoType.hpp index d0b08c50c2..fe21b05265 100644 --- a/addons/common/RscInfoType.hpp +++ b/addons/common/RscInfoType.hpp @@ -26,5 +26,5 @@ class RscDisplayInventory { }; class RscDisplayChannel { - onLoad = QUOTE(_this call GVAR(onLoadRscDisplayChannel)); + onLoad = QUOTE(_this call FUNC(onLoadRscDisplayChannel)); }; diff --git a/addons/common/XEH_postInit.sqf b/addons/common/XEH_postInit.sqf index dbb665d446..35b0f5c3fe 100644 --- a/addons/common/XEH_postInit.sqf +++ b/addons/common/XEH_postInit.sqf @@ -158,3 +158,6 @@ GVAR(OldPlayerTurret) = [ACE_player] call FUNC(getTurretIndex); PARAMS_2(_vehicle,_fuelLevel); _vehicle setFuel _fuelLevel; }] call FUNC(addEventhandler); + +["displayTextStructured", FUNC(displayTextStructured)] call FUNC(addEventhandler); +["displayTextPicture", FUNC(displayTextPicture)] call FUNC(addEventhandler); diff --git a/addons/common/XEH_preInit.sqf b/addons/common/XEH_preInit.sqf index 64a06a0f8c..144194b96f 100644 --- a/addons/common/XEH_preInit.sqf +++ b/addons/common/XEH_preInit.sqf @@ -15,12 +15,18 @@ PREP(addSetting); PREP(adminKick); PREP(ambientBrightness); PREP(applyForceWalkStatus); +PREP(ASLToPosition); +PREP(beingCarried); PREP(binarizeNumber); +PREP(blurScreen); PREP(callCustomEventHandlers); PREP(callCustomEventHandlersGlobal); PREP(canGetInPosition); +PREP(canInteract); PREP(canInteractWith); PREP(canUseWeapon); +PREP(carriedByObj); +PREP(carryObj); PREP(changeProjectileDirection); PREP(checkPBOs); PREP(claim); @@ -30,7 +36,12 @@ PREP(codeToString); PREP(convertKeyCode); PREP(createOrthonormalReference); PREP(currentChannel); +PREP(debug); +PREP(debugModule); +PREP(defineVariable); +PREP(disableAI); PREP(disableUserInput); +PREP(displayIcon); PREP(displayText); PREP(displayTextPicture); PREP(displayTextStructured); @@ -42,12 +53,21 @@ PREP(execRemoteFnc); PREP(executePersistent); PREP(filter); PREP(fixLoweredRifleAnimation); +PREP(getAllDefinedSetVariables); PREP(getAllGear); PREP(getCaptivityStatus); +PREP(getCarriedBy); +PREP(getCarriedObj); PREP(getConfigCommander); PREP(getConfigGunner); +PREP(getDeathAnim); PREP(getDefaultAnim); +PREP(getDefinedVariable); +PREP(getDefinedVariableDefault); +PREP(getDefinedVariableInfo); PREP(getDoorTurrets); +PREP(getFirstObjectIntersection); +PREP(getFirstTerrainIntersection); PREP(getForceWalkStatus); PREP(getGunner); PREP(getHitPoints); @@ -56,6 +76,7 @@ PREP(getInPosition); PREP(getMarkerType); PREP(getName); PREP(getNumberFromMissionSQM); +PREP(getNumberMagazinesIn); PREP(getPitchBankYaw); PREP(getSettingData); PREP(getStringFromMissionSQM); @@ -74,63 +95,99 @@ PREP(getUavControlPosition); PREP(getVehicleCargo); PREP(getVehicleCodriver); PREP(getVehicleCrew); +PREP(getVersion); PREP(getWeaponAzimuthAndInclination); PREP(getWeaponIndex); PREP(getWeaponType); PREP(getWindDirection); PREP(goKneeling); PREP(hadamardProduct); +PREP(hasItem); +PREP(hasMagazine); +PREP(inheritsFrom); +PREP(insertionSort); PREP(interpolateFromArray); PREP(inTransitionAnim); +PREP(inWater); +PREP(isArrested); PREP(isAutoWind); +PREP(isAwake); PREP(isEngineer); PREP(isEOD); PREP(isInBuilding); +PREP(isModLoaded); PREP(isPlayer); PREP(isTurnedOut); PREP(letterToCode); +PREP(limitMovementSpeed); +PREP(loadPerson); +PREP(loadPersonLocal); PREP(loadSettingsFromProfile); PREP(loadSettingsOnServer); PREP(map); PREP(moduleCheckPBOs); PREP(moduleLSDVehicles); +PREP(moveToTempGroup); PREP(muteUnit); PREP(numberToDigits); PREP(numberToDigitsString); +PREP(onAnswerRequest); PREP(onLoadRscDisplayChannel); PREP(owned); PREP(player); PREP(playerSide); +PREP(positionToASL); PREP(progressBar); PREP(queueAnimation); PREP(readSettingFromModule); +PREP(receiveRequest); PREP(removeActionEventHandler); PREP(removeActionMenuEventHandler); PREP(removeCameraEventHandler); PREP(removeCustomEventHandler); PREP(removeMapMarkerCreatedEventHandler); PREP(removeScrollWheelEventHandler); +PREP(removeSpecificMagazine); +PREP(requestCallback); +PREP(resetAllDefaults); PREP(restoreVariablesJIP); PREP(revertKeyCodeLocalized); PREP(sanitizeString); +PREP(sendRequest); PREP(serverLog); +PREP(setArrestState); +PREP(setCanInteract); PREP(setCaptivityStatus); +PREP(setCarriedBy); +PREP(setDefinedVariable); +PREP(setDisableUserInputStatus); PREP(setForceWalkStatus); +PREP(setHearingCapability); PREP(setName); PREP(setParameter); PREP(setPitchBankYaw); -PREP(setVariableJIP); -PREP(setVariablePublic); +PREP(setProne); PREP(setSetting); PREP(setSettingFromConfig); +PREP(setVariableJIP); +PREP(setVariablePublic); +PREP(setVolume); +PREP(sortAlphabeticallyBy); +PREP(stringCompare); PREP(stringToColoredText); +PREP(stringRemoveWhiteSpace); PREP(subString); +PREP(switchToGroupSide); +PREP(throttledPublicVariable); PREP(toBin); PREP(toBitmask); PREP(toHex); PREP(toNumber); -PREP(throttledPublicVariable); +PREP(uniqueElementsOnly); +PREP(unloadPerson); PREP(unmuteUnit); +PREP(useItem); +PREP(useMagazine); PREP(waitAndExecute); // ACE_Debug @@ -195,74 +252,6 @@ if (hasInterface) then { }, 0, []] call cba_fnc_addPerFrameHandler; }; -PREP(stringCompare); -PREP(string_removeWhiteSpace); -PREP(isHC); -PREP(sendRequest_f); -PREP(requestCallback); -PREP(receiveRequest); -PREP(onAnswerRequest); -PREP(debug); -PREP(debugModule); -PREP(defineVariable); -PREP(setDefinedVariable); -PREP(getDefinedVariable); -PREP(getAllDefinedSetVariables); -PREP(getDefinedVariableInfo); -PREP(getDefinedVariableDefault); -PREP(getDeathAnim); -PREP(insertionSort); -PREP(uniqueElementsOnly); -PREP(sortAlphabeticallyBy); -PREP(hasMagazine); -PREP(useMagazine); -PREP(findMagazine); -PREP(hasItem); -PREP(useItem); -PREP(findItem); -PREP(getNumberMagazinesIn); -PREP(setCanInteract); -PREP(getCanInteract); -PREP(canInteract); -PREP(resetAllDefaults_f); -PREP(broadcastSound3D_f); - -PREP(isAwake); -PREP(setProne); - -PREP(setDisableUserInputStatus); - -PREP(dropWeapon_f); -PREP(inWater_f); -PREP(setVolume_f); -PREP(closeAllDialogs_f); -PREP(disableAI_f); -PREP(switchToGroupSide_f); -PREP(getFirstObjectIntersection); -PREP(getFirstTerrainIntersection); -PREP(setHearingCapability); -PREP(revealObject_f); -PREP(getWeaponItems_f); -PREP(isModLoaded_f); -PREP(inheritsFrom); -PREP(getVersion); -PREP(carryObj); -PREP(carriedByObj); -PREP(getCarriedObj); -PREP(getCarriedBy); -PREP(beingCarried); -PREP(setCarriedBy); - - -PREP(moveToTempGroup); - - -PREP(limitMovementSpeed); -PREP(setArrestState); -PREP(isArrested); -PREP(loadPerson_F); -PREP(loadPersonLocal_F); -PREP(unloadPerson_F); - - ADDON = true; + +isHC = !(hasInterface || isDedicated); diff --git a/addons/common/config.cpp b/addons/common/config.cpp index 84052cbdfb..d562d185ec 100644 --- a/addons/common/config.cpp +++ b/addons/common/config.cpp @@ -94,8 +94,41 @@ class ACE_Settings { isClientSetable = 1; displayName = "$STR_ACE_Common_EnableNumberHotkeys"; }; + class GVAR(settingFeedbackIcons) { + value = 1; + typeName = "SCALAR"; + force = 0; + isClientSetable = 1; + displayName = "$STR_ACE_Common_SettingFeedbackIconsName"; + description = "$STR_ACE_Common_SettingFeedbackIconsDesc"; + values[] = {"Hide", "Top right, downwards", "Top right, to the left", "Top left, downwards", "Top left, to the right"}; + }; + class GVAR(SettingProgressBarLocation) { + value = 0; + typeName = "SCALAR"; + force = 0; + isClientSetable = 1; + displayName = "$STR_ACE_Common_SettingProgressbarLocationName"; + description = "$STR_ACE_Common_SettingProgressbarLocationDesc"; + values[] = {"Top", "Bottom"}; + }; + class GVAR(displayTextColor) { + value[] = {0,0,0,0.1}; + typeName = "COLOR"; + isClientSetable = 1; + displayName = "$STR_ACE_Common_SettingDisplayTextColorName"; + description = "$STR_ACE_Common_SettingDisplayTextColorDesc"; + }; + class GVAR(displayTextFontColor) { + value[] = {1,1,1,1}; + typeName = "COLOR"; + isClientSetable = 1; + displayName = "$STR_ACE_Common_SettingDisplayTextFontColorName"; + description = "$STR_ACE_Common_SettingDisplayTextFontColorDesc"; + }; }; +#include "define.hpp" #include #include #include @@ -103,3 +136,23 @@ class ACE_Settings { #include #include +class CfgUIGrids { + class IGUI { + class Presets { + class Arma3 { + class Variables { + grid_ACE_displayText[] = {{((safezoneX + safezoneW) - (10 *(((safezoneW / safezoneH) min 1.2) / 40)) - 2.9 *(((safezoneW / safezoneH) min 1.2) / 40)),safeZoneY + 0.175 * safezoneH, (10 *(((safezoneW / safezoneH) min 1.2) / 40)), (2 *((((safezoneW / safezoneH) min 1.2) / 1.2) / 25))}, "(((safezoneW / safezoneH) min 1.2) / 40)","((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"}; + }; + }; + }; + + class Variables { + class grid_ACE_displayText { + displayName = "ACE Hint"; + description = "Textual in game feedback to the player."; + preview = "\a3\Ui_f\data\GUI\Cfg\UIGrids\grid_hint_ca.paa"; + saveToProfile[] = {0,1}; + }; + }; + }; +}; diff --git a/addons/gui/UI/define.hpp b/addons/common/define.hpp similarity index 97% rename from addons/gui/UI/define.hpp rename to addons/common/define.hpp index 13ce7d8a3e..f1cc009864 100644 --- a/addons/gui/UI/define.hpp +++ b/addons/common/define.hpp @@ -182,12 +182,12 @@ class ACE_gui_buttonBase { bottom = 0.00; }; textureNoShortcut = ""; - animTextureNormal = QUOTE( PATHTOF(data\buttonNormal_gradient_top.paa) ); - animTextureDisabled = QUOTE( PATHTOF(data\buttonDisabled_gradient.paa)); - animTextureOver = QUOTE( PATHTOF(data\buttonNormal_gradient_top.paa)); - animTextureFocused = QUOTE( PATHTOF(data\buttonNormal_gradient_top.paa)); - animTexturePressed = QUOTE( PATHTOF(data\buttonNormal_gradient_top.paa)); - animTextureDefault = QUOTE( PATHTOF(data\buttonNormal_gradient_top.paa)); + animTextureNormal = "#(argb,8,8,3)color(0,0,0,0.9)"; + animTextureDisabled = "#(argb,8,8,3)color(0,0,0,0.8)"; + animTextureOver = "#(argb,8,8,3)color(1,1,1,1)"; + animTextureFocused = "#(argb,8,8,3)color(1,1,1,1)"; + animTexturePressed = "#(argb,8,8,3)color(1,1,1,1)"; + animTextureDefault = "#(argb,8,8,3)color(1,1,1,1)"; period = 0.5; font = FontCSE; soundClick[] = {"\A3\ui_f\data\sound\RscButton\soundClick",0.09,1}; diff --git a/addons/common/functions/fnc_ASLToPosition.sqf b/addons/common/functions/fnc_ASLToPosition.sqf new file mode 100644 index 0000000000..41e532d39b --- /dev/null +++ b/addons/common/functions/fnc_ASLToPosition.sqf @@ -0,0 +1,21 @@ +/* + * Author: CAA-Picard + * Converts ASL to Arma "Position" + * + * Arguments: + * 0: position x + * 1: position y + * 2: position z + * + * Return Value: + * None + * + * Public: No + */ +#include "script_component.hpp" + +if (surfaceIsWater _this) then { + _this +} else { + ASLtoATL _this +}; diff --git a/addons/gui/functions/fnc_blurScreen.sqf b/addons/common/functions/fnc_blurScreen.sqf similarity index 99% rename from addons/gui/functions/fnc_blurScreen.sqf rename to addons/common/functions/fnc_blurScreen.sqf index 1cde214587..c3d101a37e 100644 --- a/addons/gui/functions/fnc_blurScreen.sqf +++ b/addons/common/functions/fnc_blurScreen.sqf @@ -39,4 +39,4 @@ if (_show) then { GVAR(MENU_ppHandle_GUI_BLUR_SCREEN) = nil; }; }; -}; \ No newline at end of file +}; diff --git a/addons/common/functions/fnc_broadcastSound3D_f.sqf b/addons/common/functions/fnc_broadcastSound3D_f.sqf deleted file mode 100644 index 93f95bb431..0000000000 --- a/addons/common/functions/fnc_broadcastSound3D_f.sqf +++ /dev/null @@ -1,16 +0,0 @@ -/** - * fn_broadcastSound3D_f.sqf - * @Descr: Plays a sound in 3D - * @Author: Glowbal - * - * @Arguments: [unit OBJECT, sound STRING] - * @Return: void - * @PublicAPI: true - */ - -#include "script_component.hpp" - -if (isDedicated) exitwith{}; -_unit = [_this, 0, ObjNull,[ObjNull]] call BIS_fnc_Param; -_sound = [_this, 1, "",[""]] call BIS_fnc_Param; -_unit say3D _sound; \ No newline at end of file diff --git a/addons/common/functions/fnc_closeAllDialogs_f.sqf b/addons/common/functions/fnc_closeAllDialogs_f.sqf deleted file mode 100644 index b5ce1bc280..0000000000 --- a/addons/common/functions/fnc_closeAllDialogs_f.sqf +++ /dev/null @@ -1,14 +0,0 @@ -/** - * fn_closeAllDialogs_f.sqf - * @Descr: Close all dialogs - * @Author: Glowbal - * - * @Arguments: [] - * @Return: void - * @PublicAPI: true - */ -#include "script_component.hpp" - -while {dialog} do { - closeDialog 0; -}; \ No newline at end of file diff --git a/addons/common/functions/fnc_currentChannel.sqf b/addons/common/functions/fnc_currentChannel.sqf index 115364fb24..a7ca8c1dd5 100644 --- a/addons/common/functions/fnc_currentChannel.sqf +++ b/addons/common/functions/fnc_currentChannel.sqf @@ -14,4 +14,4 @@ #define CHANNELS ["group", "side", "global", "command", "vehicle", "direct"] #define CHANNELS_LOCALIZED [localize "str_channel_group", localize "str_channel_side", localize "str_channel_global", localize "str_channel_command", localize "str_channel_vehicle", localize "str_channel_direct"] -CHANNELS select (CHANNELS_LOCALIZED find (uiNamespace getVariable ["ACE_currentChannel", ""])) max 0 +CHANNELS select (CHANNELS_LOCALIZED find (uiNamespace getVariable [QGVAR(currentChannel), ""])) max 0 diff --git a/addons/common/functions/fnc_disableAI_f.sqf b/addons/common/functions/fnc_disableAI.sqf similarity index 100% rename from addons/common/functions/fnc_disableAI_f.sqf rename to addons/common/functions/fnc_disableAI.sqf diff --git a/addons/common/functions/fnc_displayIcon.sqf b/addons/common/functions/fnc_displayIcon.sqf new file mode 100644 index 0000000000..1fbc4e89aa --- /dev/null +++ b/addons/common/functions/fnc_displayIcon.sqf @@ -0,0 +1,120 @@ +/* +* Author: Glowbal +* +* Draw progress bar and execute given function if succesful. +* Finish/Failure/Conditional are all passed [_args, _elapsedTime, _totalTime, _errorCode] +* +* Argument: +* 0: icon ID +* 1: show +* 2: Icon Path +* 3: Icon color +* 4: timeAlive. -1 = forever +* +* Return value: +* Nothing +* +* Example: +* ["myID", true, QUOTE(PATHTOF(data\icon_group.paa)), [1,1,1,1], 0] call ace_gui_fnc_displayIcon; +*/ + + +#include "script_component.hpp" + +// positions for the icon UI +#define RIGHT_SIDE (safezoneW + safezoneX) +#define LEFT_SIDE safezoneX +#define TOP_SIDE safeZoneY +#define BOTTOM_SIDE (safeZoneH + safezoneY) +#define ICON_WIDTH (2 * (((safezoneW / safezoneH) min 1.2) / 40)) +#define X_POS_ICONS (RIGHT_SIDE - (1.5 * ICON_WIDTH)) +#define Y_POS_ICONS (TOP_SIDE + (2.5 * ICON_WIDTH)) +#define DIFFERENCE_ICONS (1.1 * ICON_WIDTH) +#define X_POS_ICONS_SECOND (RIGHT_SIDE - (4.4 * ICON_WIDTH)) +#define Y_POS_ICONS_SECOND (TOP_SIDE + (1.1 * ICON_WIDTH)) + +// setting values +#define TOP_RIGHT_DOWN 1 +#define TOP_RIGHT_LEFT 2 +#define TOP_LEFT_DOWN 3 +#define TOP_LEFT_RIGHT 4 + +// other constants +#define DEFAULT_TIME 6 + +private ["_iconId", "_show", "_icon", "_allControls", "_refresh", "_timeAlive", "_list", "_color"]; +_iconId = _this select 0; +_show = _this select 1; +_icon = _this select 2; +_color = _this select 3; +_timeAlive = if (count _this > 4) then {_this select 4} else {DEFAULT_TIME}; + +disableSerialization; +_list = missionNamespace getvariable [QGVAR(displayIconList),[]]; + +_refresh = { + private ["_allControls"]; + // Refreshing of all icons.. + _allControls = missionNamespace getvariable [QGVAR(displayIconListControls), []]; + { + ctrlDelete _x; + }foreach _allControls; + + _allControls = []; + + private ["_ctrl", "_setting"]; + _setting = missionNamespace getvariable[QGVAR(settingFeedbackIcons), 0]; + if (_setting > 0) then { + { + // +19000 because we want to make certain we are using free IDCs.. + _ctrl = ((findDisplay 46) ctrlCreate ["RscPicture", _foreachIndex + 19000]); + _position = switch (_setting) do { + case TOP_RIGHT_DOWN: {[X_POS_ICONS, Y_POS_ICONS + (_foreachIndex * DIFFERENCE_ICONS), ICON_WIDTH, ICON_WIDTH]}; + case TOP_RIGHT_LEFT: {[X_POS_ICONS_SECOND - ((_foreachIndex+3) * DIFFERENCE_ICONS), Y_POS_ICONS_SECOND - (ICON_WIDTH / 2), ICON_WIDTH, ICON_WIDTH]}; + case TOP_LEFT_DOWN: {[LEFT_SIDE + (0.5 * ICON_WIDTH), Y_POS_ICONS + (_foreachIndex * DIFFERENCE_ICONS), ICON_WIDTH, ICON_WIDTH]}; + case TOP_LEFT_RIGHT: {[LEFT_SIDE + (0.5 * ICON_WIDTH) - ((_foreachIndex+3) * DIFFERENCE_ICONS), Y_POS_ICONS_SECOND, ICON_WIDTH, ICON_WIDTH]}; + default {[X_POS_ICONS, Y_POS_ICONS + (_foreachIndex * DIFFERENCE_ICONS), ICON_WIDTH, ICON_WIDTH]}; + }; + _ctrl ctrlSetPosition _position; + _ctrl ctrlsetText (_x select 1); + _ctrl ctrlSetTextColor (_x select 2); + _ctrl ctrlCommit 0; + _allControls pushback _ctrl; + }foreach (missionNamespace getvariable [QGVAR(displayIconList),[]]); + }; + missionNamespace setvariable [QGVAR(displayIconListControls), _allControls]; +}; + +if (_show) then { + if ({(_x select 0 == _iconId)} count _list == 0) then { + _list pushback [_iconId, _icon, _color, time]; + } else { + { + if (_x select 0 == _iconId) exitwith { + _list set [_foreachIndex, [_iconId, _icon, _color, time]]; + }; + }foreach _list; + }; + missionNamespace setvariable [QGVAR(displayIconList), _list]; + call _refresh; + + if (_timeAlive >= 0) then { + [{ + [_this select 0, false, "", [0,0,0], 0] call FUNC(displayIcon); + }, [_iconId], _timeAlive, _timeAlive] call EFUNC(common,waitAndExecute); + }; + +} else { + if ({(_x select 0 == _iconId)} count _list == 1) then { + private "_newList"; + _newList = []; + { + if (_x select 0 != _iconId) then { + _newList pushback _x; + }; + }foreach _list; + + missionNamespace setvariable [QGVAR(displayIconList), _newList]; + call _refresh; + }; +}; diff --git a/addons/common/functions/fnc_displayText.sqf b/addons/common/functions/fnc_displayText.sqf index c6a68cbab2..7121ef6813 100644 --- a/addons/common/functions/fnc_displayText.sqf +++ b/addons/common/functions/fnc_displayText.sqf @@ -18,36 +18,32 @@ #define DEFAULT_DELAY 2 #define DEFAULT_PRIORITY 0 -if (isNil QGVAR(lastHint)) then { - GVAR(lastHint) = [0, 0]; -}; - _this resize 4; -_this spawn { - private ["_text", "_sound", "_delay", "_priority", "_lastHintTime", "_lastHintPriority", "_time"]; +private ["_text", "_sound", "_delay", "_priority", "_lastHintTime", "_lastHintPriority", "_time"]; +_text = _this select 0; +_sound = _this select 1; +_delay = _this select 2; +_priority = _this select 3; - _text = _this select 0; - _sound = _this select 1; - _delay = _this select 2; - _priority = _this select 3; +if (isNil QGVAR(lastHint)) then { + GVAR(lastHint) = [0, 0]; +}; - _lastHintTime = GVAR(lastHint) select 0; - _lastHintPriority = GVAR(lastHint) select 1; +_lastHintTime = GVAR(lastHint) select 0; +_lastHintPriority = GVAR(lastHint) select 1; - if !(typeName _text in ["STRING", "TEXT"]) then {_text = str _text}; - if (isNil "_sound") then {_sound = DEFAULT_PLAY_SOUND}; - if (isNil "_delay") then {_delay = DEFAULT_DELAY}; - if (isNil "_priority") then {_priority = DEFAULT_PRIORITY}; +if !(typeName _text in ["STRING", "TEXT"]) then {_text = str _text}; +if (isNil "_sound") then {_sound = DEFAULT_PLAY_SOUND}; +if (isNil "_delay") then {_delay = DEFAULT_DELAY}; +if (isNil "_priority") then {_priority = DEFAULT_PRIORITY}; - _time = time; - if (_time > _lastHintTime + _delay || {_priority >= _lastHintPriority}) then { +_time = time; +if (_time > _lastHintTime + _delay || {_priority >= _lastHintPriority}) then { hintSilent _text; if (_sound) then {playSound "ACE_Sound_Click"}; GVAR(lastHint) set [0, _time]; GVAR(lastHint) set [1, _priority]; - sleep _delay; - if (_time == GVAR(lastHint) select 0) then {hintSilent ""}; - }; + [{if ((_this select 0) == GVAR(lastHint) select 0) then {hintSilent ""};}, [_time], _delay, 0] call FUNC(waitAndExecute); }; diff --git a/addons/common/functions/fnc_displayTextPicture.sqf b/addons/common/functions/fnc_displayTextPicture.sqf index 8d46d8d38e..fadf28b480 100644 --- a/addons/common/functions/fnc_displayTextPicture.sqf +++ b/addons/common/functions/fnc_displayTextPicture.sqf @@ -1,30 +1,44 @@ /* - * Author: commy2 + * Author: commy2, Glowbal * * Display a structured text with image. * * Argument: - * 0: Text (Anything) - * 1: Image (String) + * 0: Text + * 1: Image + * 2: Image color + * 3: Target Unit. Will only display if target is the player controlled object * * Return value: * Nothing */ + #include "script_component.hpp" -private ["_text", "_image"]; - +private ["_text", "_image", "_imageColor", "_target"]; _text = _this select 0; _image = _this select 1; +_imageColor = if (count _this > 2) then {_this select 2} else {[1,1,1]}; +_imageColor resize 3; +_target = if (count _this > 3) then {_this select 3} else {ACE_player}; + +if (_target != ACE_player) exitWith {}; if (typeName _text != "TEXT") then { - _text = parseText format ["%1", _text]; + if (typeName _text == "ARRAY") then { + if (count _text > 0) then { + { + if (typeName _x == "STRING" && {isLocalized _x}) then { + _text set [_foreachIndex, localize _x]; + }; + }foreach _text; + _text = format _text; + }; + }; + if (typeName _text == "STRING" && {isLocalized _text}) then { + _text = localize _text; + }; + _text = parseText format ["%1", _text]; }; - -_text = composeText [ - parseText format ["", _image], - lineBreak, - _text -]; - -[_text] call FUNC(displayTextStructured); +_text = composeText [parseText format ["", _image, _imageColor call BIS_fnc_colorRGBtoHTML], lineBreak, _text]; +[_text, 2] call FUNC(displayTextStructured); diff --git a/addons/common/functions/fnc_displayTextStructured.sqf b/addons/common/functions/fnc_displayTextStructured.sqf index 62db6a829f..cfe2feb3cb 100644 --- a/addons/common/functions/fnc_displayTextStructured.sqf +++ b/addons/common/functions/fnc_displayTextStructured.sqf @@ -1,26 +1,41 @@ /* - * Author: commy2 + * Author: commy2, Glowbal * * Display a structured text. * * Argument: - * 0: Text (Anything) - * 1: Size of the textbox (Number, optional default: 1) + * 0: Text + * 1: Size of the textbox + * 2: Target Unit. Will only display if target is the player controlled object * * Return value: * Nothing */ + #include "script_component.hpp" -private ["_text", "_size", "_isShown", "_ctrlHint"]; - +private ["_text", "_size", "_isShown", "_ctrlHint", "_yPos", "_xPos", "_wPos", "_hPos", "_position", "_target"]; _text = _this select 0; -_size = _this select 1; +_size = if (count _this > 1) then {_this select 1} else {1.5;}; +_target = if (count _this > 2) then {_this select 2} else {ACE_player}; -if (isNil "_size") then {_size = 1}; +if (_target != ACE_player) exitWith {}; if (typeName _text != "TEXT") then { - _text = composeText [lineBreak, parseText format ["%1", _text]]; + if (typeName _text == "ARRAY") then { + if (count _text > 0) then { + { + if (typeName _x == "STRING" && {isLocalized _x}) then { + _text set [_foreachIndex, localize _x]; + }; + }foreach _text; + _text = format _text; + }; + }; + if (typeName _text == "STRING" && {isLocalized _text}) then { + _text = localize _text; + }; + _text = composeText [lineBreak, parseText format ["%1", _text]]; }; _isShown = ctrlShown (uiNamespace getVariable ["ACE_ctrlHint", controlNull]); @@ -30,19 +45,31 @@ _isShown = ctrlShown (uiNamespace getVariable ["ACE_ctrlHint", controlNull]); disableSerialization; _ctrlHint = uiNamespace getVariable "ACE_ctrlHint"; -_ctrlHint ctrlSetPosition [ - safeZoneW + safeZoneX - 0 * safezoneW, - safeZoneY + 0.2 * safezoneH, - 0.2 * safeZoneW, - _size * 0.1 * SafeZoneH -]; +_ctrlHint ctrlSetBackgroundColor GVAR(displayTextColor); +_ctrlHint ctrlSetTextColor GVAR(displayTextFontColor); +/* +// This does not function at the moment. Has been disabled until it fixed. +_xPos = profilenamespace getvariable ["IGUI_GRID_ACE_displayText_X", ((safezoneX + safezoneW) - (10 *(((safezoneW / safezoneH) min 1.2) / 40)) - 2.9 *(((safezoneW / safezoneH) min 1.2) / 40))]; +_yPos = profilenamespace getvariable ["IGUI_GRID_ACE_displayText_Y", safeZoneY + 0.175 * safezoneH]; +_wPos = profilenamespace getvariable ["IGUI_GRID_ACE_displayText_W", (10 *(((safezoneW / safezoneH) min 1.2) / 40))]; +_hPos = profilenamespace getvariable ["IGUI_GRID_ACE_displayText_H", (2 *((((safezoneW / safezoneH) min 1.2) / 1.2) / 25))]; +*/ + +_xPos = ((safezoneX + safezoneW) - (10 *(((safezoneW / safezoneH) min 1.2) / 40)) - 2.9 *(((safezoneW / safezoneH) min 1.2) / 40)); +_yPos = safeZoneY + 0.175 * safezoneH; +_wPos = (10 *(((safezoneW / safezoneH) min 1.2) / 40)); +_hPos = (2 *((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)); + +//Zeus Interface Open and Display would be under the "CREATE" list +if (!isnull curatorCamera) then { + _xPos = _xPos min ((safezoneX + safezoneW - 12.5 * (((safezoneW / safezoneH) min 1.2) / 40)) - _wPos); +}; + +_position = [_xPos, _yPos, _wPos, _size * _hPos]; + +_ctrlHint ctrlSetPosition _position; _ctrlHint ctrlCommit 0; _ctrlHint ctrlSetStructuredText _text; -_ctrlHint ctrlSetPosition [ - safeZoneW + safeZoneX - 0.2 * safezoneW, - safeZoneY + 0.2 * safezoneH, - 0.2 * safeZoneW, - _size * 0.1 * SafeZoneH -]; -_ctrlHint ctrlCommit ([0.2, 0] select _isShown); +_ctrlHint ctrlSetPosition _position; +_ctrlHint ctrlCommit ([0.5, 0] select _isShown); diff --git a/addons/common/functions/fnc_dropWeapon_f.sqf b/addons/common/functions/fnc_dropWeapon_f.sqf deleted file mode 100644 index bf1358b5e7..0000000000 --- a/addons/common/functions/fnc_dropWeapon_f.sqf +++ /dev/null @@ -1,39 +0,0 @@ -/** - * fn_dropWeapon_f.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ -#include "script_component.hpp" -private ["_unit","_currentWeapon","_currentAnimation", "_WeaponHolder"]; -_unit = [_this, 0, ObjNull,[ObjNull]] call BIS_fnc_Param; - -_currentWeapon = currentWeapon _unit; -_currentAnimation = animationState _unit; -_WeaponHolder = "GroundWeaponHolder" createVehicle position _unit; - -_unit removeWeapon _currentWeapon; -_weaponHolder addWeaponCargoGlobal [_currentWeapon, 1]; -//_unit action [ "DropWeapon", _WeaponHolder, _currentWeapon ]; -_WeaponHolder setPos (getPos _unit); -//_unit switchMove _currentAnimation; - -_primairyWeapon = primaryWeapon _unit; -_secondairyWeapon = secondaryWeapon _unit; -_handGunWeapon = handgunWeapon _unit; - -switch (_currentWeapon) do { - case _primairyWeapon: { - - }; - case _secondairyWeapon: { - - }; - case _handGunWeapon: { - - }; - default {}; -}; \ No newline at end of file diff --git a/addons/common/functions/fnc_endRadioTransmission.sqf b/addons/common/functions/fnc_endRadioTransmission.sqf index 990d4e03d8..772a34a06b 100644 --- a/addons/common/functions/fnc_endRadioTransmission.sqf +++ b/addons/common/functions/fnc_endRadioTransmission.sqf @@ -14,17 +14,17 @@ // ACRE if (isClass (configFile >> "CfgPatches" >> "acre_main")) then { - [-1] call acre_core_fnc_handleMultiPttKeyPressUp; - [0] call acre_core_fnc_handleMultiPttKeyPressUp; - [1] call acre_core_fnc_handleMultiPttKeyPressUp; - [2] call acre_core_fnc_handleMultiPttKeyPressUp; + [-1] call acre_core_fnc_handleMultiPttKeyPressUp; + [0] call acre_core_fnc_handleMultiPttKeyPressUp; + [1] call acre_core_fnc_handleMultiPttKeyPressUp; + [2] call acre_core_fnc_handleMultiPttKeyPressUp; }; // TFAR if (isClass (configFile >> "CfgPatches" >> "task_force_radio")) then { - call TFAR_fnc_onSwTangentReleased; - call TFAR_fnc_onAdditionalSwTangentReleased; - call TFAR_fnc_onLRTangentReleased; - call TFAR_fnc_onAdditionalLRTangentReleased; - call TFAR_fnc_onDDTangentReleased; + call TFAR_fnc_onSwTangentReleased; + call TFAR_fnc_onAdditionalSwTangentReleased; + call TFAR_fnc_onLRTangentReleased; + call TFAR_fnc_onAdditionalLRTangentReleased; + call TFAR_fnc_onDDTangentReleased; }; diff --git a/addons/common/functions/fnc_exportConfig.sqf b/addons/common/functions/fnc_exportConfig.sqf index 10c88d6bca..c298785c26 100644 --- a/addons/common/functions/fnc_exportConfig.sqf +++ b/addons/common/functions/fnc_exportConfig.sqf @@ -1,8 +1,8 @@ // by commy2 /* - usage: + usage: - (configFile >> "CfgAmmo") call FUNC(exportConfig); + (configFile >> "CfgAmmo") call FUNC(exportConfig); */ #include "script_component.hpp" diff --git a/addons/common/functions/fnc_findItem.sqf b/addons/common/functions/fnc_findItem.sqf deleted file mode 100644 index 5c4469ea7f..0000000000 --- a/addons/common/functions/fnc_findItem.sqf +++ /dev/null @@ -1,25 +0,0 @@ -/** - * fn_findItem.sqf - * @Descr: - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: true - */ -#include "script_component.hpp" -private ["_unit","_magazine","_return"]; -_unit = _this select 0; -_item = _this select 1; - -if (_item in (uniformItems _unit)) exitwith {1}; -if (_item in (vestItems _unit)) exitwith {2}; -if (_item in (backpackItems _unit)) exitwith {3}; -if (_item in (assignedItems _unit)) exitwith {4}; -if (_item in (primaryWeaponItems _unit)) exitwith {5}; -if (_item in (secondaryWeaponItems _unit)) exitwith {6}; -if (_item in (handgunItems _unit)) exitwith {7}; -if (_item in (items _unit)) exitwith {8}; // in case it is in items but cannot be found in any other container (should never reach this) - -// If we cannot find the item, return 0. -0; \ No newline at end of file diff --git a/addons/common/functions/fnc_findMagazine.sqf b/addons/common/functions/fnc_findMagazine.sqf deleted file mode 100644 index 549d016e8d..0000000000 --- a/addons/common/functions/fnc_findMagazine.sqf +++ /dev/null @@ -1,21 +0,0 @@ -/** - * fn_findMagazine.sqf - * @Descr: Find where the current magazines are. Order: uniform, vest, backpack, any. - * @Author: Glowbal - * - * @Arguments: [unit OBJECT, magazine STRING (Classname of magazine)] - * @Return: NUMBER 0 = none, 1 = in uniform, 2 = in vest, 3 = in backpack, 4 = found outside container - * @PublicAPI: true - */ -#include "script_component.hpp" -private ["_unit","_magazine"]; -_unit = _this select 0; -_magazine = _this select 1; - -if (_magazine in (getMagazineCargo uniformContainer _unit)) exitwith {1}; -if (_magazine in (getMagazineCargo vestContainer _unit)) exitwith {2}; -if (_magazine in (getMagazineCargo backpackContainer _unit)) exitwith {3}; -if (_magazine in (magazines _unit)) exitwith {4}; // in case it cannot be found in any other container. Most likely loaded in a weapon. - -// If we cannot find the item, return 0. -0; \ No newline at end of file diff --git a/addons/common/functions/fnc_getCanInteract.sqf b/addons/common/functions/fnc_getCanInteract.sqf deleted file mode 100644 index 87f572b93d..0000000000 --- a/addons/common/functions/fnc_getCanInteract.sqf +++ /dev/null @@ -1,12 +0,0 @@ -/** - * fn_getCanInteract.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ -#include "script_component.hpp" - -((_this select 0) getvariable [QGVAR(canInteract),0]) \ No newline at end of file diff --git a/addons/common/functions/fnc_getCustomResults_f.sqf b/addons/common/functions/fnc_getCustomResults_f.sqf deleted file mode 100644 index 4b68f85c9c..0000000000 --- a/addons/common/functions/fnc_getCustomResults_f.sqf +++ /dev/null @@ -1,45 +0,0 @@ -/** - * fn_getCustomResults_f.sqf - * @Descr: Executes custom results eventhandlers, collects their output and returns this. - * @Author: Glowbal - * - * @Arguments: [arguments ANY, handle STRING] - * @Return: ARRAY Collection of all return values of all executed CustomResult handlers - * @PublicAPI: true - */ - -#include "script_component.hpp" - -private ["_arguments","_handle","_ehCfg","_eventHandlerCollection","_eventHandlerName","_cfg","_code","_classType", "_return"]; -_arguments = _this select 0; -_handle = _this select 1; - -_eventHandlerName = ("ace_f_custom_results_eventhandler_" + _handle); -_eventHandlerCollection = missionNamespace getvariable _eventHandlerName; -if (isnil "_eventHandlerCollection") then { - _eventHandlerCollection = []; - - // TODO Get a replacement for this - _cfg = (ConfigFile >> "Advanced_Combat_Environment" >> "CustomResults" >> _handle); - if (isClass _cfg) then { - _numberOfEH = count _cfg; - for [{_EHiterator=0}, {(_EHiterator< _numberOfEH)}, {_EHiterator=_EHiterator+1}] do { - _ehCfg = _cfg select _EHiterator; - if (isClass _ehCfg) then { - _classType = (ConfigName _ehCfg); - _code = (compile getText(_ehCfg >> "onCall")); - _eventHandlerCollection pushback [_classType, _code]; - true; - }; - }; - }; - missionNamespace setvariable [_eventHandlerName, _eventHandlerCollection]; -}; - -_return = []; -{ - _return pushback (_arguments call (_x select 1)); - false; -}count _eventHandlerCollection; - -_return diff --git a/addons/common/functions/fnc_getGunner.sqf b/addons/common/functions/fnc_getGunner.sqf index 0c82066e4b..71191083e0 100644 --- a/addons/common/functions/fnc_getGunner.sqf +++ b/addons/common/functions/fnc_getGunner.sqf @@ -20,9 +20,9 @@ private "_gunner"; _gunner = objNull; { - if (_weapon in (_vehicle weaponsTurret _x)) exitWith { - _gunner = _vehicle turretUnit _x; - }; + if (_weapon in (_vehicle weaponsTurret _x)) exitWith { + _gunner = _vehicle turretUnit _x; + }; } forEach allTurrets _vehicle; _gunner diff --git a/addons/common/functions/fnc_getHitPoints.sqf b/addons/common/functions/fnc_getHitPoints.sqf index a6d75e41b9..26b0b1b840 100644 --- a/addons/common/functions/fnc_getHitPoints.sqf +++ b/addons/common/functions/fnc_getHitPoints.sqf @@ -23,33 +23,33 @@ _hitpoints = []; private "_hitpointClasses"; _hitpointClasses = [_config >> "HitPoints"]; { - private "_class"; - _class = ([_config, _x] call FUNC(getTurretConfigPath)) >> "HitPoints"; + private "_class"; + _class = ([_config, _x] call FUNC(getTurretConfigPath)) >> "HitPoints"; - if (isClass _class) then { - _hitpointClasses pushBack _class; - }; + if (isClass _class) then { + _hitpointClasses pushBack _class; + }; } forEach allTurrets _vehicle; // iterate through all classes with hitpoints and their parents { - private "_class"; - _class = _x; + private "_class"; + _class = _x; - while {isClass _class} do { + while {isClass _class} do { - for "_i" from 0 to (count _class - 1) do { - private "_entry"; - _entry = configName (_class select _i); + for "_i" from 0 to (count _class - 1) do { + private "_entry"; + _entry = configName (_class select _i); - if (!(_entry in _hitpoints) && {!isNil {_vehicle getHitPointDamage _entry}}) then { - _hitpoints pushBack _entry; - }; - }; + if (!(_entry in _hitpoints) && {!isNil {_vehicle getHitPointDamage _entry}}) then { + _hitpoints pushBack _entry; + }; + }; - _class = inheritsFrom _class; - }; + _class = inheritsFrom _class; + }; } forEach _hitpointClasses; diff --git a/addons/common/functions/fnc_getHitPointsWithSelections.sqf b/addons/common/functions/fnc_getHitPointsWithSelections.sqf index e9a7a8fac5..f0c9801382 100644 --- a/addons/common/functions/fnc_getHitPointsWithSelections.sqf +++ b/addons/common/functions/fnc_getHitPointsWithSelections.sqf @@ -24,36 +24,36 @@ _selections = []; private "_hitpointClasses"; _hitpointClasses = [_config >> "HitPoints"]; { - private "_class"; - _class = ([_config, _x] call FUNC(getTurretConfigPath)) >> "HitPoints"; + private "_class"; + _class = ([_config, _x] call FUNC(getTurretConfigPath)) >> "HitPoints"; - if (isClass _class) then { - _hitpointClasses pushBack _class; - }; + if (isClass _class) then { + _hitpointClasses pushBack _class; + }; } forEach allTurrets _vehicle; // iterate through all classes with hitpoints and their parents { - private "_class"; - _class = _x; + private "_class"; + _class = _x; - while {isClass _class} do { + while {isClass _class} do { - for "_i" from 0 to (count _class - 1) do { - private ["_entry", "_selection"]; + for "_i" from 0 to (count _class - 1) do { + private ["_entry", "_selection"]; - _entry = configName (_class select _i); - _selection = getText (_class select _i >> "name"); + _entry = configName (_class select _i); + _selection = getText (_class select _i >> "name"); - if (!(_selection in _selections) && {!isNil {_vehicle getHit _selection}}) then { - _hitpoints pushBack _entry; - _selections pushBack _selection; - }; - }; + if (!(_selection in _selections) && {!isNil {_vehicle getHit _selection}}) then { + _hitpoints pushBack _entry; + _selections pushBack _selection; + }; + }; - _class = inheritsFrom _class; - }; + _class = inheritsFrom _class; + }; } forEach _hitpointClasses; diff --git a/addons/common/functions/fnc_getWeaponItems_f.sqf b/addons/common/functions/fnc_getWeaponItems_f.sqf deleted file mode 100644 index d18ce28a72..0000000000 --- a/addons/common/functions/fnc_getWeaponItems_f.sqf +++ /dev/null @@ -1,14 +0,0 @@ -/** - * fn_getWeaponItems_f.sqf - * @Descr: Get the weapon items from the unit. - * @Author: Glowbal - * - * @Arguments: [unit OBJECT] - * @Return: - * @PublicAPI: false - */ -#include "script_component.hpp" -private "_unit"; -_unit = _this select 0; - -[primaryWeaponItems _unit, secondaryWeaponItems _unit, handgunItems _unit]; \ No newline at end of file diff --git a/addons/common/functions/fnc_hashGet.sqf b/addons/common/functions/fnc_hashGet.sqf index 6147d06a73..7682b2f6a2 100644 --- a/addons/common/functions/fnc_hashGet.sqf +++ b/addons/common/functions/fnc_hashGet.sqf @@ -9,18 +9,18 @@ _key = _this select 1; ERRORDATA(2); _val = nil; try { - if(VALIDHASH(_hash)) then { - _index = (_hash select 0) find _key; - if(_index != -1) then { - _val = (_hash select 1) select _index; - if(IS_STRING(_val) && {_val == "ACREHASHREMOVEDONOTUSETHISVAL"}) then { - _val = nil; - }; - }; - } else { - ERROR("Input hash is not valid"); - }; + if(VALIDHASH(_hash)) then { + _index = (_hash select 0) find _key; + if(_index != -1) then { + _val = (_hash select 1) select _index; + if(IS_STRING(_val) && {_val == "ACREHASHREMOVEDONOTUSETHISVAL"}) then { + _val = nil; + }; + }; + } else { + ERROR("Input hash is not valid"); + }; } catch { - HANDLECATCH; + HANDLECATCH; }; _val diff --git a/addons/common/functions/fnc_hashHasKey.sqf b/addons/common/functions/fnc_hashHasKey.sqf index d69ad2f3e8..8011e987fb 100644 --- a/addons/common/functions/fnc_hashHasKey.sqf +++ b/addons/common/functions/fnc_hashHasKey.sqf @@ -9,15 +9,15 @@ _key = _this select 1; ERRORDATA(2); _val = false; try { - if(VALIDHASH(_hash)) then { - _index = (_hash select 0) find _key; - if(_index != -1) then { - _val = true; - }; - } else { - ERROR("Input hash is not valid"); - }; + if(VALIDHASH(_hash)) then { + _index = (_hash select 0) find _key; + if(_index != -1) then { + _val = true; + }; + } else { + ERROR("Input hash is not valid"); + }; } catch { - HANDLECATCH; + HANDLECATCH; }; _val diff --git a/addons/common/functions/fnc_hashListCreateHash.sqf b/addons/common/functions/fnc_hashListCreateHash.sqf index fef9c79b85..cdad5987cd 100644 --- a/addons/common/functions/fnc_hashListCreateHash.sqf +++ b/addons/common/functions/fnc_hashListCreateHash.sqf @@ -7,12 +7,12 @@ _hashList = _this select 0; ERRORDATA(1); _hashKeys = []; try { - if(VALIDHASH(_hashList)) then { - _hashKeys = (_hashList select 0); - } else { - ERROR("Input hashlist is not valid"); - }; + if(VALIDHASH(_hashList)) then { + _hashKeys = (_hashList select 0); + } else { + ERROR("Input hashlist is not valid"); + }; } catch { - HANDLECATCH; + HANDLECATCH; }; [_hashKeys, []]; diff --git a/addons/common/functions/fnc_hashListPush.sqf b/addons/common/functions/fnc_hashListPush.sqf index e783f7c324..afd092a1b9 100644 --- a/addons/common/functions/fnc_hashListPush.sqf +++ b/addons/common/functions/fnc_hashListPush.sqf @@ -7,11 +7,11 @@ _hashList = _this select 0; _value = _this select 1; ERRORDATA(2); try { - if(VALIDHASH(_hashList)) then { - [_hashList, (count (_hashList select 1)), _value] call FUNC(hashListSet); - } else { - ERROR("Input hashlist in push not valid"); - }; + if(VALIDHASH(_hashList)) then { + [_hashList, (count (_hashList select 1)), _value] call FUNC(hashListSet); + } else { + ERROR("Input hashlist in push not valid"); + }; } catch { - HANDLECATCH; + HANDLECATCH; }; diff --git a/addons/common/functions/fnc_hashListSelect.sqf b/addons/common/functions/fnc_hashListSelect.sqf index e1ee0aae0f..0c552d072e 100644 --- a/addons/common/functions/fnc_hashListSelect.sqf +++ b/addons/common/functions/fnc_hashListSelect.sqf @@ -8,20 +8,20 @@ _index = _this select 1; ERRORDATA(2); _hash = nil; try { - if(VALIDHASH(_hashList)) then { - _keys = _hashList select 0; - _hashes = _hashList select 1; - if(_index < (count _hashes)) then { - _values = _hashes select _index; + if(VALIDHASH(_hashList)) then { + _keys = _hashList select 0; + _hashes = _hashList select 1; + if(_index < (count _hashes)) then { + _values = _hashes select _index; - _hash = [_keys, _values, 1]; - } else { - ERROR("Index of hashlist is out of range"); - }; - } else { - ERROR("Input hashlist is not valid"); - }; + _hash = [_keys, _values, 1]; + } else { + ERROR("Index of hashlist is out of range"); + }; + } else { + ERROR("Input hashlist is not valid"); + }; } catch { - HANDLECATCH; + HANDLECATCH; }; _hash; diff --git a/addons/common/functions/fnc_hashListSet.sqf b/addons/common/functions/fnc_hashListSet.sqf index 8b7239dffd..c384bc15c9 100644 --- a/addons/common/functions/fnc_hashListSet.sqf +++ b/addons/common/functions/fnc_hashListSet.sqf @@ -8,17 +8,17 @@ _index = _this select 1; _value = _this select 2; ERRORDATA(3); try { - if(VALIDHASH(_hashList)) then { - if(VALIDHASH(_value)) then { - _vals = _value select 1; - - (_hashList select 1) set[_index, _vals]; - } else { - ERROR("Set hash in hashlist is not valid"); - }; - } else { - ERROR("Input hashlist is not valid"); - }; + if(VALIDHASH(_hashList)) then { + if(VALIDHASH(_value)) then { + _vals = _value select 1; + + (_hashList select 1) set[_index, _vals]; + } else { + ERROR("Set hash in hashlist is not valid"); + }; + } else { + ERROR("Input hashlist is not valid"); + }; } catch { - HANDLECATCH; + HANDLECATCH; }; diff --git a/addons/common/functions/fnc_hashRem.sqf b/addons/common/functions/fnc_hashRem.sqf index 86898fb3df..000dbbefe0 100644 --- a/addons/common/functions/fnc_hashRem.sqf +++ b/addons/common/functions/fnc_hashRem.sqf @@ -8,23 +8,23 @@ _key = _this select 1; ERRORDATA(2); _val = nil; try { - if(VALIDHASH(_hash)) then { - _index = (_hash select 0) find _key; - if(_index != -1) then { - (_hash select 1) set[_index, "ACREHASHREMOVEDONOTUSETHISVAL"]; - // is this hash is not part of a hash list? - // if it is we need to leave the keys intact. - if((count _hash) == 2) then { - // if this is a standalone hash then we can clean it up - (_hash select 0) set[_index, "ACREHASHREMOVEDONOTUSETHISVAL"]; - _hash set[0, ((_hash select 0) - ["ACREHASHREMOVEDONOTUSETHISVAL"])]; - _hash set[1, ((_hash select 1) - ["ACREHASHREMOVEDONOTUSETHISVAL"])]; - }; - }; - } else { - ERROR("Input hash is not valid"); - }; + if(VALIDHASH(_hash)) then { + _index = (_hash select 0) find _key; + if(_index != -1) then { + (_hash select 1) set[_index, "ACREHASHREMOVEDONOTUSETHISVAL"]; + // is this hash is not part of a hash list? + // if it is we need to leave the keys intact. + if((count _hash) == 2) then { + // if this is a standalone hash then we can clean it up + (_hash select 0) set[_index, "ACREHASHREMOVEDONOTUSETHISVAL"]; + _hash set[0, ((_hash select 0) - ["ACREHASHREMOVEDONOTUSETHISVAL"])]; + _hash set[1, ((_hash select 1) - ["ACREHASHREMOVEDONOTUSETHISVAL"])]; + }; + }; + } else { + ERROR("Input hash is not valid"); + }; } catch { - HANDLECATCH; + HANDLECATCH; }; true diff --git a/addons/common/functions/fnc_hashSet.sqf b/addons/common/functions/fnc_hashSet.sqf index 23438eaf83..0e374d5f12 100644 --- a/addons/common/functions/fnc_hashSet.sqf +++ b/addons/common/functions/fnc_hashSet.sqf @@ -9,19 +9,19 @@ _key = _this select 1; _val = _this select 2; ERRORDATA(3); try { - if(VALIDHASH(_hash)) then { - _index = (_hash select 0) find _key; - if(_index == -1) then { - _index = (_hash select 0) find "ACREHASHREMOVEDONOTUSETHISVAL"; - if(_index == -1) then { - _index = (count (_hash select 0)); - }; - (_hash select 0) set[_index, _key]; - }; - (_hash select 1) set[_index, _val]; - } else { - ERROR("Input hash is not valid"); - }; + if(VALIDHASH(_hash)) then { + _index = (_hash select 0) find _key; + if(_index == -1) then { + _index = (_hash select 0) find "ACREHASHREMOVEDONOTUSETHISVAL"; + if(_index == -1) then { + _index = (count (_hash select 0)); + }; + (_hash select 0) set[_index, _key]; + }; + (_hash select 1) set[_index, _val]; + } else { + ERROR("Input hash is not valid"); + }; } catch { - HANDLECATCH; + HANDLECATCH; }; diff --git a/addons/common/functions/fnc_inWater_f.sqf b/addons/common/functions/fnc_inWater.sqf similarity index 100% rename from addons/common/functions/fnc_inWater_f.sqf rename to addons/common/functions/fnc_inWater.sqf diff --git a/addons/common/functions/fnc_isHC.sqf b/addons/common/functions/fnc_isHC.sqf deleted file mode 100644 index 82a9d49ba2..0000000000 --- a/addons/common/functions/fnc_isHC.sqf +++ /dev/null @@ -1,24 +0,0 @@ -/** - * fn_isHC.sqf - * @Descr: Check if current locality is a headless client - * @Author: Glowbal - * - * @Arguments: [] - * @Return: BOOL True if locality is headless client OR is not in multiplayer - * @PublicAPI: true - */ - -#include "script_component.hpp" - -private ["_return"]; - -if (!isMultiplayer) then { - _return = true; -} else { - if (isServer && !isDedicated) then { - _return = true; - } else { - _return = !(hasInterface || isDedicated); - }; -}; -_return \ No newline at end of file diff --git a/addons/common/functions/fnc_isModLoaded_f.sqf b/addons/common/functions/fnc_isModLoaded.sqf similarity index 100% rename from addons/common/functions/fnc_isModLoaded_f.sqf rename to addons/common/functions/fnc_isModLoaded.sqf diff --git a/addons/common/functions/fnc_loadPerson_f.sqf b/addons/common/functions/fnc_loadPerson.sqf similarity index 86% rename from addons/common/functions/fnc_loadPerson_f.sqf rename to addons/common/functions/fnc_loadPerson.sqf index 5944879c62..0d2995db1b 100644 --- a/addons/common/functions/fnc_loadPerson_f.sqf +++ b/addons/common/functions/fnc_loadPerson.sqf @@ -10,7 +10,7 @@ #include "script_component.hpp" -#define GROUP_SWITCH_ID QUOTE(FUNC(loadPerson_F)) +#define GROUP_SWITCH_ID QUOTE(FUNC(loadPerson)) private ["_caller", "_unit","_vehicle", "_loadcar", "_loadhelicopter", "_loadtank"]; _caller = [_this, 0, ObjNull,[ObjNull]] call BIS_fnc_Param; @@ -34,9 +34,9 @@ if (_unit distance _loadcar <= 10) then { }; }; if (!isNull _vehicle) then { - [_unit, true, GROUP_SWITCH_ID, side group _caller] call FUNC(switchToGroupSide_f); + [_unit, true, GROUP_SWITCH_ID, side group _caller] call FUNC(switchToGroupSide); [_caller,objNull] call FUNC(carryObj); [_unit,objNull] call FUNC(carryObj); - [[_unit, _vehicle,_caller], QUOTE(FUNC(loadPersonLocal_F)), _unit, false] call EFUNC(common,execRemoteFnc); + [[_unit, _vehicle,_caller], QUOTE(FUNC(loadPersonLocal)), _unit, false] call EFUNC(common,execRemoteFnc); }; _vehicle \ No newline at end of file diff --git a/addons/common/functions/fnc_loadPersonLocal_f.sqf b/addons/common/functions/fnc_loadPersonLocal.sqf similarity index 83% rename from addons/common/functions/fnc_loadPersonLocal_f.sqf rename to addons/common/functions/fnc_loadPersonLocal.sqf index dbba09111a..6e31050cf9 100644 --- a/addons/common/functions/fnc_loadPersonLocal_f.sqf +++ b/addons/common/functions/fnc_loadPersonLocal.sqf @@ -16,13 +16,13 @@ _vehicle = [_this, 1, ObjNull,[ObjNull]] call BIS_fnc_Param; _caller = [_this, 2, ObjNull,[ObjNull]] call BIS_fnc_Param; if (!alive _unit) then { - _unit = [_unit,_caller] call FUNC(makeCopyOfBody_F); + _unit = [_unit,_caller] call FUNC(makeCopyOfBody); }; _unit moveInCargo _vehicle; -_loaded = _vehicle getvariable [QGVAR(loaded_persons_F),[]]; +_loaded = _vehicle getvariable [QGVAR(loaded_persons),[]]; _loaded pushback _unit; -_vehicle setvariable [QGVAR(loaded_persons_F),_loaded,true]; +_vehicle setvariable [QGVAR(loaded_persons),_loaded,true]; if (!([_unit] call FUNC(isAwake))) then { _handle = [_unit,_vehicle] spawn { private ["_unit","_vehicle"]; diff --git a/addons/common/functions/fnc_moveToTempGroup.sqf b/addons/common/functions/fnc_moveToTempGroup.sqf index b146e67ef3..802bc2285d 100644 --- a/addons/common/functions/fnc_moveToTempGroup.sqf +++ b/addons/common/functions/fnc_moveToTempGroup.sqf @@ -18,12 +18,12 @@ if (_moveTo) then { _previousGroup = group _unit; _newGroup = createGroup (side _previousGroup); [_unit] joinSilent _newGroup; - _unit setvariable [QGVAR(previousGroup_F),_previousGroup]; + _unit setvariable [QGVAR(previousGroup),_previousGroup]; } else { - _previousGroup = _unit getvariable QGVAR(previousGroup_F); + _previousGroup = _unit getvariable QGVAR(previousGroup); if (!isnil "_previousGroup") then { _currentGroup = group _unit; - _unit setvariable [QGVAR(previousGroup_F),nil]; + _unit setvariable [QGVAR(previousGroup),nil]; [_unit] joinSilent _previousGroup; if (count units _currentGroup == 0) then { deleteGroup _currentGroup; diff --git a/addons/common/functions/fnc_onLoadRscDisplayChannel.sqf b/addons/common/functions/fnc_onLoadRscDisplayChannel.sqf index 2a2fbfc9a4..ae8113c1b8 100644 --- a/addons/common/functions/fnc_onLoadRscDisplayChannel.sqf +++ b/addons/common/functions/fnc_onLoadRscDisplayChannel.sqf @@ -1,24 +1,29 @@ /* - Name: FUNC(onLoadRscDisplayChannel) - - Author: Pabst Mirror, commy2 - - Description: - When the RscDisplayChannel is loaded, this will constantly uiNamespace variable "ACE_currentChannel" - with the raw localized text of CA_Channel (IDC=101). Only runs while the display is open. - - Parameters: - 0: DISPLAY - RscDisplayChannel - - Returns: - Nothing -*/ + * Author: Pabst Mirror, commy2 + * When the RscDisplayChannel is loaded, this will constantly uiNamespace variable ace_common_currentChannel + * with the raw localized text of CA_Channel (IDC=101). Only runs while the display is open. + * + * Arguments: + * 0: The RscDisplayChannel Display + * + * Return Value: + * Nothing + * + * Example: + * onLoad = QUOTE(_this call FUNC(onLoadRscDisplayChannel)); + * + * Public: No + */ #include "script_component.hpp" -uiNamespace setVariable ["ACE_ctrlChannel", (_this select 0) displayCtrl 101]; +uiNamespace setVariable [QGVAR(currentChannelControl), ((_this select 0) displayCtrl 101)]; ["ACE_currentChannel", "onEachFrame", { - if (ctrlText (uiNamespace getVariable ["ACE_ctrlChannel", controlNull]) != "") then { - uiNamespace setVariable ["ACE_currentChannel", ctrlText (uiNamespace getVariable ["ACE_ctrlChannel", controlNull])]; - }; + if (isNull (uiNamespace getVariable [QGVAR(currentChannelControl), controlNull])) then { + ["ACE_currentChannel", "onEachFrame"] call BIS_fnc_removeStackedEventHandler; + } else { + private "_localizedChannelText"; + _localizedChannelText = ctrlText (uiNamespace getVariable [QGVAR(currentChannelControl), controlNull]); + uiNamespace setVariable [QGVAR(currentChannel), _localizedChannelText]; + }; }] call BIS_fnc_addStackedEventhandler; diff --git a/addons/common/functions/fnc_positionToASL.sqf b/addons/common/functions/fnc_positionToASL.sqf new file mode 100644 index 0000000000..916184eb33 --- /dev/null +++ b/addons/common/functions/fnc_positionToASL.sqf @@ -0,0 +1,21 @@ +/* + * Author: CAA-Picard + * Converts Arma "Position" to ASL + * + * Arguments: + * 0: position x + * 1: position y + * 2: position z + * + * Return Value: + * None + * + * Public: No + */ +#include "script_component.hpp" + +if (surfaceIsWater _this) then { + _this +} else { + ATLtoASL _this +}; diff --git a/addons/common/functions/fnc_progressBar.sqf b/addons/common/functions/fnc_progressBar.sqf index ab4cb7b69c..0b8fcc7ac4 100644 --- a/addons/common/functions/fnc_progressBar.sqf +++ b/addons/common/functions/fnc_progressBar.sqf @@ -15,6 +15,9 @@ * * Return value: * Nothing +* +* Example: +* [5, [], {Hint "Finished!"}, {hint "Failure!"}, "My Title"] call ace_common_fnc_progressBar */ #include "script_component.hpp" @@ -32,14 +35,24 @@ closeDialog 0; createDialog QGVAR(ProgressBar_Dialog); (uiNamespace getVariable QGVAR(ctrlProgressBarTitle)) ctrlSetText _localizedTitle; +if (GVAR(SettingProgressBarLocation) == 1) then { + private "_ctrlPos"; + _ctrlPos = [1 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2), 29 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2), 38 * (((safezoneW / safezoneH) min 1.2) / 40), 0.8 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)]; + (uiNamespace getVariable QGVAR(ctrlProgressBar)) ctrlSetPosition _ctrlPos; + (uiNamespace getVariable QGVAR(ctrlProgressBarTitle)) ctrlSetPosition _ctrlPos; + (uiNamespace getVariable QGVAR(ctrlProgressBar)) ctrlCommit 0; + (uiNamespace getVariable QGVAR(ctrlProgressBarTitle)) ctrlCommit 0; +}; + + _perFrameFunction = { PARAMS_2(_parameters,_pfhID); EXPLODE_8_PVT(_parameters,_args,_onFinish,_onFail,_condition,_player,_startTime,_totalTime,_exceptions); private ["_elapsedTime", "_errorCode"]; - + _elapsedTime = time - _startTime; _errorCode = -1; - + if (isNull (uiNamespace getVariable [QGVAR(ctrlProgressBar), controlNull])) then { _errorCode = 1; } else { diff --git a/addons/common/functions/fnc_queueAnimation.sqf b/addons/common/functions/fnc_queueAnimation.sqf index a489a46174..73f3dca109 100644 --- a/addons/common/functions/fnc_queueAnimation.sqf +++ b/addons/common/functions/fnc_queueAnimation.sqf @@ -4,7 +4,7 @@ terminate (missionNamespace getVariable [QGVAR(waitForAnimationHandle), scriptNull]); GVAR(waitForAnimationHandle) = _this spawn { - waitUntil {!([_this select 0] call FUNC(inTransitionAnim))}; + waitUntil {!([_this select 0] call FUNC(inTransitionAnim))}; - _this call FUNC(doAnimation); + _this call FUNC(doAnimation); }; diff --git a/addons/common/functions/fnc_removeSpecificMagazine.sqf b/addons/common/functions/fnc_removeSpecificMagazine.sqf new file mode 100644 index 0000000000..7f29cf979c --- /dev/null +++ b/addons/common/functions/fnc_removeSpecificMagazine.sqf @@ -0,0 +1,69 @@ +/* + * Author: CAA-Picard + * Removes a magazine from the unit that has an specific ammo count + * + * Argument: + * 0: Player + * 1: Magazine + * 2: Ammo count + * + * Return value: + * None + */ +#include "script_component.hpp" + +EXPLODE_3_PVT(_this,_player,_magazineType,_ammoCount); + +private ["_magazines","_index","_isRemoved"]; +_isRemoved = false; + +// Check uniform +_magazines = [magazinesAmmoCargo uniformContainer _player, {_this select 0 == _magazineType}] call FUNC(filter); +_index = _magazines find [_magazineType,_ammoCount]; +if (_index > -1) exitWith { + { + _player removeItemFromUniform (_x select 0); + } forEach _magazines; + + { + if (!_isRemoved && (_x isEqualTo [_magazineType,_ammoCount])) then { + _isRemoved = true; + } else { + (uniformContainer _player) addMagazineAmmoCargo [_x select 0, 1, _x select 1]; + }; + } forEach _magazines; +}; + +// Check vest +_magazines = [magazinesAmmoCargo vestContainer _player, {_this select 0 == _magazineType}] call FUNC(filter); +_index = _magazines find [_magazineType,_ammoCount]; +if (_index > -1) exitWith { + { + _player removeItemFromVest (_x select 0); + } forEach _magazines; + + { + if (!_isRemoved && (_x isEqualTo [_magazineType,_ammoCount])) then { + _isRemoved = true; + } else { + (vestContainer _player) addMagazineAmmoCargo [_x select 0, 1, _x select 1]; + }; + } forEach _magazines; +}; + +// Check backpack +_magazines = [magazinesAmmoCargo backpackContainer _player, {_this select 0 == _magazineType}] call FUNC(filter); +_index = _magazines find [_magazineType,_ammoCount]; +if (_index > -1) exitWith { + { + _player removeItemFromBackpack (_x select 0); + } forEach _magazines; + + { + if (!_isRemoved && (_x isEqualTo [_magazineType,_ammoCount])) then { + _isRemoved = true; + } else { + (backpackContainer _player) addMagazineAmmoCargo [_x select 0, 1, _x select 1]; + }; + } forEach _magazines; +}; diff --git a/addons/common/functions/fnc_resetAllDefaults_f.sqf b/addons/common/functions/fnc_resetAllDefaults.sqf similarity index 74% rename from addons/common/functions/fnc_resetAllDefaults_f.sqf rename to addons/common/functions/fnc_resetAllDefaults.sqf index c415b5b32c..63e6764d01 100644 --- a/addons/common/functions/fnc_resetAllDefaults_f.sqf +++ b/addons/common/functions/fnc_resetAllDefaults.sqf @@ -17,17 +17,17 @@ _unit setvariable ["ACE_isDead",nil,true]; _unit setvariable ["ACE_isUnconscious", nil, true]; if (isPlayer _unit) then { - [true] call FUNC(setVolume_f); - [false] call FUNC(disableKeyInput_f); - if (["ace_medical"] call FUNC(isModLoader_f)) then { + [true] call FUNC(setVolume); + [false] call FUNC(disableKeyInput); + if (["ace_medical"] call FUNC(isModLoader)) then { [false] call EFUNC(medical,effectBlackOut); }; - if !(isnil QGVAR(DISABLE_USER_INPUT_COLLECTION_F)) then { + if !(isnil QGVAR(DISABLE_USER_INPUT_COLLECTION)) then { // clear all disable user input { [_X, false] call FUNC(setDisableUserInputStatus); - }foreach GVAR(DISABLE_USER_INPUT_COLLECTION_F); + }foreach GVAR(DISABLE_USER_INPUT_COLLECTION); }; }; diff --git a/addons/common/functions/fnc_revealObject_f.sqf b/addons/common/functions/fnc_revealObject_f.sqf deleted file mode 100644 index 9c5a34f59a..0000000000 --- a/addons/common/functions/fnc_revealObject_f.sqf +++ /dev/null @@ -1,15 +0,0 @@ -/** - * fnc_revealObject_f.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - -#include "script_component.hpp" - -if (hasInterface) then { - player reveal (_this select 0); -}; \ No newline at end of file diff --git a/addons/gui/functions/fnc_sendDisplayInformationTo.sqf b/addons/common/functions/fnc_sendDisplayInformationTo.sqf similarity index 95% rename from addons/gui/functions/fnc_sendDisplayInformationTo.sqf rename to addons/common/functions/fnc_sendDisplayInformationTo.sqf index ae4012b5fe..f22894e057 100644 --- a/addons/gui/functions/fnc_sendDisplayInformationTo.sqf +++ b/addons/common/functions/fnc_sendDisplayInformationTo.sqf @@ -42,6 +42,6 @@ if (isPlayer _reciever) then { }foreach _content; - [_title,_content,_type] call EFUNC(gui,displayInformation); + [_title,_content,_type] call EFUNC(common,displayInformation); }; }; \ No newline at end of file diff --git a/addons/gui/functions/fnc_sendDisplayMessageTo.sqf b/addons/common/functions/fnc_sendDisplayMessageTo.sqf similarity index 95% rename from addons/gui/functions/fnc_sendDisplayMessageTo.sqf rename to addons/common/functions/fnc_sendDisplayMessageTo.sqf index c66af97266..3c5b399659 100644 --- a/addons/gui/functions/fnc_sendDisplayMessageTo.sqf +++ b/addons/common/functions/fnc_sendDisplayMessageTo.sqf @@ -41,6 +41,6 @@ if (isPlayer _reciever) then { }foreach _parameters; _content = format _localizationArray; - [_title,_content,_type] call EFUNC(gui,displayMessage); + [_title,_content,_type] call EFUNC(common,displayMessage); }; }; \ No newline at end of file diff --git a/addons/common/functions/fnc_sendRequest_f.sqf b/addons/common/functions/fnc_sendRequest.sqf similarity index 100% rename from addons/common/functions/fnc_sendRequest_f.sqf rename to addons/common/functions/fnc_sendRequest.sqf diff --git a/addons/common/functions/fnc_setDisableUserInputStatus.sqf b/addons/common/functions/fnc_setDisableUserInputStatus.sqf index 2451cbe90f..2cf25b827a 100644 --- a/addons/common/functions/fnc_setDisableUserInputStatus.sqf +++ b/addons/common/functions/fnc_setDisableUserInputStatus.sqf @@ -13,16 +13,16 @@ _id = _this select 0; _disable = _this select 1; -if (isnil QGVAR(DISABLE_USER_INPUT_COLLECTION_F)) then { - GVAR(DISABLE_USER_INPUT_COLLECTION_F) = []; +if (isnil QGVAR(DISABLE_USER_INPUT_COLLECTION)) then { + GVAR(DISABLE_USER_INPUT_COLLECTION) = []; }; if (_disable) then { - GVAR(DISABLE_USER_INPUT_COLLECTION_F) pushback _id; + GVAR(DISABLE_USER_INPUT_COLLECTION) pushback _id; [true] call FUNC(disableUserInput); } else { - GVAR(DISABLE_USER_INPUT_COLLECTION_F) = GVAR(DISABLE_USER_INPUT_COLLECTION_F) - [_id]; - if (GVAR(DISABLE_USER_INPUT_COLLECTION_F) isEqualTo []) then { + GVAR(DISABLE_USER_INPUT_COLLECTION) = GVAR(DISABLE_USER_INPUT_COLLECTION) - [_id]; + if (GVAR(DISABLE_USER_INPUT_COLLECTION) isEqualTo []) then { [false] call FUNC(disableUserInput); }; }; \ No newline at end of file diff --git a/addons/common/functions/fnc_setSettingFromConfig.sqf b/addons/common/functions/fnc_setSettingFromConfig.sqf index 4151f3e0e4..27c727acab 100644 --- a/addons/common/functions/fnc_setSettingFromConfig.sqf +++ b/addons/common/functions/fnc_setSettingFromConfig.sqf @@ -17,7 +17,8 @@ EXPLODE_1_PVT(_this,_optionEntry); _fnc_getValueWithType = { EXPLODE_2_PVT(_this,_optionEntry,_typeName); - _value = getNumber (_optionEntry >> "value"); + _valueConfig = (_optionEntry >> "value"); + _value = if (isNumber (_optionEntry >> "value")) then {getNumber (_optionEntry >> "value")} else {0}; TRACE_3("_fnc_getValueWithType:", configName _optionEntry, _typeName, _value); if (_typeName == "BOOL") exitWith { _value > 0 diff --git a/addons/common/functions/fnc_setVolume_f.sqf b/addons/common/functions/fnc_setVolume.sqf similarity index 100% rename from addons/common/functions/fnc_setVolume_f.sqf rename to addons/common/functions/fnc_setVolume.sqf diff --git a/addons/common/functions/fnc_string_removeWhiteSpace.sqf b/addons/common/functions/fnc_stringRemoveWhiteSpace.sqf similarity index 100% rename from addons/common/functions/fnc_string_removeWhiteSpace.sqf rename to addons/common/functions/fnc_stringRemoveWhiteSpace.sqf diff --git a/addons/common/functions/fnc_switchToGroupSide_f.sqf b/addons/common/functions/fnc_switchToGroupSide.sqf similarity index 92% rename from addons/common/functions/fnc_switchToGroupSide_f.sqf rename to addons/common/functions/fnc_switchToGroupSide.sqf index 97b043adbe..528d32853c 100644 --- a/addons/common/functions/fnc_switchToGroupSide_f.sqf +++ b/addons/common/functions/fnc_switchToGroupSide.sqf @@ -16,7 +16,7 @@ _switch = [_this, 1, false,[false]] call BIS_fnc_Param; _id = [_this, 2, "", [""]] call BIS_fnc_Param; _side = [_this, 3, side _unit,[west]] call BIS_fnc_Param; -_previousGroupsList = _unit getvariable [QGVAR(previousGroupSwitchTo_F),[]]; +_previousGroupsList = _unit getvariable [QGVAR(previousGroupSwitchTo),[]]; if (_switch) then { // go forward _previousGroup = group _unit; @@ -30,7 +30,7 @@ if (_switch) then { [_unit] joinSilent _newGroup; _previousGroupsList pushback [_previousGroup, _originalSide, _id, true]; - _unit setvariable [QGVAR(previousGroupSwitchTo_F), _previousGroupsList, true]; + _unit setvariable [QGVAR(previousGroupSwitchTo), _previousGroupsList, true]; } else { // go one back { @@ -60,5 +60,5 @@ if (_switch) then { }foreach _previousGroupsList; _previousGroupsList = _previousGroupsList - [objNull]; reverse _previousGroupsList; // we have to reverse again, to ensure the list is in the right order. - _unit setvariable [QGVAR(previousGroupSwitchTo_F), _previousGroupsList, true]; + _unit setvariable [QGVAR(previousGroupSwitchTo), _previousGroupsList, true]; }; diff --git a/addons/common/functions/fnc_unloadPerson_f.sqf b/addons/common/functions/fnc_unloadPerson.sqf similarity index 89% rename from addons/common/functions/fnc_unloadPerson_f.sqf rename to addons/common/functions/fnc_unloadPerson.sqf index 1aaaee84a1..33c0e9c0c2 100644 --- a/addons/common/functions/fnc_unloadPerson_f.sqf +++ b/addons/common/functions/fnc_unloadPerson.sqf @@ -10,7 +10,7 @@ #include "script_component.hpp" -#define GROUP_SWITCH_ID QUOTE(FUNC(loadPerson_F)) +#define GROUP_SWITCH_ID QUOTE(FUNC(loadPerson)) private ["_caller", "_unit","_vehicle", "_loaded"]; _caller = [_this, 0, ObjNull,[ObjNull]] call BIS_fnc_Param; @@ -27,11 +27,11 @@ if (!alive _unit) then { _unit action ["Eject", vehicle _unit]; }; -[_unit, false, GROUP_SWITCH_ID, side group _caller] call FUNC(switchToGroupSide_f); +[_unit, false, GROUP_SWITCH_ID, side group _caller] call FUNC(switchToGroupSide); -_loaded = _vehicle getvariable [QGVAR(loaded_persons_F),[]]; +_loaded = _vehicle getvariable [QGVAR(loaded_persons),[]]; _loaded = _loaded - [_unit]; -_vehicle setvariable [QGVAR(loaded_persons_F),_loaded,true]; +_vehicle setvariable [QGVAR(loaded_persons),_loaded,true]; if (!([_unit] call FUNC(isAwake))) then { _handle = [_unit,_vehicle] spawn { diff --git a/addons/common/stringtable.xml b/addons/common/stringtable.xml index f2d944eb7a..d1462c1214 100644 --- a/addons/common/stringtable.xml +++ b/addons/common/stringtable.xml @@ -315,6 +315,30 @@ Ignoruj prośby wysłane przez innych graczy. Akceptacji wymagają między innymi akcje używania / współdzielenia wyposażenia, wykonywania określonych czynności. Rechazar Peticiones de otros jugadores. Pueden ser solicitudes para usar / compartir equipamiento, realizar ciertas acciones. + + Feedback icons + + + Select the position of or disable the feedback icons on your screen. These icons will show to provide extra feedback on your character status and actions performed. + + + Progress bar location + + + Set the desired location of the progress bar on your screen. + + + Hint Background color + + + The color of the background from the ACE hints. + + + Hint text font color + + + The color of the text font from the ACE hints. This color is the default color for all text displayed through the ACE Hint system, if the hint text has no other color specified. + \ No newline at end of file diff --git a/addons/explosives/CfgACE_Triggers.hpp b/addons/explosives/CfgACE_Triggers.hpp index 1b686d6092..789786bb4f 100644 --- a/addons/explosives/CfgACE_Triggers.hpp +++ b/addons/explosives/CfgACE_Triggers.hpp @@ -24,6 +24,12 @@ class CfgACE_Triggers { picture = PATHTOF(Data\UI\DeadmanSwitch.paa); requires[] = {"ACE_DeadManSwitch"}; }; + class Cellphone:Command { + displayName = $STR_ACE_Explosives_cellphone_displayName; + picture = PATHTOF(Data\UI\Cellphone_UI.paa); + onPlace = QUOTE(_this call FUNC(addCellphoneIED);false); + requires[] = {"ACE_Cellphone"}; + }; class PressurePlate { displayName = $STR_ACE_Explosives_PressurePlate; picture = PATHTOF(Data\UI\PressurePlate.paa); diff --git a/addons/explosives/CfgMagazines.hpp b/addons/explosives/CfgMagazines.hpp index 7cc1c8a8bd..51c85e607f 100644 --- a/addons/explosives/CfgMagazines.hpp +++ b/addons/explosives/CfgMagazines.hpp @@ -95,4 +95,33 @@ class CfgMagazines { }; }; }; + + class IEDUrbanBig_Remote_Mag: DemoCharge_Remote_Mag { + ACE_SetupObject = "ACE_Explosives_Place_IEDUrbanBig"; + class ACE_Triggers { + SupportedTriggers[] = {"Command","DeadmanSwitch", "Cellphone"}; + class Command { + FuseTime = 0.5; + }; + class DeadmanSwitch:Command{}; + class Cellphone:Command{}; + }; + }; + class IEDLandBig_Remote_Mag: IEDUrbanBig_Remote_Mag{ + ACE_SetupObject = "ACE_Explosives_Place_IEDLandBig"; + }; + class IEDUrbanSmall_Remote_Mag: DemoCharge_Remote_Mag { + ACE_SetupObject = "ACE_Explosives_Place_IEDUrbanSmall"; + class ACE_Triggers { + SupportedTriggers[] = {"Command","DeadmanSwitch", "Cellphone"}; + class Command { + FuseTime = 0.5; + }; + class DeadmanSwitch:Command{}; + class Cellphone:Command{}; + }; + }; + class IEDLandSmall_Remote_Mag: IEDUrbanSmall_Remote_Mag { + ACE_SetupObject = "ACE_Explosives_Place_IEDLandSmall"; + }; }; diff --git a/addons/explosives/CfgVehicles.hpp b/addons/explosives/CfgVehicles.hpp index 73477ddce5..a1f0aa5944 100644 --- a/addons/explosives/CfgVehicles.hpp +++ b/addons/explosives/CfgVehicles.hpp @@ -16,7 +16,6 @@ class CfgVehicles { showDisabled = 1; priority = 4; icon = PATHTOF(UI\Explosives_Menu_ca.paa); - subMenu[] = {"ACE_Explosives", 1}; hotkey = "X"; //Sub-menu items class ACE_Detonate { @@ -49,6 +48,15 @@ class CfgVehicles { priority = 0.8; hotkey = "F"; }; + class ACE_Cellphone { + displayName = $STR_ACE_Explosives_cellphone_displayName; + condition = "('ACE_Cellphone' in (items ace_player))"; + statement = "closeDialog 0;createDialog 'Rsc_ACE_PhoneInterface';"; + exceptions[] = {"ACE_Interaction_isNotSwimming"}; + showDisabled = 0; + icon = PATHTOF(Data\UI\Cellphone_UI.paa); + priority = 0.8; + }; }; }; }; @@ -105,6 +113,27 @@ class CfgVehicles { model = "\A3\Weapons_F\Explosives\mine_SLAM_directional"; }; + // IEDs + class ACE_Explosives_Place_IEDUrbanBig:ACE_Explosives_Place { + displayName = "IED Urban Big"; + model = "\A3\Weapons_F\Explosives\IED_urban_big"; + }; + + class ACE_Explosives_Place_IEDLandBig:ACE_Explosives_Place { + displayName = "IED Land Big"; + model = "\A3\Weapons_F\Explosives\IED_land_big"; + }; + + class ACE_Explosives_Place_IEDUrbanSmall:ACE_Explosives_Place { + displayName = "IED Urban Small"; + model = "\A3\Weapons_F\Explosives\IED_urban_small"; + }; + + class ACE_Explosives_Place_IEDLandSmall:ACE_Explosives_Place { + displayName = "IED Land Small"; + model = "\A3\Weapons_F\Explosives\IED_land_small"; + }; + class NATO_Box_Base; class EAST_Box_Base; class IND_Box_Base; @@ -133,6 +162,7 @@ class CfgVehicles { MACRO_ADDITEM(ACE_M26_Clacker,6) MACRO_ADDITEM(ACE_DefusalKit,12) MACRO_ADDITEM(ACE_Deadmanswitch,2) + MACRO_ADDITEM(ACE_Cellphone,3) }; }; @@ -142,6 +172,7 @@ class CfgVehicles { MACRO_ADDITEM(ACE_M26_Clacker,2) MACRO_ADDITEM(ACE_DefusalKit,2) MACRO_ADDITEM(ACE_Deadmanswitch,1) + MACRO_ADDITEM(ACE_Cellphone,2) }; }; @@ -151,6 +182,7 @@ class CfgVehicles { MACRO_ADDITEM(ACE_M26_Clacker,6) MACRO_ADDITEM(ACE_DefusalKit,12) MACRO_ADDITEM(ACE_Deadmanswitch,6) + MACRO_ADDITEM(ACE_Cellphone,10) }; }; diff --git a/addons/explosives/CfgWeapons.hpp b/addons/explosives/CfgWeapons.hpp index e239ed8841..fd142019e8 100644 --- a/addons/explosives/CfgWeapons.hpp +++ b/addons/explosives/CfgWeapons.hpp @@ -47,6 +47,20 @@ class CfgWeapons { ACE_Range = 100; ACE_Detonator = 1; + class ItemInfo: ACE_ExplosiveItem { + mass = 2; + uniformModel = "\A3\weapons_F\ammo\mag_univ.p3d"; + }; + }; + class ACE_Cellphone: ACE_ItemCore { + scope = 2; + displayName = $STR_ACE_Explosives_cellphone_displayName; + descriptionShort = $STR_ACE_Explosives_cellphone_description; + picture = PATHTOF(Data\UI\Cellphone_UI.paa); + model = "\A3\weapons_F\ammo\mag_univ.p3d"; + ACE_Range = 15000; + ACE_Detonator = 1; + class ItemInfo: ACE_ExplosiveItem { mass = 2; uniformModel = "\A3\weapons_F\ammo\mag_univ.p3d"; diff --git a/addons/explosives/Data/Audio/Cellphone_Ring.wss b/addons/explosives/Data/Audio/Cellphone_Ring.wss new file mode 100644 index 0000000000..bafdf7596a Binary files /dev/null and b/addons/explosives/Data/Audio/Cellphone_Ring.wss differ diff --git a/addons/explosives/Data/Audio/DialTone.wss b/addons/explosives/Data/Audio/DialTone.wss new file mode 100644 index 0000000000..4ac52b1acf Binary files /dev/null and b/addons/explosives/Data/Audio/DialTone.wss differ diff --git a/addons/explosives/Data/UI/Cellphone_Background.paa b/addons/explosives/Data/UI/Cellphone_Background.paa new file mode 100644 index 0000000000..9cafe97af8 Binary files /dev/null and b/addons/explosives/Data/UI/Cellphone_Background.paa differ diff --git a/addons/explosives/Data/UI/Cellphone_UI.paa b/addons/explosives/Data/UI/Cellphone_UI.paa new file mode 100644 index 0000000000..38360ee4da Binary files /dev/null and b/addons/explosives/Data/UI/Cellphone_UI.paa differ diff --git a/addons/explosives/ExplosivesUI.hpp b/addons/explosives/ExplosivesUI.hpp index c6c76e573c..769b3dc167 100644 --- a/addons/explosives/ExplosivesUI.hpp +++ b/addons/explosives/ExplosivesUI.hpp @@ -4,16 +4,49 @@ #define GUI_GRID_H (0.04) #define ST_CENTER 0x02 +#define X_OFFSET 0.25 class RscText; class RscButton; - -#define X_OFFSET 0.25 - class RscXSliderH; class IGUIBack; +class RscPicture; +class RscEdit; -class Rsc_ACE_Timer_Slider:RscXSliderH{ +class Rsc_ACE_CallScreen_Edit:RscEdit { + canModify = 1; + colorBackground[] = {0,0,0,1}; + colorText[] = {0,0,0,1}; + colorDisabled[] = {1,1,1,0.25}; + colorSelection[] = { + "(profilenamespace getvariable ['GUI_BCG_RGB_R',0.69])", + "(profilenamespace getvariable ['GUI_BCG_RGB_G',0.75])", + "(profilenamespace getvariable ['GUI_BCG_RGB_B',0.5])", + 1 + }; + text = ""; + style = "0x00 + 0x40 + 0x200"; + shadow = 1; + SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 20) * 1)"; + x = 0.288594 * safezoneW + safezoneX; + w = 0.0825 * safezoneW; + h = 0.044 * safezoneH; +}; +class Rsc_ACE_HiddenButton:RscButton { + colorText[] = {0, 0, 0, 0}; + colorDisabled[] = {0, 0, 0, 0}; + colorBackground[] = {0, 0, 0, 0}; + colorBackgroundDisabled[] = {0, 0, 0, 0}; + colorBackgroundActive[] = {0, 0, 0, 0}; + colorFocused[] = {0, 0, 0, 0}; + colorShadow[] = {0, 0, 0, 0}; + colorBorder[] = {0, 0, 0, 0}; + w = 0.095589; + h = 0.039216; + shadow = 0; +}; + +class Rsc_ACE_Timer_Slider:RscXSliderH { x = 0.4; y = 0.2; w = 0.3; @@ -21,8 +54,7 @@ class Rsc_ACE_Timer_Slider:RscXSliderH{ colorBackground[] = {0,0,0,0.5}; }; -class RscACE_SelectTimeUI -{ +class RscACE_SelectTimeUI { idd = 8854; movingEnable = 0; class controls { @@ -72,3 +104,185 @@ class RscACE_SelectTimeUI }; }; }; + +class Rsc_ACE_NumKeyButton: Rsc_ACE_HiddenButton{}; +class Rsc_ACE_PhoneInterface { + idd = 8855; + movingEnable = 1; + onLoad = QUOTE(GVAR(IED_CurrentSpeedDial) = -1); + class controls { + class RscPicture_1200: RscPicture { + idc = 1200; + text = PATHTOF(Data\UI\Cellphone_Background.paa); + x = 0.231875 * safezoneW + safezoneX; + y = 0.104 * safezoneH + safezoneY; + w = 0.195937 * safezoneW; + h = 0.704 * safezoneH; + }; + class numkey_1: Rsc_ACE_NumKeyButton { + idc = 1600; + x = 0.278281 * safezoneW + safezoneX; + y = 0.533 * safezoneH + safezoneY; + w = 0.0309375 * safezoneW; + h = 0.033 * safezoneH; + tooltip = "1"; + action = "ctrlSetText [1400,((ctrlText 1400) + '1')];"; + }; + class numkey_2: Rsc_ACE_NumKeyButton { + idc = 1601; + x = 0.314375 * safezoneW + safezoneX; + y = 0.533 * safezoneH + safezoneY; + w = 0.0309375 * safezoneW; + h = 0.033 * safezoneH; + tooltip = "2"; + action = "ctrlSetText [1400,((ctrlText 1400) + '2')];"; + }; + class numkey_3: Rsc_ACE_NumKeyButton { + idc = 1602; + x = 0.350469 * safezoneW + safezoneX; + y = 0.533 * safezoneH + safezoneY; + w = 0.0309375 * safezoneW; + h = 0.033 * safezoneH; + tooltip = "3"; + action = "ctrlSetText [1400,((ctrlText 1400) + '3')];"; + }; + class numkey_4: Rsc_ACE_NumKeyButton { + idc = 1603; + x = 0.278281 * safezoneW + safezoneX; + y = 0.577 * safezoneH + safezoneY; + w = 0.0309375 * safezoneW; + h = 0.033 * safezoneH; + tooltip = "4"; + action = "ctrlSetText [1400,((ctrlText 1400) + '4')];"; + }; + class numkey_5: Rsc_ACE_NumKeyButton { + idc = 1604; + x = 0.314375 * safezoneW + safezoneX; + y = 0.577 * safezoneH + safezoneY; + w = 0.0309375 * safezoneW; + h = 0.033 * safezoneH; + tooltip = "5"; + action = "ctrlSetText [1400,((ctrlText 1400) + '5')];"; + }; + class numkey_6: Rsc_ACE_NumKeyButton { + idc = 1605; + x = 0.350469 * safezoneW + safezoneX; + y = 0.577 * safezoneH + safezoneY; + w = 0.0309375 * safezoneW; + h = 0.033 * safezoneH; + tooltip = "6"; + action = "ctrlSetText [1400,((ctrlText 1400) + '6')];"; + }; + class numkey_7: Rsc_ACE_NumKeyButton { + idc = 1606; + x = 0.278281 * safezoneW + safezoneX; + y = 0.621 * safezoneH + safezoneY; + w = 0.0309375 * safezoneW; + h = 0.033 * safezoneH; + tooltip = "7"; + action = "ctrlSetText [1400,((ctrlText 1400) + '7')];"; + }; + class numkey_8: Rsc_ACE_NumKeyButton { + idc = 1607; + x = 0.314375 * safezoneW + safezoneX; + y = 0.621 * safezoneH + safezoneY; + w = 0.0309375 * safezoneW; + h = 0.033 * safezoneH; + tooltip = "8"; + action = "ctrlSetText [1400,((ctrlText 1400) + '8')];"; + }; + class numkey_9: Rsc_ACE_NumKeyButton { + idc = 1608; + x = 0.350469 * safezoneW + safezoneX; + y = 0.621 * safezoneH + safezoneY; + w = 0.0309375 * safezoneW; + h = 0.033 * safezoneH; + tooltip = "9"; + action = "ctrlSetText [1400,((ctrlText 1400) + '9')];"; + }; + class numkey_0: Rsc_ACE_NumKeyButton { + idc = 1609; + x = 0.314375 * safezoneW + safezoneX; + y = 0.676 * safezoneH + safezoneY; + w = 0.0309375 * safezoneW; + h = 0.033 * safezoneH; + tooltip = "0"; + action = "ctrlSetText [1400,((ctrlText 1400) + '0')];"; + }; + class speedDialAdd: Rsc_ACE_NumKeyButton { + idc = 1610; + x = 0.278281 * safezoneW + safezoneX; + y = 0.676 * safezoneH + safezoneY; + w = 0.0309375 * safezoneW; + h = 0.033 * safezoneH; + tooltip = "$STR_ACE_Explosives_Phone_AddToSpeedDial"; + action = QUOTE([ARR_2(ctrlText 1401,ctrlText 1400)] call FUNC(addToSpeedDial);); + }; + class clear: Rsc_ACE_HiddenButton { + idc = 1610; + x = 0.278281 * safezoneW + safezoneX; + y = 0.445 * safezoneH + safezoneY; + w = 0.020625 * safezoneW; + h = 0.033 * safezoneH; + tooltip = "$STR_ACE_Explosives_Clear"; + action = QUOTE(ctrlSetText [ARR_2(1400,'')];[ctrlText 1401] call FUNC(removeFromSpeedDial);ctrlSetText [ARR_2(1401,'')];); + }; + class dial: Rsc_ACE_HiddenButton { + idc = 1611; + x = 0.309219 * safezoneW + safezoneX; + y = 0.445 * safezoneH + safezoneY; + w = 0.04125 * safezoneW; + h = 0.033 * safezoneH; + tooltip = "$STR_ACE_Explosives_Phone_Dial"; + action = QUOTE([ARR_2(ace_player,ctrlText 1400)] call FUNC(dialPhone);); + }; + class up: Rsc_ACE_HiddenButton { + idc = 1612; + x = 0.360781 * safezoneW + safezoneX; + y = 0.445 * safezoneH + safezoneY; + w = 0.020625 * safezoneW; + h = 0.033 * safezoneH; + tooltip = "$STR_ACE_Explosives_Phone_Up"; + action = QUOTE([true] call FUNC(setSpeedDial)); + }; + class down: Rsc_ACE_HiddenButton { + idc = 1613; + x = 0.345312 * safezoneW + safezoneX; + y = 0.485 * safezoneH + safezoneY; + w = 0.020625 * safezoneW; + h = 0.033 * safezoneH; + tooltip = "$STR_ACE_Explosives_Phone_Down"; + action = QUOTE([false] call FUNC(setSpeedDial)); + }; + class speedDial_Text: RscText { + idc = 1405; + y = 0.302 * safezoneH + safezoneY; + SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 22) * 1)"; + x = 0.288594 * safezoneW + safezoneX; + w = 0.0825 * safezoneW; + h = 0.044 * safezoneH; + text = "Name"; + }; + class speedDial_edit: Rsc_ACE_CallScreen_Edit { + idc = 1401; + y = 0.302 * safezoneH + safezoneY; + x = 0.318 * safezoneW + safezoneX; + w = 0.1; + }; + class numberEdit_Text: RscText { + idc = 1406; + y = 0.348 * safezoneH + safezoneY; + SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 22) * 1)"; + x = 0.288594 * safezoneW + safezoneX; + w = 0.0825 * safezoneW; + h = 0.044 * safezoneH; + text = "#"; + }; + class number_edit: Rsc_ACE_CallScreen_Edit { + canModify = 0; + idc = 1400; + y = 0.348 * safezoneH + safezoneY; + x = 0.3 * safezoneW + safezoneX; + }; + }; +}; diff --git a/addons/explosives/XEH_postInit.sqf b/addons/explosives/XEH_postInit.sqf index 2ede878a37..e3b40308c3 100644 --- a/addons/explosives/XEH_postInit.sqf +++ b/addons/explosives/XEH_postInit.sqf @@ -18,6 +18,7 @@ if !(hasInterface) exitWith {}; GVAR(PlacedCount) = 0; GVAR(Setup) = objNull; GVAR(pfeh_running) = false; +GVAR(CurrentSpeedDial) = 0; [{(_this select 0) call FUNC(handleScrollWheel);}] call EFUNC(Common,addScrollWheelEventHandler); player addEventHandler ["Killed", { diff --git a/addons/explosives/XEH_preInit.sqf b/addons/explosives/XEH_preInit.sqf index 801ded6615..3747151d16 100644 --- a/addons/explosives/XEH_preInit.sqf +++ b/addons/explosives/XEH_preInit.sqf @@ -17,11 +17,15 @@ ADDON = false; +PREP(addCellphoneIED); PREP(addClacker); +PREP(addToSpeedDial); PREP(canDefuse); PREP(canDetonate); PREP(defuseExplosive); PREP(detonateExplosive); +PREP(dialPhone); +PREP(dialingPhone); PREP(handleScrollWheel); @@ -30,6 +34,7 @@ PREP(hasPlacedExplosives); PREP(getDetonators); PREP(getPlacedExplosives); +PREP(getSpeedDialExplosive); PREP(openDetonateUI); PREP(openPlaceUI); @@ -41,10 +46,12 @@ PREP(place_Approve); PREP(place_Cancel); PREP(placeExplosive); +PREP(removeFromSpeedDial); PREP(selectTrigger); PREP(setupExplosive); PREP(setPosition); +PREP(setSpeedDial); PREP(startDefuse); PREP(startTimer); PREP(triggerType); diff --git a/addons/explosives/config.cpp b/addons/explosives/config.cpp index e4a079f107..da95d45e7e 100644 --- a/addons/explosives/config.cpp +++ b/addons/explosives/config.cpp @@ -3,7 +3,7 @@ class CfgPatches { class ADDON { units[] = {}; - weapons[] = {"ACE_Clacker", "ACE_DefusalKit", "ACE_M26_Clacker", "ACE_DeadManSwitch"}; + weapons[] = {"ACE_Clacker", "ACE_DefusalKit", "ACE_M26_Clacker", "ACE_DeadManSwitch", "ACE_Cellphone"}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common", "ace_interaction"}; author[] = {"Garth 'L-H' de Wet"}; diff --git a/addons/explosives/functions/fnc_addCellphoneIED.sqf b/addons/explosives/functions/fnc_addCellphoneIED.sqf new file mode 100644 index 0000000000..84cb57cf4e --- /dev/null +++ b/addons/explosives/functions/fnc_addCellphoneIED.sqf @@ -0,0 +1,51 @@ +/* + * Author: Garth 'L-H' de Wet + * Adds an IED to the cellphone list + * + * Arguments: + * 0: Unit + * 1: Explosive + * 2: Magazine classname + * 3: Extra variables + * + * Return Value: + * None + * + * Example: + * Handled by PlaceExplosive. + * + * Public: No + */ +#include "script_component.hpp" +EXPLODE_4_PVT(_this,_unit,_explosive,_magazineClass,_extra); +// Config is the last item in the list of passed in items. +_config = (_this select 3) select (count (_this select 3) - 1); + +_requiredItems = getArray(_config >> "requires"); +_hasRequired = true; +_detonators = [_unit] call FUNC(getDetonators); +{ + if !(_x in _detonators) exitWith{ + _hasRequired = false; + }; +} count _requiredItems; +private ["_code", "_count", "_codeSet"]; +_codeSet = false; +while {!_codeSet} do { + _code = str(round (random 9999)); + _count = 4 - count (toArray _code); + while {_count > 0} do { + _code = "0" + _code; + _count = _count - 1; + }; + _codeSet = (count ([_code] call FUNC(getSpeedDialExplosive))) == 0; +}; +if (isNil QGVAR(CellphoneIEDs)) then { + GVAR(CellphoneIEDs) = []; +}; +_count = GVAR(CellphoneIEDs) pushBack [_explosive,_code,GetNumber(ConfigFile >> "CfgMagazines" >> _magazineClass >> "ACE_Triggers" >> "Cellphone" >> "FuseTime")]; +_count = _count + 1; +publicVariable QGVAR(CellphoneIEDs); +_unit sideChat format ["IED %1 code: %2", _count,_code]; +if !(_hasRequired) exitWith {}; +[format ["IED %1", _count],_code] call FUNC(addToSpeedDial); diff --git a/addons/explosives/functions/fnc_addToSpeedDial.sqf b/addons/explosives/functions/fnc_addToSpeedDial.sqf new file mode 100644 index 0000000000..142996e4c3 --- /dev/null +++ b/addons/explosives/functions/fnc_addToSpeedDial.sqf @@ -0,0 +1,37 @@ +/* + * Author: Garth 'L-H' de Wet + * Sets the speed dial for the UI. + * + * Arguments: + * 0: Name of speed dial + * 1: Code to add to speed dial + * + * Return Value: + * None + * + * Example: + * ["My Speed Dial","2131"] call ACE_explosives_fnc_addToSpeedDial; + * + * Public: Yes + */ +#include "script_component.hpp" +private ["_speedDial", "_found"]; +_speedDial = ace_player getVariable [QGVAR(SpeedDial), []]; +_found = false; + +EXPLODE_2_PVT(_this,_name,_code); + +if ((_code) == "") ExitWith { + [_name] call FUNC(removeFromSpeedDial); +}; +{ + if ((_x select 0) == _name) exitWith { + _speedDial set [_foreachindex, _this]; + _found = true; + }; +} foreach _speedDial; +if (!_found) then { + _speedDial pushBack _this; +}; + +ace_player setVariable [QGVAR(SpeedDial), _speedDial]; diff --git a/addons/explosives/functions/fnc_dialPhone.sqf b/addons/explosives/functions/fnc_dialPhone.sqf new file mode 100644 index 0000000000..41b2a4a4f7 --- /dev/null +++ b/addons/explosives/functions/fnc_dialPhone.sqf @@ -0,0 +1,42 @@ +/* + * Author: Garth 'L-H' de Wet + * Dials the number passed and detonates the explosive. + * + * Arguments: + * 0: Unit to do dialing + * 1: Code to dial + * + * Return Value: + * None + * + * Example: + * [ace_player,"2131"] call ACE_explosives_fnc_dialPhone; + * + * Public: Yes + */ +#include "script_component.hpp" +private ["_arr", "_ran", "_i","_speedDial"]; +EXPLODE_2_PVT(_this,_unit,_code); +if (_unit getVariable [QGVAR(Dialing),false]) exitWith {}; +if !(alive _unit) exitWith {}; +_unit setVariable [QGVAR(Dialing), true, true]; + +_ran = (ceil(random 8)) + 1; +_arr = []; +for [{_i=0}, {_i<_ran}, {_i=_i+1}] do { + _arr = _arr + ['.','..','...','']; +}; +if (_unit == ace_player) then { + ctrlSetText [1400,"Calling"]; + [FUNC(dialingPhone), 0.25, [_unit,4,_arr,_code]] call CALLSTACK(CBA_fnc_addPerFrameHandler); +} else { + private ["_explosive"]; + _explosive = [_code] call FUNC(getSpeedDialExplosive); + if ((count _explosive) > 0) then { + [{ + playSound3D [QUOTE(PATHTO_R(Data\Audio\Cellphone_Ring.wss)),objNull, false, getPosASL (_this select 1),3.16228,1,75]; + (_this select 0) setVariable [QGVAR(Dialing), false, true]; + }, [_unit,_explosive select 0], 0.25 * (count _arr - 4), 0] call EFUNC(common,waitAndExecute); + [_explosive select 0,(0.25 * (count _arr - 1)) + (_explosive select 2)] call FUNC(startTimer); + }; +}; diff --git a/addons/explosives/functions/fnc_dialingPhone.sqf b/addons/explosives/functions/fnc_dialingPhone.sqf new file mode 100644 index 0000000000..d3c429c9fc --- /dev/null +++ b/addons/explosives/functions/fnc_dialingPhone.sqf @@ -0,0 +1,44 @@ +/* + * Author: Garth 'L-H' de Wet + * Performs the dial tones and detonation of explosive. + * + * Arguments: + * 0: Unit to do dialing + * 1: Index + * 2: Dialing points + * 3: IED code + * + * Return Value: + * None + * + * Example: + * [FUNC(dialingPhone), 0.25, [_unit,4,_arr,_code]] call CALLSTACK(CBA_fnc_addPerFrameHandler); + * + * Public: No + */ +#include "script_component.hpp" +EXPLODE_4_PVT(_this select 0,_unit,_i,_arr,_code); +if ((_i mod 4) == 0) then { + playSound3D [QUOTE(PATHTO_R(Data\Audio\DialTone.wss)), objNull, false, (_unit ModelToWorld [0,0.2,2]), 15,1,2.5]; +}; +ctrlSetText [1400,format["Calling%1",_arr select (_i - 4)]]; + +private "_explosive"; +_explosive = [_code] call FUNC(getSpeedDialExplosive); + +if (_i >= (count _arr + 2)) then { + [_this select 1] call CALLSTACK(cba_fnc_removePerFrameHandler); + if ((count _explosive) > 0) then { + [_unit, -1, [_explosive select 0, _explosive select 2]] call FUNC(detonateExplosive); + }; + _unit setVariable [QGVAR(Dialing), false, true]; + if (_unit == ace_player) then { + ctrlSetText [1400,"Call Ended!"]; + }; +}; +if (_i == (count _arr)) then { + if ((count _explosive) > 0) then { + playSound3D [QUOTE(PATHTO_R(Data\Audio\Cellphone_Ring.wss)),objNull, false, getPosASL (_explosive select 0),3.16228,1,75]; + }; +}; +(_this select 0) set [1, _i + 1]; diff --git a/addons/explosives/functions/fnc_getSpeedDialExplosive.sqf b/addons/explosives/functions/fnc_getSpeedDialExplosive.sqf new file mode 100644 index 0000000000..d6d5b57b3b --- /dev/null +++ b/addons/explosives/functions/fnc_getSpeedDialExplosive.sqf @@ -0,0 +1,27 @@ +/* + * Author: Garth 'L-H' de Wet + * Gets the explosive from the speed dial entry. + * + * Arguments: + * 0: Speed dial entry + * + * Return Value: + * Associated explosive (or ObjNull) + * + * Example: + * ["2113"] call ace_explosives_fnc_getSpeedDialExplosive; + * + * Public: Yes + */ +#include "script_component.hpp" +EXPLODE_1_PVT(_this,_code); +private ["_explosive"]; +if (isNil QGVAR(CellphoneIEDs)) exitWith {[]}; +_explosive = []; +{ + if ((_x select 1) == _code) exitWith { + _explosive = _x; + }; + false +} count GVAR(CellphoneIEDs); +_explosive diff --git a/addons/explosives/functions/fnc_openPlaceUI.sqf b/addons/explosives/functions/fnc_openPlaceUI.sqf index 1bb78248d2..6eb2d478bf 100644 --- a/addons/explosives/functions/fnc_openPlaceUI.sqf +++ b/addons/explosives/functions/fnc_openPlaceUI.sqf @@ -51,8 +51,5 @@ _actions = [localize "STR_ACE_Explosives_PlaceMenu", localize "STR_ACE_Explosive }, { call EFUNC(interaction,hideMenu); - if !(profileNamespace getVariable [EGVAR(interaction,AutoCloseMenu), false]) then { - "ACE_Explosives" call EFUNC(interaction,openMenuSelf); - }; } ] call EFUNC(interaction,openSelectMenu); diff --git a/addons/explosives/functions/fnc_openTransmitterUI.sqf b/addons/explosives/functions/fnc_openTransmitterUI.sqf index b87673c214..f90636474e 100644 --- a/addons/explosives/functions/fnc_openTransmitterUI.sqf +++ b/addons/explosives/functions/fnc_openTransmitterUI.sqf @@ -43,9 +43,6 @@ if (count _detonators == 0) then { }, { call EFUNC(interaction,hideMenu); - if !(profileNamespace getVariable [QUOTE(EGVAR(interaction,AutoCloseMenu)), false]) then { - "ACE_Explosives" call EFUNC(interaction,openMenuSelf); - }; } ] call EFUNC(interaction,openSelectMenu); }; diff --git a/addons/explosives/functions/fnc_place_Approve.sqf b/addons/explosives/functions/fnc_place_Approve.sqf index 97528cb8f6..77cfbb92a1 100644 --- a/addons/explosives/functions/fnc_place_Approve.sqf +++ b/addons/explosives/functions/fnc_place_Approve.sqf @@ -28,79 +28,78 @@ _player = ACE_player; [_player, "DefaultAction", _player getVariable [QGVAR(Place), -1]] call EFUNC(Common,removeActionEventHandler); [_player, "MenuBack", _player getVariable [QGVAR(Cancel), -1]] call EFUNC(Common,removeActionEventHandler); call EFUNC(interaction,hideMouseHint); -if ((_setup getVariable [QGVAR(Class), ""]) != "") then { - _dir = (getDir _setup); - if (_dir > 180) then { - _dir = _dir - 180; - } else { - _dir = 180 + _dir; - }; - _setup setVariable [QGVAR(Direction), _dir]; - _player setVariable [QGVAR(PlantingExplosive), true]; - _setup addEventHandler ["EpeContactStart", { - if (!((_this select 0) getVariable [QGVAR(Handled), false])) then { - private ["_player", "_pos", "_attachTo"]; +if ((_setup getVariable [QGVAR(Class), ""]) == "") exitWith { + deleteVehicle _setup; +}; +_dir = (getDir _setup); +if (_dir > 180) then { + _dir = _dir - 180; +} else { + _dir = 180 + _dir; +}; +_setup setVariable [QGVAR(Direction), _dir]; +_player setVariable [QGVAR(PlantingExplosive), true]; +_setup addEventHandler ["EpeContactStart", { + if (!((_this select 0) getVariable [QGVAR(Handled), false])) then { + private ["_player", "_pos", "_attachTo"]; + _player = ACE_player; + _player setVariable [QGVAR(PlantingExplosive), false]; + _pos = getPosATL (_this select 0); + (_this select 0) enableSimulationGlobal false; + if (surfaceIsWater _pos) then { + _pos = getPosASL (_this select 0); + (_this select 0) setPosASL _pos; + }else{ + (_this select 0) setPosATL _pos; + }; + (_this select 0) setVariable [QGVAR(Handled), true]; + _attachTo = objNull; + if (!isNull (_this select 1) && {(_this select 1) isKindOf "AllVehicles"}) then { + _attachTo = (_this select 1); + }; + [(_this select 0),_attachTo, _pos] spawn { // TODO: Change to scheduled delay execution + private ["_mag", "_setup", "_dir", "_player"]; + _setup = _this select 0; _player = ACE_player; - _pos = getPosATL (_this select 0); - (_this select 0) enableSimulationGlobal false; - if (surfaceIsWater _pos) then { - _pos = getPosASL (_this select 0); - (_this select 0) setPosASL _pos; - }else{ - (_this select 0) setPosATL _pos; - }; - (_this select 0) setVariable [QGVAR(Handled), true]; - _player setVariable [QGVAR(PlantingExplosive), false]; - _attachTo = objNull; - if (!isNull (_this select 1) && {(_this select 1) isKindOf "AllVehicles"}) then { - _attachTo = (_this select 1); - }; - [(_this select 0),_attachTo, _pos] spawn { // TODO: Change to scheduled delay execution - private ["_mag", "_setup", "_dir", "_player"]; - _setup = _this select 0; - _player = ACE_player; - _mag = _setup getVariable [QGVAR(Class), ""]; - _dir = _setup getVariable [QGVAR(Direction), 0]; + _mag = _setup getVariable [QGVAR(Class), ""]; + _dir = _setup getVariable [QGVAR(Direction), 0]; - sleep getNumber(ConfigFile >> "CfgMagazines" >> _mag >> "ACE_DelayTime"); - _explosive = [_player, _this select 2, _dir, _mag, _setup getVariable QGVAR(Trigger), - [_setup getVariable QGVAR(Timer)], isNull (_this select 1)] call FUNC(placeExplosive); - deleteVehicle _setup; - if (!isNull(_explosive)) then { - _player RemoveMagazine _mag; - if (!isNull (_this select 1)) then { - _explosive attachTo [(_this select 1)]; - _dir = _dir - (getDir (_this select 1)); - [[_explosive, _dir, 0], QFUNC(setPosition)] call EFUNC(common,execRemoteFnc); - }; + sleep getNumber(ConfigFile >> "CfgMagazines" >> _mag >> "ACE_DelayTime"); + _explosive = [_player, _this select 2, _dir, _mag, _setup getVariable QGVAR(Trigger), + [_setup getVariable QGVAR(Timer)], isNull (_this select 1)] call FUNC(placeExplosive); + deleteVehicle _setup; + if (!isNull(_explosive)) then { + _player RemoveMagazine _mag; + if (!isNull (_this select 1)) then { + _explosive attachTo [(_this select 1)]; + _dir = _dir - (getDir (_this select 1)); + [[_explosive, _dir, 0], QFUNC(setPosition)] call EFUNC(common,execRemoteFnc); }; }; }; - }]; - _setup enableSimulationGlobal true; - _player playActionNow "MedicOther"; - [_setup] spawn { // TODO: Change to scheduled delay execution - private ["_setup", "_player"]; - _setup = _this select 0; - _player = ACE_player; - sleep 5; + }; +}]; +_setup enableSimulationGlobal true; +_player playActionNow "MedicOther"; +[_setup] spawn { // TODO: Change to scheduled delay execution + private ["_setup", "_player"]; + _setup = _this select 0; + _player = ACE_player; + sleep 5; + _player setVariable [QGVAR(PlantingExplosive), false]; + if (!isNull _setup) then { + private ["_mag", "_dir", "_delayTime"]; + _mag = _setup getVariable [QGVAR(Class), ""]; + _dir = _setup getVariable [QGVAR(Direction), 0]; + _delayTime = (getNumber(ConfigFile >> "CfgMagazines" >> _mag >> "ACE_DelayTime")) - 5; + if (_delayTime > 0) then { + sleep _delayTime; + }; if (!isNull _setup) then { - private ["_mag", "_dir", "_delayTime"]; - _mag = _setup getVariable [QGVAR(Class), ""]; - _dir = _setup getVariable [QGVAR(Direction), 0]; - _delayTime = (getNumber(ConfigFile >> "CfgMagazines" >> _mag >> "ACE_DelayTime")) - 5; - if (_delayTime > 0) then { - sleep _delayTime; - }; - if (!isNull _setup) then { - [_player, GetPosATL _setup, _dir, _mag, _setup getVariable QGVAR(Trigger), - [_setup getVariable QGVAR(Timer)], true] call FUNC(placeExplosive); - deleteVehicle _setup; - _player RemoveMagazine _mag; - _player setVariable [QGVAR(PlantingExplosive), false]; - }; + [_player, GetPosATL _setup, _dir, _mag, _setup getVariable QGVAR(Trigger), + [_setup getVariable QGVAR(Timer)], true] call FUNC(placeExplosive); + deleteVehicle _setup; + _player RemoveMagazine _mag; }; }; -}else{ - deleteVehicle _setup; }; diff --git a/addons/explosives/functions/fnc_removeFromSpeedDial.sqf b/addons/explosives/functions/fnc_removeFromSpeedDial.sqf new file mode 100644 index 0000000000..c0a467e6f1 --- /dev/null +++ b/addons/explosives/functions/fnc_removeFromSpeedDial.sqf @@ -0,0 +1,26 @@ +/* + * Author: Garth 'L-H' de Wet + * Removes the specified speed dial from unit's speed dial. + * + * Arguments: + * 0: Speed dial name + * + * Return Value: + * None + * + * Example: + * ["IED 1"] call ACE_explosives_fnc_removeFromSpeedDial; + * + * Public: Yes + */ +#include "script_component.hpp" +private "_speedDial"; +_speedDial = ace_player getVariable [QGVAR(SpeedDial), []]; +if (count _speedDial == 0) exitWith {}; +{ + if ((_x select 0) == (_this select 0)) exitWith { + _speedDial set [_foreachIndex, "x"]; + _speedDial = _speedDial - ["x"]; + ace_player setVariable [QGVAR(SpeedDial),_speedDial]; + }; +} foreach _speedDial; diff --git a/addons/explosives/functions/fnc_setSpeedDial.sqf b/addons/explosives/functions/fnc_setSpeedDial.sqf new file mode 100644 index 0000000000..adb2e6af03 --- /dev/null +++ b/addons/explosives/functions/fnc_setSpeedDial.sqf @@ -0,0 +1,26 @@ +/* + * Author: Garth 'L-H' de Wet + * Sets the speed dial for the UI. + * + * Arguments: + * 0: Whether to increase or decrease speed dial index + * + * Return Value: + * None + * + * Example: + * [true] call ACE_explosives_fnc_setSpeedDial; // increase + * [false] call ACE_explosives_fnc_setSpeedDial; // decrease + * + * Public: No + */ + #include "script_component.hpp" +private ["_speedDial", "_amount"]; +_speedDial = ace_player getVariable [QGVAR(SpeedDial), []]; +if (count _speedDial == 0) exitWith {}; +_amount = if((_this select 0))then{1}else{-1}; + +GVAR(CurrentSpeedDial) = (GVAR(CurrentSpeedDial) + _amount + count _speedDial) mod (count _speedDial); + +ctrlSetText [1400,(_speedDial select GVAR(CurrentSpeedDial)) select 1]; +ctrlSetText [1401,(_speedDial select GVAR(CurrentSpeedDial)) select 0]; diff --git a/addons/fcs/CfgVehicles.hpp b/addons/fcs/CfgVehicles.hpp index 4cc010f917..8861e43a43 100644 --- a/addons/fcs/CfgVehicles.hpp +++ b/addons/fcs/CfgVehicles.hpp @@ -492,13 +492,13 @@ class CfgVehicles { };*/ }; - class I_Heli_light_03_base_F: Helicopter_Base_F { + class Heli_light_03_base_F; + class I_Heli_light_03_base_F: Heli_light_03_base_F { /*class Turrets: Turrets { class MainTurret: MainTurret {}; };*/ }; - - class I_Heli_light_03_F: I_Heli_light_03_base_F { + class I_Heli_light_03_F: Heli_light_03_base_F { /*class Turrets: Turrets { class MainTurret: MainTurret {}; };*/ diff --git a/addons/fcs/functions/fnc_firedEH.sqf b/addons/fcs/functions/fnc_firedEH.sqf index f17693d33e..4c553883e2 100644 --- a/addons/fcs/functions/fnc_firedEH.sqf +++ b/addons/fcs/functions/fnc_firedEH.sqf @@ -30,7 +30,7 @@ if !([_gunner] call EFUNC(common,isPlayer)) exitWith {}; private ["_FCSMagazines", "_FCSElevation", "_offset"]; -_FCSMagazines = _vehicle getVariable format ["%1_%2", QGVAR(Magazines), _turret]; +_FCSMagazines = _vehicle getVariable [(format ["%1_%2", QGVAR(Magazines), _turret]), []]; _FCSElevation = _vehicle getVariable format ["%1_%2", QGVAR(Elevation), _turret]; if !(_magazine in _FCSMagazines) exitWith {}; diff --git a/addons/gui/CfgEventHandlers.hpp b/addons/gui/CfgEventHandlers.hpp deleted file mode 100644 index c9142e676b..0000000000 --- a/addons/gui/CfgEventHandlers.hpp +++ /dev/null @@ -1,11 +0,0 @@ -class Extended_PreInit_EventHandlers { - class ADDON { - init = QUOTE( call compile preprocessFileLineNumbers QUOTE(QUOTE(PATHTOF(XEH_preInit.sqf))) ); - }; -}; - -class Extended_PostInit_EventHandlers { - class ADDON { - init = QUOTE( call compile preprocessFileLineNumbers QUOTE(QUOTE(PATHTOF(XEH_postInit.sqf))) ); - }; -}; \ No newline at end of file diff --git a/addons/gui/GUI.hpp b/addons/gui/GUI.hpp deleted file mode 100644 index 71e8dc0090..0000000000 --- a/addons/gui/GUI.hpp +++ /dev/null @@ -1,2 +0,0 @@ -#include "UI\define.hpp" -#include "UI\RscTitles.hpp" diff --git a/addons/gui/README.md b/addons/gui/README.md deleted file mode 100644 index a6fe74f6c2..0000000000 --- a/addons/gui/README.md +++ /dev/null @@ -1,11 +0,0 @@ -ace_gui -======= - -to be scrapped. - - -## Maintainers - -The people responsible for merging changes to this component or answering potential questions. - -- [Glowbal](https://github.com/Glowbal) diff --git a/addons/gui/UI/RscTitles.hpp b/addons/gui/UI/RscTitles.hpp deleted file mode 100644 index 02e68e8d32..0000000000 --- a/addons/gui/UI/RscTitles.hpp +++ /dev/null @@ -1,179 +0,0 @@ - -#define RIGHT_SIDE (safezoneW + safezoneX) -#define LEFT_SIDE safezoneX -#define TOP_SIDE safeZoneY -#define BOTTOM_SIDE (safeZoneH + safezoneY) - -#define ICON_WIDTH (1.75 * (((safezoneW / safezoneH) min 1.2) / 40)) -#define X_POS_ICONS RIGHT_SIDE - (1.1 * ICON_WIDTH) -#define Y_POS_ICONS TOP_SIDE + (2.2 * ICON_WIDTH) -#define DIFFERENCE_ICONS (1.1 * ICON_WIDTH) - -class RscTitles { - class GVAR(iconsDisplay) { - duration = 1e+011; - idd = 1111; - movingenable = 0; - onLoad = QUOTE(uiNamespace setVariable [ARR_2(QUOTE(QGVAR(iconsDisplay)), _this select 0)]); - class controlsBackground { - class icon_1: ACE_gui_backgroundBase { - text = ""; - colorText[] = {0.0,1.0,0.0,0.4}; - idc = 10501; - x = X_POS_ICONS; - y = Y_POS_ICONS + (0 * DIFFERENCE_ICONS); - w = ICON_WIDTH; - h = ICON_WIDTH; - }; - class icon_2: icon_1 { - idc = 10502; - y = Y_POS_ICONS + (1 * DIFFERENCE_ICONS); - }; - class icon_3: icon_1 { - idc = 10503; - y = Y_POS_ICONS + (2 * DIFFERENCE_ICONS); - }; - class icon_4: icon_1 { - idc = 10504; - y = Y_POS_ICONS + (3 * DIFFERENCE_ICONS); - }; - class icon_5: icon_1 { - idc = 10505; - y = Y_POS_ICONS + (4 * DIFFERENCE_ICONS); - }; - class icon_6: icon_1 { - idc = 10506; - y = Y_POS_ICONS + (5 * DIFFERENCE_ICONS); - }; - }; - }; - - class GVAR(RSC_PROGRESSBAR_LOADING) { - idd = -1; - onLoad = QUOTE(uiNamespace setVariable [ARR_2(QUOTE(QGVAR(RSC_PROGRESSBAR_LOADING)), _this select 0)]); - fadein = 0; - fadeout = 0; - duration = 10e10; - class Controls { - class background: ACE_gui_backgroundBase { - idc = -1; - colorBackground[] = {0,0,0,1}; - colorText[] = {1, 1, 1, 1}; - x = "1 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; - y = "29 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; - w = "38 * (((safezoneW / safezoneH) min 1.2) / 40)"; - h = "0.4 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - text = "#(argb,8,8,3)color(0,0,0,0.4)"; - }; - - class Progress: ACE_gui_RscProgress { - idc = 6; - x = "1 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; - y = "29 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; - w = "38 * (((safezoneW / safezoneH) min 1.2) / 40)"; - h = "0.4 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - colorFrame[] = {0,0,0,0}; - colorBar[] = {0.27,0.5,0.31,0.6}; - texture = "#(argb,8,8,3)color(1,1,1,0.7)"; - }; - }; - }; - - - class GVAR(RSC_DISPLAY_MESSAGE) { - duration = 7; - idd = 86411; - movingenable = 0; - onLoad = QUOTE(uiNamespace setVariable [ARR_2(QUOTE(QGVAR(RSC_DISPLAY_MESSAGE)), _this select 0)]); - fadein = 0; - class controlsBackground { - class header: ACE_gui_staticBase { - idc = 1; - type = CT_STATIC; - x = "safezoneX + (safezoneW / 10)"; - y = "safezoneY + (30 * (safeZoneH / 40))"; - w = "(safeZoneW / 10)"; - h = "(safeZoneH / 40)"; - style = ST_LEFT; - font = FontCSE; - SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; - colorText[] = {0.85, 0.85, 0.85, 1.0}; - colorBackground[] = {0, 0, 0, 0.9}; - text = ""; - }; - class text: header { - idc = 2; - y = "safezoneY + (31 * (safeZoneH / 40))"; - w = "(safeZoneW / 10) * 1.3"; - colorText[] = {0.0, 0.0, 0.0, 1.0}; - colorBackground[] = {1, 1, 1, 0.9}; - text = ""; - }; - }; - }; - - class GVAR(RSC_DISPLAY_INFORMATION) { - duration = 15; - idd = 86412; - movingenable = 0; - onLoad = QUOTE(uiNamespace setVariable [ARR_2(QUOTE(QGVAR(RSC_DISPLAY_INFORMATION)), _this select 0)]); - fadein = 0; - class controlsBackground { - class header: ACE_gui_staticBase { - idc = 1; - type = CT_STATIC; - x = "safezoneX + (safezoneW / 10)"; - y = "safezoneY + (6 * (safeZoneH / 40))"; - w = "(safeZoneW / 10)"; - h = "(safeZoneH / 40)"; - style = ST_LEFT; - font = FontCSE; - SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; - colorText[] = {0.85, 0.85, 0.85, 1.0}; - colorBackground[] = {0, 0, 0, 0.9}; - text = ""; - }; - class text: header { - idc = 2; - y = "safezoneY + (7.1 * (safeZoneH / 40))"; - w = "(safeZoneW / 10) * 1.3"; - colorText[] = {0.0, 0.0, 0.0, 1.0}; - colorBackground[] = {1, 1, 1, 0.9}; - text = ""; - }; - class text2: text { - idc = 3; - y = "safezoneY + (8.2 * (safeZoneH / 40))"; - }; - class text3: text { - idc = 4; - y = "safezoneY + (9.3 * (safeZoneH / 40))"; - }; - class text4: text { - idc = 5; - y = "safezoneY + (10.4 * (safeZoneH / 40))"; - }; - class text5: text { - idc = 6; - y = "safezoneY + (11.5 * (safeZoneH / 40))"; - }; - - - class icon: ACE_gui_backgroundBase { - type = CT_STATIC; - idc = 10; - style = ST_PICTURE; - colorBackground[] = {0,0,0,1}; - colorText[] = {1, 1, 1, 1}; - font = FontCSE; - text = ""; - sizeEx = 0.032; - x = "safezoneX + (safezoneW / 10)"; - y = "safezoneY + (4 * (safeZoneH / 40))"; - w = "(safeZoneH / 40)*2"; - h = "(safeZoneH / 40)*2"; - }; - }; - }; - -}; \ No newline at end of file diff --git a/addons/gui/XEH_postInit.sqf b/addons/gui/XEH_postInit.sqf deleted file mode 100644 index 4172145202..0000000000 --- a/addons/gui/XEH_postInit.sqf +++ /dev/null @@ -1,11 +0,0 @@ -/** - * XEH_postInit.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - -#include "script_component.hpp" diff --git a/addons/gui/XEH_preInit.sqf b/addons/gui/XEH_preInit.sqf deleted file mode 100644 index b5cc064d18..0000000000 --- a/addons/gui/XEH_preInit.sqf +++ /dev/null @@ -1,25 +0,0 @@ -/** - * XEH_preInit.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - -#include "script_component.hpp" - -ADDON = false; - -PREP(loadingBar); -PREP(displayInformation); -PREP(displayMessage); -PREP(blurScreen); -PREP(displayIcon); -PREP(sendHintTo); -PREP(sendMessageTo); -PREP(sendDisplayInformationTo); -PREP(sendDisplayMessageTo); - -ADDON = true; diff --git a/addons/gui/config.cpp b/addons/gui/config.cpp deleted file mode 100644 index 2f7666be13..0000000000 --- a/addons/gui/config.cpp +++ /dev/null @@ -1,27 +0,0 @@ - -#include "script_component.hpp" - -class CfgPatches { - class ADDON { - units[] = {}; - weapons[] = {}; - requiredVersion = REQUIRED_VERSION; - requiredAddons[] = {"ACE_main"}; - version = VERSION; - author[] = {$STR_ACE_Common_ACETeam}; - authorUrl = "http://csemod.com"; // TODO website link? - }; -}; -class CfgAddons { - class PreloadAddons { - class ADDON { - list[] = {QUOTE(ADDON)}; - }; - }; -}; - -#include "CfgEventHandlers.hpp" - -// TODO Port over the UI defines -#include "GUI.hpp" -#include "empty.hpp" diff --git a/addons/gui/data/buttonDisabled.paa b/addons/gui/data/buttonDisabled.paa deleted file mode 100644 index 2c2a10856b..0000000000 Binary files a/addons/gui/data/buttonDisabled.paa and /dev/null differ diff --git a/addons/gui/data/buttonDisabled_gradient.paa b/addons/gui/data/buttonDisabled_gradient.paa deleted file mode 100644 index 43b1b8d100..0000000000 Binary files a/addons/gui/data/buttonDisabled_gradient.paa and /dev/null differ diff --git a/addons/gui/data/buttonNormal.paa b/addons/gui/data/buttonNormal.paa deleted file mode 100644 index 84936d8356..0000000000 Binary files a/addons/gui/data/buttonNormal.paa and /dev/null differ diff --git a/addons/gui/data/buttonNormal_gradient.paa b/addons/gui/data/buttonNormal_gradient.paa deleted file mode 100644 index 2210f98741..0000000000 Binary files a/addons/gui/data/buttonNormal_gradient.paa and /dev/null differ diff --git a/addons/gui/data/buttonNormal_gradient2.paa b/addons/gui/data/buttonNormal_gradient2.paa deleted file mode 100644 index cabe6c7fed..0000000000 Binary files a/addons/gui/data/buttonNormal_gradient2.paa and /dev/null differ diff --git a/addons/gui/data/buttonNormal_gradient3.paa b/addons/gui/data/buttonNormal_gradient3.paa deleted file mode 100644 index 7da9fbcf8a..0000000000 Binary files a/addons/gui/data/buttonNormal_gradient3.paa and /dev/null differ diff --git a/addons/gui/data/buttonNormal_gradient_top.paa b/addons/gui/data/buttonNormal_gradient_top.paa deleted file mode 100644 index 904e1a62f7..0000000000 Binary files a/addons/gui/data/buttonNormal_gradient_top.paa and /dev/null differ diff --git a/addons/gui/data/buttonNormal_gradient_top_w.paa b/addons/gui/data/buttonNormal_gradient_top_w.paa deleted file mode 100644 index 23dd190afc..0000000000 Binary files a/addons/gui/data/buttonNormal_gradient_top_w.paa and /dev/null differ diff --git a/addons/gui/empty.hpp b/addons/gui/empty.hpp deleted file mode 100644 index 698784e2c6..0000000000 --- a/addons/gui/empty.hpp +++ /dev/null @@ -1,21 +0,0 @@ -#include "\z\ace\addons\gui\UI\define.hpp" - -class ACE_common_empty_screen { - idd = 679123; - onLoad = "uiNamespace setVariable [""ACE_common_empty_screen"", _this select 0]"; - onUnload = "if (missionNamespace getvariable [""ACE_common_DISABLE_USER_INPUT_SCREEN"", false)]) then { createDialog ""ACE_common_empty_screen""; }"; - class controlsBackground { - class background : ACE_gui_backgroundBase { - idc = 1; - x = safezoneX; - y = safezoneY; - w = safezoneW; - h = safezoneH; - text = ""; - moving = 0; - }; - }; - - class controls { - }; -}; diff --git a/addons/gui/functions/fnc_displayIcon.sqf b/addons/gui/functions/fnc_displayIcon.sqf deleted file mode 100644 index 98895c6346..0000000000 --- a/addons/gui/functions/fnc_displayIcon.sqf +++ /dev/null @@ -1,79 +0,0 @@ -/** - * fn_gui_displayIcon.sqf - * @Descr: - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: true - * - * @Example ["myID", true, QUOTE(PATHTOF(data\icon_group.paa)), [1,1,1,1]] call ace_gui_fnc_displayIcon; - */ - -#include "script_component.hpp" - -#define MAX_N_ICONS 6 - -private ["_iconId", "_show", "_icon", "_spot", "_idc", "_display","_next_IDC", "_nextText"]; -_iconId = _this select 0; -_show = _this select 1; -_icon = _this select 2; -_color = _this select 3; - -disableSerialization; -_list = missionNamespace getvariable [QGVAR(displayIconList),[]]; -_display = uiNamespace getvariable QGVAR(iconsDisplay); - -if (isNil "_display") then { - // Display the icons - 11401 cutRsc [QGVAR(iconsDisplay),"PLAIN"]; - _display = uiNamespace getvariable QGVAR(iconsDisplay); -}; - -if (_show) then { - if ({(_x select 0 == _iconId)} count _list == 0) then { - _list pushback [_iconId, _icon, _color]; - } else { - { - if (_x select 0 == _iconId) exitwith { - _list set [_foreachIndex, [_iconId, _icon, _color]]; - }; - }foreach _list; - }; - - missionNamespace setvariable [QGVAR(displayIconList), _list]; - - { - if (_x select 0 == _iconId) exitwith { - _idc = 10501 + _foreachIndex; - _ctrl = _display displayCtrl _idc; - _ctrl ctrlsetText _icon; - _ctrl ctrlSetTextColor _color; - }; - }foreach _list; -} else { - if ({(_x select 0 == _iconId)} count _list == 1) then { - _newList = []; - { - if (_x select 0 != _iconId) then { - _newList pushback _x; - }; - }foreach _list; - - missionNamespace setvariable [QGVAR(displayIconList), _newList]; - - for "_i" from 0 to (MAX_N_ICONS - 1) /* step +1 */ do { - _idc = 10501 + _i; - _ctrl = _display displayCtrl _idc; - _ctrl ctrlsetText ""; - _ctrl ctrlSetTextColor [1,1,1,1]; - }; - - { - _idc = 10501 + _foreachIndex; - _ctrl = _display displayCtrl _idc; - _ctrl ctrlsetText (_x select 1); - _ctrl ctrlSetTextColor (_x select 2); - }foreach _newList; - }; -}; diff --git a/addons/gui/functions/fnc_displayInformation.sqf b/addons/gui/functions/fnc_displayInformation.sqf deleted file mode 100644 index c4eb96984b..0000000000 --- a/addons/gui/functions/fnc_displayInformation.sqf +++ /dev/null @@ -1,67 +0,0 @@ -/** - * fn_gui_displayInformation.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - -#include "script_component.hpp" - -#define DISPLAY_LAYER 32547 - -private["_title", "_content","_type","_display","_headerCtrl","_contentCtrl","_contentAmountOfChars","_pos","_icon","_iconCtrl"]; -_title = [_this, 0, "",[""]] call BIS_fnc_Param; -_content = [_this, 1, [""],[[""]]] call BIS_fnc_Param; -_type = [_this, 2, 0, [0]] call BIS_fnc_Param; -_icon = [_this, 3, "",[""]] call BIS_fnc_Param; - -if (_title != "") then { - DISPLAY_LAYER cutRsc [QGVAR(RSC_DISPLAY_INFORMATION),"PLAIN"]; - - disableSerialization; - _display = uiNamespace getvariable QGVAR(RSC_DISPLAY_INFORMATION); - if (!isnil "_display") then { - _headerCtrl = _display displayCtrl 1; - _headerCtrl ctrlSetText _title; - _iconCtrl = _display displayCtrl 10; - _iconCtrl ctrlSetText _icon; - - _idc = 2; - { - _text = _x; - if (_text != "") then { - _contentCtrl = _display displayCtrl _idc; - _contentCtrl ctrlSetText _text; - - _contentAmountOfChars = count (toArray _text); - _pos = ctrlPosition _contentCtrl; - _pos set [2, _contentAmountOfChars * ((((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)/ 3.3) max (safeZoneW / 11)]; - _contentCtrl ctrlSetPosition _pos; - _contentCtrl ctrlCommit 0; - - - if (_type >0) then { - if (_type == 1) then { - _contentCtrl ctrlSetBackgroundColor [0.7,0.2,0.2,0.8]; - _contentCtrl ctrlSetTextColor [1,1,1,0.9]; - }; - }; - _idc = _idc + 1; - }; - }foreach _content; - - while {(_idc < 7)} do { - _contentCtrl = _display displayCtrl _idc; - _contentCtrl ctrlSetPosition [0,0,0,0]; - _contentCtrl ctrlCommit 0; - - _idc = _idc + 1; - }; - }; -} else { - - DISPLAY_LAYER cutText ["","PLAIN"]; -}; \ No newline at end of file diff --git a/addons/gui/functions/fnc_displayMessage.sqf b/addons/gui/functions/fnc_displayMessage.sqf deleted file mode 100644 index 3dceab2638..0000000000 --- a/addons/gui/functions/fnc_displayMessage.sqf +++ /dev/null @@ -1,45 +0,0 @@ -/** - * fn_gui_displayMessage.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - -#include "script_component.hpp" - -#define DISPLAY_LAYER 546 - -private["_title", "_content","_type","_display","_headerCtrl","_contentCtrl","_contentAmountOfChars","_pos"]; -_title = [_this, 0, "",[""]] call BIS_fnc_Param; -_content = [_this, 1, "",[""]] call BIS_fnc_Param; -_type = [_this, 2, 0, [0]] call BIS_fnc_Param; - -if (_title != "" && _content != "") then { - DISPLAY_LAYER cutRsc [QGVAR(RSC_DISPLAY_MESSAGE),"PLAIN"]; - - disableSerialization; - _display = uiNamespace getvariable QGVAR(RSC_DISPLAY_MESSAGE); - if (!isnil "_display") then { - _headerCtrl = _display displayCtrl 1; - _contentCtrl = _display displayCtrl 2; - - _headerCtrl ctrlSetText _title; - _contentCtrl ctrlSetText _content; - - _contentAmountOfChars = count (toArray _content); - _pos = ctrlPosition _contentCtrl; - _pos set [2, _contentAmountOfChars * ((((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)/ 3.3) max (safeZoneW / 11)]; - _contentCtrl ctrlSetPosition _pos; - _contentCtrl ctrlCommit 0; - - if (_type >0) then { - if (_type == 1) then { - _contentCtrl ctrlSetBackgroundColor [0.7,0.2,0.2,0.8]; - _contentCtrl ctrlSetTextColor [1,1,1,0.9]; - }; - }; - }; -}; \ No newline at end of file diff --git a/addons/gui/functions/fnc_loadingbar.sqf b/addons/gui/functions/fnc_loadingbar.sqf deleted file mode 100644 index 4aba751235..0000000000 --- a/addons/gui/functions/fnc_loadingbar.sqf +++ /dev/null @@ -1,64 +0,0 @@ -/** - * fn_gui_loadingbar.sqf - * @Descr: Displays a loading bar and halts script until loading bar has finished - * @Author: Glowbal - * - * @Arguments: [timeToWait NUMBER, condition CODE (Optional), onSuccess CODE (Optional), onFailure CODE (Optional), arguments ARRAY (Optional)] - * @Return: BOOl Returns true if loading bar has fully finished. Otherwise false - * @PublicAPI: true - */ - -#include "script_component.hpp" - -private ["_timeToWait","_cond","_onfailure","_onSuccess","_args"]; -_timeToWait = _this select 0; -_cond = [_this, 1, {true}, [{true}]] call BIS_fnc_Param; -_onSuccess = [_this, 2, {}, [{}]] call BIS_fnc_Param; -_onfailure = [_this, 3, {}, [{}]] call BIS_fnc_Param; -_args = [_this, 4, [], [[]]] call BIS_fnc_Param; - - -if (_timeToWait > 0) exitwith { - GVAR(LOADING_BAR_STATUS) = 0; - disableSerialization; - 1534 cutRsc [QGVAR(RSC_PROGRESSBAR_LOADING),"plain"]; - [{ - private ["_args","_timeToWait","_start","_cond","_onSuccess","_onfailure","_params"]; - _args = _this select 0; - - _start = _args select 0; - _timeToWait = _args select 1; - _cond = _args select 2; - _onSuccess = _args select 3; - _onfailure = _args select 4; - _params = _args select 5; - - if !(_params call _cond) exitwith { - [(_this select 1)] call cba_fnc_removePerFrameHandler; - 1534 cutText ["","plain"]; - _params call _onfailure; - }; - - if (GVAR(LOADING_BAR_STATUS) >= 1) exitwith { - [(_this select 1)] call cba_fnc_removePerFrameHandler; - 1534 cutText ["","plain"]; - _params call _onSuccess; - }; - private "_dialog"; - disableSerialization; - _dialog = uiNamespace getvariable QGVAR(RSC_PROGRESSBAR_LOADING); - - GVAR(LOADING_BAR_STATUS) = (diag_tickTime - _start) / _timeToWait; - (_dialog displayCtrl 6) progressSetPosition GVAR(LOADING_BAR_STATUS); - - }, 0, [diag_tickTime, _timeToWait, _cond, _onSuccess, _onfailure, _args]] call CBA_fnc_addPerFrameHandler; - true; -}; - -if (_args call _cond) exitwith { - _args call _onSuccess; - true; -}; - -_args call _onfailure; -false; \ No newline at end of file diff --git a/addons/gui/functions/fnc_sendHintTo.sqf b/addons/gui/functions/fnc_sendHintTo.sqf deleted file mode 100644 index 0454cc5691..0000000000 --- a/addons/gui/functions/fnc_sendHintTo.sqf +++ /dev/null @@ -1,26 +0,0 @@ -/** - * fn_sendHintTo.sqf - * @Descr: Sends a hint to player unit across network - * @Author: Glowbal - * - * @Arguments: [reciever OBJECT, message STRING] - * @Return: void - * @PublicAPI: true - */ - -#include "script_component.hpp" - -private ["_reciever","_message"]; -_reciever = _this select 0; -_message = _this select 1; - -if (isPlayer _reciever) then { - if (!local _reciever) then { - [_this, QUOTE(FUNC(sendHintTo)), _reciever, false] call EFUNC(common,execRemoteFnc); - } else { - if (isLocalized _message) then { - _message = localize _message; - }; - hintsilent format ["%1",_message]; - }; -}; \ No newline at end of file diff --git a/addons/gui/functions/fnc_sendMessageTo.sqf b/addons/gui/functions/fnc_sendMessageTo.sqf deleted file mode 100644 index a4e0e4ccd5..0000000000 --- a/addons/gui/functions/fnc_sendMessageTo.sqf +++ /dev/null @@ -1,31 +0,0 @@ -/** - * fn_sendMessageTo.sqf - * @Descr: Sends a chat message to player unit across the network - * @Author: Glowbal - * - * @Arguments: [reciever OBJECT, message STRING] - * @Return: void - * @PublicAPI: true - */ - -#include "script_component.hpp" - -private ["_reciever","_message"]; -_reciever = _this select 0; -_message = _this select 1; - - -if (isPlayer _reciever) then { - if (!local _reciever) then { - [_this, QUOTE(FUNC(sendMessageTo)), _reciever, false] call EFUNC(common,execRemoteFnc); - } else { - if (isnil QGVAR(LOGIC_OBJECT)) exitwith { - // need to create an object instead - }; - - if (isLocalized _message) then { - _message = localize _message; - }; - GVAR(LOGIC_OBJECT) globalChat format ["%1",_message]; - }; -}; diff --git a/addons/gui/functions/script_component.hpp b/addons/gui/functions/script_component.hpp deleted file mode 100644 index e9276928ad..0000000000 --- a/addons/gui/functions/script_component.hpp +++ /dev/null @@ -1,12 +0,0 @@ -#define COMPONENT GUI -#include "\z\ace\addons\main\script_mod.hpp" - -#ifdef DEBUG_ENABLED_GUI - #define DEBUG_MODE_FULL -#endif - -#ifdef DEBUG_SETTINGS_GUI - #define DEBUG_SETTINGS DEBUG_SETTINGS_GUI -#endif - -#include "\z\ace\addons\main\script_macros.hpp" \ No newline at end of file diff --git a/addons/gui/script_component.hpp b/addons/gui/script_component.hpp deleted file mode 100644 index e9276928ad..0000000000 --- a/addons/gui/script_component.hpp +++ /dev/null @@ -1,12 +0,0 @@ -#define COMPONENT GUI -#include "\z\ace\addons\main\script_mod.hpp" - -#ifdef DEBUG_ENABLED_GUI - #define DEBUG_MODE_FULL -#endif - -#ifdef DEBUG_SETTINGS_GUI - #define DEBUG_SETTINGS DEBUG_SETTINGS_GUI -#endif - -#include "\z\ace\addons\main\script_macros.hpp" \ No newline at end of file diff --git a/addons/gui/stringtable.xml b/addons/gui/stringtable.xml deleted file mode 100644 index 6a7807c925..0000000000 --- a/addons/gui/stringtable.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/addons/interact_menu/CfgEventHandlers.hpp b/addons/interact_menu/CfgEventHandlers.hpp index ae9c93b32e..1301f022d3 100644 --- a/addons/interact_menu/CfgEventHandlers.hpp +++ b/addons/interact_menu/CfgEventHandlers.hpp @@ -13,7 +13,7 @@ class Extended_PostInit_EventHandlers { class Extended_InitPost_EventHandlers { class All { class GVAR(compileMenu) { - init = QUOTE(_this call FUNC(compileMenu)); + init = QUOTE(_this call FUNC(compileMenu);_this call FUNC(compileMenuSelfAction)); }; }; }; \ No newline at end of file diff --git a/addons/interact_menu/CursorMenus.hpp b/addons/interact_menu/CursorMenus.hpp new file mode 100644 index 0000000000..d13813b92e --- /dev/null +++ b/addons/interact_menu/CursorMenus.hpp @@ -0,0 +1,47 @@ +class GVAR(cursorMenu) { + idd = 91919; + movingEnable = false; + onLoad = QUOTE(uiNamespace setVariable [ARR_2(QUOTE(QGVAR(dlgCursorMenu)),_this select 0)]; uiNamespace setVariable [ARR_2(QUOTE(QGVAR(cursorMenuOpened)),true)]); + onUnload = QUOTE(uiNamespace setVariable [ARR_2(QUOTE(QGVAR(cursorMenuOpened)),false)]); + objects[] = {}; + /*class controlsBackground { + class Background { + idc = 91920; + moving = 0; + font = "TahomaB"; + text = ""; + sizeEx = 0; + lineSpacing = 0; + access = 0; + type = 0; + style = 0; + size = 1; + colorBackground[] = {0, 0, 0, 0.5}; + colorText[] = {0, 0, 0, 0}; + x = "safezoneX"; + y = "safezoneY"; + w = "safezoneW"; + h = "safezoneH"; + }; + };*/ + class controls { + class Canvas { + idc = 91921; + moving = 0; + font = "TahomaB"; + text = ""; + sizeEx = 0; + lineSpacing = 0; + access = 0; + type = 0; + style = 0; + size = 1; + colorBackground[] = {0, 0, 0, 0}; + colorText[] = {0, 0, 0, 0}; + x = "safezoneX"; + y = "safezoneY"; + w = "safezoneW"; + h = "safezoneH"; + }; + }; +}; diff --git a/addons/interact_menu/XEH_clientInit.sqf b/addons/interact_menu/XEH_clientInit.sqf index a02bf4d558..c068a15882 100644 --- a/addons/interact_menu/XEH_clientInit.sqf +++ b/addons/interact_menu/XEH_clientInit.sqf @@ -4,24 +4,32 @@ _fnc = { _this call FUNC(render); }; -// [_fnc, 0, []] call cba_fnc_addPerFrameHandler; addMissionEventHandler ["Draw3D", _fnc]; -_fnc = { - _this call FUNC(probe); -}; -[_fnc, 0.5, []] call cba_fnc_addPerFrameHandler; - ["ACE3", "Interact Key", {_this call FUNC(keyDown)}, -[15, [false, false, false]], +[219, [false, false, false]], false, "keydown"] call cba_fnc_registerKeybind; ["ACE3", "Interact Key", {_this call FUNC(keyUp)}, -[15, [false, false, false]], +[219, [false, false, false]], +false, +"keyUp"] call cba_fnc_registerKeybind; + +["ACE3", +"Self Actions Key", +{_this call FUNC(keyDownSelfAction)}, +[219, [false, true, false]], +false, +"keydown"] call cba_fnc_registerKeybind; + +["ACE3", +"Self Actions Key", +{_this call FUNC(keyUpSelfAction)}, +[219, [false, true, false]], false, "keyUp"] call cba_fnc_registerKeybind; \ No newline at end of file diff --git a/addons/interact_menu/XEH_preInit.sqf b/addons/interact_menu/XEH_preInit.sqf index 42795d6c75..d3ea2451b9 100644 --- a/addons/interact_menu/XEH_preInit.sqf +++ b/addons/interact_menu/XEH_preInit.sqf @@ -2,22 +2,22 @@ ADDON = false; -PREP(setToRender); +PREP(addAction); +PREP(compileMenu); +PREP(compileMenuSelfAction); +PREP(collectActiveActionTree); +PREP(keyDown); +PREP(keyDownSelfAction); +PREP(keyUp); +PREP(keyUpSelfAction); +PREP(removeAction); PREP(render); PREP(renderIcon); +PREP(renderBaseMenu); PREP(renderMenu); -PREP(probe); -PREP(rotateVectLineGetMap); -PREP(rotateVectLine); -PREP(keyDown); -PREP(keyUp); -PREP(compileMenu); -PREP(addAction); -PREP(removeAction); - -GVAR(toRender) = []; GVAR(keyDown) = false; +GVAR(keyDownSelfAction) = false; GVAR(keyDownTime) = 0; GVAR(lastTime) = diag_tickTime; @@ -27,12 +27,7 @@ GVAR(selectedAction) = {}; GVAR(actionSelected) = false; GVAR(selectedTarget) = objNull; -GVAR(filter) = []; - GVAR(menuDepthPath) = []; -GVAR(renderDepth) = 0; -GVAR(lastRenderDepth) = 0; -GVAR(vecLineMap) = []; GVAR(lastPos) = [0,0,0]; GVAR(currentOptions) = []; @@ -41,13 +36,8 @@ GVAR(lastPath) = []; GVAR(expanded) = false; -GVAR(maxRenderDepth) = 0; GVAR(startHoverTime) = diag_tickTime; GVAR(iconCtrls) = []; GVAR(iconCount) = 0; -GVAR(objectActionsHash) = HASH_CREATE; - -GVAR(uidCounter) = 0; - ADDON = true; diff --git a/addons/interact_menu/config.cpp b/addons/interact_menu/config.cpp index a7b7bae6df..20fc30805e 100644 --- a/addons/interact_menu/config.cpp +++ b/addons/interact_menu/config.cpp @@ -6,10 +6,21 @@ class CfgPatches { weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common"}; - author[] = {""}; + author[] = {"NouberNou", "CAA-Picard"}; authorUrl = ""; VERSION_CONFIG; }; }; #include "CfgEventHandlers.hpp" + +#include "CursorMenus.hpp" + +class ACE_Settings { + class GVAR(AlwaysUseCursorSelfInteraction) { + value = 0; + typeName = "BOOL"; + isClientSetable = 1; + displayName = "$STR_ACE_Interact_Menu_AlwaysUseCursorSelfInteraction"; + }; +}; diff --git a/addons/interact_menu/functions/fnc_addAction.sqf b/addons/interact_menu/functions/fnc_addAction.sqf index 4b9243cfac..136205766e 100644 --- a/addons/interact_menu/functions/fnc_addAction.sqf +++ b/addons/interact_menu/functions/fnc_addAction.sqf @@ -1,53 +1,54 @@ /* - * Author: commy2 - * - * Add an ACE action to an object. Note: This function is NOT global. + * Author: commy2, NouberNou and CAA-Picard + * Add an ACE action to an object, under a certain config path + * Note: This function is NOT global. * * Argument: - * 0: Object the action should be assigned to (Object) - * 1: Name of the action shown in the menu (String) - * 2: Icon (String) - * 3: Position (Position or Selection Name) - * 4: Statement (Code) - * 5: Condition (Code) - * 6: Distance (Number) + * 0: Object the action should be assigned to + * 1: Type of action, 0 for actions, 1 for self-actions + * 2: Full path of the new action + * 3: Name of the action shown in the menu + * 4: Icon + * 5: Position (Position or Selection Name) or + * 6: Statement + * 7: Condition + * 8: Distance * * Return value: - * The entry array, which can be used to remove the entry, or add children entries. + * The entry full path, which can be used to remove the entry, or add children entries . + * + * Example: + * [cursorTarget,0,["ACE_TapShoulderRight","VulcanPinch"],"Vulcan Pinch","",[0,0,0],{_target setDamage 1;},{true},100] call ace_interact_menu_fnc_addAction; + * + * Public: No */ #include "script_component.hpp" -private ["_object", "_displayName", "_icon", "_position", "_statement", "_condition", "_distance", "_actions", "_entry"]; -_object = _this select 0; -_displayName = _this select 1; -_icon = _this select 2; -_position = _this select 3; -_statement = _this select 4; -_condition = _this select 5; -_distance = _this select 6; +EXPLODE_9_PVT(_this,_object,_typeNum,_fullPath,_displayName,_icon,_position,_statement,_condition,_distance); -_actions = []; -if(IS_OBJECT(_object)) then { - _actions = _object getVariable [QUOTE(GVAR(actionData)), []]; - if((count _actions) == 0) then { - _object setVariable [QUOTE(GVAR(actionData)), _actions] - }; -} else { - if(IS_ARRAY(_object)) then { - _actions = _object select 6; - }; +private ["_varName","_actions"]; + +_varName = [QGVAR(actions),QGVAR(selfActions)] select _typeNum; +_actions = _object getVariable [_varName, []]; +if((count _actions) == 0) then { + _object setVariable [_varName, _actions]; }; +private "_entry"; _entry = [ - _displayName, - _icon, - _position, - _statement, - _condition, - _distance, - [], - GVAR(uidCounter) + [ + _displayName, + _icon, + _position, + _statement, + _condition, + _distance, + [false,false,false], + + _fullPath + ], + [] ]; -GVAR(uidCounter) = GVAR(uidCounter) + 1; + _actions pushBack _entry; -_entry; \ No newline at end of file + +_fullPath diff --git a/addons/interact_menu/functions/fnc_collectActiveActionTree.sqf b/addons/interact_menu/functions/fnc_collectActiveActionTree.sqf new file mode 100644 index 0000000000..42f762de3f --- /dev/null +++ b/addons/interact_menu/functions/fnc_collectActiveActionTree.sqf @@ -0,0 +1,72 @@ +/* + * Author: CAA-Picard + * Collect a entire tree of active actions + * + * Argument: + * 0: Object + * 1: Original action tree + * + * Return value: + * Active children + * + * Public: No + */ +#include "script_component.hpp" + +EXPLODE_2_PVT(_this,_object,_origAction); +EXPLODE_2_PVT(_origAction,_origActionData,_origActionChildren); + +private ["_resultingAction","_target","_player","_activeChildren","_action","_actionData","_x"]; + +_target = _object; +_player = ACE_player; + +// Return nothing if the action itself is not active +if !([_target, ACE_player] call (_origActionData select 4)) exitWith { + [] +}; + +_activeChildren = []; + +// Collect children class actions +{ + _action = [_object, _x] call FUNC(collectActiveActionTree); + if ((count _action) > 0) then { + _activeChildren pushBack _action; + }; +} forEach _origActionChildren; + +// Collect children object actions +{ + _action = _x; + _actionData = _action select 0; + + // Check if the action is children of the original action + if ((count (_actionData select 7)) == (count (_origActionData select 7) + 1)) then { + + // Compare parent path to see if it's a suitable child + private "_isChild"; + _isChild = true; + { + if !(_x isEqualTo ((_actionData select 7) select _forEachIndex)) exitWith { + _isChild = false; + }; + } forEach (_origActionData select 7); + + if (_isChild) then { + _action = [_object, _action] call FUNC(collectActiveActionTree); + if ((count _action) > 0) then { + _activeChildren pushBack _action; + }; + }; + }; +} forEach GVAR(objectActions); + + +// If the original action has no statement, and no children, don't display it +if ((count _activeChildren) == 0 && ((_origActionData select 3) isEqualTo {})) exitWith { + // @todo: Account for showDisabled? + [] +}; + +[_origActionData, _activeChildren] diff --git a/addons/interact_menu/functions/fnc_compileMenu.sqf b/addons/interact_menu/functions/fnc_compileMenu.sqf index 1b5e803ad6..c2ebac5034 100644 --- a/addons/interact_menu/functions/fnc_compileMenu.sqf +++ b/addons/interact_menu/functions/fnc_compileMenu.sqf @@ -1,102 +1,98 @@ -//fnc_compileMenu.sqf +/* + * Author: NouberNou and CAA-Picard + * Compile the action menu from config for an object's class + * + * Argument: + * 0: Object + * + * Return value: + * None + * + * Public: No + */ #include "script_component.hpp"; -// diag_log text format["COMPILE ACTIONS: %1", _this]; -_object = _this select 0; +EXPLODE_1_PVT(_this,_object); + +private ["_objectType","_actionsVarName"]; _objectType = typeOf _object; +_actionsVarName = format [QGVAR(Act_%1), _objectType]; +// Exit if the action menu is already compiled for this class +if !(isNil {missionNamespace getVariable [_actionsVarName, nil]}) exitWith {}; -/* -displayName = "$STR_ACE_Interaction_TeamManagement"; -distance = 4; -condition = QUOTE(alive _target && {!isPlayer _target} && {_target in units group _player} && {GVAR(EnableTeamManagement)}); -statement = ""; -showDisabled = 0; -priority = 3.2; -icon = PATHTOF(UI\team\team_management_ca.paa); -subMenu[] = {"ACE_TeamManagement", 0}; -hotkey = "M"; -enableInside = 1; -*/ - -/* -[ - [ - "Launch", - "\a3\ui_f\data\IGUI\Cfg\Actions\eject_ca.paa", - [0,0,0], - { (_this select 0) setVelocity [0,0,10]; }, - { true }, - 1, - [] - ] -] -*/ - -_actionsCfg = configFile >> "CfgVehicles" >> _objectType >> "ACE_Actions"; - - +private "_recurseFnc"; _recurseFnc = { - private ["_actions", "_displayName", "_distance", "_icon", "_statement", "_condition", "_showDisabled", - "_enableInside", "_children", "_entry", "_actionsCfg"]; + private ["_actions", "_displayName", "_distance", "_icon", "_statement", "_selection", "_condition", "_showDisabled", + "_enableInside", "_children", "_entry", "_entryCfg", "_fullPath"]; + EXPLODE_2_PVT(_this,_actionsCfg,_parentPath); _actions = []; - _actionsCfg = _this select 0; - for "_i" from 0 to (count _actionsCfg)-1 do { + + for "_i" from 0 to (count _actionsCfg) - 1 do { _entryCfg = _actionsCfg select _i; if(isClass _entryCfg) then { _displayName = getText (_entryCfg >> "displayName"); _distance = getNumber (_entryCfg >> "distance"); _icon = getText (_entryCfg >> "icon"); _statement = compile (getText (_entryCfg >> "statement")); - + _selection = getText (_entryCfg >> "selection"); + if (_selection == "") then { + _selection = [0,0,0]; + }; _condition = getText (_entryCfg >> "condition"); if (_condition == "") then {_condition = "true"}; // Add canInteract (including exceptions) and canInteractWith to condition _condition = _condition + format [QUOTE( && {%1 call EGVAR(common,canInteract)} && {[ARR_2(ACE_player, _target)] call EFUNC(common,canInteractWith)} ), getArray (_entryCfg >> "exceptions")]; - _showDisabled = getNumber (_entryCfg >> "showDisabled"); - _enableInside = getNumber (_entryCfg >> "enableInside"); + _showDisabled = (getNumber (_entryCfg >> "showDisabled")) > 0; + _enableInside = (getNumber (_entryCfg >> "enableInside")) > 0; + _canCollapse = (getNumber (_entryCfg >> "canCollapse")) > 0; + + _fullPath = (+ _parentPath); + _fullPath pushBack (configName _entryCfg); _condition = compile _condition; - // diag_log text format["_condition: %1", _condition]; - _children = []; - if(isArray (_entryCfg >> "subMenu")) then { - _subMenuDef = getArray (_entryCfg >> "subMenu"); - _childMenuName = _subMenuDef select 0; - _childMenuCfg = configFile >> "CfgVehicles" >> _objectType >> "ACE_Actions" >> _childMenuName; - _children = [_childMenuCfg] call _recurseFnc; - }; + _children = [_entryCfg, _fullPath] call _recurseFnc; + _entry = [ - _displayName, - _icon, - [0,0,0], - _statement, - _condition, - _distance, - _children, - GVAR(uidCounter) + [ + _displayName, + _icon, + _selection, + _statement, + _condition, + _distance, + [_showDisabled,_enableInside,_canCollapse], + _fullPath + ], + _children ]; - GVAR(uidCounter) = GVAR(uidCounter) + 1; _actions pushBack _entry; }; }; _actions }; -_actions = [_actionsCfg] call _recurseFnc; +private "_actionsCfg"; +_actionsCfg = configFile >> "CfgVehicles" >> _objectType >> "ACE_Actions"; -_actions = [[ - "TEST!", - "\a3\ui_f\data\IGUI\Cfg\Actions\eject_ca.paa", - "Spine3", - { true }, - { true }, - 5, - _actions, - GVAR(uidCounter) +missionNamespace setVariable [_actionsVarName, [_actionsCfg, []] call _recurseFnc]; + +/* +[ + [ + [ + "My Action", + "\a3\ui_f\data\IGUI\Cfg\Actions\eject_ca.paa", + [0,0,0], + { (_this select 0) setVelocity [0,0,10]; }, + { true }, + 1, + [false,false,false] + ["ACE_MainActions","TeamManagement","MyAction"] + ], + [children actions] + ] ] -]; -GVAR(uidCounter) = GVAR(uidCounter) + 1; - -_object setVariable [QUOTE(GVAR(actionData)), _actions]; \ No newline at end of file +*/ diff --git a/addons/interact_menu/functions/fnc_compileMenuSelfAction.sqf b/addons/interact_menu/functions/fnc_compileMenuSelfAction.sqf new file mode 100644 index 0000000000..0dd82e5178 --- /dev/null +++ b/addons/interact_menu/functions/fnc_compileMenuSelfAction.sqf @@ -0,0 +1,94 @@ +/* + * Author: NouberNou and CAA-Picard + * Compile the self action menu from config for an object's class + * + * Argument: + * 0: Object + * + * Return value: + * None + * + * Public: No + */ +#include "script_component.hpp"; + +EXPLODE_1_PVT(_this,_object); + +private ["_objectType","_actionsVarName"]; +_objectType = typeOf _object; +_actionsVarName = format [QGVAR(SelfAct_%1), _objectType]; + +// Exit if the action menu is already compiled for this class +if !(isNil {missionNamespace getVariable [_actionsVarName, nil]}) exitWith {}; + +private "_recurseFnc"; +_recurseFnc = { + private ["_actions", "_displayName", "_distance", "_icon", "_statement", "_selection", "_condition", "_showDisabled", + "_enableInside", "_children", "_entry", "_entryCfg", "_fullPath"]; + EXPLODE_2_PVT(_this,_actionsCfg,_parentPath); + _actions = []; + + for "_i" from 0 to (count _actionsCfg) - 1 do { + _entryCfg = _actionsCfg select _i; + if(isClass _entryCfg) then { + _displayName = getText (_entryCfg >> "displayName"); + + _icon = getText (_entryCfg >> "icon"); + _statement = compile (getText (_entryCfg >> "statement")); + + _condition = getText (_entryCfg >> "condition"); + if (_condition == "") then {_condition = "true"}; + + // Add canInteract (including exceptions) and canInteractWith to condition + _condition = _condition + format [QUOTE( && {%1 call EGVAR(common,canInteract)} && {[ARR_2(ACE_player, _target)] call EFUNC(common,canInteractWith)} ), getArray (_entryCfg >> "exceptions")]; + + _showDisabled = (getNumber (_entryCfg >> "showDisabled")) > 0; + _enableInside = (getNumber (_entryCfg >> "enableInside")) > 0; + _canCollapse = (getNumber (_entryCfg >> "canCollapse")) > 0; + + _fullPath = (+ _parentPath); + _fullPath pushBack (configName _entryCfg); + + _condition = compile _condition; + _children = [_entryCfg, _fullPath] call _recurseFnc; + + _entry = [ + [ + _displayName, + _icon, + [0,0,0], + _statement, + _condition, + 10, //distace + [_showDisabled,_enableInside,_canCollapse], + _fullPath + ], + _children + ]; + _actions pushBack _entry; + }; + }; + _actions +}; + +private "_actionsCfg"; +_actionsCfg = configFile >> "CfgVehicles" >> _objectType >> "ACE_SelfActions"; + +// Create a master action to base on self action +_actions = [ + [ + [ + "Self Actions", + "\a3\ui_f\data\IGUI\Cfg\Actions\eject_ca.paa", + "Spine3", + { true }, + { true }, + 10, + [false,true,false], + ["ACE_SelfActions"] + ], + [_actionsCfg, ["ACE_SelfActions"]] call _recurseFnc + ] +]; + +missionNamespace setVariable [_actionsVarName, _actions]; diff --git a/addons/interact_menu/functions/fnc_keyDown.sqf b/addons/interact_menu/functions/fnc_keyDown.sqf index e18ec69ae8..4a0592b5b8 100644 --- a/addons/interact_menu/functions/fnc_keyDown.sqf +++ b/addons/interact_menu/functions/fnc_keyDown.sqf @@ -1,8 +1,23 @@ -//fnc_keyDown.sqf +/* + * Author: NouberNou + * Handle interaction key down + * + * Argument: + * None + * + * Return value: + * true + * + * Public: No + */ #include "script_component.hpp" if(!GVAR(keyDown)) then { - GVAR(keyDown) = true; - GVAR(keyDownTime) = diag_tickTime; + + // Only interact with others if on foot + if (vehicle ACE_player != ACE_player) exitWith {}; + + GVAR(keyDown) = true; + GVAR(keyDownTime) = diag_tickTime; }; true diff --git a/addons/interact_menu/functions/fnc_keyDownSelfAction.sqf b/addons/interact_menu/functions/fnc_keyDownSelfAction.sqf new file mode 100644 index 0000000000..0f58a246d2 --- /dev/null +++ b/addons/interact_menu/functions/fnc_keyDownSelfAction.sqf @@ -0,0 +1,39 @@ +/* + * Author: NouberNou + * Handle self action key down + * + * Argument: + * None + * + * Return value: + * true + * + * Public: No + */ +#include "script_component.hpp" + +if(!GVAR(keyDownSelfAction)) then { + GVAR(keyDownSelfAction) = true; + GVAR(keyDown) = false; + GVAR(keyDownTime) = diag_tickTime; + + GVAR(useCursorMenu) = (vehicle ACE_player != ACE_player) || GVAR(AlwaysUseCursorSelfInteraction) || visibleMap; + + if (GVAR(useCursorMenu)) then { + closeDialog 0; + createDialog QGVAR(cursorMenu); + // The dialog sets: + // uiNamespace getVariable QGVAR(dlgCursorMenu); + // uiNamespace getVariable QGVAR(cursorMenuOpened); + ctrlEnable [91921, true]; + ((finddisplay 91919) displayctrl 91921) ctrlAddEventHandler ["MouseMoving", { + GVAR(cursorPos) = [_this select 1, _this select 2, 0]; + }]; + setMousePosition [0.5, 0.5]; + + }; + + GVAR(selfMenuOffset) = ((positionCameraToWorld [0, 0, 2]) call EFUNC(common,positionToASL)) vectorDiff + ((positionCameraToWorld [0, 0, 0]) call EFUNC(common,positionToASL)); +}; +true diff --git a/addons/interact_menu/functions/fnc_keyUp.sqf b/addons/interact_menu/functions/fnc_keyUp.sqf index 8f91b1322d..b2b5f35547 100644 --- a/addons/interact_menu/functions/fnc_keyUp.sqf +++ b/addons/interact_menu/functions/fnc_keyUp.sqf @@ -1,15 +1,25 @@ -//fnc_keyUp.sqf +/* + * Author: NouberNou + * Handle interaction key up + * + * Argument: + * None + * + * Return value: + * true + * + * Public: No + */ #include "script_component.hpp" GVAR(keyDown) = false; if(GVAR(actionSelected)) then { - this = GVAR(selectedTarget); + this = GVAR(selectedTarget); _player = ACE_Player; _target = GVAR(selectedTarget); - [GVAR(selectedTarget), player] call GVAR(selectedAction); + [GVAR(selectedTarget), ACE_player] call GVAR(selectedAction); }; GVAR(expanded) = false; GVAR(lastPath) = []; GVAR(menuDepthPath) = []; -GVAR(vecLineMap) = []; true diff --git a/addons/interact_menu/functions/fnc_keyUpSelfAction.sqf b/addons/interact_menu/functions/fnc_keyUpSelfAction.sqf new file mode 100644 index 0000000000..0f784e640b --- /dev/null +++ b/addons/interact_menu/functions/fnc_keyUpSelfAction.sqf @@ -0,0 +1,29 @@ +/* + * Author: NouberNou + * Handle self action key up + * + * Argument: + * None + * + * Return value: + * true + * + * Public: No + */ +#include "script_component.hpp" + +if (uiNamespace getVariable [QGVAR(cursorMenuOpened),false]) then { + closeDialog 0; +}; + +GVAR(keyDownSelfAction) = false; +if(GVAR(actionSelected)) then { + this = GVAR(selectedTarget); + _player = ACE_Player; + _target = GVAR(selectedTarget); + [GVAR(selectedTarget), ACE_player] call GVAR(selectedAction); +}; +GVAR(expanded) = false; +GVAR(lastPath) = []; +GVAR(menuDepthPath) = []; +true diff --git a/addons/interact_menu/functions/fnc_probe.sqf b/addons/interact_menu/functions/fnc_probe.sqf deleted file mode 100644 index 1f178180be..0000000000 --- a/addons/interact_menu/functions/fnc_probe.sqf +++ /dev/null @@ -1,42 +0,0 @@ -//fnc_probe.sqf -#include "script_component.hpp" - -private ["_nearestObjects", "_actionObject", "_x", "_actionData", "_renderData", "_actionItem", "_active", "_renderItem", "_object", "_forEachIndex"]; -if(!GVAR(keyDown)) then { - _nearestObjects = nearestObjects [(getPos player), ["All"], 100]; - - GVAR(toRender) = []; - { - _actionObject = _x; - _actionData = _actionObject getVariable [QUOTE(GVAR(actionData)), []]; - - if((count _actionData) > 0) then { - _renderData = []; - { - _actionItem = _x; - this = _actionObject; - _target = _actionObject; - _player = ACE_player; - _active = [_target, ACE_player] call (_actionItem select 4); - // player sideChat format["_active: %1 %2", _actionItem select 0, _active]; - if(_active) then { - _renderItem = +_actionItem; - _renderItem set[4, true]; - _renderData set[(count _renderData), _renderItem]; - }; - } forEach _actionData; - if((count _renderData) > 0) then { - GVAR(toRender) set[(count GVAR(toRender)), [_actionObject, _renderData]]; - }; - }; - } forEach _nearestObjects; - // player sideChat format["p: %1", count GVAR(toRender)]; -} else { - GVAR(filter) = []; - { - _object = _x select 0; - if(_object distance player > 100) then { - GVAR(filter) set[(count GVAR(filter)), _forEachIndex]; - }; - } forEach GVAR(toRender); -}; diff --git a/addons/interact_menu/functions/fnc_removeAction.sqf b/addons/interact_menu/functions/fnc_removeAction.sqf index 3b32f4d012..3c6988971d 100644 --- a/addons/interact_menu/functions/fnc_removeAction.sqf +++ b/addons/interact_menu/functions/fnc_removeAction.sqf @@ -1,53 +1,30 @@ /* - * Author: commy2 - * - * Add an ACE action to an object. Note: This function is global. + * Author: commy2, NouberNou and CAA-Picard + * Remove an action from an object * * Argument: - * 0: Object the action should be assigned to (Object) - * 1: Entry to remove (Array or Number) + * 0: Object the action is assigned to + * 1: Type of action, 0 for actions, 1 for self-actions + * 2: Full path of the action to remove * * Return value: - * ID of the action (used to remove it later). + * None + * + * Example: + * [cursorTarget,0,["ACE_TapShoulderRight","VulcanPinch"]] call ace_interact_menu_fnc_removeAction; + * + * Public: No */ - #include "script_component.hpp" -private ["_object", "_entry", "_found", "_actions", "_searchFnc"]; -_object = _this select 0; -_entry = _this select 1; +EXPLODE_3_PVT(_this,_object,_typeNum,_fullPath); +private ["_varName","_actions"]; +_varName = [QGVAR(actions),QGVAR(selfActions)] select _typeNum; +_actions = _object getVariable [_varName, []]; - - - -if(!IS_OBJECT(_object)) exitWith {false}; - -_actions = _object getVariable [QUOTE(GVAR(actionData)), []]; -if(IS_ARRAY(_entry)) then { - _entry = _entry select 7; -}; - -_found = false; -_searchFnc = { - private ["_actions", "_entry", "_childActions"]; - _actions = _this select 0; - _entry = _this select 1; - { - if((_x select 7) == _entry) then { - _actions set[_forEachIndex, "aceactiondelete"]; - _actions = _actions - ["aceactiondelete"]; - _found = true; - } else { - if(!_found && {count (_x select 6) > 0}) then { - _childActions = [(_x select 6), _entry] call _searchFnc; - _x set[6, _childActions]; - }; - }; - } forEach _actions; - _actions; -}; -_actions = [_actions, _entry] call _searchFnc; -_object setVariable [QUOTE(GVAR(actionData)), _actions]; - -_found; \ No newline at end of file +{ + if (((_x select 0) select 7) isEqualTo _fullPath) exitWith { + _actions deleteAt _forEachIndex; + }; +} forEach _actions; diff --git a/addons/interact_menu/functions/fnc_render.sqf b/addons/interact_menu/functions/fnc_render.sqf index 29033e3407..f5723f0c5d 100644 --- a/addons/interact_menu/functions/fnc_render.sqf +++ b/addons/interact_menu/functions/fnc_render.sqf @@ -1,104 +1,181 @@ -//fnc_render.sqf +/* + * Author: NouberNou and CAA-Picard + * Render all available nearby interactions + * + * Argument: + * None + * + * Return value: + * None + * + * Public: No + */ #include "script_component.hpp" private ["_cursorPos1", "_cursorPos2", "_cursorVec", "_p1", "_p2", "_p", "_v", "_cp", "_forEachIndex", "_renderTargets", "_x", "_cursorScreenPos", "_closestDistance", "_closestSelection", "_pos", "_sPos", "_disSq", "_closest", "_cTime", "_delta", "_foundTarget", "_misMatch", "_hoverPath", "_i"]; _foundTarget = false; _cursorPos1 = positionCameraToWorld [0, 0, 0]; _cursorPos2 = positionCameraToWorld [0, 0, 2]; + +GVAR(selfMenuScale) = (((worldToScreen (positionCameraToWorld [1,0,2])) select 0) - + ((worldToScreen (positionCameraToWorld [0,0,2])) select 0)) / 0.6; +//systemChat format ["selfMenuScale: %1", GVAR(selfMenuScale)]; GVAR(currentOptions) = []; -if((count GVAR(toRender)) > 0 && GVAR(keyDown)) then { - if((count GVAR(vecLineMap)) == 0 || ((count GVAR(menuDepthPath)) > 0 && (getPosASL player) distance GVAR(lastPos) > 0.01)) then { - GVAR(lastPos) = getPosASL player; - _cursorVec = [_cursorPos2, _cursorPos1] call BIS_fnc_vectorFromXtoY; - _p1 = [0,0,0]; - _p2 = +_cursorVec; - _p = (_cursorVec call CBA_fnc_vect2polar); - _v = [(_p select 0), (_p select 1), (_p select 2)+90] call CBA_fnc_polar2vect; - _cp = [_cursorVec, _v] call BIS_fnc_crossProduct; - - GVAR(vecLineMap) = [_cp, _p1, _p2] call FUNC(rotateVectLineGetMap); - }; - { - if(!(_forEachIndex in GVAR(filter))) then { - GVAR(renderDepth) = 0; - _renderTargets = _x; - { - [_renderTargets select 0, _x, 0] call FUNC(renderMenu); - } forEach (_renderTargets select 1); - }; - } forEach GVAR(toRender); - // player sideChat format["c: %1", count GVAR(toRender)]; + +private ["_actionsVarName","_classActions","_objectActions","_target","_player","_action","_actionData","_active"]; +_player = ACE_player; +if (GVAR(keyDown)) then { + + // Render all nearby interaction menus + #define MAXINTERACTOBJECTS 3 + private ["_numInteractObjects","_numInteractions"]; + _numInteractObjects = 0; + + _nearestObjects = nearestObjects [(getPos ACE_player), ["All"], 15]; + { + _target = _x; + + _numInteractions = 0; + // Prevent interacting with yourself or your own vehicle + if (_target != ACE_player && {_target != vehicle ACE_player}) then { + + // Iterate through object actions, find base level actions and render them if appropiate + _actionsVarName = format [QGVAR(Act_%1), typeOf _target]; + GVAR(objectActions) = _target getVariable [QGVAR(actions), []]; + { + _action = _x; + // Only render them directly if they are base level actions + if (count ((_action select 0) select 7) == 1) then { + // Try to render the menu + if ([_target, _action] call FUNC(renderBaseMenu)) then { + _numInteractions = _numInteractions + 1; + }; + }; + } forEach GVAR(objectActions); + + // Iterate through base level class actions and render them if appropiate + _classActions = missionNamespace getVariable [_actionsVarName, []]; + { + _action = _x; + // Try to render the menu + if ([_target, _action] call FUNC(renderBaseMenu)) then { + _numInteractions = _numInteractions + 1; + }; + } forEach _classActions; + + // Limit the amount of objects the player can interact with + if (_numInteractions > 0) then { + _numInteractObjects = _numInteractObjects + 1; + }; + }; + if (_numInteractObjects >= MAXINTERACTOBJECTS) exitWith {}; + + } forEach _nearestObjects; + +} else { + if (GVAR(keyDownSelfAction)) then { + + // Render only the self action menu + _target = vehicle ACE_player; + + // Iterate through object actions, find base level actions and render them if appropiate + _actionsVarName = format [QGVAR(SelfAct_%1), typeOf _target]; + GVAR(objectActions) = _target getVariable [QGVAR(selfActions), []]; + /* + { + _action = _x; + // Only render them directly if they are base level actions + if (count (_action select 7) == 1) then { + [_target, _action, 0, [180, 360]] call FUNC(renderMenu); + }; + } forEach GVAR(objectActions); + */ + + // Iterate through base level class actions and render them if appropiate + _actionsVarName = format [QGVAR(SelfAct_%1), typeOf _target]; + _classActions = missionNamespace getVariable [_actionsVarName, []]; + { + _action = _x; + + _pos = (((positionCameraToWorld [0, 0, 0]) call EFUNC(common,positionToASL)) vectorAdd GVAR(selfMenuOffset)) call EFUNC(common,ASLToPosition); + [_target, _action, _pos] call FUNC(renderBaseMenu); + } forEach _classActions; + }; }; -if(GVAR(keyDown)) then { - - _cursorScreenPos = worldToScreen _cursorPos2; - _closestDistance = 1000000; - _closestSelection = -1; - { - _pos = _x select 1; - _sPos = worldToScreen _pos; - if(count _sPos > 0) then { - _disSq = (((_cursorScreenPos select 0) - (_sPos select 0))^2 + ((_cursorScreenPos select 1) - (_sPos select 1))^2); - if(_disSq < 0.0125 && _disSq < _closestDistance) then { - _closestDistance = _disSq; - _closestSelection = _forEachIndex; - }; - }; - } forEach GVAR(currentOptions); - - if(_closestSelection != -1) then { - - _closest = GVAR(currentOptions) select _closestSelection; - - _pos = _closest select 1; - _cTime = diag_tickTime; - _delta = _cTime - GVAR(lastTime); - GVAR(lastTime) = _cTime; - GVAR(rotationAngle) = GVAR(rotationAngle) + (180*_delta); - if(GVAR(rotationAngle) > 360) then { - GVAR(rotationAngle) = GVAR(rotationAngle) - 360; - }; - drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\selectover_ca.paa", [1,0,0,.75], _pos, 0.6*SafeZoneW, 0.6*SafeZoneW, GVAR(rotationAngle), "", 0.5, 0.025, "TahomaB"]; - _foundTarget = true; - GVAR(actionSelected) = true; - GVAR(selectedTarget) = (_closest select 0) select 0; - GVAR(selectedAction) = ((_closest select 0) select 1) select 3; - _misMatch = false; - _hoverPath = (_closest select 2); - if((count GVAR(lastPath)) != (count _hoverPath)) then { - _misMatch = true; - } else { - { - if(_x != (_hoverPath select _forEachIndex)) exitWith { - _misMatch = true; - }; - } forEach GVAR(lastPath); - }; - - if(_misMatch) then { - GVAR(lastPath) = _hoverPath; - GVAR(startHoverTime) = diag_tickTime; - GVAR(expanded) = false; - } else { - if(!GVAR(expanded) && diag_tickTime-GVAR(startHoverTime) > 0.25) then { - GVAR(expanded) = true; - GVAR(menuDepthPath) = +GVAR(lastPath); - }; - }; - }; - drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\selected_ca.paa", [1,0,0,1], _cursorPos2, 1, 1, 0, "", 0.5, 0.025, "TahomaB"]; + +if(GVAR(keyDown) || GVAR(keyDownSelfAction)) then { + // Draw the red selector only when there's no cursor + if !(uiNamespace getVariable [QGVAR(cursorMenuOpened),false]) then { + drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\selected_ca.paa", [1,0,0,1], _cursorPos2, 1, 1, 0, "", 0.5, 0.025, "TahomaB"]; + }; + + _cursorScreenPos = [worldToScreen _cursorPos2, GVAR(cursorPos)] select (uiNamespace getVariable [QGVAR(cursorMenuOpened),false]); + + _closestDistance = 1000000; + _closestSelection = -1; + { + _pos = _x select 1; + _sPos = worldToScreen _pos; + if(count _sPos > 0) then { + _disSq = (((_cursorScreenPos select 0) - (_sPos select 0))^2 + ((_cursorScreenPos select 1) - (_sPos select 1))^2); + if(_disSq < 0.0125 && _disSq < _closestDistance) then { + _closestDistance = _disSq; + _closestSelection = _forEachIndex; + }; + }; + } forEach GVAR(currentOptions); + + + if(_closestSelection == -1) exitWith {}; + + _closest = GVAR(currentOptions) select _closestSelection; + + _pos = _closest select 1; + _cTime = diag_tickTime; + _delta = _cTime - GVAR(lastTime); + GVAR(lastTime) = _cTime; + GVAR(rotationAngle) = GVAR(rotationAngle) + (180*_delta); + if(GVAR(rotationAngle) > 360) then { + GVAR(rotationAngle) = GVAR(rotationAngle) - 360; + }; + drawIcon3D ["\a3\ui_f\data\IGUI\Cfg\Cursors\selectover_ca.paa", [1,0,0,.75], _pos, 0.6*SafeZoneW, 0.6*SafeZoneW, GVAR(rotationAngle), "", 0.5, 0.025, "TahomaB"]; + _foundTarget = true; + GVAR(actionSelected) = true; + GVAR(selectedTarget) = (_closest select 0) select 0; + GVAR(selectedAction) = (((_closest select 0) select 1) select 0) select 3; + _misMatch = false; + _hoverPath = (_closest select 2); + + if((count GVAR(lastPath)) != (count _hoverPath)) then { + _misMatch = true; + } else { + { + if(_x != (_hoverPath select _forEachIndex)) exitWith { + _misMatch = true; + }; + } forEach GVAR(lastPath); + }; + + if(_misMatch) then { + GVAR(lastPath) = _hoverPath; + GVAR(startHoverTime) = diag_tickTime; + GVAR(expanded) = false; + } else { + if(!GVAR(expanded) && diag_tickTime-GVAR(startHoverTime) > 0.25) then { + GVAR(expanded) = true; + GVAR(menuDepthPath) = +GVAR(lastPath); + }; + }; }; + if(!_foundTarget && GVAR(actionSelected)) then { - GVAR(actionSelected) = false; - GVAR(expanded) = false; - GVAR(lastPath) = []; - if(!GVAR(keyDown)) then { - GVAR(vecLineMap) = []; - }; + GVAR(actionSelected) = false; + GVAR(expanded) = false; + GVAR(lastPath) = []; }; for "_i" from GVAR(iconCount) to (count GVAR(iconCtrls))-1 do { - ctrlDelete (GVAR(iconCtrls) select _i); + ctrlDelete (GVAR(iconCtrls) select _i); }; GVAR(iconCtrls) resize GVAR(iconCount); GVAR(iconCount) = 0; diff --git a/addons/interact_menu/functions/fnc_renderBaseMenu.sqf b/addons/interact_menu/functions/fnc_renderBaseMenu.sqf new file mode 100644 index 0000000000..7ff430fa08 --- /dev/null +++ b/addons/interact_menu/functions/fnc_renderBaseMenu.sqf @@ -0,0 +1,71 @@ +/* + * Author: NouberNou and CAA-Picard + * Render the interaction menu for a base action + * + * Argument: + * 0: Object + * 1: Action data + * 2: 3D position (Optional) + * + * Return value: + * Was the menu rendered + * + * Public: No + */ +#include "script_component.hpp" + +private ["_distance","_pos","_weaponDir","_ref","_cameraPos","_sPos","_activeActionTree"]; + +EXPLODE_2_PVT(_this,_object,_baseAction); +EXPLODE_1_PVT(_baseAction,_actionData); + +_distance = _actionData select 5; + +// Obtain a 3D position for the action +if((count _this) > 2) then { + _pos = _this select 2; +} else { + if(typeName (_actionData select 2) == "ARRAY") then { + _pos = _object modelToWorld (_actionData select 2); + } else { + if ((_actionData select 2) == "weapon") then { + // Craft a suitable position for weapon interaction + _weaponDir = _object weaponDirection currentWeapon _object; + _ref = _weaponDir call EFUNC(common,createOrthonormalReference); + _pos = (_object modelToWorld (_object selectionPosition "righthand")) vectorAdd ((_ref select 2) vectorMultiply 0.1); + } else { + _pos = _object modelToWorld (_object selectionPosition (_actionData select 2)); + }; + }; + // Compensate for movement during the frame to get rid of jittering + _pos = _pos vectorAdd ((visiblePositionASL _object) vectorDiff (getPosASL _object)); +}; + +_cameraToActionVec = (_pos call EFUNC(common,positionToASL)) vectorDiff ((positionCameraToWorld [0,0,0]) call EFUNC(common,positionToASL)); +GVAR(refSystem) = _cameraToActionVec call EFUNC(common,createOrthonormalReference); + +// For non-self actions, exit if the action is too far away +if (GVAR(keyDown) && + {(ACE_player modelToWorld (ACE_player selectionPosition "pilot")) distance _pos >= _distance}) exitWith {false}; + +// Exit if the action is behind you +_sPos = worldToScreen _pos; +if(count _sPos == 0) exitWith {false}; + +// Exit if the action is off screen +if ((_sPos select 0) < safeZoneXAbs || (_sPos select 0) > safeZoneXAbs + safeZoneWAbs) exitWith {false}; +if ((_sPos select 1) < safeZoneY || (_sPos select 1) > safeZoneY + safeZoneH) exitWith {false}; + + +// Collect active tree +// @todo: cache activeActionTree? +_activeActionTree = ([_object, _baseAction] call FUNC(collectActiveActionTree)); + +// Check if there's something left for rendering +if (count _activeActionTree == 0) exitWith {false}; + +//EXPLODE_2_PVT(_activeActionTree,_actionData,_actionChildren); + +[_object, _activeActionTree, _pos, [180,360]] call FUNC(renderMenu); + +true diff --git a/addons/interact_menu/functions/fnc_renderIcon.sqf b/addons/interact_menu/functions/fnc_renderIcon.sqf index 39b4b120b9..9d845eab3f 100644 --- a/addons/interact_menu/functions/fnc_renderIcon.sqf +++ b/addons/interact_menu/functions/fnc_renderIcon.sqf @@ -1,4 +1,21 @@ -//fnc_renderIcon.sqf +/* + * Author: NouberNou and CAA-Picard + * Render a single interaction icon + * + * Argument: + * 0: Text + * 1: Color + * 2: 3d position ASL + * 3: ? + * 4: ? + * 5: ? + * 6: Icon + * + * Return value: + * None + * + * Public: No + */ #include "script_component.hpp" #define DEFAULT_ICON QUOTE(\z\ace\addons\interaction\ui\dot_ca.paa) private ["_color", "_pos", "_sPos", "_ctrl", "_icon"]; @@ -6,24 +23,27 @@ _text = _this select 0; _color = _this select 1; _pos = _this select 2; _icon = _this select 6; + +//systemChat format ["Icon %1 - %2,%3,%4", _text, _pos select 0, _pos select 1, _pos select 2]; + _sPos = worldToScreen _pos; // _sPos = _pos; if(count _sPos > 0) then { - // player sideChat format["render!"]; - if(GVAR(iconCount) > (count GVAR(iconCtrls))-1) then { - GVAR(iconCtrls) pushBack ((findDisplay 46) ctrlCreate ["RscStructuredText", 54021+GVAR(iconCount)]); - }; - _ctrl = GVAR(iconCtrls) select GVAR(iconCount); - GVAR(iconCount) = GVAR(iconCount) + 1; + + if(GVAR(iconCount) > (count GVAR(iconCtrls))-1) then { + _displayNum = [46,91919] select (uiNamespace getVariable [QGVAR(cursorMenuOpened),false]); + //systemChat format ["Displaynum: %1", _displayNum]; + GVAR(iconCtrls) pushBack ((findDisplay _displayNum) ctrlCreate ["RscStructuredText", 54021+GVAR(iconCount)]); + }; + _ctrl = GVAR(iconCtrls) select GVAR(iconCount); + GVAR(iconCount) = GVAR(iconCount) + 1; if(_icon == "") then { _icon = DEFAULT_ICON; }; - _text = "" + _text; - _ctrl ctrlSetStructuredText (parseText _text); - _ctrl ctrlSetPosition [(_sPos select 0)-(0.011*SafeZoneW), (_sPos select 1)-(0.0095*SafeZoneW), 0.4*SafeZoneW, 0.025*SafeZoneW]; - _ctrl ctrlSetForegroundColor _color; - _opacity = _color select 3; - _control ctrlSetTextColor _color; - // _ctrl ctrlSetBackgroundColor [1,0,0,1]; - _ctrl ctrlCommit 0; + _text = format ["
%4", _icon, _color, _color, _text]; + _ctrl ctrlSetStructuredText (parseText _text); + _ctrl ctrlSetPosition [(_sPos select 0)-(0.2*SafeZoneW), (_sPos select 1)-(0.0095*SafeZoneW), 0.4*SafeZoneW, 0.035*SafeZoneW]; + //_ctrl ctrlSetBackgroundColor [1, 0, 0, 0.1]; + //_ctrl ctrlSetBackgroundColor [1,0,0,1]; + _ctrl ctrlCommit 0; }; diff --git a/addons/interact_menu/functions/fnc_renderMenu.sqf b/addons/interact_menu/functions/fnc_renderMenu.sqf index 0337d4e8c9..ad604b9fa5 100644 --- a/addons/interact_menu/functions/fnc_renderMenu.sqf +++ b/addons/interact_menu/functions/fnc_renderMenu.sqf @@ -1,64 +1,86 @@ -//fnc_renderMenu.sqf +/* + * Author: NouberNou and CAA-Picard + * Render an interaction menu and it's children recursively + * + * Argument: + * 0: Object + * 1: Action data + * 2: 3D position + * 3: Angle range available for rendering + * + * Return value: + * None + * + * Public: No + */ #include "script_component.hpp" -private ["_object", "_actionData", "_distance", "_index", "_pos", "_cursorScreenPos", "_path", "_menuDepth", "_opacity", "_currentRenderDepth", "_radialOffset", "_active", "_x", "_offset", "_newPos", "_forEachIndex"]; +private ["_menuInSelectedPath", "_path", "_menuDepth", "_currentRenderDepth", "_x", "_offset", "_newPos", "_forEachIndex"]; -_object = _this select 0; -_actionData = _this select 1; -_distance = _actionData select 5; -_index = _this select 2; +EXPLODE_4_PVT(_this,_object,_action,_pos,_angles); +EXPLODE_2_PVT(_action,_actionData,_activeChildren); +EXPLODE_2_PVT(_angles,_centerAngle,_maxAngleSpan); -if((count _this) > 3) then { - _pos = _this select 3; -} else { - if(typeName (_actionData select 2) == "ARRAY") then { - _pos = _object modelToWorld (_actionData select 2); - } else { - _pos = _object modelToWorld (_object selectionPosition (_actionData select 2)); - }; +_menuDepth = (count GVAR(menuDepthPath)) - 1; + +// Store path to action +_path = [_object] + (_actionData select 7); + +// Check if the menu is on the selected path +_menuInSelectedPath = true; +{ + if (_forEachIndex >= (count GVAR(menuDepthPath))) exitWith { + _menuInSelectedPath = false; + }; + if (_x != (GVAR(menuDepthPath) select _forEachIndex)) exitWith { + _menuInSelectedPath = false; + }; +} forEach _path; + +// Render icon +// ARGB Color (First Hex Pair is transparancy) +_color = "#FFFFFFFF"; +if(!_menuInSelectedPath) then { //_menuDepth > 0 && + if (_menuDepth > 0) then { + _color = format ["#%1FFFFFF", [255 * ((((count _path) - 2)/_menuDepth) max 0.25)] call EFUNC(common,toHex)]; + } else { + _color = format ["#%1FFFFFF", [255 * 0.75] call EFUNC(common,toHex)]; + }; }; -_cursorScreenPos = (positionCameraToWorld [0, 0, 0]); -if(_cursorScreenPos distance _pos <= _distance) then { - _path = []; - if((count _this) > 4) then { - _path = +(_this select 4); - }; - _menuDepth = (count GVAR(menuDepthPath)); +[_actionData select 0, _color, _pos, 1, 1, 0, _actionData select 1, 0.5, 0.025, "TahomaB"] call FUNC(renderIcon); - _opacity = 1; - if(_menuDepth > 0 && _index != (GVAR(menuDepthPath) select (GVAR(renderDepth)))) then { - _opacity = ((GVAR(renderDepth)/_menuDepth)) max 0.25; - }; - _path set[(count _path), _index]; - // player sideChat format["r: %1", _actionData select 2]; - [_actionData select 0, [1,1,1,_opacity], _pos, 1, 1, 0, _actionData select 1, 0.5, 0.025, "TahomaB"] call FUNC(renderIcon); - GVAR(currentOptions) set[(count GVAR(currentOptions)), [_this, _pos, _path]]; - _currentRenderDepth = -1; - _currentRenderDepth = GVAR(renderDepth); - GVAR(renderDepth) = GVAR(renderDepth) + 1; - if(_index == (GVAR(menuDepthPath) select (GVAR(renderDepth)-1))) then { - _radialOffset = 0; - { - // if(_index != (GVAR(menuDepthPath) select (GVAR(renderDepth)))) then { - this = _object; - _target = _object; - _player = ACE_player; - _active = [_object, ACE_player] call (_x select 4); - // diag_log text format["_active: %1: %2", (_x select 0), _active]; - if(_active) then { - _offset = [GVAR(vecLineMap), (270*(GVAR(renderDepth)%2))-(_radialOffset*45)] call FUNC(rotateVectLine); - _mod = 0.1*_distance; - _newPos = [ - (_pos select 0) + ((_offset select 0)*_mod), - (_pos select 1) + ((_offset select 1)*_mod), - (_pos select 2) + ((_offset select 2)*_mod) - ]; - // drawLine3D [_pos, _newPos, [1,0,0,1]]; - [_object, _x, _forEachIndex, _newPos, _path] call FUNC(renderMenu); - _radialOffset = _radialOffset + 1; - }; - // }; - } forEach (_actionData select 6); - }; - GVAR(renderDepth) = GVAR(renderDepth) - 1; +// Add the action to current options +GVAR(currentOptions) pushBack [_this, _pos, _path]; + +// Exit without rendering children if it isn't +if !(_menuInSelectedPath) exitWith {true}; + +private ["_angleSpan","_angle"]; +_angleSpan = _maxAngleSpan min (55 * ((count _activeChildren) - 1)); +if (_angleSpan >= 305) then { + _angleSpan = 360; }; + +_angle = _centerAngle - _angleSpan / 2; +{ + _target = _object; + _player = ACE_player; + + _mod = (0.15 max (0.15 * ((positionCameraToWorld [0, 0, 0]) distance _pos))) / GVAR(selfMenuScale); + + _offset = ((GVAR(refSystem) select 1) vectorMultiply (-_mod * cos _angle)) vectorAdd + ((GVAR(refSystem) select 2) vectorMultiply (-_mod * sin _angle)); + _newPos = ((_pos call EFUNC(common,positionToASL)) vectorAdd _offset) call EFUNC(common,ASLToPosition); + + //drawLine3D [_pos, _newPos, [1,0,0,0.5]]; + + [_object, _x, _newPos, [_angle, 140]] call FUNC(renderMenu); + + if (_angleSpan == 360) then { + _angle = _angle + _angleSpan / (count _activeChildren); + } else { + _angle = _angle + _angleSpan / (((count _activeChildren)-1) max 1); + }; +} forEach _activeChildren; + +true diff --git a/addons/interact_menu/functions/fnc_rotateVectLine.sqf b/addons/interact_menu/functions/fnc_rotateVectLine.sqf deleted file mode 100644 index d411ffbf84..0000000000 --- a/addons/interact_menu/functions/fnc_rotateVectLine.sqf +++ /dev/null @@ -1,40 +0,0 @@ -//fnc_rotateVectLine.sqf -#include "script_component.hpp" - -private ["_theta", "_p", "_map", "_p1", "_p2", "_q1", "_q2", "_u", "_d"]; -_map = _this select 0; -_theta = _this select 1; - -_p = _map select 0; -_p1 = _map select 1; -_p2 = _map select 2; - -_q1 = +(_map select 3); -_q2 = +(_map select 4); -_u = _map select 5; -_d = _map select 6; - -/* Step 4 */ -_q2 set[0, (_q1 select 0) * cos(_theta) - (_q1 select 1) * sin(_theta)]; -_q2 set[1, (_q1 select 0) * sin(_theta) + (_q1 select 1) * cos(_theta)]; -_q2 set[2, (_q1 select 2)]; - -/* Inverse of step 3 */ -_q1 set[0, (_q2 select 0) * _d + (_q2 select 2) * (_u select 0)]; -_q1 set[1, (_q2 select 1)]; -_q1 set[2, - (_q2 select 0) * (_u select 0) + (_q2 select 2) * _d]; - -/* Inverse of step 2 */ -if (_d != 0) then { - _q2 set[0, (_q1 select 0)]; - _q2 set[1, (_q1 select 1) * (_u select 2) / _d + (_q1 select 2) * (_u select 1) / _d]; - _q2 set[2, - (_q1 select 1) * (_u select 1) / _d + (_q1 select 2) * (_u select 2) / _d]; -} else { - _q2 = _q1; -}; - -/* Inverse of step 1 */ -_q1 set[0, (_q2 select 0) + (_p1 select 0)]; -_q1 set[1, (_q2 select 1) + (_p1 select 1)]; -_q1 set[2, (_q2 select 2) + (_p1 select 2)]; -_q1; diff --git a/addons/interact_menu/functions/fnc_rotateVectLineGetMap.sqf b/addons/interact_menu/functions/fnc_rotateVectLineGetMap.sqf deleted file mode 100644 index 40a1d0ca0c..0000000000 --- a/addons/interact_menu/functions/fnc_rotateVectLineGetMap.sqf +++ /dev/null @@ -1,39 +0,0 @@ -//fnc_rotateVectLineGetMap.sqf -#include "script_component.hpp" - -private ["_p", "_p1", "_p2", "_q1", "_q2", "_u", "_d"]; - -_p = _this select 0; -_p1 = _this select 1; -_p2 = _this select 2; - -_q1 = []; -_q2 = []; -_u = []; - -/* Step 1 */ -_q1 set[0, (_p select 0) - (_p1 select 0)]; -_q1 set[1, (_p select 1) - (_p1 select 1)]; -_q1 set[2, (_p select 2) - (_p1 select 2)]; - -_u set[0, (_p2 select 0) - (_p1 select 0)]; -_u set[1, (_p2 select 1) - (_p1 select 1)]; -_u set[2, (_p2 select 2) - (_p1 select 2)]; -_u = _u call BIS_fnc_unitVector; -_d = sqrt((_u select 1)*(_u select 1) + (_u select 2)*(_u select 2)); - -/* Step 2 */ -if (_d != 0) then { - _q2 set[0, (_q1 select 0)]; - _q2 set[1, (_q1 select 1) * (_u select 2) / _d - (_q1 select 2) * (_u select 1) / _d]; - _q2 set[2, (_q1 select 1) * (_u select 1) / _d + (_q1 select 2) * (_u select 2) / _d]; -} else { - _q2 = _q1; -}; - -/* Step 3 */ -_q1 set[0, (_q2 select 0) * _d - (_q2 select 2) * (_u select 0)]; -_q1 set[1, (_q2 select 1)]; -_q1 set[2, (_q2 select 0) * (_u select 0) + (_q2 select 2) * _d]; - -[_p, _p1, _p2, _q1, _q2, _u, _d] diff --git a/addons/interact_menu/functions/fnc_setToRender.sqf b/addons/interact_menu/functions/fnc_setToRender.sqf deleted file mode 100644 index 4cc7cfd68f..0000000000 --- a/addons/interact_menu/functions/fnc_setToRender.sqf +++ /dev/null @@ -1,6 +0,0 @@ -//fnc_setToRender.sqf -#include "script_component.hpp" -// No idea what this function was for, it was autogenerated out of my WIP file... -private ["_options"]; -_object = _this select 0; -_options = _this select 1; diff --git a/addons/interact_menu/stringtable.xml b/addons/interact_menu/stringtable.xml new file mode 100644 index 0000000000..cecb24fee2 --- /dev/null +++ b/addons/interact_menu/stringtable.xml @@ -0,0 +1,7 @@ + + + + + Always display cursor for self interaction + + diff --git a/addons/interaction/CfgVehicles.hpp b/addons/interaction/CfgVehicles.hpp index ce1a98abc5..3cf95fe1a4 100644 --- a/addons/interaction/CfgVehicles.hpp +++ b/addons/interaction/CfgVehicles.hpp @@ -30,122 +30,177 @@ class CfgVehicles { class Man; class CAManBase: Man { class ACE_Actions { - class ACE_TeamManagement { - displayName = "$STR_ACE_Interaction_TeamManagement"; - distance = 4; - condition = QUOTE(alive _target && {!isPlayer _target} && {_target in units group _player} && {GVAR(EnableTeamManagement)}); + class ACE_MainActions { + displayName = "$STR_ACE_Interaction_MainAction"; + distance = 5; + condition = QUOTE(true); statement = ""; - showDisabled = 0; - priority = 3.2; - icon = PATHTOF(UI\team\team_management_ca.paa); - subMenu[] = {"ACE_TeamManagement", 0}; - hotkey = "M"; - enableInside = 1; + icon = "\a3\ui_f\data\IGUI\Cfg\Actions\eject_ca.paa"; + selection = "spine3"; - class ACE_JoinTeamRed { - displayName = "$STR_ACE_Interaction_JoinTeamRed"; - distance = 4; - condition = QUOTE(alive _target && {!isPlayer _target} && {_target in units group _player}); - statement = QUOTE([ARR_2(_target,'RED')] call DFUNC(joinTeam)); - showDisabled = 1; - icon = PATHTOF(UI\team\team_red_ca.paa); - priority = 2.4; - hotkey = "R"; + class ACE_TeamManagement { + displayName = "$STR_ACE_Interaction_TeamManagement"; + distance = 5; + condition = QUOTE(alive _target && {!isPlayer _target} && {_target in units group _player} && {GVAR(EnableTeamManagement)}); + statement = ""; + showDisabled = 0; + priority = 3.2; + icon = PATHTOF(UI\team\team_management_ca.paa); + hotkey = "M"; + enableInside = 1; + + class ACE_JoinTeamRed { + displayName = "$STR_ACE_Interaction_JoinTeamRed"; + distance = 5; + condition = QUOTE(alive _target && {!isPlayer _target} && {_target in units group _player}); + statement = QUOTE([ARR_2(_target,'RED')] call DFUNC(joinTeam)); + showDisabled = 1; + icon = PATHTOF(UI\team\team_red_ca.paa); + priority = 2.4; + hotkey = "R"; + enableInside = 1; + }; + class ACE_JoinTeamGreen { + displayName = "$STR_ACE_Interaction_JoinTeamGreen"; + distance = 5; + condition = QUOTE(alive _target && {!isPlayer _target} && {_target in units group _player}); + statement = QUOTE([ARR_2(_target,'GREEN')] call DFUNC(joinTeam)); + showDisabled = 1; + icon = PATHTOF(UI\team\team_green_ca.paa); + priority = 2.3; + hotkey = "G"; + enableInside = 1; + }; + class ACE_JoinTeamBlue { + displayName = "$STR_ACE_Interaction_JoinTeamBlue"; + distance = 5; + condition = QUOTE(alive _target && {!isPlayer _target} && {_target in units group _player}); + statement = QUOTE([ARR_2(_target,'BLUE')] call DFUNC(joinTeam)); + showDisabled = 1; + icon = PATHTOF(UI\team\team_blue_ca.paa); + priority = 2.2; + hotkey = "B"; + enableInside = 1; + }; + class ACE_JoinTeamYellow { + displayName = "$STR_ACE_Interaction_JoinTeamYellow"; + distance = 5; + condition = QUOTE(alive _target && {!isPlayer _target} && {_target in units group _player}); + statement = QUOTE([ARR_2(_target,'YELLOW')] call DFUNC(joinTeam)); + showDisabled = 1; + icon = PATHTOF(UI\team\team_yellow_ca.paa); + priority = 2.1; + hotkey = "Y"; + enableInside = 1; + }; + + class ACE_LeaveTeam { + displayName = "$STR_ACE_Interaction_LeaveTeam"; + distance = 5; + condition = QUOTE(alive _target && {!isPlayer _target} && {_target in units group _player} && {assignedTeam _player != 'MAIN'}); + statement = QUOTE([ARR_2(_target,'MAIN')] call DFUNC(joinTeam)); + showDisabled = 1; + icon = PATHTOF(UI\team\team_white_ca.paa); + priority = 2.5; + hotkey = "N"; + enableInside = 1; + }; + }; + + class ACE_JoinGroup { + displayName = "$STR_ACE_Interaction_JoinGroup"; + distance = 5; + condition = QUOTE(side group _player == side group _target && {group _player != group _target}); + statement = QUOTE([_player] joinSilent group _target;); + showDisabled = 0; + priority = 2.6; + icon = PATHTOF(UI\team\team_management_ca.paa); + hotkey = "J"; enableInside = 1; }; - class ACE_JoinTeamGreen { - displayName = "$STR_ACE_Interaction_JoinTeamGreen"; - distance = 4; - condition = QUOTE(alive _target && {!isPlayer _target} && {_target in units group _player}); - statement = QUOTE([ARR_2(_target,'GREEN')] call DFUNC(joinTeam)); - showDisabled = 1; - icon = PATHTOF(UI\team\team_green_ca.paa); - priority = 2.3; - hotkey = "G"; - enableInside = 1; - }; - class ACE_JoinTeamBlue { - displayName = "$STR_ACE_Interaction_JoinTeamBlue"; - distance = 4; - condition = QUOTE(alive _target && {!isPlayer _target} && {_target in units group _player}); - statement = QUOTE([ARR_2(_target,'BLUE')] call DFUNC(joinTeam)); - showDisabled = 1; - icon = PATHTOF(UI\team\team_blue_ca.paa); + + class ACE_GetDown { + displayName = "$STR_ACE_Interaction_GetDown"; + distance = 5; + condition = QUOTE([_target] call DFUNC(canInteractWithCivilian)); + statement = QUOTE([_target] call DFUNC(getDown)); + showDisabled = 0; priority = 2.2; - hotkey = "B"; - enableInside = 1; }; - class ACE_JoinTeamYellow { - displayName = "$STR_ACE_Interaction_JoinTeamYellow"; - distance = 4; - condition = QUOTE(alive _target && {!isPlayer _target} && {_target in units group _player}); - statement = QUOTE([ARR_2(_target,'YELLOW')] call DFUNC(joinTeam)); - showDisabled = 1; - icon = PATHTOF(UI\team\team_yellow_ca.paa); - priority = 2.1; - hotkey = "Y"; - enableInside = 1; + class ACE_SendAway { + displayName = "$STR_ACE_Interaction_SendAway"; + distance = 5; + condition = QUOTE([_target] call DFUNC(canInteractWithCivilian)); + statement = QUOTE([_target] call DFUNC(sendAway)); + showDisabled = 0; + priority = 2.0; }; - - class ACE_LeaveTeam { - displayName = "$STR_ACE_Interaction_LeaveTeam"; - distance = 4; - condition = QUOTE(alive _target && {!isPlayer _target} && {_target in units group _player} && {assignedTeam _player != 'MAIN'}); - statement = QUOTE([ARR_2(_target,'MAIN')] call DFUNC(joinTeam)); - showDisabled = 1; - icon = PATHTOF(UI\team\team_white_ca.paa); + class ACE_Pardon { + displayName = "$STR_ACE_Interaction_Pardon"; + distance = 5; + condition = QUOTE(rating _target < -2000 && {alive _target} && {side group _player == side group _target}); + statement = QUOTE([ARR_3(_target,'{_this addRating -rating _this}',_target)] call DEFUNC(common,execRemoteFnc)); + showDisabled = 0; priority = 2.5; - hotkey = "N"; enableInside = 1; }; }; + class ACE_Head { + displayName = "$STR_ACE_Interaction_Head"; + selection = "pilot"; + distance = 2.0; + condition = ""; + statement = ""; + }; + class ACE_ArmLeft { + displayName = "$STR_ACE_Interaction_ArmLeft"; + selection = "LeftForeArm"; + distance = 2.0; + condition = ""; + statement = ""; + }; + class ACE_ArmRight { + displayName = "$STR_ACE_Interaction_ArmRight"; + selection = "RightForeArm"; + distance = 2.0; + condition = ""; + statement = ""; + }; + class ACE_LegLeft { + displayName = "$STR_ACE_Interaction_LegLeft"; + selection = "LKnee"; + distance = 2.0; + condition = ""; + statement = ""; + }; + class ACE_LegRight { + displayName = "$STR_ACE_Interaction_LegRight"; + selection = "RKnee"; + distance = 2.0; + condition = ""; + statement = ""; + }; + class ACE_Weapon { + displayName = "$STR_ACE_Interaction_Weapon"; + selection = "weapon"; + distance = 2.0; + condition = ""; + statement = ""; + }; - class ACE_TapShoulder { + class ACE_TapShoulderRight { displayName = "$STR_ACE_Interaction_TapShoulder"; - distance = 4; + selection = "rightshoulder"; + distance = 2.0; condition = QUOTE([ARR_2(_player, _target)] call DFUNC(canTapShoulder)); - statement = QUOTE([ARR_2(_player, _target)] call DFUNC(tapShoulder)); - showDisabled = 1; - priority = 2.8; - hotkey = "Q"; - enableInside = 1; + statement = QUOTE([ARR_3(_player, _target, 0)] call DFUNC(tapShoulder)); }; - class ACE_JoinGroup { - displayName = "$STR_ACE_Interaction_JoinGroup"; - distance = 4; - condition = QUOTE(side group _player == side group _target && {group _player != group _target}); - statement = QUOTE([_player] joinSilent group _target;); - showDisabled = 0; - priority = 2.6; - icon = PATHTOF(UI\team\team_management_ca.paa); - hotkey = "J"; - enableInside = 1; - }; - - class ACE_GetDown { - displayName = "$STR_ACE_Interaction_GetDown"; - distance = 4; - condition = QUOTE([_target] call DFUNC(canInteractWith)); - statement = QUOTE([_target] call DFUNC(getDown)); - showDisabled = 0; - priority = 2.2; - }; - class ACE_SendAway { - displayName = "$STR_ACE_Interaction_SendAway"; - distance = 4; - condition = QUOTE([_target] call DFUNC(canInteractWith)); - statement = QUOTE([_target] call DFUNC(sendAway)); - showDisabled = 0; - priority = 2.0; - }; - class ACE_Pardon { - displayName = "$STR_ACE_Interaction_Pardon"; - distance = 4; - condition = QUOTE(rating _target < -2000 && {alive _target} && {side group _player == side group _target}); - statement = QUOTE([ARR_3(_target,'{_this addRating -rating _this}',_target)] call DEFUNC(common,execRemoteFnc)); - showDisabled = 0; - priority = 2.5; - enableInside = 1; + class ACE_TapShoulderLeft { + displayName = "$STR_ACE_Interaction_TapShoulder"; + selection = "leftshoulder"; + distance = 2.0; + condition = QUOTE([ARR_2(_player, _target)] call DFUNC(canTapShoulder)); + statement = QUOTE([ARR_3(_player, _target, 1)] call DFUNC(tapShoulder)); }; }; @@ -157,7 +212,6 @@ class CfgVehicles { showDisabled = 1; priority = 3.2; icon = PATHTOF(UI\team\team_management_ca.paa); - subMenu[] = {"ACE_TeamManagement", 1}; enableInside = 1; hotkey = "M"; @@ -235,30 +289,12 @@ class CfgVehicles { }; }; - /* DANCE ANIMATION DOESN'T WORK :( - class ACE_Dance { - displayName = "$STR_ACE_Interaction_Dance"; - condition = "isClass (configFile >> 'CfgPatches' >> 'ACE_Movement') and !ACE_Dancing"; - statement = "ACE_Dancing = true; [-2, {_this switchMove 'TestDance';}, player] call CBA_fnc_globalExecute;"; - showDisabled = 0; - priority = -1.2; - }; - class ACE_StopDancing { - displayName = "$STR_ACE_Interaction_StopDancing"; - condition = "ACE_Dancing"; - statement = "ACE_Dancing = false; [-2, {_this switchMove '';}, player] call CBA_fnc_globalExecute;"; - showDisabled = 0; - priority = -1.2; - }; - */ - class ACE_Gestures { displayName = "$STR_ACE_Interaction_Gestures"; condition = "canStand _target"; statement = ""; showDisabled = 1; priority = 3.5; - subMenu[] = {"ACE_Gestures", 1}; icon = PATHTOF(UI\gestures_ca.paa); hotkey = "G"; @@ -365,67 +401,105 @@ class CfgVehicles { showDisabled = 1; priority = 4.5; icon = ""; // @todo - subMenu[] = {"ACE_Equipment", 1}; enableInside = 1; hotkey = "E"; - - class ACE_Dummy { - displayName = ""; - condition = QUOTE(false); - statement = ""; - showDisabled = 1; - priority = -99; - icon = PATHTOEF(common,UI\blank_CO.paa); - enableInside = 1; - }; }; }; }; class LandVehicle; class Car: LandVehicle { - class ACE_Actions {}; + class ACE_Actions { + class ACE_MainActions { + displayName = "$STR_ACE_Interaction_MainAction"; + selection = ""; + distance = 10; + condition = "true"; + }; + }; class ACE_SelfActions {}; }; class Tank: LandVehicle { - class ACE_Actions {}; + class ACE_Actions { + class ACE_MainActions { + displayName = "$STR_ACE_Interaction_MainAction"; + selection = ""; + distance = 10; + condition = "true"; + }; + }; class ACE_SelfActions {}; }; class Air; class Helicopter: Air { - class ACE_Actions {}; + class ACE_Actions { + class ACE_MainActions { + displayName = "$STR_ACE_Interaction_MainAction"; + selection = ""; + distance = 10; + condition = "true"; + }; + }; class ACE_SelfActions {}; }; class Plane: Air { - class ACE_Actions {}; + class ACE_Actions { + class ACE_MainActions { + displayName = "$STR_ACE_Interaction_MainAction"; + selection = ""; + distance = 10; + condition = "true"; + }; + }; class ACE_SelfActions {}; }; class Ship; class Ship_F: Ship { class ACE_Actions { - class ACE_Push { - displayName = "$STR_ACE_Interaction_Push"; - distance = 4; - condition = QUOTE(getMass _target < 1000 && {alive _target}); - statement = QUOTE([ARR_2(_target, [ARR_3(2 * (vectorDir _player select 0), 2 * (vectorDir _player select 1), 0.5)])] call FUNC(push);); - showDisabled = 0; - priority = -1; + class ACE_MainActions { + displayName = "$STR_ACE_Interaction_MainAction"; + selection = ""; + distance = 10; + condition = "true"; + + class ACE_Push { + displayName = "$STR_ACE_Interaction_Push"; + distance = 6; + condition = QUOTE(getMass _target < 1000 && {alive _target}); + statement = QUOTE([ARR_2(_target, [ARR_3(2 * (vectorDir _player select 0), 2 * (vectorDir _player select 1), 0.5)])] call FUNC(push);); + showDisabled = 0; + priority = -1; + }; }; }; class ACE_SelfActions {}; }; class StaticWeapon: LandVehicle { - class ACE_Actions {}; + class ACE_Actions { + class ACE_MainActions { + displayName = "$STR_ACE_Interaction_MainAction"; + selection = "gunnerview"; + distance = 2; + condition = "true"; + }; + }; class ACE_SelfActions {}; }; class StaticMortar; class Mortar_01_base_F: StaticMortar { - class ACE_Actions {}; + class ACE_Actions { + class ACE_MainActions { + displayName = "$STR_ACE_Interaction_MainAction"; + selection = "gunnerview"; + distance = 2; + condition = "true"; + }; + }; class ACE_SelfActions {}; }; -}; \ No newline at end of file +}; diff --git a/addons/interaction/Menu_Config.hpp b/addons/interaction/Menu_Config.hpp index ccd0f7d414..38f12066e0 100644 --- a/addons/interaction/Menu_Config.hpp +++ b/addons/interaction/Menu_Config.hpp @@ -43,370 +43,6 @@ class ACE_Interaction_Button_Base { soundEscape[] = {"\A3\ui_f\data\sound\RscButton\soundEscape",0.09,1}; }; -#define ICON_BORDER 0.05 - -// Old command rose -class ACE_Interaction_Dialog { - idd = 1713999; - enableSimulation = 1; - movingEnable = 0; - onLoad = "_dlgInteractionDialog = _this select 0; for '_a' from 10 to 19 do {(_dlgInteractionDialog displayCtrl _a) ctrlShow false}; uiNamespace setVariable ['ACE_Interaction_Dialog', _dlgInteractionDialog];"; - objects[] = {}; - class controls { - class Interaction_BackgroundMain: ACE_Interaction_Button_Base { - type = 0; - style = 2; - idc = 2; - colorBackground[] = {0,0,0,0.5}; - colorBackgroundDisabled[] = {0,0,0,0.5}; - x = "(0.5-1.8/16/2 + 0 * 0.1) * safezoneW + safezoneX"; - y = "(0.5-0.55/9/2 + 0 * 0.04) * safezoneH + safezoneY"; - w = "1.8 / 16 * safezoneW"; - h = "0.55 / 9 * safezoneH"; - }; - - class Interaction_ButtonMain: ACE_Interaction_Button_Base { - action = "-1 call ACE_Interaction_fnc_onClick;"; - style = 2; - tooltip = ""; - text = "Interaction Menu"; - idc = 3; - sizeEx = "0.6 / 40 / (getResolution select 5)"; - colorBackground[] = {0,0,0,0}; - colorBackgroundDisabled[] = {0,0,0,0}; - colorBackgroundActive[] = {1,1,1,0.2}; - colorFocused[] = {0,0,0,0}; - x = "(0.5-1.8/16/2 + 0 * 0.1) * safezoneW + safezoneX"; - y = "(0.5-0.55/9/2 + 0 * 0.04) * safezoneH + safezoneY"; - w = "1.8 / 16 * safezoneW"; - h = "0.55 / 9 * safezoneH"; - }; - - class Interaction_Background0: ACE_Interaction_Button_Base { - type = 0; - style = 2; - idc = 40; - colorBackground[] = {0,0,0,0.5}; - colorBackgroundDisabled[] = {0,0,0,0.5}; - x = "(0.5-2.0/16/2 + 0 * 0.1) * safezoneW + safezoneX"; - y = "(0.5-0.3/9/2 - 2.5 * 0.04) * safezoneH + safezoneY"; - w = "2.0 / 16 * safezoneW"; - h = "0.3 / 9 * safezoneH"; - }; - class Interaction_Background1: Interaction_Background0 { - idc = 41; - x = "(0.5-2.0/16/2 + 1.0 * 0.1) * safezoneW + safezoneX"; - y = "(0.5-0.3/9/2 - 1.5 * 0.04) * safezoneH + safezoneY"; - w = "2.0 / 16 * safezoneW"; - h = "0.3 / 9 * safezoneH"; - }; - class Interaction_Background2: Interaction_Background0 { - idc = 42; - x = "(0.5-2.0/16/2 + 1.25 * 0.1) * safezoneW + safezoneX"; - y = "(0.5-0.3/9/2 - 0.5 * 0.04) * safezoneH + safezoneY"; - w = "2.0 / 16 * safezoneW"; - h = "0.3 / 9 * safezoneH"; - }; - class Interaction_Background3: Interaction_Background0 { - idc = 43; - x = "(0.5-2.0/16/2 + 1.25 * 0.1) * safezoneW + safezoneX"; - y = "(0.5-0.3/9/2 + 0.5 * 0.04) * safezoneH + safezoneY"; - w = "2.0 / 16 * safezoneW"; - h = "0.3 / 9 * safezoneH"; - }; - class Interaction_Background4: Interaction_Background0 { - idc = 44; - x = "(0.5-2.0/16/2 + 1.0 * 0.1) * safezoneW + safezoneX"; - y = "(0.5-0.3/9/2 + 1.5 * 0.04) * safezoneH + safezoneY"; - w = "2.0 / 16 * safezoneW"; - h = "0.3 / 9 * safezoneH"; - }; - class Interaction_Background5: Interaction_Background0 { - idc = 45; - x = "(0.5-2.0/16/2 + 0 * 0.1) * safezoneW + safezoneX"; - y = "(0.5-0.3/9/2 + 2.5 * 0.04) * safezoneH + safezoneY"; - w = "2.0 / 16 * safezoneW"; - h = "0.3 / 9 * safezoneH"; - }; - class Interaction_Background6: Interaction_Background0 { - idc = 46; - x = "(0.5-2.0/16/2 - 1.0 * 0.1) * safezoneW + safezoneX"; - y = "(0.5-0.3/9/2 + 1.5 * 0.04) * safezoneH + safezoneY"; - w = "2.0 / 16 * safezoneW"; - h = "0.3 / 9 * safezoneH"; - }; - class Interaction_Background7: Interaction_Background0 { - idc = 47; - x = "(0.5-2.0/16/2 - 1.25 * 0.1) * safezoneW + safezoneX"; - y = "(0.5-0.3/9/2 + 0.5 * 0.04) * safezoneH + safezoneY"; - w = "2.0 / 16 * safezoneW"; - h = "0.3 / 9 * safezoneH"; - }; - class Interaction_Background8: Interaction_Background0 { - idc = 48; - x = "(0.5-2.0/16/2 - 1.25 * 0.1) * safezoneW + safezoneX"; - y = "(0.5-0.3/9/2 - 0.5 * 0.04) * safezoneH + safezoneY"; - w = "2.0 / 16 * safezoneW"; - h = "0.3 / 9 * safezoneH"; - }; - class Interaction_Background9: Interaction_Background0 { - idc = 49; - x = "(0.5-2.0/16/2 - 1.0 * 0.1) * safezoneW + safezoneX"; - y = "(0.5-0.3/9/2 - 1.5 * 0.04) * safezoneH + safezoneY"; - w = "2.0 / 16 * safezoneW"; - h = "0.3 / 9 * safezoneH"; - }; - - class Interaction_Icon0: ACE_Interaction_Button_Base { - tooltip = ""; - text = ""; - idc = 20; - type = 0; - style = 48; - colorBackground[] = {0,0,0,0}; - x = (0.5-(2.0-ICON_BORDER)/16/2 + 0 * 0.1) * safezoneW + safezoneX; - y = (0.5-(0.3-ICON_BORDER)/9/2 - 2.5 * 0.04) * safezoneH + safezoneY; - w = (0.3-ICON_BORDER) / 16 * safezoneW; - h = (0.3-ICON_BORDER) / 9 * safezoneH; - }; - class Interaction_Icon1: Interaction_Icon0 { - idc = 21; - x = (0.5-(2.0-ICON_BORDER)/16/2 + 1.0 * 0.1) * safezoneW + safezoneX; - y = (0.5-(0.3-ICON_BORDER)/9/2 - 1.5 * 0.04) * safezoneH + safezoneY; - w = (0.3-ICON_BORDER) / 16 * safezoneW; - h = (0.3-ICON_BORDER) / 9 * safezoneH; - }; - class Interaction_Icon2: Interaction_Icon0 { - idc = 22; - x = (0.5-(2.0-ICON_BORDER)/16/2 + 1.25 * 0.1) * safezoneW + safezoneX; - y = (0.5-(0.3-ICON_BORDER)/9/2 - 0.5 * 0.04) * safezoneH + safezoneY; - w = (0.3-ICON_BORDER) / 16 * safezoneW; - h = (0.3-ICON_BORDER) / 9 * safezoneH; - }; - class Interaction_Icon3: Interaction_Icon0 { - idc = 23; - x = (0.5-(2.0-ICON_BORDER)/16/2 + 1.25 * 0.1) * safezoneW + safezoneX; - y = (0.5-(0.3-ICON_BORDER)/9/2 + 0.5 * 0.04) * safezoneH + safezoneY; - w = (0.3-ICON_BORDER) / 16 * safezoneW; - h = (0.3-ICON_BORDER) / 9 * safezoneH; - }; - class Interaction_Icon4: Interaction_Icon0 { - idc = 24; - x = (0.5-(2.0-ICON_BORDER)/16/2 + 1.0 * 0.1) * safezoneW + safezoneX; - y = (0.5-(0.3-ICON_BORDER)/9/2 + 1.5 * 0.04) * safezoneH + safezoneY; - w = (0.3-ICON_BORDER) / 16 * safezoneW; - h = (0.3-ICON_BORDER) / 9 * safezoneH; - }; - class Interaction_Icon5 : Interaction_Icon0 { - idc = 25; - x = (0.5-(2.0-ICON_BORDER)/16/2 + 0 * 0.1) * safezoneW + safezoneX; - y = (0.5-(0.3-ICON_BORDER)/9/2 + 2.5 * 0.04) * safezoneH + safezoneY; - w = (0.3-ICON_BORDER) / 16 * safezoneW; - h = (0.3-ICON_BORDER) / 9 * safezoneH; - }; - class Interaction_Icon6: Interaction_Icon0 { - idc = 26; - x = (0.5-(2.0-ICON_BORDER)/16/2 - 1.0 * 0.1) * safezoneW + safezoneX; - y = (0.5-(0.3-ICON_BORDER)/9/2 + 1.5 * 0.04) * safezoneH + safezoneY; - w = (0.3-ICON_BORDER) / 16 * safezoneW; - h = (0.3-ICON_BORDER) / 9 * safezoneH; - }; - class Interaction_Icon7: Interaction_Icon0 { - idc = 27; - x = (0.5-(2.0-ICON_BORDER)/16/2 - 1.25 * 0.1) * safezoneW + safezoneX; - y = (0.5-(0.3-ICON_BORDER)/9/2 + 0.5 * 0.04) * safezoneH + safezoneY; - w = (0.3-ICON_BORDER) / 16 * safezoneW; - h = (0.3-ICON_BORDER) / 9 * safezoneH; - }; - class Interaction_Icon8: Interaction_Icon0 { - idc = 28; - x = (0.5-(2.0-ICON_BORDER)/16/2 - 1.25 * 0.1) * safezoneW + safezoneX; - y = (0.5-(0.3-ICON_BORDER)/9/2 - 0.5 * 0.04) * safezoneH + safezoneY; - w = (0.3-ICON_BORDER) / 16 * safezoneW; - h = (0.3-ICON_BORDER) / 9 * safezoneH; - }; - class Interaction_Icon9: Interaction_Icon0 { - idc = 29; - x = (0.5-(2.0-ICON_BORDER)/16/2 - 1.0 * 0.1) * safezoneW + safezoneX; - y = (0.5-(0.3-ICON_BORDER)/9/2 - 1.5 * 0.04) * safezoneH + safezoneY; - w = (0.3-ICON_BORDER) / 16 * safezoneW; - h = (0.3-ICON_BORDER) / 9 * safezoneH; - }; - - class Interaction_Shortcut0: ACE_Interaction_Button_Base { - tooltip = ""; - text = ""; - idc = 30; - style = 2; - colorBackground[] = {0,0,0,0}; - x = "(0.5+2.0/16/2-0.3/16 + 0 * 0.1) * safezoneW + safezoneX"; - y = "(0.5-0.3/9/2 - 2.5 * 0.04) * safezoneH + safezoneY"; - w = "0.3 / 16 * safezoneW"; - h = "0.3 / 9 * safezoneH"; - }; - class Interaction_Shortcut1: Interaction_Shortcut0 { - idc = 31; - type = 0; - x = "(0.5+2.0/16/2-0.3/16 + 1.0 * 0.1) * safezoneW + safezoneX"; - y = "(0.5-0.3/9/2 - 1.5 * 0.04) * safezoneH + safezoneY"; - w = "0.3 / 16 * safezoneW"; - h = "0.3 / 9 * safezoneH"; - }; - class Interaction_Shortcut2: Interaction_Shortcut0 { - idc = 32; - type = 0; - x = "(0.5+2.0/16/2-0.3/16 + 1.25 * 0.1) * safezoneW + safezoneX"; - y = "(0.5-0.3/9/2 - 0.5 * 0.04) * safezoneH + safezoneY"; - w = "0.3 / 16 * safezoneW"; - h = "0.3 / 9 * safezoneH"; - }; - class Interaction_Shortcut3: Interaction_Shortcut0 { - idc = 33; - type = 0; - x = "(0.5+2.0/16/2-0.3/16 + 1.25 * 0.1) * safezoneW + safezoneX"; - y = "(0.5-0.3/9/2 + 0.5 * 0.04) * safezoneH + safezoneY"; - w = "0.3 / 16 * safezoneW"; - h = "0.3 / 9 * safezoneH"; - }; - class Interaction_Shortcut4: Interaction_Shortcut0 { - idc = 34; - type = 0; - x = "(0.5+2.0/16/2-0.3/16 + 1.0 * 0.1) * safezoneW + safezoneX"; - y = "(0.5-0.3/9/2 + 1.5 * 0.04) * safezoneH + safezoneY"; - w = "0.3 / 16 * safezoneW"; - h = "0.3 / 9 * safezoneH"; - }; - class Interaction_Shortcut5 : Interaction_Shortcut0 { - idc = 35; - type = 0; - x = "(0.5+2.0/16/2-0.3/16 + 0 * 0.1) * safezoneW + safezoneX"; - y = "(0.5-0.3/9/2 + 2.5 * 0.04) * safezoneH + safezoneY"; - w = "0.3 / 16 * safezoneW"; - h = "0.3 / 9 * safezoneH"; - }; - class Interaction_Shortcut6: Interaction_Shortcut0 { - idc = 36; - type = 0; - x = "(0.5+2.0/16/2-0.3/16 - 1.0 * 0.1) * safezoneW + safezoneX"; - y = "(0.5-0.3/9/2 + 1.5 * 0.04) * safezoneH + safezoneY"; - w = "0.3 / 16 * safezoneW"; - h = "0.3 / 9 * safezoneH"; - }; - class Interaction_Shortcut7: Interaction_Shortcut0 { - idc = 37; - type = 0; - x = "(0.5+2.0/16/2-0.3/16 - 1.25 * 0.1) * safezoneW + safezoneX"; - y = "(0.5-0.3/9/2 + 0.5 * 0.04) * safezoneH + safezoneY"; - w = "0.3 / 16 * safezoneW"; - h = "0.3 / 9 * safezoneH"; - }; - class Interaction_Shortcut8: Interaction_Shortcut0 { - idc = 38; - type = 0; - x = "(0.5+2.0/16/2-0.3/16 - 1.25 * 0.1) * safezoneW + safezoneX"; - y = "(0.5-0.3/9/2 - 0.5 * 0.04) * safezoneH + safezoneY"; - w = "0.3 / 16 * safezoneW"; - h = "0.3 / 9 * safezoneH"; - }; - class Interaction_Shortcut9: Interaction_Shortcut0 { - idc = 39; - type = 0; - x = "(0.5+2.0/16/2-0.3/16 - 1.0 * 0.1) * safezoneW + safezoneX"; - y = "(0.5-0.3/9/2 - 1.5 * 0.04) * safezoneH + safezoneY"; - w = "0.3 / 16 * safezoneW"; - h = "0.3 / 9 * safezoneH"; - }; - - class Interaction_Button0: ACE_Interaction_Button_Base { - action = "0 call ACE_Interaction_fnc_onClick;"; - style = 2; - tooltip = ""; - text = ""; - idc = 10; - colorBackground[] = {0,0,0,0}; - colorBackgroundDisabled[] = {0,0,0,0}; - colorBackgroundActive[] = {1,1,1,0.2}; - colorFocused[] = {0,0,0,0}; - x = "(0.5-2.0/16/2 + 0 * 0.1) * safezoneW + safezoneX"; - y = "(0.5-0.3/9/2 - 2.5 * 0.04) * safezoneH + safezoneY"; - w = "2.0 / 16 * safezoneW"; - h = "0.3 / 9 * safezoneH"; - }; - class Interaction_Button1: Interaction_Button0 { - action = "1 call ACE_Interaction_fnc_onClick;"; - idc = 11; - x = "(0.5-2.0/16/2 + 1.0 * 0.1) * safezoneW + safezoneX"; - y = "(0.5-0.3/9/2 - 1.5 * 0.04) * safezoneH + safezoneY"; - w = "2.0 / 16 * safezoneW"; - h = "0.3 / 9 * safezoneH"; - }; - class Interaction_Button2: Interaction_Button0 { - action = "2 call ACE_Interaction_fnc_onClick;"; - idc = 12; - x = "(0.5-2.0/16/2 + 1.25 * 0.1) * safezoneW + safezoneX"; - y = "(0.5-0.3/9/2 - 0.5 * 0.04) * safezoneH + safezoneY"; - w = "2.0 / 16 * safezoneW"; - h = "0.3 / 9 * safezoneH"; - }; - class Interaction_Button3: Interaction_Button0 { - action = "3 call ACE_Interaction_fnc_onClick;"; - idc = 13; - x = "(0.5-2.0/16/2 + 1.25 * 0.1) * safezoneW + safezoneX"; - y = "(0.5-0.3/9/2 + 0.5 * 0.04) * safezoneH + safezoneY"; - w = "2.0 / 16 * safezoneW"; - h = "0.3 / 9 * safezoneH"; - }; - class Interaction_Button4: Interaction_Button0 { - action = "4 call ACE_Interaction_fnc_onClick;"; - idc = 14; - x = "(0.5-2.0/16/2 + 1.0 * 0.1) * safezoneW + safezoneX"; - y = "(0.5-0.3/9/2 + 1.5 * 0.04) * safezoneH + safezoneY"; - w = "2.0 / 16 * safezoneW"; - h = "0.3 / 9 * safezoneH"; - }; - class Interaction_Button5: Interaction_Button0 { - action = "5 call ACE_Interaction_fnc_onClick;"; - idc = 15; - x = "(0.5-2.0/16/2 + 0 * 0.1) * safezoneW + safezoneX"; - y = "(0.5-0.3/9/2 + 2.5 * 0.04) * safezoneH + safezoneY"; - w = "2.0 / 16 * safezoneW"; - h = "0.3 / 9 * safezoneH"; - }; - class Interaction_Button6: Interaction_Button0 { - action = "6 call ACE_Interaction_fnc_onClick;"; - idc = 16; - x = "(0.5-2.0/16/2 - 1.0 * 0.1) * safezoneW + safezoneX"; - y = "(0.5-0.3/9/2 + 1.5 * 0.04) * safezoneH + safezoneY"; - w = "2.0 / 16 * safezoneW"; - h = "0.3 / 9 * safezoneH"; - }; - class Interaction_Button7: Interaction_Button0 { - action = "7 call ACE_Interaction_fnc_onClick;"; - idc = 17; - x = "(0.5-2.0/16/2 - 1.25 * 0.1) * safezoneW + safezoneX"; - y = "(0.5-0.3/9/2 + 0.5 * 0.04) * safezoneH + safezoneY"; - w = "2.0 / 16 * safezoneW"; - h = "0.3 / 9 * safezoneH"; - }; - class Interaction_Button8: Interaction_Button0 { - action = "8 call ACE_Interaction_fnc_onClick;"; - idc = 18; - x = "(0.5-2.0/16/2 - 1.25 * 0.1) * safezoneW + safezoneX"; - y = "(0.5-0.3/9/2 - 0.5 * 0.04) * safezoneH + safezoneY"; - w = "2.0 / 16 * safezoneW"; - h = "0.3 / 9 * safezoneH"; - }; - class Interaction_Button9: Interaction_Button0 { - action = "9 call ACE_Interaction_fnc_onClick;"; - idc = 19; - x = "(0.5-2.0/16/2 - 1.0 * 0.1) * safezoneW + safezoneX"; - y = "(0.5-0.3/9/2 - 1.5 * 0.04) * safezoneH + safezoneY"; - w = "2.0 / 16 * safezoneW"; - h = "0.3 / 9 * safezoneH"; - }; - }; -}; - class RscListbox; class IGUIBack; class RscText; @@ -518,75 +154,6 @@ class RscInteractionText: RscText{ h = 1.5 * GUI_GRID_H; }; class RscTitles { - class ACE_FlowMenu { - idd = 9920; - enableSimulation = 1; - movingEnable = 0; - fadeIn=0.5; - fadeOut=0.5; - duration = 10e10; - onLoad = "uiNamespace setVariable ['ACE_Flow_Display', _this select 0];"; - - class controls { - class RearIcon: RscInteractionIcon{ - idc = 999; - text = PATHTOF(UI\CenterIcon_ca.paa); - x = 17.9 * GUI_GRID_W; - y = 10 * GUI_GRID_H; - w = 3.7 * GUI_GRID_H; - h = 5.75 * GUI_GRID_H; - }; - class TopIcon: RscInteractionIcon{ - idc = 1200; - h = 1 * GUI_GRID_H; - y = 9 * GUI_GRID_H; - }; - class FirstIcon: RscInteractionIcon{ - idc = 1201; - y = 10.25 * GUI_GRID_H; - h = 1.5 * GUI_GRID_H; - }; - class SelectedItemIcon: RscInteractionIcon{ - idc = 1202; - y = 12 * GUI_GRID_H; - }; - class ThirdIcon: RscInteractionIcon{ - idc = 1203; - y = 14.25 * GUI_GRID_H; - h = 1.5 * GUI_GRID_H; - }; - class BottomIcon: TopIcon{ - idc = 1204; - y = 16 * GUI_GRID_H; - }; - class ItemName: RscText{ - idc = 1000; - style = 0x01; - x = 5.25 * GUI_GRID_W; - y = 12.15 * GUI_GRID_H; - w = 13 * GUI_GRID_W; - h = 1.5 * GUI_GRID_H; - colorBackground[] = {0.3, 0.3, 0.3, 0.8}; - }; - class BackIcon: RscInteractionIcon{ - idc = 1210; - text = PATHTOF(UI\backArrow_ca.paa); - x = 18.25 * GUI_GRID_W; - y = 12.69 * GUI_GRID_H; - w = 0.5 * GUI_GRID_W; - h = 0.5 * GUI_GRID_H; - }; - class ItemDetails: RscStructuredText{ - idc = 1100; - style = 0x0c; - x = 23.5 * GUI_GRID_W; - y = 11 * GUI_GRID_H; - w = 13 * GUI_GRID_W; - h = 3.9 * GUI_GRID_H; - colorBackground[] = {0, 0, 0, 0.4}; - }; - }; - }; class GVAR(InteractionHelper) { idd = 9930; enableSimulation = 1; diff --git a/addons/interaction/XEH_clientInit.sqf b/addons/interaction/XEH_clientInit.sqf index 047e528ad6..85232d1fcd 100644 --- a/addons/interaction/XEH_clientInit.sqf +++ b/addons/interaction/XEH_clientInit.sqf @@ -16,78 +16,6 @@ GVAR(isOpeningDoor) = false; // Add keybinds -["ACE3", - localize "STR_ACE_Interaction_InteractionMenu", - { - // Conditions: canInteract - _exceptions = ["ACE_Drag_isNotDragging", "ACE_Medical_canTreat", QEGVAR(captives,isNotEscorting), "ACE_Interaction_isNotSwimming"]; - if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; - // Conditions: specific - if !(isNull (findDisplay 1713999)) exitWith {false}; - - // Statement - call FUNC(onButtonDown); - true - }, - [219, [false, false, false]], - false, - "keydown" -] call cba_fnc_registerKeybind; - -["ACE3", - localize "STR_ACE_Interaction_InteractionMenu", - { - // Conditions: canInteract - _exceptions = ["ACE_Drag_isNotDragging", "ACE_Medical_canTreat", QEGVAR(captives,isNotEscorting), "ACE_Interaction_isNotSwimming"]; - if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; - // Conditions: specific - if !(!isNull (findDisplay 1713999) && {QGVAR(AutoCloseMenu)}) exitWith {false}; - - // Statement - if (GVAR(MenuType) mod 2 == 0) then {call FUNC(onButtonUp)}; - true - }, - [219, [false, false, false]], - false, - "keyup" -] call cba_fnc_registerKeybind; - -["ACE3", - localize "STR_ACE_Interaction_InteractionMenuSelf", - { - // Conditions: canInteract - _exceptions = ["ACE_Drag_isNotDragging", "ACE_Medical_canTreat", QEGVAR(captives,isNotEscorting), QEGVAR(captives,isNotSurrendering), "ACE_Interaction_isNotSwimming", "ACE_Common_notOnMap"]; - if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; - // Conditions: specific - if !(isNull (findDisplay 1713999)) exitWith {false}; - - // Statement - call FUNC(onButtonDownSelf); - true - }, - [219, [false, true, false]], - false, - "keydown" -] call cba_fnc_registerKeybind; - -["ACE3", - localize "STR_ACE_Interaction_InteractionMenuSelf", - { - // Conditions: canInteract - _exceptions = ["ACE_Drag_isNotDragging", "ACE_Medical_canTreat", QEGVAR(captives,isNotEscorting), QEGVAR(captives,isNotSurrendering), "ACE_Interaction_isNotSwimming"]; - if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; - // Conditions: specific - if !(!isNull (findDisplay 1713999) && {QGVAR(AutoCloseMenu)}) exitWith {false}; - - // Statement - if (GVAR(MenuType) mod 2 == 1) then {call FUNC(onButtonUp)}; - true - }, - [219, [false, true, false]], - false, - "keyup" -] call cba_fnc_registerKeybind; - ["ACE3", localize "STR_ACE_Interaction_OpenDoor", { diff --git a/addons/interaction/XEH_preInit.sqf b/addons/interaction/XEH_preInit.sqf index bcb8103ea2..6efa72778e 100644 --- a/addons/interaction/XEH_preInit.sqf +++ b/addons/interaction/XEH_preInit.sqf @@ -2,49 +2,30 @@ ADDON = false; -PREP(addInteraction); -PREP(addInteractionSelf); PREP(addSelectableItem); -PREP(addToTooltip); PREP(applyButtons); -PREP(canInteractWith); +PREP(canInteractWithCivilian); PREP(canTapShoulder); -PREP(getActions); -PREP(getActions2); PREP(getDoor); PREP(getDoorAnimations); PREP(getDown); PREP(getSelectedButton); PREP(hideMenu); PREP(hideMouseHint); -PREP(initialiseInteraction); PREP(isInRange); PREP(joinTeam); -PREP(menuKeyInput); PREP(moduleInteraction); PREP(moveDown); -PREP(onButtonDown); -PREP(onButtonDownSelf); -PREP(onButtonUp); -PREP(onClick); PREP(onSelectMenuDblClick); PREP(openDoor); -PREP(openMenu); PREP(openMenuSelectUI); -PREP(openMenuSelf); PREP(openSelectMenu); -PREP(openSubMenu); -PREP(openSubMenuSelf); PREP(prepareSelectMenu); PREP(push); -PREP(removeInteraction); -PREP(removeInteractionSelf); PREP(removeTag); PREP(sendAway); -PREP(showMenu); PREP(showMouseHint); PREP(sortOptionsByPriority); PREP(tapShoulder); -PREP(updateTooltipPosition); ADDON = true; diff --git a/addons/interaction/config.cpp b/addons/interaction/config.cpp index 90db08e9e2..c9cfd2c0b4 100644 --- a/addons/interaction/config.cpp +++ b/addons/interaction/config.cpp @@ -19,24 +19,6 @@ class CfgPatches { #include class ACE_Settings { - class GVAR(FlowMenu) { - value = 0; - typeName = "BOOL"; - isClientSetable = 1; - displayName = "$STR_ACE_Interaction_FlowMenu"; - }; - class GVAR(AutoCloseMenu) { - value = 0; - typeName = "BOOL"; - isClientSetable = 1; - displayName = "$STR_ACE_Interaction_AutoCloseMenu"; - }; - class GVAR(AutoCenterCursor) { - value = 1; - typeName = "BOOL"; - isClientSetable = 1; - displayName = "$STR_ACE_Interaction_AutoCenterCursor"; - }; class GVAR(EnableTeamManagement) { value = 1; typeName = "BOOL"; diff --git a/addons/interaction/functions/fnc_AddSelectableItem.sqf b/addons/interaction/functions/fnc_AddSelectableItem.sqf index 1e3065d234..966c4fe043 100644 --- a/addons/interaction/functions/fnc_AddSelectableItem.sqf +++ b/addons/interaction/functions/fnc_AddSelectableItem.sqf @@ -29,13 +29,8 @@ if (_picture == "" || _picture == "PictureThing") then { _picture = QUOTE(PATHTOF(UI\dot_ca.paa)); }; -if ((profileNamespace getVariable [QGVAR(FlowMenu), false])) then { - //[_displayName, _statement, _condition, _priority, _subMenu, _icon, _tooltip, _conditionShow, _exceptions, _distance, _hotkey] - _container pushBack [_displayName, nil, {true},0,[], _picture, "", {true}, [], 4, "", _data]; -}else{ - _index = lbAdd [_container, _displayName]; - lbSetData [_container, _index, str _data]; - lbSetPicture [_container, _index, _picture]; -}; +_index = lbAdd [_container, _displayName]; +lbSetData [_container, _index, str _data]; +lbSetPicture [_container, _index, _picture]; _container diff --git a/addons/interaction/functions/fnc_GetActions.sqf b/addons/interaction/functions/fnc_GetActions.sqf deleted file mode 100644 index 67386331c1..0000000000 --- a/addons/interaction/functions/fnc_GetActions.sqf +++ /dev/null @@ -1,154 +0,0 @@ -/* - Author: - commy2 - Garth de Wet (LH) - - Description: - - Parameters: - 0: OBJECT - target - 1: ARRAY - Parents of the target object - 2: ARRAY - Actions - 3: ARRAY - Patches - 4: CONFIG - Parent config (ConfigFile >> "CfgVehicles"/MissionConfigFile >> "CfgVehicles") - 5: BOOL - Is mission config file? - 6: STRING - Classname ("ACE_Actions"/"ACE_SelfActions") - 7: STRING - Sub-class - - Returns: - Nothing - - Example: - [player, [configfile >> "CfgVehicles" >> typeOf player, true] call BIS_fnc_returnParents, [], [],configfile >> "CfgVehicles", false, "ACE_Actions"] call ACE_Interaction_fnc_GetActions; - - [player, [configfile >> "CfgVehicles" >> typeOf player, true] call BIS_fnc_returnParents, [], [],configfile >> "CfgVehicles", false, "ACE_SelfActions"] call ACE_Interaction_fnc_GetActions; -*/ -#include "script_component.hpp" - -#define DEFAULT_ICON QUOTE(PATHTOF(UI\dot_ca.paa)) -private ["_target", "_parents", "_actions", "_patches", "_baseConfig", "_actionType", "_i","_index", "_missionConfig", "_stdConfig"]; -_target = _this select 0; -_parents = _this select 1; -_actions = _this select 2; -_patches = _this select 3; -_baseConfig = _this select 4; -_missionConfig = _this select 5; -_actionType = _this select 6; -_subClass = _this select 7; - -_stdConfig = (configFile >> "CfgVehicles" >> typeOf _target >> _actionType); -if (_subClass != "") then { - _stdConfig = _stdConfig >> _subClass; -}; - -_count = count _parents; -for "_i" from 0 to (_count - 1) do { - _config = _baseConfig >> _parents select _i >> _actionType; - if (_subClass != "") then { - _config = _config >> _subClass; - }; - - _count = count _config; - if (_count > 0) then { - for "_index" from 0 to (_count - 1) do { - private ["_action", "_displayName", "_distance","_condition","_statement","_showDisabled", "_priority", "_tooltip", "_hotkey", - "_subMenu", "_conditionShow", "_exceptions", "_icon", "_actionToCache", "_cacheActions", "_cache", "_indexCache", "_configName"]; - _action = if (_missionConfig) then {_config select _index} else {_stdConfig >> configName (_config select _index)}; - _cache = missionNamespace getVariable [QGVAR(MenuCache), [[], [], []]]; - - if (count _action > 0) then { - _configName = configName _action; - - _cacheConfigs = _cache select 0; - _cacheActions = _cache select 1; - _cacheIndices = _cache select 2; - - _indexCache = _cacheConfigs find _action; - if (_indexCache == -1) then { - _displayName = getText (_action >> "displayName"); - _distance = getNumber (_action >> "distance"); - _priority = getNumber (_action >> "priority"); - _subMenu = getArray (_action >> "subMenu"); - _tooltip = getText (_action >> "tooltip"); - _hotkey = getText (_action >> "hotkey"); - _enableInside = getNumber (_action >> "enableInside"); - - // Condition - _condition = getText (_action >> "condition"); - if (_condition == "") then {_condition = "true"}; - - _condition = _condition + format [QUOTE( && {%1 call EGVAR(common,canInteract)} && {[ARR_2(ACE_player, GVAR(Target))] call EFUNC(common,canInteractWith)} ), getArray (_action >> "exceptions")]; - if (_enableInside != 1) then {_condition = _condition + " && {_player == _vehicle}"}; - - _condition = compile _condition; - - // Condition to show the action - _conditionShow = getText (_action >> "conditionShow"); - _conditionShow = if (_conditionShow == "") then {{true}} else {compile _conditionShow}; - - _showDisabled = getNumber (_action >> "showDisabled") == 1; - if (isText (_action >> "conditionShow")) then { - _showDisabled = [_object, _player] call _conditionShow; - }; - - // Exceptions to the general conditions that have to be true - _exceptions = getArray (_action >> "exceptions"); - - // statement - _statement = getText (_action >> "statement"); - _statement = compile _statement; - - if (profileNamespace getVariable [QGVAR(FlowMenu), false]) then { - _statement = if (getText (_action >> "statement") == "" && {count _subMenu > 1}) then { - compile format [QUOTE( call FUNC(hideMenu);if(%2 == 1)then{['%1'] call FUNC(openSubMenuSelf);}else{['%1'] call FUNC(openSubMenu);}; ), _subMenu select 0, _subMenu select 1]; - } else { - compile (QUOTE( call FUNC(hideMenu); ) + getText (_action >> "statement")); - }; - }; - - // icon - _icon = getText (_action >> "Icon"); - if (_icon == "") then { - _icon = DEFAULT_ICON; - }; - - _actionToCache = [_displayName, _statement, _condition, _priority, _subMenu, _icon, _tooltip, _conditionShow, _exceptions, _distance, _hotkey]; - - if (!(_configName in _patches) && {_showDisabled || {[_object, _player] call _condition}} && {_distance == 0 || {[_object, _distance] call FUNC(isInRange)}}) then { - _actions pushBack _actionToCache; - _patches pushBack _configName; - }; - - _indexCache = _cacheActions find _actionToCache; - if (_indexCache == -1) then { - _indexCache = count _cacheActions; - _cacheActions pushBack _actionToCache; - }; - - _cacheConfigs pushBack _action; - _cacheIndices pushBack _indexCache; - - _cache = [_cacheConfigs, _cacheActions, _cacheIndices]; - ["InteractionMenu", _action, {format ["%1 loaded into cache", _this]}] call EFUNC(common,log); - } else { - ["InteractionMenu", _action, {format ["%1 loaded from cache", _this]}] call EFUNC(common,log); - - _cachedAction = _cacheActions select (_cacheIndices select _indexCache); - - _showDisabled = getNumber (_action >> "showDisabled") == 1; - if (isText (_action >> "conditionShow")) then { - _showDisabled = [_object, _player] call (_cachedAction select 7); - }; - - if (!(_configName in _patches) && {_showDisabled || {[_object, _player] call (_cachedAction select 2)}} && {[_object, (_cachedAction select 9)] call FUNC(isInRange) || {(_cachedAction select 9) == 0}}) then { - _actions pushBack _cachedAction; - _patches pushBack _configName; - }; - }; - }; - - GVAR(MenuCache) = _cache; - }; - }; -}; -[_actions, _patches] diff --git a/addons/interaction/functions/fnc_addInteraction.sqf b/addons/interaction/functions/fnc_addInteraction.sqf deleted file mode 100644 index 5e8889891d..0000000000 --- a/addons/interaction/functions/fnc_addInteraction.sqf +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Author: commy2 - * - * Add an ACE action to an object. Note: This function is global. - * - * Argument: - * 0: Object the action should be assigned to (Object) - * 1: Name of the action shown in the menu (String) - * 2: Distance the player can be away from the object (Number) - * 3: Condition (Code or String) - * 4: Statement (Code or String) - * 5: Show the action even if the conditon is not met (Bool or Number) - * 6: Priority (Number, optional default: 0) - * - * Return value: - * ID of the action (used to remove it later). - */ - -#include "script_component.hpp" - -private ["_object", "_displayName", "_distance", "_condition", "_statement", "_showDisabled", "_priority", "_actionsVar", "_id", "_actionIDs", "_actions"]; - -_object = _this select 0; -_displayName = _this select 1; -_distance = _this select 2; -_condition = _this select 3; -_statement = _this select 4; -_showDisabled = _this select 5; -_priority = _this select 6; - -if (typeName _condition == "STRING") then { - _condition = compile _condition; -}; - -if (typeName _statement == "STRING") then { - _statement = compile _statement; -}; - -if (typeName _showDisabled == "SCALAR") then { - _showDisabled = _showDisabled > 0; -}; - -if (isNil "_priority") then { - _priority = 0; -}; - -_actionsVar = _object getVariable [QGVAR(Interactions), [-1, [], []]]; - -_id = (_actionsVar select 0) + 1; -_actionIDs = _actionsVar select 1; -_actions = _actionsVar select 2; - -_actionIDs pushBack _id; -_actions pushBack [_displayName, _distance, _condition, _statement, _showDisabled, _priority]; - -_object setVariable [QGVAR(Interactions), [_id, _actionIDs, _actions], true]; -_id diff --git a/addons/interaction/functions/fnc_addInteractionSelf.sqf b/addons/interaction/functions/fnc_addInteractionSelf.sqf deleted file mode 100644 index 48773fcb99..0000000000 --- a/addons/interaction/functions/fnc_addInteractionSelf.sqf +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Author: commy2 - * - * Add an ACE self action to the player. Execute this on the local machine of the player. - * - * Argument: - * 0: Name of the action shown in the menu (String) - * 1: Condition (Code or String) - * 2: Statement (Code or String) - * 3: Show the action even if the conditon is not met (Bool or Number) - * 4: Priority (Number, optional default: 0) - * - * Return value: - * ID of the action (used to remove it later). - */ - -#include "script_component.hpp" - -private ["_displayName", "_condition", "_statement", "_showDisabled", "_priority", "_actionsVar", "_id", "_actionIDs", "_actions"]; - - -_displayName = _this select 0; - -_condition = _this select 1; -_statement = _this select 2; -_showDisabled = _this select 3; -_priority = _this select 4; - -if (typeName _condition == "STRING") then { - _condition = compile _condition; -}; - -if (typeName _statement == "STRING") then { - _statement = compile _statement; -}; - -if (typeName _showDisabled == "SCALAR") then { - _showDisabled = _showDisabled > 0; -}; - -if (isNil "_priority") then { - _priority = 0; -}; - -_actionsVar = ACE_player getVariable [QGVAR(InteractionsSelf), [-1, [], []]]; - -_id = (_actionsVar select 0) + 1; -_actionIDs = _actionsVar select 1; -_actions = _actionsVar select 2; - -_actionIDs pushBack _id; -_actions pushBack [_displayName, _condition, _statement, _showDisabled, _priority]; - -ACE_player setVariable [QGVAR(InteractionsSelf), [_id, _actionIDs, _actions], false]; -_id diff --git a/addons/interaction/functions/fnc_addToTooltip.sqf b/addons/interaction/functions/fnc_addToTooltip.sqf deleted file mode 100644 index 9f5595a9bc..0000000000 --- a/addons/interaction/functions/fnc_addToTooltip.sqf +++ /dev/null @@ -1,5 +0,0 @@ -// by commy2 - -#include "script_component.hpp" - -GVAR(CurrentTooltip) pushBack (_this select 0); diff --git a/addons/interaction/functions/fnc_canInteractWith.sqf b/addons/interaction/functions/fnc_canInteractWithCivilian.sqf similarity index 61% rename from addons/interaction/functions/fnc_canInteractWith.sqf rename to addons/interaction/functions/fnc_canInteractWithCivilian.sqf index 5a47782546..6408d66aa8 100644 --- a/addons/interaction/functions/fnc_canInteractWith.sqf +++ b/addons/interaction/functions/fnc_canInteractWithCivilian.sqf @@ -2,13 +2,10 @@ #include "script_component.hpp" -private ["_unit", "_isCivilian"]; - -_unit = _this select 0; -_isCivilian = _this select 1; +EXPLODE_2_PVT(_this,_unit,_isCivilian); if (isNil "_isCivilian") then {_isCivilian = true}; alive _unit && [side _unit != side ACE_player, side group _unit == civilian] select _isCivilian -//&& {count (weapons _unit) == 0} +//&& {count (weapons _unit) == 0} \ No newline at end of file diff --git a/addons/interaction/functions/fnc_getActions2.sqf b/addons/interaction/functions/fnc_getActions2.sqf deleted file mode 100644 index 0de4f7a534..0000000000 --- a/addons/interaction/functions/fnc_getActions2.sqf +++ /dev/null @@ -1,121 +0,0 @@ -// commy2 -#include "script_component.hpp" - -private ["_object", "_config", "_type", "_actions", "_configs"]; - -_object = _this select 0; -_config = _this select 1; // configFile, missionConfigFile -_type = _this select 2; // "ACE_CfgInteractions", "ACE_CfgInteractionsSelf" -_actions = _this select 3; // []; - -_configs = "_object isKindOf configName _x" configClasses (_config >> _type); - -// cache -private ["_cache", "_cacheConfigs", "_cacheActions", "_cacheIndices"]; - -_cache = uiNamespace getVariable [QGVAR(MenuCache), [[], [], []]]; -_cacheConfigs = _cache select 0; -_cacheActions = _cache select 1; -_cacheIndices = _cache select 2; - -// get interactions -{ - private "_configActions"; - - _configActions = "true" configClasses (_config >> _type >> configName _x); - { - private ["_action", "_configName", "_indexCache"]; - - _action = _x; - _configName = configName _action; - - _indexCache = _cacheConfigs find _action; - if (_indexCache == -1) then { - private ["_displayName", "_distance", "_priority", "_subMenu", "_tooltip", "_hotkey", "_enableInside", "_condition", "_conditionShow", "_showDisabled", "_exceptions", "_statement", "_icon"]; - - _displayName = getText (_action >> "displayName"); - _distance = getNumber (_action >> "distance"); - _priority = getNumber (_action >> "priority"); - _subMenu = getArray (_action >> "subMenu"); - _tooltip = getText (_action >> "tooltip"); - _hotkey = getText (_action >> "hotkey"); - _enableInside = getNumber (_action >> "enableInside"); - - // Condition - _condition = getText (_action >> "condition"); - if (_condition == "") then {_condition = "true"}; - - _condition = _condition + format [QUOTE(&& {%1 call EFUNC(common,canInteract)} && {[ARR_2(ACE_player, GVAR(Target))] call FUNC(canInteractWith)}), getArray (_action >> "exceptions")]; - if (_enableInside != 1) then {_condition = _condition + " && {_player == _vehicle}"}; - - _condition = compile _condition; - - // Condition to show the action - _conditionShow = getText (_action >> "conditionShow"); - _conditionShow = if (_conditionShow == "") then {{true}} else {compile _conditionShow}; - - _showDisabled = getNumber (_action >> "showDisabled") == 1; - if (isText (_action >> "conditionShow")) then { - _showDisabled = [_object, _player] call _conditionShow; - }; - - // Exceptions to the general conditions that have to be true - _exceptions = getArray (_action >> "exceptions"); - - // statement - _statement = getText (_action >> "statement"); - _statement = compile _statement; - - if (GVAR(FlowMenu)) then { - _statement = if (getText (_action >> "statement") == "" && {count _subMenu > 1}) then { - compile format [QUOTE( call FUNC(hideMenu);if(%2 == 1)then{['%1'] call FUNC(openSubMenuSelf);}else{['%1'] call FUNC(openSubMenu);}; ), _subMenu select 0, _subMenu select 1]; - } else { - compile (QUOTE( call FUNC(hideMenu); ) + getText (_action >> "statement")); - }; - }; - - // icon - _icon = getText (_action >> "Icon"); - if (_icon == "") then { - _icon = DEFAULT_ICON; - }; - - private "_actionToCache"; - _actionToCache = [_displayName, _statement, _condition, _priority, _subMenu, _icon, _tooltip, _conditionShow, _exceptions, _distance, _hotkey]; - - if ((_showDisabled || {[_object, _player] call _condition}) && {_distance == 0 || {[_object, _distance] call FUNC(isInRange)}}) then { - _actions pushBack _actionToCache; - }; - - _indexCache = _cacheActions find _actionToCache; - if (_indexCache == -1) then { - _indexCache = count _cacheActions; - _cacheActions pushBack _actionToCache; - }; - - _cacheConfigs pushBack _action; - _cacheIndices pushBack _indexCache; - - _cache = [_cacheConfigs, _cacheActions, _cacheIndices]; - ["InteractionMenu", _action, {format ["%1 loaded into cache", _this]}] call EFUNC(common,log); - } else { - ["InteractionMenu", _action, {format ["%1 loaded from cache", _this]}] call EFUNC(common,log); - - private ["_cachedAction", "_showDisabled"]; - _cachedAction = _cacheActions select (_cacheIndices select _indexCache); - - _showDisabled = getNumber (_action >> "showDisabled") == 1; - if (isText (_action >> "conditionShow")) then { - _showDisabled = [_object, _player] call (_cachedAction select 7); - }; - - if ((_showDisabled || {[_object, _player] call (_cachedAction select 2)}) && {[_object, (_cachedAction select 9)] call FUNC(isInRange) || {(_cachedAction select 9) == 0}}) then { - _actions pushBack _cachedAction; - }; - }; - } forEach _configActions; //Actions of this CfgVehicles class -} forEach _configs; //CfgVehicles class - -uiNamespace setVariable [QGVAR(MenuCache), _cache]; - -_actions diff --git a/addons/interaction/functions/fnc_initialiseInteraction.sqf b/addons/interaction/functions/fnc_initialiseInteraction.sqf deleted file mode 100644 index 4d88eb4ea1..0000000000 --- a/addons/interaction/functions/fnc_initialiseInteraction.sqf +++ /dev/null @@ -1,167 +0,0 @@ -/* - Author: - commy2 - Garth de Wet (LH) - - Description: - Initialises the interaction click handlers. - - Parameters: - 0 : CODE - code to call when right clicking/center button - 1 : BOOLEAN - Submenu - 2 : BOOLEAN - Flow Menu - 3 : BOOLEAN - Self interaction - 4 : OBJECT - Target - - Returns: - Nothing - - Example: - [{"Default" call FUNC(openMenu);}, true, (profileNamespace getVariable [QGVAR(FlowMenu), false]), GVAR(Target)] call FUNC(initialiseInteraction); -*/ -#include "script_component.hpp" - -private ["_subMenu", "_selfMenu", "_target"]; -GVAR(MainButton) = _this select 0; -_subMenu = _this select 1; -_selfMenu = _this select 3; -_target = _this select 4; - -_player = ACE_player; -_vehicle = vehicle _player; -//_object = [GVAR(Target), _player] select (GVAR(MenuType) % 2 == 1); - -if !([_target, 5] call FUNC(isInRange)) exitWith {}; - -GVAR(Shortcuts) = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1]; - -// Flow menu -if (_this select 2) then { - (QGVAR(FlowMenu) call BIS_fnc_rscLayer) cutRsc [QGVAR(FlowMenu), "PLAIN",0.5, false]; - ACE_Interaction_SelectedButton = 0; - (findDisplay 1713999) closeDisplay 1; - if (_player getVariable ["ACE_AcceptAction", -1] == -1) then { - [{if(isNil {GVAR(MainButton)} || {!(profileNamespace getVariable [QGVAR(FlowMenu), false])})exitWith{false};(-(_this select 0) / 1.2) call FUNC(MoveDown);true}] call EFUNC(common,addScrollWheelEventHandler); - - _player setVariable ["ACE_AcceptAction", [_player, "DefaultAction", {(!isNil {GVAR(MainButton)}) && {(profileNamespace getVariable [QGVAR(FlowMenu), false])}}, {_action = GVAR(Buttons) select ACE_Interaction_SelectedButton;_target = GVAR(Target);_player = ACE_player;_vehicle = vehicle _player;if ([_target, _player] call (_action select 2)) then {call FUNC(hideMenu);if(count _action == 12) then{(_action select 11) call (_action select 1);}else{[_target, _player] call (_action select 1);};};}] call EFUNC(common,addActionEventHandler)]; - _player setVariable ["ACE_AcceptAction", [_player, "menuBack", {(!isNil {GVAR(MainButton)}) && {(profileNamespace getVariable [QGVAR(FlowMenu), false])}}, {call GVAR(MainButton);}] call EFUNC(common,addActionEventHandler)]; - }; - 0 call FUNC(moveDown); - [localize "STR_ACE_Interaction_MakeSelection", if (_subMenu)then{localize "STR_ACE_Interaction_Back"}else{""}, localize "STR_ACE_Interaction_ScrollHint"] call FUNC(showMouseHint); - ((uiNamespace getVariable QGVAR(Flow_Display)) displayCtrl (1210)) ctrlShow _subMenu; -}else{ // Rose - if (!isNull(uiNamespace getVariable QGVAR(Flow_Display))) then { - (uiNameSpace getVariable QGVAR(Flow_Display)) closeDisplay 0; - call FUNC(hideMouseHint); - }; - if (!_subMenu || {isNull (findDisplay 1713999)}) then { - (findDisplay 1713999) closeDisplay 1; - - (findDisplay 46) createDisplay QGVAR(Dialog); - // Add eventhandlers - /*(findDisplay 1713999) displayAddEventHandler ["KeyDown", QUOTE(_this call EGVAR(common,onKeyDown))]; - (findDisplay 1713999) displayAddEventHandler ["KeyUp", QUOTE(_this call EGVAR(common,onKeyUp))];*/ - - (findDisplay 1713999) displayAddEventHandler ["KeyDown", QUOTE(_this call FUNC(menuKeyInput))]; - }; - disableSerialization; - _dlgInteractionDialog = uiNamespace getVariable QGVAR(Dialog); - _ctrlInteractionDialog = _dlgInteractionDialog displayCtrl 3; - if (GVAR(AutoCenterCursor)) then {setMousePosition [0.5, 0.5]}; - if !(_subMenu) then { - _ctrlInteractionDialog ctrlSetText ([_target] call EFUNC(common,getName)); - } else { - _ctrlInteractionDialog ctrlSetText localize "STR_ACE_Interaction_Back"; - }; - - _buttons = GVAR(Buttons); - _count = count _buttons; - - for "_i" from 0 to 9 do { - _ctrlInteractionDialog = _dlgInteractionDialog displayCtrl (10 + _i); - _ctrlInteractionDialog ctrlShow true; - - _ctrlInteractionDialogIcon = _dlgInteractionDialog displayCtrl (20 + _i); - _ctrlInteractionDialogShortcut = _dlgInteractionDialog displayCtrl (30 + _i); - //_ctrlInteractionDialogBackground = _dlgInteractionDialog displayCtrl (40 + _i); - if (_i < _count) then { - _action = _buttons select _i; - _ctrlInteractionDialog ctrlSetText (_action select 0); - _ctrlInteractionDialog ctrlEnable ([_target, _player] call (_action select 2)); - _ctrlInteractionDialog ctrlSetTooltip (_action select 6); - - _ctrlInteractionDialogIcon ctrlSetText (_action select 5); - _ctrlInteractionDialogShortcut ctrlSetText (_action select 10); - //_ctrlInteractionDialogBackground ctrlShow true; - - GVAR(Shortcuts) set [_i, [_action select 10] call EFUNC(common,letterToCode)]; - } else { - _ctrlInteractionDialog ctrlSetText ""; - _ctrlInteractionDialog ctrlEnable false; - _ctrlInteractionDialog ctrlSetTooltip ""; - - _ctrlInteractionDialogIcon ctrlSetText ""; - _ctrlInteractionDialogShortcut ctrlSetText ""; - //_ctrlInteractionDialogBackground ctrlShow false; - }; - }; - - // Update Buttons - terminate (missionNamespace getVariable [QGVAR(updateMenuHandle), scriptNull]); - - GVAR(updateMenuHandle) = 0 spawn { - disableSerialization; - _dlgMenu = uiNamespace getVariable [QGVAR(Dialog), displayNull]; - _ctrlTooltip = _dlgMenu displayCtrl 40; - - _player = ACE_player; - _vehicle = vehicle _player; - _target = [GVAR(Target), _player] select (GVAR(MenuType) % 2 == 1); - - waitUntil { - if !([_target, 5] call FUNC(isInRange)) exitWith { - (findDisplay 1713999) closeDisplay 1 - }; - - GVAR(Tooltips) = [[], [], [], [], [], [], [], [], [], []]; - { - _ctrlText = _dlgMenu displayCtrl (10 + _forEachIndex); - _ctrlIcon = _dlgMenu displayCtrl (20 + _forEachIndex); - - _condition = _x select 2; - _conditionShow = _x select 7; - _distance = _x select 9; - - GVAR(CurrentTooltip) = []; - - _enable = (_distance == 0 || {[_target, _distance] call FUNC(isInRange)}) && {[_target, _player] call _condition} && {[_target, _player] call _conditionShow}; - if (isNil "_enable") then {_enable = false}; - - GVAR(Tooltips) set [_forEachIndex, GVAR(CurrentTooltip)]; - - // apply conditional tooltips - /*if (_forEachIndex == call ACE_Interaction_fnc_getSelectedButton) then { - _tooltip = _x select 6; - - _showTooltip = _tooltip != ""; - - _tooltip = text _tooltip; - - { - _showTooltip = true; - _tooltip = composeText [_tooltip, lineBreak, _x]; - } forEach (GVAR(Tooltips) select _forEachIndex); - - _ctrlTooltip ctrlSetStructuredText _tooltip; - _ctrlTooltip ctrlShow _showTooltip; - };*/ - - _ctrlText ctrlEnable _enable; - _ctrlIcon ctrlEnable _enable; - } forEach GVAR(Buttons); - - sleep 0.5; - isNull (findDisplay 1713999) - }; - }; -}; diff --git a/addons/interaction/functions/fnc_menuKeyInput.sqf b/addons/interaction/functions/fnc_menuKeyInput.sqf deleted file mode 100644 index 2390d6be14..0000000000 --- a/addons/interaction/functions/fnc_menuKeyInput.sqf +++ /dev/null @@ -1,17 +0,0 @@ -// by commy2 -#include "script_component.hpp" - -private "_key"; - -_key = _this select 1; - -if (_key in [28, 57, 156, 200, 208, 203, 205, 201, 209]) exitWith {true}; - -_index = GVAR(Shortcuts) find _key; - -if (_index != -1 && {ctrlEnabled (findDisplay 1713999 displayCtrl (_index + 10))}) exitWith { - _index call FUNC(onClick); - true -}; - -false diff --git a/addons/interaction/functions/fnc_onButtonDown.sqf b/addons/interaction/functions/fnc_onButtonDown.sqf deleted file mode 100644 index 63f62ed4a0..0000000000 --- a/addons/interaction/functions/fnc_onButtonDown.sqf +++ /dev/null @@ -1,18 +0,0 @@ -// by commy2 -#include "script_component.hpp" - -if (dialog) exitWith { - closeDialog 0; -}; - -if (isNull (findDisplay 1713999)) then { - if (ACE_player == vehicle ACE_player) then {"" call FUNC(openMenu)} else {[ACE_player, vehicle ACE_player] call FUNC(openMenuSelectUI)}; - setMousePosition [0.5, 0.5]; -} else { - (findDisplay 1713999) closeDisplay 1; -}; - -// Raise custom event. @todo: remove -[_player, "interactionMenuOpened", [_player, GVAR(Target), 0]] call EFUNC(common,callCustomEventHandlers); -// Raise ACE localEvent -["interactionMenuOpened", [_player, GVAR(Target), 0]] call EFUNC(common,localEvent); diff --git a/addons/interaction/functions/fnc_onButtonDownSelf.sqf b/addons/interaction/functions/fnc_onButtonDownSelf.sqf deleted file mode 100644 index 7b9abb926e..0000000000 --- a/addons/interaction/functions/fnc_onButtonDownSelf.sqf +++ /dev/null @@ -1,18 +0,0 @@ -// by commy2 -#include "script_component.hpp" - -if (dialog) exitWith { - closeDialog 0; -}; - -if (isNull (findDisplay 1713999)) then { - "" call FUNC(openMenuSelf); - setMousePosition [0.5, 0.5]; -} else { - (findDisplay 1713999) closeDisplay 1; -}; - -// Raise custom event. @todo: remove -[_player, "interactionMenuOpened", [_player, GVAR(Target), 1]] call EFUNC(common,callCustomEventHandlers); -// Raise ACE localEvent -["interactionMenuOpened", [_player, GVAR(Target), 1]] call EFUNC(common,localEvent); diff --git a/addons/interaction/functions/fnc_openMenu.sqf b/addons/interaction/functions/fnc_openMenu.sqf deleted file mode 100644 index 7785f2e4a4..0000000000 --- a/addons/interaction/functions/fnc_openMenu.sqf +++ /dev/null @@ -1,7 +0,0 @@ -// by commy2 -#include "script_component.hpp" - -private "_target"; -_target = [cursorTarget, GVAR(Target)] select (_this == "Default"); - -[0, _target, ""] call FUNC(showMenu); diff --git a/addons/interaction/functions/fnc_openMenuSelf.sqf b/addons/interaction/functions/fnc_openMenuSelf.sqf deleted file mode 100644 index 9ce84f7287..0000000000 --- a/addons/interaction/functions/fnc_openMenuSelf.sqf +++ /dev/null @@ -1,4 +0,0 @@ -// by commy2 -#include "script_component.hpp" - -[1, ACE_player, ""] call FUNC(showMenu); diff --git a/addons/interaction/functions/fnc_openSubMenu.sqf b/addons/interaction/functions/fnc_openSubMenu.sqf deleted file mode 100644 index cda4e76537..0000000000 --- a/addons/interaction/functions/fnc_openSubMenu.sqf +++ /dev/null @@ -1,4 +0,0 @@ -// by commy2 -#include "script_component.hpp" - -[2, GVAR(Target), _this select 0] call FUNC(showMenu); diff --git a/addons/interaction/functions/fnc_openSubMenuSelf.sqf b/addons/interaction/functions/fnc_openSubMenuSelf.sqf deleted file mode 100644 index e207603ebb..0000000000 --- a/addons/interaction/functions/fnc_openSubMenuSelf.sqf +++ /dev/null @@ -1,4 +0,0 @@ -// by commy2 -#include "script_component.hpp" - -[3, ACE_player, _this select 0] call FUNC(showMenu); diff --git a/addons/interaction/functions/fnc_prepareSelectMenu.sqf b/addons/interaction/functions/fnc_prepareSelectMenu.sqf index 43c9eccdf1..acff7fa5e2 100644 --- a/addons/interaction/functions/fnc_prepareSelectMenu.sqf +++ b/addons/interaction/functions/fnc_prepareSelectMenu.sqf @@ -18,18 +18,15 @@ private ["_buttonAction", "_header", "_buttonText", "_cancelButton"]; closeDialog 0; -if (!(profileNamespace getVariable [QGVAR(FlowMenu), false])) exitWith { - _header = _this select 0; - _buttonText = _this select 1; - if (isNil "_buttonText" or {_buttonText == ""}) then { - _buttonText = localize "STR_ACE_Interaction_MakeSelection"; - }; - createDialog "RscACE_SelectAnItem"; - ctrlSetText [8860, _buttonText]; - ctrlSetText [8870, _header]; - - lbClear 8866; - - 8866 +_header = _this select 0; +_buttonText = _this select 1; +if (isNil "_buttonText" or {_buttonText == ""}) then { + _buttonText = localize "STR_ACE_Interaction_MakeSelection"; }; -[] +createDialog "RscACE_SelectAnItem"; +ctrlSetText [8860, _buttonText]; +ctrlSetText [8870, _header]; + +lbClear 8866; + +8866 diff --git a/addons/interaction/functions/fnc_removeInteraction.sqf b/addons/interaction/functions/fnc_removeInteraction.sqf deleted file mode 100644 index 141773da73..0000000000 --- a/addons/interaction/functions/fnc_removeInteraction.sqf +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Author: commy2 - * - * Remove an ACE action from an object. Note: This function is global. - * - * Argument: - * 0: Object (Object) - * 1: ID of the action (Number) - * - * Return value: - * None. - */ -#include "script_component.hpp" - -private ["_object", "_id", "_actionsVar", "_currentID", "_actionIDs", "_actions"]; - -_object = _this select 0; -_id = _this select 1; - -_actionsVar = _object getVariable [QGVAR(Interactions), [-1, [], []]]; - -_currentID = _actionsVar select 0; -_actionIDs = _actionsVar select 1; -_actions = _actionsVar select 2; - -_id = _actionIDs find _id; - -if (_id == -1) exitWith {}; - -_actionIDs set [_id, -1]; -_actionIDs = _actionIDs - [-1]; - -_actions set [_id, []]; -_actions = _actions - [[]]; - -_object setVariable [QGVAR(Interactions), [_currentID, _actionIDs, _actions], true]; diff --git a/addons/interaction/functions/fnc_removeInteractionSelf.sqf b/addons/interaction/functions/fnc_removeInteractionSelf.sqf deleted file mode 100644 index fce0f6a5a0..0000000000 --- a/addons/interaction/functions/fnc_removeInteractionSelf.sqf +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Author: commy2 - * - * Remove an ACE self action from the player. - * - * Argument: - * 0: ID of the action (Number) - * - * Return value: - * None. - */ -#include "script_component.hpp" - -private ["_id", "_actionsVar", "_currentID", "_actionIDs", "_actions"]; - - -_id = _this select 0; - -_actionsVar = ACE_player getVariable [QGVAR(InteractionsSelf), [-1, [], []]]; - -_currentID = _actionsVar select 0; -_actionIDs = _actionsVar select 1; -_actions = _actionsVar select 2; - -_id = _actionIDs find _id; - -if (_id == -1) exitWith {}; - -_actionIDs set [_id, -1]; -_actionIDs = _actionIDs - [-1]; - -_actions set [_id, []]; -_actions = _actions - [[]]; - -ACE_player setVariable [QGVAR(InteractionsSelf), [_currentID, _actionIDs, _actions], false]; diff --git a/addons/interaction/functions/fnc_showMenu.sqf b/addons/interaction/functions/fnc_showMenu.sqf deleted file mode 100644 index b567a22ea4..0000000000 --- a/addons/interaction/functions/fnc_showMenu.sqf +++ /dev/null @@ -1,118 +0,0 @@ -/* - Author: - commy2 - Garth de Wet (LH) - aeroson - - Description: - - Parameters: - 0: NUMBER - Menu type (0 - interaction, 1 - self-interaction, 2 - sub-interaction, 3 - sub-self-interaction) - 1: OBJECT - Target object - 2: STRING - Sub-Menu ClassName - - Returns: - Nothing - - Example: - [0, GVAR(Target)] call FUNC(showMenu); - [1, player] call FUNC(showMenu); - [2, GVAR(Target), "ACE_Explosives"] call FUNC(showMenu); - [3, player, "ACE_Explosives"] call FUNC(showMenu); -*/ -#include "script_component.hpp" - -private ["_player", "_vehicle", "_mainButtonAction", "_object", "_index", "_actions", "_result", "_menuType"]; -#define DEFAULT_ICON QUOTE(PATHOF(UI\dot_ca.paa)) -#define DEFAULT_DISTANCE 4 // seems to be 4 -_player = ACE_player; -_vehicle = vehicle _player; - -GVAR(MenuType) = _this select 0; // 0 Interaction, 1 Self Interaction - -_mainButtonAction = [ - {call FUNC(hideMenu)}, - {call FUNC(hideMenu)}, - {"Default" call FUNC(openMenu)}, - {"Default" call FUNC(openMenuSelf)} -] select GVAR(MenuType); - -_menuType = GVAR(MenuType) % 2; -uiNamespace setVariable [QGVAR(CursorPosition), [controlNull, 0.5, 0.5, -1]]; - -GVAR(Target) = _this select 1; -_object = GVAR(Target); - -if (_menuType == 0 && {(isNull (_object) || {!([_object, 4] call FUNC(isInRange))})}) exitWith {}; -if !([_player, _object] call EFUNC(common,canInteractWith)) exitWith {}; - -// add actions or self actions of GVAR(Target) -_parents = [configFile >> "CfgVehicles" >> typeOf _object, true] call BIS_fnc_returnParents; -_result = [_object, _parents, [], [], missionConfigFile >> "CfgVehicles", true, ["ACE_Actions", "ACE_SelfActions"] select _menuType, _this select 2] call FUNC(GetActions); -_actions = ([_object, _parents, _result select 0, _result select 1,configFile >> "CfgVehicles", false, ["ACE_Actions", "ACE_SelfActions"] select _menuType, _this select 2] call FUNC(GetActions) select 0); - -// add self actions of vehicle _player -if (_menuType == 1 && {_player != _vehicle}) then { - _parents = [configFile >> "CfgVehicles" >> typeOf _vehicle, true] call BIS_fnc_returnParents; - _result = [_vehicle, _parents, [], [], missionConfigFile >> "CfgVehicles", true, ["ACE_Actions", "ACE_SelfActions"] select _menuType, _this select 2] call FUNC(GetActions); - _actions = _actions + (([_vehicle, _parents, _result select 0, _result select 1,configFile >> "CfgVehicles", false, ["ACE_Actions", "ACE_SelfActions"] select _menuType, _this select 2] call FUNC(GetActions) select 0)); -}; - -// custom defined actions, stored in variable instead of cfg like above -if (GVAR(MenuType) < 2) then { - - private ["_customActions", "_customAction", "_displayName", "_distance","_condition","_statement","_showDisabled", "_priority"]; - - // add interactions or self interactions of GVAR(Target) - _customActions = (_object getVariable [[QGVAR(Interactions), QGVAR(ACE_InteractionsSelf)] select _menuType, [-1, [], []]]) select 2; - - // add self interactions of vehicle _player - if (_menuType == 1 && {_player != _vehicle}) then { - _customActions = _customActions + ((_vehicle getVariable [[QGVAR(Interactions), QGVAR(ACE_InteractionsSelf)] select _menuType, [-1, [], []]]) select 2); - }; - - if(_menuType==0) then { - - private ["_distance"]; - - for "_index" from 0 to (count _customActions - 1) do { - - _customAction = _customActions select _index; - _displayName = _customAction select 0; - _distance = _customAction select 1; - _condition = _customAction select 2; - _statement = _customAction select 3; - _showDisabled = _customAction select 4; - _priority = _customAction select 5; - - if ((_showDisabled || {[_object, _player] call _condition}) && {[_object, _distance] call FUNC(isInRange) || {_distance == 0}}) then { - _actions pushBack [_displayName, _statement, _condition, _priority, [], DEFAULT_ICON, "", {true}, [], _distance, ""]; - }; - }; - - } else { // self interactions do not have distance - - for "_index" from 0 to (count _customActions - 1) do { - - _customAction = _customActions select _index; - _displayName = _customAction select 0; - _condition = _customAction select 1; - _statement = _customAction select 2; - _showDisabled = _customAction select 3; - _priority = _customAction select 4; - - if (_showDisabled || {[_object, _player] call _condition}) then { - _actions pushBack [_displayName, _statement, _condition, _priority, [], DEFAULT_ICON, "", {true}, [], DEFAULT_DISTANCE, ""]; - }; - }; - - }; - - -}; - -if (count _actions == 0) exitWith {}; - -_actions call FUNC(sortOptionsByPriority); -GVAR(Buttons) = _actions; -[_mainButtonAction, (_this select 2) != "", (profileNamespace getVariable [QGVAR(FlowMenu), false]), _menuType == 1, _object] call FUNC(initialiseInteraction); diff --git a/addons/interaction/functions/fnc_tapShoulder.sqf b/addons/interaction/functions/fnc_tapShoulder.sqf index 02eed88542..262012dbb9 100644 --- a/addons/interaction/functions/fnc_tapShoulder.sqf +++ b/addons/interaction/functions/fnc_tapShoulder.sqf @@ -1,21 +1,22 @@ // by commy2 #include "script_component.hpp" -private ["_unit", "_message"]; - -_tapper = _this select 0; -_target = _this select 1; +EXPLODE_3_PVT(_this,_tapper,_target,_shoulderNum); if (_target != ACE_player) exitWith { - addCamShake [4, 0.5, 5]; - if !(local _target) then { - [[_tapper, _target], QUOTE(DFUNC(tapShoulder)), _target] call EFUNC(common,execRemoteFnc); - }; + addCamShake [4, 0.5, 5]; + ACE_player playActionNow 'gestureAdvance'; + if !(local _target) then { + [[_tapper, _target, _shoulderNum], QUOTE(DFUNC(tapShoulder)), _target] call EFUNC(common,execRemoteFnc); + }; }; addCamShake [4, 0.5, 5]; -//_message = format ["%1 tapped you on your shoulder.", [_unit] call EFUNC(common,getName)]; -_message = localize "STR_ACE_Interaction_YouWereTapped"; +if (_shoulderNum == 0) then { + _message = localize "STR_ACE_Interaction_YouWereTappedRight"; +} else { + _message = localize "STR_ACE_Interaction_YouWereTappedLeft"; +}; [_message] call EFUNC(common,displayTextStructured); diff --git a/addons/interaction/stringtable.xml b/addons/interaction/stringtable.xml index e58e808687..76898cd227 100644 --- a/addons/interaction/stringtable.xml +++ b/addons/interaction/stringtable.xml @@ -2,6 +2,27 @@ + + Interactions >> + + + Head >> + + + Left Arm >> + + + Right Arm >> + + + Left Leg >> + + + Right Leg >> + + + Weapon >> + Interaction Menu Interaktionsmenü @@ -338,17 +359,29 @@ Tocar ombro Dai un colpetto - - You were tapped on the shoulder. - Dir wurde auf die Schulter geklopft - Te tocaron el hombro. - On te tape sur l'épaule. - Zostałeś klepnięty po ramieniu - Vállonveregettek - Někdo tě poklepal na rameno. - Вас похлопали по плечу - Você foi tocado no ombro. - Ti è stato dato un colpetto sulla spalla + + You were tapped on the RIGHT shoulder > + Te tocaron el hombro DERECHO > + Dir wurde auf die Schulter geklopft > + On te tape sur l'épaule > + Zostałeś klepnięty po ramieniu > + Vállonveregettek > + Někdo tě poklepal na rameno > + Вас похлопали по плечу > + Você foi tocado no ombro > + Ti è stato dato un colpetto sulla spalla > + + + < You were tapped on the LEFT shoulder. + < Te tocaron el hombro IZQUIERDO. + < Dir wurde auf die Schulter geklopft + < On te tape sur l'épaule. + < Zostałeś klepnięty po ramieniu + < Vállonveregettek + < Někdo tě poklepal na rameno. + < Вас похлопали по плечу + < Você foi tocado no ombro. + < Ti è stato dato un colpetto sulla spalla Cancel @@ -554,18 +587,6 @@ Perdona Megbocsátás - - Flow Menu - Mausradmenü - Flow Menu - Menú desplegable - Menu Déroulant - Flow Menu - Выпадающее меню - Flow Menu - Menù a Scorrimento - Legördülő menü - Scroll Scrollen @@ -601,25 +622,6 @@ Poza zasięgiem Mimo dosah - - Close Menu on Key Release - Menü nach Loslassen schließen - Zamknij menu automatycznie - Fermer le menu en relâchant la touche - Cerrar menú al soltar la tecla - Menü bezárása a billentyű elengedésekor - Закрывать меню при отжатии клавиши - Menu interakce (Na držení) - - - Auto Center Cursor - Mauszeiger automatisch zentrieren - Auto-centrar cursor - Automatycznie centruj kursor - Vycentrování kurzoru - Egér auto-centrírozása - Автоцентрирование курсора - Equipment >> Ausrüstung >> diff --git a/addons/logistics_uavbattery/CfgVehicles.hpp b/addons/logistics_uavbattery/CfgVehicles.hpp index 933079071a..a3a3fc763d 100644 --- a/addons/logistics_uavbattery/CfgVehicles.hpp +++ b/addons/logistics_uavbattery/CfgVehicles.hpp @@ -2,6 +2,7 @@ class CfgVehicles { class Helicopter_Base_F; class UAV_01_base_F: Helicopter_Base_F { class ACE_Actions { + class ACE_MainActions { class GVAR(RefuelUAV) { displayName = "$STR_ACE_logistics_uavbattery_Recharge"; distance = 4; @@ -11,9 +12,10 @@ class CfgVehicles { priority = 1.245; \ icon = QUOTE(PATHTOF(ui\UAV_battery.paa)); }; + }; }; }; - + // Misc box content class Box_NATO_Support_F; class ACE_Box_Misc: Box_NATO_Support_F { diff --git a/addons/logistics_uavbattery/functions/fnc_canRefuelUAV.sqf b/addons/logistics_uavbattery/functions/fnc_canRefuelUAV.sqf index 4256ddabf9..aaaac3077d 100644 --- a/addons/logistics_uavbattery/functions/fnc_canRefuelUAV.sqf +++ b/addons/logistics_uavbattery/functions/fnc_canRefuelUAV.sqf @@ -1,17 +1,19 @@ -/* fnc_refuel.sqf -* -* Author: marc_book (modified by PabstMirror) -* -* Tests if unit can refuel the target UAV -* -* Argument: -* 0: OBJECT - Player unit -* 1: OBJECT - UAV to test -* -* Return value: -* BOOL -*/ - +/* + * Author: marc_book + * Tests if unit can refuel the target UAV + * + * Arguments: + * 0: Player + * 1: UAV + * + * Return Value: + * Can the player rechange the UAV + * + * Example: + * [player, theUAV] call ace_logistics_uavbattery_fnc_canRefuelUAV + * + * Public: No + */ #include "script_component.hpp" PARAMS_2(_caller,_target); diff --git a/addons/logistics_uavbattery/functions/fnc_refuelUAV.sqf b/addons/logistics_uavbattery/functions/fnc_refuelUAV.sqf index 5a248bf812..a23969aa9f 100644 --- a/addons/logistics_uavbattery/functions/fnc_refuelUAV.sqf +++ b/addons/logistics_uavbattery/functions/fnc_refuelUAV.sqf @@ -1,17 +1,19 @@ -/* fnc_refuel.sqf -* -* Author: marc_book (modified by PabstMirror) -* -* Starts refueling/recharging the 'Dartar' UAVs -* -* Argument: -* 0: OBJECT - Player unit -* 1: OBJECT - UAV -* -* Return value: -* NOTHING -*/ - +/* + * Author: marc_book + * Starts refueling/recharging the 'Dartar' UAVs + * + * Arguments: + * 0: Player + * 1: UAV + * + * Return Value: + * Nothing + * + * Example: + * [player, theUAV] call ace_logistics_uavbattery_fnc_refuelUAV + * + * Public: No + */ #include "script_component.hpp" PARAMS_2(_caller,_target); diff --git a/addons/magazinerepack/functions/fnc_openSelectMagazineUI.sqf b/addons/magazinerepack/functions/fnc_openSelectMagazineUI.sqf index e96e84e9a1..fc183faa5b 100644 --- a/addons/magazinerepack/functions/fnc_openSelectMagazineUI.sqf +++ b/addons/magazinerepack/functions/fnc_openSelectMagazineUI.sqf @@ -54,6 +54,5 @@ _actions, { [_this] call FUNC(startRepackingMagazine); }, { call EFUNC(interaction,hideMenu); //ToDo: Self Interaction Integration - if !(profileNamespace getVariable [QGVAR(AutoCloseMenu), false]) then {"Default" call EFUNC(interaction,openMenuSelf)}; } ] call EFUNC(interaction,openSelectMenu); diff --git a/addons/magazines/CfgWeapons.hpp b/addons/magazines/CfgWeapons.hpp index d54cf28e52..2b24d578fe 100644 --- a/addons/magazines/CfgWeapons.hpp +++ b/addons/magazines/CfgWeapons.hpp @@ -1,5 +1,5 @@ - class SlotInfo; +class MuzzleSlot; class CfgWeapons { @@ -20,7 +20,7 @@ class CfgWeapons { }; class WeaponSlotsInfo: WeaponSlotsInfo { - class MuzzleSlot: SlotInfo { + class MuzzleSlot: MuzzleSlot { compatibleItems[] += {"ACE_muzzle_mzls_H"}; }; }; @@ -59,7 +59,7 @@ class CfgWeapons { }; class WeaponSlotsInfo: WeaponSlotsInfo { - class MuzzleSlot: SlotInfo { + class MuzzleSlot: MuzzleSlot { compatibleItems[] += {"ACE_muzzle_mzls_H"}; }; }; @@ -74,7 +74,7 @@ class CfgWeapons { class EBR_base_F: Rifle_Long_Base_F { class WeaponSlotsInfo: WeaponSlotsInfo { - class MuzzleSlot: SlotInfo { + class MuzzleSlot: MuzzleSlot { compatibleItems[] += {"ACE_muzzle_mzls_B"}; }; }; @@ -82,7 +82,7 @@ class CfgWeapons { class DMR_01_base_F: Rifle_Long_Base_F { class WeaponSlotsInfo: WeaponSlotsInfo { - class MuzzleSlot: SlotInfo { + class MuzzleSlot: MuzzleSlot { compatibleItems[] += {"ACE_muzzle_mzls_B"}; }; }; @@ -90,7 +90,7 @@ class CfgWeapons { class LMG_Mk200_F: Rifle_Long_Base_F { class WeaponSlotsInfo: WeaponSlotsInfo { - class MuzzleSlot: SlotInfo { + class MuzzleSlot: MuzzleSlot { compatibleItems[] += {"ACE_muzzle_mzls_H"}; }; }; @@ -98,7 +98,7 @@ class CfgWeapons { class LMG_Zafir_F: Rifle_Long_Base_F { class WeaponSlotsInfo: WeaponSlotsInfo { - class MuzzleSlot: SlotInfo { + class MuzzleSlot: MuzzleSlot { compatibleItems[] += {"ACE_muzzle_mzls_B"}; }; }; @@ -115,7 +115,7 @@ class CfgWeapons { }; class WeaponSlotsInfo: WeaponSlotsInfo { - class MuzzleSlot: SlotInfo { + class MuzzleSlot: MuzzleSlot { compatibleItems[] += {"ACE_muzzle_mzls_L"}; }; }; @@ -129,7 +129,7 @@ class CfgWeapons { }; class WeaponSlotsInfo: WeaponSlotsInfo { - class MuzzleSlot: SlotInfo { + class MuzzleSlot: MuzzleSlot { compatibleItems[] += {"ACE_muzzle_mzls_L"}; }; }; @@ -148,7 +148,7 @@ class CfgWeapons { class pdw2000_base_F: Rifle_Base_F { class WeaponSlotsInfo: WeaponSlotsInfo { - class MuzzleSlot: SlotInfo { + class MuzzleSlot: MuzzleSlot { compatibleItems[] += {"ACE_muzzle_mzls_smg_02"}; }; }; @@ -156,7 +156,7 @@ class CfgWeapons { class SMG_01_Base: Rifle_Base_F { class WeaponSlotsInfo: WeaponSlotsInfo { - class MuzzleSlot: SlotInfo { + class MuzzleSlot: MuzzleSlot { compatibleItems[] += {"ACE_muzzle_mzls_smg_01"}; }; }; @@ -164,7 +164,7 @@ class CfgWeapons { class SMG_02_base_F: Rifle_Base_F { class WeaponSlotsInfo: WeaponSlotsInfo { - class MuzzleSlot: SlotInfo { + class MuzzleSlot: MuzzleSlot { compatibleItems[] += {"ACE_muzzle_mzls_smg_02"}; }; }; @@ -180,7 +180,7 @@ class CfgWeapons { class hgun_P07_F: Pistol_Base_F { class WeaponSlotsInfo: WeaponSlotsInfo { - class MuzzleSlot: SlotInfo { + class MuzzleSlot: MuzzleSlot { linkProxy = "\A3\data_f\proxies\weapon_slots\MUZZLE"; compatibleItems[] += {"ACE_muzzle_mzls_smg_02"}; }; @@ -189,7 +189,7 @@ class CfgWeapons { class hgun_Rook40_F: Pistol_Base_F { class WeaponSlotsInfo: WeaponSlotsInfo { - class MuzzleSlot: SlotInfo { + class MuzzleSlot: MuzzleSlot { linkProxy = "\A3\data_f\proxies\weapon_slots\MUZZLE"; compatibleItems[] += {"ACE_muzzle_mzls_smg_02"}; }; @@ -198,7 +198,7 @@ class CfgWeapons { class hgun_ACPC2_F: Pistol_Base_F { class WeaponSlotsInfo: WeaponSlotsInfo { - class MuzzleSlot: SlotInfo { + class MuzzleSlot: MuzzleSlot { compatibleItems[] += {"ACE_muzzle_mzls_smg_01"}; }; }; @@ -206,7 +206,7 @@ class CfgWeapons { class hgun_Pistol_heavy_01_F: Pistol_Base_F { class WeaponSlotsInfo: WeaponSlotsInfo { - class MuzzleSlot: SlotInfo { + class MuzzleSlot: MuzzleSlot { compatibleItems[] += {"ACE_muzzle_mzls_smg_01"}; }; }; diff --git a/addons/main/config.cpp b/addons/main/config.cpp index 3b8c600e22..44e9c6f33e 100644 --- a/addons/main/config.cpp +++ b/addons/main/config.cpp @@ -1,539 +1,540 @@ #include "script_component.hpp" class CfgPatches { - class ADDON { - units[] = {}; - weapons[] = {}; - requiredVersion = REQUIRED_VERSION; - requiredAddons[] = { - "a3_air_f", - "a3_air_f_beta", - "a3_air_f_beta_heli_attack_01", - "a3_air_f_beta_heli_attack_02", - "a3_air_f_beta_heli_transport_01", - "a3_air_f_beta_heli_transport_02", - "a3_air_f_beta_parachute_01", - "a3_air_f_beta_parachute_02", - "a3_air_f_epb_heli_light_03", - "a3_air_f_epc_plane_cas_01", - "a3_air_f_epc_plane_cas_02", - "a3_air_f_epc_plane_fighter_03", - "a3_air_f_gamma_plane_fighter_03", - "a3_air_f_gamma_uav_01", - "a3_air_f_gamma_uav_02", - "a3_air_f_heli", - "a3_air_f_heli_heli_attack_01", - "a3_air_f_heli_heli_attack_02", - "a3_air_f_heli_heli_light_01", - "a3_air_f_heli_heli_light_02", - "a3_air_f_heli_heli_light_03", - "a3_air_f_heli_heli_transport_01", - "a3_air_f_heli_heli_transport_02", - "a3_air_f_heli_heli_transport_03", - "a3_air_f_heli_heli_transport_04", - "a3_air_f_heli_light_01", - "a3_air_f_heli_light_02", - "a3_animals_f", - "a3_animals_f_animconfig", - "a3_animals_f_chicken", - "a3_animals_f_dog", - "a3_animals_f_fishes", - "a3_animals_f_goat", - "a3_animals_f_kestrel", - "a3_animals_f_rabbit", - "a3_animals_f_seagull", - "a3_animals_f_sheep", - "a3_animals_f_snakes", - "a3_animals_f_turtle", - "a3_anims_f", - "a3_anims_f_config_sdr", - "a3_anims_f_epa", - "a3_anims_f_epc", - "a3_anims_f_heli", - "a3_anims_f_kart", - "a3_armor_f", - "a3_armor_f_amv", - "a3_armor_f_apc_wheeled_03", - "a3_armor_f_beta", - "a3_armor_f_beta_apc_tracked_02", - "a3_armor_f_epb_apc_tracked_03", - "a3_armor_f_epb_mbt_03", - "a3_armor_f_epc_mbt_01", - "a3_armor_f_marid", - "a3_armor_f_panther", - "a3_armor_f_slammer", - "a3_armor_f_t100k", - "a3_baseconfig_f", - "a3_boat_f", - "a3_boat_f_beta_boat_armed_01", - "a3_boat_f_beta_boat_transport_01", - "a3_boat_f_boat_armed_01", - "a3_boat_f_boat_transport_01", - "a3_boat_f_civilian_boat", - "a3_boat_f_epc_submarine_01_f", - "a3_boat_f_gamma_boat_transport_01", - "a3_boat_f_heli_boat_armed_01", - "a3_boat_f_heli_sdv_01", - "a3_boat_f_sdv_01", - "a3_boat_f_trawler", - "a3_cargoposes_f", - "a3_cargoposes_f_heli", - "a3_characters_f", - "a3_characters_f_beta", - "a3_characters_f_blufor", - "a3_characters_f_bootcamp", - "a3_characters_f_bootcamp_common", - "a3_characters_f_civil", - "a3_characters_f_common", - "a3_characters_f_epa", - "a3_characters_f_epb", - "a3_characters_f_epb_heads", - "a3_characters_f_epc", - "a3_characters_f_gamma", - "a3_characters_f_heads", - "a3_characters_f_indep", - "a3_characters_f_kart", - "a3_characters_f_opfor", - "a3_characters_f_proxies", - "a3_data_f", - "a3_data_f_bootcamp", - "a3_data_f_curator", - "a3_data_f_curator_characters", - "a3_data_f_curator_eagle", - "a3_data_f_curator_intel", - "a3_data_f_curator_misc", - "a3_data_f_curator_respawn", - "a3_data_f_curator_virtual", - "a3_data_f_heli", - "a3_data_f_hook", - "a3_data_f_kart", - "a3_data_f_kart_particleeffects", - "a3_data_f_particleeffects", - "a3_dubbing_radio_f", - "a3_editor_f", - "a3_functions_f", - "a3_functions_f_bootcamp", - "a3_functions_f_curator", - "a3_functions_f_epa", - "a3_functions_f_epc", - "a3_functions_f_heli", - "a3_language_f", - "a3_language_f_beta", - "a3_language_f_bootcamp", - "a3_language_f_curator", - "a3_language_f_epa", - "a3_language_f_epb", - "a3_language_f_epc", - "a3_language_f_gamma", - "a3_language_f_heli", - "a3_language_f_kart", - "a3_languagemissions_f", - "a3_languagemissions_f_beta", - "a3_languagemissions_f_gamma", - "a3_languagemissions_f_kart", - "a3_map_altis", - "a3_map_altis_scenes", - "a3_map_data", - "a3_map_stratis", - "a3_map_stratis_scenes", - "a3_map_vr_scenes", - "a3_misc_f", - "a3_misc_f_helpers", - "a3_missions_f", - "a3_missions_f_beta", - "a3_missions_f_bootcamp", - "a3_missions_f_curator", - "a3_missions_f_epa", - "a3_missions_f_epb", - "a3_missions_f_epc", - "a3_missions_f_gamma", - "a3_missions_f_heli", - "a3_missions_f_kart", - "a3_modules_f", - "a3_modules_f_beta", - "a3_modules_f_beta_firingdrills", - "a3_modules_f_bootcamp", - "a3_modules_f_bootcamp_misc", - "a3_modules_f_curator", - "a3_modules_f_curator_animals", - "a3_modules_f_curator_cas", - "a3_modules_f_curator_chemlights", - "a3_modules_f_curator_curator", - "a3_modules_f_curator_effects", - "a3_modules_f_curator_environment", - "a3_modules_f_curator_flares", - "a3_modules_f_curator_intel", - "a3_modules_f_curator_lightning", - "a3_modules_f_curator_mines", - "a3_modules_f_curator_misc", - "a3_modules_f_curator_multiplayer", - "a3_modules_f_curator_objectives", - "a3_modules_f_curator_ordnance", - "a3_modules_f_curator_respawn", - "a3_modules_f_curator_smokeshells", - "a3_modules_f_dyno", - "a3_modules_f_effects", - "a3_modules_f_epb", - "a3_modules_f_epb_misc", - "a3_modules_f_events", - "a3_modules_f_groupmodifiers", - "a3_modules_f_hc", - "a3_modules_f_heli", - "a3_modules_f_heli_spawnai", - "a3_modules_f_intel", - "a3_modules_f_kart", - "a3_modules_f_kart_timetrials", - "a3_modules_f_livefeed", - "a3_modules_f_marta", - "a3_modules_f_misc", - "a3_modules_f_multiplayer", - "a3_modules_f_objectmodifiers", - "a3_modules_f_sites", - "a3_modules_f_skirmish", - "a3_modules_f_strategicmap", - "a3_modules_f_supports", - "a3_modules_f_uav", - "a3_music_f", - "a3_music_f_bootcamp", - "a3_music_f_epa", - "a3_music_f_epb", - "a3_music_f_epc", - "a3_music_f_heli", - "a3_plants_f_bush", - "a3_roads_f", - "a3_rocks_f", - "a3_signs_f", - "a3_signs_f_ad", - "a3_soft_f", - "a3_soft_f_beta_quadbike", - "a3_soft_f_bootcamp_offroad_01", - "a3_soft_f_bootcamp_quadbike", - "a3_soft_f_bootcamp_truck", - "a3_soft_f_car", - "a3_soft_f_crusher_ugv", - "a3_soft_f_epc_truck_03", - "a3_soft_f_gamma_hemtt", - "a3_soft_f_gamma_offroad", - "a3_soft_f_gamma_quadbike", - "a3_soft_f_gamma_truckheavy", - "a3_soft_f_heli_car", - "a3_soft_f_heli_crusher_ugv", - "a3_soft_f_heli_mrap_01", - "a3_soft_f_heli_mrap_02", - "a3_soft_f_heli_mrap_03", - "a3_soft_f_heli_quadbike", - "a3_soft_f_heli_suv", - "a3_soft_f_heli_truck", - "a3_soft_f_hemtt", - "a3_soft_f_kart_kart_01", - "a3_soft_f_mrap_01", - "a3_soft_f_mrap_02", - "a3_soft_f_mrap_03", - "a3_soft_f_offroad_01", - "a3_soft_f_quadbike", - "a3_soft_f_suv", - "a3_soft_f_truck", - "a3_soft_f_truckheavy", - "a3_sounds_f", - "a3_sounds_f_bootcamp", - "a3_sounds_f_epb", - "a3_sounds_f_epc", - "a3_static_f", - "a3_static_f_beta_mortar_01", - "a3_static_f_gamma", - "a3_static_f_gamma_aa", - "a3_static_f_gamma_at", - "a3_static_f_gamma_mortar_01", - "a3_static_f_mortar_01", - "a3_structures_f", - "a3_structures_f_bootcamp_civ_camping", - "a3_structures_f_bootcamp_civ_sportsgrounds", - "a3_structures_f_bootcamp_ind_cargo", - "a3_structures_f_bootcamp_items_electronics", - "a3_structures_f_bootcamp_items_food", - "a3_structures_f_bootcamp_items_sport", - "a3_structures_f_bootcamp_system", - "a3_structures_f_bootcamp_training", - "a3_structures_f_bootcamp_vr_blocks", - "a3_structures_f_bootcamp_vr_coverobjects", - "a3_structures_f_bootcamp_vr_helpers", - "a3_structures_f_bridges", - "a3_structures_f_civ", - "a3_structures_f_civ_accessories", - "a3_structures_f_civ_ancient", - "a3_structures_f_civ_belltowers", - "a3_structures_f_civ_calvaries", - "a3_structures_f_civ_camping", - "a3_structures_f_civ_chapels", - "a3_structures_f_civ_constructions", - "a3_structures_f_civ_dead", - "a3_structures_f_civ_garbage", - "a3_structures_f_civ_graffiti", - "a3_structures_f_civ_infoboards", - "a3_structures_f_civ_kiosks", - "a3_structures_f_civ_lamps", - "a3_structures_f_civ_market", - "a3_structures_f_civ_offices", - "a3_structures_f_civ_pavements", - "a3_structures_f_civ_playground", - "a3_structures_f_civ_sportsgrounds", - "a3_structures_f_civ_statues", - "a3_structures_f_civ_tourism", - "a3_structures_f_dominants", - "a3_structures_f_dominants_amphitheater", - "a3_structures_f_dominants_castle", - "a3_structures_f_dominants_church", - "a3_structures_f_dominants_hospital", - "a3_structures_f_dominants_lighthouse", - "a3_structures_f_dominants_wip", - "a3_structures_f_epa_civ_camping", - "a3_structures_f_epa_civ_constructions", - "a3_structures_f_epa_items_electronics", - "a3_structures_f_epa_items_food", - "a3_structures_f_epa_items_medical", - "a3_structures_f_epa_items_tools", - "a3_structures_f_epa_items_vessels", - "a3_structures_f_epa_mil_scrapyard", - "a3_structures_f_epa_walls", - "a3_structures_f_epb_civ_accessories", - "a3_structures_f_epb_civ_camping", - "a3_structures_f_epb_civ_dead", - "a3_structures_f_epb_civ_garbage", - "a3_structures_f_epb_civ_graffiti", - "a3_structures_f_epb_civ_playground", - "a3_structures_f_epb_furniture", - "a3_structures_f_epb_items_documents", - "a3_structures_f_epb_items_luggage", - "a3_structures_f_epb_items_military", - "a3_structures_f_epb_items_vessels", - "a3_structures_f_epb_naval_fishing", - "a3_structures_f_epc_civ_accessories", - "a3_structures_f_epc_civ_camping", - "a3_structures_f_epc_civ_garbage", - "a3_structures_f_epc_civ_infoboards", - "a3_structures_f_epc_civ_kiosks", - "a3_structures_f_epc_civ_playground", - "a3_structures_f_epc_civ_tourism", - "a3_structures_f_epc_dominants_ghosthotel", - "a3_structures_f_epc_dominants_stadium", - "a3_structures_f_epc_furniture", - "a3_structures_f_epc_items_documents", - "a3_structures_f_epc_items_electronics", - "a3_structures_f_epc_walls", - "a3_structures_f_furniture", - "a3_structures_f_heli_civ_accessories", - "a3_structures_f_heli_civ_constructions", - "a3_structures_f_heli_civ_garbage", - "a3_structures_f_heli_civ_market", - "a3_structures_f_heli_furniture", - "a3_structures_f_heli_ind_airport", - "a3_structures_f_heli_ind_cargo", - "a3_structures_f_heli_ind_machines", - "a3_structures_f_heli_items_airport", - "a3_structures_f_heli_items_electronics", - "a3_structures_f_heli_items_food", - "a3_structures_f_heli_items_luggage", - "a3_structures_f_heli_items_sport", - "a3_structures_f_heli_items_tools", - "a3_structures_f_heli_vr_helpers", - "a3_structures_f_households", - "a3_structures_f_households_addons", - "a3_structures_f_households_house_big01", - "a3_structures_f_households_house_big02", - "a3_structures_f_households_house_shop01", - "a3_structures_f_households_house_shop02", - "a3_structures_f_households_house_small01", - "a3_structures_f_households_house_small02", - "a3_structures_f_households_house_small03", - "a3_structures_f_households_slum", - "a3_structures_f_households_stone_big", - "a3_structures_f_households_stone_shed", - "a3_structures_f_households_stone_small", - "a3_structures_f_households_wip", - "a3_structures_f_ind", - "a3_structures_f_ind_airport", - "a3_structures_f_ind_cargo", - "a3_structures_f_ind_carservice", - "a3_structures_f_ind_concretemixingplant", - "a3_structures_f_ind_crane", - "a3_structures_f_ind_dieselpowerplant", - "a3_structures_f_ind_factory", - "a3_structures_f_ind_fuelstation", - "a3_structures_f_ind_fuelstation_small", - "a3_structures_f_ind_pipes", - "a3_structures_f_ind_powerlines", - "a3_structures_f_ind_reservoirtank", - "a3_structures_f_ind_shed", - "a3_structures_f_ind_solarpowerplant", - "a3_structures_f_ind_tank", - "a3_structures_f_ind_transmitter_tower", - "a3_structures_f_ind_wavepowerplant", - "a3_structures_f_ind_windmill", - "a3_structures_f_ind_windpowerplant", - "a3_structures_f_items", - "a3_structures_f_items_cans", - "a3_structures_f_items_documents", - "a3_structures_f_items_electronics", - "a3_structures_f_items_gadgets", - "a3_structures_f_items_luggage", - "a3_structures_f_items_medical", - "a3_structures_f_items_military", - "a3_structures_f_items_stationery", - "a3_structures_f_items_tools", - "a3_structures_f_items_valuables", - "a3_structures_f_items_vessels", - "a3_structures_f_kart_civ_sportsgrounds", - "a3_structures_f_kart_mil_flags", - "a3_structures_f_kart_signs_companies", - "a3_structures_f_mil", - "a3_structures_f_mil_bagbunker", - "a3_structures_f_mil_bagfence", - "a3_structures_f_mil_barracks", - "a3_structures_f_mil_bunker", - "a3_structures_f_mil_cargo", - "a3_structures_f_mil_flags", - "a3_structures_f_mil_fortification", - "a3_structures_f_mil_helipads", - "a3_structures_f_mil_offices", - "a3_structures_f_mil_radar", - "a3_structures_f_mil_scrapyard", - "a3_structures_f_mil_shelters", - "a3_structures_f_mil_tenthangar", - "a3_structures_f_naval", - "a3_structures_f_naval_buoys", - "a3_structures_f_naval_fishing", - "a3_structures_f_naval_piers", - "a3_structures_f_naval_rowboats", - "a3_structures_f_research", - "a3_structures_f_signs_companies", - "a3_structures_f_system", - "a3_structures_f_training", - "a3_structures_f_training_invisibletarget", - "a3_structures_f_walls", - "a3_structures_f_wrecks", - "a3_supplies_f_heli", - "a3_supplies_f_heli_bladders", - "a3_supplies_f_heli_cargonets", - "a3_supplies_f_heli_fuel", - "a3_supplies_f_heli_slingload", - "a3_uav_f_characters_f_gamma", - "a3_uav_f_weapons_f_gamma_ammoboxes", - "a3_ui_f", - "a3_ui_f_bootcamp", - "a3_ui_f_curator", - "a3_ui_f_heli", - "a3_ui_f_kart", - "a3_uifonts_f", - "a3_weapons_f", - "a3_weapons_f_aaf", - "a3_weapons_f_acc", - "a3_weapons_f_ammoboxes", - "a3_weapons_f_beta", - "a3_weapons_f_beta_acc", - "a3_weapons_f_beta_ammoboxes", - "a3_weapons_f_beta_ebr", - "a3_weapons_f_beta_rifles_khaybar", - "a3_weapons_f_beta_rifles_mx", - "a3_weapons_f_beta_rifles_trg20", - "a3_weapons_f_bootcamp", - "a3_weapons_f_bootcamp_ammoboxes", - "a3_weapons_f_bootcamp_longrangerifles_gm6", - "a3_weapons_f_bootcamp_longrangerifles_m320", - "a3_weapons_f_csat", - "a3_weapons_f_dummyweapons", - "a3_weapons_f_ebr", - "a3_weapons_f_epa", - "a3_weapons_f_epa_acc", - "a3_weapons_f_epa_ammoboxes", - "a3_weapons_f_epa_ebr", - "a3_weapons_f_epa_longrangerifles_dmr_01", - "a3_weapons_f_epa_longrangerifles_gm6", - "a3_weapons_f_epa_rifles_mx", - "a3_weapons_f_epb", - "a3_weapons_f_epb_acc", - "a3_weapons_f_epb_ammoboxes", - "a3_weapons_f_epb_longrangerifles_gm3", - "a3_weapons_f_epb_longrangerifles_m320", - "a3_weapons_f_epb_rifles_mx_black", - "a3_weapons_f_epc", - "a3_weapons_f_explosives", - "a3_weapons_f_fia", - "a3_weapons_f_gamma", - "a3_weapons_f_gamma_acc", - "a3_weapons_f_gamma_ammoboxes", - "a3_weapons_f_gamma_items", - "a3_weapons_f_headgear", - "a3_weapons_f_itemholders", - "a3_weapons_f_items", - "a3_weapons_f_kart", - "a3_weapons_f_kart_pistols_pistol_signal_f", - "a3_weapons_f_launchers_law", - "a3_weapons_f_launchers_nlaw", - "a3_weapons_f_launchers_titan", - "a3_weapons_f_longrangerifles_gm6", - "a3_weapons_f_longrangerifles_m320", - "a3_weapons_f_machineguns_m200", - "a3_weapons_f_machineguns_zafir", - "a3_weapons_f_nato", - "a3_weapons_f_pistols_acpc2", - "a3_weapons_f_pistols_p07", - "a3_weapons_f_pistols_pdw2000", - "a3_weapons_f_pistols_pistol_heavy_01", - "a3_weapons_f_pistols_pistol_heavy_02", - "a3_weapons_f_pistols_rook40", - "a3_weapons_f_rifles_khaybar", - "a3_weapons_f_rifles_mk20", - "a3_weapons_f_rifles_mx", - "a3_weapons_f_rifles_sdar", - "a3_weapons_f_rifles_smg_02", - "a3_weapons_f_rifles_trg20", - "a3_weapons_f_rifles_vector", - "a3_weapons_f_uniforms", - "a3_weapons_f_vests", - "a3data", - "extended_eventhandlers", "CBA_UI", "CBA_XEH", "CBA_XEH_A3" + class ADDON { + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = { + "a3_air_f", + "a3_air_f_beta", + "a3_air_f_beta_heli_attack_01", + "a3_air_f_beta_heli_attack_02", + "a3_air_f_beta_heli_transport_01", + "a3_air_f_beta_heli_transport_02", + "a3_air_f_beta_parachute_01", + "a3_air_f_beta_parachute_02", + "a3_air_f_epb_heli_light_03", + "a3_air_f_epc_plane_cas_01", + "a3_air_f_epc_plane_cas_02", + "a3_air_f_epc_plane_fighter_03", + "a3_air_f_gamma_plane_fighter_03", + "a3_air_f_gamma_uav_01", + "a3_air_f_gamma_uav_02", + "a3_air_f_heli", + "a3_air_f_heli_heli_attack_01", + "a3_air_f_heli_heli_attack_02", + "a3_air_f_heli_heli_light_01", + "a3_air_f_heli_heli_light_02", + "a3_air_f_heli_heli_light_03", + "a3_air_f_heli_heli_transport_01", + "a3_air_f_heli_heli_transport_02", + "a3_air_f_heli_heli_transport_03", + "a3_air_f_heli_heli_transport_04", + "a3_air_f_heli_light_01", + "a3_air_f_heli_light_02", + "a3_animals_f", + "a3_animals_f_animconfig", + "a3_animals_f_chicken", + "a3_animals_f_dog", + "a3_animals_f_fishes", + "a3_animals_f_goat", + "a3_animals_f_kestrel", + "a3_animals_f_rabbit", + "a3_animals_f_seagull", + "a3_animals_f_sheep", + "a3_animals_f_snakes", + "a3_animals_f_turtle", + "a3_anims_f", + "a3_anims_f_config_sdr", + "a3_anims_f_epa", + "a3_anims_f_epc", + "a3_anims_f_heli", + "a3_anims_f_kart", + "a3_armor_f", + "a3_armor_f_amv", + "a3_armor_f_apc_wheeled_03", + "a3_armor_f_beta", + "a3_armor_f_beta_apc_tracked_02", + "a3_armor_f_epb_apc_tracked_03", + "a3_armor_f_epb_mbt_03", + "a3_armor_f_epc_mbt_01", + "a3_armor_f_marid", + "a3_armor_f_panther", + "a3_armor_f_slammer", + "a3_armor_f_t100k", + "a3_baseconfig_f", + "a3_boat_f", + "a3_boat_f_beta_boat_armed_01", + "a3_boat_f_beta_boat_transport_01", + "a3_boat_f_boat_armed_01", + "a3_boat_f_boat_transport_01", + "a3_boat_f_civilian_boat", + "a3_boat_f_epc_submarine_01_f", + "a3_boat_f_gamma_boat_transport_01", + "a3_boat_f_heli_boat_armed_01", + "a3_boat_f_heli_sdv_01", + "a3_boat_f_sdv_01", + "a3_boat_f_trawler", + "a3_cargoposes_f", + "a3_cargoposes_f_heli", + "a3_characters_f", + "a3_characters_f_beta", + "a3_characters_f_blufor", + "a3_characters_f_bootcamp", + "a3_characters_f_bootcamp_common", + "a3_characters_f_civil", + "a3_characters_f_common", + "a3_characters_f_epa", + "a3_characters_f_epb", + "a3_characters_f_epb_heads", + "a3_characters_f_epc", + "a3_characters_f_gamma", + "a3_characters_f_heads", + "a3_characters_f_indep", + "a3_characters_f_kart", + "a3_characters_f_opfor", + "a3_characters_f_proxies", + "a3_data_f", + "a3_data_f_bootcamp", + "a3_data_f_curator", + "a3_data_f_curator_characters", + "a3_data_f_curator_eagle", + "a3_data_f_curator_intel", + "a3_data_f_curator_misc", + "a3_data_f_curator_respawn", + "a3_data_f_curator_virtual", + "a3_data_f_heli", + "a3_data_f_hook", + "a3_data_f_kart", + "a3_data_f_kart_particleeffects", + "a3_data_f_particleeffects", + "a3_dubbing_radio_f", + "a3_editor_f", + "a3_functions_f", + "a3_functions_f_bootcamp", + "a3_functions_f_curator", + "a3_functions_f_epa", + "a3_functions_f_epc", + "a3_functions_f_heli", + "a3_language_f", + "a3_language_f_beta", + "a3_language_f_bootcamp", + "a3_language_f_curator", + "a3_language_f_epa", + "a3_language_f_epb", + "a3_language_f_epc", + "a3_language_f_gamma", + "a3_language_f_heli", + "a3_language_f_kart", + "a3_languagemissions_f", + "a3_languagemissions_f_beta", + "a3_languagemissions_f_gamma", + "a3_languagemissions_f_kart", + "a3_map_altis", + "a3_map_altis_scenes", + "a3_map_data", + "a3_map_stratis", + "a3_map_stratis_scenes", + "a3_map_vr_scenes", + "a3_misc_f", + "a3_misc_f_helpers", + "a3_missions_f", + "a3_missions_f_beta", + "a3_missions_f_bootcamp", + "a3_missions_f_curator", + "a3_missions_f_epa", + "a3_missions_f_epb", + "a3_missions_f_epc", + "a3_missions_f_gamma", + "a3_missions_f_heli", + "a3_missions_f_kart", + "a3_modules_f", + "a3_modules_f_beta", + "a3_modules_f_beta_firingdrills", + "a3_modules_f_bootcamp", + "a3_modules_f_bootcamp_misc", + "a3_modules_f_curator", + "a3_modules_f_curator_animals", + "a3_modules_f_curator_cas", + "a3_modules_f_curator_chemlights", + "a3_modules_f_curator_curator", + "a3_modules_f_curator_effects", + "a3_modules_f_curator_environment", + "a3_modules_f_curator_flares", + "a3_modules_f_curator_intel", + "a3_modules_f_curator_lightning", + "a3_modules_f_curator_mines", + "a3_modules_f_curator_misc", + "a3_modules_f_curator_multiplayer", + "a3_modules_f_curator_objectives", + "a3_modules_f_curator_ordnance", + "a3_modules_f_curator_respawn", + "a3_modules_f_curator_smokeshells", + "a3_modules_f_dyno", + "a3_modules_f_effects", + "a3_modules_f_epb", + "a3_modules_f_epb_misc", + "a3_modules_f_events", + "a3_modules_f_groupmodifiers", + "a3_modules_f_hc", + "a3_modules_f_heli", + "a3_modules_f_heli_spawnai", + "a3_modules_f_intel", + "a3_modules_f_kart", + "a3_modules_f_kart_timetrials", + "a3_modules_f_livefeed", + "a3_modules_f_marta", + "a3_modules_f_misc", + "a3_modules_f_multiplayer", + "a3_modules_f_objectmodifiers", + "a3_modules_f_sites", + "a3_modules_f_skirmish", + "a3_modules_f_strategicmap", + "a3_modules_f_supports", + "a3_modules_f_uav", + "a3_music_f", + "a3_music_f_bootcamp", + "a3_music_f_epa", + "a3_music_f_epb", + "a3_music_f_epc", + "a3_music_f_heli", + "a3_plants_f_bush", + "a3_roads_f", + "a3_rocks_f", + "a3_signs_f", + "a3_signs_f_ad", + "a3_soft_f", + "a3_soft_f_beta_quadbike", + "a3_soft_f_bootcamp_offroad_01", + "a3_soft_f_bootcamp_quadbike", + "a3_soft_f_bootcamp_truck", + "a3_soft_f_car", + "a3_soft_f_crusher_ugv", + "a3_soft_f_epc_truck_03", + "a3_soft_f_gamma_hemtt", + "a3_soft_f_gamma_offroad", + "a3_soft_f_gamma_quadbike", + "a3_soft_f_gamma_truckheavy", + "a3_soft_f_heli_car", + "a3_soft_f_heli_crusher_ugv", + "a3_soft_f_heli_mrap_01", + "a3_soft_f_heli_mrap_02", + "a3_soft_f_heli_mrap_03", + "a3_soft_f_heli_quadbike", + "a3_soft_f_heli_suv", + "a3_soft_f_heli_truck", + "a3_soft_f_hemtt", + "a3_soft_f_kart_kart_01", + "a3_soft_f_mrap_01", + "a3_soft_f_mrap_02", + "a3_soft_f_mrap_03", + "a3_soft_f_offroad_01", + "a3_soft_f_quadbike", + "a3_soft_f_suv", + "a3_soft_f_truck", + "a3_soft_f_truckheavy", + "a3_sounds_f", + "a3_sounds_f_bootcamp", + "a3_sounds_f_epb", + "a3_sounds_f_epc", + "a3_static_f", + "a3_static_f_beta_mortar_01", + "a3_static_f_gamma", + "a3_static_f_gamma_aa", + "a3_static_f_gamma_at", + "a3_static_f_gamma_mortar_01", + "a3_static_f_mortar_01", + "a3_structures_f", + "a3_structures_f_bootcamp_civ_camping", + "a3_structures_f_bootcamp_civ_sportsgrounds", + "a3_structures_f_bootcamp_ind_cargo", + "a3_structures_f_bootcamp_items_electronics", + "a3_structures_f_bootcamp_items_food", + "a3_structures_f_bootcamp_items_sport", + "a3_structures_f_bootcamp_system", + "a3_structures_f_bootcamp_training", + "a3_structures_f_bootcamp_vr_blocks", + "a3_structures_f_bootcamp_vr_coverobjects", + "a3_structures_f_bootcamp_vr_helpers", + "a3_structures_f_bridges", + "a3_structures_f_civ", + "a3_structures_f_civ_accessories", + "a3_structures_f_civ_ancient", + "a3_structures_f_civ_belltowers", + "a3_structures_f_civ_calvaries", + "a3_structures_f_civ_camping", + "a3_structures_f_civ_chapels", + "a3_structures_f_civ_constructions", + "a3_structures_f_civ_dead", + "a3_structures_f_civ_garbage", + "a3_structures_f_civ_graffiti", + "a3_structures_f_civ_infoboards", + "a3_structures_f_civ_kiosks", + "a3_structures_f_civ_lamps", + "a3_structures_f_civ_market", + "a3_structures_f_civ_offices", + "a3_structures_f_civ_pavements", + "a3_structures_f_civ_playground", + "a3_structures_f_civ_sportsgrounds", + "a3_structures_f_civ_statues", + "a3_structures_f_civ_tourism", + "a3_structures_f_dominants", + "a3_structures_f_dominants_amphitheater", + "a3_structures_f_dominants_castle", + "a3_structures_f_dominants_church", + "a3_structures_f_dominants_hospital", + "a3_structures_f_dominants_lighthouse", + "a3_structures_f_dominants_wip", + "a3_structures_f_epa_civ_camping", + "a3_structures_f_epa_civ_constructions", + "a3_structures_f_epa_items_electronics", + "a3_structures_f_epa_items_food", + "a3_structures_f_epa_items_medical", + "a3_structures_f_epa_items_tools", + "a3_structures_f_epa_items_vessels", + "a3_structures_f_epa_mil_scrapyard", + "a3_structures_f_epa_walls", + "a3_structures_f_epb_civ_accessories", + "a3_structures_f_epb_civ_camping", + "a3_structures_f_epb_civ_dead", + "a3_structures_f_epb_civ_garbage", + "a3_structures_f_epb_civ_graffiti", + "a3_structures_f_epb_civ_playground", + "a3_structures_f_epb_furniture", + "a3_structures_f_epb_items_documents", + "a3_structures_f_epb_items_luggage", + "a3_structures_f_epb_items_military", + "a3_structures_f_epb_items_vessels", + "a3_structures_f_epb_naval_fishing", + "a3_structures_f_epc_civ_accessories", + "a3_structures_f_epc_civ_camping", + "a3_structures_f_epc_civ_garbage", + "a3_structures_f_epc_civ_infoboards", + "a3_structures_f_epc_civ_kiosks", + "a3_structures_f_epc_civ_playground", + "a3_structures_f_epc_civ_tourism", + "a3_structures_f_epc_dominants_ghosthotel", + "a3_structures_f_epc_dominants_stadium", + "a3_structures_f_epc_furniture", + "a3_structures_f_epc_items_documents", + "a3_structures_f_epc_items_electronics", + "a3_structures_f_epc_walls", + "a3_structures_f_furniture", + "a3_structures_f_heli_civ_accessories", + "a3_structures_f_heli_civ_constructions", + "a3_structures_f_heli_civ_garbage", + "a3_structures_f_heli_civ_market", + "a3_structures_f_heli_furniture", + "a3_structures_f_heli_ind_airport", + "a3_structures_f_heli_ind_cargo", + "a3_structures_f_heli_ind_machines", + "a3_structures_f_heli_items_airport", + "a3_structures_f_heli_items_electronics", + "a3_structures_f_heli_items_food", + "a3_structures_f_heli_items_luggage", + "a3_structures_f_heli_items_sport", + "a3_structures_f_heli_items_tools", + "a3_structures_f_heli_vr_helpers", + "a3_structures_f_households", + "a3_structures_f_households_addons", + "a3_structures_f_households_house_big01", + "a3_structures_f_households_house_big02", + "a3_structures_f_households_house_shop01", + "a3_structures_f_households_house_shop02", + "a3_structures_f_households_house_small01", + "a3_structures_f_households_house_small02", + "a3_structures_f_households_house_small03", + "a3_structures_f_households_slum", + "a3_structures_f_households_stone_big", + "a3_structures_f_households_stone_shed", + "a3_structures_f_households_stone_small", + "a3_structures_f_households_wip", + "a3_structures_f_ind", + "a3_structures_f_ind_airport", + "a3_structures_f_ind_cargo", + "a3_structures_f_ind_carservice", + "a3_structures_f_ind_concretemixingplant", + "a3_structures_f_ind_crane", + "a3_structures_f_ind_dieselpowerplant", + "a3_structures_f_ind_factory", + "a3_structures_f_ind_fuelstation", + "a3_structures_f_ind_fuelstation_small", + "a3_structures_f_ind_pipes", + "a3_structures_f_ind_powerlines", + "a3_structures_f_ind_reservoirtank", + "a3_structures_f_ind_shed", + "a3_structures_f_ind_solarpowerplant", + "a3_structures_f_ind_tank", + "a3_structures_f_ind_transmitter_tower", + "a3_structures_f_ind_wavepowerplant", + "a3_structures_f_ind_windmill", + "a3_structures_f_ind_windpowerplant", + "a3_structures_f_items", + "a3_structures_f_items_cans", + "a3_structures_f_items_documents", + "a3_structures_f_items_electronics", + "a3_structures_f_items_gadgets", + "a3_structures_f_items_luggage", + "a3_structures_f_items_medical", + "a3_structures_f_items_military", + "a3_structures_f_items_stationery", + "a3_structures_f_items_tools", + "a3_structures_f_items_valuables", + "a3_structures_f_items_vessels", + "a3_structures_f_kart_civ_sportsgrounds", + "a3_structures_f_kart_mil_flags", + "a3_structures_f_kart_signs_companies", + "a3_structures_f_mil", + "a3_structures_f_mil_bagbunker", + "a3_structures_f_mil_bagfence", + "a3_structures_f_mil_barracks", + "a3_structures_f_mil_bunker", + "a3_structures_f_mil_cargo", + "a3_structures_f_mil_flags", + "a3_structures_f_mil_fortification", + "a3_structures_f_mil_helipads", + "a3_structures_f_mil_offices", + "a3_structures_f_mil_radar", + "a3_structures_f_mil_scrapyard", + "a3_structures_f_mil_shelters", + "a3_structures_f_mil_tenthangar", + "a3_structures_f_naval", + "a3_structures_f_naval_buoys", + "a3_structures_f_naval_fishing", + "a3_structures_f_naval_piers", + "a3_structures_f_naval_rowboats", + "a3_structures_f_research", + "a3_structures_f_signs_companies", + "a3_structures_f_system", + "a3_structures_f_training", + "a3_structures_f_training_invisibletarget", + "a3_structures_f_walls", + "a3_structures_f_wrecks", + "a3_supplies_f_heli", + "a3_supplies_f_heli_bladders", + "a3_supplies_f_heli_cargonets", + "a3_supplies_f_heli_fuel", + "a3_supplies_f_heli_slingload", + "a3_uav_f_characters_f_gamma", + "a3_uav_f_weapons_f_gamma_ammoboxes", + "a3_ui_f", + "a3_ui_f_bootcamp", + "a3_ui_f_curator", + "a3_ui_f_heli", + "a3_ui_f_kart", + "a3_uifonts_f", + "a3_weapons_f", + "a3_weapons_f_aaf", + "a3_weapons_f_acc", + "a3_weapons_f_ammoboxes", + "a3_weapons_f_beta", + "a3_weapons_f_beta_acc", + "a3_weapons_f_beta_ammoboxes", + "a3_weapons_f_beta_ebr", + "a3_weapons_f_beta_rifles_khaybar", + "a3_weapons_f_beta_rifles_mx", + "a3_weapons_f_beta_rifles_trg20", + "a3_weapons_f_bootcamp", + "a3_weapons_f_bootcamp_ammoboxes", + "a3_weapons_f_bootcamp_longrangerifles_gm6", + "a3_weapons_f_bootcamp_longrangerifles_m320", + "a3_weapons_f_csat", + "a3_weapons_f_dummyweapons", + "a3_weapons_f_ebr", + "a3_weapons_f_epa", + "a3_weapons_f_epa_acc", + "a3_weapons_f_epa_ammoboxes", + "a3_weapons_f_epa_ebr", + "a3_weapons_f_epa_longrangerifles_dmr_01", + "a3_weapons_f_epa_longrangerifles_gm6", + "a3_weapons_f_epa_rifles_mx", + "a3_weapons_f_epb", + "a3_weapons_f_epb_acc", + "a3_weapons_f_epb_ammoboxes", + "a3_weapons_f_epb_longrangerifles_gm3", + "a3_weapons_f_epb_longrangerifles_m320", + "a3_weapons_f_epb_rifles_mx_black", + "a3_weapons_f_epc", + "a3_weapons_f_explosives", + "a3_weapons_f_fia", + "a3_weapons_f_gamma", + "a3_weapons_f_gamma_acc", + "a3_weapons_f_gamma_ammoboxes", + "a3_weapons_f_gamma_items", + "a3_weapons_f_headgear", + "a3_weapons_f_itemholders", + "a3_weapons_f_items", + "a3_weapons_f_kart", + "a3_weapons_f_kart_pistols_pistol_signal_f", + "a3_weapons_f_launchers_law", + "a3_weapons_f_launchers_nlaw", + "a3_weapons_f_launchers_titan", + "a3_weapons_f_longrangerifles_gm6", + "a3_weapons_f_longrangerifles_m320", + "a3_weapons_f_machineguns_m200", + "a3_weapons_f_machineguns_zafir", + "a3_weapons_f_nato", + "a3_weapons_f_pistols_acpc2", + "a3_weapons_f_pistols_p07", + "a3_weapons_f_pistols_pdw2000", + "a3_weapons_f_pistols_pistol_heavy_01", + "a3_weapons_f_pistols_pistol_heavy_02", + "a3_weapons_f_pistols_rook40", + "a3_weapons_f_rifles_khaybar", + "a3_weapons_f_rifles_mk20", + "a3_weapons_f_rifles_mx", + "a3_weapons_f_rifles_sdar", + "a3_weapons_f_rifles_smg_02", + "a3_weapons_f_rifles_trg20", + "a3_weapons_f_rifles_vector", + "a3_weapons_f_uniforms", + "a3_weapons_f_vests", + "a3data", + "map_vr", + "extended_eventhandlers", "CBA_UI", "CBA_XEH", "CBA_XEH_A3" + }; + author[] = {"ACE Team"}; + authorUrl = ""; + versionDesc = "A.C.E."; + versionAct = "['MAIN',_this] execVM '\z\ace\addons\main\about.sqf';"; + VERSION_CONFIG; }; - author[] = {"ACE Team"}; - authorUrl = ""; - versionDesc = "A.C.E."; - versionAct = "['MAIN',_this] execVM '\z\ace\addons\main\about.sqf';"; - VERSION_CONFIG; - }; }; class CfgMods { - class PREFIX { - dir = "@ACE"; - name = "Core - Advanced Combat Environment"; - picture = "A3\Ui_f\data\Logos\arma3_expansion_alpha_ca"; - hidePicture = "true"; - hideName = "true"; - actionName = "Website"; - action = "http://ace.dev-heaven.net"; - description = "Bugtracker: "; - }; + class PREFIX { + dir = "@ACE"; + name = "Core - Advanced Combat Environment"; + picture = "A3\Ui_f\data\Logos\arma3_expansion_alpha_ca"; + hidePicture = "true"; + hideName = "true"; + actionName = "Website"; + action = "http://ace.dev-heaven.net"; + description = "Bugtracker: "; + }; }; class CfgSettings { - class CBA { - class Versioning { - class PREFIX { - level = DEFAULT_VERSIONING_LEVEL; - handler = "ace_common_fnc_mismatch"; - class Dependencies { - CBA[]={"cba_main", {1,0,0}, "true"}; - XEH[]={"cba_xeh", {1,0,0}, "true"}; + class CBA { + class Versioning { + class PREFIX { + level = DEFAULT_VERSIONING_LEVEL; + handler = "ace_common_fnc_mismatch"; + class Dependencies { + CBA[]={"cba_main", {1,0,0}, "true"}; + XEH[]={"cba_xeh", {1,0,0}, "true"}; + }; + }; }; - }; - }; -/* + /* class Registry { - class PREFIX { + class PREFIX { removed[] = {}; - }; }; -*/ - }; + }; + */ + }; }; #include "CfgModuleCategories.hpp" diff --git a/addons/map/CfgVehicles.hpp b/addons/map/CfgVehicles.hpp index 6c2d4a1ee1..4452c10b23 100644 --- a/addons/map/CfgVehicles.hpp +++ b/addons/map/CfgVehicles.hpp @@ -15,7 +15,6 @@ class CfgVehicles { exceptions[] = {"ACE_Drag_isNotDragging", QEGVAR(common,notOnMap)}; showDisabled = 0; priority = 100; - subMenu[] = {"ACE_MapTools", 1}; enableInside = 1; class ACE_MapToolsHide { @@ -85,12 +84,14 @@ class CfgVehicles { }; class ACE_Actions { - class ACE_CopyMap { - displayName = "$STR_ACE_Map_CopyMap"; - condition = QUOTE(([_target] call EFUNC(common,isPlayer) && {'ItemMap' in assigneditems _player} && {'ACE_MapTools' in items _player} && {'ItemMap' in assignedItems _target})); - statement = QUOTE([ARR_2(_player,_target)] call FUNC(copyMapStart)); - showDisabled = 0; - priority = -1; + class ACE_MainActions { + class ACE_CopyMap { + displayName = "$STR_ACE_Map_CopyMap"; + condition = QUOTE(([_target] call EFUNC(common,isPlayer) && {'ItemMap' in assigneditems _player} && {'ACE_MapTools' in items _player} && {'ItemMap' in assignedItems _target})); + statement = QUOTE([ARR_2(_player,_target)] call FUNC(copyMapStart)); + showDisabled = 0; + priority = -1; + }; }; }; }; diff --git a/addons/markers/functions/fnc_initInsertMarker.sqf b/addons/markers/functions/fnc_initInsertMarker.sqf index d172c6a532..e5328a7470 100644 --- a/addons/markers/functions/fnc_initInsertMarker.sqf +++ b/addons/markers/functions/fnc_initInsertMarker.sqf @@ -31,42 +31,49 @@ ctrlSetFocus _text; //Change ok button's text based on current channel - //if (isNull _buttonOK) exitWith {true}; + [{ + EXPLODE_2_PVT(_this,_params,_pfhId); + EXPLODE_1_PVT(_params,_buttonOK); - _channel = ""; - _textColor = [1,1,1,1]; - switch (call EFUNC(common,currentChannel)) do { + if (isNull _buttonOK) exitWith { + [_pfhId] call CBA_fnc_removePerFrameHandler; + }; + + _channel = ""; + _textColor = [1,1,1,1]; + switch (call EFUNC(common,currentChannel)) do { case ("global"): { - _channel = localize "str_channel_global"; - _textColor = [(216/255),(216/255),(216/255),1]; - }; + _channel = localize "str_channel_global"; + _textColor = [(216/255),(216/255),(216/255),1]; + }; case ("side"): { - _channel = localize "str_channel_side"; - _textColor = [(70/255),(211/255),(252/255),1]; - }; + _channel = localize "str_channel_side"; + _textColor = [(70/255),(211/255),(252/255),1]; + }; case ("group"): { - _channel = localize "str_channel_group"; - _textColor = [(181/255),(248/255),(98/255),1]; - }; + _channel = localize "str_channel_group"; + _textColor = [(181/255),(248/255),(98/255),1]; + }; case ("vehicle"): { - _channel = localize "str_channel_vehicle"; - _textColor = [(255/255),(208/255),(0/255),1]; - }; + _channel = localize "str_channel_vehicle"; + _textColor = [(255/255),(208/255),(0/255),1]; + }; case ("direct"): { - _channel = localize "str_channel_direct"; - _textColor = [(255/255),(255/255),(255/255),1]; - }; + _channel = localize "str_channel_direct"; + _textColor = [(255/255),(255/255),(255/255),1]; + }; case ("command"): { - _channel = localize "str_channel_command"; - _textColor = [(255/255),(255/255),(70/255),1]; + _channel = localize "str_channel_command"; + _textColor = [(255/255),(255/255),(70/255),1]; + }; }; - }; - //If localization not found, then don't touch anything (default is RscButtonMenuOK's localized text) - if (_channel != "") then { - _buttonOK ctrlSetTextColor _textColor; - _buttonOK ctrlSetText format [localize "STR_ACE_Markers_PlaceIn", _channel]; - }; + //If localization not found, then don't touch anything (default is RscButtonMenuOK's localized text) + if (_channel != "") then { + _buttonOK ctrlSetTextColor _textColor; + _buttonOK ctrlSetText format [localize "STR_ACE_Markers_PlaceIn", _channel]; + }; + }, 0, [_buttonOK]] call CBA_fnc_addPerFrameHandler; //--- Background _pos = ctrlposition _text; diff --git a/addons/medical/$PBOPREFIX$ b/addons/medical/$PBOPREFIX$ index 03a98be3f5..72c25436dd 100644 --- a/addons/medical/$PBOPREFIX$ +++ b/addons/medical/$PBOPREFIX$ @@ -1 +1 @@ -z\ace\Addons\medical \ No newline at end of file +z\ace\addons\medical diff --git a/addons/medical/ACE_Medical_Treatments.hpp b/addons/medical/ACE_Medical_Treatments.hpp new file mode 100644 index 0000000000..a50648f599 --- /dev/null +++ b/addons/medical/ACE_Medical_Treatments.hpp @@ -0,0 +1,724 @@ + +class ACE_Medical_Actions { + class Basic { + // @todo: localization + class Bandage { + displayName = "Bandage"; + displayNameProgress = "Bandaging ..."; + + treatmentLocations[] = {"All"}; + requiredMedic = 0; + treatmentTime = 5; + treatmentTimeSelfCoef = 1; + items[] = {{QGVAR(fieldDressing), QGVAR(packingBandage), QGVAR(elasticBandage), QGVAR(quikClot)}}; + + itemConsumed = 1; + + callbackSuccess = QUOTE(DFUNC(treatmentBasic_bandage)); + callbackFailure = ""; + callbackProgress = ""; + + animationPatient = ""; + animationCaller = "AinvPknlMstpSnonWnonDnon_medic4"; + animationCallerProne = "AinvPpneMstpSlayW[wpn]Dnon_medic"; + animationCallerSelf = "AinvPknlMstpSlayW[wpn]Dnon_medic"; + animationCallerSelfProne = "AinvPpneMstpSlayW[wpn]Dnon_medic"; + }; + class Morphine: Bandage { + displayName = "Morphine"; + displayNameProgress = "Injecting Morphine ..."; + treatmentTime = 2; + items[] = {QGVAR(morphine)}; + callbackSuccess = QUOTE(DFUNC(treatmentBasic_morphine)); + animationCaller = "AinvPknlMstpSnonWnonDnon_medic1"; + }; + class Epipen: Bandage { + displayName = "Epinephrine"; + displayNameProgress = "Injecting Epinephrine ..."; + requiredMedic = 1; + treatmentTime = 3; + items[] = {QGVAR(epipen)}; + callbackSuccess = QUOTE(DFUNC(treatmentBasic_epipen)); + animationCaller = "AinvPknlMstpSnonWnonDnon_medic1"; + }; + class Bloodbag: Bandage { + displayName = "Blood Bag"; + displayNameProgress = "Transfusing Blood ..."; + requiredMedic = 1; + treatmentTime = 20; + items[] = {{QGVAR(bloodIV), QGVAR(bloodIV_500), QGVAR(bloodIV_250)}}; + callbackSuccess = QUOTE(DFUNC(treatmentBasic_bloodbag)); + animationCaller = "AinvPknlMstpSnonWnonDnon_medic1"; + }; + }; + + class Advanced { + // cse_surgical_kit cse_bandage_basic cse_packing_bandage cse_bandageElastic cse_tourniquet cse_splint cse_morphine cse_atropine cse_epinephrine cse_plasma_iv cse_plasma_iv_500 cse_plasma_iv250 cse_blood_iv cse_blood_iv_500 cse_blood_iv_250 cse_saline_iv cse_saline_iv_500 cse_saline_iv_250 cse_quikclot cse_nasopharyngeal_tube cse_opa cse_liquidSkin cse_chestseal cse_personal_aid_kit + + class FieldDressing { + // Which locations can this treatment action be used? Available: Field, MedicalFacility, MedicalVehicle, All. + treatmentLocations[] = {"All"}; + // What is the level of medical skill required for this treatment action? 0 = all soldiers, 1 = medic, 2 = doctor + requiredMedic = 0; + // The time it takes for a treatment action to complete. Time is in seconds. + treatmentTime = 5; + // Item required for the action. Leave empty for no item required. + items[] = {QGVAR(fieldDressing)}; + // Callbacks + callbackSuccess = QUOTE(DFUNC(treatmentAdvanced_bandage)); + callbackFailure = ""; + callbackProgress = ""; + animationPatient = ""; + animationCaller = ""; // TODO + itemConsumed = 1; + }; + class PackingBandage: fieldDressing { + items[] = {QGVAR(packingBandage)}; + }; + class ElasticBandage: fieldDressing { + items[] = {QGVAR(elasticBandage)}; + }; + class QuikClot: fieldDressing { + items[] = {QGVAR(quikClot)}; + }; + class Tourniquet: fieldDressing { + items[] = {QGVAR(tourniquet)}; + treatmentTime = 6; + callbackSuccess = QUOTE(DFUNC(treatmentTourniquet)); + }; + class Morphine: fieldDressing { + items[] = {QGVAR(morphine)}; + treatmentTime = 3; + callbackSuccess = QUOTE(DFUNC(treatmentAdvanced_medication)); + }; + class Atropine: fieldDressing { + items[] = {QGVAR(atropine)}; + }; + class Epinephrine: fieldDressing { + items[] = {QGVAR(epinephrine)}; + }; + class BloodIV: fieldDressing { + items[] = {QGVAR(bloodIV)}; + requiredMedic = 1; + treatmentTime = 7; + callbackSuccess = QUOTE(DFUNC(treatmentIV)); + }; + class BloodIV_500: BloodIV { + items[] = {QGVAR(bloodIV_500)}; + }; + class BloodIV_250: BloodIV { + items[] = {QGVAR(bloodIV_250)}; + }; + class PlasmaIV: BloodIV { + items[] = {QGVAR(plasmaIV)}; + }; + class PlasmaIV_500: PlasmaIV { + items[] = {QGVAR(plasmaIV_500)}; + }; + class PlasmaIV_250: PlasmaIV { + items[] = {QGVAR(plasmaIV_250)}; + }; + class SalineIV: BloodIV { + items[] = {QGVAR(salineIV)}; + }; + class SalineIV_500: SalineIV { + items[] = {QGVAR(salineIV_500)}; + }; + class SalineIV_250: SalineIV { + items[] = {QGVAR(salineIV_250)}; + }; + class SurgicalKit: fieldDressing { + items[] = {QGVAR(surgicalKit)}; + treatmentLocations[] = {"MedicalFacility", "MedicalVehicle"}; + requiredMedic = 2; + treatmentTime = 15; + callbackSuccess = QUOTE(DFUNC(treatmentAdvanced_surgicalKit)); + itemConsumed = 0; + }; + class PersonalAidKit: fieldDressing { + items[] = {QGVAR(personalAidKit)}; + treatmentLocations[] = {"All"}; + requiredMedic = 1; + treatmentTime = 15; + callbackSuccess = QUOTE(DFUNC(treatmentAdvanced_fullHeal)); + itemConsumed = 0; + }; + class CheckPulse: fieldDressing { + treatmentLocations[] = {"All"}; + requiredMedic = 0; + treatmentTime = 2; + items[] = {}; + callbackSuccess = QUOTE(DFUNC(actionCheckPulse)); + callbackFailure = ""; + callbackProgress = ""; + animationPatient = ""; + animationCaller = ""; // TODO + itemConsumed = 0; + }; + class CheckBloodPressure: CheckPulse { + callbackSuccess = QUOTE(DFUNC(actionCheckBloodPressure)); + }; + class CheckResponse: CheckPulse { + callbackSuccess = QUOTE(DFUNC(actionCheckResponse)); + }; + class RemoveTourniquet: CheckPulse { + treatmentTime = 2.5; + callbackSuccess = QUOTE(DFUNC(actionRemoveTourniquet)); + }; + class CPR: fieldDressing { + treatmentLocations[] = {"All"}; + requiredMedic = 0; + treatmentTime = 25; + items[] = {}; + callbackSuccess = QUOTE(DFUNC(treatmentAdvanced_CPR)); + callbackFailure = ""; + callbackProgress = ""; + animationPatient = ""; + animationCaller = ""; // TODO + itemConsumed = 0; + }; + + }; +}; + +class ACE_Medical_Advanced { + // Defines all the possible injury types for advanced medical + class Injuries { + // All the possible wounds + class wounds { + + // Source: Scarle + // Also called scrapes, they occur when the skin is rubbed away by friction against another rough surface (e.g. rope burns and skinned knees). + class Abrasion { + name = "Scrape"; + selections[] = {"All"}; + bleedingRate = 0.0001; + pain = 0.1; + causes[] = {"falling", "ropeburn", "vehiclecrash"}; + minDamage = 0.01; + class Minor { + minDamage = 0.01; + bleedingRate = 0.0001; + }; + class Medium { + minDamage = 0.2; + bleedingRate = 0.00015; + }; + class Large { + minDamage = 0.3; + bleedingRate = 0.0002; + }; + }; + + // Occur when an entire structure or part of it is forcibly pulled away, such as the loss of a permanent tooth or an ear lobe. Explosions, gunshots, and animal bites may cause avulsions. + class Avulsions { + name = "Avulsion"; + selections[] = {"All"}; + bleedingRate = 0.01; + pain = 1; + causes[] = {"explosive", "vehiclecrash", "grenade", "shell", "bullet", "backblast", "bite"}; + minDamage = 0.2; + class Minor { + minDamage = 0.2; + bleedingRate = 0.01; + }; + class Medium { + minDamage = 0.3; + bleedingRate = 0.02; + }; + class Large { + minDamage = 0.5; + bleedingRate = 0.05; + }; + }; + + // Also called bruises, these are the result of a forceful trauma that injures an internal structure without breaking the skin. Blows to the chest, abdomen, or head with a blunt instrument (e.g. a football or a fist) can cause contusions. + class Contusion { + name = "Bruise"; + selections[] = {"All"}; + bleedingRate = 0.0; + pain = 1; + causes[] = {"bullet", "backblast", "punch","vehiclecrash","falling"}; + minDamage = 0.01; + class Minor { + minDamage = 0.01; + }; + class Medium { + minDamage = 0.1; + }; + class Large { + minDamage = 0.3; + }; + }; + + // Occur when a heavy object falls onto a person, splitting the skin and shattering or tearing underlying structures. + class CrushWound { + name = "Crushed tissue"; + selections[] = {"All"}; + bleedingRate = 0.01; + pain = 1; + causes[] = {"falling", "vehiclecrash", "punch"}; + minDamage = 0.1; + class Minor { + minDamage = 0.1; + bleedingRate = 0.005; + }; + class Medium { + minDamage = 0.4; + bleedingRate = 0.007; + }; + class Large { + minDamage = 0.6; + bleedingRate = 0.0095; + }; + }; + + // Slicing wounds made with a sharp instrument, leaving even edges. They may be as minimal as a paper cut or as significant as a surgical incision. + class Cut { + name = "Cut"; + selections[] = {"All"}; + bleedingRate = 0.01; + pain = 1; + causes[] = {"vehiclecrash", "grenade", "explosive", "shell", "backblast", "stab"}; + minDamage = 0.1; + class Minor { + minDamage = 0.1; + bleedingRate = 0.005; + }; + class Medium { + minDamage = 0.3; + bleedingRate = 0.02; + }; + class Large { + minDamage = 0.65; + bleedingRate = 0.05; + }; + }; + + // Also called tears, these are separating wounds that produce ragged edges. They are produced by a tremendous force against the body, either from an internal source as in childbirth, or from an external source like a punch. + class Laceration { + name = "Tear"; + selections[] = {"All"}; + bleedingRate = 0.01; + pain = 1; + causes[] = {"vehiclecrash", "punch"}; + minDamage = 0.01; + class Minor { + minDamage = 0.1; + bleedingRate = 0.005; + }; + class Medium { + minDamage = 0.5; + bleedingRate = 0.01; + }; + class Large { + minDamage = 0.7; + bleedingRate = 0.03; + }; + }; + + // Also called velocity wounds, they are caused by an object entering the body at a high speed, typically a bullet or small peices of shrapnel. + class velocityWound { + name = "Velocity Wound"; + selections[] = {"All"}; + bleedingRate = 0.01; + pain = 1; + causes[] = {"bullet", "grenade","explosive", "shell"}; + minDamage = 0.15; + class Minor { + minDamage = 0.15; + bleedingRate = 0.025; + }; + class Medium { + minDamage = 0.3; + bleedingRate = 0.05; + }; + class Large { + minDamage = 0.75; + bleedingRate = 0.1; + }; + }; + + // Deep, narrow wounds produced by sharp objects such as nails, knives, and broken glass. + class punctureWound { + name = "Puncture Wound"; + selections[] = {"All"}; + bleedingRate = 0.01; + pain = 1; + causes[] = {"stab", "grenade"}; + minDamage = 0.01; + class Minor { + minDamage = 0.01; + bleedingRate = 0.01; + }; + class Medium { + minDamage = 0.5; + bleedingRate = 0.03; + }; + class Large { + minDamage = 0.65; + bleedingRate = 0.08; + }; + }; + }; + class fractures { + class Femur { + name = "Broken Femur"; + selections[] = {"Head", "Torso"}; + pain = 20; + causes[] = {"Bullet", "VehicleCrash", "Backblast", "Explosive", "Shell", "Grenade"}; + minDamage = 0.5; + }; + }; + class damageTypes { + thresholds[] = {{0.1, 1}}; + selectionSpecific = 1; + class bullet { + // above damage, amount. Put the highest threshold to the left and lower the threshold with the elements to the right of it. + thresholds[] = {{0.1, 1}}; + selectionSpecific = 1; + }; + class grenade { + thresholds[] = {{0.1, 3}, {0, 1}}; + selectionSpecific = 0; + }; + class explosive { + thresholds[] = {{1, 6}, {0.1, 4}, {0, 1}}; + selectionSpecific = 0; + }; + class shell { + thresholds[] = {{1, 7}, {0.1, 5}, {0, 1}}; + selectionSpecific = 0; + }; + class vehiclecrash { + thresholds[] = {{0.25, 5}}; + selectionSpecific = 0; + }; + class backblast { + thresholds[] = {{0.25, 5}}; + selectionSpecific = 0; + }; + class stab { + thresholds[] = {{0.1, 1}}; + selectionSpecific = 1; + }; + class punch { + thresholds[] = {{0.1, 1}}; + selectionSpecific = 1; + }; + class falling { + thresholds[] = {{0.1, 1}}; + selectionSpecific = 1; + }; + class ropeburn { + thresholds[] = {{0.1, 1}}; + selectionSpecific = 1; + }; + }; + }; + class Treatment { + class Bandaging { + class FieldDressing { + // How effect is the bandage for treating one wounds type injury + effectiveness = 1; + // What is the chance and delays (in seconds) of the treated default injury reopening + reopeningChance = 0.1; + reopeningMinDelay = 120; + reopeningMaxDelay = 200; + class Abrasion { + effectiveness = 1; + reopeningChance = 0; + reopeningMinDelay = 0; + reopeningMaxDelay = 0; + }; + class Avulsions: Abrasion { + effectiveness = 0.3; + reopeningChance = 0.5; + reopeningMinDelay = 120; + reopeningMaxDelay = 200; + }; + class Contusion: Abrasion { + effectiveness = 1; + reopeningChance = 0; + reopeningMinDelay = 0; + reopeningMaxDelay = 0; + }; + class CrushWound: Abrasion { + effectiveness = 0.6; + reopeningChance = 0.2; + reopeningMinDelay = 120; + reopeningMaxDelay = 200; + }; + class Cut: Abrasion { + effectiveness = 0.4; + reopeningChance = 0.5; + reopeningMinDelay = 220; + reopeningMaxDelay = 260; + }; + class Laceration: Abrasion { + effectiveness = 0.7; + reopeningChance = 0.3; + reopeningMinDelay = 120; + reopeningMaxDelay = 260; + }; + class velocityWound: Abrasion { + effectiveness = 0.3; + reopeningChance = 0.8; + reopeningMinDelay = 20; + reopeningMaxDelay = 300; + }; + class punctureWound: Abrasion { + effectiveness = 0.5; + reopeningChance = 0.8; + reopeningMinDelay = 20; + reopeningMaxDelay = 300; + }; + }; + class PackingBandage: fieldDressing { + class Abrasion { + effectiveness = 1; + reopeningChance = 0; + reopeningMinDelay = 0; + reopeningMaxDelay = 0; + }; + class Avulsions: Abrasion { + effectiveness = 1; + reopeningChance = 0.3; + reopeningMinDelay = 120; + reopeningMaxDelay = 200; + }; + class Contusion: Abrasion { + effectiveness = 1; + reopeningChance = 0; + reopeningMinDelay = 0; + reopeningMaxDelay = 0; + }; + class CrushWound: Abrasion { + effectiveness = 0.6; + reopeningChance = 0.2; + reopeningMinDelay = 120; + reopeningMaxDelay = 200; + }; + class Cut: Abrasion { + effectiveness = 0.2; + reopeningChance = 0.6; + reopeningMinDelay = 30; + reopeningMaxDelay = 260; + }; + class Laceration: Abrasion { + effectiveness = 0.3; + reopeningChance = 0.3; + reopeningMinDelay = 120; + reopeningMaxDelay = 260; + }; + class velocityWound: Abrasion { + effectiveness = 1; + reopeningChance = 0.5; + reopeningMinDelay = 20; + reopeningMaxDelay = 300; + }; + class punctureWound: Abrasion { + effectiveness = 0.3; + reopeningChance = 0.5; + reopeningMinDelay = 20; + reopeningMaxDelay = 300; + }; + }; + class ElasticBandage: fieldDressing { + class Abrasion { + effectiveness = 1; + reopeningChance = 0; + reopeningMinDelay = 0; + reopeningMaxDelay = 0; + }; + class Avulsions: Abrasion { + effectiveness = 0.3; + reopeningChance = 0.4; + reopeningMinDelay = 120; + reopeningMaxDelay = 200; + }; + class Contusion: Abrasion { + effectiveness = 1; + reopeningChance = 0; + reopeningMinDelay = 0; + reopeningMaxDelay = 0; + }; + class CrushWound: Abrasion { + effectiveness = 1; + reopeningChance = 0; + reopeningMinDelay = 0; + reopeningMaxDelay = 0; + }; + class Cut: Abrasion { + effectiveness = 1; + reopeningChance = 0.2; + reopeningMinDelay = 10; + reopeningMaxDelay = 400; + }; + class Laceration: Abrasion { + effectiveness = 1; + reopeningChance = 0.3; + reopeningMinDelay = 120; + reopeningMaxDelay = 260; + }; + class velocityWound: Abrasion { + effectiveness = 0.5; + reopeningChance = 0.5; + reopeningMinDelay = 20; + reopeningMaxDelay = 300; + }; + class punctureWound: Abrasion { + effectiveness = 0.85; + reopeningChance = 0.5; + reopeningMinDelay = 20; + reopeningMaxDelay = 300; + }; + }; + class QuikClot: fieldDressing { + class Abrasion { + effectiveness = 0.7; + reopeningChance = 0; + reopeningMinDelay = 0; + reopeningMaxDelay = 0; + }; + class Avulsions: Abrasion { + effectiveness = 0.2; + reopeningChance = 0.1; + reopeningMinDelay = 300; + reopeningMaxDelay = 350; + }; + class Contusion: Abrasion { + effectiveness = 0.7; + reopeningChance = 0; + reopeningMinDelay = 0; + reopeningMaxDelay = 0; + }; + class CrushWound: Abrasion { + effectiveness = 0.7; + reopeningChance = 0; + reopeningMinDelay = 0; + reopeningMaxDelay = 0; + }; + class Cut: Abrasion { + effectiveness = 0.7; + reopeningChance = 0.2; + reopeningMinDelay = 100; + reopeningMaxDelay = 400; + }; + class Laceration: Abrasion { + effectiveness = 0.7; + reopeningChance = 0; + reopeningMinDelay = 0; + reopeningMaxDelay = 0; + }; + class velocityWound: Abrasion { + effectiveness = 0.7; + reopeningChance = 0.1; + reopeningMinDelay = 200; + reopeningMaxDelay = 300; + }; + class punctureWound: Abrasion { + effectiveness = 0.5; + reopeningChance = 0.1; + reopeningMinDelay = 200; + reopeningMaxDelay = 300; + }; + }; + + }; + class Medication { + // How much does the pain get reduced? + painReduce = 0; + // How much will the heart rate be increased when the HR is low (below 55)? {minIncrease, maxIncrease, seconds} + hrIncreaseLow[] = {0, 0, 0}; + hrIncreaseNormal[] = {0, 0, 0}; + hrIncreaseHigh[] = {0, 0, 0}; + // Callback once the heart rate values have been added. + hrCallback = ""; + + // How long until this medication has disappeared + timeInSystem = 120; + // How many of this type of medication can be in the system before the patient overdoses? + maxDose = 4; + // Function to execute upon overdose. Arguments passed to call back are 0: unit , 1: medicationClassName + onOverDose = ""; + // The viscosity of a fluid is a measure of its resistance to gradual deformation by shear stress or tensile stress. For liquids, it corresponds to the informal concept of "thickness". This value will increase/decrease the viscoty of the blood with the percentage given. Where 100 = max. Using the minus will decrease viscosity + viscosityChange = 0; + + // specific details for the ACE_Morphine treatment action + class Morphine { + painReduce = 0.7; + hrIncreaseLow[] = {-10, -30, 35}; + hrIncreaseNormal[] = {-10, -50, 40}; + hrIncreaseHigh[] = {-10, -40, 50}; + timeInSystem = 500; + maxDose = 4; + inCompatableMedication[] = {}; + viscosityChange = 10; + }; + class Epinephrine { + painReduce = 0; + hrIncreaseLow[] = {10, 20, 30}; + hrIncreaseNormal[] = {10, 50, 20}; + hrIncreaseHigh[] = {10, 40, 10}; + timeInSystem = 120; + maxDose = 10; + inCompatableMedication[] = {}; + }; + class Atropine { + painReduce = 0; + hrIncreaseLow[] = {20, 30, 15}; + hrIncreaseNormal[] = {-10, -50, 20}; + hrIncreaseHigh[] = {-10, -40, 10}; + timeInSystem = 120; + maxDose = 6; + inCompatableMedication[] = {}; + }; + class PainKillers { + painReduce = 0.7; + timeInSystem = 120; + maxDose = 10; + inCompatableMedication[] = {}; + viscosityChange = 5; + }; + }; + class IV { + // volume is in millileters + volume = 1000; + ratio[] = {}; + type = "Blood"; + class BloodIV { + volume = 1000; + ratio[] = {"Plasma", 1}; + }; + class BloodIV_500: BloodIV { + volume = 500; + }; + class BloodIV_250: BloodIV { + volume = 250; + }; + class PlasmaIV: BloodIV { + volume = 1000; + ratio[] = {"Blood", 1}; + type = "Plasma"; + }; + class PlasmaIV_500: PlasmaIV { + volume = 500; + }; + class PlasmaIV_250: PlasmaIV { + volume = 250; + }; + class SalineIV: BloodIV { + volume = 1000; + type = "Saline"; + ratio[] = {}; + }; + class SalineIV_500: SalineIV { + volume = 500; + }; + class SalineIV_250: SalineIV { + volume = 250; + }; + }; + }; +}; diff --git a/addons/medical/CfgEventHandlers.hpp b/addons/medical/CfgEventHandlers.hpp index ab62ee2c0a..8033dbe2cb 100644 --- a/addons/medical/CfgEventHandlers.hpp +++ b/addons/medical/CfgEventHandlers.hpp @@ -1,3 +1,4 @@ + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); @@ -6,30 +7,22 @@ class Extended_PreInit_EventHandlers { class Extended_PostInit_EventHandlers { class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_postInit)); + init = QUOTE(call COMPILE_FILE(XEH_postInit)); }; }; - -class Extended_Killed_Eventhandlers { - class CaManBase { +class Extended_Init_EventHandlers { + class CAManBase { class ADDON { - Killed = QUOTE(_this call FUNC(eh_killed)); + init = QUOTE(call COMPILE_FILE(XEH_init)); }; }; }; -class Extended_Local_Eventhandlers { - class CaManBase { +class Extended_Respawn_EventHandlers { + class CAManBase { class ADDON { - Local = QUOTE(_this call FUNC(eh_local)); - }; - }; -}; -class Extended_Init_Eventhandlers { - class CaManBase { - class ADDON { - init = QUOTE(_this call FUNC(onInitForUnit);); + respawn = QUOTE(call COMPILE_FILE(XEH_respawn)); }; }; }; diff --git a/addons/medical/CfgFactionClasses.hpp b/addons/medical/CfgFactionClasses.hpp deleted file mode 100644 index 35f77aedb1..0000000000 --- a/addons/medical/CfgFactionClasses.hpp +++ /dev/null @@ -1,7 +0,0 @@ -class CfgFactionClasses -{ - class NO_CATEGORY; - class ACE_medical: NO_CATEGORY { - displayName = "ACE Medical"; - }; -}; \ No newline at end of file diff --git a/addons/medical/CfgHints.hpp b/addons/medical/CfgHints.hpp deleted file mode 100644 index 2c6409536d..0000000000 --- a/addons/medical/CfgHints.hpp +++ /dev/null @@ -1,38 +0,0 @@ -class CfgHints -{ - class Combat_Space_Enhancement - { - displayName = "Combat Space Enhancement"; - class ACE_Module - { - displayName = "Combat Medical System"; - displayNameShort = "Combat Medical System"; - description = "Combat Medical System is an advanced medical system for players and AI."; - tip = ""; - arguments[] = {}; - image = ""; - noImage = true; - }; - class Assessment - { - displayName = "Patient Assessment"; - displayNameShort = "Patient Assessment"; - description = "It is essential when treating a casualty that you fully assess each of the areas of the casualty to determine not only the injuries but the priority of each in severity.
You cna assess a patient by clicking on the Assessment ICON
Use Check Pulse, check Blood Pressure and Check Response to get an overview."; - tip = "Medics will get a faster and more accurate result when assessing patients."; - arguments[] = {}; - image = ""; - noImage = true; - }; - - class Bleeding - { - displayName = "Bandaging a wound"; - displayNameShort = "Bandaging a wound"; - description = "For casualties the first priority is to stop the bleeding. You will want to bandage the largest wounds first, before attending to the smaller ones.
You can apply a tourniquet on the limbs to stem the bleeding faster, but remember to remove it!"; - tip = "Select a wound in the injury list to bandage that one first!"; - arguments[] = {}; - image = ""; - noImage = true; - }; - }; -}; \ No newline at end of file diff --git a/addons/medical/CfgSounds.hpp b/addons/medical/CfgSounds.hpp index de25bda65d..6b5fa48344 100644 --- a/addons/medical/CfgSounds.hpp +++ b/addons/medical/CfgSounds.hpp @@ -1,45 +1,37 @@ -class CfgSounds -{ - class GVAR(heartbeat_fast_1) - { - name = QGVAR(heartbeat_fast_1); - sound[] = {QUOTE(PATHTOF(sounds\heart_beats\fast_1.wav)),"db-1",1}; +class CfgSounds { + class ACE_heartbeat_fast_1 { + name = "ACE_heartbeat_fast_1"; + sound[] = {QUOTE(PATHTOF(sounds\heart_beats\fast_1.wav)), "db+1", 1}; titles[] = {}; }; - class GVAR(heartbeat_fast_2) - { - name = QGVAR(heartbeat_fast_2); - sound[] = {QUOTE(PATHTOF(sounds\heart_beats\fast_2.wav)),"db-1",1}; + class ACE_heartbeat_fast_2 { + name = "ACE_heartbeat_fast_2"; + sound[] = {QUOTE(PATHTOF(sounds\heart_beats\fast_2.wav)), "db+1", 1}; titles[] = {}; }; - class GVAR(heartbeat_fast_3) - { - name = QGVAR(heartbeat_fast_3); - sound[] = {QUOTE(PATHTOF(sounds\heart_beats\fast_3.wav)),"db-1",1}; + class ACE_heartbeat_fast_3 { + name = "ACE_heartbeat_fast_3"; + sound[] = {QUOTE(PATHTOF(sounds\heart_beats\fast_3.wav)), "db+1", 1}; titles[] = {}; }; - class GVAR(heartbeat_norm_1) - { - name = QGVAR(heartbeat_norm_1); - sound[] = {QUOTE(PATHTOF(sounds\heart_beats\norm_1.wav)),"db-1",1}; + class ACE_heartbeat_norm_1 { + name = "ACE_heartbeat_norm_1"; + sound[] = {QUOTE(PATHTOF(sounds\heart_beats\norm_1.wav)), "db+1", 1}; titles[] = {}; }; - class GVAR(heartbeat_norm_2) - { - name = QGVAR(heartbeat_norm_2); - sound[] = {QUOTE(PATHTOF(sounds\heart_beats\norm_2.wav)),"db-1",1}; + class ACE_heartbeat_norm_2 { + name = "ACE_heartbeat_norm_2"; + sound[] = {QUOTE(PATHTOF(sounds\heart_beats\norm_2.wav)), "db+1", 1}; titles[] = {}; }; - class GVAR(heartbeat_slow_1) - { - name = QGVAR(heartbeat_slow_1); - sound[] = {QUOTE(PATHTOF(sounds\heart_beats\slow_1.wav)),"db-1",1}; + class ACE_heartbeat_slow_1 { + name = "ACE_heartbeat_slow_1"; + sound[] = {QUOTE(PATHTOF(sounds\heart_beats\slow_1.wav)), "db+1", 1}; titles[] = {}; }; - class GVAR(heartbeat_slow_2) - { - name = QGVAR(heartbeat_slow_2); - sound[] = {QUOTE(PATHTOF(sounds\heart_beats\slow_2.wav)),"db-1",1}; + class ACE_heartbeat_slow_2 { + name = "ACE_heartbeat_slow_2"; + sound[] = {QUOTE(PATHTOF(sounds\heart_beats\slow_2.wav)), "db+1", 1}; titles[] = {}; }; -}; \ No newline at end of file +}; diff --git a/addons/medical/CfgVehicles.hpp b/addons/medical/CfgVehicles.hpp index c081efc27f..0a5c7c1788 100644 --- a/addons/medical/CfgVehicles.hpp +++ b/addons/medical/CfgVehicles.hpp @@ -1,817 +1,5 @@ -class CfgVehicles -{ - class Logic; - class Module_F: Logic { - class ArgumentsBaseUnits { - }; - }; - class ACE_moduleCombatMedicalSystem: Module_F { - scope = 2; - displayName = "Combat Medical System [ACE]"; - icon = QUOTE(PATHTOF(data\ACE_medical_module.paa)); - category = "ACE_medical"; - function = QUOTE(FUNC(initalizeModuleCMS)); - functionPriority = 1; - isGlobal = 1; - isTriggerActivated = 0; - author = "Glowbal"; - class Arguments { - class advancedLevel { - displayName = "Advanced Level"; - description = "How advanced can the medical system be?"; - typeName = "NUMBER"; - class values { - class basic { - name = "Basic. Only bleeding and pain."; - value = 0; - default = 1; - }; - class normal { - name = "Normal. Bleeding, Pain, Blood pressure and heart rate"; - value = 1; - }; - class full { - name = "Full. Everything enabled."; - value = 2; - }; - }; - }; - class openingOfWounds { - displayName = "Advanced Wounds"; - description = "When set to true, bandaged wounds could on occasion re-open, resulting in new open wounds that need to be bandaged."; - typeName = "BOOL"; - defaultValue = 1; - }; - class mediACEtting { - displayName = "Advanced Medic roles"; - description = "Medics only are able to view the detailed information"; - typeName = "BOOL"; - defaultValue = 1; - }; - class difficultySetting { - displayName = "Survival Difficulty"; - description = "Select the aggressiveness of the medical simulation"; - typeName = "NUMBER"; - class values { - class recruit { - name = "Recruit"; - value = 0.5; - }; - class regular { - name = "Regular"; - value = 1; - default = 1; - }; - class veteran { - name = "Veteran"; - value = 1.2; - }; - class expert { - name = "Expert"; - value = 1.5; - }; - }; - }; - class enableFor { - displayName = "Enabled for"; - description = "Select what units CMS will be enabled for"; - typeName = "NUMBER"; - class values { - class playableUnits { - name = "Players only"; - value = 0; - default = 1; - }; - class playableUnitsAndAI { - name = "Players and AI"; - value = 1; - }; - }; - }; - class enableAirway { - displayName = "Enable Airway"; - description = "Should CMS Airway system be enabled?"; - typeName = "NUMBER"; - class values { - class enable { - name = "Yes"; - value = 1; - }; - class disable { - name = "No"; - value = 0; - default = 1; - }; - }; - }; - class vehCrashes { - displayName = "Vehicle Crashes"; - description = "Enable injuries on vehicle crashes"; - typeName = "BOOL"; - defaultValue = 1; - }; - - class aidKitUponUsage { - displayName = "Disposable Aid kit"; - description = "Is a personal aid kit disposable?"; - typeName = "BOOL"; - defaultValue = false; - }; - class aidKitMedicsOnly { - displayName = "Medics only"; - description = "Are aid kits restricted to medics only?"; - typeName = "BOOL"; - defaultValue = false; - }; - class aidKitRestrictions { - displayName = "Aid kit"; - description = "When can an Aid kit be used?"; - typeName = "NUMBER"; - class values { - class medFacility { - name = "Medical Facility"; - value = 0; - default = 1; - }; - class medFAcilityNoBleeding { - name = "Medical Facility & No bleeding"; - value = 1; - }; - class Everywhere { - name = "Everywhere"; - value = 2; - }; - class EverywhereNoBleeding { - name = "Everywhere & No Bleeding"; - value = 3; - }; - }; - }; - class bandageTime { - displayName = "Bandage Time"; - description = "Time it takes for a bandage action to be completed"; - typeName = "NUMBER"; - defaultValue = 5; - }; - class stitchingAllow { - displayName = "Can Stitch"; - description = "What units can use stitching?"; - typeName = "NUMBER"; - defaultValue = 0; - class values { - class medicsOnly { - name = "Medics Only"; - value = 0; - default = 1; - }; - class everyone { - name = "Everyone"; - value = 1; - }; - class noOne { - name = "No units"; - value = -1; - }; - }; - }; - - }; - class ModuleDescription { - description = "Provides a more realistic medical system for both players and AI."; // Short description, will be formatted as structured text - sync[] = {}; - }; - }; - - class ACE_moduleDamageSettings: Module_F { - scope = 2; - displayName = "Damage Settings [ACE]"; - icon = QUOTE(PATHTOF(data\ACE_medical_module.paa)); - category = "ACE_medical"; - function = QUOTE(FUNC(moduleDamageSettings)); - functionPriority = 1; - isGlobal = 1; - isTriggerActivated = 0; - author = "Glowbal"; - class Arguments { - class damageThresholdAI { - displayName = "Damage Threshold AI"; - description = "How much damage does it take for an AI to be killed?"; - typeName = "NUMBER"; - defaultValue = 1; - }; - class damageThresholdPlayers { - displayName = "Damage Threshold Players"; - description = "How much damage does it take for a player to be killed?"; - typeName = "NUMBER"; - defaultValue = 1; - }; - }; - class ModuleDescription { - description = "Custom damage threshold module"; - sync[] = {}; - }; - }; - - class ACE_moduleAssignMedicRoles: Module_F { - scope = 2; - displayName = "Set Medic Class [ACE]"; - icon = QUOTE(PATHTOF(data\ACE_medical_module.paa)); - category = "ACE_medical"; - function = QUOTE(FUNC(moduleAssignMedicRoles)); - functionPriority = 10; - isGlobal = 2; - isTriggerActivated = 0; - isDisposable = 0; - author = "Glowbal"; - class Arguments { - class EnableList { - displayName = "List"; - description = "List of unit names that will be classified as medic, separated by commas."; - defaultValue = ""; - }; - class class { - displayName = "Is Medic"; - description = "Medics allow for more advanced treatment in case of Advanced Medic roles enabled"; - typeName = "BOOL"; - defaultValue = true; - }; - }; - class ModuleDescription { - description = "Assigns the ACE medic class to a unit"; // Short description, will be formatted as structured text - sync[] = {}; - }; - }; - - class ACE_moduleAssignMedicalVehicle: Module_F { - scope = 2; - displayName = "set Medical Vehicle [ACE]"; - icon = QUOTE(PATHTOF(data\ACE_medical_module.paa)); - category = "ACE_medical"; - function = QUOTE(FUNC(moduleAssignMedicalVehicle)); - functionPriority = 10; - isGlobal = 2; - isTriggerActivated = 0; - isDisposable = 0; - author = "Glowbal"; - class Arguments { - class EnableList { - displayName = "List"; - description = "List of object names that will be classified as medical vehicle, separated by commas."; - defaultValue = ""; - }; - class enabled { - displayName = "Is Medical Vehicle"; - description = "Whatever or not the objects in the list will be a medical vehicle."; - typeName = "BOOL"; - defaultValue = true; - }; - }; - class ModuleDescription { - description = "Assigns the ACE medical vehicle class to a vehicle."; - sync[] = {}; - }; - }; - - class ACE_moduleAssignMedicalFacility: Module_F { - scope = 2; - displayName = "Set Medical Facility [ACE]"; - icon = QUOTE(PATHTOF(data\ACE_medical_module.paa)); - category = "ACE_medical"; - function = QUOTE(FUNC(moduleAssignMedicalFacility)); - functionPriority = 10; - isGlobal = 2; - isTriggerActivated = 0; - isDisposable = 0; - author = "Glowbal"; - class Arguments { - class class { - displayName = "Is Medical Facility"; - description = "Registers an object as a medical facility for CMS"; - typeName = "BOOL"; - }; - }; - class ModuleDescription { - description = "Defines an object as a medical facility for CMS. This allows for more advanced treatments. Can be used on buildings and vehicles. "; - sync[] = {}; - }; - }; - class ACE_moduleAssignMedicalEquipment: Module_F { - scope = 2; - displayName = "Assign Medical Equipment [ACE]"; - icon = QUOTE(PATHTOF(data\ACE_medical_module.paa)); - category = "ACE_medical"; - function = QUOTE(FUNC(moduleAssignMedicalEquipment)); - functionPriority = 1; - isGlobal = 1; - isTriggerActivated = 0; - author = "Glowbal"; - class Arguments { - class equipment { - displayName = "Assign Equipment"; - description = "Assign Medical equipment to all players"; - typeName = "NUMBER"; - defaultValue = 0; - class values { - class AllPlayers { - name = "All Players"; - value = 0; - default = 1; - }; - class MedicsOnly { - name = "Medics only"; - value = 1; - }; - }; - }; - }; - class ModuleDescription { - description = "Assigns medical equipment to units"; - sync[] = {}; - }; - }; - - - class MapBoard_altis_F; - class ACE_bodyBag: MapBoard_altis_F { - scope = 1; - side = -1; - model = QUOTE(PATHTOF(equipment\bodybag.p3d)); - icon = ""; - displayName = $STR_ACE_MAG_BODYBAG_DISPLAY; - }; - - - class Item_Base_F; - class ACE_bandage_basicItem: Item_Base_F { - scope = 2; - scopeCurator = 2; - displayName = $STR_ACE_MAG_BANDAGE_BASIC_DISPLAY; - author = "Glowbal"; - vehicleClass = "Items"; - class TransportItems - { - class ACE_bandage_basic - { - name = "ACE_bandage_basic"; - count = 1; - }; - }; - }; - class ACE_packing_bandageItem: Item_Base_F { - scope = 2; - scopeCurator = 2; - displayName = $STR_ACE_MAG_PACKING_BANDAGE_DISPLAY; - author = "Glowbal"; - vehicleClass = "Items"; - class TransportItems - { - class ACE_packing_bandage - { - name = "ACE_packing_bandage"; - count = 1; - }; - }; - }; - class ACE_bandageElasticItem: Item_Base_F { - scope = 2; - scopeCurator = 2; - displayName = $STR_ACE_MAG_BANDAGE_ELASTIC_DISPLAY; - author = "Glowbal"; - vehicleClass = "Items"; - class TransportItems - { - class ACE_bandageElastic - { - name = "ACE_bandageElastic"; - count = 1; - }; - }; - }; - class ACE_tourniquetItem: Item_Base_F { - scope = 2; - scopeCurator = 2; - displayName = $STR_ACE_MAG_TOURNIQUET_DISPLAY; - author = "Glowbal"; - vehicleClass = "Items"; - class TransportItems - { - class ACE_tourniquet - { - name = "ACE_tourniquet"; - count = 1; - }; - }; - }; - class ACE_splintItem: Item_Base_F { - scope = 2; - scopeCurator = 2; - displayName = $STR_ACE_MAG_SPLINT_DISPLAY; - author = "Glowbal"; - vehicleClass = "Items"; - class TransportItems - { - class ACE_splint - { - name = "ACE_splint"; - count = 1; - }; - }; - }; - class ACE_morphineItem: Item_Base_F { - scope = 2; - scopeCurator = 2; - displayName = $STR_ACE_MAG_MORPHINE_DISPLAY; - author = "Glowbal"; - vehicleClass = "Items"; - class TransportItems - { - class ACE_morphine - { - name = "ACE_morphine"; - count = 1; - }; - }; - }; - class ACE_atropineItem: Item_Base_F { - scope = 2; - scopeCurator = 2; - displayName = $STR_ACE_MAG_ATROPINE_DISPLAY; - author = "Glowbal"; - vehicleClass = "Items"; - class TransportItems - { - class ACE_atropine - { - name = "ACE_atropine"; - count = 1; - }; - }; - }; - class ACE_epinephrineItem: Item_Base_F { - scope = 2; - scopeCurator = 2; - displayName = $STR_ACE_MAG_EPINEPHRINE_DISPLAY; - author = "Glowbal"; - vehicleClass = "Items"; - class TransportItems - { - class ACE_epinephrine - { - name = "ACE_epinephrine"; - count = 1; - }; - }; - }; - class ACE_plasma_ivItem: Item_Base_F { - scope = 2; - scopeCurator = 2; - displayName = $STR_ACE_MAG_PLASMA_IV; - author = "Glowbal"; - vehicleClass = "Items"; - class TransportItems - { - class ACE_plasma_iv - { - name = "ACE_plasma_iv"; - count = 1; - }; - }; - }; - class ACE_plasma_iv_500Item: Item_Base_F { - scope = 2; - scopeCurator = 2; - displayName = $STR_ACE_MAG_PLASMA_IV_500; - author = "Glowbal"; - vehicleClass = "Items"; - class TransportItems - { - class ACE_plasma_iv_500 - { - name = "ACE_plasma_iv_500"; - count = 1; - }; - }; - }; - class ACE_plasma_iv_250Item: Item_Base_F { - scope = 2; - scopeCurator = 2; - displayName = $STR_ACE_MAG_PLASMA_IV_250; - author = "Glowbal"; - vehicleClass = "Items"; - class TransportItems - { - class ACE_plasma_iv_250 - { - name = "ACE_plasma_iv_250"; - count = 1; - }; - }; - }; - class ACE_blood_ivItem: Item_Base_F { - scope = 2; - scopeCurator = 2; - displayName = $STR_ACE_MAG_BLOOD_IV; - author = "Glowbal"; - vehicleClass = "Items"; - class TransportItems - { - class ACE_blood_iv - { - name = "ACE_blood_iv"; - count = 1; - }; - }; - }; - class ACE_blood_iv_500Item: Item_Base_F { - scope = 2; - scopeCurator = 2; - displayName = $STR_ACE_MAG_BLOOD_IV_500; - author = "Glowbal"; - vehicleClass = "Items"; - class TransportItems - { - class ACE_blood_iv_500 - { - name = "ACE_blood_iv_500"; - count = 1; - }; - }; - }; - class ACE_blood_iv_250Item: Item_Base_F { - scope = 2; - scopeCurator = 2; - displayName = $STR_ACE_MAG_BLOOD_IV_250; - author = "Glowbal"; - vehicleClass = "Items"; - class TransportItems - { - class ACE_blood_iv_250 - { - name = "ACE_blood_iv_250"; - count = 1; - }; - }; - }; - class ACE_saline_ivItem: Item_Base_F { - scope = 2; - scopeCurator = 2; - displayName = $STR_ACE_MAG_SALINE_IV; - author = "Glowbal"; - vehicleClass = "Items"; - class TransportItems - { - class ACE_saline_iv - { - name = "ACE_saline_iv"; - count = 1; - }; - }; - }; - class ACE_saline_iv_500Item: Item_Base_F { - scope = 2; - scopeCurator = 2; - displayName = $STR_ACE_MAG_SALINE_IV_500; - author = "Glowbal"; - vehicleClass = "Items"; - class TransportItems - { - class ACE_saline_iv_500 - { - name = "ACE_saline_iv_500"; - count = 1; - }; - }; - }; - class ACE_saline_iv_250Item: Item_Base_F { - scope = 2; - scopeCurator = 2; - displayName = $STR_ACE_MAG_SALINE_IV_250; - author = "Glowbal"; - vehicleClass = "Items"; - class TransportItems - { - class ACE_saline_iv_250 - { - name = "ACE_saline_iv_250"; - count = 1; - }; - }; - }; - class ACE_quikclotItem: Item_Base_F { - scope = 2; - scopeCurator = 2; - displayName = $STR_ACE_MAG_QUIKCLOT_DISPLAY; - author = "Glowbal"; - vehicleClass = "Items"; - class TransportItems - { - class ACE_quikclot - { - name = "ACE_quikclot"; - count = 1; - }; - }; - }; - class ACE_nasopharyngeal_tubeItem: Item_Base_F { - scope = 2; - scopeCurator = 2; - displayName = $STR_ACE_MAG_NPA_DISPLAY; - author = "Glowbal"; - vehicleClass = "Items"; - class TransportItems - { - class ACE_nasopharyngeal_tube - { - name = "ACE_nasopharyngeal_tube"; - count = 1; - }; - }; - }; - class ACE_opaItem: Item_Base_F { - scope = 2; - scopeCurator = 2; - displayName = $STR_ACE_MAG_OPA_DISPLAY; - author = "Glowbal"; - vehicleClass = "Items"; - class TransportItems - { - class ACE_opa - { - name = "ACE_opa"; - count = 1; - }; - }; - }; - class ACE_liquidSkinItem: Item_Base_F { - scope = 2; - scopeCurator = 2; - displayName = $STR_ACE_MAG_LIQUID_SKIN_DISPLAY; - author = "Glowbal"; - vehicleClass = "Items"; - class TransportItems - { - class ACE_liquidSkin - { - name = "ACE_liquidSkin"; - count = 1; - }; - }; - }; - class ACE_chestsealItem: Item_Base_F { - scope = 2; - scopeCurator = 2; - displayName = $STR_ACE_MAG_CHEST_SEAL_DISPLAY; - author = "Glowbal"; - vehicleClass = "Items"; - class TransportItems - { - class ACE_chestseal - { - name = "ACE_chestseal"; - count = 1; - }; - }; - }; - class ACE_personal_aid_kitItem: Item_Base_F { - scope = 2; - scopeCurator = 2; - displayName = $STR_ACE_MAG_AID_KIT_DISPLAY; - author = "Glowbal"; - vehicleClass = "Items"; - class TransportItems - { - class ACE_personal_aid_kit - { - name = "ACE_personal_aid_kit"; - count = 1; - }; - }; - }; - class ACE_bodyBagItem: Item_Base_F { - scope = 2; - scopeCurator = 2; - displayName = $STR_ACE_MAG_BODYBAG_DISPLAY; - author = "Glowbal"; - vehicleClass = "Items"; - class TransportItems - { - class ACE_itemBodyBag - { - name = "ACE_itemBodyBag"; - count = 1; - }; - }; - }; - - - class NATO_Box_Base; - class ACE_medical_supply_crate_cms : NATO_Box_Base { - scope = 2; - accuracy = 1000; - displayName = "Medical Supply Crate [ACE]"; - model = "\A3\weapons_F\AmmoBoxes\AmmoBox_F"; - author = "Glowbal"; - class TransportItems { - class ACE_bandage_basic { - name = "ACE_bandage_basic"; - count = 25; - }; - class ACE_packing_bandage { - name = "ACE_packing_bandage"; - count = 25; - }; - class ACE_tourniquet { - name = "ACE_tourniquet"; - count = 25; - }; - class ACE_splint { - name = "ACE_splint"; - count = 25; - }; - class ACE_plasma_iv { - name = "ACE_plasma_iv"; - count = 25; - }; - class ACE_plasma_iv_500 { - name = "ACE_plasma_iv_500"; - count = 25; - }; - class ACE_plasma_iv_250 { - name = "ACE_plasma_iv_250"; - count = 25; - }; - class ACE_blood_iv { - name = "ACE_blood_iv"; - count = 25; - }; - class ACE_blood_iv_500 { - name = "ACE_blood_iv_500"; - count = 25; - }; - class ACE_blood_iv_250 { - name = "ACE_blood_iv_250"; - count = 25; - }; - class ACE_saline_iv { - name = "ACE_saline_iv"; - count = 25; - }; - class ACE_saline_iv_500 { - name = "ACE_saline_iv_500"; - count = 25; - }; - class ACE_saline_iv_250 { - name = "ACE_saline_iv_250"; - count = 25; - }; - class ACE_morphine { - name = "ACE_morphine"; - count = 25; - }; - class ACE_epinephrine { - name = "ACE_epinephrine"; - count = 25; - }; - class ACE_atropine { - name = "ACE_atropine"; - count = 25; - }; - class ACE_quikclot { - name = "ACE_quikclot"; - count = 25; - }; - class ACE_nasopharyngeal_tube { - name = "ACE_nasopharyngeal_tube"; - count = 25; - }; - class ACE_bandageElastic { - name = "ACE_bandageElastic"; - count = 25; - }; - class ACE_liquidSkin { - name = "ACE_liquidSkin"; - count = 25; - }; - class ACE_chestseal { - name = "ACE_chestseal"; - count = 25; - }; - class ACE_personal_aid_kit { - name = "ACE_personal_aid_kit"; - count = 25; - }; - class ACE_surgical_kit { - name = "ACE_surgical_kit"; - count = 25; - }; - class ACE_itemBodyBag { - name = "ACE_itemBodyBag"; - count = 5; - }; - }; - }; - +class CfgVehicles { #define ARM_LEG_ARMOR_DEFAULT 2 #define ARM_LEG_ARMOR_BETTER 3 #define ARM_LEG_ARMOR_CSAT 4 @@ -870,6 +58,81 @@ class CfgVehicles name = "leg_r"; }; }; + + class ACE_Actions { + class ACE_Head { + class Bandage_Head { + displayName = "Bandage Head"; + distance = 2.0; + condition = QUOTE([ARR_4(_player, _target, 'head', 'Bandage')] call DFUNC(canTreat)); + statement = QUOTE([ARR_4(_player, _target, 'head', 'Bandage')] call DFUNC(treatment)); + showDisabled = 1; + priority = 2; + hotkey = "B"; + enableInside = 1; + }; + }; + class ACE_MainActions { + class Bandage_Torso { + displayName = "Bandage Torso"; + distance = 2.0; + condition = QUOTE([ARR_4(_player, _target, 'body', 'Bandage')] call DFUNC(canTreat)); + statement = QUOTE([ARR_4(_player, _target, 'body', 'Bandage')] call DFUNC(treatment)); + showDisabled = 1; + priority = 2; + hotkey = "B"; + enableInside = 1; + }; + }; + class ACE_ArmLeft { + class Bandage_LeftArm { + displayName = "Bandage Left Arm"; + distance = 2.0; + condition = QUOTE([ARR_4(_player, _target, 'hand_l', 'Bandage')] call DFUNC(canTreat)); + statement = QUOTE([ARR_4(_player, _target, 'hand_l', 'Bandage')] call DFUNC(treatment)); + showDisabled = 1; + priority = 2; + hotkey = "B"; + enableInside = 1; + }; + }; + class ACE_ArmRight { + class Bandage_RightArm { + displayName = "Bandage Right Arm"; + distance = 2.0; + condition = QUOTE([ARR_4(_player, _target, 'hand_r', 'Bandage')] call DFUNC(canTreat)); + statement = QUOTE([ARR_4(_player, _target, 'hand_r', 'Bandage')] call DFUNC(treatment)); + showDisabled = 1; + priority = 2; + hotkey = "B"; + enableInside = 1; + }; + }; + class ACE_LegLeft { + class Bandage_LeftLeg { + displayName = "Bandage Left Leg"; + distance = 2.0; + condition = QUOTE([ARR_4(_player, _target, 'leg_l', 'Bandage')] call DFUNC(canTreat)); + statement = QUOTE([ARR_4(_player, _target, 'leg_l', 'Bandage')] call DFUNC(treatment)); + showDisabled = 1; + priority = 2; + hotkey = "B"; + enableInside = 1; + }; + }; + class ACE_LegRight { + class Bandage_RightLeg { + displayName = "Bandage Right Leg"; + distance = 2.0; + condition = QUOTE([ARR_4(_player, _target, 'leg_r', 'Bandage')] call DFUNC(canTreat)); + statement = QUOTE([ARR_4(_player, _target, 'leg_r', 'Bandage')] call DFUNC(treatment)); + showDisabled = 1; + priority = 2; + hotkey = "B"; + enableInside = 1; + }; + }; + }; }; class SoldierWB: CAManBase {}; @@ -877,6 +140,7 @@ class CfgVehicles class SoldierGB: CAManBase {}; class B_Soldier_base_F: SoldierWB {}; + class B_Soldier_04_f: B_Soldier_base_F { class HitPoints: HitPoints { class HitHead: HitHead {}; diff --git a/addons/medical/CfgWeapons.hpp b/addons/medical/CfgWeapons.hpp index 34636cf0fb..1aab4b7d7a 100644 --- a/addons/medical/CfgWeapons.hpp +++ b/addons/medical/CfgWeapons.hpp @@ -1,317 +1,263 @@ + class CfgWeapons { - class ItemCore; - class InventoryItem_Base_F; - class ACE_bandage_basic: ItemCore - { - scope = 2; - value = 1; - count = 1; - type = 16; - displayName = $STR_ACE_MAG_BANDAGE_BASIC_DISPLAY; - picture = QUOTE(PATHTOF(equipment\img\field_dressing.paa)); - model = QUOTE(PATHTOF(equipment\bandages\fielddressing.p3d)); - descriptionShort = $STR_ACE_MAG_BANDAGE_BASIC_DESC_SHORT; - descriptionUse = $STR_ACE_MAG_BANDAGE_BASIC_DESC_USE; - class ItemInfo: InventoryItem_Base_F - { - mass=0.5; - type=201; - }; + class ItemCore; + class InventoryItem_Base_F; + class InventoryFirstAidKitItem_Base_F; + class MedikitItem; + + // ITEMS + class FirstAidKit: ItemCore { + type = 0; + class ItemInfo: InventoryFirstAidKitItem_Base_F { + mass = 4; + type = 201; }; - class ACE_packing_bandage: ItemCore - { - scope = 2; - value = 1; - count = 1; - type = 16; - displayName = $STR_ACE_MAG_PACKING_BANDAGE_DISPLAY; - picture = QUOTE(PATHTOF(equipment\img\packing_bandage.paa)); - model = QUOTE(PATHTOF(equipment\bandages\packingbandage.p3d)); - descriptionShort = $STR_ACE_MAG_PACKING_BANDAGE_DESC_SHORT; - descriptionUse = $STR_ACE_MAG_PACKING_BANDAGE_DESC_USE; - class ItemInfo: InventoryItem_Base_F - { - mass=1; - type=201; - }; + }; + class Medikit: ItemCore { + type = 0; + class ItemInfo: MedikitItem { + mass = 60; + type = 201; }; - class ACE_bandageElastic: ItemCore { + }; + + // @todo localize + class ACE_ItemCore; + class GVAR(fieldDressing): ACE_ItemCore { scope = 2; - value = 1; - count = 1; - type = 16; - displayName = $STR_ACE_MAG_BANDAGE_ELASTIC_DISPLAY; - picture = QUOTE(PATHTOF(equipment\img\bandageElastic.paa)); model = "\A3\Structures_F_EPA\Items\Medical\Bandage_F.p3d"; - descriptionShort = $STR_ACE_MAG_BANDAGE_ELASTIC_DESC_SHORT; - descriptionUse = $STR_ACE_MAG_BANDAGE_ELASTIC_DESC_USE; - class ItemInfo: InventoryItem_Base_F - { + picture = QUOTE(PATHTOF(ui\items\fieldDressing.paa)); + displayName = $STR_ACE_MEDICAL_BANDAGE_BASIC_DISPLAY; + descriptionShort = $STR_ACE_MEDICAL_BANDAGE_BASIC_DESC_SHORT; + descriptionUse = $STR_ACE_MEDICAL_BANDAGE_BASIC_DESC_USE; + class ItemInfo: InventoryItem_Base_F { mass=1; type=201; }; }; - class ACE_tourniquet: ItemCore - { + class GVAR(packingBandage): ItemCore { scope = 2; value = 1; count = 1; type = 16; - displayName = $STR_ACE_MAG_TOURNIQUET_DISPLAY; - picture = QUOTE(PATHTOF(equipment\img\tourniquet.paa)); - model = QUOTE(PATHTOF(equipment\Tourniquet.p3d)); - descriptionShort = $STR_ACE_MAG_TOURNIQUET_DESC_SHORT; - descriptionUse = $STR_ACE_MAG_TOURNIQUET_DESC_USE; - class ItemInfo: InventoryItem_Base_F - { + displayName = $STR_ACE_MEDICAL_PACKING_BANDAGE_DISPLAY; + picture = QUOTE(PATHTOF(ui\items\packingBandage.paa)); + model = QUOTE(PATHTOF(data\packingbandage.p3d)); + descriptionShort = $STR_ACE_MEDICAL_PACKING_BANDAGE_DESC_SHORT; + descriptionUse = $STR_ACE_MEDICAL_PACKING_BANDAGE_DESC_USE; + class ItemInfo: InventoryItem_Base_F { mass=1; type=201; }; }; - class ACE_splint: ItemCore - { + class GVAR(elasticBandage): ItemCore { scope = 2; value = 1; count = 1; type = 16; - displayName = $STR_ACE_MAG_SPLINT_DISPLAY; - picture = QUOTE(PATHTOF(equipment\img\splint.paa)); - descriptionUse = $STR_ACE_MAG_SPLINT_DESC_USE; - descriptionShort = $STR_ACE_MAG_SPLINT_DESC_SHORT; - class ItemInfo: InventoryItem_Base_F - { + displayName = $STR_ACE_MEDICAL_BANDAGE_ELASTIC_DISPLAY; + picture = QUOTE(PATHTOF(ui\items\elasticBandage.paa)); + model = "\A3\Structures_F_EPA\Items\Medical\Bandage_F.p3d"; + descriptionShort = $STR_ACE_MEDICAL_BANDAGE_ELASTIC_DESC_SHORT; + descriptionUse = $STR_ACE_MEDICAL_BANDAGE_ELASTIC_DESC_USE; + class ItemInfo: InventoryItem_Base_F { mass=1; type=201; }; }; - class ACE_morphine: ItemCore - { + class GVAR(tourniquet): ItemCore { scope = 2; value = 1; count = 1; type = 16; - displayName = $STR_ACE_MAG_MORPHINE_DISPLAY; - picture = QUOTE(PATHTOF(equipment\img\morphine.paa)); - model = QUOTE(PATHTOF(equipment\Morphinpen.p3d)); - descriptionShort = $STR_ACE_MAG_MORPHINE_DESC_SHORT; - descriptionUse = $STR_ACE_MAG_MORPHINE_DESC_USE; - class ItemInfo: InventoryItem_Base_F - { + displayName = $STR_ACE_MEDICAL_TOURNIQUET_DISPLAY; + picture = QUOTE(PATHTOF(ui\items\tourniquet.paa)); + model = QUOTE(PATHTOF(data\tourniquet.p3d)); + descriptionShort = $STR_ACE_MEDICAL_TOURNIQUET_DESC_SHORT; + descriptionUse = $STR_ACE_MEDICAL_TOURNIQUET_DESC_USE; + class ItemInfo: InventoryItem_Base_F { mass=1; type=201; }; }; - class ACE_atropine: ItemCore { + class GVAR(morphine): ItemCore { scope = 2; value = 1; count = 1; type = 16; - displayName = $STR_ACE_MAG_ATROPINE_DISPLAY; - picture = QUOTE(PATHTOF(equipment\img\atropine.paa)); - model = QUOTE(PATHTOF(equipment\Atropin-pen.p3d)); - descriptionShort = $STR_ACE_MAG_ATROPINE_DESC_SHORT; - descriptionUse = $STR_ACE_MAG_ATROPINE_DESC_USE; - class ItemInfo: InventoryItem_Base_F - { + displayName = $STR_ACE_MEDICAL_MORPHINE_DISPLAY; + picture = QUOTE(PATHTOF(ui\items\morphine.paa)); + model = QUOTE(PATHTOF(data\morphine.p3d)); + descriptionShort = $STR_ACE_MEDICAL_MORPHINE_DESC_SHORT; + descriptionUse = $STR_ACE_MEDICAL_MORPHINE_DESC_USE; + class ItemInfo: InventoryItem_Base_F { mass=1; type=201; }; }; - class ACE_epinephrine: ItemCore { + class GVAR(atropine): ItemCore { scope = 2; value = 1; count = 1; type = 16; - displayName = $STR_ACE_MAG_EPINEPHRINE_DISPLAY; - picture = QUOTE(PATHTOF(equipment\img\epinephrine.paa)); - model = QUOTE(PATHTOF(equipment\Epipen.p3d)); - descriptionShort = $STR_ACE_MAG_EPINEPHRINE_DESC_SHORT; - descriptionUse = $STR_ACE_MAG_EPINEPHRINE_DESC_USE; - class ItemInfo: InventoryItem_Base_F - { + displayName = $STR_ACE_MEDICAL_ATROPINE_DISPLAY; + picture = QUOTE(PATHTOF(ui\items\atropine.paa)); + model = QUOTE(PATHTOF(data\atropine.p3d)); + descriptionShort = $STR_ACE_MEDICAL_ATROPINE_DESC_SHORT; + descriptionUse = $STR_ACE_MEDICAL_ATROPINE_DESC_USE; + class ItemInfo: InventoryItem_Base_F { mass=1; type=201; }; }; - class ACE_plasma_iv: ItemCore { + class GVAR(epinephrine): ItemCore { scope = 2; value = 1; count = 1; - displayName = $STR_ACE_MAG_PLASMA_IV; - picture = QUOTE(PATHTOF(equipment\img\plasma_iv.paa)); - descriptionShort = $STR_ACE_MAG_PLASMA_IV_DESC_SHORT; - descriptionUse = $STR_ACE_MAG_PLASMA_IV_DESC_USE; - class ItemInfo: InventoryItem_Base_F - { + type = 16; + displayName = $STR_ACE_MEDICAL_EPINEPHRINE_DISPLAY; + picture = QUOTE(PATHTOF(ui\items\epinephrine.paa)); + model = QUOTE(PATHTOF(data\epinephrine.p3d)); + descriptionShort = $STR_ACE_MEDICAL_EPINEPHRINE_DESC_SHORT; + descriptionUse = $STR_ACE_MEDICAL_EPINEPHRINE_DESC_USE; + class ItemInfo: InventoryItem_Base_F { mass=1; type=201; }; }; - class ACE_plasma_iv_500: ACE_plasma_iv { - displayName = $STR_ACE_MAG_PLASMA_IV_500; + class GVAR(plasmaIV): ItemCore { + scope = 2; + value = 1; + count = 1; + displayName = $STR_ACE_MEDICAL_PLASMA_IV; + picture = QUOTE(PATHTOF(ui\items\plasmaIV.paa)); + descriptionShort = $STR_ACE_MEDICAL_PLASMA_IV_DESC_SHORT; + descriptionUse = $STR_ACE_MEDICAL_PLASMA_IV_DESC_USE; + class ItemInfo: InventoryItem_Base_F { + mass = 10; + type = 201; + }; }; - class ACE_plasma_iv_250: ACE_plasma_iv_500 { - displayName = $STR_ACE_MAG_PLASMA_IV_250; + class GVAR(plasmaIV_500): GVAR(plasmaIV) { + displayName = $STR_ACE_MEDICAL_PLASMA_IV_500; + class ItemInfo: InventoryItem_Base_F { + mass = 5; + type = 201; + }; }; - class ACE_blood_iv: ItemCore { + class GVAR(plasmaIV_250): GVAR(plasmaIV) { + displayName = $STR_ACE_MEDICAL_PLASMA_IV_250; + class ItemInfo: InventoryItem_Base_F { + mass = 2.5; + type = 201; + }; + }; + class GVAR(bloodIV): ItemCore { scope = 2; value = 1; count = 1; model = "\A3\Structures_F_EPA\Items\Medical\BloodBag_F.p3d"; - displayName = $STR_ACE_MAG_BLOOD_IV; - picture = QUOTE(PATHTOF(equipment\img\bloodbag.paa)); - descriptionShort = $STR_ACE_MAG_BLOOD_IV_DESC_SHORT; - descriptionUse = $STR_ACE_MAG_BLOOD_IV_DESC_USE; - class ItemInfo: InventoryItem_Base_F - { - mass=1; - type=201; + displayName = $STR_ACE_MEDICAL_BLOOD_IV; + picture = QUOTE(PATHTOF(ui\items\bloodIV.paa)); + descriptionShort = $STR_ACE_MEDICAL_BLOOD_IV_DESC_SHORT; + descriptionUse = $STR_ACE_MEDICAL_BLOOD_IV_DESC_USE; + class ItemInfo: InventoryItem_Base_F { + mass = 10; + type = 201; }; }; - class ACE_blood_iv_500: ACE_blood_iv { - displayName = $STR_ACE_MAG_BLOOD_IV_500; + class GVAR(bloodIV_500): GVAR(bloodIV) { + displayName = $STR_ACE_MEDICAL_BLOOD_IV_500; + class ItemInfo: InventoryItem_Base_F { + mass = 5; + type = 201; + }; }; - class ACE_blood_iv_250: ACE_blood_iv_500 { - displayName = $STR_ACE_MAG_BLOOD_IV_250; + class GVAR(bloodIV_250): GVAR(bloodIV) { + displayName = $STR_ACE_MEDICAL_BLOOD_IV_250; + class ItemInfo: InventoryItem_Base_F { + mass = 2.5; + type = 201; + }; }; - class ACE_saline_iv: ItemCore { + class GVAR(salineIV): ItemCore { scope = 2; value = 1; count = 1; - displayName = $STR_ACE_MAG_SALINE_IV; - picture = QUOTE(PATHTOF(equipment\img\saline_iv.paa)); - descriptionShort = $STR_ACE_MAG_SALINE_IV_DESC_SHORT; - descriptionUse = $STR_ACE_MAG_SALINE_IV_DESC_USE; - class ItemInfo: InventoryItem_Base_F - { - mass=1; - type=201; + displayName = $STR_ACE_MEDICAL_SALINE_IV; + picture = QUOTE(PATHTOF(ui\items\salineIV.paa)); + descriptionShort = $STR_ACE_MEDICAL_SALINE_IV_DESC_SHORT; + descriptionUse = $STR_ACE_MEDICAL_SALINE_IV_DESC_USE; + class ItemInfo: InventoryItem_Base_F { + mass = 10; + type = 201; }; }; - class ACE_saline_iv_500: ACE_saline_iv { - displayName = $STR_ACE_MAG_SALINE_IV_500; + class GVAR(salineIV_500): GVAR(salineIV) { + displayName = $STR_ACE_MEDICAL_SALINE_IV_500; + class ItemInfo: InventoryItem_Base_F { + mass = 2.5; + type = 201; + }; }; - class ACE_saline_iv_250: ACE_saline_iv_500 { - displayName = $STR_ACE_MAG_SALINE_IV_250; + class GVAR(salineIV_250): GVAR(salineIV) { + displayName = $STR_ACE_MEDICAL_SALINE_IV_250; + class ItemInfo: InventoryItem_Base_F { + mass = 2.5; + type = 201; + }; }; - class ACE_quikclot: ItemCore { + class GVAR(quikclot): ItemCore { scope = 2; value = 1; count = 1; type = 16; - displayName = $STR_ACE_MAG_QUIKCLOT_DISPLAY; - picture = QUOTE(PATHTOF(equipment\img\quickclot.paa)); - descriptionShort = $STR_ACE_MAG_QUIKCLOT_DESC_SHORT; - descriptionUse = $STR_ACE_MAG_QUIKCLOT_DESC_USE; - class ItemInfo: InventoryItem_Base_F - { - mass=1; - type=201; + displayName = $STR_ACE_MEDICAL_QUIKCLOT_DISPLAY; + picture = QUOTE(PATHTOF(ui\items\quickclot.paa)); + descriptionShort = $STR_ACE_MEDICAL_QUIKCLOT_DESC_SHORT; + descriptionUse = $STR_ACE_MEDICAL_QUIKCLOT_DESC_USE; + class ItemInfo: InventoryItem_Base_F { + mass = 1; + type = 201; }; }; - class ACE_nasopharyngeal_tube: ItemCore { + class GVAR(personalAidKit): ItemCore { scope = 2; value = 1; count = 1; type = 16; - displayName = $STR_ACE_MAG_NPA_DISPLAY; - picture = QUOTE(PATHTOF(equipment\img\nasopharyngeal_tube.paa)); - descriptionUse = $STR_ACE_MAG_NPA_DESC_USE; - descriptionShort = $STR_ACE_MAG_NPA_DESC_SHORT; - class ItemInfo: InventoryItem_Base_F - { - mass=1; - type=201; + displayName = $STR_ACE_MEDICAL_AID_KIT_DISPLAY; + //picture = QUOTE(PATHTOF(ui\items\personal_aid_kit.paa)); + //model = QUOTE(PATHTOF(equipment\Personal-aidkits\MTP.p3d)); + descriptionShort = $STR_ACE_MEDICAL_AID_KIT_DESC_SHORT; + descriptionUse = $STR_ACE_MEDICAL_AID_KIT_DESC_USE; + class ItemInfo: InventoryItem_Base_F { + mass = 2; + type = 201; }; }; - class ACE_opa: ItemCore { - scope = 2; - value = 1; - count = 1; - type = 16; - displayName = $STR_ACE_MAG_OPA_DISPLAY; - picture = QUOTE(PATHTOF(equipment\img\nasopharyngeal_tube.paa)); - descriptionShort = $STR_ACE_MAG_OPA_DESC_SHORT; - descriptionUse = $STR_ACE_MAG_OPA_DESC_USE; - class ItemInfo: InventoryItem_Base_F - { - mass=1; - type=201; - }; - }; - class ACE_liquidSkin: ItemCore { - scope = 2; - value = 1; - count = 1; - type = 16; - displayName = $STR_ACE_MAG_LIQUID_SKIN_DISPLAY; - picture = QUOTE(PATHTOF(equipment\img\liquidSkin.paa)); - model = QUOTE(PATHTOF(equipment\skinliquid.p3d)); - descriptionShort = $STR_ACE_MAG_LIQUID_SKIN_DESC_SHORT; - descriptionUse = $STR_ACE_MAG_LIQUID_SKIN_DESC_USE; - class ItemInfo: InventoryItem_Base_F - { - mass=1; - type=201; - }; - }; - class ACE_chestseal: ItemCore { - scope = 2; - value = 1; - count = 1; - type = 16; - displayName = $STR_ACE_MAG_CHEST_SEAL_DISPLAY; - picture = QUOTE(PATHTOF(equipment\img\chestseal.paa)); - descriptionShort = $STR_ACE_MAG_CHEST_SEAL_DESC_SHORT; - descriptionUse = $STR_ACE_MAG_CHEST_SEAL_DESC_USE; - class ItemInfo: InventoryItem_Base_F - { - mass=1; - type=201; - }; - }; - class ACE_personal_aid_kit: ItemCore { - scope = 2; - value = 1; - count = 1; - type = 16; - displayName = $STR_ACE_MAG_AID_KIT_DISPLAY; - picture = QUOTE(PATHTOF(equipment\img\personal_aid_kit.paa)); - model = QUOTE(PATHTOF(equipment\Personal-aidkits\MTP.p3d)); - descriptionShort = $STR_ACE_MAG_AID_KIT_DESC_SHORT; - descriptionUse = $STR_ACE_MAG_AID_KIT_DESC_USE; - class ItemInfo: InventoryItem_Base_F - { - mass=2; - type=201; - }; - }; - class ACE_surgical_kit: ItemCore - { + class GVAR(surgicalKit): ItemCore { scope=2; - displayName= $STR_ACE_MAG_SURGICALKIT_DISPLAY; - model = QUOTE(PATHTOF(equipment\surgical_kit.p3d)); - picture = QUOTE(PATHTOF(equipment\img\surgical_kit.paa)); - descriptionShort = $STR_ACE_MAG_SURGICALKIT_DESC_SHORT; - descriptionUse = $STR_ACE_MAG_SURGICALKIT_DESC_USE; - class ItemInfo: InventoryItem_Base_F - { - mass= 5; - type=201; + displayName= $STR_ACE_MEDICAL_SURGICALKIT_DISPLAY; + model = QUOTE(PATHTOF(data\surgical_kit.p3d)); + //picture = QUOTE(PATHTOF(data\surgical_kit.paa)); + descriptionShort = $STR_ACE_MEDICAL_SURGICALKIT_DESC_SHORT; + descriptionUse = $STR_ACE_MEDICAL_SURGICALKIT_DESC_USE; + class ItemInfo: InventoryItem_Base_F { + mass = 5; + type = 201; }; }; - class ACE_itemBodyBag: ItemCore - { + class GVAR(bodyBag): ItemCore { scope=2; - displayName= $STR_ACE_MAG_BODYBAG_DISPLAY; - model = QUOTE(PATHTOF(equipment\bodybagItem.p3d)); - picture = QUOTE(PATHTOF(equipment\img\bodybag.paa)); - descriptionShort = $STR_ACE_MAG_BODYBAG_DESC_SHORT; - descriptionUse = $STR_ACE_MAG_BODYBAG_DESC_USE; - class ItemInfo: InventoryItem_Base_F - { - mass= 15; - type=201; + displayName= $STR_ACE_MEDICAL_BODYBAG_DISPLAY; + model = QUOTE(PATHTOF(data\bodybagItem.p3d)); + picture = QUOTE(PATHTOF(ui\items\bodybag.paa)); + descriptionShort = $STR_ACE_MEDICAL_BODYBAG_DESC_SHORT; + descriptionUse = $STR_ACE_MEDICAL_BODYBAG_DESC_USE; + class ItemInfo: InventoryItem_Base_F { + mass = 15; + type = 201; }; }; }; diff --git a/addons/medical/README.md b/addons/medical/README.md index 0b2b7a4038..b7a5fd2a3b 100644 --- a/addons/medical/README.md +++ b/addons/medical/README.md @@ -8,3 +8,4 @@ Provides a basic and advanced medical system. The people responsible for merging changes to this component or answering potential questions. - [Glowbal](https://github.com/Glowbal) +- [KoffeinFlummi](https://github.com/KoffeinFlummi) diff --git a/addons/medical/XEH_init.sqf b/addons/medical/XEH_init.sqf new file mode 100644 index 0000000000..4d92575f9b --- /dev/null +++ b/addons/medical/XEH_init.sqf @@ -0,0 +1,10 @@ +#include "script_component.hpp" + +private ["_unit"]; +_unit = _this select 0; + +if !(local _unit) exitWith {}; + +_unit addEventHandler ["HandleDamage", {_this call FUNC(handleDamage)}]; + +[_unit] call FUNC(init); diff --git a/addons/medical/XEH_postInit.sqf b/addons/medical/XEH_postInit.sqf index 062df32ddf..151065ff1b 100644 --- a/addons/medical/XEH_postInit.sqf +++ b/addons/medical/XEH_postInit.sqf @@ -1,245 +1,233 @@ -/** - * XEH_postInit.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ +// ACE Medical System Visual Loop #include "script_component.hpp" -#include "variable_defines.sqf" -GVAR(injuredUnitCollection) = []; -[{ - { - if (!alive _x || !local _x) then { - GVAR(injuredUnitCollection) set [ _forEachIndex, ObjNull]; - } else { - [_x] call FUNC(handleUnitVitals); +if (!hasInterface) exitwith{}; - private "_pain"; - _pain = _X getvariable [QGVAR(amountOfPain), 0]; - if (_pain > 5 && (random(1) > 0.5)) then { - _x setvariable [QGVAR(amountOfPain), _pain + 0.002]; - }; - if (_pain > 45) then { - if (random(1) > 0.6) then { - [_X] call FUNC(setUnconsciousState); - }; - //[_X] call FUNC(playInjuredSound); - }; - }; - }foreach GVAR(injuredUnitCollection); - GVAR(injuredUnitCollection) = GVAR(injuredUnitCollection) - [ObjNull]; -}, 1, [] ] call CBA_fnc_addPerFrameHandler; +GVAR(heartBeatSounds_Fast) = ["ACE_heartbeat_fast_1", "ACE_heartbeat_fast_2", "ACE_heartbeat_fast_3"]; +GVAR(heartBeatSounds_Normal) = ["ACE_heartbeat_norm_1", "ACE_heartbeat_norm_2"]; +GVAR(heartBeatSounds_Slow) = ["ACE_heartbeat_slow_1", "ACE_heartbeat_slow_2"]; -[ - {(([_this select 0,QGVAR(bloodVolume)] call EFUNC(common,getDefinedVariable)) < 65)}, - {(([_this select 0,QGVAR(amountOfPain)] call EFUNC(common,getDefinedVariable)) > 48)}, - {(((_this select 0) call FUNC(getBloodLoss)) > 0.25)}, - {((_this select 0) getvariable ["ACE_inReviveState", false])} -] call FUNC(registerUnconsciousCondition); - -call FUNC(handleDisplayEffects); - -// Assigning all eventhandlers ["Medical_treatmentCompleted", FUNC(onTreatmentCompleted)] call ace_common_fnc_addEventHandler; -["onStartMovingUnit", FUNC(onStartMovingUnit)] call ace_common_fnc_addEventHandler; -["onUnconscious", FUNC(onUnconscious)] call ace_common_fnc_addEventHandler; -["carryObjectDropped", FUNC(onCarryObjectDropped)] call ace_common_fnc_addEventHandler; +["medical_propagateWound", FUNC(onPropagateWound)] call ace_common_fnc_addEventHandler; +["medical_woundUpdateRequest", FUNC(onWoundUpdateRequest)] call ace_common_fnc_addEventHandler; -if (isNil QGVAR(ENABLE_REVIVE_F)) then { - GVAR(ENABLE_REVIVE_F) = 0; +// Initialize all effects +_fnc_createEffect = { + private ["_type", "_layer", "_default"]; + _type = _this select 0; + _layer = _this select 1; + _default = _this select 2; + + _effect = ppEffectCreate [_type, _layer]; + _effect ppEffectForceInNVG true; + _effect ppEffectAdjust _default; + _effect ppEffectCommit 0; + + _effect }; +GVAR(effectUnconsciousCC) = [ + "ColorCorrections", + 4201, + [1,1,0, [0,0,0,1], [0,0,0,0], [1,1,1,1], [0.4,0.4,0,0,0,0.1,0.3]] +] call _fnc_createEffect; -// Keybindings -GVAR(keyPressed) = false; +GVAR(effectUnconsciousRB) = [ + "RadialBlur", + 4202, + [0.01,0.01,0,0] +] call _fnc_createEffect; -["ACE3", - localize "STR_ACE_OPEN_CMS_MENU_DESC", - { if (!GVAR(keyPressed)) then { - GVAR(keyPressed) = true; - GVAR(timeMenuOpened) = time; - [] call FUNC(openMenu); +GVAR(effectBlindingCC) = [ + "ColorCorrections", + 4203, + [1,1,0, [1,1,1,0], [0,0,0,1], [0,0,0,0]] +] call _fnc_createEffect; - true; - } else { - false; +GVAR(effectBloodVolumeCC) = [ + "ColorCorrections", + 4204, + [1,1,0, [0,0,0,0], [1,1,1,1], [0.2,0.2,0.2,0]] +] call _fnc_createEffect; + +GVAR(effectPainCA) = [ + "chromAberration", + 4205, + [0, 0, false] +] call _fnc_createEffect; + +GVAR(effectPainCC) = [ + "ColorCorrections", + 4206, + [1,1,0, [1,1,1,1], [0,0,0,0], [1,1,1,1], [1.3,1.3,0,0,0,0.2,2]] +] call _fnc_createEffect; + +// Initialize Other Variables +GVAR(effectBlind) = false; +GVAR(effectTimeBlood) = time; + +// MAIN EFFECTS LOOP +[{ + // Zeus interface is open or player is dead; disable everything + if (!(isNull (findDisplay 312)) or !(alive ACE_player)) exitWith { + GVAR(effectUnconsciousCC) ppEffectEnable false; + GVAR(effectUnconsciousRB) ppEffectEnable false; + GVAR(effectBlindingCC) ppEffectEnable false; + GVAR(effectBloodVolumeCC) ppEffectEnable false; + GVAR(effectPainCA) ppEffectEnable false; + GVAR(effectPainCC) ppEffectEnable false; + ["unconscious", false] call EFUNC(common,setDisableUserInputStatus); + }; + + // Unconsciousness effect + if (ACE_player getVariable [QGVAR(isUnconscious), false]) then { + GVAR(effectUnconsciousCC) ppEffectEnable true; + GVAR(effectUnconsciousRB) ppEffectEnable true; + GVAR(effectBlind) = true; + ["unconscious", true] call EFUNC(common,setDisableUserInputStatus); + } else { + GVAR(effectUnconsciousCC) ppEffectEnable false; + GVAR(effectUnconsciousRB) ppEffectEnable false; + ["unconscious", false] call EFUNC(common,setDisableUserInputStatus); + if (GVAR(effectBlind)) then { + _strength = 0.78 * (call EFUNC(common,ambientBrightness)); + GVAR(effectBlindingCC) ppEffectEnable true; + GVAR(effectBlindingCC) ppEffectAdjust [1,1,_strength, [1,1,1,0], [0,0,0,1], [0,0,0,0]]; + GVAR(effectBlindingCC) ppEffectCommit 0; + + [{ + GVAR(effectBlindingCC) ppEffectAdjust [1,1,0, [1,1,1,0], [0,0,0,1], [0,0,0,0]]; + GVAR(effectBlindingCC) ppEffectCommit ((_this select 0) * 2); + }, [_strength], 0.01, 0] call EFUNC(common,waitAndExecute); + + [{ + GVAR(effectBlindingCC) ppEffectEnable false; + }, [], (_strength * 2) + 0.5, 0] call EFUNC(common,waitAndExecute); + + GVAR(effectBlind) = false; }; - }, - [ 0, [false, false, false]], - false, - "keydown"] call cba_fnc_registerKeybind; + }; -["ACE3", - localize "STR_ACE_OPEN_CMS_MENU_DESC", - { - GVAR(keyPressed) = false; - if (time - GVAR(timeMenuOpened) >= (0.25*accTime)) then { - disableSerialization; - _display = uiNamespace getVariable QGVAR(medicalMenu); - if (!isnil "_display") then { - closeDialog 314412; + // Bleeding Indicator + if (damage ACE_player > 0.1 and GVAR(effectTimeBlood) + 6 < time) then { + GVAR(effectTimeBlood) = time; + [500 * damage ACE_player] call BIS_fnc_bloodEffect; + }; + + // Blood Volume Effect + _blood = (ACE_player getVariable [QGVAR(bloodVolume), 100]) / 100; + if (_blood > 0.99) then { + GVAR(effectBloodVolumeCC) ppEffectEnable false; + } else { + GVAR(effectBloodVolumeCC) ppEffectEnable true; + GVAR(effectBloodVolumeCC) ppEffectAdjust [1,1,0, [0,0,0,0], [1,1,1,_blood], [0.2,0.2,0.2,0]]; + GVAR(effectBloodVolumeCC) ppEffectCommit 0; + }; +}, 0.5, []] call CBA_fnc_addPerFrameHandler; + + +GVAR(lastHeartBeat) = time; +GVAR(lastHeartBeatSound) = time; + +// @todo, remove once parameters are set up +if (isNil QGVAR(level)) then { + GVAR(level) = 0; +}; + +// HEARTRATE BASED EFFECTS +[{ + _heartRate = ACE_player getVariable [QGVAR(heartRate), 70]; + if (GVAR(level) == 0) then { + _heartRate = 60 + 40 * (ACE_player getVariable [QGVAR(pain), 0]); + }; + if (_heartRate <= 0) exitwith {}; + _interval = 60 / (_heartRate min 50); + if (time > GVAR(lastHeartBeat) + _interval) then { + GVAR(lastHeartBeat) = time; + + // Pain effect + _strength = ACE_player getVariable [QGVAR(pain), 0]; + // _strength = _strength * (ACE_player getVariable [QGVAR(coefPain), GVAR(coefPain)]); @todo + GVAR(alternativePainEffect) = false; // @todo + if (GVAR(alternativePainEffect)) then { + GVAR(effectPainCC) ppEffectEnable false; + if ((ACE_player getVariable [QGVAR(pain), 0]) > 0 && {alive ACE_player}) then { + _strength = _strength * 0.15; + GVAR(effectPainCA) ppEffectEnable true; + GVAR(effectPainCA) ppEffectAdjust [_strength, _strength, false]; + GVAR(effectPainCA) ppEffectCommit 0.01; + [{ + GVAR(effectPainCA) ppEffectAdjust [(_this select 0), (_this select 0), false]; + GVAR(effectPainCA) ppEffectCommit (_this select 1); + }, [_strength * 0.1, _interval * 0.2], _interval * 0.05, 0] call EFUNC(common,waitAndExecute); + [{ + GVAR(effectPainCA) ppEffectAdjust [(_this select 0), (_this select 0), false]; + GVAR(effectPainCA) ppEffectCommit 0.01; + }, [_strength * 0.7], _interval * 0.3, 0] call EFUNC(common,waitAndExecute); + [{ + GVAR(effectPainCA) ppEffectAdjust [(_this select 0), (_this select 0), false]; + GVAR(effectPainCA) ppEffectCommit (_this select 1); + }, [_strength * 0.1, _interval * 0.55], _interval * 0.4, 0] call EFUNC(common,waitAndExecute); + } else { + GVAR(effectPainCA) ppEffectEnable false; + }; + } else { + GVAR(effectPainCA) ppEffectEnable false; + if ((ACE_player getVariable [QGVAR(pain), 0]) > 0 && {alive ACE_player}) then { + _strength = _strength * 0.6; + GVAR(effectPainCC) ppEffectEnable true; + GVAR(effectPainCC) ppEffectAdjust [1,1,0, [1,1,1,1], [0,0,0,0], [1,1,1,1], [1 - _strength,1 - _strength,0,0,0,0.2,2]]; + GVAR(effectPainCC) ppEffectCommit 0.01; + [{ + GVAR(effectPainCC) ppEffectAdjust [1,1,0, [1,1,1,1], [0,0,0,0], [1,1,1,1], [1 - (_this select 0),1 - (_this select 0),0,0,0,0.2,2]]; + GVAR(effectPainCC) ppEffectCommit (_this select 1); + }, [_strength * 0.1, _interval * 0.2], _interval * 0.05, 0] call EFUNC(common,waitAndExecute); + [{ + GVAR(effectPainCC) ppEffectAdjust [1,1,0, [1,1,1,1], [0,0,0,0], [1,1,1,1], [1 - (_this select 0),1 - (_this select 0),0,0,0,0.2,2]]; + GVAR(effectPainCC) ppEffectCommit 0.01; + }, [_strength * 0.7], _interval * 0.3, 0] call EFUNC(common,waitAndExecute); + [{ + GVAR(effectPainCC) ppEffectAdjust [1,1,0, [1,1,1,1], [0,0,0,0], [1,1,1,1], [1 - (_this select 0),1 - (_this select 0),0,0,0,0.2,2]]; + GVAR(effectPainCC) ppEffectCommit (_this select 1); + }, [_strength * 0.1, _interval * 0.55], _interval * 0.4, 0] call EFUNC(common,waitAndExecute); + } else { + GVAR(effectPainCC) ppEffectEnable false; }; }; - false; - }, - [ 0, [false, false, false]], - false, - "keyUp"] call cba_fnc_registerKeybind; - - -// Adding the treatment options for all available medical equipment. - -// Advanced Treatment options -ADD_TREATMENT_ADVANCED("STR_ACE_ACTION_BLOODIV_1000ml","STR_ACE_ACTION_BLOODIV_1000ML_TOOLTIP",'ACE_blood_iv'); -ADD_TREATMENT_ADVANCED("STR_ACE_ACTION_BLOODIV_500ml","STR_ACE_ACTION_BLOODIV_500ML_TOOLTIP",'ACE_blood_iv_500'); -ADD_TREATMENT_ADVANCED("STR_ACE_ACTION_BLOODIV_250ml","STR_ACE_ACTION_BLOODIV_250ML_TOOLTIP",'ACE_blood_iv_250'); -ADD_TREATMENT_ADVANCED("STR_ACE_ACTION_PLASMAIV_1000ml","STR_ACE_ACTION_PLASMAIV_1000ML_TOOLTIP",'ACE_plasma_iv'); -ADD_TREATMENT_ADVANCED("STR_ACE_ACTION_PLASMAIV_500ml","STR_ACE_ACTION_PLASMAIV_500ML_TOOLTIP",'ACE_plasma_iv_500'); -ADD_TREATMENT_ADVANCED("STR_ACE_ACTION_PLASMAIV_250ml","STR_ACE_ACTION_PLASMAIV_250ML_TOOLTIP",'ACE_plasma_iv_250'); -ADD_TREATMENT_ADVANCED("STR_ACE_ACTION_SALINEIV_1000ml","STR_ACE_ACTION_SALINEIV_1000ML_TOOLTIP",'ACE_saline_iv'); -ADD_TREATMENT_ADVANCED("STR_ACE_ACTION_SALINEIV_500ml","STR_ACE_ACTION_SALINEIV_500ML_TOOLTIP",'ACE_saline_iv_500'); -ADD_TREATMENT_ADVANCED("STR_ACE_ACTION_SALINEIV_250ml","STR_ACE_ACTION_SALINEIV_250ML_TOOLTIP",'ACE_saline_iv_250'); - -["STR_ACE_ACTION_PERSONAL_AID_KIT","STR_ACE_ACTION_PERSONAL_AID_KIT_TOOLTIP",{ - _caller = _this select 0; - _target = _this select 1; - if !([_this select 0,_this select 1, 'ACE_personal_aid_kit'] call FUNC(hasEquipment)) exitwith { - false; }; - _inMedFacility = ([_caller] call FUNC(inMedicalFacility)); - _hasOpenWounds = ([_target] call FUNC(hasOpenWounds)); - if ((GVAR(setting_aidKitRestrictions) == 0 && _inMedFacility) || - (GVAR(setting_aidKitRestrictions) == 1 && _inMedFacility && (!_hasOpenWounds)) || - (GVAR(setting_aidKitRestrictions) == 2) || - (GVAR(setting_aidKitRestrictions) == 3 && (!_hasOpenWounds))) exitwith { - - ((GVAR(setting_aidKitMedicsOnly) && [_caller] call FUNC(isMedic) || !GVAR(setting_aidKitMedicsOnly))); + if (GVAR(level) > 0 && {_heartRate > 0}) then { + _minTime = 60 / _heartRate; + if (time - GVAR(lastHeartBeatSound) > _minTime) then { + GVAR(lastHeartBeatSound) = time; + // Heart rate sound effect + if (_heartRate < 60) then { + _sound = GVAR(heartBeatSounds_Normal) select (random((count GVAR(heartBeatSounds_Normal)) -1)); + playSound _sound; + } else { + if (_heartRate > 150) then { + playSound "ACE_heartbeat_fast_2"; + }; + }; + }; }; - false; -},TREATMENT_ADVANCED('ACE_personal_aid_kit'),'advanced'] call FUNC(addTreatmentOption); -["STR_ACE_ACTION_PERFORM_CPR","STR_ACE_ACTION_PERFORM_CPR_TOOLTIP",{ - _caller = _this select 0; - _target = _this select 1; +}, 0, []] call CBA_fnc_addPerFrameHandler; - (!(_caller getvariable[QGVAR(isProvidingCPR), false]) && ((_target getvariable [QGVAR(inCardiacArrest),false]) || !([_target] call EFUNC(common,isAwake)))) -},TREATMENT_ADVANCED('ACE_CPR'),'advanced'] call FUNC(addTreatmentOption); +// broadcast injuries to JIP clients in a MP session +if (isMultiplayer && !isDedicated) then { + [QGVAR(onPlayerConnected), "onPlayerConnected", { + if (isNil QGVAR(InjuredCollection)) then { + GVAR(InjuredCollection) = []; + }; -["STR_ACE_ACTION_STOP_CPR","STR_ACE_ACTION_STOP_CPR_TOOLTIP",{ - _caller = _this select 0; - _target = _this select 1; - - (_caller getvariable[QGVAR(isProvidingCPR), false]) -},{((_this select 0) setvariable[QGVAR(isProvidingCPR), nil, true])},'advanced'] call FUNC(addTreatmentOption); - -["STR_ACE_ACTION_STITCHING","STR_ACE_ACTION_STITCHING_TOOLTIP",{ - _caller = _this select 0; - _target = _this select 1; - - ((GVAR(setting_allowStitching) == 0 && [_Caller] call FUNC(isMedic)) || GVAR(setting_allowStitching) == 1) -},TREATMENT_ADVANCED('ACE_surgical_kit'),'advanced'] call FUNC(addTreatmentOption); - -// Airway Management -["STR_ACE_ACTION_APPLY_NPA","STR_ACE_ACTION_APPLY_NPA_TOOLTIP",{ - _caller = _this select 0; - _target = _this select 1; - if !([_this select 0,_this select 1, 'ACE_nasopharyngeal_tube'] call FUNC(hasEquipment)) exitwith { - false; - }; - (!([_target, QGVAR(airwayTreated)] call EFUNC(common,getDefinedVariable)) && !([_target] call EFUNC(common,isAwake))) -},TREATMENT_AIRWAY('ACE_nasopharyngeal_tube'),'advanced'] call FUNC(addTreatmentOption); - -["STR_ACE_ACTION_REMOVE_NPA","STR_ACE_ACTION_REMOVE_NPA_TOOLTIP",{ - _caller = _this select 0; - _target = _this select 1; - ([_target, QGVAR(airwayTreated)] call EFUNC(common,getDefinedVariable)); -}, {GVAR(INTERACTION_TARGET) setvariable [QGVAR(airwayTreated), nil, true]; (_this select 0) addItem 'ACE_nasopharyngeal_tube';},'airway'] call FUNC(addTreatmentOption); - - -// Bandaging -ADD_TREATMENT_BANDAGE("STR_ACE_ACTION_BANDAGE_BASIC","STR_ACE_ACTION_BANDAGE_BASIC_TOOLTIP",'ACE_bandage_basic'); -ADD_TREATMENT_BANDAGE("STR_ACE_ACTION_QUIKCLOT","STR_ACE_ACTION_QUIKCLOT_TOOLTIP",'ACE_quikclot'); -ADD_TREATMENT_BANDAGE("STR_ACE_ACTION_BANDAGE_ELASTIC","STR_ACE_ACTION_BANDAGE_ELASTIC_TOOLTIP",'ACE_bandageElastic'); -ADD_TREATMENT_BANDAGE("STR_ACE_ACTION_PACKING_BANDAGE","STR_ACE_ACTION_PACKING_BANDAGE_TOOLTIP",'ACE_packing_bandage'); - -["STR_ACE_ACTION_REMOVE_TOURNIQUET","STR_ACE_ACTION_REMOVE_TOURNIQUET_TOOLTIP",{ - _caller = _this select 0; - _target = _this select 1; - ([_target, call FUNC(getSelectedBodyPart)] call FUNC(hasTourniquetAppliedTo)); -},{[_this select 0,_this select 1,call FUNC(getSelectedBodyPart)] call FUNC(actionRemoveTourniquet)},'bandage'] call FUNC(addTreatmentOption); - -["STR_ACE_ACTION_APPLY_TOURNIQUET","STR_ACE_ACTION_APPLY_TOURNIQUET_TOOLTIP",{ - _caller = _this select 0; - _target = _this select 1; - (!([_target, call FUNC(getSelectedBodyPart)] call FUNC(hasTourniquetAppliedTo)) && ([_caller,_target,'ACE_tourniquet'] call FUNC(hasEquipment))); -},TREATMENT_BANDAGE('ACE_tourniquet'),'bandage'] call FUNC(addTreatmentOption); - - -// Medication -ADD_TREATMENT_MEDICATION("STR_ACE_ACTION_MORPHINE","STR_ACE_ACTION_MORPHINE_TOOLTIP",'ACE_morphine'); -ADD_TREATMENT_MEDICATION("STR_ACE_ACTION_ATROPINE","STR_ACE_ACTION_ATROPINE_TOOLTIP",'ACE_atropine'); -ADD_TREATMENT_MEDICATION("STR_ACE_ACTION_EPINEPHRINE","STR_ACE_ACTION_EPINEPHRINE_TOOLTIP",'ACE_epinephrine'); - - -// Examine -["STR_ACE_ACTION_CHECK_PULSE","STR_ACE_ACTION_CHECK_PULSE_TOOLTIP",{ - true; -},{[_this select 0,_this select 1] call FUNC(actionCheckPulse)},'examine'] call FUNC(addTreatmentOption); - -["STR_ACE_ACTION_CHECK_BP","STR_ACE_ACTION_CHECK_BP_TOOLTIP",{ - true; -},{[_this select 0,_this select 1] call FUNC(actionCheckBloodPressure);},'examine'] call FUNC(addTreatmentOption); - -["STR_ACE_ACTION_CHECK_RESPONSE","STR_ACE_ACTION_CHECK_RESPONSE_TOOLTIP",{ - true; -},{[_this select 0,_this select 1] call FUNC(actionCheckResponse)},'examine'] call FUNC(addTreatmentOption); - - -// Drag/Movement -["STR_ACE_ACTION_DRAG_PATIENT","STR_ACE_ACTION_DRAG_PATIENT_TOOLTIP",{ - _caller = _this select 0; - _target = _this select 1; - - (isNull ([_caller] call EFUNC(common,getCarriedObj)) && isNull ([_target] call EFUNC(common,getCarriedObj)) && (_caller != _target) && (vehicle _target == _target)); -}, {[_this select 0,_this select 1] call FUNC(actionDragUnit)},'drag'] call FUNC(addTreatmentOption); - -["STR_ACE_ACTION_CARRY_PATIENT","STR_ACE_ACTION_CARRY_PATIENT_TOOLTIP",{ - _caller = _this select 0; - _target = _this select 1; - - (isNull ([_caller] call EFUNC(common,getCarriedObj)) && isNull ([_target] call EFUNC(common,getCarriedObj)) && (_caller != _target) && (vehicle _target == _target)); -}, {[_this select 0,_this select 1] call FUNC(actionCarryUnit)},'drag'] call FUNC(addTreatmentOption); - -["STR_ACE_ACTION_BODYBAG","STR_ACE_ACTION_BODYBAG_TOOLTIP",{ - _caller = _this select 0; - _target = _this select 1; - - (isNull ([_caller] call EFUNC(common,getCarriedObj)) && isNull ([_target] call EFUNC(common,getCarriedObj)) && (_caller != _target) && (vehicle _target == _target) && ([_caller, _target] call FUNC(canPutInBodyBag))); -}, {[_this select 0,_this select 1] call FUNC(actionPlaceInBodyBag)},'drag'] call FUNC(addTreatmentOption); - -["STR_ACE_ACTION_DROP_PATIENT","STR_ACE_ACTION_DROP_PATIENT_TOOLTIP",{ - _caller = _this select 0; - _target = _this select 1; - - (!(isNull ([_caller] call EFUNC(common,getCarriedObj))) && ([_caller] call FUNC(isMovingUnit))); -}, {[_this select 0,_this select 1] call FUNC(actionDropUnit)},'drag'] call FUNC(addTreatmentOption); - -["STR_ACE_ACTION_LOAD_PATIENT","STR_ACE_ACTION_LOAD_PATIENT_TOOLTIP",{ - _caller = _this select 0; - _target = _this select 1; - - ((vehicle _target == _target)); -}, {[_this select 0,_this select 1] call FUNC(actionLoadUnit)},'drag'] call FUNC(addTreatmentOption); - -["STR_ACE_ACTION_UNLOAD_PATIENT","STR_ACE_ACTION_UNLOAD_PATIENT_TOOLTIP",{ - _caller = _this select 0; - _target = _this select 1; - - ((vehicle _target != _target)); -}, {[_this select 0,_this select 1] call FUNC(actionUnloadUnit)},'drag'] call FUNC(addTreatmentOption); + { + _unit = _x; + _openWounds = _unit getvariable [QGVAR(openWounds), []]; + { + ["medical_propagateWound", [_id], [_unit, _x]] call EFUNC(common,targetEvent); + }foreach _openWounds; + }foreach GVAR(InjuredCollection); + }, []] call BIS_fnc_addStackedEventHandler; +}; diff --git a/addons/medical/XEH_preInit.sqf b/addons/medical/XEH_preInit.sqf index 57800cd5b7..91427fd545 100644 --- a/addons/medical/XEH_preInit.sqf +++ b/addons/medical/XEH_preInit.sqf @@ -1,171 +1,83 @@ -/** - * XEH_preInit); - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - #include "script_component.hpp" ADDON = false; -PREP(actionCarryUnit); -PREP(ActioncheckBloodPressure); -PREP(ActionCheckBloodPressureLocal); -PREP(ActionCheckPulse); +PREP(actionCheckBloodPressure); +PREP(actionCheckBloodPressureLocal); +PREP(actionCheckPulse); PREP(actionCheckPulseLocal); PREP(actionCheckResponse); -PREP(actionDragUnit); -PREP(actionDropUnit); -PREP(actionLoadUnit); PREP(actionPlaceInBodyBag); PREP(actionRemoveTourniquet); +PREP(actionLoadUnit); PREP(actionUnloadUnit); - -PREP(addActivityToLog); PREP(addHeartRateAdjustment); -PREP(addOpenWounds); PREP(addToInjuredCollection); -PREP(addToQuickViewLog); -PREP(addToTriageList); -PREP(addTreatmentOption); - +PREP(addToLog); +PREP(addToTriageCard); +PREP(addUnconsciousCondition); PREP(canAccessMedicalEquipment); -PREP(canPutInBodyBag); +PREP(canTreat); PREP(determineIfFatal); -PREP(determineIfUnconscious); -PREP(fromNumberToBodyPart); - -PREP(effectPain); -PREP(effectBleeding); -PREP(effectBlackOut); - -PREP(getActivityLog); PREP(getBloodLoss); PREP(getBloodPressure); PREP(getBloodVolumeChange); -PREP(getBodyPartNumber); PREP(getCardiacOutput); -PREP(getCurrentSelectedInjuryData); -PREP(getHeartRateChange); -PREP(getNewDamageBodyPart); -PREP(getQuickViewLog); -PREP(getSelectedBodyPart); -PREP(getTreatmentOptions); -PREP(getTriageList); -PREP(getTriageStatus); PREP(getTypeOfDamage); - -// Handling events & actions -PREP(handleBandageOpening); +PREP(getUnconsciousCondition); PREP(handleDamage); -PREP(handleDisplayEffects); -PREP(handleHeal); -PREP(handleReactionHit); -PREP(handleTreatment); -PREP(handleTreatment_Action_AdvancedLocal); -PREP(handleTreatment_Action_AirwayLocal); -PREP(handleTreatment_Action_BandageLocal); -PREP(handleTreatment_Action_CPR); -PREP(handleTreatment_Action_CPRLocal); -PREP(handleTreatment_Action_fullHeal); -PREP(handleTreatment_Action_fullHealLocal); -PREP(handleTreatment_Action_MedicationLocal); -PREP(handleTreatment_Action_Stitching); -PREP(handleTreatment_Action_tourniquet); -PREP(handleTreatment_Action_tourniquetLocal); -PREP(handleTreatment_Category_Advanced); -PREP(handleTreatment_Category_Airway); -PREP(handleTreatment_Category_Bandaging); -PREP(handleTreatment_Category_Medication); -PREP(handleUI_DisplayOptions); -PREP(handleUI_dropDownTriageCard); +PREP(handleDamage_advanced); +PREP(handleDamage_advancedSetDamage); +PREP(handleDamage_airway); +PREP(handleDamage_basic); +PREP(handleDamage_caching); +PREP(handleDamage_fractures); +PREP(handleDamage_internalInjuries); +PREP(handleDamage_wounds); PREP(handleUnitVitals); -PREP(handleDropUnit); - -PREP(hasEquipment); +PREP(hasItem); +PREP(hasItems); PREP(hasMedicalEnabled); -PREP(hasOpenWounds); PREP(hasTourniquetAppliedTo); - -PREP(increasePain); -PREP(initalizeModuleCMS); -PREP(inMedicalFacility); +PREP(init); +PREP(isInMedicalFacility); PREP(isMedic); PREP(isMedicalVehicle); -PREP(isSetTreatmentMutex); -PREP(isMovingUnit); - -PREP(moduleAssignMedicalEquipment); -PREP(moduleAssignMedicalFacility); -PREP(moduleAssignMedicalVehicle); -PREP(moduleAssignMedicRoles); -PREP(moduleDamageSettings); - -PREP(onInitForUnit); -PREP(onInjury_assignAirwayStatus); -PREP(onInjury_assignFractures); -PREP(onInjury_assignOpenWounds); -PREP(onKilled); -PREP(onLocal); -PREP(onMenuOpen); -PREP(onTreatmentCompleted); -PREP(onUnconscious); -PREP(onStartMovingUnit); -PREP(onCarryObjectDropped); -PREP(onDamage); - -PREP(openMenu); +PREP(onMedicationUsage); +PREP(onWoundUpdateRequest); +PREP(onPropagateWound); +PREP(parseConfigForInjuries); PREP(playInjuredSound); +PREP(reactionToDamage); +PREP(selectionNameToNumber); PREP(setCardiacArrest); -PREP(setDamageBodyPart); PREP(setDead); -PREP(setMedicRole); -PREP(setTriageStatus); -PREP(treatmentMutex); +PREP(setHitPointDamage); +PREP(setUnconscious); +PREP(treatment); +PREP(treatment_failure); +PREP(treatment_success); +PREP(treatmentAdvanced_bandage); +PREP(treatmentAdvanced_bandageLocal); +PREP(treatmentAdvanced_CPR); +PREP(treatmentAdvanced_CPRLocal); +PREP(treatmentAdvanced_fullHeal); +PREP(treatmentAdvanced_fullHealLocal); +PREP(treatmentAdvanced_medication); +PREP(treatmentAdvanced_medicationLocal); +PREP(treatmentBasic_bandage); +PREP(treatmentBasic_bloodbag); +PREP(treatmentBasic_epipen); +PREP(treatmentBasic_morphine); +PREP(treatmentIV); +PREP(treatmentIVLocal); +PREP(treatmentTourniquet); +PREP(treatmentTourniquetLocal); +PREP(useItem); +PREP(useItems); +PREP(displayPatientInformation); -PREP(updateActivityLog); -PREP(updateBodyImg); -PREP(updateIcons); -PREP(updateUIInfo); - -PREP(useEquipment); -PREP(cacheHandledamageCall); -PREP(checkDamage); - - -PREP(setUnconsciousState); -PREP(isUnconscious); -PREP(getUnconsciousCondition); -PREP(registerUnconsciousCondition); -PREP(cleanUpCopyOfBody_F); -PREP(makeCopyOfBody_F); -PREP(canGoUnconsciousState); -PREP(setDead); -PREP(moduleBasicRevive); - -PREP(setWeaponsCorrectUnconscious); -PREP(setCaptiveSwitch); - - -// initalize all module parameters. -GVAR(setting_allowInstantDead) = true; -GVAR(setting_AdvancedLevel) = 0; -GVAR(setting_advancedWoundsSetting) = false; -GVAR(setting_advancedMedicRoles) = false; -GVAR(setting_medicalDifficulty) = 1; -GVAR(setting_enableBandagingAid) = true; -GVAR(setting_allowAIFullHeal) = false; -GVAR(setting_enableForUnits) = 1; -GVAR(setting_allowAirwayInjuries) = false; -GVAR(setting_aidKitRestrictions) = 0; -GVAR(setting_removeAidKitOnUse) = true; -GVAR(setting_aidKitMedicsOnly) = false; -GVAR(setting_bandageWaitingTime) = 5; -GVAR(setting_allowVehicleCrashInjuries) = true; -GVAR(setting_allowStitching) = 0; +GVAR(injuredUnitCollection) = []; +call FUNC(parseConfigForInjuries); ADDON = true; diff --git a/addons/medical/XEH_respawn.sqf b/addons/medical/XEH_respawn.sqf new file mode 100644 index 0000000000..f9ead5a801 --- /dev/null +++ b/addons/medical/XEH_respawn.sqf @@ -0,0 +1,10 @@ +#include "script_component.hpp" + +private ["_unit"]; + +_unit = _this select 0; + +if !(local _unit) exitWith {}; + +diag_log "running respawn"; +[_unit] call FUNC(init); diff --git a/addons/medical/config.cpp b/addons/medical/config.cpp index 96af8ac1ca..0449a7e17b 100644 --- a/addons/medical/config.cpp +++ b/addons/medical/config.cpp @@ -1,31 +1,20 @@ #include "script_component.hpp" -class CfgPatches -{ - class ADDON - { - units[] = {"ACE_medical_supply_crate_cms", "ACE_bandage_basicItem","ACE_packing_bandageItem","ACE_bandageElasticItem","ACE_tourniquetItem","ACE_splintItem","ACE_morphineItem","ACE_atropineItem","ACE_epinephrineItem","ACE_plasma_ivItem","ACE_plasma_iv_500Item","ACE_plasma_iv250Item","ACE_blood_ivItem","ACE_blood_iv_500Item","ACE_blood_iv_250Item","ACE_saline_ivItem","ACE_saline_iv_500Item","ACE_saline_iv_250Item","ACE_quikclotItem","ACE_nasopharyngeal_tubeItem","ACE_opaItem","ACE_liquidSkinItem","ACE_chestsealItem","ACE_personal_aid_kitItem"}; - weapons[] = {"ACE_surgical_kit"}; - requiredVersion = REQUIRED_VERSION; - requiredAddons[] = {"ACE_gui","ACE_common"}; - version = VERSION; - author[] = {$STR_ACE_Common_ACETeam, "Glowbal"}; - authorUrl = "http://csemod.com"; - }; -}; -class CfgAddons { - class PreloadAddons { - class ADDON { - list[] = {QUOTE(ADDON)}; - }; +class CfgPatches { + class ADDON { + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {ace_common, ace_interaction}; + author[] = {"Glowbal", "KoffienFlummi"}; + authorUrl = ""; + VERSION_CONFIG; }; }; #include "CfgEventHandlers.hpp" -#include "CfgFactionClasses.hpp" -#include "CfgWeapons.hpp" -#include "CfgSounds.hpp" #include "CfgVehicles.hpp" -#include "ui\define.hpp" -#include "ui\menu.hpp" -#include "ui\RscTitles.hpp" +#include "CfgWeapons.hpp" +#include "CFgSounds.hpp" +#include "ACE_Medical_Treatments.hpp" +#include "UI\RscTitles.hpp" diff --git a/addons/medical/data/ACE_medical_module.paa b/addons/medical/data/ACE_medical_module.paa deleted file mode 100644 index 9cb6c4782d..0000000000 Binary files a/addons/medical/data/ACE_medical_module.paa and /dev/null differ diff --git a/addons/medical/data/atropine.p3d b/addons/medical/data/atropine.p3d new file mode 100644 index 0000000000..582f495291 Binary files /dev/null and b/addons/medical/data/atropine.p3d differ diff --git a/addons/medical/equipment/data/Atropinpen_co.paa b/addons/medical/data/atropine_co.paa similarity index 100% rename from addons/medical/equipment/data/Atropinpen_co.paa rename to addons/medical/data/atropine_co.paa diff --git a/addons/medical/data/background_img.paa b/addons/medical/data/background_img.paa deleted file mode 100644 index de59065e3b..0000000000 Binary files a/addons/medical/data/background_img.paa and /dev/null differ diff --git a/addons/medical/data/black_out.paa b/addons/medical/data/black_out.paa deleted file mode 100644 index c50a106954..0000000000 Binary files a/addons/medical/data/black_out.paa and /dev/null differ diff --git a/addons/medical/data/bleeding.paa b/addons/medical/data/bleeding.paa deleted file mode 100644 index 2e88e1cf3d..0000000000 Binary files a/addons/medical/data/bleeding.paa and /dev/null differ diff --git a/addons/medical/data/body_arms.paa b/addons/medical/data/body_arms.paa deleted file mode 100644 index b4b272f73d..0000000000 Binary files a/addons/medical/data/body_arms.paa and /dev/null differ diff --git a/addons/medical/data/body_background.paa b/addons/medical/data/body_background.paa deleted file mode 100644 index d3f7440e68..0000000000 Binary files a/addons/medical/data/body_background.paa and /dev/null differ diff --git a/addons/medical/data/body_img-arms.paa b/addons/medical/data/body_img-arms.paa deleted file mode 100644 index f469a59359..0000000000 Binary files a/addons/medical/data/body_img-arms.paa and /dev/null differ diff --git a/addons/medical/data/body_img-head.paa b/addons/medical/data/body_img-head.paa deleted file mode 100644 index 2f7d15e1ca..0000000000 Binary files a/addons/medical/data/body_img-head.paa and /dev/null differ diff --git a/addons/medical/data/body_img-legs.paa b/addons/medical/data/body_img-legs.paa deleted file mode 100644 index 35f68d8635..0000000000 Binary files a/addons/medical/data/body_img-legs.paa and /dev/null differ diff --git a/addons/medical/data/body_img-torso.paa b/addons/medical/data/body_img-torso.paa deleted file mode 100644 index cc5ecb9d60..0000000000 Binary files a/addons/medical/data/body_img-torso.paa and /dev/null differ diff --git a/addons/medical/data/body_legs.paa b/addons/medical/data/body_legs.paa deleted file mode 100644 index 9af3adc2ca..0000000000 Binary files a/addons/medical/data/body_legs.paa and /dev/null differ diff --git a/addons/medical/data/bodybag.p3d b/addons/medical/data/bodybag.p3d new file mode 100644 index 0000000000..1fec3a05f0 Binary files /dev/null and b/addons/medical/data/bodybag.p3d differ diff --git a/addons/medical/equipment/data/bodybag.rvmat b/addons/medical/data/bodybag.rvmat similarity index 100% rename from addons/medical/equipment/data/bodybag.rvmat rename to addons/medical/data/bodybag.rvmat diff --git a/addons/medical/data/bodybagItem.p3d b/addons/medical/data/bodybagItem.p3d new file mode 100644 index 0000000000..72c8fec886 Binary files /dev/null and b/addons/medical/data/bodybagItem.p3d differ diff --git a/addons/medical/equipment/data/bodybagItem.rvmat b/addons/medical/data/bodybagItem.rvmat similarity index 100% rename from addons/medical/equipment/data/bodybagItem.rvmat rename to addons/medical/data/bodybagItem.rvmat diff --git a/addons/medical/equipment/data/bodybagItem_co.paa b/addons/medical/data/bodybagItem_co.paa similarity index 100% rename from addons/medical/equipment/data/bodybagItem_co.paa rename to addons/medical/data/bodybagItem_co.paa diff --git a/addons/medical/equipment/data/bodybagItem_nohq.paa b/addons/medical/data/bodybagItem_nohq.paa similarity index 100% rename from addons/medical/equipment/data/bodybagItem_nohq.paa rename to addons/medical/data/bodybagItem_nohq.paa diff --git a/addons/medical/equipment/data/bodybagItem_smdi.paa b/addons/medical/data/bodybagItem_smdi.paa similarity index 100% rename from addons/medical/equipment/data/bodybagItem_smdi.paa rename to addons/medical/data/bodybagItem_smdi.paa diff --git a/addons/medical/equipment/data/bodybag_co.paa b/addons/medical/data/bodybag_co.paa similarity index 100% rename from addons/medical/equipment/data/bodybag_co.paa rename to addons/medical/data/bodybag_co.paa diff --git a/addons/medical/equipment/data/bodybag_nohq.paa b/addons/medical/data/bodybag_nohq.paa similarity index 100% rename from addons/medical/equipment/data/bodybag_nohq.paa rename to addons/medical/data/bodybag_nohq.paa diff --git a/addons/medical/data/border_arm_left.paa b/addons/medical/data/border_arm_left.paa deleted file mode 100644 index eae1d751cf..0000000000 Binary files a/addons/medical/data/border_arm_left.paa and /dev/null differ diff --git a/addons/medical/data/border_arm_right.paa b/addons/medical/data/border_arm_right.paa deleted file mode 100644 index 0aea4ce20e..0000000000 Binary files a/addons/medical/data/border_arm_right.paa and /dev/null differ diff --git a/addons/medical/data/border_head.paa b/addons/medical/data/border_head.paa deleted file mode 100644 index 3b2e7aaf10..0000000000 Binary files a/addons/medical/data/border_head.paa and /dev/null differ diff --git a/addons/medical/data/border_leg_left.paa b/addons/medical/data/border_leg_left.paa deleted file mode 100644 index 7ff3b170fa..0000000000 Binary files a/addons/medical/data/border_leg_left.paa and /dev/null differ diff --git a/addons/medical/data/border_leg_right.paa b/addons/medical/data/border_leg_right.paa deleted file mode 100644 index bef0f70779..0000000000 Binary files a/addons/medical/data/border_leg_right.paa and /dev/null differ diff --git a/addons/medical/data/border_torso.paa b/addons/medical/data/border_torso.paa deleted file mode 100644 index 2b70076939..0000000000 Binary files a/addons/medical/data/border_torso.paa and /dev/null differ diff --git a/addons/medical/data/buttonDisabled_gradient.paa b/addons/medical/data/buttonDisabled_gradient.paa deleted file mode 100644 index 43b1b8d100..0000000000 Binary files a/addons/medical/data/buttonDisabled_gradient.paa and /dev/null differ diff --git a/addons/medical/data/buttonNormal_gradient.paa b/addons/medical/data/buttonNormal_gradient.paa deleted file mode 100644 index 2210f98741..0000000000 Binary files a/addons/medical/data/buttonNormal_gradient.paa and /dev/null differ diff --git a/addons/medical/data/buttonNormal_gradient2.paa b/addons/medical/data/buttonNormal_gradient2.paa deleted file mode 100644 index cabe6c7fed..0000000000 Binary files a/addons/medical/data/buttonNormal_gradient2.paa and /dev/null differ diff --git a/addons/medical/data/buttonNormal_gradient3.paa b/addons/medical/data/buttonNormal_gradient3.paa deleted file mode 100644 index 7da9fbcf8a..0000000000 Binary files a/addons/medical/data/buttonNormal_gradient3.paa and /dev/null differ diff --git a/addons/medical/data/buttonNormal_gradient_top.paa b/addons/medical/data/buttonNormal_gradient_top.paa deleted file mode 100644 index 904e1a62f7..0000000000 Binary files a/addons/medical/data/buttonNormal_gradient_top.paa and /dev/null differ diff --git a/addons/medical/data/epinephrine.p3d b/addons/medical/data/epinephrine.p3d new file mode 100644 index 0000000000..a06831867a Binary files /dev/null and b/addons/medical/data/epinephrine.p3d differ diff --git a/addons/medical/equipment/data/Epipen_co.paa b/addons/medical/data/epinephrine_co.paa similarity index 100% rename from addons/medical/equipment/data/Epipen_co.paa rename to addons/medical/data/epinephrine_co.paa diff --git a/addons/medical/data/hit.paa b/addons/medical/data/hit.paa deleted file mode 100644 index e878efff0b..0000000000 Binary files a/addons/medical/data/hit.paa and /dev/null differ diff --git a/addons/medical/data/icons/advanced_treatment_small.paa b/addons/medical/data/icons/advanced_treatment_small.paa deleted file mode 100644 index 8becb9d2df..0000000000 Binary files a/addons/medical/data/icons/advanced_treatment_small.paa and /dev/null differ diff --git a/addons/medical/data/icons/airway_management_small.paa b/addons/medical/data/icons/airway_management_small.paa deleted file mode 100644 index ab4da47958..0000000000 Binary files a/addons/medical/data/icons/airway_management_small.paa and /dev/null differ diff --git a/addons/medical/data/icons/bandage_fracture_small.paa b/addons/medical/data/icons/bandage_fracture_small.paa deleted file mode 100644 index a869f260ec..0000000000 Binary files a/addons/medical/data/icons/bandage_fracture_small.paa and /dev/null differ diff --git a/addons/medical/data/icons/examine_patient_small.paa b/addons/medical/data/icons/examine_patient_small.paa deleted file mode 100644 index 2e9fc9831d..0000000000 Binary files a/addons/medical/data/icons/examine_patient_small.paa and /dev/null differ diff --git a/addons/medical/data/icons/icon_advanced_treatment.paa b/addons/medical/data/icons/icon_advanced_treatment.paa deleted file mode 100644 index d6bf6effd9..0000000000 Binary files a/addons/medical/data/icons/icon_advanced_treatment.paa and /dev/null differ diff --git a/addons/medical/data/icons/icon_airway_management.paa b/addons/medical/data/icons/icon_airway_management.paa deleted file mode 100644 index f444f5f385..0000000000 Binary files a/addons/medical/data/icons/icon_airway_management.paa and /dev/null differ diff --git a/addons/medical/data/icons/icon_bandage_fracture.paa b/addons/medical/data/icons/icon_bandage_fracture.paa deleted file mode 100644 index df8d1de571..0000000000 Binary files a/addons/medical/data/icons/icon_bandage_fracture.paa and /dev/null differ diff --git a/addons/medical/data/icons/icon_bleeding.paa b/addons/medical/data/icons/icon_bleeding.paa deleted file mode 100644 index d11c2ed496..0000000000 Binary files a/addons/medical/data/icons/icon_bleeding.paa and /dev/null differ diff --git a/addons/medical/data/icons/icon_carry.paa b/addons/medical/data/icons/icon_carry.paa deleted file mode 100644 index 7ebb830b03..0000000000 Binary files a/addons/medical/data/icons/icon_carry.paa and /dev/null differ diff --git a/addons/medical/data/icons/icon_examine_patient.paa b/addons/medical/data/icons/icon_examine_patient.paa deleted file mode 100644 index 12eb06c890..0000000000 Binary files a/addons/medical/data/icons/icon_examine_patient.paa and /dev/null differ diff --git a/addons/medical/data/icons/icon_medication.paa b/addons/medical/data/icons/icon_medication.paa deleted file mode 100644 index 98893ad863..0000000000 Binary files a/addons/medical/data/icons/icon_medication.paa and /dev/null differ diff --git a/addons/medical/data/icons/icon_toggle_self.paa b/addons/medical/data/icons/icon_toggle_self.paa deleted file mode 100644 index 3078eb5dd5..0000000000 Binary files a/addons/medical/data/icons/icon_toggle_self.paa and /dev/null differ diff --git a/addons/medical/data/icons/icon_tourniquet.paa b/addons/medical/data/icons/icon_tourniquet.paa deleted file mode 100644 index 8b34a7bfbb..0000000000 Binary files a/addons/medical/data/icons/icon_tourniquet.paa and /dev/null differ diff --git a/addons/medical/data/icons/icon_tourniquet_small.paa b/addons/medical/data/icons/icon_tourniquet_small.paa deleted file mode 100644 index a457e2c0d5..0000000000 Binary files a/addons/medical/data/icons/icon_tourniquet_small.paa and /dev/null differ diff --git a/addons/medical/data/icons/icon_triage_card.paa b/addons/medical/data/icons/icon_triage_card.paa deleted file mode 100644 index 850ab0f4ce..0000000000 Binary files a/addons/medical/data/icons/icon_triage_card.paa and /dev/null differ diff --git a/addons/medical/data/icons/medication_small.paa b/addons/medical/data/icons/medication_small.paa deleted file mode 100644 index b6acd670c8..0000000000 Binary files a/addons/medical/data/icons/medication_small.paa and /dev/null differ diff --git a/addons/medical/data/icons/toggle_self_small.paa b/addons/medical/data/icons/toggle_self_small.paa deleted file mode 100644 index 73108e5a98..0000000000 Binary files a/addons/medical/data/icons/toggle_self_small.paa and /dev/null differ diff --git a/addons/medical/data/icons/triage_card_small.paa b/addons/medical/data/icons/triage_card_small.paa deleted file mode 100644 index 92eb0f0d20..0000000000 Binary files a/addons/medical/data/icons/triage_card_small.paa and /dev/null differ diff --git a/addons/medical/data/morphine.p3d b/addons/medical/data/morphine.p3d new file mode 100644 index 0000000000..4457c97cc9 Binary files /dev/null and b/addons/medical/data/morphine.p3d differ diff --git a/addons/medical/equipment/data/morphin_co.paa b/addons/medical/data/morphine_co.paa similarity index 100% rename from addons/medical/equipment/data/morphin_co.paa rename to addons/medical/data/morphine_co.paa diff --git a/addons/medical/data/packingbandage.p3d b/addons/medical/data/packingbandage.p3d new file mode 100644 index 0000000000..ccabe2b1f3 Binary files /dev/null and b/addons/medical/data/packingbandage.p3d differ diff --git a/addons/medical/equipment/bandages/packingbandage.rvmat b/addons/medical/data/packingbandage.rvmat similarity index 100% rename from addons/medical/equipment/bandages/packingbandage.rvmat rename to addons/medical/data/packingbandage.rvmat diff --git a/addons/medical/equipment/bandages/packingbandage_color.paa b/addons/medical/data/packingbandage_color.paa similarity index 100% rename from addons/medical/equipment/bandages/packingbandage_color.paa rename to addons/medical/data/packingbandage_color.paa diff --git a/addons/medical/data/painScreen.paa b/addons/medical/data/painScreen.paa deleted file mode 100644 index f629d66280..0000000000 Binary files a/addons/medical/data/painScreen.paa and /dev/null differ diff --git a/addons/medical/data/surgical_kit.p3d b/addons/medical/data/surgical_kit.p3d new file mode 100644 index 0000000000..f820ea6078 Binary files /dev/null and b/addons/medical/data/surgical_kit.p3d differ diff --git a/addons/medical/equipment/data/surgical_kit.rvmat b/addons/medical/data/surgical_kit.rvmat similarity index 100% rename from addons/medical/equipment/data/surgical_kit.rvmat rename to addons/medical/data/surgical_kit.rvmat diff --git a/addons/medical/equipment/data/surgical_kit_co.paa b/addons/medical/data/surgical_kit_co.paa similarity index 100% rename from addons/medical/equipment/data/surgical_kit_co.paa rename to addons/medical/data/surgical_kit_co.paa diff --git a/addons/medical/equipment/data/surgical_kit_metal.rvmat b/addons/medical/data/surgical_kit_metal.rvmat similarity index 100% rename from addons/medical/equipment/data/surgical_kit_metal.rvmat rename to addons/medical/data/surgical_kit_metal.rvmat diff --git a/addons/medical/equipment/data/surgical_kit_nohq.paa b/addons/medical/data/surgical_kit_nohq.paa similarity index 100% rename from addons/medical/equipment/data/surgical_kit_nohq.paa rename to addons/medical/data/surgical_kit_nohq.paa diff --git a/addons/medical/data/ui_background.paa b/addons/medical/data/ui_background.paa deleted file mode 100644 index f1c42c7d7d..0000000000 Binary files a/addons/medical/data/ui_background.paa and /dev/null differ diff --git a/addons/medical/equipment/Atropin-pen.p3d b/addons/medical/equipment/Atropin-pen.p3d deleted file mode 100644 index a34d11641a..0000000000 Binary files a/addons/medical/equipment/Atropin-pen.p3d and /dev/null differ diff --git a/addons/medical/equipment/Atropin-pen_used.p3d b/addons/medical/equipment/Atropin-pen_used.p3d deleted file mode 100644 index 8d72c3f8dc..0000000000 Binary files a/addons/medical/equipment/Atropin-pen_used.p3d and /dev/null differ diff --git a/addons/medical/equipment/Bandage elastic.p3d b/addons/medical/equipment/Bandage elastic.p3d deleted file mode 100644 index c215842967..0000000000 Binary files a/addons/medical/equipment/Bandage elastic.p3d and /dev/null differ diff --git a/addons/medical/equipment/Bandage-Pack.p3d b/addons/medical/equipment/Bandage-Pack.p3d deleted file mode 100644 index 00a288a57d..0000000000 Binary files a/addons/medical/equipment/Bandage-Pack.p3d and /dev/null differ diff --git a/addons/medical/equipment/Bandage-elastic.p3d b/addons/medical/equipment/Bandage-elastic.p3d deleted file mode 100644 index d7ab5a79e0..0000000000 Binary files a/addons/medical/equipment/Bandage-elastic.p3d and /dev/null differ diff --git a/addons/medical/equipment/Epipen.p3d b/addons/medical/equipment/Epipen.p3d deleted file mode 100644 index 8a1b0e5e35..0000000000 Binary files a/addons/medical/equipment/Epipen.p3d and /dev/null differ diff --git a/addons/medical/equipment/Epipen_used.p3d b/addons/medical/equipment/Epipen_used.p3d deleted file mode 100644 index af1294b0e2..0000000000 Binary files a/addons/medical/equipment/Epipen_used.p3d and /dev/null differ diff --git a/addons/medical/equipment/Morphinpen.p3d b/addons/medical/equipment/Morphinpen.p3d deleted file mode 100644 index 06a39e7d56..0000000000 Binary files a/addons/medical/equipment/Morphinpen.p3d and /dev/null differ diff --git a/addons/medical/equipment/Morphinpen_used.p3d b/addons/medical/equipment/Morphinpen_used.p3d deleted file mode 100644 index 6e6bf06119..0000000000 Binary files a/addons/medical/equipment/Morphinpen_used.p3d and /dev/null differ diff --git a/addons/medical/equipment/Personal-aidkits/MTP.p3d b/addons/medical/equipment/Personal-aidkits/MTP.p3d deleted file mode 100644 index f2313e9652..0000000000 Binary files a/addons/medical/equipment/Personal-aidkits/MTP.p3d and /dev/null differ diff --git a/addons/medical/equipment/Personal-aidkits/data/MTP_co.paa b/addons/medical/equipment/Personal-aidkits/data/MTP_co.paa deleted file mode 100644 index 660ebe3477..0000000000 Binary files a/addons/medical/equipment/Personal-aidkits/data/MTP_co.paa and /dev/null differ diff --git a/addons/medical/equipment/Personal-aidkits/data/Mulitcam.paa b/addons/medical/equipment/Personal-aidkits/data/Mulitcam.paa deleted file mode 100644 index 3e55892c84..0000000000 Binary files a/addons/medical/equipment/Personal-aidkits/data/Mulitcam.paa and /dev/null differ diff --git a/addons/medical/equipment/Personal-aidkits/data/Personalaidkit.rvmat b/addons/medical/equipment/Personal-aidkits/data/Personalaidkit.rvmat deleted file mode 100644 index a071c22c19..0000000000 --- a/addons/medical/equipment/Personal-aidkits/data/Personalaidkit.rvmat +++ /dev/null @@ -1,32 +0,0 @@ -ambient[]={1,1,1,1}; -diffuse[]={0.5,0.5,0.5,1}; -forcedDiffuse[]={0.5,0.5,0.5,0}; -emmisive[]={0,0,0,1}; -specular[]={0.30000001,0.30000001,0.30000001,0}; -specularPower=100; -PixelShaderID="NormalMapSpecularDIMap"; -VertexShaderID="NormalMap"; -class Stage1 -{ - texture="z\ace\addons\medical\equipment\Personal-aidkits\data\Personalaidkit_nohq.paa"; - uvSource="tex"; - class uvTransform - { - aside[]={1,0,0}; - up[]={0,1,0}; - dir[]={0,0,1}; - pos[]={0,0,0}; - }; -}; -class Stage2 -{ - texture="z\ace\addons\medical\equipment\Personal-aidkits\data\Personalaidkit_smdi.paa"; - uvSource="tex"; - class uvTransform - { - aside[]={1,0,0}; - up[]={0,1,0}; - dir[]={0,0,1}; - pos[]={0,0,0}; - }; -}; diff --git a/addons/medical/equipment/Personal-aidkits/data/Personalaidkit_nohq.paa b/addons/medical/equipment/Personal-aidkits/data/Personalaidkit_nohq.paa deleted file mode 100644 index 0d03b45372..0000000000 Binary files a/addons/medical/equipment/Personal-aidkits/data/Personalaidkit_nohq.paa and /dev/null differ diff --git a/addons/medical/equipment/Personal-aidkits/data/Personalaidkit_smdi.paa b/addons/medical/equipment/Personal-aidkits/data/Personalaidkit_smdi.paa deleted file mode 100644 index 2fb8bec533..0000000000 Binary files a/addons/medical/equipment/Personal-aidkits/data/Personalaidkit_smdi.paa and /dev/null differ diff --git a/addons/medical/equipment/QuickClot.p3d b/addons/medical/equipment/QuickClot.p3d deleted file mode 100644 index aa431372bb..0000000000 Binary files a/addons/medical/equipment/QuickClot.p3d and /dev/null differ diff --git a/addons/medical/equipment/Tourniquet.p3d b/addons/medical/equipment/Tourniquet.p3d deleted file mode 100644 index 300a74c166..0000000000 Binary files a/addons/medical/equipment/Tourniquet.p3d and /dev/null differ diff --git a/addons/medical/equipment/bandages/fielddressing.p3d b/addons/medical/equipment/bandages/fielddressing.p3d deleted file mode 100644 index 6b7f94ef9b..0000000000 Binary files a/addons/medical/equipment/bandages/fielddressing.p3d and /dev/null differ diff --git a/addons/medical/equipment/bandages/fielddressing.rvmat b/addons/medical/equipment/bandages/fielddressing.rvmat deleted file mode 100644 index 7eda45da4f..0000000000 --- a/addons/medical/equipment/bandages/fielddressing.rvmat +++ /dev/null @@ -1,32 +0,0 @@ -ambient[]={1,1,1,1}; -diffuse[]={0.5,0.5,0.5,1}; -forcedDiffuse[]={0.5,0.5,0.5,0}; -emmisive[]={0,0,0,1}; -specular[]={0.30000001,0.30000001,0.30000001,0}; -specularPower=57.799999; -PixelShaderID="NormalMapSpecularDIMap"; -VertexShaderID="NormalMap"; -class Stage1 -{ - texture="z\ace\addons\medical\equipment\bandages\fielddressing_nohq.paa"; - uvSource="tex"; - class uvTransform - { - aside[]={1,0,0}; - up[]={0,1,0}; - dir[]={0,0,1}; - pos[]={0,0,0}; - }; -}; -class Stage2 -{ - texture="z\ace\addons\medical\equipment\bandages\fielddressing_smdi.paa"; - uvSource="tex"; - class uvTransform - { - aside[]={1,0,0}; - up[]={0,1,0}; - dir[]={0,0,1}; - pos[]={0,0,0}; - }; -}; diff --git a/addons/medical/equipment/bandages/fielddressing_color.paa b/addons/medical/equipment/bandages/fielddressing_color.paa deleted file mode 100644 index 7d68a365c2..0000000000 Binary files a/addons/medical/equipment/bandages/fielddressing_color.paa and /dev/null differ diff --git a/addons/medical/equipment/bandages/fielddressing_garbage.p3d b/addons/medical/equipment/bandages/fielddressing_garbage.p3d deleted file mode 100644 index 0939de5c08..0000000000 Binary files a/addons/medical/equipment/bandages/fielddressing_garbage.p3d and /dev/null differ diff --git a/addons/medical/equipment/bandages/fielddressing_nohq.paa b/addons/medical/equipment/bandages/fielddressing_nohq.paa deleted file mode 100644 index c66785cf13..0000000000 Binary files a/addons/medical/equipment/bandages/fielddressing_nohq.paa and /dev/null differ diff --git a/addons/medical/equipment/bandages/fielddressing_smdi.paa b/addons/medical/equipment/bandages/fielddressing_smdi.paa deleted file mode 100644 index 96376989f7..0000000000 Binary files a/addons/medical/equipment/bandages/fielddressing_smdi.paa and /dev/null differ diff --git a/addons/medical/equipment/bandages/packingbandage.p3d b/addons/medical/equipment/bandages/packingbandage.p3d deleted file mode 100644 index c1cc09af35..0000000000 Binary files a/addons/medical/equipment/bandages/packingbandage.p3d and /dev/null differ diff --git a/addons/medical/equipment/bandages/packingbandage_garbage.p3d b/addons/medical/equipment/bandages/packingbandage_garbage.p3d deleted file mode 100644 index cb695caac6..0000000000 Binary files a/addons/medical/equipment/bandages/packingbandage_garbage.p3d and /dev/null differ diff --git a/addons/medical/equipment/bandages/packingbandage_nohq.paa b/addons/medical/equipment/bandages/packingbandage_nohq.paa deleted file mode 100644 index 1b3782c501..0000000000 Binary files a/addons/medical/equipment/bandages/packingbandage_nohq.paa and /dev/null differ diff --git a/addons/medical/equipment/bandages/packingbandage_smdi.paa b/addons/medical/equipment/bandages/packingbandage_smdi.paa deleted file mode 100644 index 8d5b3848ac..0000000000 Binary files a/addons/medical/equipment/bandages/packingbandage_smdi.paa and /dev/null differ diff --git a/addons/medical/equipment/bodybag.p3d b/addons/medical/equipment/bodybag.p3d deleted file mode 100644 index 4a6b6e85ab..0000000000 Binary files a/addons/medical/equipment/bodybag.p3d and /dev/null differ diff --git a/addons/medical/equipment/bodybagItem.p3d b/addons/medical/equipment/bodybagItem.p3d deleted file mode 100644 index 11168bf776..0000000000 Binary files a/addons/medical/equipment/bodybagItem.p3d and /dev/null differ diff --git a/addons/medical/equipment/data/Field-Dressing.rvmat b/addons/medical/equipment/data/Field-Dressing.rvmat deleted file mode 100644 index 9c43af9abf..0000000000 --- a/addons/medical/equipment/data/Field-Dressing.rvmat +++ /dev/null @@ -1,32 +0,0 @@ -ambient[]={1,1,1,1}; -diffuse[]={0.5,0.5,0.5,1}; -forcedDiffuse[]={0.5,0.5,0.5,0}; -emmisive[]={0,0,0,1}; -specular[]={0.30000001,0.30000001,0.30000001,0}; -specularPower=57.799999; -PixelShaderID="NormalMapSpecularDIMap"; -VertexShaderID="NormalMap"; -class Stage1 -{ - texture="z\ace\addons\medical\equipment\data\Field-Dressing_nohq.paa"; - uvSource="tex"; - class uvTransform - { - aside[]={1,0,0}; - up[]={0,1,0}; - dir[]={0,0,1}; - pos[]={0,0,0}; - }; -}; -class Stage2 -{ - texture="z\ace\addons\medical\equipment\data\Field-Dressing_smdi.paa"; - uvSource="tex"; - class uvTransform - { - aside[]={1,0,0}; - up[]={0,1,0}; - dir[]={0,0,1}; - pos[]={0,0,0}; - }; -}; diff --git a/addons/medical/equipment/data/Field-Dressing_nohq.paa b/addons/medical/equipment/data/Field-Dressing_nohq.paa deleted file mode 100644 index 6972636a3d..0000000000 Binary files a/addons/medical/equipment/data/Field-Dressing_nohq.paa and /dev/null differ diff --git a/addons/medical/equipment/data/Field-Dressing_smdi.paa b/addons/medical/equipment/data/Field-Dressing_smdi.paa deleted file mode 100644 index f450605958..0000000000 Binary files a/addons/medical/equipment/data/Field-Dressing_smdi.paa and /dev/null differ diff --git a/addons/medical/equipment/data/Field-dressing.paa b/addons/medical/equipment/data/Field-dressing.paa deleted file mode 100644 index 07bae7d595..0000000000 Binary files a/addons/medical/equipment/data/Field-dressing.paa and /dev/null differ diff --git a/addons/medical/equipment/data/Liquid-skin.paa b/addons/medical/equipment/data/Liquid-skin.paa deleted file mode 100644 index fda64304bc..0000000000 Binary files a/addons/medical/equipment/data/Liquid-skin.paa and /dev/null differ diff --git a/addons/medical/equipment/data/Tournequit_co.paa b/addons/medical/equipment/data/Tournequit_co.paa deleted file mode 100644 index e83aada994..0000000000 Binary files a/addons/medical/equipment/data/Tournequit_co.paa and /dev/null differ diff --git a/addons/medical/equipment/data/bandage-elastic.paa b/addons/medical/equipment/data/bandage-elastic.paa deleted file mode 100644 index 3164b5d4ca..0000000000 Binary files a/addons/medical/equipment/data/bandage-elastic.paa and /dev/null differ diff --git a/addons/medical/equipment/data/env_co.paa b/addons/medical/equipment/data/env_co.paa deleted file mode 100644 index 77645347b5..0000000000 Binary files a/addons/medical/equipment/data/env_co.paa and /dev/null differ diff --git a/addons/medical/equipment/data/quickclot_co.paa b/addons/medical/equipment/data/quickclot_co.paa deleted file mode 100644 index bf0edccd7e..0000000000 Binary files a/addons/medical/equipment/data/quickclot_co.paa and /dev/null differ diff --git a/addons/medical/equipment/field_dressing.p3d b/addons/medical/equipment/field_dressing.p3d deleted file mode 100644 index 39b516c6bc..0000000000 Binary files a/addons/medical/equipment/field_dressing.p3d and /dev/null differ diff --git a/addons/medical/equipment/field_dressing_used.p3d b/addons/medical/equipment/field_dressing_used.p3d deleted file mode 100644 index a29958cca0..0000000000 Binary files a/addons/medical/equipment/field_dressing_used.p3d and /dev/null differ diff --git a/addons/medical/equipment/img/chestseal.paa b/addons/medical/equipment/img/chestseal.paa deleted file mode 100644 index be0f4f77bf..0000000000 Binary files a/addons/medical/equipment/img/chestseal.paa and /dev/null differ diff --git a/addons/medical/equipment/img/liquidSkin.paa b/addons/medical/equipment/img/liquidSkin.paa deleted file mode 100644 index 40e72038ec..0000000000 Binary files a/addons/medical/equipment/img/liquidSkin.paa and /dev/null differ diff --git a/addons/medical/equipment/img/nasopharyngeal_tube.paa b/addons/medical/equipment/img/nasopharyngeal_tube.paa deleted file mode 100644 index 6629605519..0000000000 Binary files a/addons/medical/equipment/img/nasopharyngeal_tube.paa and /dev/null differ diff --git a/addons/medical/equipment/img/personal_aid_kit.paa b/addons/medical/equipment/img/personal_aid_kit.paa deleted file mode 100644 index 87d6a1612f..0000000000 Binary files a/addons/medical/equipment/img/personal_aid_kit.paa and /dev/null differ diff --git a/addons/medical/equipment/img/splint.paa b/addons/medical/equipment/img/splint.paa deleted file mode 100644 index 87c1cb8686..0000000000 Binary files a/addons/medical/equipment/img/splint.paa and /dev/null differ diff --git a/addons/medical/equipment/skinliquid.p3d b/addons/medical/equipment/skinliquid.p3d deleted file mode 100644 index b3d761e256..0000000000 Binary files a/addons/medical/equipment/skinliquid.p3d and /dev/null differ diff --git a/addons/medical/equipment/splint.p3d b/addons/medical/equipment/splint.p3d deleted file mode 100644 index 42f3ad14b7..0000000000 Binary files a/addons/medical/equipment/splint.p3d and /dev/null differ diff --git a/addons/medical/equipment/surgical_kit.p3d b/addons/medical/equipment/surgical_kit.p3d deleted file mode 100644 index 9f616a100f..0000000000 Binary files a/addons/medical/equipment/surgical_kit.p3d and /dev/null differ diff --git a/addons/medical/functions/fnc_ActionCheckPulse.sqf b/addons/medical/functions/fnc_ActionCheckPulse.sqf deleted file mode 100644 index 52e9158329..0000000000 --- a/addons/medical/functions/fnc_ActionCheckPulse.sqf +++ /dev/null @@ -1,39 +0,0 @@ -/** - * fn_checkPulse.sqf - * @Descr: Displays specified units current pulse - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - - #include "script_component.hpp" - -private ["_caller","_target","_title","_content"]; -_caller = _this select 0; -_target = _this select 1; - -if ([_caller] call FUNC(isSetTreatmentMutex)) exitwith {}; -[_caller, true] call FUNC(treatmentMutex); - -_title = format["STR_ACE_CHECK_PULSE"]; -_content = ["STR_ACE_CHECK_PULSE_CONTENT"]; -[_caller, _title, _content] call EFUNC(gui,sendDisplayInformationTo); - -_caller setvariable [QGVAR(StartingPositionHandleTreatment), getPos _caller]; -[2 + round(random(1)), - {((vehicle (_this select 0) != (_this select 0)) ||((getPos (_this select 0)) distance ((_this select 0) getvariable QGVAR(StartingPositionHandleTreatment)) < 1))}, // the condition - { - private ["_caller","_target"]; - _caller = _this select 0; - _target = _this select 1; - [[_caller, _target], QUOTE(FUNC(actionCheckPulseLocal)), _target] call EFUNC(common,execRemoteFnc); - [_caller,false] call FUNC(treatmentMutex); - }, // on success - { - [(_this select 0), "STR_ACE_CANCELED", ["STR_ACE_ACTION_CANCELED","STR_ACE_YOU_MOVED_AWAY"]] call EFUNC(gui,sendDisplayInformationTo); - [(_this select 0),false] call FUNC(treatmentMutex); - }, // on failure - [_caller, _target] // arguments -] call EFUNC(gui,loadingBar); diff --git a/addons/medical/functions/fnc_ActioncheckBloodPressure.sqf b/addons/medical/functions/fnc_ActioncheckBloodPressure.sqf deleted file mode 100644 index d96ae8b19c..0000000000 --- a/addons/medical/functions/fnc_ActioncheckBloodPressure.sqf +++ /dev/null @@ -1,40 +0,0 @@ -/** - * fn_checkBloodPressure.sqf - * @Descr: Displays specified units current blood pressure - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - -#include "script_component.hpp" - -private ["_caller","_target","_title","_content"]; -_caller = _this select 0; -_target = _this select 1; - -if ([_caller] call FUNC(isSetTreatmentMutex)) exitwith {}; -[_caller, true] call FUNC(treatmentMutex); - -_title = format["STR_ACE_CHECK_BLOODPRESSURE"]; -_content = ["STR_ACE_CHECK_BLOODPRESSURE_CONTENT"]; -[_caller, _title, _content] call EFUNC(gui,sendDisplayInformationTo); - -_caller setvariable [QGVAR(StartingPositionHandleTreatment), getPos _caller]; -[2 + round(random(1)), - {((vehicle (_this select 0) != (_this select 0)) ||((getPos (_this select 0)) distance ((_this select 0) getvariable QGVAR(StartingPositionHandleTreatment)) < 1))}, // the condition - { - private ["_caller","_target"]; - _caller = _this select 0; - _target = _this select 1; - [_this, QUOTE(FUNC(actionCheckBloodPressureLocal)), _target] call EFUNC(common,execRemoteFnc); - [_caller,false] call FUNC(treatmentMutex); - }, // on success - { - [(_this select 0), "STR_ACE_CANCELED", ["STR_ACE_ACTION_CANCELED","STR_ACE_YOU_MOVED_AWAY"]] call EFUNC(gui,sendDisplayInformationTo); - [(_this select 0),false] call FUNC(treatmentMutex); - }, // on failure - [_caller, _target] // arguments -] call EFUNC(gui,loadingBar); - diff --git a/addons/medical/functions/fnc_actionCarryUnit.sqf b/addons/medical/functions/fnc_actionCarryUnit.sqf deleted file mode 100644 index d3cfb35aee..0000000000 --- a/addons/medical/functions/fnc_actionCarryUnit.sqf +++ /dev/null @@ -1,95 +0,0 @@ -/* - fnc_carry.sqf - Usage: makes the calling unit start carrying the specified unit - Author: Glowbal - - Arguments: array [caller (object), target (object)] - 1: caller (OBJECT), Object of type Man - 2: target (OBJECT), Object of type Man - Returns: none - - Affects: Caller and target locality - Executes: spawn -*/ - -#include "script_component.hpp" - - -private ["_caller", "_unit", "_positionUnit", "_killOnDrop"]; -_caller = [_this, 0, objNull, [objNull]] call BIS_fnc_param; -_unit = [_this, 1, objNull, [objNull]] call BIS_fnc_param; -_killOnDrop = [_this, 2, false, [false]] call BIS_fnc_param; - -["FUNC(actionDragUnit) has been called",2] call EFUNC(common,debug); - -if ([_caller] call FUNC(isSetTreatmentMutex)) exitwith {}; -[_caller, true] call FUNC(treatmentMutex); - -if (!(_unit isKindOf "CaManBase") || !(_caller isKindOf "CaManBase")) exitwith{ [_caller, false] call FUNC(treatmentMutex);}; -if (vehicle _caller != _caller || vehicle _unit != _unit) exitwith { [_caller, false] call FUNC(treatmentMutex);}; - -if (!([_caller] call EFUNC(common,canInteract)) || {_caller == _unit} || {(([_unit] call EFUNC(common,isAwake)))}) exitwith { - [_caller, false] call FUNC(treatmentMutex); -}; - -if (([_caller] call EFUNC(common,getCarriedObj)) != _unit && !(isNull ([_caller] call EFUNC(common,getCarriedObj))) || {!isNull(_unit getvariable [QGVAR(beingDragged),objNull]) || !isNull(_caller getvariable [QGVAR(dragging),objNull])} || {!isNull(_unit getvariable [QGVAR(beingCarried),objNull]) || !isNull(_caller getvariable [QGVAR(carrying),objNull])}) exitwith { - [_caller,objNull] call EFUNC(common,carryObj); - [_caller, false] call FUNC(treatmentMutex); -}; -_caller action ["WeaponOnBack", _caller]; -_killOnDrop = false; -if (!alive _unit) exitwith { - [_caller, false] call FUNC(treatmentMutex); - [{ - _this call FUNC(actionCarryUnit); - }, [_caller, ([_unit,_caller] call FUNC(makeCopyOfBody_F)), _killOnDrop], 0.25, 0.25] call EFUNC(common,waitAndExecute); -}; - -if !([_caller,_unit] call EFUNC(common,carryObj)) exitwith { - ["couldn't carry object!"] call EFUNC(common,debug); [_caller,false] call FUNC(treatmentMutex); -}; - -if (primaryWeapon _caller == "") then { - _caller addWeapon "ACE_FakePrimaryWeapon"; -}; -_caller selectWeapon (primaryWeapon _caller); - -_unit attachTo [_caller, [0.1, -0.1, -1.25], "LeftShoulder"]; - -[_unit,"AinjPfalMstpSnonWnonDf_carried_dead", 2, true] call EFUNC(common,doAnimation); -[_caller,"acinpercmstpsraswrfldnon", 1] call EFUNC(common,doAnimation); - -_caller setvariable [QGVAR(StartingPositionHandleTreatment), getPos _caller]; -[2, - {((vehicle (_this select 0) != (_this select 0)) ||((getPos (_this select 0)) distance ((_this select 0) getvariable QGVAR(StartingPositionHandleTreatment)) < 1.5))}, // the condition - { - private ["_caller","_target"]; - _caller = _this select 0; - _target = _this select 1; - _killOnDrop = _this select 2; - [_caller, false] call FUNC(treatmentMutex); - - // Registration for drag/carry functions - _target setvariable [QGVAR(beingCarried),_caller,true]; - _caller setvariable [QGVAR(carrying),_unit,true]; - - // Removing any old drop scroll wheel actions - // TODO Do we still want scroll wheel actions? - if (!isnil QGVAR(DROP_ADDACTION)) then { - _caller removeAction GVAR(DROP_ADDACTION); - GVAR(DROP_ADDACTION) = nil; - }; - // Adding the drop scroll wheel action. - GVAR(DROP_ADDACTION) = _caller addAction [format["Drop %1",[_target] call EFUNC(common,getName)], {[_this select 1, _this select 2] call FUNC(actionDropUnit);}]; - - // Raise an event - ["onStartMovingUnit", [_caller], [_caller, _Target, _killOnDrop, false]] call EFUNC(common,targetEvent); - - }, // on success - { - [(_this select 0), "STR_ACE_CANCELED", ["STR_ACE_ACTION_CANCELED","STR_ACE_YOU_MOVED_AWAY"]] call EFUNC(gui,sendDisplayInformationTo); - [(_this select 0), false] call FUNC(treatmentMutex); - [(_this select 0), objNull,[0, 0, 0]] call EFUNC(common,carryObj); - }, // on failure - [_caller, _unit, _killOnDrop] // arguments -] call EFUNC(gui,loadingBar); \ No newline at end of file diff --git a/addons/medical/functions/fnc_ActionCheckBloodPressureLocal.sqf b/addons/medical/functions/fnc_actionCheckBloodPressureLocal.sqf similarity index 59% rename from addons/medical/functions/fnc_ActionCheckBloodPressureLocal.sqf rename to addons/medical/functions/fnc_actionCheckBloodPressureLocal.sqf index 9f645e80ad..c175791b73 100644 --- a/addons/medical/functions/fnc_ActionCheckBloodPressureLocal.sqf +++ b/addons/medical/functions/fnc_actionCheckBloodPressureLocal.sqf @@ -1,21 +1,25 @@ -/** - * fn_checkBloodPressureLocal.sqf - * @Descr: Displays specified units current blood pressure - * @Author: Glowbal +/* + * Author: Glowbal + * Local callback for checking the blood pressure of a patient * - * @Arguments: [] - * @Return: - * @PublicAPI: false + * Arguments: + * 0: The medic + * 1: The patient + * + * Return Value: + * NONE + * + * Public: No */ #include "script_component.hpp" -private ["_caller","_unit","_bloodPressure","_bloodPressureHigh","_bloodPressureLow","_title","_content"]; +private ["_caller","_target","_bloodPressure","_bloodPressureHigh","_bloodPressureLow","_title","_content"]; _caller = _this select 0; -_unit = _this select 1; +_target = _this select 1; -_bloodPressure = [_unit] call FUNC(getBloodPressure); -if (!alive _unit) then { +_bloodPressure = [_target] call FUNC(getBloodPressure); +if (!alive _target) then { _bloodPressure = [0,0]; }; @@ -49,10 +53,8 @@ if ([_caller] call FUNC(isMedic)) then { }; }; -_title = format["STR_ACE_CHECK_BLOODPRESSURE"]; -_content = ["STR_ACE_CHECK_BLOODPRESSURE_CHECKED_MEDIC", _output]; -[_caller, _title, _content, 0,[[_unit] call EFUNC(common,getName), round(_bloodPressureHigh),round(_bloodPressureLow)] ] call EFUNC(gui,sendDisplayInformationTo); +["displayTextStructured", [_caller], [[_output, [_target] call EFUNC(common,getName), round(_bloodPressureHigh),round(_bloodPressureLow)], 1.5, _caller]] call EFUNC(common,targetEvent); if (_logOutPut != "") then { - [_unit,"examine",format["%1 checked Blood Pressure: %2",[_caller] call EFUNC(common,getName),_logOutPut]] call FUNC(addToQuickViewLog); -}; \ No newline at end of file + [_target,"examine", format["%1 checked Blood Pressure: %2", [_caller] call EFUNC(common,getName), _logOutPut]] call FUNC(addToLog); +}; diff --git a/addons/medical/functions/fnc_actionCheckPulseLocal.sqf b/addons/medical/functions/fnc_actionCheckPulseLocal.sqf index ae69f52272..e6565efb21 100644 --- a/addons/medical/functions/fnc_actionCheckPulseLocal.sqf +++ b/addons/medical/functions/fnc_actionCheckPulseLocal.sqf @@ -1,21 +1,25 @@ -/** - * fn_checkPulseLocal.sqf - * @Descr: N/A - * @Author: Glowbal +/* + * Author: Glowbal + * Local callback for checking the pulse of a patient * - * @Arguments: [] - * @Return: - * @PublicAPI: false + * Arguments: + * 0: The medic + * 1: The patient + * + * Return Value: + * NONE + * + * Public: No */ #include "script_component.hpp" -private ["_caller","_unit", "_heartRateOutput", "_heartRate","_logOutPut", "_title","_content"]; +private ["_caller","_unit", "_heartRateOutput", "_heartRate","_logOutPut","_content"]; _caller = _this select 0; _unit = _this select 1; -_heartRate = [_unit,QGVAR(heartRate)] call EFUNC(common,getDefinedVariable); +_heartRate = _unit getvariable [QGVAR(heartRate), 80]; if (!alive _unit) then { _heartRate = 0; }; @@ -42,10 +46,9 @@ if (_heartRate > 1.0) then { }; }; -_title = "STR_ACE_CHECK_PULSE"; _content = ["STR_ACE_CHECK_PULSE_CHECKED_MEDIC",_heartRateOutput]; -[_caller, _title, _content, 0, [[_unit] call EFUNC(common,getName), round(_heartRate)]] call EFUNC(gui,sendDisplayInformationTo); +["displayTextStructured", [_caller], [[_content, [_unit] call EFUNC(common,getName), round(_heartRate)], 1.5, _caller]] call EFUNC(common,targetEvent); if (_logOutPut != "") then { - [_unit,"examine",format["%1 checked Heart Rate: %2",[_caller] call EFUNC(common,getName),_logOutPut]] call FUNC(addToQuickViewLog); + [_unit,"examine",format["%1 checked Heart Rate: %2",[_caller] call EFUNC(common,getName),_logOutPut]] call FUNC(addToLog); }; diff --git a/addons/medical/functions/fnc_actionCheckResponse.sqf b/addons/medical/functions/fnc_actionCheckResponse.sqf index d2201e15f2..34ea90264b 100644 --- a/addons/medical/functions/fnc_actionCheckResponse.sqf +++ b/addons/medical/functions/fnc_actionCheckResponse.sqf @@ -1,11 +1,15 @@ -/** - * fn_checkResponse.sqf - * @Descr: N/A - * @Author: Glowbal +/* + * Author: Glowbal + * Action for checking the response status of the patient * - * @Arguments: [] - * @Return: - * @PublicAPI: false + * Arguments: + * 0: The medic + * 1: The patient + * + * Return Value: + * NONE + * + * Public: No */ #include "script_component.hpp" @@ -14,38 +18,13 @@ private ["_caller","_target"]; _caller = _this select 0; _target = _this select 1; -if ([_caller] call FUNC(isSetTreatmentMutex)) exitwith {}; -[_caller, true] call FUNC(treatmentMutex); +_output = ""; +if ([_target] call EFUNC(common,isAwake)) then { + _output = ["STR_ACE_CHECK_REPONSE_RESPONSIVE",[_target] call EFUNC(common,getName)]; +} else { + _output = ["STR_ACE_CHECK_REPONSE_UNRESPONSIVE",[_target] call EFUNC(common,getName)]; +}; -_title = format["STR_ACE_CHECK_RESPONSE"]; -_content = ["STR_ACE_CHECK_RESPONSE_CONTENT"]; -[_caller, _title, _content] call EFUNC(gui,sendDisplayInformationTo); +["displayTextStructured", [_caller], [_output, 1.5, _caller]] call EFUNC(common,targetEvent); -_caller setvariable [QGVAR(StartingPositionHandleTreatment), getPos _caller]; -[2 + round(random(1)), - {((vehicle (_this select 0) != (_this select 0)) ||((getPos (_this select 0)) distance ((_this select 0) getvariable QGVAR(StartingPositionHandleTreatment)) < 1))}, // the condition - { - private ["_caller","_target", "_output", "_title", "_content"]; - _caller = _this select 0; - _target = _this select 1; - - _output = ""; - if ([_target] call EFUNC(common,isAwake)) then { - _output = format[localize "STR_ACE_CHECK_REPONSE_RESPONSIVE",[_target] call EFUNC(common,getName)]; - } else { - _output = format[localize "STR_ACE_CHECK_REPONSE_UNRESPONSIVE",[_target] call EFUNC(common,getName)]; - }; - - _title = format["STR_ACE_CHECK_RESPONSE"]; - _content = [format[localize "STR_ACE_CHECK_REPONSE_YOU_CHECKED",[_target] call EFUNC(common,getName)],_output]; - [_caller, _title, _content] call EFUNC(gui,sendDisplayInformationTo); - [_target,"examine",_output] call FUNC(addToQuickViewLog); - - [_caller,false] call FUNC(treatmentMutex); - }, // on success - { - [(_this select 0), "STR_ACE_CANCELED", ["STR_ACE_ACTION_CANCELED","STR_ACE_YOU_MOVED_AWAY"]] call EFUNC(gui,sendDisplayInformationTo); - [(_this select 0),false] call FUNC(treatmentMutex); - }, // on failure - [_caller, _target] // arguments -] call EFUNC(gui,loadingBar); +[_target,"examine",_output] call FUNC(addToLog); diff --git a/addons/medical/functions/fnc_actionDragUnit.sqf b/addons/medical/functions/fnc_actionDragUnit.sqf deleted file mode 100644 index d0fa1c70ea..0000000000 --- a/addons/medical/functions/fnc_actionDragUnit.sqf +++ /dev/null @@ -1,102 +0,0 @@ -/* -fnc_drag.sqf -Usage: makes the calling unit start dragging the specified unit -Author: Glowbal - -Arguments: array [unit (object), unit (object)] - 1: Caller OBJECT. Unit that initiats the dragging - 2: Target OBJECT. Unit that will be dragged -Returns: none - -Affects: Caller and target Locality -Executes: call -*/ - -#include "script_component.hpp" - -private ["_caller", "_unit", "_positionUnit", "_killOnDrop"]; -_caller = [_this, 0, objNull, [objNull]] call BIS_fnc_param; -_unit = [_this, 1, objNull, [objNull]] call BIS_fnc_param; -_killOnDrop = [_this, 2, false, [false]] call BIS_fnc_param; - -["FUNC(actionDragUnit) has been called",2] call EFUNC(common,debug); - -if ([_caller] call FUNC(isSetTreatmentMutex)) exitwith {}; -[_caller, true] call FUNC(treatmentMutex); - -if (!(_unit isKindOf "CaManBase") || !(_caller isKindOf "CaManBase")) exitwith{ [_caller, false] call FUNC(treatmentMutex);}; -if (vehicle _caller != _caller || vehicle _unit != _unit) exitwith { [_caller, false] call FUNC(treatmentMutex);}; - -if (!([_caller] call EFUNC(common,canInteract)) || {_caller == _unit} || {(([_unit] call EFUNC(common,isAwake)))}) exitwith { - [_caller, false] call FUNC(treatmentMutex); -}; - -if (([_caller] call EFUNC(common,getCarriedObj)) != _unit && !(isNull ([_caller] call EFUNC(common,getCarriedObj))) || {!isNull(_unit getvariable [QGVAR(beingDragged),objNull]) || !isNull(_caller getvariable [QGVAR(dragging),objNull])}) exitwith { - [_caller,objNull] call EFUNC(common,carryObj); - [_caller, false] call FUNC(treatmentMutex); -}; - -if (!alive _unit) exitwith { - [_caller, false] call FUNC(treatmentMutex); - [{ - _this call FUNC(actionDragUnit); - }, [_caller, ([_unit,_caller] call FUNC(makeCopyOfBody_F)), _killOnDrop], 0.25, 0.25] call EFUNC(common,waitAndExecute); -}; - -if (primaryWeapon _caller == "") then { - _caller addWeapon "ACE_FakePrimaryWeapon"; -}; -_caller selectWeapon (primaryWeapon _unit); - -_unit setDir (getDir _unit + 180) % 360; -_unit setPos ((getPos _unit) vectorAdd ((vectorDir _caller) vectorMultiply 1.5)); - -if !([_caller,_unit,[0.125, 1.007, 0]] call EFUNC(common,carryObj)) exitwith { - [_caller, false] call FUNC(treatmentMutex); - // well something went horribly wrong here, should never reach this, since we do checks above.. - -}; - -[_unit, "AinjPpneMstpSnonWrflDb", 2, true] call EFUNC(common,doAnimation); - -_caller selectWeapon (primaryWeapon _caller); // if no primairy weapon, add a fake one first -if (currentWeapon _caller == primaryWeapon _caller) then { - [_caller,"AcinPknlMstpSrasWrflDnon", 1] call EFUNC(common,doAnimation); -} else { - [_caller,"AcinPknlMstpSnonWnonDnon", 1] call EFUNC(common,doAnimation); -}; - -_caller setvariable [QGVAR(StartingPositionHandleTreatment), getPos _caller]; -[2, - {((vehicle (_this select 0) != (_this select 0)) ||((getPos (_this select 0)) distance ((_this select 0) getvariable QGVAR(StartingPositionHandleTreatment)) < 1.5))}, // the condition - { - private ["_caller","_target"]; - _caller = _this select 0; - _target = _this select 1; - _killOnDrop = _this select 2; - [_caller, false] call FUNC(treatmentMutex); - - // Registration for drag/carry functions - _target setvariable [QGVAR(beingDragged),_caller,true]; - _caller setvariable [QGVAR(dragging), _target,true]; - - // Removing any old drop scroll wheel actions - // TODO Do we still want scroll wheel actions? - if (!isnil QGVAR(DROP_ADDACTION)) then { - _caller removeAction GVAR(DROP_ADDACTION); - GVAR(DROP_ADDACTION) = nil; - }; - // Adding the drop scroll wheel action. - GVAR(DROP_ADDACTION) = _caller addAction [format["Drop %1",[_target] call EFUNC(common,getName)], {[_this select 1, _this select 2] call FUNC(actionDropUnit);}]; - - // Raise an event - ["onStartMovingUnit", [_caller], [_caller, _Target, _killOnDrop, true]] call EFUNC(common,targetEvent); - - }, // on success - { - [(_this select 0), "STR_ACE_CANCELED", ["STR_ACE_ACTION_CANCELED","STR_ACE_YOU_MOVED_AWAY"]] call EFUNC(gui,sendDisplayInformationTo); - [(_this select 0), false] call FUNC(treatmentMutex); - [(_this select 0), objNull,[0, 0, 0]] call EFUNC(common,carryObj); - }, // on failure - [_caller, _unit, _killOnDrop] // arguments -] call EFUNC(gui,loadingBar); diff --git a/addons/medical/functions/fnc_actionDropUnit.sqf b/addons/medical/functions/fnc_actionDropUnit.sqf deleted file mode 100644 index 7154f6a5d5..0000000000 --- a/addons/medical/functions/fnc_actionDropUnit.sqf +++ /dev/null @@ -1,24 +0,0 @@ - -/* - fnc_drop.sqf - Usage: makes the calling unit start dragging the specified unit - Author: Glowbal - - Arguments: array [unit (object), unit (object)] - Returns: none - - Affects: - Executes: -*/ - -#include "script_component.hpp" - -private ["_caller", "_unit","_info","_draggedPerson"]; -_caller = _this select 0; -_unit = _this select 1; - -if (!isnil QGVAR(DROP_ADDACTION)) then { - [_caller,objNull] call EFUNC(common,carryObj); - _caller removeAction GVAR(DROP_ADDACTION); - GVAR(DROP_ADDACTION) = nil; -}; diff --git a/addons/medical/functions/fnc_actionLoadUnit.sqf b/addons/medical/functions/fnc_actionLoadUnit.sqf index cd20140bdb..6fad5b0847 100644 --- a/addons/medical/functions/fnc_actionLoadUnit.sqf +++ b/addons/medical/functions/fnc_actionLoadUnit.sqf @@ -1,31 +1,37 @@ -/** - * fn_load_CMS.sqf - * @Descr: N/A - * @Author: Glowbal +/* + * Author: Glowbal + * Action for loading an unconscious or dead unit in the nearest vechile * - * @Arguments: [] - * @Return: - * @PublicAPI: false + * Arguments: + * 0: The medic + * 1: The patient + * + * Return Value: + * NONE + * + * Public: No */ + #include "script_component.hpp" -private ["_caller", "_unit","_vehicle", "_loaded"]; +private ["_caller", "_target","_vehicle", "_loaded"]; _caller = _this select 0; -_unit = _this select 1; +_target = _this select 1; -if ([_unit] call cse_fnc_isAwake) exitwith { - hintSilent "This person is awake and cannot be loaded"; +if ([_target] call EFUNC(common,isAwake)) exitwith { + // TODO localization + ["displayTextStructured", [_caller], [["This person (%1) is awake and cannot be loaded", [_target] call EFUNC(common,getName)], 1.5, _caller]] call EFUNC(common,targetEvent); }; -[_caller,objNull] call cse_fnc_carryObj; -[_unit,objNull] call cse_fnc_carryObj; +[_caller, objNull] call cse_fnc_carryObj; +[_target, objNull] call cse_fnc_carryObj; -_vehicle = [_caller, _unit] call EFUNC(common,loadPerson_F); +_vehicle = [_caller, _target] call EFUNC(common,loadPerson); if (!isNull _vehicle) then { if (!isnil QGVAR(DROP_ADDACTION)) then { _caller removeAction GVAR(DROP_ADDACTION); GVAR(DROP_ADDACTION) = nil; }; -}; \ No newline at end of file +}; diff --git a/addons/medical/functions/fnc_actionPlaceInBodyBag.sqf b/addons/medical/functions/fnc_actionPlaceInBodyBag.sqf index 8df95c24d9..9cd3bf1bed 100644 --- a/addons/medical/functions/fnc_actionPlaceInBodyBag.sqf +++ b/addons/medical/functions/fnc_actionPlaceInBodyBag.sqf @@ -1,18 +1,22 @@ -/** - * fn_placeInBodyBag.sqf - * @Descr: - * @Author: Glowbal +/* + * Author: Glowbal + * Replace a dead body by a bodybag * - * @Arguments: [] - * @Return: - * @PublicAPI: true + * Arguments: + * 0: The patient + * 1: The new item classname + * + * Return Value: + * nil + * + * Public: Yes */ #include "script_component.hpp" -private ["_unit","_caller"]; -_unit = _this select 0; -_caller = _this select 1; +private ["_target","_caller", "_nameOfUnit", "_onPosition", "_bodyBagCreated"]; +_caller = _this select 0; +_target = _this select 1; if !([_caller, "ACE_itemBodyBag"] call EFUNC(common,hasItem)) exitwith {}; @@ -21,23 +25,15 @@ if !([_caller, "ACE_itemBodyBag"] call EFUNC(common,hasItem)) exitwith {}; _nameOfUnit = [_unit] call EFUNC(common,getName); if (alive _unit) then { // force kill the unit. - [_unit, true] call EFUNC(common,setDead); + [_unit, true] call FUNC(setDead); }; _onPosition = getPos _unit; -_allVariables = [_unit] call EFUNC(common,getAllDefinedSetVariables); deleteVehicle _unit; - _bodyBagCreated = createVehicle ["ACE_bodyBag", _onPosition, [], 0, "NONE"]; -_bodyBagCreated setvariable [QEGVAR(common,nameOfBody), _nameOfUnit, true]; - -{ -// [_bodyBagCreated,_x select 0, _x select 2] call EFUNC(common,setDefinedVariable); -}foreach _allVariables; // reset the position to ensure it is on the correct one. _bodyBagCreated setPos _onPosition; -[[_bodyBagCreated], QEFUNC(common,revealObject_f), true] call BIS_fnc_MP; +// TODO Does this need to be something with QUOTE(DEFUNC)? +[[_bodyBagCreated], QEFUNC(common,revealObject), true] call call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ -_bodyBagCreated setvariable [QEGVAR(logistics,enableDrag), true, true]; - -_bodyBagCreated; \ No newline at end of file +_bodyBagCreated; diff --git a/addons/medical/functions/fnc_actionRemoveTourniquet.sqf b/addons/medical/functions/fnc_actionRemoveTourniquet.sqf index 30363453e2..75d7b67daa 100644 --- a/addons/medical/functions/fnc_actionRemoveTourniquet.sqf +++ b/addons/medical/functions/fnc_actionRemoveTourniquet.sqf @@ -1,62 +1,41 @@ -/** - * fn_removeTourniquet.sqf - * @Descr: N/A - * @Author: Glowbal +/* + * Author: Glowbal + * Action for removing the tourniquet on specified selection * - * @Arguments: [] - * @Return: - * @PublicAPI: false + * Arguments: + * 0: The medic + * 1: The patient + * 2: SelectionName + * + * Return Value: + * NONE + * + * Public: Yes */ #include "script_component.hpp" -private ["_caller","_target","_part","_selectionName","_removeItem","_tourniquets"]; +private ["_caller","_target","_part","_selectionName","_removeItem","_tourniquets", "_output"]; _caller = _this select 0; _target = _this select 1; _selectionName = _this select 2; -[_caller,"You attempt to remove a tourniquet"] call EFUNC(common,sendHintTo); -if ([_caller] call FUNC(isSetTreatmentMutex)) exitwith {["MUTEX HAS BEEN SET - EXITING"] call EFUNC(common,debug);}; -[_caller,true] call FUNC(treatmentMutex); - -_part = [_selectionName] call FUNC(getBodyPartNumber); -_tourniquets = [_target,QGVAR(tourniquets)] call EFUNC(common,getDefinedVariable); +// grab the required data +_part = [_selectionName] call FUNC(selectionNameToNumber); +_tourniquets = _target getvariable [QGVAR(tourniquets), [0,0,0,0,0,0]]; +// Check if there is a tourniquet on this bodypart if ((_tourniquets select _part) == 0) exitwith { - [_caller, false] call FUNC(treatmentMutex); - [_caller,"There is no tourniquet on this body part!"] call EFUNC(common,sendHintTo); + // TODO localization + _output = "There is no tourniquet on this body part!"; + ["displayTextStructured", [_caller], [_output, 1.5, _caller]] call EFUNC(common,targetEvent); }; -if (vehicle _caller == _caller && (vehicle _target == _target)) then { - [_caller,"AinvPknlMstpSlayWrflDnon_medic", 1] call EFUNC(common,doAnimation); -}; - -_caller setvariable [QGVAR(StartingPositionHandleTreatment), getPos _caller]; -[2.5, - {((vehicle (_this select 0) != (_this select 0)) ||((getPos (_this select 0)) distance ((_this select 0) getvariable QGVAR(StartingPositionHandleTreatment)) < 1))}, // the condition - { - private ["_caller","_target", "_selectionName", "_part","_tourniquets"]; - _caller = _this select 0; - _target = _this select 1; - _selectionName = _this select 2; - - _part = [_selectionName] call FUNC(getBodyPartNumber); - _tourniquets = [_target,QGVAR(tourniquets)] call EFUNC(common,getDefinedVariable); - _tourniquets set[_part,0]; - [_target,QGVAR(tourniquets),_tourniquets] call EFUNC(common,setDefinedVariable); - - _caller addItem "ACE_tourniquet"; - [_caller,false] call FUNC(treatmentMutex); - - [_target,"treatment",format["%1 removed a tourniquet on %2",[_caller] call EFUNC(common,getName),_selectionName]] call FUNC(addActivityToLog); - - [_caller,false] call FUNC(treatmentMutex); - }, // on success - { - [(_this select 0), "STR_ACE_CANCELED", ["STR_ACE_ACTION_CANCELED","STR_ACE_YOU_MOVED_AWAY"]] call EFUNC(gui,sendDisplayInformationTo); - [(_this select 0),false] call FUNC(treatmentMutex); - }, // on failure - [_caller, _target, _selectionName] // arguments -] call EFUNC(gui,loadingBar); +// Removing the tourniquet +_tourniquets set[_part, 0]; +_target setvariable [QGVAR(tourniquets), _tourniquets, true]; +// Adding the tourniquet item to the caller +_caller addItem "ACE_tourniquet"; +// "AinvPknlMstpSlayWrflDnon_medic diff --git a/addons/medical/functions/fnc_actionUnloadUnit.sqf b/addons/medical/functions/fnc_actionUnloadUnit.sqf index 6eefb4b138..92c06e176a 100644 --- a/addons/medical/functions/fnc_actionUnloadUnit.sqf +++ b/addons/medical/functions/fnc_actionUnloadUnit.sqf @@ -1,28 +1,33 @@ -/** - * fn_unload_CMS.sqf - * @Descr: N/A - * @Author: Glowbal +/* + * Author: Glowbal + * Action for unloading an unconscious or dead unit from a vechile * - * @Arguments: [] - * @Return: - * @PublicAPI: false + * Arguments: + * 0: The medic + * 1: The patient + * 2: Drag after unload + * + * Return Value: + * NONE + * + * Public: No */ #include "script_component.hpp" -private ["_caller", "_unit","_vehicle", "_drag", "_handle"]; -_caller = [_this, 0, ObjNull,[ObjNull]] call BIS_fnc_Param; -_unit = [_this, 1, ObjNull,[ObjNull]] call BIS_fnc_Param; -_drag = [_this, 2, false, [false]] call BIS_fnc_Param; +private ["_caller", "_target","_vehicle", "_drag", "_handle"]; +_caller = _this select 0; +_target = _this select 1; +_drag = if (count _this > 2) then {_this select 2} else {false}; // cannot unload a unit not in a vehicle. -if (vehicle _unit == _unit) exitwith {}; -if (([_unit] call cse_fnc_isAwake)) exitwith {}; +if (vehicle _target == _target) exitwith {}; +if (([_target] call cse_fnc_isAwake)) exitwith {}; -if ([_caller, _unit] call EFUNC(common,unloadPerson_F)) then { +if ([_caller, _target] call EFUNC(common,unloadPerson)) then { if (_drag) then { if ((vehicle _caller) == _caller) then { - [[_caller,_unit], QUOTE(FUNC(actionDragUnit)), _caller, false] call BIS_fnc_MP; + [[_caller, _target], QUOTE(DFUNC(actionDragUnit)), _caller, false] call BIS_fnc_MP; }; }; -}; \ No newline at end of file +}; diff --git a/addons/medical/functions/fnc_addActivityToLog.sqf b/addons/medical/functions/fnc_addActivityToLog.sqf deleted file mode 100644 index c5fd4b1976..0000000000 --- a/addons/medical/functions/fnc_addActivityToLog.sqf +++ /dev/null @@ -1,46 +0,0 @@ -/** - * fn_addActivityToLog.sqf - * @Descr: adds an item to the activity log - * @Author: Glowbal - * - * @Arguments: [unit OBJECT, type STRING, message STRING] - * @Return: - * @PublicAPI: false - */ - -#include "script_component.hpp" - -private ["_unit","_caller","_type","_activity","_log"]; - -_unit = _this select 0; -_type = _this select 1; -_message = _this select 2; - -if (!local _unit) exitwith { - [_this, QUOTE(FUNC(addActivityToLog)), _unit] call EFUNC(common,execRemoteFnc); -}; -_lastNumber = date select 4; -_moment = format["%1:%2",date select 3, _lastNumber]; -if (_lastNumber < 10) then { - _moment = format["%1:0%2",date select 3, _lastNumber]; -}; - - -_log = [_unit, QGVAR(activityLog)] call EFUNC(common,getDefinedVariable); -if (count _log >= 8) then { - _newLog = []; - _counter = 0; - { - // ensure the first element will not be added - if (_counter > 0) then { - _newLog pushback _x; - } else { - _counter = _counter + 1; - }; - }foreach _log; - _log = _newLog; -}; -_log pushback [_message,_moment,_type]; - -[_unit, QGVAR(activityLog),_log] call EFUNC(common,setDefinedVariable); -["Medical_OnActivityLogChanged", [_unit, _type, _message]] call ace_common_fnc_localEvent; diff --git a/addons/medical/functions/fnc_addHeartRateAdjustment.sqf b/addons/medical/functions/fnc_addHeartRateAdjustment.sqf index 798ec18b0e..dbe0271e99 100644 --- a/addons/medical/functions/fnc_addHeartRateAdjustment.sqf +++ b/addons/medical/functions/fnc_addHeartRateAdjustment.sqf @@ -1,11 +1,17 @@ -/** - * fn_addHeartRateAdjustment.sqf - * @Descr: Increase the Heart Rate of a local unit by given number within given amount of seconds. - * @Author: Glowbal +/* + * Author: Glowbal, KoffeinFlummi + * Increase the Heart Rate of a local unit by given number within given amount of seconds. * - * @Arguments: [unit OBJECT, value NUMBER, time NUMBER (Amount of seconds), callBack CODE (Called when adjustment is completed)] - * @Return: void - * @PublicAPI: true + * Arguments: + * 0: The unit + * 1: value + * 2: time in seconds + * 3: callback + * + * Return Value: + * nil + * + * Public: Yes */ #include "script_component.hpp" @@ -16,7 +22,7 @@ _value = [_this, 1, 0, [0]] call BIS_fnc_Param; _time = [_this, 2, 1, [0]] call BIS_fnc_Param; _callBack = [_this, 3, {}, [{}]] call BIS_fnc_Param; -_adjustment = [_unit, QGVAR(heartRateAdjustments)] call EFUNC(common,getDefinedVariable); +_adjustment = _unit getvariable [QGVAR(heartRateAdjustments), []]; _adjustment pushback [_value, _time, _callBack]; _unit setvariable [QGVAR(heartRateAdjustments), _adjustment ]; -["Medical_onHeartRateAdjustmentAdded", [_unit, _value, _time]] call ace_common_fnc_localEvent; \ No newline at end of file +["Medical_onHeartRateAdjustmentAdded", [_unit, _value, _time]] call ace_common_fnc_localEvent; diff --git a/addons/medical/functions/fnc_addOpenWounds.sqf b/addons/medical/functions/fnc_addOpenWounds.sqf deleted file mode 100644 index 1a87e409f9..0000000000 --- a/addons/medical/functions/fnc_addOpenWounds.sqf +++ /dev/null @@ -1,47 +0,0 @@ -/** - * fn_addOpenWounds.sqf - * @Descr: Add open wounds to unit. - * @Author: Glowbal - * - * @Arguments: [unit OBJECT (The object that will recieve the wound), bodyPart STRING, type STRING (Small, medium or large), amount NUMBER (The amount of open wounds added)] - * @Return: void - * @PublicAPI: true - */ - -#include "script_component.hpp" - -private ["_unit", "_bodyPart", "_type", "_openWounds", "_selection", "_amount", "_newAmount", "_global"]; -_unit = _this select 0; -_bodyPart = _this select 1; -_type = _this select 2; -_amount = _this select 3; -_global = if (count _this > 4) then {_this select 4} else {true}; - -if (typeName _bodyPart == "STRING") then { - _bodyPart = [_bodyPart] call FUNC(getBodyPartNumber); -}; -if (typeName _type == "STRING") then { - _type = switch (toLower _type) do { - case "small": {0}; - case "medium": {1}; - case "large": {2}; - default {-1}; - }; -}; - -if (_type < 0) exitwith { - [format["Adding an injury with an invalid type: %1",_this], 0] call EFUNC(common,debug); -}; - -_openWounds = [_unit,QGVAR(openWounds)] call EFUNC(common,getDefinedVariable); -_selection = _openWounds select _bodyPart; -_newAmount = (_selection select _type) + _amount; -if (_newAmount < 0) then { - _newAmount = 0; -}; -_selection set [ _type, _newAmount]; -_openWounds set [ _bodyPart , _selection]; -[_unit, QGVAR(openWounds),_openWounds, _global] call EFUNC(common,setDefinedVariable); - -[_unit] call FUNC(addToInjuredCollection); -["Medical_onOpenWoundsAdded", [_unit, _bodyPart, _type, _amount]] call ace_common_fnc_localEvent; \ No newline at end of file diff --git a/addons/medical/functions/fnc_addToInjuredCollection.sqf b/addons/medical/functions/fnc_addToInjuredCollection.sqf index f82e0fd5e4..972ad13ccd 100644 --- a/addons/medical/functions/fnc_addToInjuredCollection.sqf +++ b/addons/medical/functions/fnc_addToInjuredCollection.sqf @@ -1,11 +1,14 @@ -/** - * fnc_addToInjuredCollection.sqf - * @Descr: N/A - * @Author: Glowbal +/* + * Author: Glowbal + * Enabled the vitals loop for a unit. * - * @Arguments: [] - * @Return: - * @PublicAPI: false + * Arguments: + * 0: The Unit + * + * ReturnValue: + * + * + * Public: Yes */ #include "script_component.hpp" @@ -13,7 +16,7 @@ private "_unit"; _unit = _this select 0; if !(local _unit) exitwith{ - [[_unit], QUOTE(FUNC(addToInjuredCollection)), _unit] call EFUNC(common,execRemoteFnc); + [[_unit], QUOTE(DFUNC(addToInjuredCollection)), _unit] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ }; if !(_unit getvariable[QGVAR(addedToUnitLoop),false]) then{ @@ -21,9 +24,27 @@ if !(_unit getvariable[QGVAR(addedToUnitLoop),false]) then{ }; if ([_unit] call FUNC(hasMedicalEnabled)) then { - if (isnil QGVAR(injuredUnitCollection)) then { - GVAR(injuredUnitCollection) = []; + [{ + private "_unit"; + _unit = (_this select 0) select 0; + if (!alive _unit || !local _unit) then { + [_this select 1] call CBA_fnc_removePerFrameHandler; + } else { + [_unit] call FUNC(handleUnitVitals); + + private "_pain"; + _pain = _unit getvariable [QGVAR(pain), 0]; + if (_pain > 45) then { + if (random(1) > 0.6) then { + [_unit] call FUNC(setUnconscious); + }; + [_unit] call FUNC(playInjuredSound); + }; + }; + }, 1, [_unit]] call CBA_fnc_addPerFrameHandler; + + if (isNil QGVAR(InjuredCollection)) then { + GVAR(InjuredCollection) = []; }; - if (_unit in GVAR(injuredUnitCollection)) exitwith {}; - GVAR(injuredUnitCollection) pushback _unit; + GVAR(InjuredCollection) pushback _unit; }; diff --git a/addons/medical/functions/fnc_addToLog.sqf b/addons/medical/functions/fnc_addToLog.sqf new file mode 100644 index 0000000000..c36d57b482 --- /dev/null +++ b/addons/medical/functions/fnc_addToLog.sqf @@ -0,0 +1,56 @@ +/* + * Author: Glowbal + * Add an entry to the specified log + * + * Arguments: + * 0: The patient + * 1: The log type + * 2: The message + * 3: The arguments for localization + * + * Return Value: + * nil + * + * Public: Yes + */ + +#include "script_component.hpp" + +private ["_unit", "_type", "_message", "_arguments", "_lastNumber", "_moment", "_logVarName", "_log","_newLog"]; +_unit = _this select 0; +_type = _this select 1; +_message = _this select 2; +_arguments = _this select 3; + +if (!local _unit) exitwith { + [_this, QUOTE(DFUNC(addToLog)), _unit] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ +}; + +_lastNumber = date select 4; +_moment = format["%1:%2",date select 3, _lastNumber]; +if (_lastNumber < 10) then { + _moment = format["%1:0%2",date select 3, _lastNumber]; +}; +_logVarName = format[QGVAR(logFile_%1), _type]; + +_log = _unit getvariable [_logVarName, []]; +if (count _log >= 8) then { + _newLog = []; + { + // ensure the first element will not be added + if (_foreachIndex > 0) then { + _newLog pushback _x; + }; + }foreach _log; + _log = _newLog; +}; +_log pushback [_message,_moment,_type, _arguments]; + +_unit setvariable [_logVarName, _log, true]; +["medical_onLogEntryAdded", [_unit, _type, _message, _arguments]] call ace_common_fnc_localEvent; + +_logs = _unit getvariable [QGVAR(allLogs), []]; +if !(_logVarName in _logs) then { + _logs pushback _logVarName; + _unit setvariable [QGVAR(allLogs), _logs, true]; +}; diff --git a/addons/medical/functions/fnc_addToQuickViewLog.sqf b/addons/medical/functions/fnc_addToQuickViewLog.sqf deleted file mode 100644 index ddac44c3b2..0000000000 --- a/addons/medical/functions/fnc_addToQuickViewLog.sqf +++ /dev/null @@ -1,45 +0,0 @@ -/** - * fn_addToQuickViewLog.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - -#include "script_component.hpp" - -private ["_unit","_type","_activity","_log", "_lastNumber", "_message"]; - -_unit = _this select 0; -_type = _this select 1; -_message = _this select 2; - -if (!local _unit) exitwith { - [_this, QUOTE(FUNC(addToQuickViewLog)), _unit] call EFUNC(common,execRemoteFnc); -}; - -_lastNumber = date select 4; -_moment = format["%1:%2",date select 3, _lastNumber]; -if (_lastNumber < 10) then { - _moment = format["%1:0%2",date select 3, _lastNumber]; -}; - -_log = [_unit,QGVAR(quickViewLog)] call EFUNC(common,getDefinedVariable); -if (count _log >= 8) then { - _newLog = []; - _counter = 0; - { - if (_counter > 0) then { - _newLog pushback _x; - } else { - _counter = _counter + 1; - }; - }foreach _log; - _log = _newLog; -}; -_log pushback [_message,_moment,_type]; - -[_unit,QGVAR(quickViewLog),_log] call EFUNC(common,setDefinedVariable); -["Medical_onQuickViewLogChanged", [_unit, _type, _message]] call ace_common_fnc_localEvent; \ No newline at end of file diff --git a/addons/medical/functions/fnc_addToTriageList.sqf b/addons/medical/functions/fnc_addToTriageCard.sqf similarity index 54% rename from addons/medical/functions/fnc_addToTriageList.sqf rename to addons/medical/functions/fnc_addToTriageCard.sqf index ec6fbc7d60..49e642cfc4 100644 --- a/addons/medical/functions/fnc_addToTriageList.sqf +++ b/addons/medical/functions/fnc_addToTriageCard.sqf @@ -1,11 +1,15 @@ -/** - * fn_addToTriageList.sqf - * @Descr: N/A - * @Author: Glowbal +/* + * Author: Glowbal + * Add an entry to the triage card * - * @Arguments: [] - * @Return: - * @PublicAPI: false + * Arguments: + * 0: The patient + * 1: The new item classname + * + * Return Value: + * nil + * + * Public: Yes */ #include "script_component.hpp" @@ -15,10 +19,10 @@ _unit = _this select 0; _newItem = _this select 1; if (!local _unit) exitwith { - [_this, QUOTE(FUNC(addToTriageList)), _unit] call EFUNC(common,execRemoteFnc); + [_this, QUOTE(DFUNC(addToTriageList)), _unit] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ }; -_log = [_unit,QGVAR(triageCard)] call EFUNC(common,getDefinedVariable); +_log = _unit getvariable [QGVAR(triageCard), []]; _inList = false; _amount = 1; { @@ -26,6 +30,7 @@ _amount = 1; private "_info"; _info = _log select _foreachIndex; _info set [1,(_info select 1) + 1]; + _info set [2, time]; _log set [_foreachIndex, _info]; _amount = (_info select 1); @@ -34,8 +39,7 @@ _amount = 1; }foreach _log; if (!_inList) then { - _log pushback [_newItem,1]; + _log pushback [_newItem, 1, time]; }; - -[_unit,QGVAR(triageCard),_log] call EFUNC(common,setDefinedVariable); -["Medical_onItemAddedToTriageCard", [_unit, _newItem, _amount]] call ace_common_fnc_localEvent; \ No newline at end of file +_unit setvariable [QGVAR(triageCard), _log, true]; +["Medical_onItemAddedToTriageCard", [_unit, _newItem, _amount]] call ace_common_fnc_localEvent; diff --git a/addons/medical/functions/fnc_addTreatmentOption.sqf b/addons/medical/functions/fnc_addTreatmentOption.sqf deleted file mode 100644 index 12d5cb1da1..0000000000 --- a/addons/medical/functions/fnc_addTreatmentOption.sqf +++ /dev/null @@ -1,31 +0,0 @@ -/** - * fnc_addTreatmentOption.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - -#include "script_component.hpp" - -private ["_displayName","_tooltip","_condition","_code", "_category","_options"]; -_displayName = _this select 0; -_tooltip = _this select 1; -_condition = _this select 2; -_code = _this select 3; -_category = _this select 4; - -if (isLocalized _displayName) then { - _displayName = localize _displayName; -}; - -if (isLocalized _tooltip) then { - _tooltip = localize _tooltip; -}; - -_options = missionNamespace getvariable [QGVAR(registeredTreatmentOptions_)+_category, []]; -_options pushback [_displayName, _tooltip, _condition, _code]; - -missionNamespace setvariable [QGVAR(registeredTreatmentOptions_)+_category, _options]; diff --git a/addons/medical/functions/fnc_addUnconsciousCondition.sqf b/addons/medical/functions/fnc_addUnconsciousCondition.sqf new file mode 100644 index 0000000000..579a55ca1f --- /dev/null +++ b/addons/medical/functions/fnc_addUnconsciousCondition.sqf @@ -0,0 +1,25 @@ +/* + * Author: Glowbal + * Adds new condition for the unconscious state. Conditions are not actively checked for units unless unit is in unconscious state. + * + * Arguments: + * 0: Code, should return a boolean + * + * ReturnValue: + * + * + * Public: Yes + */ + +#include "script_component.hpp" + +if (isnil QGVAR(unconsciousConditions)) then { + GVAR(unconsciousConditions) = []; +}; +if (typeName _this == typeName []) then { + { + if (typeName _x == typeName {}) then { + GVAR(unconsciousConditions) pushback _x; + }; + }foreach _this; +}; diff --git a/addons/medical/functions/fnc_canAccessMedicalEquipment.sqf b/addons/medical/functions/fnc_canAccessMedicalEquipment.sqf index d0522a79dd..4b1940b7e3 100644 --- a/addons/medical/functions/fnc_canAccessMedicalEquipment.sqf +++ b/addons/medical/functions/fnc_canAccessMedicalEquipment.sqf @@ -1,18 +1,22 @@ -/** - * fn_canAccessMedicalEquipment.sqf - * @Descr: Check if caller can access targets medical equipment, based upon accessLevel - * @Author: Glowbal +/* + * Author: Glowbal + * Check if caller can access targets medical equipment, based upon accessLevel. * - * @Arguments: [target OBJECT, caller OBJECT] - * @Return: BOOL - * @PublicAPI: true + * Arguments: + * 0: The caller + * 1: The target + * + * ReturnValue: + * Can Treat + * + * Public: Yes */ #include "script_component.hpp" private ["_target", "_caller", "_accessLevel", "_return"]; -_target = _this select 0; -_caller = _this select 1; +_caller = _this select 0; +_target = _this select 1; _accessLevel = _target getvariable [QGVAR(allowSharedEquipmentAccess), -1]; diff --git a/addons/medical/functions/fnc_canGoUnconsciousState.sqf b/addons/medical/functions/fnc_canGoUnconsciousState.sqf deleted file mode 100644 index 6eaf983e31..0000000000 --- a/addons/medical/functions/fnc_canGoUnconsciousState.sqf +++ /dev/null @@ -1,17 +0,0 @@ -/** - * fn_canGoUnconsciousState.sqf - * @Descr: Checks if an object can move into unconscious state - * @Author: Glowbal - * - * @Arguments: [unit OBJECT] - * @Return: BOOL true if object can move into unconscious state - * @PublicAPI: true - */ - - -#include "script_component.hpp" - -private ["_unit"]; -_unit = _this select 0; - -(!(isNull _unit) && {(_unit isKindOf "CaManBase") && ([_unit] call EFUNC(common,isAwake))}) \ No newline at end of file diff --git a/addons/medical/functions/fnc_canPutInBodyBag.sqf b/addons/medical/functions/fnc_canPutInBodyBag.sqf deleted file mode 100644 index 07626c0d21..0000000000 --- a/addons/medical/functions/fnc_canPutInBodyBag.sqf +++ /dev/null @@ -1,17 +0,0 @@ -/** - * fn_canPutInBodyBag.sqf - * @Descr: - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: true - */ - -#include "script_component.hpp" - -private ["_unit","_caller"]; -_caller = _this select 0; -_target = _this select 1; - -([_caller, "ACE_itemBodyBag"] call EFUNC(common,hasItem) && {(!(alive _target) || (_target getvariable [QEGVAR(common,isDead),false]) || (_target getvariable ["ACE_inReviveState", false]))} && {(_target distance _caller) < 7.5} && (vehicle _target == _unit)); // return \ No newline at end of file diff --git a/addons/medical/functions/fnc_canTreat.sqf b/addons/medical/functions/fnc_canTreat.sqf new file mode 100644 index 0000000000..2260a2750b --- /dev/null +++ b/addons/medical/functions/fnc_canTreat.sqf @@ -0,0 +1,48 @@ +/* + * Author: Glowbal + * Check if the treatment action can be performed. + * + * Arguments: + * 0: The caller + * 1: The target + * 2: Selection name + * 3: ACE_Medical_Treatments Classname + * + * ReturnValue: + * Can Treat + * + * Public: Yes + */ + +#include "script_component.hpp" + +private ["_caller", "_target", "_selectionName", "_className", "_config", "_availableLevels", "_medicRequired", "_items", "_locations", "_return"]; +_caller = _this select 0; +_target = _this select 1; +_selectionName = _this select 2; +_className = _this select 3; + +_config = (ConfigFile >> "ACE_Medical_Treatments" >> "Basic" >> _className); +if (GVAR(level)>=1) then { + _config = (ConfigFile >> "ACE_Medical_Treatments" >> "Advanced" >> _className); +}; +if !(isClass _config) exitwith {false}; + +_medicRequired = getNumber (_config >> "requiredMedic"); +if !([_caller, _medicRequired] call FUNC(isMedic) || [_target, _medicRequired] call FUNC(isMedic)) exitwith {false}; + +_items = getArray (_config >> "items"); +if (count _items > 0 && {!([_caller, _target, _items] call FUNC(hasItems))}) exitwith {false}; + +_locations = getArray (_config >> "treatmentLocations"); + +if ("All" in _locations) exitwith {true}; + +_return = false; +{ + if (_x == "field") exitwith {_return = true;}; + if (_x == "MedicalFacility" && {[_caller, _target] call FUNC(inMedicalFacility)}) exitwith {_return = true;}; + if (_x == "MedicalVehicle" && {[_caller, _target] call FUNC(inMedicalVehicle)}) exitwith {_return = true;}; +}foreach _locations; + +_return; diff --git a/addons/medical/functions/fnc_checkDamage.sqf b/addons/medical/functions/fnc_checkDamage.sqf deleted file mode 100644 index 67495c25de..0000000000 --- a/addons/medical/functions/fnc_checkDamage.sqf +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Author: KoffeinFlummi - * - * Checks the unit for leg and arm damage, and removes orphan structural damage. - * - * Arguments: - + 0: Unit - * 1: Leg Damage - * 2: Arm Damage - * 3: Remove orphan damage? (Bool; optional, default No) - * - * Return Value: - * None - */ - -#define LEGDAMAGETRESHOLD1 1 -#define LEGDAMAGETRESHOLD2 1.7 -#define ARMDAMAGETRESHOLD1 1 -#define ARMDAMAGETRESHOLD2 1.7 - -private ["_unit", "_legdamage", "_armdamage", "_damagesum"]; - -_unit = _this select 0; -_legdamage = _this select 1; -_armdamage = _this select 2; - -// Leg Damage -// lightly wounded, only limit walking speed (forceWalk is for suckers) -if (_legdamage >= LEGDAMAGETRESHOLD1) then { - if (_unit getHitPointDamage "HitLegs" != 1) then {_unit setHitPointDamage ["HitLegs", 1]}; -} else { - if (_unit getHitPointDamage "HitLegs" != 0) then {_unit setHitPointDamage ["HitLegs", 0]}; -}; -// @ŧodo: force prone for completely fucked up legs. - -// Arm Damage -// fx only -if (_armdamage >= ARMDAMAGETRESHOLD1) then { - if (_unit getHitPointDamage "HitHands" != 1) then {_unit setHitPointDamage ["HitHands", 1]}; -} else { - if (_unit getHitPointDamage "HitHands" != 0) then {_unit setHitPointDamage ["HitHands", 0]}; -}; - -// remove leftover structural damage if unit is already fully healed -if (count _this > 3 and _this select 3) then { - _damagesum = (_unit getHitPointDamage "HitHead") + - (_unit getHitPointDamage "HitBody") + - (_unit getHitPointDamage "HitLeftArm") + - (_unit getHitPointDamage "HitRightArm") + - (_unit getHitPointDamage "HitLeftLeg") + - (_unit getHitPointDamage "HitRightLeg"); - if (_damagesum <= 0.06) then { - _unit setDamage 0; - }; -}; diff --git a/addons/medical/functions/fnc_cleanUpCopyOfBody_f.sqf b/addons/medical/functions/fnc_cleanUpCopyOfBody_f.sqf deleted file mode 100644 index b20169e9f5..0000000000 --- a/addons/medical/functions/fnc_cleanUpCopyOfBody_f.sqf +++ /dev/null @@ -1,26 +0,0 @@ -/** - * fn_cleanUpCopyOfBody_f.sqf - * @Descr: Called from a custom eventhandler to ensure that any copies of bodies are cleaned up. - * @Author: Glowbal - * - * @Arguments: [unit OBJECT] - * @Return: BOOL - * @PublicAPI: true - */ - -#include "script_component.hpp" - -private ["_unit", "_copy"]; -_unit = _this select 0; - -_copy = _unit getvariable QGVAR(copyOfBody_f); -if (isnil "_copy") exitwith {false}; -[format["Cleaning up a copy of Body: %1 %2", _unit, _copy]] call EFUNC(common,debug); -// lets clean it up -_unit setvariable [QGVAR(originalCopy_f), nil, true]; -_unit setvariable [QGVAR(copyOfBody_f), nil, true]; -if (!isNull _copy) then { - deleteVehicle _copy; -}; - -true; \ No newline at end of file diff --git a/addons/medical/functions/fnc_determineIfFatal.sqf b/addons/medical/functions/fnc_determineIfFatal.sqf index b14822efeb..978aa16b2b 100644 --- a/addons/medical/functions/fnc_determineIfFatal.sqf +++ b/addons/medical/functions/fnc_determineIfFatal.sqf @@ -10,23 +10,24 @@ #include "script_component.hpp" -private ["_unit","_part","_damageThreshold"]; +private ["_unit","_part","_damageThreshold", "_withDamage"]; _unit = _this select 0; _part = _this select 1; +_withDamage = if (count _this > 2) then { _this select 2} else {0}; if (!alive _unit) exitwith {true}; - +if (_part < 0 || _part > 5) exitwith {}; if ((vehicle _unit != _unit) && {!alive (vehicle _unit)}) exitwith { true }; // Find the correct Damage threshold for unit. _damageThreshold = [1,1,1]; if (isPlayer _unit) then { - _damageThreshold =_unit getvariable[QGVAR(unitDamageThreshold), [GVAR(damageThreshold_Players), GVAR(damageThreshold_Players), GVAR(damageThreshold_Players) * 1.7]]; + //_damageThreshold =_unit getvariable[QGVAR(unitDamageThreshold), [GVAR(damageThreshold_Players), GVAR(damageThreshold_Players), GVAR(damageThreshold_Players) * 1.7]]; } else { - _damageThreshold =_unit getvariable[QGVAR(unitDamageThreshold), [GVAR(damageThreshold_AI), GVAR(damageThreshold_AI), GVAR(damageThreshold_AI) * 1.7]]; + //_damageThreshold =_unit getvariable[QGVAR(unitDamageThreshold), [GVAR(damageThreshold_AI), GVAR(damageThreshold_AI), GVAR(damageThreshold_AI) * 1.7]]; }; -_damageBodyPart = ([_unit,QGVAR(bodyPartStatus),[0,0,0,0,0,0]] call EFUNC(common,getDefinedVariable)) select _part; +_damageBodyPart = ((_unit getvariable [QGVAR(bodyPartStatus),[0, 0, 0, 0, 0, 0]]) select _part) + _withDamage; // Check if damage to body part is higher as damage head if (_part == 0) exitwith { diff --git a/addons/medical/functions/fnc_determineIfUnconscious.sqf b/addons/medical/functions/fnc_determineIfUnconscious.sqf deleted file mode 100644 index ebc3af26eb..0000000000 --- a/addons/medical/functions/fnc_determineIfUnconscious.sqf +++ /dev/null @@ -1,40 +0,0 @@ -/** - * fn_determineIfUnconscious.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - -#include "script_component.hpp" - -private ["_unit","_part","_damageThreshold"]; -_unit = _this select 0; -_part = _this select 1; - -if (!alive _unit) exitwith { true }; - -if ((vehicle _unit != _unit) && {!alive (vehicle _unit)}) exitwith { true }; - -// Find the correct Damage threshold for unit. -_damageThreshold = if (isPlayer _unit) then { - missionNamespace getvariable[QGVAR(unitDamageThreshold), [GVAR(damageThreshold_Players), GVAR(damageThreshold_Players), GVAR(damageThreshold_Players)]]; -} else { - missionNamespace getvariable[QGVAR(unitDamageThreshold), [GVAR(damageThreshold_AI), GVAR(damageThreshold_AI), GVAR(damageThreshold_AI)]]; -}; - -_damageBodyPart = ([_unit,QGVAR(bodyPartStatus),[0,0,0,0,0,0]] call EFUNC(common,getDefinedVariable)) select _part; - -// Check if damage to body part is higher as damage head -if (_part == 0) exitwith { - ((_damageBodyPart * GVAR(setting_medicalDifficulty)) >= ((_damageThreshold select 0) * 0.7) && {(random(1) > 0.35)}); -}; - -// Check if damage to body part is higher as damage torso -if (_part == 1) exitwith { - ((_damageBodyPart * GVAR(setting_medicalDifficulty)) >= ((_damageThreshold select 1) * 0.5) && {(random(1) > 0.4)}); -}; -// Check if damage to body part is higher as damage limbs -((_damageBodyPart * GVAR(setting_medicalDifficulty)) >= ((_damageThreshold select 2) * 0.8) && {(random(1) > 0.7)}); \ No newline at end of file diff --git a/addons/medical/functions/fnc_displayPatientInformation.sqf b/addons/medical/functions/fnc_displayPatientInformation.sqf new file mode 100644 index 0000000000..d5154ba105 --- /dev/null +++ b/addons/medical/functions/fnc_displayPatientInformation.sqf @@ -0,0 +1,74 @@ +/* + * Author: Glowbal + * Displays the patient information for given unit. + * + * Arguments: + * 0: The Unit + * 1: Show + * + * ReturnValue: + * nil + * + * Public: No + */ + +#include "script_component.hpp" + +private ["_target", "_show"]; +_target = _this select 0; +_show = if (count _this > 1) then {_this select 1} else {true}; + +GVAR(displayPatientInformationTarget) = if (_show) then {_target} else {ObjNull}; + +if (_show) then { + + ("ACE_MedicalRscDisplayInformation" call BIS_fnc_rscLayer) cutRsc [QGVAR(DisplayInformation),"PLAIN"]; + + [{ + private ["_target", "_display", "_alphaLevel", "_damaged", "_availableSelections", "_openWounds", "_selectionBloodLoss", "_red", "_green", "_blue", "_alphaLevel"]; + _target = (_this select 0) select 0; + if (GVAR(displayPatientInformationTarget) != _target) exitwith { + [_this select 1] call CBA_fnc_removePerFrameHandler; + }; + + disableSerialization; + _display = uiNamespace getvariable QGVAR(DisplayInformation); + if (isnil "_display") exitwith { + [_this select 1] call CBA_fnc_removePerFrameHandler; + }; + + _alphaLevel = 1.0; + _damaged = [false, false, false, false, false, false]; + _availableSelections = [50,51,52,53,54,55]; + _openWounds = _target getvariable [QGVAR(openWounds), []]; + + _selectionBloodLoss = [0,0,0,0,0,0]; + { + _selectionBloodLoss set [(_x select 2), (_selectionBloodLoss select (_x select 2)) + ((_x select 4) * (_x select 3))]; + }foreach _openWounds; + + { + private ["_red", "_green", "_blue"]; + _total = _x; + + _red = 1; + _green = 1; + _blue = 1; + if (_total >0) then { + _green = 0.9 - (15*(_total)); + if (_green < 0.0) then { + _green = 0.0; + }; + _blue = _green; + _damaged set[_foreachIndex, true]; + }; + (_display displayCtrl (_availableSelections select _foreachIndex)) ctrlSetTextColor [_red, _green, _blue, _alphaLevel]; + }foreach _selectionBloodLoss; + + // TODO fill the lb with the appropiate information for the patient + + }, 0, [_target]] call CBA_fnc_addPerFrameHandler; + +} else { + ("ACE_MedicalRscDisplayInformation" call BIS_fnc_rscLayer) cutRsc ["","PLAIN"]; +}; \ No newline at end of file diff --git a/addons/medical/functions/fnc_effectBlackOut.sqf b/addons/medical/functions/fnc_effectBlackOut.sqf deleted file mode 100644 index 1ffa75fff9..0000000000 --- a/addons/medical/functions/fnc_effectBlackOut.sqf +++ /dev/null @@ -1,29 +0,0 @@ -/** - * fn_effectBlackOut.sqf - * @Descr: Displays the blacked out effect for clients. - * @Author: Glowbal - * - * @Arguments: [displayEffect BOOL] - * @Return: void - * @PublicAPI: true - */ - -#include "script_component.hpp" - -private ["_displayEffect","_effect"]; -_displayEffect = [_this, 0, false,[false]] call bis_fnc_param; - -if (!hasInterface) exitwith {}; - -disableSerialization; -_effect = uiNamespace getVariable QGVAR(ScreenEffectsBlack); -if (isNil "_effect") then { - 45 cutRsc [QGVAR(ScreenEffectsBlack),"PLAIN"]; - _effect = uiNamespace getVariable QGVAR(ScreenEffectsBlack); -}; - -if (_displayEffect) then { - (_effect displayCtrl 11112) ctrlSetTextColor [0.0,0.0,0.0,0.9]; -} else { - (_effect displayCtrl 11112) ctrlSetTextColor [0.0,0.0,0.0,0.0]; -}; \ No newline at end of file diff --git a/addons/medical/functions/fnc_effectBleeding.sqf b/addons/medical/functions/fnc_effectBleeding.sqf deleted file mode 100644 index 0882267df1..0000000000 --- a/addons/medical/functions/fnc_effectBleeding.sqf +++ /dev/null @@ -1,36 +0,0 @@ -/** - * fn_effectBleeding.sqf - * @Descr: Displays the ACE Bleeding effect - * @Author: Glowbal - * - * @Arguments: [bloodLoss NUMBER] - * @Return: void - * @PublicAPI: true - */ - -#include "script_component.hpp" - -if (isnil QGVAR(DisplayingBleedingEffect)) then { - GVAR(DisplayingBleedingEffect) = false; -}; -if (GVAR(DisplayingBleedingEffect)) exitwith {}; -private ["_bloodLoss","_time"]; -_bloodLoss = _this select 0; -if (!(_bloodLoss > 0)) exitwith{}; - -_time = 10 - _bloodLoss; -if (_time < 1.5) then { - _time = 1.5; -}; -GVAR(DisplayingBleedingEffect) = true; -47 cutRsc [QGVAR(ScreenEffectsBleeding),"PLAIN"]; - -[{ - if !(isnil QGVAR(DisplayingBleedingEffect_ran)) then { - GVAR(DisplayingBleedingEffect_ran) = nil; - GVAR(DisplayingBleedingEffect) = false; - [(_this select 1)] call cba_fnc_removePerFrameHandler; - } else { - GVAR(DisplayingBleedingEffect_ran) = true; - }; -}, _time, [] ] call CBA_fnc_addPerFrameHandler; diff --git a/addons/medical/functions/fnc_effectPain.sqf b/addons/medical/functions/fnc_effectPain.sqf deleted file mode 100644 index 595d4ea6a0..0000000000 --- a/addons/medical/functions/fnc_effectPain.sqf +++ /dev/null @@ -1,32 +0,0 @@ -/** - * fn_effectPain.sqf - * @Descr: Displays the ACE Pain effect - * @Author: Glowbal - * - * @Arguments: [painRatio NUMBER] - * @Return: void - * @PublicAPI: true - */ - -#include "script_component.hpp" - -if (isnil QGVAR(DisplayingPainEffect)) then { - GVAR(DisplayingPainEffect) = false; -}; - -if (GVAR(DisplayingPainEffect)) exitwith {}; - -private ["_ratio","_time"]; -_ratio = _this select 0; -if (!(_ratio > 0)) exitwith{}; - _time = 6 - _ratio; -if (_time <1.5) then { - _time = 1.5; -}; -GVAR(DisplayingPainEffect) = true; -46 cutRsc [QGVAR(ScreenEffectsPain),"PLAIN"]; - -[{ - GVAR(DisplayingPainEffect) = false; - [(_this select 1)] call cba_fnc_removePerFrameHandler; -}, _time, [] ] call CBA_fnc_addPerFrameHandler; diff --git a/addons/medical/functions/fnc_fromNumberToBodyPart.sqf b/addons/medical/functions/fnc_fromNumberToBodyPart.sqf deleted file mode 100644 index a556ea1211..0000000000 --- a/addons/medical/functions/fnc_fromNumberToBodyPart.sqf +++ /dev/null @@ -1,39 +0,0 @@ -/** - * fn_fromNumberToBodyPart.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - -#include "script_component.hpp" - -private ["_selectionName","_part"]; -_part = _this select 0; -_selectionName = ""; -_selectionName = switch (_part) do { - case 0: { - "head" - }; - case 1: { - "body" - }; - case 2: { - "hand_l" - }; - case 3: { - "hand_r" - }; - case 4: { - "leg_l" - }; - case 5: { - "leg_r" - }; - default { - "" - }; -}; -_selectionName \ No newline at end of file diff --git a/addons/medical/functions/fnc_getActivityLog.sqf b/addons/medical/functions/fnc_getActivityLog.sqf deleted file mode 100644 index 5f5f1ba6de..0000000000 --- a/addons/medical/functions/fnc_getActivityLog.sqf +++ /dev/null @@ -1,23 +0,0 @@ -/** - * fn_getActivityLog.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - -#include "script_component.hpp" - -private["_unit"]; -_unit = _this select 0; -_log = [_unit,QGVAR(activityLog)] call EFUNC(common,getDefinedVariable); - -if (isnil "_log") then { - _log = []; -}; -if (typeName _log != typeName []) then { - _log = []; -}; -_log diff --git a/addons/medical/functions/fnc_getBloodLoss.sqf b/addons/medical/functions/fnc_getBloodLoss.sqf index 929ca2b856..d91ab15d52 100644 --- a/addons/medical/functions/fnc_getBloodLoss.sqf +++ b/addons/medical/functions/fnc_getBloodLoss.sqf @@ -1,36 +1,45 @@ -/** - * fn_getBloodLoss.sqf - * @Descr: Calculate the total blood loss of a unit. - * @Author: Glowbal +/* + * Author: Glowbal + * Calculate the total blood loss of a unit. * - * @Arguments: [unit OBJECT] - * @Return: NUMBER Total blood loss of unit - * @PublicAPI: true + * Arguments: + * 0: The Unit + * + * ReturnValue: + * Total blood loss of unit + * + * Public: No */ #include "script_component.hpp" -#define BLOODLOSS_SMALL_WOUNDS 0.025 -#define BLOODLOSS_MEDIUM_WOUNDS 0.05 -#define BLOODLOSS_LARGE_WOUNDS 0.1 - -/** -* The default cardiac output when all stats are set to normal is 5.25. -*/ -#define DEFAULT_CARDIAC_OUTPUT 5.25 - -private ["_totalBloodLoss","_tourniquets","_openWounds", "_value", "_cardiacOutput"]; - +private ["_totalBloodLoss","_tourniquets","_openWounds", "_value", "_cardiacOutput", "_internalWounds"]; +// TODO Only use this calculation if medium or higher, otherwise use vanilla calculations (for basic medical). _totalBloodLoss = 0; -_tourniquets = [_this, QGVAR(tourniquets)] call EFUNC(common,getDefinedVariable); -_openWounds = [_this, QGVAR(openWounds)] call EFUNC(common,getDefinedVariable); -_cardiacOutput = [_this] call FUNC(getCardiacOutput); -{ - if ((_tourniquets select _foreachIndex) < 1) then { - _totalBloodLoss = _totalBloodLoss + (((BLOODLOSS_SMALL_WOUNDS * (_x select 0))) + ((BLOODLOSS_MEDIUM_WOUNDS * (_x select 1))) + ((BLOODLOSS_LARGE_WOUNDS * (_x select 2))) * (_cardiacOutput / DEFAULT_CARDIAC_OUTPUT)); - }; -}foreach _openWounds; +// Advanced medical bloodloss handling +if (GVAR(level) >= 1) then { + _tourniquets = _this getvariable [QGVAR(tourniquets), [0,0,0,0,0,0]]; + _openWounds = _this getvariable [QGVAR(openWounds), []]; + //_cardiacOutput = [_this] call FUNC(getCardiacOutput); -// cap the blood loss to be no greater as the current cardiac output -(_totalBloodLoss min _cardiacOutput); \ No newline at end of file + { + if ((_tourniquets select (_x select 2)) < 1) then { + // total bleeding ratio * percentage of injury left + _totalBloodLoss = _totalBloodLoss + ((_x select 4) * (_x select 3)); + + // (((BLOODLOSS_SMALL_WOUNDS * (_x select 0))) + ((BLOODLOSS_MEDIUM_WOUNDS * (_x select 1))) + ((BLOODLOSS_LARGE_WOUNDS * (_x select 2))) * (_cardiacOutput / DEFAULT_CARDIAC_OUTPUT)); + }; + }foreach _openWounds; + + _internalWounds = _this getvariable [QGVAR(internalWounds), []]; + { + _totalBloodLoss = _totalBloodLoss + ((_x select 4) * (_x select 3)); + }foreach _internalWounds; + + // cap the blood loss to be no greater as the current cardiac output + //(_totalBloodLoss min _cardiacOutput); +} else { + // TODO basic medical +}; +_totalBloodLoss; diff --git a/addons/medical/functions/fnc_getBloodPressure.sqf b/addons/medical/functions/fnc_getBloodPressure.sqf index 620b8d541d..f5012c8735 100644 --- a/addons/medical/functions/fnc_getBloodPressure.sqf +++ b/addons/medical/functions/fnc_getBloodPressure.sqf @@ -1,11 +1,14 @@ -/** - * fn_getBloodPressure.sqf - * @Descr: Calculate the current blood pressure of a unit. - * @Author: Glowbal +/* + * Author: Glowbal + * Calculates the blood volume change and decreases the IVs given to the unit. * - * @Arguments: [unit OBJECT (The unit to get the blood pressure from.)] - * @Return: ARRAY Blood Pressure. Format [low NUMBER, high NUMBER] - * @PublicAPI: true + * Arguments: + * 0: The Unit + * + * ReturnValue: + * Blood Pressuret ,> + * + * Public: No */ #include "script_component.hpp" @@ -23,9 +26,9 @@ private ["_unit", "_bloodPressureLow", "_bloodPressureHigh", "_cardiacOutput", "_resistance"]; _unit = _this select 0; _cardiacOutput = [_unit] call FUNC(getCardiacOutput); -_resistance = [_unit, QGVAR(peripheralResistance)] call EFUNC(common,getDefinedVariable); +_resistance = _unit getvariable [QGVAR(peripheralResistance), 100]; _bloodPressureHigh = (_cardiacOutput * MODIFIER_BP_HIGH) * _resistance; _bloodPressureLow = (_cardiacOutput * MODIFIER_BP_LOW) * _resistance; -[_bloodPressureLow, _bloodPressureHigh]; \ No newline at end of file +[_bloodPressureLow, _bloodPressureHigh]; diff --git a/addons/medical/functions/fnc_getBloodVolumeChange.sqf b/addons/medical/functions/fnc_getBloodVolumeChange.sqf index 69b240b1d7..92b4408fbf 100644 --- a/addons/medical/functions/fnc_getBloodVolumeChange.sqf +++ b/addons/medical/functions/fnc_getBloodVolumeChange.sqf @@ -1,11 +1,14 @@ -/** - * fn_getBloodVolumeChange.sqf - * @Descr: Calculates the blood volume change and decreases the IVs given to the unit. - * @Author: Glowbal +/* + * Author: Glowbal + * Calculates the blood volume change and decreases the IVs given to the unit. * - * @Arguments: [] - * @Return: NUMBER Bloodvolume change - * @PublicAPI: false + * Arguments: + * 0: The Unit + * + * ReturnValue: + * Current cardiac output + * + * Public: No */ #include "script_component.hpp" @@ -38,11 +41,6 @@ if (_bloodVolume < 100.0) then { _bloodVolumeChange = _bloodVolumeChange + BLOOD_CHANGE_PER_SECOND; _ivVolume = (_unit getvariable [QGVAR(salineIVVolume), 0]) + IV_CHANGE_PER_SECOND; _unit setvariable [QGVAR(salineIVVolume),_ivVolume]; - if ([QEGVAR(fieldRations,module)] call EFUNC(common,isModuleEnabled_F)) then { - if ([_unit] call EFUNC(fieldRations,canDrink)) then { - _unit setvariable [QEGVAR(fieldRations,drinkStatus), (_unit getvariable [QEGVAR(fieldRations,drinkStatus), 100]) + 0.2]; - }; - }; }; if ((_unit getvariable [QGVAR(plasmaIVVolume), 0]) > 0) then { _bloodVolumeChange = _bloodVolumeChange + BLOOD_CHANGE_PER_SECOND; @@ -56,4 +54,4 @@ if (_bloodVolume < 100.0) then { }; }; -_bloodVolumeChange +_bloodVolumeChange; diff --git a/addons/medical/functions/fnc_getBodyPartNumber.sqf b/addons/medical/functions/fnc_getBodyPartNumber.sqf deleted file mode 100644 index 6bfc041c80..0000000000 --- a/addons/medical/functions/fnc_getBodyPartNumber.sqf +++ /dev/null @@ -1,54 +0,0 @@ -/** - * fn_getBodyPartNumber.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - -#include "script_component.hpp" - -private ["_selectionName","_part"]; -_selectionName = _this select 0; - - _part = -1; - _part = switch (_selectionName) do { - case "head": { - 0 - }; - case "body": { - 1 - }; - case "hands": { - if (random(1)>=0.5) then { - 2 - } else { - 3 - }; - }; - case "hand_l": { - 2 - }; - case "hand_r": { - 3 - }; - case "legs": { - if (random(1)>=0.5) then { - 4 - } else { - 5 - }; - }; - case "leg_l": { - 4 - }; - case "leg_r": { - 5 - }; - default { - -1 - }; - }; -_part \ No newline at end of file diff --git a/addons/medical/functions/fnc_getCardiacOutput.sqf b/addons/medical/functions/fnc_getCardiacOutput.sqf index a22bb3d5d9..a44e8a8e29 100644 --- a/addons/medical/functions/fnc_getCardiacOutput.sqf +++ b/addons/medical/functions/fnc_getCardiacOutput.sqf @@ -1,11 +1,14 @@ -/** - * fn_getCardiacOutput.sqf - * @Descr: Get the cardiac output from the Heart, based on current Heart Rate and Blood Volume. - * @Author: Glowbal +/* + * Author: Glowbal + * Get the cardiac output from the Heart, based on current Heart Rate and Blood Volume. * - * @Arguments: [unit OBJECT] - * @Return: NUMBER Current cardiac output. - * @PublicAPI: true + * Arguments: + * 0: The Unit + * + * ReturnValue: + * Current cardiac output + * + * Public: No */ #include "script_component.hpp" @@ -22,4 +25,4 @@ private "_unit"; _unit = _this select 0; -((_unit getvariable [QGVAR(bloodVolume), 100])/MODIFIER_CARDIAC_OUTPUT) + ((_unit getvariable [QGVAR(heartRate), 80])/80-1); \ No newline at end of file +((_unit getvariable [QGVAR(bloodVolume), 100])/MODIFIER_CARDIAC_OUTPUT) + ((_unit getvariable [QGVAR(heartRate), 80])/80-1); diff --git a/addons/medical/functions/fnc_getCurrentSelectedInjuryData.sqf b/addons/medical/functions/fnc_getCurrentSelectedInjuryData.sqf deleted file mode 100644 index 93e2a6c871..0000000000 --- a/addons/medical/functions/fnc_getCurrentSelectedInjuryData.sqf +++ /dev/null @@ -1,19 +0,0 @@ -/** - * fn_getCurrentSelectedInjuryData.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - -#include "script_component.hpp" - -private ["_return", "_current"]; -_return = ""; -if (dialog) then { - _current = lbCurSel 213; - _return = lbData [213,_current]; -}; -_return; \ No newline at end of file diff --git a/addons/medical/functions/fnc_getHeartRateChange.sqf b/addons/medical/functions/fnc_getHeartRateChange.sqf index a3c0c239cd..e7bc9407d2 100644 --- a/addons/medical/functions/fnc_getHeartRateChange.sqf +++ b/addons/medical/functions/fnc_getHeartRateChange.sqf @@ -1,11 +1,14 @@ -/** - * fn_getHeartRateChange.sqf - * @Descr: N/A - * @Author: Glowbal +/* + * Author: Glowbal + * Get the change in the heart rate. Used for the vitals calculations. Calculated in one seconds. * - * @Arguments: [] - * @Return: void - * @PublicAPI: false + * Arguments: + * 0: The Unit + * + * ReturnValue: + * Change in heart Rate + * + * Public: No */ #include "script_component.hpp" @@ -31,7 +34,7 @@ if (!(_unit getvariable [QGVAR(inCardiacArrest),false])) then { _change = (_values / _time); _hrIncrease = _hrIncrease + _change; - if ( (_time - 1) < 0) then { + if ( (_time - 1) <= 0) then { _time = 0; _adjustment set [_foreachIndex, ObjNull]; [_unit] call _callBack; @@ -40,7 +43,8 @@ if (!(_unit getvariable [QGVAR(inCardiacArrest),false])) then { _adjustment set [_foreachIndex, [_values - _change, _time]]; }; } else { - _adjustment set [_foreachIndex, ObjNull]; + _adjustment set [_foreachIndex, ObjNull]; + [_unit] call _callBack; }; }foreach _adjustment; diff --git a/addons/medical/functions/fnc_getNewDamageBodyPart.sqf b/addons/medical/functions/fnc_getNewDamageBodyPart.sqf deleted file mode 100644 index ec1efcab9f..0000000000 --- a/addons/medical/functions/fnc_getNewDamageBodyPart.sqf +++ /dev/null @@ -1,28 +0,0 @@ -/** - * fnc_getNewDamageBodyPart.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - -#include "script_component.hpp" - -private ["_unit","_selectionName","_newDamage", "_previousDamage", "_origDamage", "_number"]; -_unit = _this select 0; -_amountOfDamage = _this select 1; -_number = _this select 2; - -_previousDamage = _unit getvariable [QGVAR(bodyPartStatusPrevious), [0,0,0,0,0,0]]; -_newDamage = _amountOfDamage - (_previousDamage select _number); -_previousDamage set [_number, _newDamage]; -[_unit,QGVAR(bodyPartStatusPrevious),_previousDamage] call EFUNC(common,setDefinedVariable); - - -_origDamage = [_unit,QGVAR(bodyPartStatus),[0,0,0,0,0,0]] call EFUNC(common,getDefinedVariable); -_origDamage set [_number, (_origDamage select _number) + _newDamage]; /* We are storing the total Damage done on a body part for determining the damage properly */ -[_unit,QGVAR(bodyPartStatus),_origDamage] call EFUNC(common,setDefinedVariable); - -_newDamage \ No newline at end of file diff --git a/addons/medical/functions/fnc_getQuickViewLog.sqf b/addons/medical/functions/fnc_getQuickViewLog.sqf deleted file mode 100644 index 356c08391e..0000000000 --- a/addons/medical/functions/fnc_getQuickViewLog.sqf +++ /dev/null @@ -1,22 +0,0 @@ -/** - * fn_getQuickViewLog.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - -#include "script_component.hpp" - -private["_unit"]; -_unit = _this select 0; -_log = [_unit,QGVAR(quickViewLog)] call EFUNC(common,getDefinedVariable); -if (isnil "_log") then { - _log = []; -}; -if (typeName _log != typeName []) then { - _log = []; -}; -_log diff --git a/addons/medical/functions/fnc_getSelectedBodyPart.sqf b/addons/medical/functions/fnc_getSelectedBodyPart.sqf deleted file mode 100644 index 6e018c2aac..0000000000 --- a/addons/medical/functions/fnc_getSelectedBodyPart.sqf +++ /dev/null @@ -1,16 +0,0 @@ -/** - * fn_getSelectedBodyPart.sqf - * @Descr: Get the current selected body part for client - * @Author: Glowbal - * - * @Arguments: [] - * @Return: STRING bodyPart selected - * @PublicAPI: true - */ - -#include "script_component.hpp" - -if (isnil QGVAR(selectedBodyPart)) then { - GVAR(selectedBodyPart) = "head"; -}; -GVAR(selectedBodyPart) \ No newline at end of file diff --git a/addons/medical/functions/fnc_getTreatmentOptions.sqf b/addons/medical/functions/fnc_getTreatmentOptions.sqf deleted file mode 100644 index b2bd75dc78..0000000000 --- a/addons/medical/functions/fnc_getTreatmentOptions.sqf +++ /dev/null @@ -1,49 +0,0 @@ -/** - * fnc_getTreatmentOptions.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - -#include "script_component.hpp" - - -private ["_caller","_target","_category", "_result", "_nameCaller", "_nameTarget"]; -_caller = _this select 0; -_target = _this select 1; -_category = _this select 2; - -if ((_category == "advanced" || _category == "airway") && (_caller == _target)) exitwith { - []; -}; - -if (!([_caller] call EFUNC(common,canInteract))) exitwith { - []; -}; - -if (([_caller] call EFUNC(common,beingCarried))) exitwith { - []; -}; - -if (!(isNull([_caller] call EFUNC(common,getCarriedObj))) && _category != "drag") exitwith { - []; -}; - -_nameCaller = [_caller] call EFUNC(common,getName); -_nameTarget = [_Target] call EFUNC(common,getName); - -_result = []; -{ - if ([_caller, _target] call (_x select 2)) then { - - private ["_caller", "_target", "_category"]; - - // title, code, tooltip - _result pushback [format[_x select 0, _nameCaller, _nameTarget], _x select 3, format[_x select 1, _nameCaller, _nameTarget]]; - }; -}foreach (missionNamespace getvariable [QGVAR(registeredTreatmentOptions_)+_category, []]); - -_result; \ No newline at end of file diff --git a/addons/medical/functions/fnc_getTriageList.sqf b/addons/medical/functions/fnc_getTriageList.sqf deleted file mode 100644 index 89660d7c97..0000000000 --- a/addons/medical/functions/fnc_getTriageList.sqf +++ /dev/null @@ -1,22 +0,0 @@ -/** - * fn_getTriageList.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - -#include "script_component.hpp" - -private["_unit"]; -_unit = _this select 0; -_log = [_unit,QGVAR(triageCard)] call EFUNC(common,getDefinedVariable); -if (isnil "_log") then { - _log = []; -}; -if (typeName _log != typeName []) then { - _log = []; -}; -_log diff --git a/addons/medical/functions/fnc_getTriageStatus.sqf b/addons/medical/functions/fnc_getTriageStatus.sqf deleted file mode 100644 index 58b2f3f0d5..0000000000 --- a/addons/medical/functions/fnc_getTriageStatus.sqf +++ /dev/null @@ -1,24 +0,0 @@ -/** - * fn_getTriageStatus.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - -#include "script_component.hpp" - -private ["_unit","_return","_status"]; -_unit = _this select 0; -_status = _unit getvariable [QGVAR(triageLevel), -1]; -_return = switch (_status) do { - case 0: {["None",0,[0,0,0,0.7]]}; // none - case 1: {["Minor",1,[0,0.5,0,0.7]]}; - case 2: {["Delayed",2,[0.77,0.51,0.08,0.7]]}; - case 3: {["Immediate",3,[1,0.2,0.2,0.7]]}; - case 4: {["Deceased",4,[0,0,0,0.7]]}; - default {["None",0,[0,0,0,0.7]]}; -}; -_return \ No newline at end of file diff --git a/addons/medical/functions/fnc_getTypeOfDamage.sqf b/addons/medical/functions/fnc_getTypeOfDamage.sqf index 80bbb0c972..1037f8514d 100644 --- a/addons/medical/functions/fnc_getTypeOfDamage.sqf +++ b/addons/medical/functions/fnc_getTypeOfDamage.sqf @@ -1,11 +1,14 @@ -/** - * fn_getTypeOfDamage.sqf - * @Descr: N/A - * @Author: Glowbal +/* + * Author: Glowbal + * Get the type of damage based upon the projectile. * - * @Arguments: [] - * @Return: - * @PublicAPI: false + * Arguments: + * 0: The projectile classname or object + * + * ReturnValue: + * Type of damage + * + * Public: No */ #include "script_component.hpp" @@ -13,6 +16,7 @@ private ["_typeOfProjectile","_typeOfInjury"]; _typeOfProjectile = _this select 0; _typeOfInjury = switch (true) do { + case (_typeOfProjectile isKindOf "Backblast"): {"backblast"}; case (_typeOfProjectile iskindof "BulletBase"): {"Bullet"}; case (_typeOfProjectile iskindof "GrenadeCore"): {"Grenade"}; case (_typeOfProjectile iskindof "TimeBombCore"): {"Explosive"}; @@ -27,4 +31,5 @@ _typeOfInjury = switch (true) do { case (_typeOfProjectile == "VehicleCrash"): {"VehicleCrash"}; default {"Unknown"}; }; -_typeOfInjury \ No newline at end of file +// TODO replace the capitalization on the switch results instead.. +toLower _typeOfInjury; diff --git a/addons/medical/functions/fnc_getUnconsciousCondition.sqf b/addons/medical/functions/fnc_getUnconsciousCondition.sqf index 097a5682ec..69ff9744d0 100644 --- a/addons/medical/functions/fnc_getUnconsciousCondition.sqf +++ b/addons/medical/functions/fnc_getUnconsciousCondition.sqf @@ -1,11 +1,14 @@ -/** - * fn_getUnconsciousCondition.sqf - * @Descr: get whatever or not a unit should be or stay unconscious - * @Author: Glowbal +/* + * Author: Glowbal + * Get whatever or not a unit should be or stay unconscious. * - * @Arguments: [unit OBJECT] - * @Return: BOOL True when the unit should be unconscious - * @PublicAPI: true + * Arguments: + * 0: The Unit + * + * ReturnValue: + * Should the unit stay unconscious? + * + * Public: Yes */ #include "script_component.hpp" @@ -13,17 +16,16 @@ private ["_unit","_return"]; _unit = _this select 0; -if (isnil QGVAR(unconsciousConditions_F)) then { - GVAR(unconsciousConditions_F) = []; +if (GVAR(level) == 0) exitwith {true}; +if (isnil QGVAR(unconsciousConditions)) then { + GVAR(unconsciousConditions) = []; }; _return = false; { - if (typeName _x == typeName {}) then { - if (([_unit] call _x)) then { - _return = true; - }; + if (typeName _x == typeName {} && {([_unit] call _x)}) exitwith { + _return = true; }; - if (_return) exitwith{}; -}foreach GVAR(unconsciousConditions_F); -_return \ No newline at end of file +}foreach GVAR(unconsciousConditions); + +_return; diff --git a/addons/medical/functions/fnc_handleBandageOpening.sqf b/addons/medical/functions/fnc_handleBandageOpening.sqf deleted file mode 100644 index cc27dbdee7..0000000000 --- a/addons/medical/functions/fnc_handleBandageOpening.sqf +++ /dev/null @@ -1,83 +0,0 @@ -/** - * fn_handleBandageOpening.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - -#include "script_component.hpp" - -#define CFG_DEFAULT_WAITING_TIME 900 + random(120) -#define WAITINGTIME 1 -#define RATIO 2 -#define CHANCE 3 - -private ["_person","_amount","_bodyPart","_woundClass","_item","_config","_found", "_waitingTime", "_selectedConfig"]; -_person = _this select 0; -_amount = _this select 1; -_bodyPart = _this select 2; -_woundClass = _this select 3; -_item = _this select 4; - -// classname, waiting time until wound opens, ratio in which it start bleeding again, chance of the wound ever opening up // -_config = [ - ["ACE_bandage_basic", 900 + random (120), 0.75, 0.4], - ["ACE_packing_bandage", 1200 + random (120), 0.5, 0.6], - ["ACE_bandageElastic", 900 + random (900), 0.75, 0.2], - ["ACE_quikclot", 1, 0.1, 0], - ["default", 1, CFG_DEFAULT_WAITING_TIME, 1] -]; -_selectedConfig = _config select (count _config - 1); -_waitingTime = -1; - -_found = false; -{ - if (_item == _x select 0) exitwith { - _found = true; - if (random(1)> (1 - (_x select CHANCE))) then { - - _waitingTime = (_x select WAITINGTIME); - _selectedConfig = _x; - }; - }; -}foreach _config; - -if (!_found && (random(1)>0.2)) then { - _waitingTime = CFG_DEFAULT_WAITING_TIME; -}; - -if (_waitingTime > 0) then { - [{ - private ["_params", "_config", "_person", "_amount","_bodyPart","_woundClass","_item", "_bandagedWounds","_bandagedBodyPart","_bandagedWoundClass","_openWounds", "_openWoundsBodyPart","_openWoundClass"]; - _params = _this select 0; - _config = _this select 1; - - _person = _params select 0; - _amount = _params select 1; - _bodyPart = _params select 2; - _woundClass = _params select 3; - _item = _params select 4; - - _bandagedWounds = [_person,QGVAR(bandagedWounds)] call EFUNC(common,getDefinedVariable); - _bandagedBodyPart = _bandagedWounds select _bodyPart; - _bandagedWoundClass = _bandagedBodyPart select _woundClass; - if (_bandagedWoundClass >= _amount) then { - _openWounds =[_person,QGVAR(openWounds)] call EFUNC(common,getDefinedVariable); - _openWoundsBodyPart = _openWounds select _bodyPart; - _openWoundClass = _openWoundsBodyPart select _woundClass; - - _bandagedBodyPart set [_woundClass,_bandagedWoundClass - (_amount * (_config select RATIO))]; - _openWoundsBodyPart set [_woundClass,_openWoundClass + (_amount * (_config select RATIO))]; - - _bandagedWounds set[_bodyPart,_bandagedBodyPart]; - _openWounds set[_bodyPart,_openWoundsBodyPart]; - [_person,QGVAR(openWounds),_openWounds] call EFUNC(common,setDefinedVariable); - [_person,QGVAR(bandagedWounds),_bandagedWounds] call EFUNC(common,setDefinedVariable); - - ["Medical_onWoundsReopened", [_person, (_amount * (_config select RATIO)), _bodyPart, _woundClass, _item]] call ace_common_fnc_localEvent; - }; - }, [_this, _selectedConfig], _waitingTime, _waitingTime] call EFUNC(common,waitAndExecute); -}; \ No newline at end of file diff --git a/addons/medical/functions/fnc_handleDamage.sqf b/addons/medical/functions/fnc_handleDamage.sqf index a157a0b2ae..d3b56c4a6e 100644 --- a/addons/medical/functions/fnc_handleDamage.sqf +++ b/addons/medical/functions/fnc_handleDamage.sqf @@ -1,93 +1,72 @@ -/** - * fn_handleDamage.sqf - * @Descr: N/A - * @Author: Glowbal +/* + * Author: KoffeinFlummi, Glowbal + * Main HandleDamage EH function. * - * @Arguments: [] - * @Return: - * @PublicAPI: false + * Arguments: + * 0: Unit That Was Hit + * 1: Name Of Hit Selection + * 2: Amount Of Damage + * 3: Shooter + * 4: Projectile + * + * Return Value: + * Damage To Be Inflicted + * + * Public: No */ #include "script_component.hpp" -private ["_unit","_selectionName","_amountOfDamage","_sourceOfDamage", "_typeOfProjectile","_bodyPartn","_newDamage","_typeOfDamage","_caliber", "_hitPointName", "_returnDamage", "_varCheck"]; -_unit = _this select 0; -_selectionName = _this select 1; -_amountOfDamage = _this select 2; -_sourceOfDamage = _this select 3; -_typeOfProjectile = _this select 4; -_returnDamage = _amountOfDamage; +private ["_unit", "_selection", "_damage", "_shooter", "_projectile", "_damageReturn", "_hitPoints", "_typeOfDamage"]; +_unit = _this select 0; +_selection = _this select 1; +_damage = _this select 2; +_shooter = _this select 3; +_projectile = _this select 4; -// do not function on non local units -if (!local _unit) exitwith { - nil; +if !(local _unit) exitWith {nil}; + +if !([_unit] call FUNC(hasMedicalEnabled)) exitwith {}; + +if (typeName _projectile == "OBJECT") then { + _projectile = typeOf _projectile; + _this set [4, _projectile]; }; -_bodyPartn = [_selectionName] call FUNC(getBodyPartNumber); +// If the damage is being weird, we just tell it to fuck off. +_hitSelections = ["head", "body", "hand_l", "hand_r", "leg_l", "leg_r"]; +if !(_selection in (_hitSelections + [""])) exitWith {0}; -// Check for vehicle crash -if (vehicle _unit != _unit && {_bodyPartn < 0} && {isNull _sourceOfDamage} && {_typeOfProjectile == ""} && {_selectionName == ""}) then { - if (GVAR(setting_allowVehicleCrashInjuries)) then { - _bodyPartn = if (random(1)>=0.5) then { 0 } else { 1 }; - _typeOfProjectile = "VehicleCrash"; - }; +_damageReturn = _damage; +if (GVAR(level) == 0) then { + _damageReturn = (_this + [_damageReturn]) call FUNC(handleDamage_basic); }; -// If it is not a valid bodyPart number, exit because we cannot do anything with it. -if (_bodyPartn < 0) exitwith {0}; +if (GVAR(level) >= 1) then { + [_unit, _selection, _damage, _source, _projectile, _damageReturn] call FUNC(handleDamage_caching); -// Most likely taking exessive fire damage. Lets exit. -if (isNull _sourceOfDamage && (_selectionName == "head" || isBurning _unit) && _typeOfProjectile == "" && vehicle _unit == _unit) exitwith { - 0 -}; // Prefent excessive fire damage - -// Ensure damage is being handled correctly. -_newDamage = [_unit, _amountOfDamage, _bodyPartn] call FUNC(getNewDamageBodyPart); -[_unit] call FUNC(setDamageBodyPart); - -if ([_unit] call FUNC(hasMedicalEnabled)) then { - _returnDamage = 0; - if (_amountOfDamage < 0) then { - _amountOfDamage = 0; - }; - - // figure out the type of damage so we can use that to determine what injures should be given. - _typeOfDamage = [_typeOfProjectile] call FUNC(getTypeOfDamage); - - [_unit, _newDamage, _typeOfDamage, _bodyPartn] call FUNC(onInjury_assignOpenWounds); - - if ((missionNamespace getvariable[QGVAR(setting_AdvancedLevel), 0]) > 0) then { - if (GVAR(setting_allowAirwayInjuries)) then { - [_unit, _amountOfDamage, _typeOfDamage, _bodyPartn] call FUNC(onInjury_assignAirwayStatus); + if (_damageReturn > 0.9) then { + _hitPoints = ["HitHead", "HitBody", "HitLeftArm", "HitRightArm", "HitLeftLeg", "HitRightLeg"]; + _newDamage = _damage - (damage _unit); + if (_selection in _hitSelections) then { + _newDamage = _damage - (_unit getHitPointDamage (_hitPoints select (_hitSelections find _selection))); }; - }; - [_unit, _newDamage, _bodyPartn] call FUNC(increasePain); - - if (([_unit, _bodyPartn] call FUNC(determineIfFatal)) || !(alive (vehicle _unit))) then { - [_unit] call FUNC(setDead); - _returnDamage = 1; - } else { - [_unit] call FUNC(addToInjuredCollection); - if ([_unit, _bodyPartn] call FUNC(determineIfUnconscious)) then { - [_unit] call FUNC(setUnconsciousState); + if ([_unit, [_selection] call FUNC(selectionNameToNumber), _newDamage] call FUNC(determineIfFatal)) then { + if ([_unit] call FUNC(setDead)) then { + _damageReturn = 1; + }; } else { - [_unit,_newDamage] call FUNC(handleReactionHit); + _damageReturn = 0.89; }; }; - - if (!(alive (vehicle _unit))) then { - _returnDamage = 1; - [_unit] call FUNC(setDead); - }; - ["Medical_onHandleDamage", _this] call ace_common_fnc_localEvent; -} else { - if (_returnDamage > 0.957) then { - _returnDamage = 0.957; - }; - if (([_unit, _bodyPartn] call FUNC(determineIfFatal)) || !(alive (vehicle _unit))) then { - [_unit] call FUNC(setDead); - _returnDamage = 1; - }; }; -_returnDamage; +if (_unit getVariable [QGVAR(preventDeath), false] && {_damageReturn >= 0.9} && {_selection in ["", "head", "body"]}) exitWith { + if (vehicle _unit != _unit and {damage _vehicle >= 1}) then { + // @todo + // [_unit] call FUNC(unload); + }; + 0.89 +}; + +_damageReturn diff --git a/addons/medical/functions/fnc_handleDamage_advanced.sqf b/addons/medical/functions/fnc_handleDamage_advanced.sqf new file mode 100644 index 0000000000..559c52709e --- /dev/null +++ b/addons/medical/functions/fnc_handleDamage_advanced.sqf @@ -0,0 +1,57 @@ +/* + * Author: Glowbal + * Advanced HandleDamage EH function. + * + * Arguments: + * 0: Unit That Was Hit + * 1: Name Of Hit Selection + * 2: Amount Of Damage + * 3: Shooter + * 4: Projectile + * 5: Current damage to be returned + * 6: Type of Damage + * + * Return Value: + * Damage To Be Inflicted + * + * Public: No + */ + +#include "script_component.hpp" + +private ["_unit","_selectionName","_amountOfDamage","_sourceOfDamage","_typeOfProjectile","_typeOfDamage", "_part", "_damageBodyParts", "_newDamage", "_hitPoints"]; +_unit = _this select 0; +_selectionName = _this select 1; +_amountOfDamage = _this select 2; +_sourceOfDamage = _this select 3; +_typeOfProjectile = _this select 4; +_returnDamage = _this select 5; + +_typeOfDamage = [_typeOfProjectile] call FUNC(getTypeOfDamage); +_part = [_selectionName] call FUNC(selectionNameToNumber); + +_hitPoints = ["HitHead", "HitBody", "HitLeftArm", "HitRightArm", "HitLeftLeg", "HitRightLeg"]; +// Sorting out the damage +_damageBodyParts = _unit getvariable [QGVAR(bodyPartStatus), [0,0,0,0,0,0]]; +_newDamage = _amountOfDamage - (_unit getHitPointDamage (_hitPoints select _part)); +_damageBodyParts set [_part, (_damageBodyParts select _part) + _newDamage]; +_unit setvariable [QGVAR(bodyPartStatus), _damageBodyParts, true]; +[_unit] call FUNC(handleDamage_advancedSetDamage); + +[_unit, _selectionName, _newDamage, _typeOfProjectile, _typeOfDamage] call FUNC(handleDamage_wounds); + +if (GVAR(enableAirway)) then { + [_unit,_selectionName,_newDamage,_sourceOfDamage, _typeOfDamage] call FUNC(handleDamage_airway); +}; +if (GVAR(enableFractures)) then { + [_unit,_selectionName,_newDamage,_sourceOfDamage, _typeOfDamage] call FUNC(handleDamage_fractures); +}; +if (GVAR(enableInternalBleeding)) then { + [_unit,_selectionName,_newDamage,_sourceOfDamage, _typeOfDamage] call FUNC(handleDamage_internalInjuries); +}; + +if (alive _unit && {!(_unit getvariable ["ACE_isUnconscious", false])}) then { + [_unit, _newDamage] call FUNC(reactionToDamage); +}; + +_returnDamage; diff --git a/addons/medical/functions/fnc_setDamageBodyPart.sqf b/addons/medical/functions/fnc_handleDamage_advancedSetDamage.sqf similarity index 80% rename from addons/medical/functions/fnc_setDamageBodyPart.sqf rename to addons/medical/functions/fnc_handleDamage_advancedSetDamage.sqf index 828bd93c7e..74db6029d2 100644 --- a/addons/medical/functions/fnc_setDamageBodyPart.sqf +++ b/addons/medical/functions/fnc_handleDamage_advancedSetDamage.sqf @@ -1,11 +1,14 @@ -/** - * fnc_setDamageBodyPart.sqf - * @Descr: N/A - * @Author: Glowbal +/* + * Author: Glowbal + * Sets the hitpoint damage for au nit to the correct values * - * @Arguments: [] - * @Return: - * @PublicAPI: false + * Arguments: + * 0: Unit for which the hitpoint damage will be sorted out + * + * Return Value: + * nil + * + * Public: No */ #include "script_component.hpp" @@ -17,7 +20,7 @@ if (!local _unit) exitwith { // execute only local }; -_bodyStatus = [_unit,QGVAR(bodyPartStatus),[0,0,0,0,0,0]] call EFUNC(common,getDefinedVariable); +_bodyStatus = _unit getvariable [QGVAR(bodyPartStatus),[0,0,0,0,0,0]]; // ["head", "body", "hand_l", "hand_r", "leg_l", "leg_r"] _headDamage = _bodyStatus select 0; if (_headDamage > 0.95) then { diff --git a/addons/medical/functions/fnc_handleDamage_airway.sqf b/addons/medical/functions/fnc_handleDamage_airway.sqf new file mode 100644 index 0000000000..a1357e95a8 --- /dev/null +++ b/addons/medical/functions/fnc_handleDamage_airway.sqf @@ -0,0 +1,37 @@ +/* + * Author: Glowbal + * Handling of the airway injuries upon the handleDamage eventhandler. + * + * Arguments: + * 0: Unit That Was Hit + * 1: Name Of Hit Selection + * 2: Amount Of Damage + * 3: Shooter or source of the damage + * 4: Type of the damage done + * + * Return Value: + * None + * + * Public: No + */ + +#include "script_component.hpp" + +private ["_unit", "_selectionName", "_amountOfDamage", "_sourceOfDamage", "_typeOfDamage", "_bodyPartn"]; +_unit = _this select 0; +_selectionName = _this select 1; +_amountOfDamage = _this select 2; +_sourceOfDamage = _this select 3; +_typeOfDamage = _this select 4; +_bodyPartn = [_selectionName] call FUNC(selectionNameToNumber); + +// We process only the head for airway. +if (_bodyPartn != 0) exitwith {}; + +if (_amountOfDamage > 0.4) then { + if (random(1) >= 0.8) then { + if !(_unit getvariable[QGVAR(airwayCollapsed), false]) then { + _unit setvariable [QGVAR(airwayCollapsed), true, true]; + }; + }; +}; diff --git a/addons/medical/functions/fnc_handleDamage_basic.sqf b/addons/medical/functions/fnc_handleDamage_basic.sqf new file mode 100644 index 0000000000..f31c9f186d --- /dev/null +++ b/addons/medical/functions/fnc_handleDamage_basic.sqf @@ -0,0 +1,182 @@ +/* + * Author: KoffeinFlummi + * Basic HandleDamage EH function. + * + * Arguments: + * 0: Unit That Was Hit + * 1: Name Of Hit Selection + * 2: Amount Of Damage + * 3: Shooter + * 4: Projectile + * 5: Current damage to be returned + * + * Return Value: + * Damage To Be Inflicted + * + * Public: No + */ + +#include "script_component.hpp" + +#define LEGDAMAGETRESHOLD1 1 +#define LEGDAMAGETRESHOLD2 1.7 +#define ARMDAMAGETRESHOLD1 1 +#define ARMDAMAGETRESHOLD2 1.7 +#define UNCONSCIOUSNESSTRESHOLD 0.7 + +private ["_unit", "_selection", "_damage", "_shooter", "_projectile", "_damageReturn"]; + +_unit = _this select 0; +_selection = _this select 1; +_damage = _this select 2; +_shooter = _this select 3; +_projectile = _this select 4; +_damageReturn = _this select 5; + + +// This is a new hit, reset variables. +// Note: sometimes handleDamage spans over 2 or even 3 frames. +if (diag_frameno > (_unit getVariable [QGVAR(frameNo), -3]) + 2) then { + _unit setVariable [QGVAR(frameNo), diag_frameno]; + _unit setVariable [QGVAR(isFalling), false]; + _unit setVariable [QGVAR(projectiles), []]; + _unit setVariable [QGVAR(hitPoints), []]; + _unit setVariable [QGVAR(damages), []]; + _unit setVariable [QGVAR(structDamage), 0]; + _unit setVariable [QGVAR(preventDeath), false]; +}; + + +_hitSelections = ["head", "body", "hand_l", "hand_r", "leg_l", "leg_r"]; +_hitPoints = ["HitHead", "HitBody", "HitLeftArm", "HitRightArm", "HitLeftLeg", "HitRightLeg"]; + +_newDamage = _damageReturn - (damage _unit); +if (_selection in _hitSelections) then { + _newDamage = _damageReturn - (_unit getHitPointDamage (_hitPoints select (_hitSelections find _selection))); +}; + +_damageReturn = _damageReturn - _newDamage; + + +// Exclude falling damage to everything other than legs and reduce it overall. +if (((velocity _unit) select 2 < -5) and (vehicle _unit == _unit)) then { + _unit setVariable [QGVAR(isFalling), true]; +}; +if (_unit getVariable [QGVAR(isFalling), false] and !(_selectionName in ["", "leg_l", "leg_r"])) exitWith { + (_unit getHitPointDamage (_hitPoints select (_hitSelections find _selectionName))) max 0.01; +}; +if (_unit getVariable [QGVAR(isFalling), false]) then { + _newDamage = _newDamage * 0.7; +}; + + +// Make sure there's only one damaged selection per projectile per frame. +if (_selectionName != "" and !(_unit getVariable QGVAR(isFalling))) then { + _cache_projectiles = _unit getVariable QGVAR(projectiles); + _cache_hitpoints = _unit getVariable QGVAR(hitPoints); + _cache_damages = _unit getVariable QGVAR(damages); + if (_projectile in _cache_projectiles) then { + _index = _cache_projectiles find _projectile; + _otherDamage = (_cache_damages select _index); + if (_otherDamage > _newDamage) then { + _newDamage = 0; + } else { + _hitPoint = _cache_hitpoints select _index; + _restore = ((_unit getHitPointDamage _hitPoint) - _otherDamage) max 0; + _unit setHitPointDamage [_hitPoint, _restore]; + // Make entry unfindable + _cache_projectiles set [_index, objNull]; + _cache_projectiles pushBack _projectile; + _cache_hitpoints pushBack (_hitPoints select (_hitSelections find _selectionName)); + _cache_damages pushBack _newDamage; + }; + } else { + _cache_projectiles pushBack _projectile; + _cache_hitpoints pushBack (_hitPoints select (_hitSelections find _selectionName)); + _cache_damages pushBack _newDamage; + }; + _unit setVariable [QGVAR(projectiles), _cache_projectiles]; + _unit setVariable [QGVAR(hitPoints), _cache_hitpoints]; + _unit setVariable [QGVAR(damages), _cache_damages]; +}; + +// Get rid of double structural damage (seriously arma, what the fuck?) +if (_selection == "") then { + _cache_structDamage = _unit getVariable QGVAR(structDamage); + if (_newDamage > _cache_structDamage) then { + _unit setVariable [QGVAR(structDamage), _newDamage]; + _newDamage = _newDamage - _cache_structDamage; + } else { + _newDamage = 0; + }; +}; + + +// Assign orphan structural damage to torso; +// @todo + + +if (_selection == "") then { + _damageReturn = _damageReturn + (_unit getVariable QGVAR(structDamage)); +} else { + _damageReturn = _damageReturn + _newDamage; +}; + + +// Leg Damage +_legdamage = (_unit getHitPointDamage "HitLeftLeg") + (_unit getHitPointDamage "HitRightLeg"); +if (_selectionName == "leg_l") then { + _legdamage = _damageReturn + (_unit getHitPointDamage "HitRightLeg"); +}; +if (_selectionName == "leg_r") then { + _legdamage = (_unit getHitPointDamage "HitLeftLeg") + _damageReturn; +}; + +if (_legdamage >= LEGDAMAGETRESHOLD1) then { + if (_unit getHitPointDamage "HitLegs" != 1) then {_unit setHitPointDamage ["HitLegs", 1]}; +} else { + if (_unit getHitPointDamage "HitLegs" != 0) then {_unit setHitPointDamage ["HitLegs", 0]}; +}; +// @ŧodo: force prone for completely fucked up legs. + + +// Arm Damage +_armdamage = (_unit getHitPointDamage "HitLeftArm") + (_unit getHitPointDamage "HitRightArm"); +if (_selectionName == "hand_l") then { + _armdamage = _damageReturn + (_unit getHitPointDamage "HitRightArm"); +}; +if (_selectionName == "hand_r") then { + _armdamage = (_unit getHitPointDamage "HitLeftArm") + _damageReturn; +}; + +if (_armdamage >= ARMDAMAGETRESHOLD1) then { + if (_unit getHitPointDamage "HitHands" != 1) then {_unit setHitPointDamage ["HitHands", 1]}; +} else { + if (_unit getHitPointDamage "HitHands" != 0) then {_unit setHitPointDamage ["HitHands", 0]}; +}; +// @todo: Drop weapon for full damage. + + +// Set Pain +if (_selection == "") then { + _pain = _unit getVariable [QGVAR(pain), 0]; + _pain = _pain + _newDamage * (1 - (_unit getVariable [QGVAR(morphine), 0])); + _unit setVariable [QGVAR(pain), _pain min 1, true]; +}; + + +// Unconsciousness +if (_selection == "" and + _damageReturn >= UNCONSCIOUSNESSTRESHOLD and + _damageReturn < 1 and + !(_unit getVariable [QGVAR(isUnconscious), False] +)) then { + // random chance to kill AI instead of knocking them out + if (_unit getVariable [QGVAR(allowUnconscious), ([_unit] call EFUNC(common,isPlayer)) or random 1 > 0.5]) then { + hint "unconscious"; // @todo + } else { + _damageReturn = 1; + }; +}; + +_damageReturn diff --git a/addons/medical/functions/fnc_cacheHandleDamageCall.sqf b/addons/medical/functions/fnc_handleDamage_caching.sqf similarity index 91% rename from addons/medical/functions/fnc_cacheHandleDamageCall.sqf rename to addons/medical/functions/fnc_handleDamage_caching.sqf index b692c2e871..c171439422 100644 --- a/addons/medical/functions/fnc_cacheHandleDamageCall.sqf +++ b/addons/medical/functions/fnc_handleDamage_caching.sqf @@ -1,14 +1,21 @@ -/** - * fnc_cacheHandleDamageCall.sqf - * @Descr: Cache a handleDamage call to execute it 3 frames later - * @Author: KoffeinFlummi +/* + * Author: KoffeinFlummi, Glowbal + * Cache a handleDamage call to execute it 3 frames later * - * @Arguments: [unit OBJECT, selection STRING, damagE NUMBER, source OBJECT, projectile STRING (Could be an OBJECT on occasion)] - * @Return: - * @PublicAPI: false + * Arguments: + * 0: Unit That Was Hit + * 1: Name Of Hit Selection + * 2: Amount Of Damage + * 3: Shooter + * 4: Projectile + * 5: Current damage to be returned + * + * Return Value: + * + * + * Public: No */ - #include "script_component.hpp" private ["_unit", "_selectionName","_damage", "_source","_projectile","_hitSelections","_hitPoints","_newDamage","_cache_hitpoints","_cache_projectiles","_cache_params","_cache_damages"]; @@ -17,6 +24,7 @@ _selectionName = _this select 1; _damage = _this select 2; _source = _this select 3; _projectile = _this select 4; +_returnDamage = _this select 5; _hitSelections = ["head", "body", "hand_l", "hand_r", "leg_l", "leg_r"]; _hitPoints = ["HitHead", "HitBody", "HitLeftArm", "HitRightArm", "HitLeftLeg", "HitRightLeg"]; @@ -64,7 +72,7 @@ if (diag_frameno > (_unit getVariable [QGVAR(frameNo_damageCaching), -3]) + 2) t _cache_params = _unit getVariable [QGVAR(cachedHandleDamageParams), []]; { if (typeName _x == typeName "") then { - (_cache_params select _foreachIndex) call FUNC(handleDamage); + (_cache_params select _foreachIndex) call FUNC(handleDamage_advanced); }; }foreach _cache_projectiles; [(_this select 1)] call cba_fnc_removePerFrameHandler; @@ -110,14 +118,14 @@ if (_selectionName != "") then { _cache_projectiles pushBack _projectile; _cache_hitpoints pushBack (_hitPoints select (_hitSelections find _selectionName)); _cache_damages pushBack _newDamage; - _cache_params pushBack [_unit, _selectionName, _damage, _source, _projectile]; + _cache_params pushBack [_unit, _selectionName, _damage, _source, _projectile, _returnDamage]; }; } else { // This is an unhandled projectile _cache_projectiles pushBack _projectile; _cache_hitpoints pushBack (_hitPoints select (_hitSelections find _selectionName)); _cache_damages pushBack _newDamage; - _cache_params pushBack [_unit, _selectionName, _damage, _source, _projectile]; + _cache_params pushBack [_unit, _selectionName, _damage, _source, _projectile, _returnDamage]; }; }; diff --git a/addons/medical/functions/fnc_handleDamage_fractures.sqf b/addons/medical/functions/fnc_handleDamage_fractures.sqf new file mode 100644 index 0000000000..0a22365044 --- /dev/null +++ b/addons/medical/functions/fnc_handleDamage_fractures.sqf @@ -0,0 +1,74 @@ +/* + * Author: Glowbal + * Handling of the fracture injuries upon the handleDamage eventhandler. + * + * Arguments: + * 0: Unit That Was Hit + * 1: Name Of Hit Selection + * 2: Amount Of Damage + * 3: Shooter or source of the damage + * 4: Type of the damage done + * + * Return Value: + * None + * + * Public: No + */ + +#include "script_component.hpp" + +private ["_unit", "_selectionName", "_amountOfDamage", "_sourceOfDamage", "_typeOfDamage", "_bodyPartn", "_fractures", "_fractureType"]; +_unit = _this select 0; +_selectionName = _this select 1; +_amountOfDamage = _this select 2; +_sourceOfDamage = _this select 3; +_typeOfDamage = _this select 4; +_bodyPartn = [_selectionName] call FUNC(selectionNameToNumber); + +_fractureType = 1; +if (_amountOfDamage > 0.05) then { + + // TODO specify fractures based off typeOfInjury details better. + switch (_typeOfDamage) do { + case "Bullet": { + _fractureType = round(random(2)); + }; + case "Grenade": { + _fractureType = round(random(2)); + if (_fractureType < 1) then { + _fractureType = 1; + }; + }; + case "Explosive": { + _fractureType = round(random(2)); + if (_fractureType < 1) then { + _fractureType = 1; + }; + }; + case "Shell": { + _fractureType = round(random(2)); + if (_fractureType < 1) then { + _fractureType = 1; + }; + }; + case "Unknown": { + _fractureType = round(random(1)); + }; + case "VehicleCrash": { + _fractureType = round(random(0)); + }; + default { + _fractureType = round(random(1)); + }; + }; + + private ["_fractures", "_fractureID", "_amountOf"]; + _fractures = _unit getvariable[QGVAR(fractures), []]; + _fractureID = 1; + _amountOf = count _fractures; + if (_amountOf > 0) then { + _fractureID = (_fractures select (_amountOf - 1) select 0) + 1; + }; + _fractures pushback [_fractureID, _fractureType, _bodyPartn, 1 /* percentage treated */]; + _unit setvariable [GVAR(fractures), _fractures, true]; +}; \ No newline at end of file diff --git a/addons/medical/functions/fnc_handleDamage_internalInjuries.sqf b/addons/medical/functions/fnc_handleDamage_internalInjuries.sqf new file mode 100644 index 0000000000..6ee256a977 --- /dev/null +++ b/addons/medical/functions/fnc_handleDamage_internalInjuries.sqf @@ -0,0 +1,28 @@ +/* + * Author: Glowbal + * Handling of the internal injuries upon the handleDamage eventhandler. + * + * Arguments: + * 0: Unit That Was Hit + * 1: Name Of Hit Selection + * 2: Amount Of Damage + * 3: Shooter or source of the damage + * 4: Type of the damage done + * + * Return Value: + * None + * + * Public: No + */ + +#include "script_component.hpp" + +private ["_unit", "_selectionName", "_amountOfDamage", "_sourceOfDamage", "_typeOfDamage", "_bodyPartn"]; +_unit = _this select 0; +_selectionName = _this select 1; +_amountOfDamage = _this select 2; +_sourceOfDamage = _this select 3; +_typeOfDamage = _this select 4; +_bodyPartn = [_selectionName] call FUNC(selectionNameToNumber); + +// TODO implement internal injuries diff --git a/addons/medical/functions/fnc_handleDamage_wounds.sqf b/addons/medical/functions/fnc_handleDamage_wounds.sqf new file mode 100644 index 0000000000..2b8e27d75a --- /dev/null +++ b/addons/medical/functions/fnc_handleDamage_wounds.sqf @@ -0,0 +1,110 @@ +/* + * Author: Glowbal + * Handling of the open wounds & injuries upon the handleDamage eventhandler. + * + * Arguments: + * 0: Unit That Was Hit + * 1: Name Of Hit Selection + * 2: Amount Of Damage + * 3: Shooter or source of the damage + * 4: Type of the damage done + * + * Return Value: + * None + * + * Public: No + */ + +#include "script_component.hpp" + +private ["_unit", "_selectionName", "_damage", "_typeOfProjectile", "_typeOfDamage", "_bodyPartn", "_woundType", "_injuryTypeInfo", "_allInjuriesForDamageType", "_allPossibleInjuries", "_highestPossibleDamage", "_highestPossibleSpot", "_minDamage", "_openWounds", "_woundID", "_toAddInjury", "_painToAdd"]; +_unit = _this select 0; +_selectionName = _this select 1; +_damage = _this select 2; +_typeOfProjectile = _this select 3; +_typeOfDamage = _this select 4; + +// Convert the selectionName to a number and ensure it is a valid selection. +_bodyPartn = [_selectionName] call FUNC(selectionNameToNumber); +if (_bodyPartn < 0) exitwith {}; + +// Get the injury type information. Format: [typeDamage thresholds, selectionSpecific, woundTypes] +_injuryTypeInfo = missionNamespace getvariable [format[QGVAR(woundInjuryType_%1), _typeOfDamage],[[], false, []]]; + +// This are the available injuries for this damage type. Format [[classtype, selections, bloodloss, minimalDamage, pain], ..] +_allInjuriesForDamageType = _injuryTypeInfo select 2; + +// find the available injuries for this damage type and damage amount +_highestPossibleSpot = -1; +_highestPossibleDamage = 0; +_allPossibleInjuries = []; +{ + _minDamage = _x select 4; + + // Check if the damage is higher as the min damage for the specific injury + if (_damage >= _minDamage) then { + _classType = _x select 0; + _selections = _x select 1; + _bloodLoss = _x select 2; + _pain = _x select 3; + + // Check if the injury can be applied to the given selection name + if ("All" in _selections || _selectionName in _selections) then { + + // Find the wound which has the highest minimal damage, so we can use this later on for adding the correct injuries + if (_minDamage > _highestPossibleDamage) then { + _highestPossibleSpot = _foreachIndex; + _highestPossibleDamage = _minDamage; + }; + + // Store the valid possible injury for the damage type, damage amount and selection + _allPossibleInjuries pushback _x; + }; + }; +}foreach _allInjuriesForDamageType; + +// No possible wounds available for this damage type or damage amount. +if (_highestPossibleSpot < 0) exitwith { + // It appears we are dealing with an unknown type of damage. + if (count _allInjuriesForDamageType == 0) then { + + }; +}; + +// admin for open wounds and ids +_openWounds = _unit getvariable[QGVAR(openWounds), []]; +_woundID = _unit getvariable[QGVAR(lastUniqueWoundID), 1]; + +_painToAdd = 0; +_woundsCreated = []; +{ + if (_x select 0 <= _damage) exitwith { + for "_i" from 0 to (1+ floor(random(_x select 1)-1)) /* step +1 */ do { + + // Find the injury we are going to add. Format [ classType, allowdSelections, bloodloss, painOfInjury, minimalDamage] + _toAddInjury = _allPossibleInjuries select (floor(random (count _allPossibleInjuries))); + + // Create a new injury. Format [ID, classname, bodypart, percentage treated, bloodloss rate] + _injury = [_woundID, _toAddInjury select 0, if (_injuryTypeInfo select 1) then {_bodyPartn} else {floor(random(6))}, 1, _toAddInjury select 2]; + + // Store the injury so we can process it later correctly. + _openWounds pushback _injury; + _woundsCreated pushback _injury; + _woundID = _woundID + 1; + + // Collect the pain that is caused by this injury + _painToAdd = _painToAdd + (_toAddInjury select 3); + }; + }; +}foreach (_injuryTypeInfo select 0); + +_unit setvariable [QGVAR(openWounds), _openWounds]; +_unit setvariable [QGVAR(lastUniqueWoundID), _woundID, true]; + +// Broadcast the new injuries across the net in parts. One broadcast per injury. Prevents having to broadcast one massive array of injuries. +{ + ["medical_propagateWound", [_unit, _x]] call EFUNC(common,globalEvent); +}foreach _woundsCreated; + +_painLevel = _unit getvariable [QGVAR(pain), 0]; +_unit setvariable [QGVAR(pain), _painLevel + _painToAdd]; diff --git a/addons/medical/functions/fnc_handleDisplayEffects.sqf b/addons/medical/functions/fnc_handleDisplayEffects.sqf deleted file mode 100644 index b640532cac..0000000000 --- a/addons/medical/functions/fnc_handleDisplayEffects.sqf +++ /dev/null @@ -1,83 +0,0 @@ -/** - * fn_handleDisplayEffects.sqf - * @Descr: displays visual effects to user - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - -#include "script_component.hpp" - -if (!hasInterface) exitwith{}; -45 cutRsc [QGVAR(ScreenEffectsBlack),"PLAIN"]; - -FUNC(hb_effect) = { - _heartRate = _this select 0; - if (_heartRate < 0.1) exitwith {}; - _hbSoundsFast = ["ACE_heartbeat_fast_1", "ACE_heartbeat_fast_2", "ACE_heartbeat_fast_3", "ACE_heartbeat_norm_1", "ACE_heartbeat_norm_2"]; - _hbSoundsNorm = ["ACE_heartbeat_norm_1", "ACE_heartbeat_norm_2"]; - _hbSoundsSlow = ["ACE_heartbeat_slow_1", "ACE_heartbeat_slow_2", "ACE_heartbeat_norm_1", "ACE_heartbeat_norm_2"]; - - if (GVAR(playingHeartBeatSound)) exitwith {}; - GVAR(playingHeartBeatSound) = true; - - _sleep = 60 / _heartRate; - if (_heartRate < 60) then { - _sound = _hbSoundsSlow select (random((count _hbSoundsSlow) -1)); - playSound _sound; - - [{ - GVAR(playingHeartBeatSound) = false; - }, [], _sleep, _sleep] call EFUNC(common,waitAndExecute); - } else { - if (_heartRate > 120) then { - _sound = _hbSoundsFast select (random((count _hbSoundsFast) -1)); - playSound _sound; - [{ - GVAR(playingHeartBeatSound) = false; - }, [], _sleep, _sleep] call EFUNC(common,waitAndExecute); - }; - }; -}; - -GVAR(playingHeartBeatSound) = false; -GVAR(BloodLevel_CC) = ppEffectCreate ["ColorCorrections", 4208]; -GVAR(BloodLevel_CC) ppEffectForceInNVG true; -GVAR(BloodLevel_CC) ppEffectAdjust [1,1,0, [0,0,0,0], [1,1,1,1], [0.2,0.2,0.2,0]]; -GVAR(BloodLevel_CC) ppEffectCommit 0; - -[{ - private ["_unit","_bloodLoss", "_bloodVolume"]; - _unit = ACE_player; - - if (isNull(findDisplay 312)) then { - if ([_unit] call EFUNC(common,isAwake) && false) then { - _bloodLoss = _unit call FUNC(getBloodLoss); - if (_bloodLoss >0) then { - [_bloodLoss] call FUNC(effectBleeding); - }; - - [{ - [((_this select 0) getvariable[QGVAR(amountOfPain), 0])] call FUNC(effectPain); - }, [_unit], 0.25, 0.25] call EFUNC(common,waitAndExecute); - - [(_unit getvariable[QGVAR(heartRate), 70])] call FUNC(hb_effect); - ["medicalEffectsLoop", [_unit]] call ace_common_fnc_localEvent - }; - - // Blood Level Effect - _bloodVolume = _unit getVariable [QGVAR(bloodVolume), 100]; - if (_bloodVolume > 99 || !alive _unit) then { - GVAR(BloodLevel_CC) ppEffectEnable false; - } else { - GVAR(BloodLevel_CC) ppEffectEnable true; - GVAR(BloodLevel_CC) ppEffectAdjust [1, 1, 0, [0.0, 0.0, 0.0, 0.0], [1, 1, 1,_bloodVolume/100], [0.2, 0.2, 0.2, 0]]; - GVAR(BloodLevel_CC) ppEffectCommit 0; - }; - } else { - GVAR(BloodLevel_CC) ppEffectEnable false; - }; - - } , 0.5, [] ] call CBA_fnc_addPerFrameHandler; diff --git a/addons/medical/functions/fnc_handleDropUnit.sqf b/addons/medical/functions/fnc_handleDropUnit.sqf deleted file mode 100644 index c82fe8ce79..0000000000 --- a/addons/medical/functions/fnc_handleDropUnit.sqf +++ /dev/null @@ -1,88 +0,0 @@ -/** - * fnc_handleDropUnit.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - - -#include "script_component.hpp" - - -private ["_caller","_target","_killOnDrop","_dragging"]; -_caller = _params select 0; -_target = _params select 1; -_killOnDrop = _params select 2; -_dragging = _params select 3; - -[format["fnc_handleDropUnit: %1",_this]] call EFUNC(common,debug); - -if ((isNull ([_caller] call EFUNC(common,getCarriedObj))) || !([_caller] call EFUNC(common,isAwake)) || (vehicle _caller != _caller)) then { - - if (primaryWeapon _caller == "ACE_FakePrimaryWeapon") then { - _caller removeWeapon "ACE_FakePrimaryWeapon"; - }; - - [_target, false] call EFUNC(common,disableAI_f); - _caller setvariable[QGVAR(onStartMovingUnitParams), nil]; - - // handle the drag & carry administration - if (_dragging) then { - _target setvariable [QGVAR(beingDragged),nil,true]; - _caller setvariable [QGVAR(dragging),nil,true]; - } else { - _target setvariable [QGVAR(beingCarried),nil,true]; - _caller setvariable [QGVAR(carrying),nil,true]; - }; - - // This is for good messure, the object should already have been dropped if it ever reaches this - [_caller,ObjNull] call EFUNC(common,carryObj); - - // handle the drag & carry animiations - if ([_caller] call EFUNC(common,isAwake) && (vehicle _caller == _caller)) then { - [_caller,"amovpercmstpsraswrfldnon_amovpknlmstpslowwrfldnon", 1] call EFUNC(common,doAnimation); - }; - - if (vehicle _target == _target) then { - if (_dragging) then { - [_target,"AinjPpneMstpSnonWrflDb_release", 2, true] call EFUNC(common,doAnimation); - } else { - [_target,"AinjPfalMstpSnonWrflDnon_carried_Down", 2, true] call EFUNC(common,doAnimation); - }; - } else { - if ([_target] call EFUNC(common,isAwake)) then { - [_target,"", 2] call EFUNC(common,doAnimation); // TODO play animation for the current seat instead - } else { - // this might not work properly - [_target,([_target] call EFUNC(common,getDeathAnim)), 1] call EFUNC(common,doAnimation); - }; - }; - - // Ensure that the unit does not get dropped through the floor of a building - if (!surfaceIsWater getPos _caller) then { - [{ - EXPLODE_3_PVT(_this,_caller,_target,_killOnDrop); - if (vehicle _target == _target && (vehicle _caller == _caller)) then { - // This will set the target body/unit on the correct position, so it doesn't fall through floors. - _positionUnit = getPosATL _target; - _positionUnit set [2, (getPosATL _caller) select 2]; - _target setPosATL _positionUnit; - }; - - if (_killOnDrop) then { - _unit setDamage 1; - }; - [format["fnc_handleDropUnit: %1 - passed setPosATL fix", _caller]] call EFUNC(common,debug); - }, [_caller,_target,_killOnDrop], 0.5, 0.5] call EFUNC(common,waitAndExecute); - } else { - if (_killOnDrop) then { - _unit setDamage 1; - }; - }; - - ["onDropInjured", [_caller], [_caller, _unit, 0]] call EFUNC(common,targetEvent); - -}; \ No newline at end of file diff --git a/addons/medical/functions/fnc_handleHeal.sqf b/addons/medical/functions/fnc_handleHeal.sqf deleted file mode 100644 index 04e17a5d4c..0000000000 --- a/addons/medical/functions/fnc_handleHeal.sqf +++ /dev/null @@ -1,29 +0,0 @@ -/** - * fn_handleHeal.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - -#include "script_component.hpp" - -private ["_unit",'_healer']; -_unit = _this select 0; -_healer = _this select 1; - -if (!(isPlayer _healer) && GVAR(setting_allowAIFullHeal) && !([_unit] call EFUNC(common,isUnconscious))) then { - [_unit, QGVAR(openWounds),[[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0]]] call EFUNC(common,setDefinedVariable); - [_unit, QGVAR(bandagedWounds),[[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0]]] call EFUNC(common,setDefinedVariable); - - if (_unit != _healer) then { - [_unit,"STR_ACE_BANDAGED","STR_ACE_IS_BANDAGING_YOU", 0, [[_healer] call EFUNC(common,getName)]] call EFUNC(gui,sendDisplayMessageTo); - }; - [_unit,"treatment",format["%1 has patched up the patient",[_healer] call EFUNC(common,getName)]] call FUNC(addActivityToLog); - - ["Medical_onHandleHeal", _this] call ace_common_fnc_localEvent; -}; - -true; \ No newline at end of file diff --git a/addons/medical/functions/fnc_handleTreatment.sqf b/addons/medical/functions/fnc_handleTreatment.sqf deleted file mode 100644 index 929dcfdbb0..0000000000 --- a/addons/medical/functions/fnc_handleTreatment.sqf +++ /dev/null @@ -1,72 +0,0 @@ -/** - * fnc_handleTreatment.sqf - * @Descr: entry point for all treatment actions. Handles the syncronization between treatment actions and equipment usages. Will pass on the the treatment action to their category handlers. - * When using an undefined category, the caller is responsible for cleaning up, including unlocking the treatment mutex. - * @Author: Glowbal - * - * @Arguments: [caller OBJECT, target OBJECT, selectionName STRING, removeItem STRING, category STRING] - * @Return: nil - * @PublicAPI: false - */ - -#include "script_component.hpp" - -private ["_treatingPerson","_injuredPerson","_selectionName","_removeItem","_attributes","_patient", "_continue", "_prevAnim"]; -_caller = _this select 0; -_target = _this select 1; -_selectionName = _this select 2; -_removeItem = _this select 3; -_category = _this select 4; - -if (!local _caller) exitwith { - [[_caller, _target, _selectionName, _removeItem, _category], QUOTE(FUNC(handleTreatment)), _caller] call EFUNC(common,execRemoteFnc); - false; -}; - -if ([_caller] call FUNC(isSetTreatmentMutex)) exitwith { - if (_caller == ACE_player) then { - // display a message - currently occupied with treatment already - }; - false -}; -[_caller, true] call FUNC(treatmentMutex); - -if (!([_caller, _target, _removeItem] call FUNC(hasEquipment)) && _removeItem != "") exitwith { - [_caller, false] call FUNC(treatmentMutex); - false; -}; - -if (primaryWeapon _caller == "") then { - _caller addWeapon "ACE_FakePrimaryWeapon"; -}; -_caller selectWeapon (primaryWeapon _caller); - -// TODO make dynamic -switch (toLower _category) do { - case "bandage": { - ([_caller, _target, _selectionName, _removeItem] call FUNC(handleTreatment_Category_Bandaging)); - }; - case "medication": { - ([_caller, _target, _selectionName, _removeItem] call FUNC(handleTreatment_Category_Medication)); - }; - case "advanced": { - ([_caller, _target, _selectionName, _removeItem] call FUNC(handleTreatment_Category_Advanced)); - }; - case "airway": { - ([_caller, _target, _selectionName, _removeItem] call FUNC(handleTreatment_Category_Airway)); - }; - default { - // Do not handle the request - false; - }; -}; - -// Entry point for any un supported treatment actions. -// Expected to have one of the local events call the treatment completed event. -["Medical_performingTreatment", [_caller, _target, _selectionName, _removeItem, _category]] call ace_common_fnc_localEvent; - -if ([_target] call FUNC(hasMedicalEnabled)) then { - [_target] call FUNC(addToInjuredCollection); -}; - -true; diff --git a/addons/medical/functions/fnc_handleTreatment_Action_AdvancedLocal.sqf b/addons/medical/functions/fnc_handleTreatment_Action_AdvancedLocal.sqf deleted file mode 100644 index 1afb25f44c..0000000000 --- a/addons/medical/functions/fnc_handleTreatment_Action_AdvancedLocal.sqf +++ /dev/null @@ -1,45 +0,0 @@ -/** - * fnc_handleTreatment_Action_AdvancedLocal.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - -#include "script_component.hpp" - -private ["_unit", "_caller", "_selectionName", "_removeItem", "_prevAnim", "_value"]; -_caller = _this select 0; -_target = _this select 1; -_selectionName = _this select 2; -_removeItem = _this select 3; -_prevAnim = _this select 4; - -// TODO old code, has to be replaced by something more dynamic. -_attributes = switch (_removeItem) do { - case "ACE_blood_iv": {[QGVAR(bloodIVVolume),1000,"Blood IV"]}; - case "ACE_saline_iv": {[QGVAR(salineIVVolume),1000,"Saline IV"]}; - case "ACE_plasma_iv": {[QGVAR(plasmaIVVolume),1000,"Plasma IV"]}; - - case "ACE_blood_iv_500": {[QGVAR(bloodIVVolume),500,"Blood IV"]}; - case "ACE_saline_iv_500": {[QGVAR(salineIVVolume),500,"Saline IV"]}; - case "ACE_plasma_iv_500": {[QGVAR(plasmaIVVolume),500,"Plasma IV"]}; - - case "ACE_blood_iv_250": {[QGVAR(bloodIVVolume),250,"Blood IV"]}; - case "ACE_saline_iv_250": {[QGVAR(salineIVVolume),250,"Saline IV"]}; - case "ACE_plasma_iv_250": {[QGVAR(plasmaIVVolume),250,"Plasma IV"]}; - - default {[]}; -}; - -if (count _attributes > 1) then { - _value = [_target,(_attributes select 0)] call EFUNC(common,getDefinedVariable); - _value = _value + (_attributes select 1); - [_target,(_attributes select 0),_value] call EFUNC(common,setDefinedVariable); - - // TODO localization - [_target,"treatment",format["%1 has given %4 a %2(%3ml)",[_caller] call EFUNC(common,getName),_attributes select 2,_attributes select 1,_target]] call FUNC(addActivityToLog); - [_target,_removeItem] call FUNC(addToTriageList); -}; diff --git a/addons/medical/functions/fnc_handleTreatment_Action_AirwayLocal.sqf b/addons/medical/functions/fnc_handleTreatment_Action_AirwayLocal.sqf deleted file mode 100644 index a140f74f6b..0000000000 --- a/addons/medical/functions/fnc_handleTreatment_Action_AirwayLocal.sqf +++ /dev/null @@ -1,36 +0,0 @@ -/** - * fn_treatmentAirwayLocal.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - -#include "script_component.hpp" - -private ["_caller","_target","_selectedData", "_selectionName", "_prevAnim", "_displayingIcon", "_part"]; -_caller = _this select 0; -_target = _this select 1; -_selectionName = _this select 2; -_removeItem = _this select 3; - - -if (!local _target) exitwith{}; - -[_target,"STR_ACE_AIRWAY","STR_ACE_IS_TREATING_YOUR_AIRWAY",0, [([_caller] call EFUNC(common,getName))]] call EFUNC(gui,sendDisplayMessageTo); -[_target,_removeItem] call FUNC(addToTriageList); - - -_airwayStatus = [_target,QGVAR(airway)] call EFUNC(common,getDefinedVariable); -if (_airwayStatus > 0) then { - if (!([_treatingPerson] call FUNC(isMedic))) then { - _target setvariable [QGVAR(airwayTreated), true, true]; - } else { - if (random (1) >= 0.35) then { - _target setvariable [QGVAR(airwayTreated), true, true]; - }; - }; -}; -true \ No newline at end of file diff --git a/addons/medical/functions/fnc_handleTreatment_Action_BandageLocal.sqf b/addons/medical/functions/fnc_handleTreatment_Action_BandageLocal.sqf deleted file mode 100644 index c6a09fa4de..0000000000 --- a/addons/medical/functions/fnc_handleTreatment_Action_BandageLocal.sqf +++ /dev/null @@ -1,143 +0,0 @@ -/** - * fn_bandageLocal.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - -#include "script_component.hpp" - -private ["_caller","_Target","_selectionName","_removeItem","_part","_openWounds","_woundsArray","_highest_amount","_highestSpot","_collectiveImpact", "_highestTotal","_totalNumber", "_selectedData"]; -_caller = _this select 0; -_target = _this select 1; -_selectionName = _this select 2; -_removeItem = _this select 3; - -// TODO figure this out later on -//_selectedData = [_this, 4, "", [""]] call BIS_fnc_Param; - -if (!local _target) exitwith{ - ["fnc_bandageLocal called on non local machine",3] call EFUNC(common,debug); -}; - -if (_caller != _target) then { - [_target,"STR_ACE_BANDAGING", "STR_ACE_IS_BANDAGING_YOU", 0, [[_treatingPerson] call EFUNC(common,getName)]] call EFUNC(gui,sendDisplayMessageTo); -}; - -[_target,_removeItem] call FUNC(addToTriageList); - -// TODO make dynamic -_collectiveImpact = switch (_removeItem) do { - case "ACE_packing_bandage": {[1.0, 1.5, 1.2]}; - case "ACE_bandageElastic": {[1.3, 0.9, 0.9]}; - case "ACE_bandage_basic": {[1.5, 1.0, 0.6]}; - case "ACE_stitching": {[2.0, 2.0, 2.0]}; - case "ACE_quikclot": {[0.9, 0.3, 0.3]}; - default {[0.9, 0.5, 0.5]}; -}; - -_part = [_selectionName] call FUNC(getBodyPartNumber); - -_openWounds = [_target,QGVAR(openWounds)] call EFUNC(common,getDefinedVariable); -_woundsArray = _openWounds select _part; - -// Find the type of which we have the most injures and the amount of this for the selected bodypart. -_highestSpot = 0; -_highest_amount = 0; -{ - if (_x > _highest_amount) then { - _highestSpot = _foreachIndex; - _highest_amount = _x; - }; -}foreach _woundsArray; - -// If we have bandaging aid enabled (on easy difficulty), we will find the body part with the most injuries and use that instead. -if (GVAR(setting_enableBandagingAid)) then { - _highestTotal = 0; - { - // find out how many injuries this bodypart has - _totalNumber = 0; - { - _totalNumber = _totalNumber + _x; - }foreach _x; - - // Check if this body part has the highest amount of injuries - if (_totalNumber > _highestTotal) then { - _part = _foreachIndex; - _highestTotal = _totalNumber; - }; - }foreach _openWounds; - - // Find the type of which we have the most injures and the amount of this for the selected bodypart. - _woundsArray = _openWounds select _part; - _highestSpot = 0; - _highest_amount = 0; - { - if (_x > _highest_amount) then { - _highestSpot = _foreachIndex; - _highest_amount = _x; - }; - }foreach _woundsArray; -}; - -// Find the amount of impact the used bandage has for the injury -_impactOfBandage = (_collectiveImpact select _highestSpot); - -_wounds = _highest_amount; -_amountOfInpact = 0; - -// if we have wounds, log that we have bandaged those and find the real impact of the bandage -if (_wounds > 0) then { - [_target,"treatment",format["%2 has bandaged a wound on %1",[_part] call FUNC(fromNumberToBodyPart),[_caller] call EFUNC(common,getName)]] call FUNC(addActivityToLog); - - _amountOfInpact = _impactOfBandage; - if (_impactOfBandage > _wounds) then { - _amountOfInpact = _wounds; - }; -}; - -// Decrease the impact -_wounds = (_wounds - _impactOfBandage); -if (_wounds < 0) then { - _wounds = 0; -}; -// Adjust the wounds value for the unit -_woundsArray set[_highestSpot, _wounds]; -_openWounds set [_part, _woundsArray]; -[_target,QGVAR(openWounds),_openWounds] call EFUNC(common,setDefinedVariable); - - -// Check if we have wounds opening enabled -if (isnil QGVAR(setting_advancedWoundsSetting)) then { - GVAR(setting_advancedWoundsSetting) = true; -}; -if (_amountOfInpact > 0.0 && GVAR(setting_advancedWoundsSetting)) then { - - // Find the bandaged body part - _bandagedWounds = [_target,QGVAR(bandagedWounds)] call EFUNC(common,getDefinedVariable); - _bandagedPart = _bandagedWounds select _part; - - // Increase the amount of bandaged wounds - _bandagedWound = _bandagedPart select _highestSpot; - _bandagedPart set [_highestSpot,_bandagedWound + _amountOfInpact]; - _bandagedWounds set[_part,_bandagedPart]; - - // Store the new bandaged wounds - [_target,QGVAR(bandagedWounds),_bandagedWounds] call EFUNC(common,setDefinedVariable); - - // Do not provide the possibility for small injuries to open again - if (_highestSpot > 0) then { - [_target, _amountOfInpact,_part,_highestSpot, _removeItem] call FUNC(handleBandageOpening); - }; -}; - -// If all wounds have been bandaged, we will reset all damage to 0. -if (!([_target] call FUNC(hasOpenWounds))) then { - _target setDamage 0; - // TODO also set hitpoints to 0 -}; - -true \ No newline at end of file diff --git a/addons/medical/functions/fnc_handleTreatment_Action_CPR.sqf b/addons/medical/functions/fnc_handleTreatment_Action_CPR.sqf deleted file mode 100644 index 61e12687a7..0000000000 --- a/addons/medical/functions/fnc_handleTreatment_Action_CPR.sqf +++ /dev/null @@ -1,71 +0,0 @@ -/** - * fn_performCPR.sqf - * @Descr: Start the CPR action from CMS. Caller unit will attempt to restart the targets heart using CPR. - * @Author: Glowbal - * - * @Arguments: [unit OBJECT (The unit that cPR will be performed upon), caller OBJECT (The unit that does the CPR action)] - * @Return: void - * @PublicAPI: true - */ - -#include "script_component.hpp" - -#define CPR_TIME 25 // time in seconds - -private ["_caller","_target", "_selectionName", "_prevAnim"]; -_caller = _this select 0; -_target = _this select 1; -_selectionName = _this select 2; -_removeItem = _this select 3; -_prevAnim = _this select 4; - -// only allow CPR once -if (_caller getvariable[QGVAR(isProvidingCPR), false]) exitwith {true}; - -_caller setvariable[QGVAR(isProvidingCPR), true, true]; - -[_this] call EFUNC(common,debug); -[_caller] call FUNC(treatmentMutex); - -if (_target == _caller) exitwith{[_caller,"You cannot give yourself CPR"] call EFUNC(common,sendHintTo); true}; - -[_caller,"You start providing CPR"] call EFUNC(common,sendHintTo); - -if (vehicle _target == _target) then { - [_unit,"AinjPpneMstpSnonWrflDnon_rolltoback", 1] call EFUNC(common,doAnimation); -}; - -_caller setvariable [QGVAR(StartingPositionHandleTreatment), getPos _caller]; -[CPR_TIME, - {((vehicle (_this select 0) != (_this select 0)) ||((getPos (_this select 0)) distance ((_this select 0) getvariable QGVAR(StartingPositionHandleTreatment)) < 1)) && (_caller getvariable[QGVAR(isProvidingCPR), false])}, // the condition - { - private ["_caller","_target", "_selectionName", "_prevAnim"]; - _caller = _this select 0; - _target = _this select 1; - _selectionName = _this select 2; - _removeItem = _this select 3; - - [[_caller, _target], QUOTE(FUNC(handleTreatment_Action_CPRLocal)), _target] call EFUNC(common,execRemoteFnc); - if (_prevAnim != "") then { - [_caller,_prevAnim, 0] call EFUNC(common,doAnimation); - }; - - _caller setvariable[QGVAR(isProvidingCPR), nil, true]; - ["Medical_handleTreatment_CPR", [_caller, _target, _selectionName, _removeItem, true]] call ace_common_fnc_localEvent; - ["Medical_treatmentCompleted", [_caller, _target, _selectionName, _removeItem]] call ace_common_fnc_localEvent; - }, // on success - { - private ["_caller","_target", "_selectionName", "_prevAnim"]; - [(_this select 0), "STR_ACE_CANCELED", ["STR_ACE_ACTION_CANCELED","STR_ACE_YOU_MOVED_AWAY"]] call EFUNC(gui,sendDisplayInformationTo); - - if (_prevAnim != "") then { - [_caller,_prevAnim, 0] call EFUNC(common,doAnimation); - }; - _caller setvariable[QGVAR(isProvidingCPR), nil, true]; - ["Medical_handleTreatment_CPR", [_caller, _target, _selectionName, _removeItem, false]] call ace_common_fnc_localEvent; - ["Medical_treatmentCompleted", [_caller, _target, _selectionName, _removeItem]] call ace_common_fnc_localEvent; - }, // on failure - [_caller, _target, _selectionName, _removeItem, _prevAnim] // arguments -] call EFUNC(gui,loadingBar); - -true; \ No newline at end of file diff --git a/addons/medical/functions/fnc_handleTreatment_Action_MedicationLocal.sqf b/addons/medical/functions/fnc_handleTreatment_Action_MedicationLocal.sqf deleted file mode 100644 index d10bce389a..0000000000 --- a/addons/medical/functions/fnc_handleTreatment_Action_MedicationLocal.sqf +++ /dev/null @@ -1,182 +0,0 @@ -/** - * fnc_handleTreatment_Action_MedicationLocal.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - -#include "script_component.hpp" - -private ["_caller","_target","_selectionName","_removeItem","_attributes"]; -_caller = _this select 0; -_target = _this select 1; -_selectionName = _this select 2; -_removeItem = _this select 3; - -_attributes = switch (_removeItem) do { - case "ACE_morphine": { - [QGVAR(givenMorphine),"Morphine"] - }; - case "ACE_atropine": { - [QGVAR(givenAtropine),"Atropine"] - }; - case "ACE_epinephrine": { - [QGVAR(givenEpinephrine),"Epinephrine"] - }; - default {[]}; -}; - -if (count _attributes > 1) then { - private ["_value","_patient"]; - [_target] call FUNC(addToInjuredCollection); - _value = [_target,(_attributes select 0)] call EFUNC(common,getDefinedVariable); - [_target,(_attributes select 0),_value + 1] call EFUNC(common,setDefinedVariable); - - _patient = "patient"; - if (_target == _caller) then { - _patient = "himself"; - }; - [_target,"treatment",format["%1 has given %3 %2",[_caller] call EFUNC(common,getName), (_attributes select 1),_patient]] call FUNC(addActivityToLog); - [_target,_removeItem] call FUNC(addToTriageList); - - _usedMedication = { - private ["_target","_var","_usedMed","_morphineUsed","_epiUsed","_atroUsed","_totalUsed"]; - _target = _this select 0; - _var = _this select 1; - _overDose = 5; - _wearOff = 120; - - if (!alive _target) exitwith{}; - if (count _this > 2) then { - _overDose = _this select 2; - if (count _this > 3) then { - _wearOff = _this select 3; - }; - }; - _usedMed = [_target, _var, 0] call EFUNC(common,getDefinedVariable); - if (isnil "_usedMed") then { - _usedMed = 0; - }; - if (_usedMed > (_overDose + round(random(2)))) then { - [_target] call EFUNC(common,setDead); - }; - - _morphineUsed = _target getvariable [QGVAR(givenMorphine), 0]; - _epiUsed = _target getvariable [QGVAR(givenEpinephrine), 0]; - _atroUsed = _target getvariable [QGVAR(givenAtropine), 0]; - _totalUsed = _morphineUsed + _epiUsed + _atroUsed; - - if (_totalUsed > 10) then { - [_target] call EFUNC(common,setDead); - }; - _wearOff = _wearOff + (round(random(30))); - - [{ - _target = _this select 0; - _wearOff = _this select 1; - _var = _this select 2; - - _amountDecreased = 0; - _usedMed = [_this select 0, _this select 2] call EFUNC(common,getDefinedVariable); - if (typeName _usedMed != typeName 0) then { - _usedMed = 0; - }; - - if (_usedMed > 0) then { - [{ - _args = _this select 0; - _amountDecreased = _args select 3; - _usedMed = ([_args select 0, _args select 2] call EFUNC(common,getDefinedVariable)); - [_args select 0, _args select 2,_usedMed - 0.001] call EFUNC(common,setDefinedVariable); - _amountDecreased = _amountDecreased + 0.001; - - if (_amountDecreased >= 1 || (_usedMed - 0.001 <= 0)) then { - [(_this select 1)] call cba_fnc_removePerFrameHandler; - }; - _args set [3, _amountDecreased]; - }, 1, [_target, _wearOff,_var, 0] ] call CBA_fnc_addPerFrameHandler; - }; - }, [_target, _wearOff, _var], _wearOff, _wearOff] call EFUNC(common,waitAndExecute); - - }; - - private ["_heartRate","_pain"]; - - switch (_removeItem) do { - case "ACE_atropine": { - - _heartRate = [_target, QGVAR(heartRate)] call EFUNC(common,getDefinedVariable); - //_heartRate = [_target, QGVAR(heartRate)] call EFUNC(common,getDefinedVariable); - if (alive _target) then { - if (_heartRate > 0) then { - if (_heartRate <= 40) then { - [_target, -(10 + random(20)), 30] call FUNC(addHeartRateAdjustment); - }; - - if (_heartRate > 40) then { - if (_heartRate > 120) then { - [_target, -(10 + random(50)), 30] call FUNC(addHeartRateAdjustment); - } else { - [_target, -(10 + random(40)), 30] call FUNC(addHeartRateAdjustment); - }; - }; - }; - //[_target, QGVAR(heartRate),_heartRate] call EFUNC(common,setDefinedVariable); - [_target,(_attributes select 0),5] call _usedMedication; - }; - }; - case "ACE_epinephrine": { - _heartRate = [_target, QGVAR(heartRate)] call EFUNC(common,getDefinedVariable); - if (alive _target) then { - if (_heartRate > 0) then { - if (_heartRate <= 40) then { - [_target, (10 + random(20)), 30] call FUNC(addHeartRateAdjustment); - }; - - if (_heartRate > 40) then { - if (_heartRate > 120) then { - [_target, (10 + random(50)), 30] call FUNC(addHeartRateAdjustment); - } else { - [_target, (10 + random(40)), 30, {}] call FUNC(addHeartRateAdjustment); - }; - }; - }; - [_target,(_attributes select 0),3] call _usedMedication; - }; - }; - case "ACE_morphine": { - private ["_usedMorphine"]; - _pain = [_target, QGVAR(amountOfPain)] call EFUNC(common,getDefinedVariable); - _pain = 0; - //_pain = _pain - 35; - if (_pain <= 0) then { - _pain = 0; - }; - _heartRate = [_target, QGVAR(heartRate)] call EFUNC(common,getDefinedVariable); - [format["used morphine: %1",_heartRate]] call EFUNC(common,debug); - if (alive _target) then { - if (_heartRate > 0) then { - if (_heartRate <= 40) then { - [_target, -(10 + random(20)), 40] call FUNC(addHeartRateAdjustment); - }; - if (_heartRate > 40) then { - if (_heartRate > 120) then { - [_target, -(10 + random(50)), 40] call FUNC(addHeartRateAdjustment); - } else { - [_target, -(10 + random(40)), 40] call FUNC(addHeartRateAdjustment); - }; - }; - }; - }; - [_target, QGVAR(amountOfPain),_pain] call EFUNC(common,setDefinedVariable); - [_target,(_attributes select 0),4,120] call _usedMedication; - }; - default { - - }; - }; -}; -true \ No newline at end of file diff --git a/addons/medical/functions/fnc_handleTreatment_Action_Stitching.sqf b/addons/medical/functions/fnc_handleTreatment_Action_Stitching.sqf deleted file mode 100644 index a6e9156966..0000000000 --- a/addons/medical/functions/fnc_handleTreatment_Action_Stitching.sqf +++ /dev/null @@ -1,104 +0,0 @@ -/** - * fn_performStitching.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - -#include "script_component.hpp" - -#define WAITING_TIME_SMALL 2.5 -#define WAITING_TIME_MEDIUM 3.5 -#define WAITING_TIME_LARGE 4.5 - -#define WAITING_TIMES_WOUNDS [WAITING_TIME_SMALL, WAITING_TIME_MEDIUM, WAITING_TIME_LARGE] - -private ["_injuredPerson", "_treatingPerson", "_selectionName", "_removeItem", "_prevAnim", "_bandagedWounds", "_bodyPartN", "_allWounds", "_totalWoundsCount", "_totalTime", "_startTimeOfStitching", "_indexStitch", "_woundstoStitchOf", "_afterStitchingWoundsCount", "_waitingTime", "_i", "_startTime", "_messageSend"]; -_caller = _this select 0; -_target = _this select 1; -_selectionName = _this select 2; -_removeItem = _this select 3; -_prevAnim = _this select 4; - -[_caller,"STR_ACE_STITCHING","STR_ACE_START_STITCHING_INJURIES", 0, [[_injuredPerson] call EFUNC(common,getName),_selectionName]] call EFUNC(gui,sendDisplayMessageTo); - -_bandagedWounds = [_injuredPerson,QGVAR(bandagedWounds)] call EFUNC(common,getDefinedVariable); -_bodyPartN = [_selectionName] call FUNC(getBodyPartNumber); - -_allWounds = _bandagedWounds select _bodyPartN; -_totalTime = ((_allWounds select 0) * WAITING_TIME_MEDIUM) + ((_allWounds select 1) * WAITING_TIME_MEDIUM) + ((_allWounds select 2) * WAITING_TIME_MEDIUM); - - -// Get the current position for the treatment person -_caller setvariable [QGVAR(StartingPositionHandleTreatment), getPos _caller]; - -_caller setvariable [QGVAR(lastStichPerformed), diag_tickTime]; -[{ - private ["_caller","_target", "_selectionName", "_prevAnim", "_removeItem","_args"]; - _args = _this select 0; - _caller = _args select 0; - _target = _args select 1; - _selectionName = _args select 2; - _removeItem = _args select 3; - _prevAnim = _args select 4; - - if ((vehicle _caller != _caller) || ((getPos _caller) distance (_caller getvariable GVAR(ORIGINAL_POSITION_PLAYER))) >= 1) then { - [(_this select 0), "STR_ACE_CANCELED", ["STR_ACE_ACTION_CANCELED","STR_ACE_YOU_MOVED_AWAY"]] call EFUNC(gui,sendDisplayInformationTo); - - if (_prevAnim != "") then { - [_caller,_prevAnim, 0] call EFUNC(common,doAnimation); - }; - [QGVAR(treatmentIconID), false, QUOTE(PATHTOF(data\icons\icon_advanced_treatment.paa)), [1,1,1,1]] call EFUNC(gui,displayIcon); - ["Medical_handleTreatment_Stitching", [_caller, _target, _selectionName, _removeItem, false]] call ace_common_fnc_localEvent; - ["Medical_treatmentCompleted", [_caller, _target, _selectionName, _removeItem]] call ace_common_fnc_localEvent; - - [(_this select 1)] call cba_fnc_removePerFrameHandler; - }; - - if (diag_tickTime - (_caller getvariable [QGVAR(lastStichPerformed), diag_tickTime - WAITING_TIME_MEDIUM]) >= WAITING_TIME_MEDIUM) then { - _caller setvariable [QGVAR(lastStichPerformed), diag_tickTime]; - - _bandagedWounds = [_target,QGVAR(bandagedWounds)] call EFUNC(common,getDefinedVariable); - _allWounds = _bandagedWounds select _bodyPartN; - { - if (_x > 0) exitwith { - _value = _x - 1; - if (_value < 0) then { - _value = 0; - }; - - _allWounds set[_foreachIndex, _value]; - }; - }foreach _allWounds; - - _bandagedWounds set [_bodyPartN, _allWounds]; - [_target, QGVAR(bandagedWounds), _bandagedWounds] call EFUNC(common,setDefinedVariable); - - if (((_allWounds select 0) * 2.5) + ((_allWounds select 1) * 3.5) + ((_allWounds select 2) * 4.5) <= 0) then { - [_target,"treatment",format["%1 has stitched up some bandages wounds",[_caller] call EFUNC(common,getName)]] call FUNC(addActivityToLog); - - if (_prevAnim != "") then { - [_caller,_prevAnim, 0] call EFUNC(common,doAnimation); - }; - [QGVAR(treatmentIconID), false, QUOTE(PATHTOF(data\icons\icon_advanced_treatment.paa)), [1,1,1,1]] call EFUNC(gui,displayIcon); - ["Medical_handleTreatment_Stitching", [_caller, _target, _selectionName, _removeItem, true]] call ace_common_fnc_localEvent; - ["Medical_treatmentCompleted", [_caller, _target, _selectionName, _removeItem]] call ace_common_fnc_localEvent; - - [(_this select 1)] call cba_fnc_removePerFrameHandler; - }; - }; -}, 0.1, [_caller, _target, _selectionName, _removeItem, _prevAnim] ] call CBA_fnc_addPerFrameHandler; - - -// Necessary for showing the loading bar along side -[_totalTime, // the time to wait - {_caller = _this select 0; ((vehicle _caller != _caller) ||((getPos _caller) distance GVAR(ORIGINAL_POSITION_PLAYER)) < 1)}, // the condition, called every frame - {}, // on success - {}, // on failure - [_caller] // arguments -] call EFUNC(gui,loadingBar); - -true; \ No newline at end of file diff --git a/addons/medical/functions/fnc_handleTreatment_Action_fullHeal.sqf b/addons/medical/functions/fnc_handleTreatment_Action_fullHeal.sqf deleted file mode 100644 index 53f82f74f0..0000000000 --- a/addons/medical/functions/fnc_handleTreatment_Action_fullHeal.sqf +++ /dev/null @@ -1,74 +0,0 @@ -/** - * fn_heal.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - -#include "script_component.hpp" - -private ["_unit", "_caller", "_selectionName", "_removeItem", "_prevAnim"]; -_caller = _this select 0; -_target = _this select 1; -_selectionName = _this select 2; -_removeItem = _this select 3; -_prevAnim = _this select 4; - -if !((GVAR(setting_aidKitRestrictions) == 0 && ([_caller] call FUNC(inMedicalFacility))) || (GVAR(setting_aidKitRestrictions) == 1 && ([_caller] call FUNC(inMedicalFacility)) && (!([_unit] call FUNC(hasOpenWounds)))) || (GVAR(setting_aidKitRestrictions) == 2) || (GVAR(setting_aidKitRestrictions) == 3 && (!([_unit] call FUNC(hasOpenWounds))))) exitwith {false}; - - -// Get the current position for the treatment person -_caller setvariable [QGVAR(StartingPositionHandleTreatment), getPos _caller]; - -[7, // the time to wait - {((vehicle (_this select 0) != (_this select 0)) ||((getPos (_this select 0)) distance ((_this select 0) getvariable QGVAR(StartingPositionHandleTreatment)) < 1))}, // the condition, called every frame - { - private ["_caller","_target", "_selectionName", "_prevAnim", "_removeItem"]; - _caller = _this select 0; - _target = _this select 1; - _selectionName = _this select 2; - _removeItem = _this select 3; - _prevAnim = _this select 4; - - if (GVAR(setting_removeAidKitOnUse)) then { - [_caller, _target, _removeItem] call FUNC(useEquipment); - }; - [[_caller, _target], QUOTE(FUNC(handleTreatment_Action_HealLocal)), _target] call EFUNC(common,execRemoteFnc); - - if (_prevAnim != "") then { - [_caller,_prevAnim, 0] call EFUNC(common,doAnimation); - }; - - [QGVAR(treatmentIconID), false, "", [1,1,1,1]] call EFUNC(gui,displayIcon); - ["Medical_handleTreatment_FullHeal", [_caller, _target, _selectionName, _removeItem, true]] call ace_common_fnc_localEvent; - ["Medical_treatmentCompleted", [_caller, _target, _selectionName, _removeItem]] call ace_common_fnc_localEvent; - }, // on success - { - private ["_caller","_target", "_selectionName", "_prevAnim", "_removeItem"]; - _caller = _this select 0; - _target = _this select 1; - _selectionName = _this select 2; - _removeItem = _this select 3; - _prevAnim = _this select 4; - - [(_this select 0), "STR_ACE_CANCELED", ["STR_ACE_ACTION_CANCELED","STR_ACE_YOU_MOVED_AWAY"]] call EFUNC(gui,sendDisplayInformationTo); - - if (_prevAnim != "") then { - [_caller,_prevAnim, 0] call EFUNC(common,doAnimation); - }; - - [QGVAR(treatmentIconID), false, "", [1,1,1,1]] call EFUNC(gui,displayIcon); - ["Medical_handleTreatment_FullHeal", [_caller, _target, _selectionName, _removeItem, false]] call ace_common_fnc_localEvent; - ["Medical_treatmentCompleted", [_caller, _target, _selectionName, _removeItem]] call ace_common_fnc_localEvent; - }, // on failure - [_caller, _target, _selectionName, _removeItem, _prevAnim] // arguments -] call EFUNC(gui,loadingBar); - - -if (!(_unit getvariable [QEGVAR(common,isDead),false]) && alive _unit) then { - [[_unit,_caller], QUOTE(FUNC(healLocal)), _unit] call EFUNC(common,execRemoteFnc); -}; -true; \ No newline at end of file diff --git a/addons/medical/functions/fnc_handleTreatment_Action_fullHealLocal.sqf b/addons/medical/functions/fnc_handleTreatment_Action_fullHealLocal.sqf deleted file mode 100644 index 1d08a00e23..0000000000 --- a/addons/medical/functions/fnc_handleTreatment_Action_fullHealLocal.sqf +++ /dev/null @@ -1,67 +0,0 @@ -/** - * fn_healLocal.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - -#include "script_component.hpp" - -private ["_unit", "_caller"]; -_unit = _this select 0; -_caller = _this select 1; - -if (alive _unit) exitwith { - [_unit,"treatment",format["%1 used a personal aid kit",[_caller] call EFUNC(common,getName)]] call FUNC(addActivityToLog); - - // Public variables - [_unit,QGVAR(openWounds),[[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0]]] call EFUNC(common,setDefinedVariable); - [_unit,QGVAR(bandagedWounds),[[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0]]] call EFUNC(common,setDefinedVariable); - - if (GVAR(setting_AdvancedLevel) > 0) then { - [_unit,QGVAR(fractures),[[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0]]] call EFUNC(common,setDefinedVariable); - [_unit,QGVAR(airway),0] call EFUNC(common,setDefinedVariable); - [_unit,QGVAR(splints),0] call EFUNC(common,setDefinedVariable); - }; - - [_unit,QGVAR(tourniquets),[0,0,0,0,0,0]] call EFUNC(common,setDefinedVariable); - - //[QGVAR(activityLog),[]] call EFUNC(common,setDefinedVariable); - [_unit,QGVAR(triageLevel),0] call EFUNC(common,setDefinedVariable); - [_unit,QGVAR(triageCard),[]] call EFUNC(common,setDefinedVariable); - - // Private variables - [_unit,QGVAR(bloodVolume),100] call EFUNC(common,setDefinedVariable); - [_unit,QGVAR(bloodIVVolume),0] call EFUNC(common,setDefinedVariable); - [_unit,QGVAR(plasmaIVVolume),0] call EFUNC(common,setDefinedVariable); - [_unit,QGVAR(salineIVVolume),0] call EFUNC(common,setDefinedVariable); - - if (GVAR(setting_AdvancedLevel) > 0) then { - [_unit,QGVAR(heartRate),80] call EFUNC(common,setDefinedVariable); - [_unit,QGVAR(andrenaline),0] call EFUNC(common,setDefinedVariable); - [_unit,QGVAR(bloodPressure),[80,120]] call EFUNC(common,setDefinedVariable); - }; - [_unit,QGVAR(amountOfPain),0] call EFUNC(common,setDefinedVariable); - - [_unit,QGVAR(givenMorphine),0] call EFUNC(common,setDefinedVariable); - [_unit,QGVAR(givenAtropine),0] call EFUNC(common,setDefinedVariable); - [_unit,QGVAR(givenEpinephrine),0] call EFUNC(common,setDefinedVariable); - - [_unit,QGVAR(bodyPartStatus),[0,0,0,0,0,0]] call EFUNC(common,setDefinedVariable); - - // Resetting damage - _unit setDamage 0; - - // Resetting potential revive state - [_unit,QEGVAR(common,ENABLE_REVIVE_SETDEAD_F), 0] call EFUNC(common,setDefinedVariable); - [_unit,QEGVAR(common,ENABLE_REVIVE_COUNTER), 0] call EFUNC(common,setDefinedVariable); - - - ["Medical_onFullyHealed", [_unit, true]] call ace_common_fnc_localEvent; - [format["Completed healLocal %1", _this]] call EFUNC(common,debug); -}; - -["Medical_onFullyHealed", [_unit, false]] call ace_common_fnc_localEvent; \ No newline at end of file diff --git a/addons/medical/functions/fnc_handleTreatment_Action_tourniquet.sqf b/addons/medical/functions/fnc_handleTreatment_Action_tourniquet.sqf deleted file mode 100644 index 6b9e9b3f5d..0000000000 --- a/addons/medical/functions/fnc_handleTreatment_Action_tourniquet.sqf +++ /dev/null @@ -1,36 +0,0 @@ -/** - * fnc_handleTreatment_Action_tourniquet.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - -#include "script_component.hpp" - -private ["_caller","_target","_part","_selectionName","_removeItem", "_tourniquets"]; -_caller = _this select 0; -_target = _this select 1; -_selectionName = _this select 2; -_removeItem = _this select 3; - -_part = [_selectionName] call FUNC(getBodyPartNumber); -if (_part == 0 || _part == 1) exitwith { - [_caller,"You cannot apply a CAT on this body part!"] call EFUNC(common,sendHintTo); - false; -}; - -[_caller, _target, _removeItem] call FUNC(useEquipment); - -_tourniquets = [_target, QGVAR(tourniquets)] call EFUNC(common,getDefinedVariable); -if ((_tourniquets select _part) > 0) exitwith { - [_caller,"There is already a tourniquet on this body part!"] call EFUNC(common,sendHintTo); - false; -}; - -[_caller, _unit,_removeItem] call FUNC(useEquipment); -[[_caller, _target, _selectionName, _removeItem], QUOTE(FUNC(handleTreatment_Action_TourniquetLocal)), _unit] call EFUNC(common,execRemoteFnc); - -true \ No newline at end of file diff --git a/addons/medical/functions/fnc_handleTreatment_Action_tourniquetLocal.sqf b/addons/medical/functions/fnc_handleTreatment_Action_tourniquetLocal.sqf deleted file mode 100644 index f2ce6ff6a5..0000000000 --- a/addons/medical/functions/fnc_handleTreatment_Action_tourniquetLocal.sqf +++ /dev/null @@ -1,56 +0,0 @@ -/** - * fnc_handleTreatment_Action_tourniquetLocal.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - -#include "script_component.hpp" - -private ["_caller","_target","_part","_selectionName","_removeItem", "_tourniquets", "_applyingTo"]; -_caller = _this select 0; -_target = _this select 1; -_selectionName = _this select 2; -_removeItem = _this select 3; - - -[_target,"treatment",format["%1 applied a tourniquet on %2",[_caller] call EFUNC(common,getName),_selectionName]] call FUNC(addActivityToLog); -[_target,_removeItem] call FUNC(addToTriageList); -[_target] call FUNC(addToInjuredCollection); - - -_part = [_selectionName] call FUNC(getBodyPartNumber); - -// Place a tourniquet on the bodypart -_tourniquets = [_target, QGVAR(tourniquets)] call EFUNC(common,getDefinedVariable); -_applyingTo = (_tourniquets select _part) + 1 + round(random(100)); -_tourniquets set[_part, _applyingTo]; -[_target, QGVAR(tourniquets), _tourniquets] call EFUNC(common,setDefinedVariable); - -[{ - private ["_args","_target","_applyingTo","_part", "_tourniquets"]; - _args = _this select 0; - _target = _args select 0; - _applyingTo = _args select 1; - _part = _args select 2; - - if (!alive _target) exitwith { - [(_this select 1)] call cba_fnc_removePerFrameHandler; - }; - - _tourniquets = [_injuredPerson,QGVAR(tourniquets)] call EFUNC(common,getDefinedVariable); - if !((_tourniquets select _part) == _applyingTo) exitwith { - // Tourniquet has been removed - [(_this select 1)] call cba_fnc_removePerFrameHandler; - }; - - _pain = [_target, QGVAR(amountOfPain)] call EFUNC(common,getDefinedVariable); - _pain = _pain + 0.005; - [_target, QGVAR(amountOfPain),_pain] call EFUNC(common,setDefinedVariable); - -}, 5, [_target, _applyingTo, _part] ] call CBA_fnc_addPerFrameHandler; - -true \ No newline at end of file diff --git a/addons/medical/functions/fnc_handleTreatment_Category_Advanced.sqf b/addons/medical/functions/fnc_handleTreatment_Category_Advanced.sqf deleted file mode 100644 index 2189a57a29..0000000000 --- a/addons/medical/functions/fnc_handleTreatment_Category_Advanced.sqf +++ /dev/null @@ -1,94 +0,0 @@ -/** - * fnc_handleTreatment_Category_Advanced.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - -#include "script_component.hpp" - -// Time in seconds -#define ADVANCED_TREATMENT_TIME 5 - -private ["_caller","_target","_selectedData", "_selectionName", "_prevAnim", "_displayingIcon"]; -_caller = _this select 0; -_target = _this select 1; -_selectionName = _this select 2; -_removeItem = _this select 3; - -// TODO add fake weapon for treatment, in case no primairy weapon is present -// Handle the animations -_prevAnim = ""; -if (vehicle _caller == _caller && (vehicle _target == _target) && !(stance _caller == "PRONE")) then { - if (primaryWeapon _caller == "") then { - _prevAnim = animationState _caller; - }; - [_caller,"AinvPknlMstpSlayWrflDnon_medic", 1] call EFUNC(common,doAnimation); -}; - -if (ACE_player == _caller) then { - // Displaying the treatment icon action - [QGVAR(treatmentIconID), true, QUOTE(PATHTOF(data\icons\icon_advanced_treatment.paa)), [1,1,1,1]] call EFUNC(gui,displayIcon); -}; - -_isHandled = switch (_removeItem) do { - case "ACE_personal_aid_kit": { - ([_caller, _target, _selectionName, _removeItem, _prevAnim] call FUNC(handleTreatment_Action_FullHeal)); - }; - case "ACE_surgical_kit": { - ([_caller, _target, _selectionName, _removeItem, _prevAnim] call FUNC(handleTreatment_Action_Stitching)); - }; - case "ACE_CPR": { - ([_caller, _target, _selectionName, _removeItem, _prevAnim] call FUNC(handleTreatment_Action_CPR)); - }; - default { - // handle it ourself - - // Get the current position for the treatment person - _caller setvariable [QGVAR(StartingPositionHandleTreatment), getPos _caller]; - - [ADVANCED_TREATMENT_TIME, // the time to wait - {((vehicle (_this select 0) != (_this select 0)) ||((getPos (_this select 0)) distance ((_this select 0) getvariable QGVAR(StartingPositionHandleTreatment)) < 1))}, // the condition, called every frame - { - private ["_caller","_target", "_selectionName", "_prevAnim", "_removeItem"]; - _caller = _this select 0; - _target = _this select 1; - _selectionName = _this select 2; - _removeItem = _this select 3; - _prevAnim = _this select 4; - - [_caller, _target, _removeItem] call FUNC(useEquipment); - [[_caller, _target, _selectionName, _removeItem], QUOTE(FUNC(handleTreatment_Action_AdvancedLocal)), _target] call EFUNC(common,execRemoteFnc); - - if (_prevAnim != "") then { - [_caller,_prevAnim, 0] call EFUNC(common,doAnimation); - }; - - ["Medical_handleTreatment_Advanced", [_caller, _target, _selectionName, _removeItem, true]] call ace_common_fnc_localEvent; - ["Medical_treatmentCompleted", [_caller, _target, _selectionName, _removeItem]] call ace_common_fnc_localEvent; - }, // on success - { - private ["_caller","_target", "_selectionName", "_prevAnim", "_removeItem"]; - _caller = _this select 0; - _target = _this select 1; - _selectionName = _this select 2; - _removeItem = _this select 3; - _prevAnim = _this select 4; - [(_this select 0), "STR_ACE_CANCELED", ["STR_ACE_ACTION_CANCELED","STR_ACE_YOU_MOVED_AWAY"]] call EFUNC(gui,sendDisplayInformationTo); - - if (_prevAnim != "") then { - [_caller,_prevAnim, 0] call EFUNC(common,doAnimation); - }; - - ["Medical_handleTreatment_Advanced", [_caller, _target, _selectionName, _removeItem, false]] call ace_common_fnc_localEvent; - ["Medical_treatmentCompleted", [_caller, _target, _selectionName, _removeItem]] call ace_common_fnc_localEvent; - }, // on failure - [_caller, _target, _selectionName, _removeItem, _prevAnim] // arguments - ] call EFUNC(gui,loadingBar); - true; - }; -}; -_isHandled; diff --git a/addons/medical/functions/fnc_handleTreatment_Category_Airway.sqf b/addons/medical/functions/fnc_handleTreatment_Category_Airway.sqf deleted file mode 100644 index 3456e6df18..0000000000 --- a/addons/medical/functions/fnc_handleTreatment_Category_Airway.sqf +++ /dev/null @@ -1,77 +0,0 @@ -/** - * fnc_handleTreatment_Category_Airway.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - -#include "script_component.hpp" - -private ["_caller","_target","_selectedData", "_selectionName", "_prevAnim", "_displayingIcon", "_part"]; -_caller = _this select 0; -_target = _this select 1; -_selectionName = _this select 2; -_removeItem = _this select 3; - -// we can only treat the head or torso for this -_part = [_selectionName] call FUNC(getBodyPartNumber); -if (_part == 0 || _part == 1) exitwith { - // TODO add fake weapon for treatment, in case no primairy weapon is present - // Handle the animations - _prevAnim = ""; - if (vehicle _caller == _caller && (vehicle _target == _target) && !(stance _caller == "PRONE")) then { - if (primaryWeapon _caller == "") then { - _prevAnim = animationState _caller; - }; - [_caller,"AinvPknlMstpSlayWrflDnon_medic", 1] call EFUNC(common,doAnimation); - }; - - if (ACE_player == _caller) then { - // Displaying the treatment icon action - [QGVAR(treatmentIconID), true, QUOTE(PATHTOF(data\icons\icon_airway_management.paa)), [1,1,1,1]] call EFUNC(gui,displayIcon); - }; - - // Get the current position for the treatment person - _caller setvariable [QGVAR(StartingPositionHandleTreatment), getPos _caller]; - - [5, // the time to wait - {((vehicle (_this select 0) != (_this select 0)) ||((getPos (_this select 0)) distance ((_this select 0) getvariable QGVAR(StartingPositionHandleTreatment)) < 1))}, // the condition - { - private ["_caller","_target", "_selectionName", "_prevAnim"]; - _caller = _this select 0; - _target = _this select 1; - _selectionName = _this select 2; - _removeItem = _this select 3; - [_caller, _target, _removeItem] call FUNC(useEquipment); - - [[_caller, _target, _selectionName, _removeItem], QUOTE(FUNC(handleTreatment_Action_AirwayLocal)), _target] call EFUNC(common,execRemoteFnc); - if (_prevAnim != "") then { - [_caller,_prevAnim, 0] call EFUNC(common,doAnimation); - }; - - ["Medical_handleTreatment_Airway", [_caller, _target, _selectionName, _removeItem, true]] call ace_common_fnc_localEvent; - ["Medical_treatmentCompleted", [_caller, _target, _selectionName, _removeItem]] call ace_common_fnc_localEvent; - }, // on success - { - private ["_caller","_target", "_selectionName", "_prevAnim"]; - [(_this select 0), "STR_ACE_CANCELED", ["STR_ACE_ACTION_CANCELED","STR_ACE_YOU_MOVED_AWAY"]] call EFUNC(gui,sendDisplayInformationTo); - - if (_prevAnim != "") then { - [_caller,_prevAnim, 0] call EFUNC(common,doAnimation); - }; - - ["Medical_handleTreatment_Airway", [_caller, _target, _selectionName, _removeItem, false]] call ace_common_fnc_localEvent; - ["Medical_treatmentCompleted", [_caller, _target, _selectionName, _removeItem]] call ace_common_fnc_localEvent; - }, // on failure - [_caller, _target, _selectionName, _removeItem, _prevAnim] // arguments - ] call EFUNC(gui,loadingBar); - true; -}; -// TODO display message to caller - -["Medical_handleTreatment_Airway", [_caller, _target, _selectionName, _removeItem, false]] call ace_common_fnc_localEvent; - -false; \ No newline at end of file diff --git a/addons/medical/functions/fnc_handleTreatment_Category_Bandaging.sqf b/addons/medical/functions/fnc_handleTreatment_Category_Bandaging.sqf deleted file mode 100644 index c1113166f5..0000000000 --- a/addons/medical/functions/fnc_handleTreatment_Category_Bandaging.sqf +++ /dev/null @@ -1,97 +0,0 @@ -/** - * fnc_handleTreatment_Category_Bandaging.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - -#include "script_component.hpp" - -private ["_caller","_target","_selectedData", "_selectionName", "_prevAnim", "_displayingIcon"]; -_caller = _this select 0; -_target = _this select 1; -_selectionName = _this select 2; -_removeItem = _this select 3; - -// TODO find selected data/wound in menu -_selectedData = [_this, 4, "", [""]] call BIS_fnc_Param; - - -// TODO add fake weapon for treatment, in case no primairy weapon is present -// Handle the animations -_prevAnim = ""; -if (vehicle _caller == _caller && (vehicle _target == _target) && !(stance _caller == "PRONE")) then { - if (primaryWeapon _caller == "") then { - _prevAnim = animationState _caller; - }; - [_caller,"AinvPknlMstpSlayWrflDnon_medic", 1] call EFUNC(common,doAnimation); -}; - -if (ACE_player == _caller) then { - switch (_removeItem) do { - case "ACE_tourniquet": { - - }; - case "ACE_splint": { - - }; - default { - [_caller, "STR_ACE_BANDAGING", "STR_ACE_APPLY_BANDAGE", 0, [[_target] call EFUNC(common,getName), _selectionName]] call EFUNC(gui,sendDisplayMessageTo); - }; - }; - // Displaying the treatment icon action - [QGVAR(treatmentIconID), true, QUOTE(PATHTOF(data\icons\bandage_fracture_small.paa)), [1,1,1,1]] call EFUNC(gui,displayIcon); -}; - -// Get the current position for the treatment person -_caller setvariable [QGVAR(StartingPositionHandleTreatment), getPos _caller]; - -if (isnil QGVAR(setting_bandageWaitingTime)) then { - GVAR(setting_bandageWaitingTime) = 5; -}; - -[GVAR(setting_bandageWaitingTime), // the time to wait - {((vehicle (_this select 0) != (_this select 0)) ||((getPos (_this select 0)) distance ((_this select 0) getvariable QGVAR(StartingPositionHandleTreatment)) < 1))}, // the condition - { - private ["_caller","_target","_selectedData", "_selectionName", "_prevAnim"]; - _caller = _this select 0; - _target = _this select 1; - _selectionName = _this select 2; - _removeItem = _this select 3; - - switch (_removeItem) do { - case "ACE_tourniquet": { - [_caller, _target, _selectionName, _removeItem] call FUNC(handleTreatment_Action_tourniquet); - }; - case "ACE_splint": { - // TODO implement splints - }; - default { - [[_caller, _target, _selectionName, _removeItem], QUOTE(FUNC(handleTreatment_Action_BandageLocal)), _target] call EFUNC(common,execRemoteFnc); - [_caller, _target, _removeItem] call FUNC(useEquipment); - }; - }; - - if (_prevAnim != "") then { - [_caller,_prevAnim, 0] call EFUNC(common,doAnimation); - }; - ["Medical_handleTreatment_Bandaging", [_caller, _target, _selectionName, _removeItem, true]] call ace_common_fnc_localEvent; - ["Medical_treatmentCompleted", [_caller, _target, _selectionName, _removeItem]] call ace_common_fnc_localEvent; - }, // on success - { - private ["_caller","_target","_selectedData", "_selectionName", "_prevAnim"]; - [(_this select 0), "STR_ACE_CANCELED", ["STR_ACE_ACTION_CANCELED","STR_ACE_YOU_MOVED_AWAY"]] call EFUNC(gui,sendDisplayInformationTo); - - if (_prevAnim != "") then { - [_caller,_prevAnim, 0] call EFUNC(common,doAnimation); - }; - ["Medical_handleTreatment_Bandaging", [_caller, _target, _selectionName, _removeItem, false]] call ace_common_fnc_localEvent; - ["Medical_treatmentCompleted", [_caller, _target, _selectionName, _removeItem]] call ace_common_fnc_localEvent; - }, // on failure - [_caller, _target, _selectionName, _removeItem, _prevAnim] // arguments -] call EFUNC(gui,loadingBar); - -true; \ No newline at end of file diff --git a/addons/medical/functions/fnc_handleTreatment_Category_Medication.sqf b/addons/medical/functions/fnc_handleTreatment_Category_Medication.sqf deleted file mode 100644 index f57ab20783..0000000000 --- a/addons/medical/functions/fnc_handleTreatment_Category_Medication.sqf +++ /dev/null @@ -1,69 +0,0 @@ -/** - * fnc_handleTreatment_Category_Medication.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - -#include "script_component.hpp" - -private ["_caller","_target","_selectedData", "_selectionName", "_prevAnim", "_displayingIcon"]; -_caller = _this select 0; -_target = _this select 1; -_selectionName = _this select 2; -_removeItem = _this select 3; - -// TODO add fake weapon for treatment, in case no primairy weapon is present -// Handle the animations -_prevAnim = ""; -if (vehicle _caller == _caller && (vehicle _target == _target) && !(stance _caller == "PRONE")) then { - if (primaryWeapon _caller == "") then { - _prevAnim = animationState _caller; - }; - [_caller,"AinvPknlMstpSlayWrflDnon_medic", 1] call EFUNC(common,doAnimation); -}; - -if (ACE_player == _caller) then { - // Displaying the treatment icon action - [QGVAR(treatmentIconID), true, QUOTE(PATHTOF(data\icons\medication_small.paa)), [1,1,1,1]] call EFUNC(gui,displayIcon); -}; - -// Get the current position for the treatment person -_caller setvariable [QGVAR(StartingPositionHandleTreatment), getPos _caller]; - -[4, // the time to wait - {((vehicle (_this select 0) != (_this select 0)) ||((getPos (_this select 0)) distance ((_this select 0) getvariable QGVAR(StartingPositionHandleTreatment)) < 1))}, // the condition - { - private ["_caller","_target", "_selectionName", "_prevAnim"]; - _caller = _this select 0; - _target = _this select 1; - _selectionName = _this select 2; - _removeItem = _this select 3; - [_caller, _target, _removeItem] call FUNC(useEquipment); - - [[_caller, _target, _selectionName, _removeItem], QUOTE(FUNC(handleTreatment_Action_MedicationLocal)), _target] call EFUNC(common,execRemoteFnc); - if (_prevAnim != "") then { - [_caller,_prevAnim, 0] call EFUNC(common,doAnimation); - }; - - ["Medical_handleTreatment_Medication", [_caller, _target, _selectionName, _removeItem, true]] call ace_common_fnc_localEvent; - ["Medical_treatmentCompleted", [_caller, _target, _selectionName, _removeItem]] call ace_common_fnc_localEvent; - }, // on success - { - private ["_caller","_target", "_selectionName", "_prevAnim"]; - [(_this select 0), "STR_ACE_CANCELED", ["STR_ACE_ACTION_CANCELED","STR_ACE_YOU_MOVED_AWAY"]] call EFUNC(gui,sendDisplayInformationTo); - - if (_prevAnim != "") then { - [_caller,_prevAnim, 0] call EFUNC(common,doAnimation); - }; - - ["Medical_handleTreatment_Medication", [_caller, _target, _selectionName, _removeItem, false]] call ace_common_fnc_localEvent; - ["Medical_treatmentCompleted", [_caller, _target, _selectionName, _removeItem]] call ace_common_fnc_localEvent; - }, // on failure - [_caller, _target, _selectionName, _removeItem, _prevAnim] // arguments -] call EFUNC(gui,loadingBar); - -true; diff --git a/addons/medical/functions/fnc_handleUI_DisplayOptions.sqf b/addons/medical/functions/fnc_handleUI_DisplayOptions.sqf deleted file mode 100644 index f56bbbf699..0000000000 --- a/addons/medical/functions/fnc_handleUI_DisplayOptions.sqf +++ /dev/null @@ -1,85 +0,0 @@ -/** - * fn_displayOptions.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - -#include "script_component.hpp" - -#define START_IDC 20 -#define END_IDC 27 -#define AMOUNT_OF_ENTRIES (count _entries) - -private ["_name","_entries","_display","_newTarget","_counter","_card","_ctrl","_code"]; -_name = _this select 0; -if (!hasInterface) exitwith{}; - -disableSerialization; -_display = uiNamespace getVariable QGVAR(medicalMenu); -if (isNil "_display") exitwith {}; // no valid dialog present - -if ((_name == "toggle")) exitwith { - - if (GVAR(INTERACTION_TARGET) != ACE_player) then { - _newTarget = ACE_player; - } else { - _newTarget = GVAR(INTERACTION_TARGET_PREVIOUS); - }; - - GVAR(INTERACTION_TARGET_PREVIOUS) = GVAR(INTERACTION_TARGET); - [_newTarget] spawn { - closeDialog 0; - sleep 0.1; - [_this select 0] call FUNC(openMenu); - }; -}; - -// Clean the dropdown options list from all actions -for [{_x=START_IDC},{_x <= END_IDC},{_x=_x+1}] do { - _ctrl = (_display displayCtrl (_x)); - _ctrl ctrlSetText ""; - _ctrl ctrlShow false; - _ctrl ctrlSetEventHandler ["ButtonClick",""]; - _ctrl ctrlSetTooltip ""; - _ctrl ctrlCommit 0; -}; - -GVAR(LatestDisplayOptionMenu) = _name; - -// The triage card has no options available -lbClear 212; -if (_name == "triage") exitwith { - ctrlEnable[212,true]; - _card = ([GVAR(INTERACTION_TARGET)] call FUNC(getTriageList)); - { - lbadd[212,format["%1 x%2", getText(configFile >> "CfgWeapons" >> (_x select 0) >> "displayName"), _x select 1]]; - }foreach _card; - if (count _card == 0) then { - lbadd[212,"No Entries"]; - }; -}; - -ctrlEnable[212,false]; - -_entries = [ACE_player, GVAR(INTERACTION_TARGET),_name] call FUNC(getTreatmentOptions); - -{ - //player sidechat format["TRIGGERED: %1",_x]; - if (_foreachIndex > END_IDC) exitwith {}; - _ctrl = (_display displayCtrl (START_IDC + _foreachIndex)); - if (!(_foreachIndex > AMOUNT_OF_ENTRIES)) then { - _ctrl ctrlSetText (_x select 0); - _code = format["[ACE_player, ACE_medical_INTERACTION_TARGET] call %1;",(_x select 1)]; - _ctrl ctrlSetEventHandler ["ButtonClick", _code]; - _ctrl ctrlSetTooltip (_x select 2); - _ctrl ctrlShow true; - } else { - _ctrl ctrlSetText ""; - _ctrl ctrlSetEventHandler ["ButtonClick",""]; - }; - _ctrl ctrlCommit 0; -}foreach _entries; diff --git a/addons/medical/functions/fnc_handleUI_dropDownTriageCard.sqf b/addons/medical/functions/fnc_handleUI_dropDownTriageCard.sqf deleted file mode 100644 index 2d895cae70..0000000000 --- a/addons/medical/functions/fnc_handleUI_dropDownTriageCard.sqf +++ /dev/null @@ -1,28 +0,0 @@ -/** - * fn_handleUI_dropDownTriageCard.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - -#include "script_component.hpp" - -private ["_display","_pos","_ctrl","_curPos","_idc"]; -disableSerialization; -_display = uiNamespace getVariable QGVAR(medicalMenu); -_pos = [ 0,0,0,0]; -_curPos = ctrlPosition (_display displayCtrl 2002); -if ((_curPos select 0) == 0 && (_curPos select 1) == 0) then { - _pos = ctrlPosition (_display displayCtrl 2001); -}; - -for "_idc" from 2002 to 2006 step 1 do { - _pos set [1, (_pos select 1) + (_pos select 3)]; - _ctrl = (_display displayCtrl _idc); - _ctrl ctrlSetPosition _pos; - _ctrl ctrlCommit 0; -}; - diff --git a/addons/medical/functions/fnc_handleUnitVitals.sqf b/addons/medical/functions/fnc_handleUnitVitals.sqf index 7ced1ec393..b666e78914 100644 --- a/addons/medical/functions/fnc_handleUnitVitals.sqf +++ b/addons/medical/functions/fnc_handleUnitVitals.sqf @@ -1,11 +1,14 @@ -/** - * fn_handleUnitVitals.sqf - * @Descr: Updates the vitals. Is expected to be called every second. - * @Author: Glowbal +/* + * Author: Glowbal + * Updates the vitals. Is expected to be called every second. * - * @Arguments: [unit OBJECT] - * @Return: void - * @PublicAPI: false + * Arguments: + * 0: The Unit + * + * ReturnValue: + * + * + * Public: No */ #include "script_component.hpp" @@ -13,13 +16,12 @@ private ["_unit", "_heartRate","_bloodPressure","_bloodVolume","_painStatus"]; _unit = _this select 0; -_bloodVolume = ([_unit, QGVAR(bloodVolume)] call EFUNC(common,getDefinedVariable)) + ([_unit] call FUNC(getBloodVolumeChange)); +_bloodVolume = (_unit getvariable [QGVAR(bloodVolume), 0]) + ([_unit] call FUNC(getBloodVolumeChange)); if (_bloodVolume <= 0) then { _bloodVolume = 0; }; _unit setvariable [QGVAR(bloodVolume), _bloodVolume]; - // Set variables for synchronizing information across the net if (_bloodVolume < 90) then { if !(_unit getvariable [QGVAR(hasLostBlood), false]) then { @@ -41,7 +43,7 @@ if ((_unit call FUNC(getBloodLoss)) > 0) then { }; }; -_painStatus = [_unit,QGVAR(amountOfPain),0] call EFUNC(common,getDefinedVariable); +_painStatus = _unit getvariable [QGVAR(pain), 0]; if (_painStatus > 0) then { if !(_unit getvariable [QGVAR(hasPain), false]) then { _unit setvariable [QGVAR(hasPain), true, true]; @@ -60,16 +62,16 @@ if (_bloodVolume < 30) exitwith { if ([_unit] call EFUNC(common,isAwake)) then { if (_bloodVolume < 60) then { if (random(1) > 0.9) then { - [_unit] call FUNC(setUnconsciousState); + [_unit] call FUNC(setUnconscious); }; }; }; // handle advanced medical, with vitals -if ((missionNamespace getvariable[QGVAR(setting_AdvancedLevel), 0]) > 0) exitwith { +if ((missionNamespace getvariable[QGVAR(level), 0]) > 0) exitwith { // Set the vitals - _heartRate = ([_unit, QGVAR(heartRate)] call EFUNC(common,getDefinedVariable)) + ([_unit] call FUNC(getHeartRateChange)); + _heartRate = (_unit getvariable [QGVAR(heartRate), 0]) + ([_unit] call FUNC(getHeartRateChange)); _unit setvariable [QGVAR(heartRate), _heartRate]; _bloodPressure = [_unit] call FUNC(getBloodPressure); @@ -93,37 +95,36 @@ if ((missionNamespace getvariable[QGVAR(setting_AdvancedLevel), 0]) > 0) exitwit // Check vitals for medical status // TODO check for in revive state instead of variable - if ((_unit getvariable[QEGVAR(common,ENABLE_REVIVE_SETDEAD_F),0]) == 0) then { - _bloodPressureL = _bloodPressure select 0; - _bloodPressureH = _bloodPressure select 1; + // TODO Implement cardiac arrest. + _bloodPressureL = _bloodPressure select 0; + _bloodPressureH = _bloodPressure select 1; - if (!(_unit getvariable [QGVAR(inCardiacArrest),false])) then { - if (_heartRate < 10 || _bloodPressureH < 30 || _bloodVolume < 20) then { - [_unit] call FUNC(setUnconsciousState); // safety check to ensure unconsciousness for units if they are not dead already. - }; + if (!(_unit getvariable [QGVAR(inCardiacArrest),false])) then { + if (_heartRate < 10 || _bloodPressureH < 30 || _bloodVolume < 20) then { + [_unit] call FUNC(setUnconscious); // safety check to ensure unconsciousness for units if they are not dead already. + }; - if (_bloodPressureH > 260) then { - if (random(1) > 0.7) then { - [_unit] call FUNC(setCardiacArrest); - }; - }; - if (_bloodPressureL < 40 && _heartRate > 190) then { - if (random(1) > 0.7) then { - [_unit] call FUNC(setCardiacArrest); - }; - }; - if (_bloodPressureH > 145 && _heartRate > 150) then { - if (random(1) > 0.7) then { - [_unit] call FUNC(setCardiacArrest); - }; - }; - if (_heartRate > 200) then { - [_unit] call FUNC(setCardiacArrest); - }; - - if (_heartRate < 20) then { + if (_bloodPressureH > 260) then { + if (random(1) > 0.7) then { [_unit] call FUNC(setCardiacArrest); }; }; + if (_bloodPressureL < 40 && _heartRate > 190) then { + if (random(1) > 0.7) then { + [_unit] call FUNC(setCardiacArrest); + }; + }; + if (_bloodPressureH > 145 && _heartRate > 150) then { + if (random(1) > 0.7) then { + [_unit] call FUNC(setCardiacArrest); + }; + }; + if (_heartRate > 200) then { + [_unit] call FUNC(setCardiacArrest); + }; + + if (_heartRate < 20) then { + [_unit] call FUNC(setCardiacArrest); + }; }; }; diff --git a/addons/medical/functions/fnc_hasEquipment.sqf b/addons/medical/functions/fnc_hasItem.sqf similarity index 67% rename from addons/medical/functions/fnc_hasEquipment.sqf rename to addons/medical/functions/fnc_hasItem.sqf index bdf652fd30..d02abb9187 100644 --- a/addons/medical/functions/fnc_hasEquipment.sqf +++ b/addons/medical/functions/fnc_hasItem.sqf @@ -1,11 +1,16 @@ -/** - * fn_hasEquipment.sqf - * @Descr: Check if the medic or patient have the right equipment for treatment. - * @Author: Glowbal +/* + * Author: Glowbal + * Check if the item is present between the patient and the medic * - * @Arguments: [medic OBJECT, patient OBJECT, item STRING (Classname of the item. Expects magazine type.)] - * @Return: BOOL - * @PublicAPI: false + * Arguments: + * 0: Medic + * 1: Patient + * 2: Item + * + * ReturnValue: + * + * + * Public: Yes */ #include "script_component.hpp" @@ -30,10 +35,10 @@ _return = false; if ([vehicle _medic] call FUNC(isMedicalVehicle) && {(vehicle _medic != _medic)}) then { _crew = crew vehicle _medic; { - if ([_x, _medic] call FUNC(canAccessMedicalEquipment) && {([_x, _item] call EFUNC(common,hasItem))}) exitwith { + if ([_medic, _x] call FUNC(canAccessMedicalEquipment) && {([_x, _item] call EFUNC(common,hasItem))}) exitwith { _return = true; }; }foreach _crew; }; -_return \ No newline at end of file +_return; diff --git a/addons/medical/functions/fnc_hasItems.sqf b/addons/medical/functions/fnc_hasItems.sqf new file mode 100644 index 0000000000..ea16edebc4 --- /dev/null +++ b/addons/medical/functions/fnc_hasItems.sqf @@ -0,0 +1,34 @@ +/* + * Author: Glowbal + * Check if all items are present between the patient and the medic. + * + * Arguments: + * 0: Medic + * 1: Patient + * 2: Items > + * + * ReturnValue: + * Has the items + * + * Public: Yes + */ + +#include "script_component.hpp" + +private ["_medic", "_patient", "_items", "_return"]; +_medic = _this select 0; +_patient = _this select 1; +_items = _this select 2; + +_return = true; +{ + // + if (typeName _x == "ARRAY" && {({[_medic, _patient, _x] call FUNC(hasItem)}count _x == 0)}) exitwith { + _return = false; + }; + if (typeName _x == "STRING" && {!([_medic, _patient, _x] call FUNC(hasItem))}) exitwith { + _return = false; + }; +}foreach _items; + +_return; diff --git a/addons/medical/functions/fnc_hasOpenWounds.sqf b/addons/medical/functions/fnc_hasOpenWounds.sqf deleted file mode 100644 index fdfef6883f..0000000000 --- a/addons/medical/functions/fnc_hasOpenWounds.sqf +++ /dev/null @@ -1,16 +0,0 @@ -/** - * fn_hasOpenWounds.sqf - * @Descr: Check if unit has open wounds - * @Author: Glowbal - * - * @Arguments: [unit OBJECT (The unit to check)] - * @Return: BOOL - * @PublicAPI: true - */ - -#include "script_component.hpp" - -private "_openWounds"; -_openWounds = [_this select 0,QGVAR(openWounds)] call EFUNC(common,getDefinedVariable); - -({(((_x select 0) + (_x select 1) + (_x select 2)) > 0)}count _openWounds > 0); \ No newline at end of file diff --git a/addons/medical/functions/fnc_hasTourniquetAppliedTo.sqf b/addons/medical/functions/fnc_hasTourniquetAppliedTo.sqf index ee6cd5fd61..6183854e45 100644 --- a/addons/medical/functions/fnc_hasTourniquetAppliedTo.sqf +++ b/addons/medical/functions/fnc_hasTourniquetAppliedTo.sqf @@ -1,13 +1,21 @@ -/** - * fnc_hasTourniquetAppliedTo.sqf - * @Descr: N/A - * @Author: Glowbal +/* + * Author: Glowbal + * Check if unit has a tourniquet applied to the specified bodypart * - * @Arguments: [] - * @Return: - * @PublicAPI: false + * Arguments: + * 0: The Unit + * 1: SelectionName + * + * ReturnValue: + * Has tourniquet applied + * + * Public: Yes */ #include "script_component.hpp" -((([(_this select 0),QGVAR(tourniquets)] call EFUNC(common,getDefinedVariable)) select ([(_this select 1)] call FUNC(getBodyPartNumber))) > 0); \ No newline at end of file +private ["_target", "_selectionName"]; +_target = _this select 0; +_selectionName = _this select 1; + +(((_target getvariable [QGVAR(tourniquets), [0,0,0,0,0,0]]) select ([_selectionName] call FUNC(selectionNameToNumber))) > 0); diff --git a/addons/medical/functions/fnc_increasePain.sqf b/addons/medical/functions/fnc_increasePain.sqf deleted file mode 100644 index 64a29989e4..0000000000 --- a/addons/medical/functions/fnc_increasePain.sqf +++ /dev/null @@ -1,46 +0,0 @@ -/** - * fn_increasePain.sqf - * @Descr: Increase the pain level of a unit - * @Author: Glowbal - * - * @Arguments: [unit OBJECT, amount NUMBER, sectionName NUMBER (Also supports string representation of bodyparts)] - * @Return: nil - * @PublicAPI: true - */ - -#include "script_component.hpp" - -private ["_unit","_amountOfDamage","_selectionName","_sourceOfDamage","_painStatus"]; -_unit = _this select 0; -_amountOfDamage = _this select 1; -_selectionName = _this select 2; - -if (!alive _unit || (_amountOfDamage <= 0)) exitwith{}; -_painStatus = [_unit,QGVAR(amountOfPain),0] call EFUNC(common,getDefinedVariable); - -if (typeName _selectionName == "STRING") then { - _selectionName = [_selectionName] call FUNC(getBodyPartNumber); -}; - -_amountOfDamage = _amountOfDamage * 10; - -_painStatus = switch (_selectionName) do { - case 0: { - _painStatus + (_amountOfDamage*1.5); - }; - case 1: { - _painStatus + (_amountOfDamage*0.9); - }; - case 2: { - _painStatus + (_amountOfDamage*0.8); - }; - case 3: { - _painStatus + (_amountOfDamage*0.7); - }; - default {_painStatus}; -}; - -[_unit,QGVAR(amountOfPain),_painStatus] call EFUNC(common,setDefinedVariable); -["Medical_onPainIncreased", [_unit, _selectionName, _painStatus]] call ace_common_fnc_localEvent; - -nil; \ No newline at end of file diff --git a/addons/medical/functions/fnc_init.sqf b/addons/medical/functions/fnc_init.sqf new file mode 100644 index 0000000000..aee0b6b345 --- /dev/null +++ b/addons/medical/functions/fnc_init.sqf @@ -0,0 +1,76 @@ +/* + * Author: KoffeinFlummi + * Initializes unit variables. + * + * Arguments: + * 0: The Unit + * + * ReturnValue: + * nil + * + * Public: No + */ + +#include "script_component.hpp" + +private ["_unit", "_allUsedMedication", "_logs"]; + +_unit = _this select 0; + +_unit setVariable [QGVAR(pain), 0, true]; +_unit setVariable [QGVAR(morphine), 0, true]; +_unit setVariable [QGVAR(bloodVolume), 100, true]; + +// tourniquets +_unit setvariable [QGVAR(tourniquets), [0,0,0,0,0,0], true]; + +// wounds and injuries +_unit setvariable [QGVAR(openWounds), [], true]; +_unit setVariable [QGVAR(internalWounds), [], true]; + +// vitals +_unit setVariable [QGVAR(heartRate), 80]; +_unit setvariable [QGVAR(heartRateAdjustments), []]; +_unit setvariable [QGVAR(bloodPressure), [80, 120]]; +_unit setVariable [QGVAR(peripheralResistance), 100]; + +// fractures +_unit setVariable [QGVAR(fractures), []]; + +// triage card and logs +_unit setvariable [QGVAR(triageLevel), 0, true]; +_unit setvariable [QGVAR(triageCard), [], true]; + +// IVs +_unit setVariable [QGVAR(salineIVVolume), 0]; +_unit setVariable [QGVAR(plasmaIVVolume), 0]; +_unit setVariable [QGVAR(bloodIVVolume), 0]; + +// damage storage +_unit setvariable [QGVAR(bodyPartStatus), [0,0,0,0,0,0], true]; + +// airway +_unit setvariable [QGVAR(airwayStatus), 0, true]; +_unit setVariable [QGVAR(airwayOccluded), false, true]; +_unit setvariable [QGVAR(airwayCollapsed), true, true]; + +// generic medical admin +_unit setvariable [QGVAR(addedToUnitLoop), false, true]; +_unit setvariable [QGVAR(inCardiacArrest), true, true]; +_unit setVariable [QGVAR(isUnconscious), false, true]; +_unit setvariable [QGVAR(hasLostBlood), true, true]; +_unit setvariable [QGVAR(isBleeding), false, true]; +_unit setvariable [QGVAR(hasPain), false, true]; + +// medication +_allUsedMedication = _unit getVariable [QGVAR(allUsedMedication), []]; +{ + _unit setvariable [_x select 0, nil]; +} foreach _allUsedMedication; +_unit setVariable [QGVAR(allUsedMedication), []]; + +_logs = _unit getvariable [QGVAR(allLogs), []]; +{ + _unit setvariable [_x, nil, true]; +} foreach _logs; +_unit setvariable [QGVAR(allLogs), [], true]; diff --git a/addons/medical/functions/fnc_initalizeModuleCMS.sqf b/addons/medical/functions/fnc_initalizeModuleCMS.sqf deleted file mode 100644 index 40e50c6fb0..0000000000 --- a/addons/medical/functions/fnc_initalizeModuleCMS.sqf +++ /dev/null @@ -1,71 +0,0 @@ -/* -init.sqf -Usage: -Author: Glowbal - -Arguments: -Returns: - -Affects: Local -Executes: call -*/ - -#include "script_component.hpp" - -private ["_logic"]; -_logic = _this select 0; - -if (isNull _logic) exitwith {}; - -// Damage thresholds only in case the damge threshold module hasn't been placed down. -if (isnil QGVAR(damageThreshold_AI)) then { - GVAR(damageThreshold_AI) = 1; -}; - -if (isnil QGVAR(damageThreshold_Players)) then { - GVAR(damageThreshold_Players) = 1; -}; - -GVAR(setting_allowInstantDead) = _logic getvariable["setting_allowInstantDead", true]; -GVAR(setting_AdvancedLevel) = _logic getvariable["advancedLevel", 0]; -GVAR(setting_advancedWoundsSetting) = _logic getvariable["openingOfWounds", true]; -GVAR(setting_advancedMedicRoles) = _logic getvariable["medicSetting", false]; -GVAR(setting_medicalDifficulty) = _logic getvariable["difficultySetting", 1]; -GVAR(setting_enableBandagingAid) = _logic getvariable["bandagingAid", GVAR(setting_AdvancedLevel) == 0]; -GVAR(setting_allowAIFullHeal) = _logic getvariable["allowAIFullHeal", false]; -GVAR(setting_enableForUnits) = _logic getvariable["enableFor", 1]; -GVAR(setting_allowAirwayInjuries) = (_logic getvariable["enableAirway", 0]) == 1; -GVAR(setting_aidKitRestrictions) = _logic getvariable["aidKitRestrictions", 0]; -GVAR(setting_removeAidKitOnUse) = _logic getvariable["aidKitUponUsage", false]; -GVAR(setting_aidKitMedicsOnly) = _logic getvariable["aidKitMedicsOnly", false]; -GVAR(setting_bandageWaitingTime) = _logic getvariable["bandageTime", 5]; -GVAR(setting_allowVehicleCrashInjuries) = _logic getvariable["vehCrashes", true]; -GVAR(setting_allowStitching) = _logic getvariable["stitchingMedicsOnly", 0]; - -if (GVAR(setting_AdvancedLevel) == -1) exitwith{}; -GVAR(isEnabled) = true; - - -waituntil{!isnil "ACE_gui" && !isnil "ACE_common"}; - - -if (GVAR(setting_AdvancedLevel) > 0) then { - [ - {(([_this select 0,QGVAR(heartRate)] call EFUNC(common,getDefinedVariable)) < 20)} - ] call FUNC(registerUnconsciousCondition); - - if (GVAR(setting_allowAirwayInjuries)) then { - [ - {(([_this select 0,QGVAR(airway)] call EFUNC(common,getDefinedVariable)) > 2)} - ] call FUNC(registerUnconsciousCondition); - }; -}; - -if (!hasInterface) exitwith{}; - -{ - if(_x == "FirstAidKit" || {_x == "Medikit"}) then { - player removeItem _x; - }; -}foreach (items player); - diff --git a/addons/medical/functions/fnc_inMedicalFacility.sqf b/addons/medical/functions/fnc_isInMedicalFacility.sqf similarity index 84% rename from addons/medical/functions/fnc_inMedicalFacility.sqf rename to addons/medical/functions/fnc_isInMedicalFacility.sqf index 8f86fbab8b..b1521b288b 100644 --- a/addons/medical/functions/fnc_inMedicalFacility.sqf +++ b/addons/medical/functions/fnc_isInMedicalFacility.sqf @@ -1,11 +1,14 @@ -/** - * fn_inMedicalFacility.sqf - * @Descr: Checks if a unit is in a designated medical facility - * @Author: Glowbal +/* + * Author: Glowbal + * Checks if a unit is in a designated medical facility * - * @Arguments: [unit OBJECT] - * @Return: BOOL true if unit is in a building or under a roof. - * @PublicAPI: true + * Arguments: + * 0: The Unit + * + * ReturnValue: + * Is in medical facility + * + * Public: Yes */ #include "script_component.hpp" @@ -48,4 +51,4 @@ if (!_isInBuilding) then { }; }foreach _objects; }; -_isInBuilding \ No newline at end of file +_isInBuilding; diff --git a/addons/medical/functions/fnc_isMedic.sqf b/addons/medical/functions/fnc_isMedic.sqf index ef824c06f1..872777e8c6 100644 --- a/addons/medical/functions/fnc_isMedic.sqf +++ b/addons/medical/functions/fnc_isMedic.sqf @@ -1,33 +1,34 @@ -/** - * fn_medicClass.sqf - * @Descr: Check if a unit is any medical class above normal. - * @Author: Glowbal +/* + * Author: Glowbal + * Check if a unit is any medical class * - * @Arguments: [unit OBJECT] - * @Return: BOOL - * @PublicAPI: true + * Arguments: + * 0: The Unit + * 1: Class + * + * ReturnValue: + * Is in of medic class + * + * Public: Yes */ #include "script_component.hpp" private ["_unit","_class","_return"]; -_unit = [_this, 0, objNull,[ObjNull]] call BIS_fnc_Param; +_unit = _this select 0; +_medicN = if (count _this > 1) then {_this select 1} else {1}; if (isnil QGVAR(setting_advancedMedicRoles)) exitwith { true; }; if (GVAR(setting_advancedMedicRoles)) then { - _class = [_unit,QGVAR(medicClass)] call EFUNC(common,getDefinedVariable); - _return = switch (_class) do { - case 0: {false}; - case 1: {true}; - case 2: {true}; - default {false}; - + _class = _unit getvariable [QGVAR(medicClass), 0]; + if (_class >= _medicN) then { + _return = true; }; } else { _return = true; }; -_return \ No newline at end of file +_return; diff --git a/addons/medical/functions/fnc_isMedicalVehicle.sqf b/addons/medical/functions/fnc_isMedicalVehicle.sqf index 9489c518b7..bf13c51a6a 100644 --- a/addons/medical/functions/fnc_isMedicalVehicle.sqf +++ b/addons/medical/functions/fnc_isMedicalVehicle.sqf @@ -1,17 +1,19 @@ -/** - * fn_isMedicalVehicle.sqf - * @Descr: Check if vehicle is a medical vehicle - * @Author: Glowbal +/* + * Author: Glowbal + * Check if vehicle is a medical vehicle * - * @Arguments: [vehicle OBJECT] - * @Return: BOOL - * @PublicAPI: true + * Arguments: + * 0: The Vehicle + * + * ReturnValue: + * Is in of medic class + * + * Public: Yes */ - #include "script_component.hpp" private ["_veh"]; _veh = _this select 0; if !(_veh getvariable [QGVAR(isMedicalVehicle), true]) exitwith {false}; // exit in case the false is set. -((getNumber(configFile >> "CfgVehicles" >> typeOf _veh >> QGVAR(isMedicalVehicle)) == 1) || (_veh getvariable [QGVAR(isMedicalVehicle), false])); \ No newline at end of file +((getNumber(configFile >> "CfgVehicles" >> typeOf _veh >> QGVAR(isMedicalVehicle)) == 1) || (_veh getvariable [QGVAR(isMedicalVehicle), false])); diff --git a/addons/medical/functions/fnc_isMovingUnit.sqf b/addons/medical/functions/fnc_isMovingUnit.sqf deleted file mode 100644 index 326a7b1e97..0000000000 --- a/addons/medical/functions/fnc_isMovingUnit.sqf +++ /dev/null @@ -1,16 +0,0 @@ -/** - * fnc_isMovingUnit.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - -#include "script_component.hpp" - -private "_unit"; -_unit = _this select 0; - -(!(isNull(_unit getvariable [QGVAR(carrying),objNull])) || !(isNull(_unit getvariable [QGVAR(dragging),objNull]))) diff --git a/addons/medical/functions/fnc_isSetTreatmentMutex.sqf b/addons/medical/functions/fnc_isSetTreatmentMutex.sqf deleted file mode 100644 index 2280b066df..0000000000 --- a/addons/medical/functions/fnc_isSetTreatmentMutex.sqf +++ /dev/null @@ -1,16 +0,0 @@ -/** - * fn_isSetTreatmentMutex.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - -#include "script_component.hpp" - -// Max locked time is 2 minutes. -#define MAX_LOCKED_TIME 120 - -(time - ((_this select 0) getvariable [QGVAR(PerformingTreatmentMutex), -MAX_LOCKED_TIME]) <= MAX_LOCKED_TIME); \ No newline at end of file diff --git a/addons/medical/functions/fnc_isUnconscious.sqf b/addons/medical/functions/fnc_isUnconscious.sqf deleted file mode 100644 index a4293cf13b..0000000000 --- a/addons/medical/functions/fnc_isUnconscious.sqf +++ /dev/null @@ -1,13 +0,0 @@ -/** - * fn_isUnconscious.sqf - * @Descr: Checks whatever given object is in the unconscious state - * @Author: Glowbal - * - * @Arguments: [unit OBJECT] - * @Return: BOOL True when object is in unconscious state - * @PublicAPI: true - */ - -#include "script_component.hpp" - -((_this select 0) getvariable ["ACE_isUnconscious",false]); \ No newline at end of file diff --git a/addons/medical/functions/fnc_makeCopyOfBody_f.sqf b/addons/medical/functions/fnc_makeCopyOfBody_f.sqf deleted file mode 100644 index cee0631862..0000000000 --- a/addons/medical/functions/fnc_makeCopyOfBody_f.sqf +++ /dev/null @@ -1,75 +0,0 @@ -/** - * fn_makeCopyOfBody_f.sqf - * @Descr: Makes a copy of a dead body. For handling dead bodies for actions such as load and carry. - * @Author: Glowbal - * - * @Arguments: [oldBody OBJECT, caller OBJECT] - * @Return: newUnit OBJECT Returns the copy of the unit. If no copy could be made, returns the oldBody - * @PublicAPI: false - */ - -#include "script_component.hpp" - -private ["_oldBody","_newUnit","_class","_group","_position","_side","_allVariables"]; -_oldBody = _this select 0; -_caller = _this select 1; - - if (alive _oldBody) exitwith {_oldBody}; // we only want to do this for dead bodies - _name = _oldBody getvariable ["ACE_name","unknown"]; - _class = typeof _oldBody; - _side = side _caller; - _group = createGroup _side; - _position = getPos _oldBody; - - _newUnit = _group createUnit [typeof _oldBody, _position, [], 0, "NONE"]; - - _allVariables = [_oldBody] call EFUNC(common,getAllDefinedSetVariables); - // [NAME (STRING), TYPENAME (STRING), VALUE (ANY), DEFAULT GLOBAL (BOOLEAN)] - { - [_newUnit,_x select 0, _x select 2] call EFUNC(common,setDefinedVariable); - }foreach _allVariables; - _newUnit setVariable ["ACE_name",_name,true]; - - _newUnit disableAI "TARGET"; - _newUnit disableAI "AUTOTARGET"; - _newUnit disableAI "MOVE"; - _newUnit disableAI "ANIM"; - _newUnit disableAI "FSM"; - _newUnit setvariable ["ACE_isDead",true,true]; - - removeallweapons _newUnit; - removeallassigneditems _newUnit; - removeUniform _newUnit; - removeHeadgear _newUnit; - removeBackpack _newUnit; - removeVest _newUnit; - - _newUnit addHeadgear (headgear _oldBody); - _newUnit addBackpack (backpack _oldBody); - clearItemCargoGlobal (backpackContainer _newUnit); - clearMagazineCargoGlobal (backpackContainer _newUnit); - clearWeaponCargoGlobal (backpackContainer _newUnit); - - _newUnit addVest (vest _oldBody); - clearItemCargoGlobal (backpackContainer _newUnit); - clearMagazineCargoGlobal (backpackContainer _newUnit); - clearWeaponCargoGlobal (backpackContainer _newUnit); - - _newUnit addUniform (uniform _oldBody); - clearItemCargoGlobal (backpackContainer _newUnit); - clearMagazineCargoGlobal (backpackContainer _newUnit); - clearWeaponCargoGlobal (backpackContainer _newUnit); - - {_newUnit addMagazine _x} count (magazines _oldBody); - {_newUnit addWeapon _x} count (weapons _oldBody); - {_newUnit addItem _x} count (items _oldBody); - - _newUnit selectWeapon (primaryWeapon _newUnit); - //_newUnit playMoveNow ([_newUnit] call FUNC(getDeathAnim)); - - deleteVehicle _oldBody; - - // TODO sometimes the old body does not get cleaned up properly. Look into garbage collection. - - _newUnit setDamage 0.9; -_newUnit \ No newline at end of file diff --git a/addons/medical/functions/fnc_moduleAssignMedicRoles.sqf b/addons/medical/functions/fnc_moduleAssignMedicRoles.sqf deleted file mode 100644 index 2236d30fce..0000000000 --- a/addons/medical/functions/fnc_moduleAssignMedicRoles.sqf +++ /dev/null @@ -1,61 +0,0 @@ -/** - * fn_assignMedicRoles.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - -#include "script_component.hpp" - -private ["_logic","_setting","_objects"]; -_logic = [_this,0,objNull,[objNull]] call BIS_fnc_param; - - [format["AssignMedicalRoles called. Arguments are: %1 %2", _this]] call EFUNC(common,debug); - -if (!isNull _logic) then { - _list = _logic getvariable ["EnableList",""]; - - _splittedList = [_list, ","] call BIS_fnc_splitString; - _nilCheckPassedList = ""; - { - _x = [_x] call EFUNC(common,string_removeWhiteSpace); - if !(isnil _x) then { - if (_nilCheckPassedList == "") then { - _nilCheckPassedList = _x; - } else { - _nilCheckPassedList = _nilCheckPassedList + ","+ _x; - }; - }; - }foreach _splittedList; - - _list = "[" + _nilCheckPassedList + "]"; - _parsedList = [] call compile _list; - _setting = _logic getvariable ["class",0]; - _objects = synchronizedObjects _logic; - if (!(_objects isEqualTo []) && _parsedList isEqualTo []) then { - [["synchronizedObjects for the 'Assign Medic Role' Module is deprecated. Please use the enable for list instead!"], 1] call EFUNC(common,debug); - { - if (!isnil "_x") then { - if (typeName _x == typeName objNull) then { - if (local _x) then { - [_x,_setting] call FUNC(setMedicRole); - }; - }; - }; - }foreach _objects; - }; - { - if (!isnil "_x") then { - if (typeName _x == typeName objNull) then { - if (local _x) then { - [_x,_setting] call FUNC(setMedicRole); - }; - }; - }; - }foreach _parsedList; - }; - -true \ No newline at end of file diff --git a/addons/medical/functions/fnc_moduleAssignMedicalEquipment.sqf b/addons/medical/functions/fnc_moduleAssignMedicalEquipment.sqf deleted file mode 100644 index f26cfd9ffc..0000000000 --- a/addons/medical/functions/fnc_moduleAssignMedicalEquipment.sqf +++ /dev/null @@ -1,81 +0,0 @@ -/** - * fn_assignMedicalEquipment.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ -#define ALL_PLAYERS 0 -#define ONLY_MEDICS 1 - - -// TODO add amount of to defines -#define BASIC_BANDAGES "ACE_bandage_basic" -#define PACKING_BANDAGES "ACE_packing_bandage" - -#include "script_component.hpp" - -private ["_logic","_setting","_objects", "_medicsLoadout", "_nonMedics", "_code"]; -_logic = [_this,0,objNull,[objNull]] call BIS_fnc_param; -if (!isNull _logic) then { - _setting = _logic getvariable ["equipment",0]; - waituntil {!isnil "ACE_gui"}; // ensure the player unit is available. - waituntil {time>0}; - - _start = diag_tickTime; - - // TODO Create functions for adding multiple magazines to a unit - // TODO Check if unit can store more magazines (ie backpack/vest/uniform are not full) - - _medicsLoadout = { - for "_i" from 1 to 8 do { - player addItem BASIC_BANDAGES; - player addItem PACKING_BANDAGES; - }; - for "_i" from 1 to 3 do { - player addItem "ACE_tourniquet"; - }; - for "_i" from 1 to 3 do { - player addItem "ACE_morphine"; - }; - for "_i" from 1 to 2 do { - player addItem "ACE_epinephrine"; - }; - }; - - _nonMedics = { - for "_i" from 1 to 3 do { - player addItem BASIC_BANDAGES; - }; - player addItem "ACE_tourniquet"; - player addItem "ACE_morphine"; - }; - - // TODO make this neat code. - switch (_setting) do { - case ALL_PLAYERS: { - _code = if ([player] call FUNC(isMedic)) then { - _medicsLoadout; - } else { - _nonMedics; - }; - - call _code; - player addEventhandler["Respawn", _code]; - }; - case ONLY_MEDICS: { - _code = if ([player] call FUNC(isMedic)) then { - _medicsLoadout; - } else { - {}; - }; - call _code; - player addEventhandler["Respawn", _code]; - }; - default {}; - }; - }; - -true \ No newline at end of file diff --git a/addons/medical/functions/fnc_moduleAssignMedicalFacility.sqf b/addons/medical/functions/fnc_moduleAssignMedicalFacility.sqf deleted file mode 100644 index 92ac746303..0000000000 --- a/addons/medical/functions/fnc_moduleAssignMedicalFacility.sqf +++ /dev/null @@ -1,25 +0,0 @@ -/** - * fn_assignMedicalFacility.sqf - * @Descr: Register synchronized objects from passed object as a medical facility for CMS. - * @Author: Glowbal - * - * @Arguments: [logic OBJECT] - * @Return: BOOL - * @PublicAPI: true - */ - -#include "script_component.hpp" - -private ["_logic","_setting","_objects"]; -_logic = [_this,0,objNull,[objNull]] call BIS_fnc_param; -if (!isNull _logic) then { - _setting = _logic getvariable ["class",0]; - _objects = synchronizedObjects _logic; - { - if (local _x) then { - _x setvariable[QGVAR(isMedicalFacility), true, true]; - }; - }foreach _objects; -}; - -true \ No newline at end of file diff --git a/addons/medical/functions/fnc_moduleAssignMedicalVehicle.sqf b/addons/medical/functions/fnc_moduleAssignMedicalVehicle.sqf deleted file mode 100644 index 485eaba63b..0000000000 --- a/addons/medical/functions/fnc_moduleAssignMedicalVehicle.sqf +++ /dev/null @@ -1,62 +0,0 @@ -/** - * fn_assignMedicalVehicle.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - -#include "script_component.hpp" - -private ["_logic","_setting", "_list", "_parsedList", "_splittedList","_nilCheckPassedList", "_objects"]; -_logic = [_this,0,objNull,[objNull]] call BIS_fnc_param; - - [format["AssignMedicalRoles called. Arguments are: %1 %2", _this]] call EFUNC(common,debug); - -if (!isNull _logic) then { - _list = _logic getvariable ["EnableList",""]; - _setting = _logic getvariable ["enabled",0]; - - _splittedList = [_list, ","] call BIS_fnc_splitString; - _nilCheckPassedList = ""; - { - _x = [_x] call EFUNC(common,string_removeWhiteSpace); - if !(isnil _x) then { - if (_nilCheckPassedList == "") then { - _nilCheckPassedList = _x; - } else { - _nilCheckPassedList = _nilCheckPassedList + ","+ _x; - }; - }; - }foreach _splittedList; - - _list = "[" + _nilCheckPassedList + "]"; - _parsedList = [] call compile _list; - - _objects = synchronizedObjects _logic; - { - // assign the medical vehicle role for non man type objects that are local only. - if !(_x isKindOf "CAManBase") then { - if (local _x) then { - _x setvariable [QGVAR(isMedicalVehicle), _setting, true]; - }; - }; - }foreach _objects; - - { - if (!isnil "_x") then { - if (typeName _x == typeName objNull) then { - // assign the medical vehicle role for non man type objects that are local only. - if !(_x isKindOf "CAManBase") then { - if (local _x) then { - _x setvariable [QGVAR(isMedicalVehicle), _setting, true]; - }; - }; - }; - }; - }foreach _parsedList; - }; - -true \ No newline at end of file diff --git a/addons/medical/functions/fnc_moduleBasicRevive.sqf b/addons/medical/functions/fnc_moduleBasicRevive.sqf deleted file mode 100644 index b02d873313..0000000000 --- a/addons/medical/functions/fnc_moduleBasicRevive.sqf +++ /dev/null @@ -1,24 +0,0 @@ -/** - * fn_moduleEnableBasicRevive.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - -#include "script_component.hpp" - -private ["_logic"]; -_logic = _this select 0; - -GVAR(Module) = true; - -[_logic, QGVAR(ENABLE_REVIVE_F), "enableFor" ] call EFUNC(common,readSettingFromModule); -[_logic, QGVAR(REVIVE_TIMER_MAX_F), "timer" ] call EFUNC(common,readSettingFromModule); -[_logic, QGVAR(REVIVE_NUMBER_MAX_F), "amountOf" ] call EFUNC(common,readSettingFromModule); - -[ - {(((_this select 0) getvariable[QGVAR(ENABLE_REVIVE_SETDEAD_F),0]) > 0)} -] call FUNC(registerUnconsciousCondition); diff --git a/addons/medical/functions/fnc_moduleDamageSettings.sqf b/addons/medical/functions/fnc_moduleDamageSettings.sqf deleted file mode 100644 index 9040d2ff81..0000000000 --- a/addons/medical/functions/fnc_moduleDamageSettings.sqf +++ /dev/null @@ -1,20 +0,0 @@ -/** - * fnc_moduleDamageSettings.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - -#include "script_component.hpp" - -private ["_logic","_setting","_objects"]; -_logic = [_this,0,objNull,[objNull]] call BIS_fnc_param; -if (!isNull _logic) then { - GVAR(damageThreshold_AI) = _logic getvariable ["damageThresholdAI", 1]; - GVAR(damageThreshold_Players) = _logic getvariable ["damageThresholdPlayers", 1]; -}; - -true \ No newline at end of file diff --git a/addons/medical/functions/fnc_onCarryObjectDropped.sqf b/addons/medical/functions/fnc_onCarryObjectDropped.sqf deleted file mode 100644 index 4b7dd14a59..0000000000 --- a/addons/medical/functions/fnc_onCarryObjectDropped.sqf +++ /dev/null @@ -1,21 +0,0 @@ -/** - * fnc_onCarryObjectDropped.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - -#include "script_component.hpp" - -private ["_unit","_params"]; -_unit = _this select 0; - -[format["fnc_onCarryObjectDropped: %1",_this]] call EFUNC(common,debug); - -_params = _unit getvariable QGVAR(onStartMovingUnitParams); -if (!isnil "_params") then { - _params call FUNC(handleDropUnit); -}; \ No newline at end of file diff --git a/addons/medical/functions/fnc_onDamage.sqf b/addons/medical/functions/fnc_onDamage.sqf deleted file mode 100644 index 489759f9b6..0000000000 --- a/addons/medical/functions/fnc_onDamage.sqf +++ /dev/null @@ -1,88 +0,0 @@ -/** - * fnc_onDamage.sqf - * @Descr: Called when some dude gets shot. Or stabbed. Or blown up. Or pushed off a cliff. Or hit by a car. Or burnt. Or poisoned. Or gassed. Or cut. You get the idea. - * @Author: KoffeinFlummi - * - * @Arguments: [unit OBJECT, selection STRING, damagE NUMBER, source OBJECT, projectile STRING (Could be an OBJECT on occasion)] - * @Return: damage value to be inflicted - * @PublicAPI: false - */ - -#include "script_component.hpp" - -#define ARMOURCOEF 2 - -private ["_unit", "_selectionName", "_damage", "_source", "_source", "_projectile", "_hitSelections", "_hitPoints", "_newDamage", "_found", "_cache_projectiles", "_cache_hitpoints", "_cache_damages"]; -_unit = _this select 0; -_selectionName = _this select 1; -_damage = _this select 2; -_source = _this select 3; -_projectile = _this select 4; - -if (!([_unit] call FUNC(hasMedicalEnabled))) exitwith { - call FUNC(handleDamage); // let it run through the damage threshold script -}; - -// Otherwise we carry on with collecting the necessary information - -if (typeName _projectile == "OBJECT") then { - _projectile = typeOf _projectile; -}; - -// This seems to only show up in MP too, but since it doesn't -// collide with anything, I'll check it in SP as well. -if (_selectionName == "r_femur_hit") then { - _selectionName = "leg_r"; -}; - -// If the damage is being weird, we just tell it to fuck off. -if !(_selectionName in ["head", "body", "hand_l", "hand_r", "leg_l", "leg_r"]) exitWith {0.01}; - -// Cache the handleDamage call -[_unit, _selectionName, _damage, _source, _projectile] call FUNC(cacheHandledamageCall); - -// Check if a unit would die from this hit -if (alive (vehicle _unit)) then { - _bodyPartn = [_selectionName] call FUNC(getBodyPartNumber); - - // Find the correct Damage threshold for unit. - _damageThreshold = [1,1,1]; - if (isPlayer _unit) then { - _damageThreshold =_unit getvariable[QGVAR(unitDamageThreshold), [GVAR(damageThreshold_Players), GVAR(damageThreshold_Players), GVAR(damageThreshold_Players) * 1.7]]; - } else { - _damageThreshold =_unit getvariable[QGVAR(unitDamageThreshold), [GVAR(damageThreshold_AI), GVAR(damageThreshold_AI), GVAR(damageThreshold_AI) * 1.7]]; - }; - _damageBodyPart = ([_unit,QGVAR(bodyPartStatus),[0,0,0,0,0,0]] call EFUNC(common,getDefinedVariable)) select _bodyPartn; - - _hitSelections = ["head", "body", "hand_l", "hand_r", "leg_l", "leg_r"]; - _hitPoints = ["HitHead", "HitBody", "HitLeftArm", "HitRightArm", "HitLeftLeg", "HitRightLeg"]; - - // Calculate change in damage. - _previousDamage = _unit getvariable [QGVAR(bodyPartStatusPrevious), [0,0,0,0,0,0]]; - _newDamage = _damage - (_previousDamage select _bodyPartn); - - // Check if damage to body part is higher as damage head - if (_bodyPartn == 0) exitwith { - if (_damageBodyPart >= ((_damageThreshold select 0) + _newDamage) && {(random(1) > 0.2)}) then { - _damage = 1; - }; - }; - - // Check if damage to body part is higher as damage torso - if (_bodyPartn == 1) exitwith { - if (_damageBodyPart >= ((_damageThreshold select 1) + _newDamage) && {(random(1) > 0.2)}) then { - _damage = 1; - }; - }; - // Check if damage to body part is higher as damage limbs - if (_damageBodyPart >= ((_damageThreshold select 2) + _newDamage) && {(random(1) > 0.95)}) exitwith { - _damage = 1; - }; - // Checking if we should return full damage or not - if (_damage > 0.975) then { - _damage = 0.975; - }; -} else { - _damage = 1; -}; -_damage diff --git a/addons/medical/functions/fnc_onInitForUnit.sqf b/addons/medical/functions/fnc_onInitForUnit.sqf deleted file mode 100644 index 596dc38b98..0000000000 --- a/addons/medical/functions/fnc_onInitForUnit.sqf +++ /dev/null @@ -1,31 +0,0 @@ -/** - * fn_onInitForUnit.sqf - * @Descr: Deprecated. Is no longer used, as we dropped init eventhandler methods. - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - -#include "script_component.hpp" - -private ["_unit","_handler"]; -_unit = _this select 0; - -if (!local _unit) exitwith {}; -if !(_unit isKindOf "CAManBase") exitwith{}; - -_unit addEventhandler["handleDamage", { - if ((missionNamespace getvariable[QGVAR(setting_AdvancedLevel), 0]) >= 0) then { - call FUNC(onDamage); // cache damage and pass it to handleDamage function - }; -}]; - -_unit addEventHandler["handleHeal", { - if ((missionNamespace getvariable[QGVAR(setting_AdvancedLevel), 0]) >= 0) then { - call FUNC(handleHeal) - }; -}]; - -["medical_onInitForUnit", [_unit]] call ace_common_fnc_localEvent; diff --git a/addons/medical/functions/fnc_onInjury_assignAirwayStatus.sqf b/addons/medical/functions/fnc_onInjury_assignAirwayStatus.sqf deleted file mode 100644 index df233be89d..0000000000 --- a/addons/medical/functions/fnc_onInjury_assignAirwayStatus.sqf +++ /dev/null @@ -1,26 +0,0 @@ -/** - * fn_assignAirwayStatus.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - -#include "script_component.hpp" - -private ["_unit", "_amountOfDamage", "_typeOfInjury", "_bodyPartn","_airwayItem","_airwayStatus","_selection", "_airwayIncrease"]; -_unit = _this select 0; -_amountOfDamage = _this select 1; -_typeOfInjury = _this select 2; -_bodyPartn = _this select 3; - -// only the head -if (_bodyPartn != 0) exitwith {}; - -if (_amountOfDamage > 0.4) then { - if (random(1) >= 0.8) then { - _unit setvariable [QGVAR(airwayCollapsed), true, true]; - }; -}; \ No newline at end of file diff --git a/addons/medical/functions/fnc_onInjury_assignFractures.sqf b/addons/medical/functions/fnc_onInjury_assignFractures.sqf deleted file mode 100644 index 19b4e95858..0000000000 --- a/addons/medical/functions/fnc_onInjury_assignFractures.sqf +++ /dev/null @@ -1,70 +0,0 @@ -/** - * fn_assignFractures.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - -#include "script_component.hpp" - -private ["_unit", "_amountOfDamage", "_typeOfInjury", "_bodyPartn","_amountOfBrokenBones","_fractures","_size","_selection"]; -_unit = _this select 0; -_amountOfDamage = _this select 1; -_typeOfInjury = _this select 2; -_bodyPartn = _this select 3; -_amountOfBrokenBones = 1; -_size = 1; -if (_amountOfDamage > 0.05) then { - switch (_typeOfInjury) do { - case "Bullet": { - _amountOfBrokenBones = 1; - _size = round(random(2)); - }; - case "Grenade": { - _amountOfBrokenBones = 1; - _size = round(random(2)); - if (_size < 1) then { - _size = 1; - }; - }; - case "Explosive": { - _amountOfBrokenBones = 1; - _size = round(random(2)); - if (_size < 1) then { - _size = 1; - }; - }; - case "Shell": { - _amountOfBrokenBones = 1; - _size = round(random(2)); - if (_size < 1) then { - _size = 1; - }; - }; - case "Unknown": { - _amountOfBrokenBones = 1; - _size = round(random(1)); - }; - case "Crash": { - _amountOfBrokenBones = 0; - _size = round(random(0)); - }; - default { - _amountOfBrokenBones = 1; - _size = round(random(1)); - }; - }; - if (_size > 2) then { - _size = 3; - }; - - _fractures = [_unit,QGVAR(fractures)] call EFUNC(common,getDefinedVariable); - _selection = _fractures select _bodyPartn; - _selection set [ _size, (_selection select _size) + _amountOfBrokenBones ]; - _fractures set [ _bodyPartn , _selection]; - - [_unit, QGVAR(fractures),_fractures] call EFUNC(common,setDefinedVariable); -}; \ No newline at end of file diff --git a/addons/medical/functions/fnc_onInjury_assignOpenWounds.sqf b/addons/medical/functions/fnc_onInjury_assignOpenWounds.sqf deleted file mode 100644 index f03f4c7abe..0000000000 --- a/addons/medical/functions/fnc_onInjury_assignOpenWounds.sqf +++ /dev/null @@ -1,70 +0,0 @@ -/** - * fn_assignOpenWounds.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - -#include "script_component.hpp" -#define ADD_INJURY(BODYPART,TYPE,AMOUNT) _selection = _openWounds select BODYPART; \ - _newAmount = (_selection select TYPE) + AMOUNT; \ - _selection set [ TYPE, _newAmount]; \ - _openWounds set [BODYPART , _selection]; - - -private ["_unit", "_amountOfDamage", "_typeOfInjury", "_bodyPartn", "_openWounds","_newAmount","_selection"]; -_unit = _this select 0; -_amountOfDamage = _this select 1; -_typeOfInjury = _this select 2; -_bodyPartn = _this select 3; - -if (_amountOfDamage > 0.05) exitwith { - _openWounds = [_unit,QGVAR(openWounds)] call EFUNC(common,getDefinedVariable); - switch (toLower _typeOfInjury) do { - case "bullet": { - ADD_INJURY(_bodyPartn, round(random(2)), 1); - }; - case "grenade": { - ADD_INJURY(_bodyPartn, round(random(2)), 1); - for "_i" from 0 to round(random(3)) /* step +1 */ do { - ADD_INJURY(round(random(6)), round(random(2)), 1); - }; - }; - case "explosive": { - ADD_INJURY(_bodyPartn, round(random(2)), 1); - for "_i" from 0 to round(random(4)) /* step +1 */ do { - ADD_INJURY(round(random(6)), round(random(2)), 1); - }; - }; - case "shell": { - ADD_INJURY(_bodyPartn, round(random(2)), 1); - for "_i" from 0 to round(random(5)) /* step +1 */ do { - ADD_INJURY(round(random(6)), round(random(2)), 1); - }; - }; - case "backblast": { - if (random(1)>=0.5) then{ - ADD_INJURY(_bodyPartn, round(random(2)), 1); - }; - }; - case "unknown": { - ADD_INJURY(_bodyPartn, round(random(1)), 1); - }; - case "vehiclecrash": { - if (random(1)>=0.5) then{ - ADD_INJURY(_bodyPartn, round(random(1)), 1); - }; - }; - default { - ADD_INJURY(_bodyPartn, round(random(1)), 1); - }; - }; - [_unit, QGVAR(openWounds),_openWounds] call EFUNC(common,setDefinedVariable); - - true; -}; - -false; \ No newline at end of file diff --git a/addons/medical/functions/fnc_onKilled.sqf b/addons/medical/functions/fnc_onKilled.sqf deleted file mode 100644 index e3609a57e5..0000000000 --- a/addons/medical/functions/fnc_onKilled.sqf +++ /dev/null @@ -1,12 +0,0 @@ -#include "script_component.hpp" - -private["_unit"]; -_unit = _this select 0; -if (!local _unit) exitwith {}; -[_unit, QGVAR(amountOfPain),0,true] call EFUNC(common,setDefinedVariable); -[_unit, QGVAR(heartRate),0,true] call EFUNC(common,setDefinedVariable); -[_unit, QGVAR(bloodPressure), [0,0],true] call EFUNC(common,setDefinedVariable); -if (_unit getvariable[QEGVAR(common,unconscious_non_captive_f),false]) then { - _unit setCaptive false; - _unit setvariable[QEGVAR(common,unconscious_non_captive_f),nil]; -}; \ No newline at end of file diff --git a/addons/medical/functions/fnc_onLocal.sqf b/addons/medical/functions/fnc_onLocal.sqf deleted file mode 100644 index 83611baa04..0000000000 --- a/addons/medical/functions/fnc_onLocal.sqf +++ /dev/null @@ -1,10 +0,0 @@ -#include "script_component.hpp" - -private["_unit", "_local"]; -_unit = _this select 0; -_local = _this select 1; -if (_local) then { - if (_unit getvariable[QGVAR(addedToUnitLoop),false]) then { - [_unit] call FUNC(addToInjuredCollection); - }; -}; \ No newline at end of file diff --git a/addons/medical/functions/fnc_onMedicationUsage.sqf b/addons/medical/functions/fnc_onMedicationUsage.sqf new file mode 100644 index 0000000000..a95a9e0e8e --- /dev/null +++ b/addons/medical/functions/fnc_onMedicationUsage.sqf @@ -0,0 +1,109 @@ +/* + * Author: Glowbal + * Handles the medication given to a patient. + * + * Arguments: + * 0: The patient + * 1: Medication Treatment classname + * 2: The medication treatment variablename + * 3: Max dosage + * 4: The time in the system + * 5: Incompatable medication > + * + * Return Value: + * NONE + * + * Public: No + */ + +#include "script_component.hpp" + +private ["_target", "_className", "_variable", "_maxDosage", "_timeInSystem", "_incompatabileMeds", "_foundEntry", "_allUsedMedication","_allMedsFromClassname", "_usedMeds", "_hasOverDosed", "_med", "_limit", "_classNamesUsed", "_decreaseAmount", "_viscosityChange", "_viscosityAdjustment", "_medicationConfig", "_onOverDose"]; +_target = _this select 0; +_className = _this select 1; +_variable = _this select 2; +_maxDosage = _this select 3; +_timeInSystem = _this select 4; +_incompatabileMeds = _this select 5; +_viscosityChange = _this select 6; + +_foundEntry = false; +_allUsedMedication = _target getvariable [QGVAR(allUsedMedication), []]; +{ + if (_x select 0 == _variable) exitwith { + _allMedsFromClassname = _x select 1; + if !(_className in _allMedsFromClassname) then { + _allMedsFromClassname pushback _className; + _x set [1, _allMedsFromClassname]; + _allUsedMedication set [_foreachIndex, _x]; + _target setvariable [QGVAR(allUsedMedication), _allUsedMedication]; + }; + _foundEntry = true; + }; +} foreach _allUsedMedication; + +if (!_foundEntry) then { + _allUsedMedication pushback [_variable, [_className]]; + _target setvariable [QGVAR(allUsedMedication), _allUsedMedication]; +}; + + +_usedMeds = _target getvariable [_variable, 0]; +if (_usedMeds >= floor (_maxDosage + round(random(2))) && _maxDosage >= 1) then { + [_target] call FUNC(setDead); +}; + +_hasOverDosed = 0; +{ + _med = _x select 0; + _limit = _x select 1; + { + _classNamesUsed = _x select 1; + if ({_x == _med} count _classNamesUsed > _limit) then { + _hasOverDosed = _hasOverDosed + 1; + }; + }foreach _allUsedMedication; +}foreach _incompatabileMeds; + +if (_hasOverDosed > 0) then { + _medicationConfig = (configFile >> "ACE_Medical_Advanced" >> "Treatment" >> "Medication"); + _onOverDose = getText (_medicationConfig >> "onOverDose"); + if (isClass (_medicationConfig >> _className)) then { + _medicationConfig = (_medicationConfig >> _className); + if (isText (_medicationConfig >> "onOverDose")) then { _onOverDose = getText (_medicationConfig >> "onOverDose"); }; + }; + if (isNil _onOverDose) then { + _onOverDose = compile _onOverDose; + } else { + _onOverDose = missionNamespace getvariable _onOverDose; + }; + [_target, _className] call _onOverDose; +}; + +_decreaseAmount = 1 / _timeInSystem; +_viscosityAdjustment = _viscosityChange / _timeInSystem; + +[{ + private ["_args", "_target", "_timeInSystem", "_variable", "_amountDecreased","_decreaseAmount", "_usedMeds", "_viscosityAdjustment"]; + _args = _this select 0; + _target = _args select 0; + _timeInSystem = _args select 1; + _variable = _args select 2; + _amountDecreased = _args select 3; + _decreaseAmount = _args select 4; + _viscosityAdjustment = _args select 5; + + _usedMeds = _target getvariable [_variable, 0]; + _usedMeds = _usedMeds - _decreaseAmount; + _target setvariable [_variable, _usedMeds]; + + _amountDecreased = _amountDecreased + _decreaseAmount; + + // Restoring the viscosity while the medication is leaving the system + _target setvariable [QGVAR(peripheralResistance), ((_target getvariable [QGVAR(peripheralResistance), 100]) - _viscosityAdjustment) max 0]; + + if (_amountDecreased >= 1 || (_usedMeds <= 0) || !alive _target) then { + [(_this select 1)] call cba_fnc_removePerFrameHandler; + }; + _args set [3, _amountDecreased]; +}, 1, [_target, _timeInSystem, _variable, 0, _decreaseAmount, _viscosityAdjustment] ] call CBA_fnc_addPerFrameHandler; diff --git a/addons/medical/functions/fnc_onMenuOpen.sqf b/addons/medical/functions/fnc_onMenuOpen.sqf deleted file mode 100644 index 5597dacce1..0000000000 --- a/addons/medical/functions/fnc_onMenuOpen.sqf +++ /dev/null @@ -1,76 +0,0 @@ -/** - * fn_onMenuOpen.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - -#include "script_component.hpp" - -if (isnil QGVAR(LatestDisplayOptionMenu)) then { - GVAR(LatestDisplayOptionMenu) = "triage"; -} else { - if (GVAR(LatestDisplayOptionMenu) == "toggle") then { - GVAR(LatestDisplayOptionMenu) = "triage"; - GVAR(INTERACTION_TARGET) = GVAR(INTERACTION_TARGET_PREVIOUS); - }; -}; - -private ["_display","_target"]; -_target = GVAR(INTERACTION_TARGET); -if (isnil QGVAR(INTERACTION_TARGET_PREVIOUS)) then { - GVAR(INTERACTION_TARGET_PREVIOUS) = _target; -}; -[GVAR(LatestDisplayOptionMenu)] call FUNC(handleUI_DisplayOptions); - -[] call FUNC(updateActivityLog); -[_target] call FUNC(updateUIInfo); - -// 11 till 18 -disableSerialization; -_display = _this select 0; //uiNamespace getVariable QGVAR(medicalMenu); -if (isnil "_display") exitwith { - -}; - -(_display displayCtrl 11) ctrlSetTooltip localize "STR_ACE_UI_VIEW_TRIAGE_CARD"; -(_display displayCtrl 12) ctrlSetTooltip localize "STR_ACE_UI_EXAMINE_PATIENT"; -(_display displayCtrl 13) ctrlSetTooltip localize "STR_ACE_UI_BANDAGE_FRACTURES"; -(_display displayCtrl 14) ctrlSetTooltip localize "STR_ACE_UI_MEDICATION"; -(_display displayCtrl 15) ctrlSetTooltip localize "STR_ACE_UI_AIRWAY_MANAGEMENT"; -(_display displayCtrl 16) ctrlSetTooltip localize "STR_ACE_UI_ADVANCED_TREATMENT"; -(_display displayCtrl 17) ctrlSetTooltip localize "STR_ACE_UI_DRAG_CARRY"; -(_display displayCtrl 18) ctrlSetTooltip localize "STR_ACE_UI_TOGGLE_SELF"; - -(_display displayCtrl 301) ctrlSetTooltip localize "STR_ACE_UI_SELECT_HEAD"; -(_display displayCtrl 302) ctrlSetTooltip localize "STR_ACE_UI_SELECT_TORSO"; -(_display displayCtrl 303) ctrlSetTooltip localize "STR_ACE_UI_SELECT_ARM_R"; -(_display displayCtrl 304) ctrlSetTooltip localize "STR_ACE_UI_SELECT_ARM_L"; -(_display displayCtrl 305) ctrlSetTooltip localize "STR_ACE_UI_SELECT_LEG_R"; -(_display displayCtrl 306) ctrlSetTooltip localize "STR_ACE_UI_SELECT_LEG_L"; -(_display displayCtrl 2001) ctrlSetTooltip localize "STR_ACE_UI_SELECT_TRIAGE_STATUS"; - - -(_display displayCtrl 1) ctrlSetText format["%1",[_target] call EFUNC(common,getName)]; -setMousePosition [ 0.4, 0.4]; - -[QGVAR(onMenuOpen), "onEachFrame", { - if (isNull GVAR(INTERACTION_TARGET)) then { - GVAR(INTERACTION_TARGET) = ACE_player; - }; - [GVAR(INTERACTION_TARGET)] call FUNC(updateUIInfo); - [GVAR(INTERACTION_TARGET)] call FUNC(updateIcons); - [GVAR(LatestDisplayOptionMenu)] call FUNC(handleUI_DisplayOptions); - - [] call FUNC(updateActivityLog); - - _status = [GVAR(INTERACTION_TARGET)] call FUNC(getTriageStatus); - ((_this select 0) displayCtrl 2000) ctrlSetText (_status select 0); - ((_this select 0) displayCtrl 2000) ctrlSetBackgroundColor (_status select 2); - - }, [_display]] call BIS_fnc_addStackedEventHandler; - - ["Medical_onMenuOpen", [ACE_player, _interactionTarget]] call ace_common_fnc_localEvent; diff --git a/addons/medical/functions/fnc_onPropagateWound.sqf b/addons/medical/functions/fnc_onPropagateWound.sqf new file mode 100644 index 0000000000..b2f611314b --- /dev/null +++ b/addons/medical/functions/fnc_onPropagateWound.sqf @@ -0,0 +1,37 @@ +/* + * Author: Glowbal + * Adds a new injury to the wounds collection from remote clients. Is used to split up the large collection of injuries broadcasting across network. + * + * Arguments: + * 0: The remote unit + * 1: injury + * + * Return Value: + * None + * + * Public: No + */ + +#include "script_component.hpp" + +private ["_unit", "_injury", "_openWounds", "_injuryID", "_exists"]; +_unit = _this select 0; +_injury = _this select 1; + +if (!local _unit) then { + _openWounds = _unit getvariable[QGVAR(openWounds), []]; + _injuryID = _injury select 0; + + _exists = false; + { + if (_x select 0 == _injuryID) exitwith { + _exists = true; + _openWounds set [_foreachIndex, _injury]; + }; + }foreach _openWounds; + + if (!_exists) then { + _openWounds pushback _injury; + }; + _unit setvariable [GVAR(openWounds), _openWounds]; +}; diff --git a/addons/medical/functions/fnc_onStartMovingUnit.sqf b/addons/medical/functions/fnc_onStartMovingUnit.sqf deleted file mode 100644 index 7fe3dd8d65..0000000000 --- a/addons/medical/functions/fnc_onStartMovingUnit.sqf +++ /dev/null @@ -1,25 +0,0 @@ -/** - * fnc_onStartMovingUnit.sqf - * @Descr: is called when a unit start to move another unit through either carry or drag actions. - * - * @Author: Glowbal - * - * @Arguments: [caller OBJECT, unit OBJECT, killOnDrop BOOL (Should the unit be killed when being dropped), dragging BOOL (true means the dragging animations should be played, false will play carry animations)] - * @Return: nil - * @PublicAPI: false - */ - -#include "script_component.hpp" - - -private ["_caller","_target","_killOnDrop","_dragging"]; -_caller = _this select 0; -_target = _this select 1; -_killOnDrop = _this select 2; -_dragging = _this select 3; - -_caller setvariable[QGVAR(onStartMovingUnitParams), [_caller, _target, _killOnDrop, _dragging]]; - -[_target, true] call EFUNC(common,disableAI_f); - -nil; \ No newline at end of file diff --git a/addons/medical/functions/fnc_onTreatmentCompleted.sqf b/addons/medical/functions/fnc_onTreatmentCompleted.sqf deleted file mode 100644 index 4505575f00..0000000000 --- a/addons/medical/functions/fnc_onTreatmentCompleted.sqf +++ /dev/null @@ -1,26 +0,0 @@ -/** - * fnc_handleTreatmentCompleted.sqf - * @Descr: Called when a treatment action has been completed. - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - -#include "script_component.hpp" - -private ["_caller", "_target","_selectionName","_removeItem"]; -_caller = _this select 0; -_target = _this select 1; -_selectionName = _this select 2; -_removeItem = _this select 3; - -if (primaryWeapon _caller == "ACE_FakePrimaryWeapon") then { - _caller removeWeapon "ACE_FakePrimaryWeapon"; -}; - -[_caller,false] call FUNC(treatmentMutex); - -// TODO: BUG: if AI finishes treatment, it will also hide the icon for the player -[QGVAR(treatmentIconID), false, "", [1,1,1,1]] call EFUNC(gui,displayIcon); diff --git a/addons/medical/functions/fnc_onUnconscious.sqf b/addons/medical/functions/fnc_onUnconscious.sqf deleted file mode 100644 index b18f55c099..0000000000 --- a/addons/medical/functions/fnc_onUnconscious.sqf +++ /dev/null @@ -1,23 +0,0 @@ -/** - * fnc_onUnconscious.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - -#include "script_component.hpp" - -private ["_unit", "_state"]; -_unit = _this select 0; -_state = _this select 1; - -if (_state) then { - if (GVAR(setting_allowAirwayInjuries)) then { - if (random(1) >= 0.3) then { - _unit setvariable [QGVAR(airwayOccluded), true, true]; - }; - }; -}; \ No newline at end of file diff --git a/addons/medical/functions/fnc_onWoundUpdateRequest.sqf b/addons/medical/functions/fnc_onWoundUpdateRequest.sqf new file mode 100644 index 0000000000..55b2ab28fe --- /dev/null +++ b/addons/medical/functions/fnc_onWoundUpdateRequest.sqf @@ -0,0 +1,27 @@ +/* + * Author: Glowbal + * Enabled the vitals loop for a unit. + * + * Arguments: + * 0: The Unit + * 1: the last known ID + * 2: Origin object + * + * ReturnValue: + * + * + * Public: Yes + */ + +#include "script_component.hpp" +private ["_unit", "_lastId", "_openWounds"]; +_unit = _this select 0; +_lastId = _this select 1; +_originOfrequest = _this select 2; + +_openWounds = _unit getvariable [QGVAR(openWounds), []]; +if (count _openWounds > _lastId) then { + { + ["medical_propagateWound", [_originOfrequest], [_unit, _x]] call EFUNC(common,targetEvent); + }foreach _openWounds; +}; diff --git a/addons/medical/functions/fnc_openMenu.sqf b/addons/medical/functions/fnc_openMenu.sqf deleted file mode 100644 index 5e0b488ff5..0000000000 --- a/addons/medical/functions/fnc_openMenu.sqf +++ /dev/null @@ -1,44 +0,0 @@ -/** - * fn_openMenu.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - -#include "script_component.hpp" - - -if (dialog) exitwith { - disableSerialization; - - private "_display"; - _display = uiNamespace getVariable QGVAR(medicalMenu); - if (!isnil "_display") then { - closeDialog 314412; - }; - -}; - -private ["_interactionTarget"]; -_interactionTarget = objNull; -if (count _this > 0) then { - _interactionTarget = _this select 0; - -} else { - _interactionTarget = cursortarget; - if (isNull _interactionTarget) then { - _interactionTarget = ACE_player; - }; - if (_interactionTarget distance ACE_player > 5 || !(_interactionTarget isKindOf "CaManBase")) then { - _interactionTarget = ACE_player; - }; -}; - -if (isNull _interactionTarget) then { - _interactionTarget = ACE_player; -}; -GVAR(INTERACTION_TARGET) = _interactionTarget; -createDialog QGVAR(medicalMenu); diff --git a/addons/medical/functions/fnc_parseConfigForInjuries.sqf b/addons/medical/functions/fnc_parseConfigForInjuries.sqf new file mode 100644 index 0000000000..3ef3b4c684 --- /dev/null +++ b/addons/medical/functions/fnc_parseConfigForInjuries.sqf @@ -0,0 +1,96 @@ +/* + * Author: Glowbal + * Parse the ACE_Medical_Advanced config for all injury types. + * + * Arguments: + * + * ReturnValue: + * + * + * Public: No + */ + +#include "script_component.hpp" + +private ["_injuriesRootConfig", "_woundsConfig", "_allWoundClasses", "_amountOf", "_entry","_classType", "_selections", "_bloodLoss", "_pain","_minDamage","_causes", "_allTypes", "_damageTypesConfig", "_thresholds", "_typeThresholds", "_selectionSpecific", "_selectionSpecificType", "_classDisplayName", "_subClassDisplayName"]; + +_injuriesRootConfig = (configFile >> "ACE_Medical_Advanced" >> "Injuries"); +_allTypes = ["stab", "grenade", "bullet", "explosive", "shell", "punch", "vehiclecrash", "backblast", "falling", "bite", "ropeburn"]; + +_allFoundDamageTypes = []; +_configDamageTypes = (_injuriesRootConfig >> "damageTypes"); +for "_i" from 0 to (count _configDamageTypes -1) /* step +1 */ do { + if (isClass(_configDamageTypes select _i)) then { + _allFoundDamageTypes pushback (configName (_configDamageTypes select _i)); + }; +}; +GVAR(allAvailableDamageTypes) = _allFoundDamageTypes; + +_parseForSubClassWounds = { + _subClass = _this select 0; + if (isClass (_entry >> _subClass)) exitwith { + _subClassConfig = (_entry >> _subClass); + _subClasstype = _classType + (configName _subClassConfig); + _subClassselections = if (isArray(_subClassConfig >> "selections")) then { getArray(_subClassConfig >> "selections");} else { _selections }; + _subClassbloodLoss = if (isNumber(_subClassConfig >> "bleedingRate")) then { getNumber(_subClassConfig >> "bleedingRate");} else { _bloodLoss }; + _subClasspain = if (isNumber(_subClassConfig >> "pain")) then { getNumber(_subClassConfig >> "pain");} else { _pain }; + _subClassminDamage = if (isNumber(_subClassConfig >> "minDamage")) then { getNumber(_subClassConfig >> "minDamage");} else { _minDamage }; + _subClasscauses = if (isArray(_subClassConfig >> "causes")) then { getArray(_subClassConfig >> "causes");} else { _causes }; + _subClassDisplayName = if (isText(_entry >> "name")) then { getText(_entry >> "name");} else {_classDisplayName + " " + _subClass}; + if (count _selections > 0 && count _causes > 0) then { + _allWoundClasses pushback [_subClasstype, _subClassselections, _subClassbloodLoss, _subClasspain, _subClassminDamage, _subClasscauses, _subClassDisplayName]; + }; + true; + }; + false; +}; + +// TODO classTypes are strings currently. Convert them to unqiue IDs instead. +_woundsConfig = (_injuriesRootConfig >> "wounds"); +_allWoundClasses = []; +if (isClass _woundsConfig) then { + _amountOf = count _woundsConfig; + for "_i" from 0 to (_amountOf -1) /* step +1 */ do { + _entry = _woundsConfig select _i; + if (isClass _entry) then { + _classType = (ConfigName _entry); + _selections = if (isArray(_entry >> "selections")) then { getArray(_entry >> "selections");} else {[]}; + _bloodLoss = if (isNumber(_entry >> "bleedingRate")) then { getNumber(_entry >> "bleedingRate");} else {0}; + _pain = if (isNumber(_entry >> "pain")) then { getNumber(_entry >> "pain");} else {0}; + _minDamage = if (isNumber(_entry >> "minDamage")) then { getNumber(_entry >> "minDamage");} else {0}; + _causes = if (isArray(_entry >> "causes")) then { getArray(_entry >> "causes");} else {[]}; + _classDisplayName = if (isText(_entry >> "name")) then { getText(_entry >> "name");} else {_classType}; + if (["Minor"] call _parseForSubClassWounds || ["Medium"] call _parseForSubClassWounds || ["Large"] call _parseForSubClassWounds) exitwith {}; // continue to the next one + + // There were no subclasses, so we will add this one instead. + if (count _selections > 0 && count _causes > 0) then { + _allWoundClasses pushback [_classType, _selections, _bloodLoss, _pain, _minDamage, _causes, _classDisplayName]; + }; + true; + }; + }; +}; +GVAR(AllWoundInjuryTypes) = _allWoundClasses; + +_damageTypesConfig = (configFile >> "ACE_Medical_Advanced" >> "Injuries" >> "damageTypes"); +_thresholds = getArray(_damageTypesConfig >> "thresholds"); +_selectionSpecific = getNumber(_damageTypesConfig >> "selectionSpecific"); + +{ + _varName = format[QGVAR(woundInjuryType_%1),_x]; + _woundTypes = []; + _type = _x; + { + // Check if this type is in the causes of a wound class, if so, we will store the wound types for this damage type + if (_type in (_x select 5)) then { + _woundTypes pushback _x; + }; + }foreach _allWoundClasses; + _typeThresholds = _thresholds; + _selectionSpecificType = _selectionSpecific; + if (isClass(_damageTypesConfig >> _x)) then { + if (isArray(_damageTypesConfig >> _x >> "thresholds")) then { _typeThresholds = getArray(_damageTypesConfig >> _x >> "thresholds");}; + if (isNumber(_damageTypesConfig >> _x >> "selectionSpecific")) then { _selectionSpecificType = getNumber(_damageTypesConfig >> _x >> "selectionSpecific");}; + }; + missionNamespace setvariable [_varName, [_typeThresholds, _selectionSpecificType > 0, _woundTypes]]; +}foreach _allTypes; diff --git a/addons/medical/functions/fnc_playInjuredSound.sqf b/addons/medical/functions/fnc_playInjuredSound.sqf index f514f8ddae..1044be7ecf 100644 --- a/addons/medical/functions/fnc_playInjuredSound.sqf +++ b/addons/medical/functions/fnc_playInjuredSound.sqf @@ -1,14 +1,16 @@ -/** - * fn_playInjuredSound.sqf - * @Descr: Play the injured sound for a unit if the unit is damaged. The sound broadcasted across MP. +/* + * Author: Glowbal + * Play the injured sound for a unit if the unit is damaged. The sound broadcasted across MP. * Will not play if the unit has already played a sound within to close a time frame. - * Delay: With minimal damage (below 1), the delay is (10 + random(50)) seconds. Otherwise it is 60 seconds / damage. - * - * @Author: Glowbal + * Delay: With minimal damage (below 1), the delay is (10 + random(50)) seconds. Otherwise it is 60 seconds / damage. * - * @Arguments: [unit OBJECT] - * @Return: nil - * @PublicAPI: false + * Arguments: + * 0: The Unit + * + * ReturnValue: + * + * + * Public: No */ #include "script_component.hpp" @@ -50,18 +52,18 @@ _availableSounds_C = [ "WoundedGuyC_05" ]; -// TODO Maybe base this off hitpoint damage +// TODO Base this off hitpoint damage // Find the amount of damage for this unit, based upon body part status. -_bodyPartStatus = [_unit,QGVAR(bodyPartStatus)] call EFUNC(common,getDefinedVariable); +//_bodyPartStatus = [_unit,QGVAR(bodyPartStatus)] call EFUNC(common,getDefinedVariable); _amountOfDamage = 0; -{ +/*{ _amountOfDamage = _amountOfDamage + _x; -}foreach _bodyPartStatus; +}foreach _bodyPartStatus;*/ // Play the sound if there is any damage present. if (_amountOfDamage > 0) exitwith { _sound = ""; - + // Select the to be played sound based upon damage amount. if (_amountOfDamage > 1) then { if (random(1) > 0.5) then { @@ -72,10 +74,10 @@ if (_amountOfDamage > 0) exitwith { } else { _sound = _availableSounds_B select (round(random((count _availableSounds_B) - 1))); }; - + // Play the sound playSound3D [((getArray(configFile >> "CfgSounds" >> _sound >> "sound") select 0)), _unit, false, getPos _unit, 2, 1, 15]; // +2db, 15 meters. - + // Figure out what the delay will be before it is possible to play a sound again. private "_delay"; _delay = 1; @@ -84,7 +86,7 @@ if (_amountOfDamage > 0) exitwith { } else { _delay = (60 / _amountOfDamage); }; - + // Clean up the lock [{ (_this select 0) setvariable [QGVAR(playingInjuredSound),nil]; diff --git a/addons/medical/functions/fnc_handleReactionHit.sqf b/addons/medical/functions/fnc_reactionToDamage.sqf similarity index 82% rename from addons/medical/functions/fnc_handleReactionHit.sqf rename to addons/medical/functions/fnc_reactionToDamage.sqf index 2128fa65c6..b8c9256bde 100644 --- a/addons/medical/functions/fnc_handleReactionHit.sqf +++ b/addons/medical/functions/fnc_reactionToDamage.sqf @@ -11,11 +11,12 @@ #include "script_component.hpp" private ["_unit","_amountOfDamage"]; -_unit = _this select 0; +_unit = _this select 0; _amountOfDamage = _this select 1; if (_amountOfDamage > 0.2) then { - // [_unit] call FUNC(playInjuredSound); + + [_unit] call FUNC(playInjuredSound); if ((vehicle _unit) isKindOf "StaticWeapon") exitwith { if (_amountOfDamage > 1) then { _unit action ["eject", vehicle _unit]; @@ -38,14 +39,14 @@ if (_amountOfDamage > 0.2) then { [_unit] call EFUNC(common,setProne); }; }; - if (isPlayer _unit) then { - 76 cutRsc [QGVAR(ScreenEffectsHit),"PLAIN"]; + if (_unit == ACE_player) then { + //76 cutRsc [QGVAR(ScreenEffectsHit),"PLAIN"]; addCamShake [3, 5, _amountOfDamage + random 10]; }; } else { if (_amountOfDamage > 0) then { - if (isPlayer _unit) then { - 76 cutRsc [QGVAR(ScreenEffectsHit),"PLAIN"]; + if (_unit == ACE_player) then { + // 76 cutRsc [QGVAR(ScreenEffectsHit),"PLAIN"]; }; }; -}; \ No newline at end of file +}; diff --git a/addons/medical/functions/fnc_registerUnconsciousCondition.sqf b/addons/medical/functions/fnc_registerUnconsciousCondition.sqf deleted file mode 100644 index f34d05b57d..0000000000 --- a/addons/medical/functions/fnc_registerUnconsciousCondition.sqf +++ /dev/null @@ -1,22 +0,0 @@ -/** - * fn_registerUnconsciousCondition.sqf - * @Descr: Register new condition for the unconscious state. Conditions are not actively checked for units unless unit is in unconscious state. - * @Author: Glowbal - * - * @Arguments: [code CODE] - * @Return: void - * @PublicAPI: true - */ - -#include "script_component.hpp" - -if (isnil QGVAR(unconsciousConditions_F)) then { - GVAR(unconsciousConditions_F) = []; -}; -if (typeName _this == typeName []) then { - { - if (typeName _x == typeName {}) then { - GVAR(unconsciousConditions_F) pushback _x; - }; - }foreach _this; -}; \ No newline at end of file diff --git a/addons/medical/functions/fnc_selectionNameToNumber.sqf b/addons/medical/functions/fnc_selectionNameToNumber.sqf new file mode 100644 index 0000000000..1e8d79183f --- /dev/null +++ b/addons/medical/functions/fnc_selectionNameToNumber.sqf @@ -0,0 +1,16 @@ +/* + * Author: Glowbal + * Get the number representation of a selection name. + * + * Arguments: + * 0: The selection name of a unit + * + * ReturnValue: + * Number representation. -1 if invalid. + * + * Public: yes + */ + +#include "script_component.hpp" + +(["head","body","hand_l","hand_r","leg_l","leg_r"] find (_this select 0)); diff --git a/addons/medical/functions/fnc_setCaptiveSwitch.sqf b/addons/medical/functions/fnc_setCaptiveSwitch.sqf deleted file mode 100644 index 378f42e5d4..0000000000 --- a/addons/medical/functions/fnc_setCaptiveSwitch.sqf +++ /dev/null @@ -1,33 +0,0 @@ -/** - * fn_setCaptiveSwitch.sqf - * @Descr: Register a unit as captive for the unconscious state - * @Author: Glowbal - * - * @Arguments: [unit OBJECT, setCaptive BOOL] - * @Return: BOOL True if unit is put as set captive, otherwise false - * @PublicAPI: false - */ - -#include "script_component.hpp" - -private ["_unit", "_captiveSwitch", "_setCaptive"]; -_unit = [_this, 0, objNull, [objNull]] call BIS_fnc_Param; -_setCaptive = [_this, 1, false, [false]] call BIS_fnc_Param; - - -_captiveSwitch = true; -if (_setCaptive) then { - if (captive _unit) then { - _captiveSwitch = false; - } else { - _unit setCaptive true; - }; -} else { - if (captive _unit) then { - _unit setCaptive false; - } else { - _captiveSwitch = false; - }; -}; - -_captiveSwitch \ No newline at end of file diff --git a/addons/medical/functions/fnc_setCardiacArrest.sqf b/addons/medical/functions/fnc_setCardiacArrest.sqf index 090af82b49..03b9835fd7 100644 --- a/addons/medical/functions/fnc_setCardiacArrest.sqf +++ b/addons/medical/functions/fnc_setCardiacArrest.sqf @@ -1,11 +1,15 @@ -/** - * fn_setCardiacArrest.sqf - * @Descr: Triggers a unit into the Cardiac Arrest state from CMS. Will put the unit in an unconscious state and run a countdown timer until unit dies.
Timer is a random value between 120 and 720 seconds. - * @Author: Glowbal +/* + * Author: Glowbal + * Triggers a unit into the Cardiac Arrest state from CMS. Will put the unit in an unconscious state and run a countdown timer until unit dies. + * Timer is a random value between 120 and 720 seconds. * - * @Arguments: [unit OBJECT (The unit that will be put in cardiac arrest state)] - * @Return: void - * @PublicAPI: true + * Arguments: + * 0: The unit that will be put in cardiac arrest state + * + * ReturnValue: + * + * + * Public: yes */ #include "script_component.hpp" @@ -14,13 +18,12 @@ private ["_unit", "_modifier","_timer","_counter", "_heartRate"]; _unit = _this select 0; if (_unit getvariable [QGVAR(inCardiacArrest),false]) exitwith {}; -[format["%1 is put into cardiac arrest",_unit]] call EFUNC(common,debug); _unit setvariable [QGVAR(inCardiacArrest), true,true]; -[_unit,QGVAR(heartRate), 0] call EFUNC(common,setDefinedVariable); +_unit setvariable [QGVAR(heartRate), 0]; ["Medical_onEnteredCardiacArrest", [_unit]] call ace_common_fnc_localEvent; -[_unit] call FUNC(setUnconsciousState); +[_unit] call FUNC(setUnconscious); _counter = 120 + round(random(600)); _timer = 0; @@ -31,13 +34,12 @@ _timer = 0; _timer = _args select 1; _counter = _args select 2; - _heartRate = [_unit,QGVAR(heartRate)] call EFUNC(common,getDefinedVariable); + _heartRate = _unit getvariable [QGVAR(heartRate), 0]; if (_heartRate > 0 || !alive _unit) exitwith { _unit setvariable [QGVAR(inCardiacArrest), nil,true]; [(_this select 1)] call cba_fnc_removePerFrameHandler; }; if (_counter - _timer < 1) exitwith { - [_unit] call FUNC(setDead); [(_this select 1)] call cba_fnc_removePerFrameHandler; _unit setvariable [QGVAR(inCardiacArrest), nil,true]; diff --git a/addons/medical/functions/fnc_setDead.sqf b/addons/medical/functions/fnc_setDead.sqf index d43c1e1afc..69ce88c86f 100644 --- a/addons/medical/functions/fnc_setDead.sqf +++ b/addons/medical/functions/fnc_setDead.sqf @@ -1,17 +1,18 @@ -/** - * fn_setDead.sqf - * @Descr: Kills a unit - * @Author: Glowbal +/* + * Author: Glowbal + * Either kills a unit or puts the unit in a revivable state, depending on the settings. * - * @Arguments: [unit OBJECT] - * @Return: void - * @PublicAPI: true + * Arguments: + * 0: The unit that will be killed + * + * ReturnValue: + * + * + * Public: yes */ #include "script_component.hpp" -#define TIME_BETWEEN_REVIVE_RUNS 0.5 - private ["_unit"]; _unit = _this select 0; _force = false; @@ -21,65 +22,15 @@ if (count _this >= 2) then { if (!alive _unit) exitwith{}; if (!local _unit) exitwith { - [[_unit, _force], QUOTE(FUNC(setDead)), _unit, false] call BIS_fnc_MP; + [[_unit, _force], QUOTE(DFUNC(setDead)), _unit, false] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ }; -if (isnil QGVAR(ENABLE_REVIVE_F)) then { - GVAR(ENABLE_REVIVE_F) = 0; +if (missionNamespace getVariable [QGVAR(enableRevive), false]) exitwith { + // TODO Implement the revive state }; -if (((GVAR(ENABLE_REVIVE_F) == 1 && isPlayer _unit) || (GVAR(ENABLE_REVIVE_F) == 2)) && !_force && (alive (vehicle _unit))) exitwith { - // enter revive state - _unit setvariable ["ACE_inReviveState", true, true]; - - // Remain unconscious while in revive state - [_unit] call FUNC(setUnconsciousState); - - // setting the revive default values - if (isnil QGVAR(REVIVE_TIMER_F)) then { - GVAR(REVIVE_TIMER_F) = 10; - }; - if (isnil QGVAR(REVIVE_NUMBER_MAX_F)) then { - GVAR(REVIVE_NUMBER_MAX_F) = -1; - }; - - [{ - private ["_unit","_playerDead","_counter"]; - _unit = (_this select 0) select 0; - _playerDead = (_this select 0) select 1; - - // Check if a unit woke up or was already killed - if (!([_unit] call FUNC(isUnconscious)) || !alive _unit) exitwith { - [(_this select 1)] call cba_fnc_removePerFrameHandler; - - // Cleaning up the variables, as we no longer need them. - _unit setvariable ["ACE_reviveCounterValue", nil]; - _unit setvariable ["ACE_inReviveState", nil, true]; - }; - - _counter = _unit getvariable ["ACE_reviveCounterValue", 0]; - if (_counter >= GVAR(REVIVE_TIMER_F)) exitwith{ - if (isPlayer _unit) then { - titleText ["You died..","PLAIN DOWN"]; - }; - [_unit,"ACE_isDead", true, true] call EFUNC(common,setDefinedVariable); - if (_playerDead) then { - [_unit,QGVAR(isDeadPlayer),true,true] call EFUNC(common,setDefinedVariable); - }; - - _unit setdamage 1; // killing a unit will automatically clean up all variables. - - [(_this select 1)] call cba_fnc_removePerFrameHandler; - }; - _unit setvariable ["ACE_reviveCounterValue",_counter + TIME_BETWEEN_REVIVE_RUNS]; - - }, TIME_BETWEEN_REVIVE_RUNS, [_unit, isPlayer _unit] ] call CBA_fnc_addPerFrameHandler; - -}; - -[_unit,"ACE_isDead",true,true] call EFUNC(common,setDefinedVariable); +_unit setvariable ["ACE_isDead", true, true]; if (isPLayer _unit) then { - [_unit,QGVAR(isDeadPlayer),true,true] call EFUNC(common,setDefinedVariable); + _unit setvariable ["isDeadPlayer", true, true]; }; - _unit setdamage 1; diff --git a/addons/medical/functions/fnc_setHitPointDamage.sqf b/addons/medical/functions/fnc_setHitPointDamage.sqf new file mode 100644 index 0000000000..473852b159 --- /dev/null +++ b/addons/medical/functions/fnc_setHitPointDamage.sqf @@ -0,0 +1,78 @@ +/* + * Author: KoffeinFlummi + * My very own setHitPointDamage since BIS's one is buggy when affecting a remote unit. + * It also doesn't change the overall damage. This does. + * + * Arguments: + * 0: Unit + * 1: HitPoint + * 2: Damage + * 3: Disable overall damage adjustment (optional) + * + * Return Value: + * nil + * + * Public: Yes + */ + +#include "script_component.hpp" + +private ["_unit", "_selection", "_damage", "_selections", "_damages", "_damageOld", "_damageSumOld", "_damageNew", "_damageSumNew", "_damageFinal"]; + +_unit = _this select 0; +_selection = _this select 1; +_damage = _this select 2; + +// Unit isn't local, give function to machine where it is. +if !(local _unit) exitWith { + [_this, "ace_medical_fnc_setHitPointDamage", _unit] call EFUNC(common,execRemoteFnc); +}; + +// Check if overall damage adjustment is disabled +if (count _this > 3 && {_this select 3}) exitWith { + _unit setHitPointDamage [_selection, _damage]; +}; + +_selections = [ + "HitHead", + "HitBody", + "HitLeftArm", + "HitRightArm", + "HitLeftLeg", + "HitRightLeg" +]; + +if !(_selection in _selections) exitWith { + _unit setHitPointDamage [_selection, _damage]; +}; + +GVAR(unit) = _unit; +_damages = [_selections, {GVAR(unit) getHitPointDamage _this}] call EFUNC(common,map); + +_damageOld = damage _unit; +_damageSumOld = 0; +{ + _damageSumOld = _damageSumOld + _x; +} forEach _damages; +_damageSumOld = _damageSumOld max 0.001; + +_damages set [_selections find _selection, _damage]; + +_damageSumNew = 0; +{ + _damageSumNew = _damageSumNew + _x; +} forEach _damages; + +_damageNew = _damageSumNew / 6; +if (_damageOld > 0) then { + _damageNew = _damageOld * (_damageSumNew / _damageSumOld); +}; + +// @todo: prevent death + +_unit setDamage _damageNew; + +{ + _damageFinal = (_damages select _forEachIndex); + _unit setHitPointDamage [_x, _damageFinal]; +} forEach _selections; diff --git a/addons/medical/functions/fnc_setMedicRole.sqf b/addons/medical/functions/fnc_setMedicRole.sqf deleted file mode 100644 index 5c8a67539a..0000000000 --- a/addons/medical/functions/fnc_setMedicRole.sqf +++ /dev/null @@ -1,23 +0,0 @@ -/** - * fn_setMedicRole.sqf - * @Descr: Register a unit as a medic - * @Author: Glowbal - * - * @Arguments: [unit OBJECT (Any unit of type CAManBase), value NUMBER (0 is normal. 1 or above is medic)] - * @Return: void - * @PublicAPI: true - */ - -#include "script_component.hpp" - -private ["_unit","_value"]; -_unit = [_this,0,ObjNull,[ObjNull]] call BIS_fnc_param; -_value = [_this, 1, false,[false]] call BIS_fnc_param; - -if (_unit isKindOf "CaManBase") then { - if (_value) then { - _unit setvariable [QGVAR(medicClass), 1, true]; - } else { - _unit setvariable [QGVAR(medicClass), 0, true]; - } -}; diff --git a/addons/medical/functions/fnc_setTriageStatus.sqf b/addons/medical/functions/fnc_setTriageStatus.sqf deleted file mode 100644 index c37a636c14..0000000000 --- a/addons/medical/functions/fnc_setTriageStatus.sqf +++ /dev/null @@ -1,21 +0,0 @@ -/** - * fn_setTriageStatus.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - -#include "script_component.hpp" - -private ["_unit","_caller","_type","_activity","_status"]; - -_unit = _this select 0; -_status = _this select 1; - -if (!local _unit) exitwith { - [_this, QUOTE(FUNC(setTriageStatus)), _unit] call EFUNC(common,execRemoteFnc); -}; -[_unit,QGVAR(triageLevel),_status] call EFUNC(common,setDefinedVariable); \ No newline at end of file diff --git a/addons/medical/functions/fnc_setUnconsciousState.sqf b/addons/medical/functions/fnc_setUnconscious.sqf similarity index 59% rename from addons/medical/functions/fnc_setUnconsciousState.sqf rename to addons/medical/functions/fnc_setUnconscious.sqf index 3f53e629e9..6ac8294552 100644 --- a/addons/medical/functions/fnc_setUnconsciousState.sqf +++ b/addons/medical/functions/fnc_setUnconscious.sqf @@ -1,70 +1,77 @@ -/** - * fn_setUnconsciousState.sqf - * @Descr: Sets a unit in the unconscious state - * @Author: Glowbal +/* + * Author: Glowbal + * Sets a unit in the unconscious state. * - * @Arguments: [unit OBJECT] - * @Return: void - * @PublicAPI: true + * Arguments: + * 0: The unit that will be put in an unconscious state + * + * ReturnValue: + * nil + * + * Public: yes */ #include "script_component.hpp" -private ["_unit", "_animState", "_dAnim"]; +private ["_unit", "_set", "_animState", "_originalPos", "_captiveSwitch", "_startingTime","_minWaitingTime"]; _unit = _this select 0; +_set = if (count _this > 1) then {_this select 1} else {true}; -if !([_unit] call FUNC(canGoUnconsciousState)) exitwith{ - [format["Exit setUnconscious: %1", _this]] call EFUNC(common,debug); +if !(_set) exitwith { + _unit setvariable ["ACE_isUnconscious", false,true]; }; +if !(!(isNull _unit) && {(_unit isKindOf "CaManBase") && ([_unit] call EFUNC(common,isAwake))}) exitwith{}; + // We only want this function to work on local machines if (!local _unit) exitwith { - [[_unit], QUOTE(FUNC(setUnconsciousState)), _unit, false] call EFUNC(common,execRemoteFnc); - [format["Exit setUnconscious: %1", _this]] call EFUNC(common,debug); + [[_unit], QUOTE(DFUNC(setUnconsciousState)), _unit, false] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ }; -// get rid of the object we are carrying, before we go unconscious. +// Get rid of the object we are carrying, before we go unconscious. [_unit, ObjNull, [0,0,0]] call EFUNC(common,carryObj); // Set the unit in the unconscious state. -_unit setvariable ["ACE_isUnconscious",true,true]; +_unit setvariable ["ACE_isUnconscious", true, true]; _unit setUnconscious true; // If a unit has the launcher out, it will sometimes start selecting the primairy weapon while unconscious, // therefor we force it to select the primairy weapon before going unconscious -[_unit] call FUNC(setWeaponsCorrectUnconscious); - +if ((vehicle _unit) isKindOf "StaticWeapon") then { + moveOut _unit; + unassignVehicle _unit; + //_unit action ["eject", vehicle _unit]; +}; +if (animationState _unit in ["ladderriflestatic","laddercivilstatic"]) then { + _unit action ["ladderOff", (nearestBuilding _unit)]; +}; +if (vehicle _unit == _unit) then { + if (primaryWeapon _unit == "") then { + _unit addWeapon "ACE_fakeWeapon"; + }; + _unit selectWeapon (primaryWeapon _unit); + _unit switchMove ""; + _unit playmoveNow ""; +}; // We are storing the current animation, so we can use it later on when waking the unit up inside a vehicle _animState = animationState _unit; _originalPos = unitPos _unit; -// Handle the on screen effects -if (isPlayer _unit) then { - [] call EFUNC(common,closeAllDialogs_f); - [true] call FUNC(effectBlackOut); - ["unconscious", true] call EFUNC(common,setDisableUserInputStatus); - [false] call EFUNC(common,setVolume_f); -} else { - _unit setUnitPos "DOWN"; - [_unit, true] call EFUNC(common,disableAI_F); -}; +_unit setUnitPos "DOWN"; +[_unit, true] call EFUNC(common,disableAI); // So the AI does not get stuck, we are moving the unit to a temp group on its own. -[_unit, true, "ACE_isUnconscious", side group _unit] call EFUNC(common,switchToGroupSide_f); +[_unit, true, "ACE_isUnconscious", side group _unit] call EFUNC(common,switchToGroupSide); _captiveSwitch = [_unit, true] call EFUNC(common,setCaptiveSwitch); [_unit, [_unit] call EFUNC(common,getDeathAnim), 1, true] call EFUNC(common,doAnimation); - -[format["Unit moving into unconscious: %1", _this]] call EFUNC(common,debug); - - _startingTime = time; _minWaitingTime = (round(random(10)+5)); [{ - private ["_unit", "_vehicleOfUnit","_lockSwitch","_minWaitingTime", "_oldAnimation", "_captiveSwitch"]; + private ["_unit", "_vehicleOfUnit","_lockSwitch","_minWaitingTime", "_oldAnimation", "_captiveSwitch", "_hasMovedOut"]; _args = _this select 0; _unit = _args select 0; _oldAnimation = _args select 1; @@ -72,17 +79,16 @@ _minWaitingTime = (round(random(10)+5)); _originalPos = _args select 3; _startingTime = _args select 4; _minWaitingTime = _args select 5; - + _hasMovedOut = _args select 6; // Since the unit is no longer alive, get rid of this PFH. if (!alive _unit) exitwith { - [format["%1 Unit no longer alive, exiting"], _unit] call EFUNC(common,debug); // EXIT PFH [(_this select 1)] call cba_fnc_removePerFrameHandler; }; // In case the unit is no longer in an unconscious state, we are going to check if we can already reset the animation - if !([_unit] call FUNC(isUnconscious)) exitwith { - [format["%1 Unit no longer unconscious, handling exit and animation"], _unit] call EFUNC(common,debug); + if !(_unit getvariable ["ACE_isUnconscious",false]) exitwith { + // TODO, handle this with carry instead, so we can remove the PFH here. // Wait until the unit isn't being carried anymore, so we won't end up with wierd animations if !([_unit] call EFUNC(common,beingCarried)) then { if (vehicle _unit == _unit) then { @@ -96,35 +102,32 @@ _minWaitingTime = (round(random(10)+5)); // EXIT PFH [(_this select 1)] call cba_fnc_removePerFrameHandler; }; + if (!_hasMovedOut) then { + // Reset the unit back to the previous captive state. + if (_captiveSwitch) then { + [_unit, false] call EFUNC(common,setCaptiveSwitch); + }; + + // Swhich the unit back to its original group + [_unit, false, "ACE_isUnconscious", side group _unit] call EFUNC(common,switchToGroupSide); + + [_unit, false] call EFUNC(common,disableAI_F); + _unit setUnitPos _originalPos; // This is not position but stance (DOWN, MIDDLE, UP) + + _unit setUnconscious false; + + // ensure this statement runs only once + _args set [6, true]; + }; }; + // Ensure we are waiting at least a minimum period before checking if we can wake up the unit again, allows for temp knock outs if ((time - _startingTime) >= _minWaitingTime) exitwith { // Wait until the unit is no longer unconscious if (!([_unit] call FUNC(getUnconsciousCondition))) then { - [format["%1 No unconscious condition valid anymore, moving uit out of unconsciousState"], _unit] call EFUNC(common,debug); - // Reset the unit back to the previous captive state. - if (_captiveSwitch) then { - [_unit, false] call FUNC(setCaptiveSwitch); - }; - _unit setUnconscious false; - - // Swhich the unit back to its original group - [_unit, false, "ACE_isUnconscious", side group _unit] call EFUNC(common,switchToGroupSide_f); - - // Reset any visual and audio effects for players, or enable everything again for AI. - if (isPlayer _unit) then { - [false] call FUNC(effectBlackOut); - [true] call EFUNC(common,setVolume_f); - ["unconscious", false] call EFUNC(common,setDisableUserInputStatus); - } else { - [_unit, false] call EFUNC(common,disableAI_F); - _unit setUnitPos _originalPos; // This is not position but stance (DOWN, MIDDLE, UP) - }; - // Move unit out of unconscious state _unit setvariable ["ACE_isUnconscious", false, true]; - [format["%1 Unit no longer unconsicous"], _unit] call EFUNC(common,debug); }; }; @@ -132,8 +135,7 @@ _minWaitingTime = (round(random(10)+5)); // TODO: Might no longer be necessary: Have to test this in MP. if (vehicle _unit == _unit && {animationState _unit != "deadState" && animationState _unit != "unconscious"} && {(isNull ([_unit] call EFUNC(common,getCarriedBy)))} && (time - _startingTime >= 0.5)) then { [_unit,([_unit] call FUNC(getDeathAnim)), 1, true] call EFUNC(common,doAnimation); // Reset animations if unit starts doing wierd things. - [format["%1 Had to reset an animation for unconscious"], _unit] call EFUNC(common,debug); }; -}, 0.1, [_unit,_animState, _captiveSwitch, _originalPos, _startingTime, _minWaitingTime] ] call CBA_fnc_addPerFrameHandler; +}, 0.1, [_unit,_animState, _captiveSwitch, _originalPos, _startingTime, _minWaitingTime, false] ] call CBA_fnc_addPerFrameHandler; diff --git a/addons/medical/functions/fnc_setWeaponsCorrectUnconscious.sqf b/addons/medical/functions/fnc_setWeaponsCorrectUnconscious.sqf deleted file mode 100644 index bdd4fde460..0000000000 --- a/addons/medical/functions/fnc_setWeaponsCorrectUnconscious.sqf +++ /dev/null @@ -1,38 +0,0 @@ -/** - * fn_setWeaponsCorrectUnconscious.sqf - * @Descr: Ensures the weapon of a unit is selected correctly for the unconscious state. Prefents wierd animation behaviour - * @Author: Glowbal - * - * @Arguments: [unit OBJECT] - * @Return: void - * @PublicAPI: false - */ - -#include "script_component.hpp" - -private ["_unit"]; -_unit = _this select 0; - -if ((vehicle _unit) isKindOf "StaticWeapon") then { - moveOut _unit; - unassignVehicle _unit; - //unassignVehicle _unit; - //_unit action ["eject", vehicle _unit]; -}; -if (vehicle _unit == _unit) then { - if (currentWeapon _unit == secondaryWeapon _unit) then { - reload _unit; - }; -}; - -if (animationState _unit in ["ladderriflestatic","laddercivilstatic"]) then { - _unit action ["ladderOff", (nearestBuilding _unit)]; -}; - -if (vehicle _unit == _unit) then { - if (currentWeapon _unit == secondaryWeapon _unit) then { - _unit selectWeapon (primaryWeapon _unit); - _unit switchMove ""; - _unit playmoveNow ""; - }; -}; diff --git a/addons/medical/functions/fnc_treatment.sqf b/addons/medical/functions/fnc_treatment.sqf new file mode 100644 index 0000000000..44bb0749d5 --- /dev/null +++ b/addons/medical/functions/fnc_treatment.sqf @@ -0,0 +1,118 @@ +/* + * Author: Glowbal, KoffeinFlummi + * Starts the treatment process + * + * Arguments: + * 0: The medic + * 1: The patient + * 2: SelectionName + * 3: Treatment classname + * + * Return Value: + * Succesful treatment started + * + * Public: Yes + */ + +#include "script_component.hpp" + +private ["_caller", "_target", "_selectionName", "_className", "_config", "_availableLevels", "_medicRequired", "_items", "_locations", "_return", "_callbackSuccess", "_callbackFailure", "_callbackProgress", "_treatmentTime", "_callerAnim", "_patientAnim", "_iconDisplayed"]; +_caller = _this select 0; +_target = _this select 1; +_selectionName = _this select 2; +_className = _this select 3; + +if !(_target isKindOf "CAManBase") exitWith {false}; + +_config = (configFile >> "ACE_Medical_Actions" >> "Basic" >> _className); +if (GVAR(level) >= 1) then { + _config = (configFile >> "ACE_Medical_Actions" >> "Advanced" >> _className); +}; +if !(isClass _config) exitwith {false}; + +// Check for required class +_medicRequired = getNumber (_config >> "requiredMedic"); +if !([_caller, _medicRequired] call FUNC(isMedic) || [_target, _medicRequired] call FUNC(isMedic)) exitwith {false}; + +// Check item +_items = getArray (_config >> "items"); +if (count _items > 0 && {!([_caller, _target, _items] call FUNC(hasItems))}) exitwith {false}; + +// Check allowed locations +_locations = getArray (_config >> "treatmentLocations"); +_return = false; +if ("All" in _locations) then { + _return = true; +} else { + { + if (_x == "field") exitwith {_return = true;}; + if (_x == "MedicalFacility" && {([_caller] call FUNC(isInMedicalFacility)) || ([_target] call FUNC(isInMedicalFacility))}) exitwith {_return = true;}; + if (_x == "MedicalVehicle" && {([vehicle _caller] call FUNC(isMedicalVehicle)) || ([vehicle _target] call FUNC(isMedicalVehicle))}) exitwith {_return = true;}; + }foreach _locations; +}; +if !(_return) exitwith {false}; + +// Parse the config for the progress callback +_callbackProgress = getText (_config >> "callbackProgress"); +if (_callbackProgress == "") then { + _callbackProgress = "true"; +}; +if (isNil _callbackProgress) then { + _callbackProgress = compile _callbackProgress; +} else { + _callbackProgress = missionNamespace getvariable _callbackProgress; +}; + +// Patient Animation +_patientAnim = getText (_confg >> "animationPatient"); +if (_caller != _target && {vehicle _target == _target} && {_patientAnim != ""}) then { + [_target, _patientAnim] call EFUNC(common,doAnimation); +}; + +// Player Animation +_callerAnim = [getText (_config >> "animationCaller"), getText (_config >> "animationCallerProne")] select (stance _caller == "PRONE"); +if (_caller == _target) then { + _callerAnim = [getText (_config >> "animationCallerSelf"), getText (_config >> "animationCallerSelfProne")] select (stance _caller == "PRONE"); +}; +_wpn = ["non", "rfl", "pst"] select (["", primaryWeapon _caller, handgunWeapon _caller] find (currentWeapon _caller)); +_callerAnim = [_callerAnim, "[wpn]", _wpn] call CBA_fnc_replace; +if (vehicle _caller == _caller && {_callerAnim != ""}) then { + if (primaryWeapon _caller == "") then { + _caller addWeapon "ACE_FakePrimaryWeapon"; + }; + _caller selectWeapon (primaryWeapon _caller); + _caller setvariable [QGVAR(treatmentPrevAnimCaller), animationState _caller]; + [_caller, _callerAnim] call EFUNC(common,doAnimation); +}; + +// Start treatment +_treatmentTime = getNumber (_config >> "treatmentTime"); +[ + _treatmentTime, + [_caller, _target, _selectionName, _className, _items], + DFUNC(treatment_success), + DFUNC(treatment_failure), + getText (_config >> "displayNameProgress"), + _callbackProgress +] call EFUNC(common,progressBar); + +// Display Icon +_iconDisplayed = getText (_config >> "actionIconPath"); +if (_iconDisplayed != "") then { + [QGVAR(treatmentActionIcon), true, _iconDisplayed, [1,1,1,1], getNumber(_config >> "actionIconDisplayTime")] call EFUNC(common,displayIcon); +}; + +// handle display of text/hints +_displayText = ""; +if (_target != _caller) then { + _displayText = getText(_config >> "displayTextOther"); +} else { + _displayText = getText(_config >> "displayTextSelf"); +}; + +if (_displayText != "") then { + ["displayTextStructured", [_caller], [[_displayText, [_caller] call EFUNC(common,getName), [_target] call EFUNC(common,getName)], 1.5, _caller]] call EFUNC(common,targetEvent); +}; + + +true; diff --git a/addons/medical/functions/fnc_treatmentAdvanced_CPR.sqf b/addons/medical/functions/fnc_treatmentAdvanced_CPR.sqf new file mode 100644 index 0000000000..ee3f51f549 --- /dev/null +++ b/addons/medical/functions/fnc_treatmentAdvanced_CPR.sqf @@ -0,0 +1,29 @@ +/* + * Author: Glowbal + * Callback for the CPR treatment action on success. + * + * Arguments: + * 0: The medic + * 1: The patient + * 2: SelectionName + * 3: Treatment classname + * + * Return Value: + * Succesful treatment started + * + * Public: Yes + */ + +#include "script_component.hpp" + +private ["_caller", "_target", "_selectionName", "_className", "_items", "_removeItem"]; +_caller = _this select 0; +_target = _this select 1; +_selectionName = _this select 2; +_className = _this select 3; +_items = _this select 4; + +// TODO replace by event system instead +[[_caller, _target], QUOTE(DFUNC(treatmentAdvanced_CPRLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ + +true; diff --git a/addons/medical/functions/fnc_handleTreatment_Action_CPRLocal.sqf b/addons/medical/functions/fnc_treatmentAdvanced_CPRLocal.sqf similarity index 56% rename from addons/medical/functions/fnc_handleTreatment_Action_CPRLocal.sqf rename to addons/medical/functions/fnc_treatmentAdvanced_CPRLocal.sqf index 537fd85088..4bb14e1139 100644 --- a/addons/medical/functions/fnc_handleTreatment_Action_CPRLocal.sqf +++ b/addons/medical/functions/fnc_treatmentAdvanced_CPRLocal.sqf @@ -1,11 +1,15 @@ -/** - * fnc_handleTreatment_Action_CPRLocal.sqf - * @Descr: N/A - * @Author: Glowbal +/* + * Author: Glowbal + * local Callback for the CPR treatment action on success. * - * @Arguments: [] - * @Return: - * @PublicAPI: false + * Arguments: + * 0: The medic + * 1: The patient + * + * Return Value: + * Succesful treatment started + * + * Public: Yes */ #include "script_component.hpp" @@ -14,7 +18,6 @@ private ["_caller","_target", "_n"]; _caller = _this select 0; _target = _this select 1; - _n = _target getvariable [QEGVAR(common,ENABLE_REVIVE_COUNTER),0]; if (_n > 0) then { _n = _n - random(20); @@ -25,11 +28,9 @@ if (_n > 0) then { }; if (random(1)>= 0.6) exitwith { - [_caller,"CPR Success"] call cse_fnc_sendHintTo; _target setvariable [QGVAR(inCardiacArrest), nil,true]; - - [_target, QGVAR(heartRate),40] call EFUNC(common,setDefinedVariable); - [_target, QGVAR(bloodPressure),[50,70]] call EFUNC(common,setDefinedVariable); + _target setvariable [QGVAR(heartRate), 40]; + _target setvariable [QGVAR(bloodPressure), [50,70]]; }; -true; \ No newline at end of file +true; diff --git a/addons/medical/functions/fnc_treatmentAdvanced_bandage.sqf b/addons/medical/functions/fnc_treatmentAdvanced_bandage.sqf new file mode 100644 index 0000000000..c5c86422b6 --- /dev/null +++ b/addons/medical/functions/fnc_treatmentAdvanced_bandage.sqf @@ -0,0 +1,41 @@ +/* + * Author: Glowbal + * IV Treatment callback + * + * Arguments: + * 0: The medic + * 1: The patient + * 2: SelectionName + * 3: Treatment classname + * + * + * Return Value: + * Succesful treatment started + * + * Public: Yes + */ + +#include "script_component.hpp" + +private ["_caller", "_target", "_selectionName", "_className", "_items", "_removeItem"]; +_caller = _this select 0; +_target = _this select 1; +_selectionName = _this select 2; +_className = _this select 3; +_items = _this select 4; + +if (count _items == 0) exitwith {}; + +if ([_caller, _target, _items] call FUNC(useItems)) then { + [[_target, _className], QUOTE(DFUNC(treatmentBandageLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ + { + if (_x != "") then { + [_target, _x] call FUNC(addToTriageCard); + }; + }foreach _items; + + ["Medical_treatmentCompleted", [_caller, _target, _selectionName, _className, true]] call ace_common_fnc_localEvent; + [_target, "activity", "STR_ACE_HAS_BANDAGED_ACTIVITY", [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog); +}; + +true; diff --git a/addons/medical/functions/fnc_treatmentAdvanced_bandageLocal.sqf b/addons/medical/functions/fnc_treatmentAdvanced_bandageLocal.sqf new file mode 100644 index 0000000000..a84312fcc5 --- /dev/null +++ b/addons/medical/functions/fnc_treatmentAdvanced_bandageLocal.sqf @@ -0,0 +1,90 @@ +/* + * Author: Glowbal + * Handles the bandage of a patient. + * + * Arguments: + * 0: The patient + * 1: Treatment classname + * + * + * Return Value: + * Succesful treatment started + * + * Public: Yes + */ + +#include "script_component.hpp" + +private ["_target", "_bandage", "_part", "_openWounds", "_config", "_effectiveness","_mostEffectiveInjury", "_mostEffectiveSpot", "_woundEffectivenss", "_mostEffectiveInjury", "_impact"]; +_target = _this select 0; +_bandage = _this select 1; + +// Ensure it is a valid bodypart +_part = [_selectionName] call FUNC(selectionNameToNumber); +if (_part < 0) exitwith {}; + +// Get the open wounds for this unit +_openWounds = _target getvariable [QGVAR(openWounds), []]; +if (count _openWounds == 0) exitwith {}; // nothing to do here! + +// Get the default effectiveness for the used bandage +_config = (ConfigFile >> "ACE_Medical_Advanced" >> "Treatment" >> "Bandaging"); +_effectiveness = getNumber (_config >> "effectiveness"); +if (isClass (_config >> _bandage)) then { + _config = (_config >> _bandage); + if (isNumber (_config >> "effectiveness")) then { _effectiveness = getNumber (_config >> "effectiveness");}; +}; + +// Figure out which injury for this bodypart is the best choice to bandage +_mostEffectiveSpot = 0; +_effectivenessFound = 0; +_mostEffectiveInjury = _openWounds select 0; +{ + // Only parse injuries that are for the selected bodypart. + if (_x select 2 == _part) then { + _woundEffectivenss = _effectiveness; + + // Check if this wound type has attributes specified for the used bandage + if (isClass (_config >> (_x select 1))) then { + + // Collect the effectiveness from the used bandage for this wound type + _woundTreatmentConfig = (_config >> (_x select 1)); + if (isNumber (_woundTreatmentConfig >> "effectiveness")) then { + _woundEffectivenss = getNumber (_woundTreatmentConfig >> "effectiveness"); + }; + }; + + // Check if this is the currently most effective found. + if (_woundEffectivenss * ((_x select 4) * (_x select 3)) > _effectivenessFound * ((_mostEffectiveInjury select 4) * (_mostEffectiveInjury select 3))) then { + _effectivenessFound = _woundEffectivenss; + _mostEffectiveSpot = _foreachIndex; + _mostEffectiveInjury = _x; + }; + }; +}foreach _openWounds; + +if (_effectivenessFound == 0) exitwith {}; // Seems everything is patched up on this body part already.. + +// TODO refactor this part +// Find the impact this bandage has and reduce the amount this injury is present +_impact = if ((_mostEffectiveInjury select 3) >= _effectivenessFound) then {_effectivenessFound} else { (_mostEffectiveInjury select 3) }; +_mostEffectiveInjury set [ 3, ((_mostEffectiveInjury select 3) - _effectivenessFound) max 0]; +_openWounds set [_mostEffectiveSpot, _mostEffectiveInjury]; + +_target setvariable [QGVAR(openWounds), _openWounds]; + +["medical_propagateWound", [_unit, _mostEffectiveInjury]] call EFUNC(common,globalEvent); + +// Handle the reopening of bandaged wounds +if (_impact > 0) then { + // TODO handle reopening of bandaged wounds + // [_target, _impact, _part,_highestSpot, _removeItem] call FUNC(handleBandageOpening); +}; + +// If all wounds have been bandaged, we will reset all damage to 0, so the unit is not showing any blood on the model anymore. +if (count _openWounds == 0) then { + _target setDamage 0; + // TODO also set hitpoints to 0 +}; + +true; diff --git a/addons/medical/functions/fnc_treatmentAdvanced_fullHeal.sqf b/addons/medical/functions/fnc_treatmentAdvanced_fullHeal.sqf new file mode 100644 index 0000000000..807be828e8 --- /dev/null +++ b/addons/medical/functions/fnc_treatmentAdvanced_fullHeal.sqf @@ -0,0 +1,23 @@ +/** + * fn_heal.sqf + * @Descr: N/A + * @Author: Glowbal + * + * @Arguments: [] + * @Return: + * @PublicAPI: false + */ + +#include "script_component.hpp" + +private ["_unit", "_caller", "_selectionName", "_className", "_items"]; +_caller = _this select 0; +_target = _this select 1; +_selectionName = _this select 2; +_className = _this select 3; +_items = _this select 4; + +// TODO replace by event system +[[_caller, _target], QUOTE(DFUNC(treatmentAdvanced_fullHealLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ + +true; diff --git a/addons/medical/functions/fnc_treatmentAdvanced_fullHealLocal.sqf b/addons/medical/functions/fnc_treatmentAdvanced_fullHealLocal.sqf new file mode 100644 index 0000000000..b8ac6999ea --- /dev/null +++ b/addons/medical/functions/fnc_treatmentAdvanced_fullHealLocal.sqf @@ -0,0 +1,68 @@ +/** + * fn_healLocal.sqf + * @Descr: N/A + * @Author: Glowbal + * + * @Arguments: [] + * @Return: + * @PublicAPI: false + */ + +#include "script_component.hpp" + +private ["_unit", "_caller", "_allUsedMedication"]; +_unit = _this select 0; +_caller = _this select 1; + +if (alive _unit) exitwith { + + _unit setVariable [QGVAR(pain), 0, true]; + _unit setVariable [QGVAR(morphine), 0, true]; + _unit setVariable [QGVAR(bloodVolume), 100, true]; + + // tourniquets + _unit setvariable [QGVAR(tourniquets), [0,0,0,0,0,0], true]; + + // wounds and injuries + _unit setvariable [QGVAR(openWounds), [], true]; + _unit setVariable [QGVAR(internalWounds), [], true]; + + // vitals + _unit setVariable [QGVAR(heartRate), 80]; + _unit setvariable [QGVAR(heartRateAdjustments), []]; + _unit setvariable [QGVAR(bloodPressure), [80, 120]]; + _unit setVariable [QGVAR(peripheralResistance), 100]; + + // fractures + _unit setVariable [QGVAR(fractures), []]; + + // IVs + _unit setVariable [QGVAR(salineIVVolume), 0]; + _unit setVariable [QGVAR(plasmaIVVolume), 0]; + _unit setVariable [QGVAR(bloodIVVolume), 0]; + + // damage storage + _unit setvariable [QGVAR(bodyPartStatus), [0,0,0,0,0,0], true]; + + // airway + _unit setvariable [QGVAR(airwayStatus), 0, true]; + _unit setVariable [QGVAR(airwayOccluded), false, true]; + _unit setvariable [QGVAR(airwayCollapsed), true, true]; + + // generic medical admin + _unit setvariable [QGVAR(addedToUnitLoop), false, true]; + _unit setvariable [QGVAR(inCardiacArrest), true, true]; + _unit setVariable [QGVAR(isUnconscious), false, true]; + _unit setvariable [QGVAR(hasLostBlood), true, true]; + _unit setvariable [QGVAR(isBleeding), false, true]; + _unit setvariable [QGVAR(hasPain), false, true]; + + // medication + _allUsedMedication = _unit getVariable [QGVAR(allUsedMedication), []]; + { + _unit setvariable [_x select 0, nil]; + }foreach _allUsedMedication; + + // Resetting damage + _unit setDamage 0; +}; diff --git a/addons/medical/functions/fnc_treatmentAdvanced_medication.sqf b/addons/medical/functions/fnc_treatmentAdvanced_medication.sqf new file mode 100644 index 0000000000..415996d025 --- /dev/null +++ b/addons/medical/functions/fnc_treatmentAdvanced_medication.sqf @@ -0,0 +1,41 @@ +/* + * Author: Glowbal + * IV Treatment callback + * + * Arguments: + * 0: The medic + * 1: The patient + * 2: SelectionName + * 3: Treatment classname + * + * + * Return Value: + * Succesful treatment started + * + * Public: Yes + */ + +#include "script_component.hpp" + +private ["_caller", "_target", "_selectionName", "_className", "_items", "_removeItem"]; +_caller = _this select 0; +_target = _this select 1; +_selectionName = _this select 2; +_className = _this select 3; +_items = _this select 4; + +if (count _items == 0) exitwith {}; + +if ([_caller, _target, _items] call FUNC(useItems)) then { + [[_target, _className], QUOTE(DFUNC(treatmentMedicationLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ + { + if (_x != "") then { + [_target, _x] call FUNC(addToTriageCard); + }; + }foreach _items; + + ["Medical_treatmentCompleted", [_caller, _target, _selectionName, _className, true]] call ace_common_fnc_localEvent; + [_target, "activity", "STR_ACE_HAS_MEDICATION_ACTIVITY", [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog); +}; + +true; diff --git a/addons/medical/functions/fnc_treatmentAdvanced_medicationLocal.sqf b/addons/medical/functions/fnc_treatmentAdvanced_medicationLocal.sqf new file mode 100644 index 0000000000..a3d3e26d1d --- /dev/null +++ b/addons/medical/functions/fnc_treatmentAdvanced_medicationLocal.sqf @@ -0,0 +1,89 @@ +/* + * Author: Glowbal + * Handles the medication given to a patient. + * + * Arguments: + * 0: The patient + * 1: Treatment classname + * + * + * Return Value: + * Succesful treatment started + * + * Public: Yes + */ + +#include "script_component.hpp" + +private ["_target", "_className", "_currentInSystem", "_medicationConfig", "_painReduce", "_hrIncreaseLow", "_hrIncreaseNorm", "_hrIncreaseHigh", "_maxDose", "_inCompatableMedication", "_timeInSystem", "_heartRate", "_pain", "_resistance", "_hrCallback"]; +_target = _this select 0; +_className = _this select 1; + +// We have added a new dose of this medication to our system, so let's increase it +_varName = format[QGVAR(%1_inSystem), _className]; +_currentInSystem = _target getvariable [_varName, 0]; +_currentInSystem = _currentInSystem + 1; +_target setvariable [_varName, _currentInSystem]; + +// Find the proper attributes for the used medication +_medicationConfig = (configFile >> "ACE_Medical_Advanced" >> "Treatment" >> "Medication"); +_painReduce = getNumber (_medicationConfig >> "painReduce"); +_hrIncreaseLow = getArray (_medicationConfig >> "hrIncreaseLow"); +_hrIncreaseNorm = getArray (_medicationConfig >> "hrIncreaseNormal"); +_hrIncreaseHigh = getArray (_medicationConfig >> "hrIncreaseHigh"); +_timeInSystem = getNumber (_medicationConfig >> "timeInSystem"); +_maxDose = getNumber (_medicationConfig >> "maxDose"); +_viscosityChange = getNumber (_medicationConfig >> "viscosityChange"); +_hrCallback = getText (_medicationConfig >> "hrCallback"); + +_inCompatableMedication = []; +if (isClass (_medicationConfig >> _className)) then { + _medicationConfig = (_medicationConfig >> _className); + if (isNumber (_medicationConfig >> "painReduce")) then { _painReduce = getNumber (_medicationConfig >> "painReduce");}; + if (isArray (_medicationConfig >> "hrIncreaseLow")) then { _hrIncreaseLow = getArray (_medicationConfig >> "hrIncreaseLow"); }; + if (isArray (_medicationConfig >> "hrIncreaseNormal")) then { _hrIncreaseNorm = getArray (_medicationConfig >> "hrIncreaseNormal"); }; + if (isArray (_medicationConfig >> "hrIncreaseHigh")) then { _hrIncreaseHigh = getArray (_medicationConfig >> "hrIncreaseHigh"); }; + if (isNumber (_medicationConfig >> "timeInSystem")) then { _timeInSystem = getNumber (_medicationConfig >> "timeInSystem"); }; + if (isNumber (_medicationConfig >> "maxDose")) then { _maxDose = getNumber (_medicationConfig >> "maxDose"); }; + if (isArray (_medicationConfig >> "inCompatableMedication")) then { _inCompatableMedication = getArray (_medicationConfig >> "inCompatableMedication"); }; + if (isNumber (_medicationConfig >> "viscosityChange")) then { _viscosityChange = getNumber (_medicationConfig >> "viscosityChange"); }; + if (isText (_medicationConfig >> "hrCallback")) then { _hrCallback = getText (_medicationConfig >> "hrCallback"); }; +}; +if (isNil _hrCallback) then { + _hrCallback = compile _hrCallback; +} else { + _hrCallback = missionNamespace getvariable _hrCallback; +}; + +// Adjust the heart rate based upon config entry +_heartRate = _target getvariable [QGVAR(heartRate), 70]; +if (alive _target) then { + if (_heartRate > 0) then { + if (_heartRate <= 45) then { + [_target, ((_hrIncreaseLow select 0) + random((_hrIncreaseLow select 1))), (_hrIncreaseLow select 2), _hrCallback] call FUNC(addHeartRateAdjustment); + } else { + if (_heartRate > 120) then { + [_target, ((_hrIncreaseHigh select 0) + random((_hrIncreaseHigh select 1))), (_hrIncreaseHigh select 2), _hrCallback] call FUNC(addHeartRateAdjustment); + } else { + [_target, ((_hrIncreaseNorm select 0) + random((_hrIncreaseNorm select 1))), (_hrIncreaseNorm select 2), _hrCallback] call FUNC(addHeartRateAdjustment); + }; + }; + }; +}; + +// Reduce the pain level +_pain = _target getvariable [QGVAR(pain), 0]; +_pain = _pain * _painReduce; +if (_pain <= 0) then { + _pain = 0; +}; +_target setvariable [QGVAR(pain), _pain]; + +_resistance = _unit getvariable [QGVAR(peripheralResistance), 100]; +_resistance = _resistance + _viscosityChange; +_unit setvariable [QGVAR(peripheralResistance), _resistance max 0]; + +// Call back to ensure that the medication is decreased over time +[_target, _classname, _varName, _maxDose, _timeInSystem, _inCompatableMedication, _viscosityChange] call FUNC(onMedicationUsage); + +true diff --git a/addons/medical/functions/fnc_treatmentBasic_bandage.sqf b/addons/medical/functions/fnc_treatmentBasic_bandage.sqf new file mode 100644 index 0000000000..39b910d6e4 --- /dev/null +++ b/addons/medical/functions/fnc_treatmentBasic_bandage.sqf @@ -0,0 +1,37 @@ +/* + * Author: KoffeinFlummi + * Callback when the bandaging treatment is complete + * + * Arguments: + * 0: The medic + * 1: The patient + * 2: Selection Name + * 3: Treatment classname + * + * Return Value: + * nil + * + * Public: No + */ + +#include "script_component.hpp" +#define BANDAGEHEAL 0.8 + +private ["_caller", "_target","_selection","_className","_target","_hitSelections","_hitPoints","_point"]; +_caller = _this select 0; +_target = _this select 1; +_selection = _this select 2; +_className = _this select 3; + +if (_selection == "all") then { + _target setDamage ((damage _target - BANDAGEHEAL) max 0); +} else { + _hitSelections = ["head", "body", "hand_l", "hand_r", "leg_l", "leg_r"]; + _hitPoints = ["HitHead", "HitBody", "HitLeftArm", "HitRightArm", "HitLeftLeg", "HitRightLeg"]; + _point = _hitPoints select (_hitSelections find _selection); + + _damage = ((_target getHitPointDamage _point) - BANDAGEHEAL) max 0; + [_target, _point, _damage] call FUNC(setHitPointDamage); + + // @todo: leg/arm damage - in setHitPointDamage? +}; diff --git a/addons/medical/functions/fnc_treatmentBasic_bloodbag.sqf b/addons/medical/functions/fnc_treatmentBasic_bloodbag.sqf new file mode 100644 index 0000000000..57563ad8fc --- /dev/null +++ b/addons/medical/functions/fnc_treatmentBasic_bloodbag.sqf @@ -0,0 +1,26 @@ +/* + * Author: KoffeinFlummi + * Callback when the bloodbag treatment is complete + * + * Arguments: + * 0: The medic + * 1: The patient + * 2: Selection Name + * 3: Treatment classname + * + * Return Value: + * nil + * + * Public: No + */ + +#include "script_component.hpp" +#define BLOODBAGHEAL 70 + +private ["_caller", "_target","_className","_blood"]; +_caller = _this select 0; +_target = _this select 1; +_className = _this select 3; + +_blood = ((_target getVariable [QGVAR(bloodVolume), 100]) + BLOODBAGHEAL) min 100; +_target setVariable [QGVAR(bloodVolume), _blood, true]; diff --git a/addons/medical/functions/fnc_treatmentBasic_epipen.sqf b/addons/medical/functions/fnc_treatmentBasic_epipen.sqf new file mode 100644 index 0000000000..e616327673 --- /dev/null +++ b/addons/medical/functions/fnc_treatmentBasic_epipen.sqf @@ -0,0 +1,25 @@ +/* + * Author: KoffeinFlummi + * Callback when the epipen treatment is complete + * + * Arguments: + * 0: The medic + * 1: The patient + * 2: Selection Name + * 3: Treatment classname + * + * Return Value: + * nil + * + * Public: No + */ + +#include "script_component.hpp" +#define BLOODBAGHEAL 70 + +private ["_caller", "_target","_className"]; +_caller = _this select 0; +_target = _this select 1; +_className = _this select 3; + +[_target, false] call FUNC(setUnconscious); diff --git a/addons/medical/functions/fnc_treatmentBasic_morphine.sqf b/addons/medical/functions/fnc_treatmentBasic_morphine.sqf new file mode 100644 index 0000000000..30c87b6f05 --- /dev/null +++ b/addons/medical/functions/fnc_treatmentBasic_morphine.sqf @@ -0,0 +1,33 @@ +/* + * Author: KoffeinFlummi + * Callback when the morphine treatment is complete + * + * Arguments: + * 0: The medic + * 1: The patient + * 2: Selection Name + * 3: Treatment classname + * + * Return Value: + * nil + * + * Public: No + */ + +#include "script_component.hpp" +#define MORPHINEHEAL 0.4 + +private ["_caller", "_target","_className","_blood","_morphine","_pain"]; +_caller = _this select 0; +_target = _this select 1; +_className = _this select 3; + +// reduce pain, pain sensitivity +_morphine = (_target getVariable [QGVAR(morphine), 0] + MORPHINEHEAL) min 1; +_target setVariable [QGVAR(morphine), _morphine, true]; +_pain = ((_target getVariable [QGVAR(pain), 0]) - MORPHINEHEAL) max 0; +_target setVariable [QGVAR(pain), _pain, true]; + +// @todo overdose + +// @todo pain, painkiller reduction diff --git a/addons/medical/functions/fnc_treatmentIV.sqf b/addons/medical/functions/fnc_treatmentIV.sqf new file mode 100644 index 0000000000..2581c1f0d2 --- /dev/null +++ b/addons/medical/functions/fnc_treatmentIV.sqf @@ -0,0 +1,35 @@ +/* + * Author: Glowbal + * Patient IV Treatment callback + * + * Arguments: + * 0: The medic + * 1: The patient + * 2: SelectionName + * 3: Treatment classname + * + * + * Return Value: + * + * + * Public: Yes + */ + +#include "script_component.hpp" + +private ["_caller", "_target", "_selectionName", "_className", "_items", "_removeItem", "_attributes"]; +_caller = _this select 0; +_target = _this select 1; +_selectionName = _this select 2; +_className = _this select 3; +_items = _this select 4; + +if (count _items == 0) exitwith {}; + +if ([_caller, _target, _items] call FUNC(useItems)) then { + _removeItem = _items select 0; + [[_target, _removeItem], QUOTE(DFUNC(treatmentIVLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ + ["Medical_treatmentCompleted", [_caller, _target, _selectionName, _className, true]] call ace_common_fnc_localEvent; + [_target, _removeItem] call FUNC(addToTriageCard); + [_target, "activity", "STR_ACE_HAS_GIVEN_IV_ACTIVITY", [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog); +}; diff --git a/addons/medical/functions/fnc_treatmentIVLocal.sqf b/addons/medical/functions/fnc_treatmentIVLocal.sqf new file mode 100644 index 0000000000..190498a8a6 --- /dev/null +++ b/addons/medical/functions/fnc_treatmentIVLocal.sqf @@ -0,0 +1,38 @@ +/* + * Author: Glowbal + * IV Treatment local callback + * + * Arguments: + * 0: The medic + * 1: Item used classname + * + * + * Return Value: + * nil + * + * Public: Yes + */ + +#include "script_component.hpp" + +private ["_target", "_ivItem", "_config", "_volumeAdded", "_typeOf", "_varName"]; +_target = _this select 0; +_ivItem = _this select 1; + +// Find the proper attributes for the used IV +_config = (configFile >> "ACE_Medical_Advanced" >> "Treatment" >> "IV"); +_volumeAdded = getNumber (_medicationConfig >> "volume"); +_typeOf = getText (_medicationConfig >> "type"); + +if (isClass (_config >> _className)) then { + _config = (_config >> _className); + if (isNumber (_config >> "volume")) then { _volumeAdded = getNumber (_config >> "volume");}; + if (isText (_config >> "type")) then { _typeOf = getText (_config >> "type"); }; +}; + +_varName = format["ACE_Medical_IVVolume_%1",_typeOf]; +_target setvariable [_varName, (_target getvariable [_varName, 0]) + _volumeAdded]; + +// TODO localization +//[_target,"treatment",format["%1 has given %4 a %2(%3ml)",[_caller] call EFUNC(common,getName),_attributes select 2,_attributes select 1,_target]] call FUNC(addActivityToLog); +//[_target,_removeItem] call FUNC(addToTriageList); diff --git a/addons/medical/functions/fnc_treatmentMutex.sqf b/addons/medical/functions/fnc_treatmentMutex.sqf deleted file mode 100644 index af27737b49..0000000000 --- a/addons/medical/functions/fnc_treatmentMutex.sqf +++ /dev/null @@ -1,23 +0,0 @@ -/** - * fn_treatmentMutex.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [client OBJECT, action STRING ("release" releases the mutex if it has been set. "set" for setting the mutex)] - * @Return: void - * @PublicAPI: false - */ - -#include "script_component.hpp" - -private ["_unit", "_set"]; - -_unit = _this select 0; -_set = if (count _this > 1) then {_this select 1} else {true}; - -if (_set) exitwith { - _unit setvariable [QGVAR(PerformingTreatmentMutex), time, true]; -}; - -// Max locked time is 2 minutes. -_unit setvariable [QGVAR(PerformingTreatmentMutex), -120, true]; \ No newline at end of file diff --git a/addons/medical/functions/fnc_treatmentTourniquet.sqf b/addons/medical/functions/fnc_treatmentTourniquet.sqf new file mode 100644 index 0000000000..cd1e9f72e7 --- /dev/null +++ b/addons/medical/functions/fnc_treatmentTourniquet.sqf @@ -0,0 +1,50 @@ +/* + * Author: Glowbal + * Apply a tourniquet to the patient + * + * Arguments: + * 0: The medic + * 1: The patient + * 2: SelectionName + * 3: Treatment classname + * + * + * Return Value: + * + * + * Public: No + */ + +#include "script_component.hpp" + +private ["_caller","_target","_part","_selectionName","_removeItem", "_tourniquets", "_items", "_output"]; +_caller = _this select 0; +_target = _this select 1; +_selectionName = _this select 2; +_className = _this select 3; +_items = _this select 4; + +if (count _items == 0) exitwith {}; + +_part = [_selectionName] call FUNC(selectionNameToNumber); +if (_part == 0 || _part == 1) exitwith { + // [_caller,"You cannot apply a CAT on this body part!"] call EFUNC(common,sendHintTo); + false; +}; + +_tourniquets = _target getvariable [QGVAR(tourniquets), [0,0,0,0,0,0]]; +if ((_tourniquets select _part) > 0) exitwith { + _output = "There is already a tourniquet on this body part!"; // TODO localization + ["displayTextStructured", [_caller], [_output, 1.5, _caller]] call EFUNC(common,targetEvent); + false; +}; + +if ([_caller, _target, _items] call FUNC(useItems)) then { + _removeItem = _items select 0; + [[_target, _removeItem], QUOTE(DFUNC(treatmentTourniquetLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ + ["Medical_treatmentCompleted", [_caller, _target, _selectionName, _className, true]] call ace_common_fnc_localEvent; + [_target, _removeItem] call FUNC(addToTriageCard); + [_target, "activity", "STR_ACE_HAS_APPLIED_TOURNIQUET_ACTIVITY", [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog); +}; + +true; diff --git a/addons/medical/functions/fnc_treatmentTourniquetLocal.sqf b/addons/medical/functions/fnc_treatmentTourniquetLocal.sqf new file mode 100644 index 0000000000..064761aea0 --- /dev/null +++ b/addons/medical/functions/fnc_treatmentTourniquetLocal.sqf @@ -0,0 +1,54 @@ +/* + * Author: Glowbal + * Apply a tourniquet to the patient, local callback. + * + * Arguments: + * 0: The patient + * 1: Item used classname + * + * Return Value: + * nil + * + * Public: No + */ +#include "script_component.hpp" + +private ["_target", "_tourniquetItem", "_part", "_tourniquets", "_applyingTo"]; +_target = _this select 0; +_tourniquetItem = _this select 1; + +//[_target,"treatment",format["%1 applied a tourniquet on %2",[_caller] call EFUNC(common,getName),_selectionName]] call FUNC(addActivityToLog); +//[_target,_removeItem] call FUNC(addToTriageList); +[_target] call FUNC(addToInjuredCollection); + + +_part = [_selectionName] call FUNC(selectionNameToNumber); + +// Place a tourniquet on the bodypart +_tourniquets = _target getvariable [QGVAR(tourniquets), [0,0,0,0,0,0]]; +_applyingTo = (_tourniquets select _part) + 1 + round(random(100)); +_tourniquets set[_part, _applyingTo]; +_target setvariable [QGVAR(tourniquets), _tourniquets, true]; + +[{ + private ["_args","_target","_applyingTo","_part", "_tourniquets"]; + _args = _this select 0; + _target = _args select 0; + _applyingTo = _args select 1; + _part = _args select 2; + _time = _args select 3; + if (!alive _target) exitwith { + [(_this select 1)] call cba_fnc_removePerFrameHandler; + }; + + _tourniquets = _target getvariable [QGVAR(tourniquets), [0,0,0,0,0,0]]; + if !((_tourniquets select _part) == _applyingTo) exitwith { + // Tourniquet has been removed + [(_this select 1)] call cba_fnc_removePerFrameHandler; + }; + if (time - _time > 120) then { + _target setvariable [QGVAR(pain), (_target getvariable [QGVAR(pain), 0]) + 0.005]; + }; +}, 5, [_target, _applyingTo, _part, time] ] call CBA_fnc_addPerFrameHandler; + +true; diff --git a/addons/medical/functions/fnc_treatment_failure.sqf b/addons/medical/functions/fnc_treatment_failure.sqf new file mode 100644 index 0000000000..6174956934 --- /dev/null +++ b/addons/medical/functions/fnc_treatment_failure.sqf @@ -0,0 +1,49 @@ +/* + * Author: KoffeinFlummi, Glowbal + * Callback when the treatment fails + * + * Arguments: + * 0: The medic + * 1: The patient + * 2: SelectionName + * 3: Treatment classname + * 4: Items available > + * + * Return Value: + * nil + * + * Public: No + */ + +#include "script_component.hpp" + +private ["_caller", "_target","_selectionName","_className","_config","_callback"]; + +_args = _this select 0; +_caller = _args select 0; +_target = _args select 1; +_selectionName = _args select 2; +_className = _args select 3; + +if (primaryWeapon _caller == "ACE_FakePrimaryWeapon") then { + _caller removeWeapon "ACE_FakePrimaryWeapon"; +}; +[_caller, _caller getvariable [QGVAR(treatmentPrevAnimCaller), ""], 1] call EFUNC(common,doAnimation); +_caller setvariable [QGVAR(treatmentPrevAnimCaller), nil]; + +// @todo remove item? + +// Record specific callback +_config = (configFile >> "ACE_Medical_Actions" >> "Basic" >> _className); +if (GVAR(level) >= 1) then { + _config = (configFile >> "ACE_Medical_Actions" >> "Advanced" >> _className); +}; + +_callback = getText (_config >> "callbackFailure"); +if (isNil _callback) then { + _callback = compile _callback; +} else { + _callback = missionNamespace getvariable _callback; +}; + +_args call _callback diff --git a/addons/medical/functions/fnc_treatment_success.sqf b/addons/medical/functions/fnc_treatment_success.sqf new file mode 100644 index 0000000000..878aaa01b7 --- /dev/null +++ b/addons/medical/functions/fnc_treatment_success.sqf @@ -0,0 +1,49 @@ +/* + * Author: KoffeinFlummi, Glowbal + * Callback when the treatment is completed + * + * Arguments: + * 0: The medic + * 1: The patient + * 2: SelectionName + * 3: Treatment classname + * 4: Items available > + * + * Return Value: + * nil + * + * Public: No + */ + +#include "script_component.hpp" + +private ["_caller", "_target","_selectionName","_className","_config","_callback"]; + +_args = _this select 0; +_caller = _args select 0; +_target = _args select 1; +_selectionName = _args select 2; +_className = _args select 3; + +if (primaryWeapon _caller == "ACE_FakePrimaryWeapon") then { + _caller removeWeapon "ACE_FakePrimaryWeapon"; +}; +[_caller, _caller getvariable [QGVAR(treatmentPrevAnimCaller), ""], 1] call EFUNC(common,doAnimation); +_caller setvariable [QGVAR(treatmentPrevAnimCaller), nil]; + +// @todo remove item + +// Record specific callback +_config = (configFile >> "ACE_Medical_Actions" >> "Basic" >> _className); +if (GVAR(level) >= 1) then { + _config = (configFile >> "ACE_Medical_Actions" >> "Advanced" >> _className); +}; + +_callback = getText (_config >> "callbackSuccess"); +if (isNil _callback) then { + _callback = compile _callback; +} else { + _callback = missionNamespace getvariable _callback; +}; + +_args call _callback diff --git a/addons/medical/functions/fnc_updateActivityLog.sqf b/addons/medical/functions/fnc_updateActivityLog.sqf deleted file mode 100644 index 58179a8392..0000000000 --- a/addons/medical/functions/fnc_updateActivityLog.sqf +++ /dev/null @@ -1,44 +0,0 @@ -/** - * fn_updateActivityLog.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - -#include "script_component.hpp" - -_log = [GVAR(INTERACTION_TARGET)] call FUNC(getActivityLog); -_counter = 0; -lbclear 214; -{ - //[_caller,_moment,_activity,_type] - lbadd[214, _x select 1]; // moment - lbadd[214, _x select 0]; // name, caller - //lbadd[214, _x select 2]; // activity - lbSetData [214,_counter,_x select 2]; - - _counter = _counter + 1; -}foreach _log; -if (count _log < 1) then { - lbadd[214, "No Activity recorded.."]; - lbadd[214, ""]; -}; - -_log = [GVAR(INTERACTION_TARGET)] call FUNC(getQuickViewLog); -_counter = 0; -lbclear 215; -{ - - //[_caller,_moment,_activity,_type] - lbadd[215, _x select 1]; // moment - lbadd[215, _x select 0]; // name, caller - lbSetData [215,_counter,_x select 2]; - _counter = _counter + 1; -}foreach _log; -if (count _log < 1) then { - lbadd[215, "No Data recorded.."]; - lbadd[215, ""]; -}; diff --git a/addons/medical/functions/fnc_updateBodyImg.sqf b/addons/medical/functions/fnc_updateBodyImg.sqf deleted file mode 100644 index 194d2b6e08..0000000000 --- a/addons/medical/functions/fnc_updateBodyImg.sqf +++ /dev/null @@ -1,71 +0,0 @@ -/** - * fn_updateBodyImg.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - -#include "script_component.hpp" - -private ["_unit", "_interactionDialog", "_openWounds", "_part", "_total", "_amountOfWoundsSmall", "_amountOfWoundsMedium", "_amountOfWoundsLarge", "_bandagedWounds","_alphaLevel", "_damaged"]; -_openWounds = _this select 0; -_bandagedWounds = _this select 1; - -disableSerialization; -_interactionDialog = uiNamespace getvariable QGVAR(medicalMenu); -if (isnil "_interactionDialog") exitwith {}; - -_colorCalculationsOpenWounds = { - if (_total >0) then { - _green = 0.9; - _blue = 0.9; - for [{_i = 0},{ _i < round(_total)},{ _i = _i +1;}] do { - _green = _green - 0.75; - _blue = _blue - 0.75; - }; - if (_green < 0.0) then { - _green = 0.0; - _blue = 0.0; - }; - _damaged set[_part,true]; - }; -}; -_alphaLevel = 1.0; -_damaged = [false,false,false,false,false,false]; -_availableSelections = [50,51,52,53,54,55]; -_part = 0; - -{ - private ["_red", "_green", "_blue"]; - _amountOfWoundsSmall = (_x select 0); - _amountOfWoundsMedium = (_x select 1); - _amountOfWoundsLarge = (_x select 2); - _total = (_amountOfWoundsSmall) + _amountOfWoundsMedium + (_amountOfWoundsLarge); - - _red = 1; - _green = 1; - _blue = 1; - call _colorCalculationsOpenWounds; - (_interactionDialog displayCtrl (_availableSelections select _part)) ctrlSetTextColor [_red,_green,_blue,_alphaLevel]; - _part = _part + 1; -}foreach _openWounds; - -{ - if (!(_damaged select _foreachIndex)) then { - _amountOfWoundsSmall = (_x select 0); - _amountOfWoundsMedium = (_x select 1); - _amountOfWoundsLarge = (_x select 2); - - _total = (_amountOfWoundsSmall) + _amountOfWoundsMedium + (_amountOfWoundsLarge); - if (_total>0) then { - private ["_red", "_green", "_blue"]; - _red = 1.0; - _green = 0.7; - _blue = 0.7; - (_interactionDialog displayCtrl (_availableSelections select _foreachIndex)) ctrlSetTextColor [_red,_green,_blue,_alphaLevel]; - }; - }; -}foreach _bandagedWounds; diff --git a/addons/medical/functions/fnc_updateIcons.sqf b/addons/medical/functions/fnc_updateIcons.sqf deleted file mode 100644 index 81c071efca..0000000000 --- a/addons/medical/functions/fnc_updateIcons.sqf +++ /dev/null @@ -1,27 +0,0 @@ -/** - * fn_updateIcons.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - -#include "script_component.hpp" - -private ["_display","_startIDC","_idc","_options","_name","_amount"]; -disableSerialization; -_display = uiNamespace getVariable QGVAR(medicalMenu); - -_startIDC = 111; - -_options = ["triage" , "examine", "bandage", "medication", "airway", "advanced", "drag", "toggle"]; -for "_idc" from _startIDC to 118 step 1 do { - _amount = [ACE_player, GVAR(INTERACTION_TARGET), _options select (_idc - 111)] call FUNC(getTreatmentOptions); - if ((count _amount) > 0 || _idc == 111 || _idc == 118) then { - (_display displayCtrl _idc) ctrlSettextColor [1,1,1,1]; - } else { - (_display displayCtrl _idc) ctrlSettextColor [0.4,0.4,0.4,1]; - }; -}; \ No newline at end of file diff --git a/addons/medical/functions/fnc_updateUIInfo.sqf b/addons/medical/functions/fnc_updateUIInfo.sqf deleted file mode 100644 index 4ac6b463f1..0000000000 --- a/addons/medical/functions/fnc_updateUIInfo.sqf +++ /dev/null @@ -1,215 +0,0 @@ -/** - * fn_updateUIInfo.sqf - * @Descr: N/A - * @Author: Glowbal - * - * @Arguments: [] - * @Return: - * @PublicAPI: false - */ - -#include "script_component.hpp" - -private ["_targetObj","_bodyPartText","_bodyPartN","_openWounds","_bandagedWounds","_fractures","_listOfWounds","_listOfBandagedWounds","_listOfFractures","_counter","_nameEntry","_untreatedWounds" ,"_remainder", "_numberOf", "_airwayStatus", "_airwayTreated"]; -_targetObj = _this select 0; - -_bodyPartText = (call FUNC(getSelectedBodyPart)); -_bodyPartN = [_bodyPartText] call FUNC(getBodyPartNumber); - -if (_bodyPartN < 0 || _bodyPartN > 5) exitwith {}; - -_openWounds = [_targetObj,QGVAR(openWounds)] call EFUNC(common,getDefinedVariable); -_bandagedWounds = [_targetObj,QGVAR(bandagedWounds)] call EFUNC(common,getDefinedVariable); -_fractures = [_targetObj,QGVAR(fractures)] call EFUNC(common,getDefinedVariable); -_airwayStatus = [_targetObj,QGVAR(airway)] call EFUNC(common,getDefinedVariable); - -if (count _this > 1) then { - switch (_this select 1) do { - case QGVAR(openWounds): { _openWounds = _this select 2; }; - case QGVAR(bandagedWounds): { _bandagedWounds = _this select 2; }; - case QGVAR(fractures): { _fractures = _this select 2; }; - }; -}; - -[_openWounds,_bandagedWounds] call FUNC(updateBodyImg); -_listOfWounds = _openWounds select _bodyPartN; -_listOfBandagedWounds = _bandagedWounds select _bodyPartN; -_listOfFractures = _fractures select _bodyPartN; - -// TODO collect all information first, then clear the lb and fill in with details. Also; use ctrl instead of IDC. -_numberOf = 0; -lbClear 213; - -_displayBodyPartText = switch (_bodyPartText) do { - case "head": { - localize "STR_ACE_UI_HEAD"; - }; - case "body": { - localize "STR_ACE_UI_TORSO"; - }; - case "hand_r": { - localize "STR_ACE_UI_ARM_R"; - }; - case "hand_l": { - localize "STR_ACE_UI_ARM_L"; - }; - case "leg_r": { - localize "STR_ACE_UI_LEG_R"; - }; - case "leg_l": { - localize "STR_ACE_UI_LEG_L"; - }; - default {"-"}; -}; - - -lbadd[213,format[localize "STR_ACE_UI_SELECTED_BODY_PART",_displayBodyPartText]]; -lbSetData [213, _numberOf, ""]; -lbSetColor [213, _numberOf, [0.27, 0.40, 0.26, 1]]; -_numberOf = _numberOf + 1; - -if (GVAR(setting_allowAirwayInjuries)) then { - _airwayTreated = _targetObj getvariable [QGVAR(airwayTreated), false]; - - if (_airwayStatus > 0) then { - _nameEntry = switch (_airwayStatus) do { - case 0: {localize "STR_ACE_UI_NORMAL_BREATHING"}; - case 1: {localize "STR_ACE_UI_DIFFICULT_BREATHING"}; - case 2: {localize "STR_ACE_UI_ALMOST_NO_BREATHING"}; - default {localize "STR_ACE_UI_NO_BREATHING"}; - }; - - if (!(alive _targetObj) || (_targetObj getvariable [QEGVAR(common,isDead), false])) then { - lbadd[213,format["%1",localize "STR_ACE_UI_NO_BREATHING"]]; - } else { - lbadd[213,format["%1",_nameEntry]]; - }; - lbSetData [213, _numberOf, ""]; - _numberOf = _numberOf + 1; - } else { - if (!(alive _targetObj) || (_targetObj getvariable [QEGVAR(common,isDead), false])) then { - lbadd[213,format["%1",localize "STR_ACE_UI_NO_BREATHING"]]; - lbSetData [213, _numberOf, ""]; - _numberOf = _numberOf + 1; - }; - }; - - if (_airwayTreated) then { - lbadd[213,localize "STR_ACE_UI_STATUS_NPA_APPLIED"]; - lbSetData [213, _numberOf, ""]; - lbSetColor [213, _numberOf, [0.5, 0.5, 0, 1]]; - _numberOf = _numberOf + 1; - }; -}; - -if (([_targetObj,QGVAR(isBleeding)] call EFUNC(common,getDefinedVariable))) then { - lbadd[213,localize "STR_ACE_UI_STATUS_BLEEDING"]; - lbSetData [213, _numberOf, ""]; - _numberOf = _numberOf + 1; -}; -if (([_targetObj,QGVAR(hasLostBlood)] call EFUNC(common,getDefinedVariable))) then { - lbadd[213,localize "STR_ACE_UI_STATUS_LOST_BLOOD"]; - lbSetData [213, _numberOf, ""]; - _numberOf = _numberOf + 1; -}; - -if (([_targetObj,QGVAR(hasPain)] call EFUNC(common,getDefinedVariable))) then { - lbadd[213,localize "STR_ACE_UI_STATUS_PAIN"]; - lbSetData [213, _numberOf, ""]; - _numberOf = _numberOf + 1; -}; -if (([_targetObj, _bodyPartText] call FUNC(hasTourniquetAppliedTo))) then { - lbadd[213,localize "STR_ACE_UI_STATUS_TOURNIQUET_APPLIED"]; - lbSetColor [213, _numberOf, [0.5, 0.5, 0, 1]]; - lbSetData [213, _numberOf, ""]; - _numberOf = _numberOf + 1; -}; - -_counter = 0; -{ - if (_x > 0) then { - _untreatedWounds = floor _x; - _remainder = _x - (floor _x); - - _nameEntry = switch (_counter) do { - case 0: {localize "STR_ACE_UI_SMALL"}; - case 1: {localize "STR_ACE_UI_MEDIUM"}; - case 2: {localize "STR_ACE_UI_LARGE"}; - default {localize "STR_ACE_UI_SMALL"}; - }; - - if (_untreatedWounds > 1) then { - lbadd[213,format[localize "STR_ACE_UI_MULTIPLE_OPEN_WOUNDS",_nameEntry,_untreatedWounds]]; - lbSetData [213, _numberOf, format["open_wound_%1",_counter]]; - lbSetColor [213, _numberOf, [0.6, 0, 0, 1]]; - _numberOf = _numberOf + 1; - } else { - if (_untreatedWounds == 1) then { - lbadd[213,format[localize "STR_ACE_UI_SINGLE_OPEN_WOUND",_nameEntry]]; - lbSetData [213, _numberOf, format["open_wound_%1",_counter]]; - lbSetColor [213, _numberOf, [0.6, 0, 0, 1]]; - _numberOf = _numberOf + 1; - }; - }; - - if (_remainder > 0) then { - lbadd[213,format[localize "STR_ACE_UI_PARTIAL_OPEN_WOUND",_nameEntry]]; - lbSetData [213, _numberOf, format["open_wound_%1",_counter]]; - lbSetColor [213, _numberOf, [0.6, 0, 0, 1]]; - _numberOf = _numberOf + 1; - }; - }; - _counter = _counter + 1; -}foreach _listOfWounds; - -_counter = 0; -{ - if (_x > 0) then { - - _untreatedWounds = floor _x; - _remainder = _x - (floor _x); - - _nameEntry = switch (_counter) do { - case 0: {localize "STR_ACE_UI_SMALL"}; - case 1: {localize "STR_ACE_UI_MEDIUM"}; - case 2: {localize "STR_ACE_UI_LARGE"}; - default {localize "STR_ACE_UI_SMALL"}; - }; - - if (_untreatedWounds > 1) then { - lbadd[213,format[localize "STR_ACE_UI_MULTIPLE_BANDAGED_WOUNDS",_nameEntry,_untreatedWounds]]; - lbSetData [213, _numberOf, format["bandaged_wound_%1",_counter]]; - _numberOf = _numberOf + 1; - } else { - if (_untreatedWounds == 1) then { - lbadd[213,format[localize "STR_ACE_UI_SINGLE_BANDAGED_WOUND",_nameEntry]]; - lbSetData [213, _numberOf, format["bandaged_wound_%1",_counter]]; - _numberOf = _numberOf + 1; - }; - }; - - if (_remainder > 0) then { - lbadd[213,format[localize "STR_ACE_UI_PARTIAL_BANDAGED_WOUND",_nameEntry]]; - lbSetData [213, _numberOf, format["bandaged_wound_%1",_counter]]; - _numberOf = _numberOf + 1; - }; - }; - _counter = _counter + 1; -}foreach _listOfBandagedWounds; - -_counter = 0; -{ - if (_x > 0) then { - _nameEntry = switch (_counter) do { - case 0: {localize "STR_ACE_UI_SMALL"}; - case 1: {localize "STR_ACE_UI_MEDIUM"}; - case 2: {localize "STR_ACE_UI_LARGE"}; - default {localize "STR_ACE_UI_SMALL"}; - }; - lbadd[213,format["%1 Fracture x%2",_nameEntry,_x]]; - lbSetData [213, _numberOf, ""]; - _numberOf = _numberOf + 1; - }; - _counter = _counter + 1; -}foreach _listOfFractures; - diff --git a/addons/medical/functions/fnc_useEquipment.sqf b/addons/medical/functions/fnc_useItem.sqf similarity index 64% rename from addons/medical/functions/fnc_useEquipment.sqf rename to addons/medical/functions/fnc_useItem.sqf index e432585de9..8a9a088247 100644 --- a/addons/medical/functions/fnc_useEquipment.sqf +++ b/addons/medical/functions/fnc_useItem.sqf @@ -1,11 +1,16 @@ -/** - * fn_useEquipment.sqf - * @Descr: Use Equipment if any is available. Priority: 1) Medic, 2) Patient. If in vehicle: 3) Crew - * @Author: Glowbal +/* + * Author: Glowbal + * Use Equipment if any is available. Priority: 1) Medic, 2) Patient. If in vehicle: 3) Crew * - * @Arguments: [medic OBJECT, patient OBJECT, item STRING (ClassName of magazine item)] - * @Return: BOOL - * @PublicAPI: true + * Arguments: + * 0: Medic + * 1: Patient + * 2: Item + * + * ReturnValue: + * + * + * Public: Yes */ #include "script_component.hpp" @@ -20,12 +25,12 @@ if (isnil QGVAR(setting_allowSharedEquipment)) then { }; if (GVAR(setting_allowSharedEquipment) && {[_patient, _item] call EFUNC(common,hasItem)}) exitwith { - [[_patient, _item], QUOTE(EFUNC(common,useItem)), _patient] call BIS_fnc_MP; + [[_patient, _item], QUOTE(EFUNC(common,useItem)), _patient] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ true; }; if ([_medic, _item] call EFUNC(common,hasItem)) exitwith { - [[_medic, _item], QUOTE(EFUNC(common,useItem)), _medic] call BIS_fnc_MP; + [[_medic, _item], QUOTE(EFUNC(common,useItem)), _medic] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ true; }; @@ -33,11 +38,11 @@ _return = false; if ([vehicle _medic] call FUNC(isMedicalVehicle) && {vehicle _medic != _medic}) then { _crew = crew vehicle _medic; { - if ([_x, _medic] call FUNC(canAccessMedicalEquipment) && {([_x, _item] call EFUNC(common,hasItem))}) exitwith { + if ([_medic, _x] call FUNC(canAccessMedicalEquipment) && {([_x, _item] call EFUNC(common,hasItem))}) exitwith { _return = true; - [[_x, _item], QUOTE(EFUNC(common,useItem)), _x] call BIS_fnc_MP; + [[_x, _item], QUOTE(EFUNC(common,useItem)), _x] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ }; }foreach _crew; }; -_return \ No newline at end of file +_return; diff --git a/addons/medical/functions/fnc_useItems.sqf b/addons/medical/functions/fnc_useItems.sqf new file mode 100644 index 0000000000..4feb234e8c --- /dev/null +++ b/addons/medical/functions/fnc_useItems.sqf @@ -0,0 +1,35 @@ +/* + * Author: Glowbal + * Use Equipment items if any is available. Priority: 1) Medic, 2) Patient. If in vehicle: 3) Crew + * + * Arguments: + * 0: Medic + * 1: Patient + * 2: Items > + * + * ReturnValue: + * + * + * Public: Yes + */ + +#include "script_component.hpp" + +private ["_medic", "_patient", "_items"]; +_medic = _this select 0; +_patient = _this select 1; +_items = _this select 2; + +{ + // handle a one of type use item + if (typeName _x == "ARRAY") then { + { + if ([_medic, _patient, _x] call FUNC(useItem)) exitwith {}; + }foreach _x; + }; + + // handle required item + if (typeName _x == "STRING") then { + [_medic, _patient, _x] call FUNC(useItem); + }; +}foreach _items; diff --git a/addons/medical/script_component.hpp b/addons/medical/script_component.hpp index cdbccbd643..ad45e06a3e 100644 --- a/addons/medical/script_component.hpp +++ b/addons/medical/script_component.hpp @@ -10,16 +10,3 @@ #endif #include "\z\ace\addons\main\script_macros.hpp" - - -#define TREATMENT_AIRWAY(ITEM) {[_this select 0,_this select 1,call FUNC(getSelectedBodyPart),ITEM,'airway'] call FUNC(handleTreatment)} -#define TREATMENT_ADVANCED(ITEM) {[_this select 0,_this select 1,call FUNC(getSelectedBodyPart),ITEM,'advanced'] call FUNC(handleTreatment)} -#define TREATMENT_BANDAGE(ITEM) {[_this select 0,_this select 1,call FUNC(getSelectedBodyPart),ITEM,'bandage'] call FUNC(handleTreatment)} -#define TREATMENT_MEDICATION(ITEM) {[_this select 0,_this select 1,call FUNC(getSelectedBodyPart),ITEM,'medication'] call FUNC(handleTreatment)} -#define TREATMENT_OTHER(ITEM) {[_this select 0,_this select 1,call FUNC(getSelectedBodyPart),ITEM,'other'] call FUNC(handleTreatment)} - -#define ADD_TREATMENT_AIRWAY(TITLE,TOOLTIP,ITEM) [TITLE,TOOLTIP,{[_this select 0,_this select 1,ITEM] call FUNC(hasEquipment)},TREATMENT_AIRWAY(ITEM),'airway'] call FUNC(addTreatmentOption) -#define ADD_TREATMENT_ADVANCED(TITLE,TOOLTIP,ITEM) [TITLE,TOOLTIP,{[_this select 0,_this select 1,ITEM] call FUNC(hasEquipment)},TREATMENT_ADVANCED(ITEM),'advanced'] call FUNC(addTreatmentOption) -#define ADD_TREATMENT_BANDAGE(TITLE,TOOLTIP,ITEM) [TITLE,TOOLTIP,{[_this select 0,_this select 1,ITEM] call FUNC(hasEquipment)},TREATMENT_BANDAGE(ITEM),'bandage'] call FUNC(addTreatmentOption) -#define ADD_TREATMENT_MEDICATION(TITLE,TOOLTIP,ITEM) [TITLE,TOOLTIP,{[_this select 0,_this select 1,ITEM] call FUNC(hasEquipment)},TREATMENT_MEDICATION(ITEM),'medication'] call FUNC(addTreatmentOption) -#define ADD_TREATMENT_OTHER(TITLE,TOOLTIP,ITEM) [TITLE,TOOLTIP,{[_this select 0,_this select 1,ITEM] call FUNC(hasEquipment)},TREATMENT_OTHER(ITEM),'other'] call FUNC(addTreatmentOption) diff --git a/addons/medical/stringtable.xml b/addons/medical/stringtable.xml index f23f45c1fc..9e46060e6b 100644 --- a/addons/medical/stringtable.xml +++ b/addons/medical/stringtable.xml @@ -1,1422 +1,330 @@ - - - - - Open Combat Medical System Menu - Открыть меню медицинской системы CMS - Otwórz menu Combat Medical System - Abrir Menú CMS - - - Opens the CMS menu - Открывает меню CMS - Otwiera menu CMS - Abre el Menú CMS - - - - - Nasopharyngeal Tube - Назотрахеальная трубка - Cánula Nasofaríngea - Canule Nasopharyngée - Rurka nosowo-gardłowa - - - Used to keep the airway patent - Для обеспечения проходимости дыхательных путей - Mantiene libre las vías aéreas - Maintien les voix respiratoires libres - Używana w celu udrożnienia dróg oddechowych - - - Remove Nasopharyngeal - Извлечь назотрахеальную трубку - Retirar Cánula Nasofaríngea - Retirer la Canule Nasopharyngée - Wyjmij rurkę nosowo-gardłową - - - Remove the Nasopharyngeal Tube - Извлечь назотрахеальную трубку - Retirar Cánula Nasofaríngea - Retirer la Canule Nasopharyngée - Wyjmuje rurkę nosowo-gardłową - - - - - Give Blood IV (1000ml) - Перелить кровь (1000 мл) - Give Blood IV (1000ml) - Intravenöse Blutspende (1000ml) - Sangre Intravenosa (1000ml) - Cullot Sanguin IV (1000ml) - Podaj krew IV (1000ml) - - - Give Blood IV (500ml) - Перелить кровь (500 мл) - Give Blood IV (500ml) - Intravenöse Blutspende (500ml) - Sangre Intravenosa (500ml) - Cullot Sanguin IV (500ml) - Podaj krew IV (500ml) - - - Give Blood IV (250ml) - Перелить кровь (250 мл) - Give Blood IV (250ml) - Intravenöse Blutspende (250ml) - Sangre Intravenosa (250ml) - Cullot Sanguin IV (250ml) - Podaj krew IV (250ml) - - - Give Plasma IV (1000ml) - Влить плазму (1000 мл) - Give Plasma IV (1000ml) - Intravenöse Plasmaspende (1000ml) - Plasma Intravenoso (1000ml) - Plasma Sanguin IV (1000ml) - Podaj osocze IV (1000ml) - - - Give Plasma IV (500ml) - Влить плазму (500 мл) - Give Plasma IV (500ml) - Intravenöse Plasmaspende (500ml) - Plasma Intravenoso (500ml) - Plasma Sanguin IV (500ml) - Podaj osocze IV (500ml) - - - Give Plasma IV (250ml) - Влить плазму (250 мл) - Give Plasma IV (250ml) - Intravenöse Plasmaspende (250ml) - Plasma Intravenoso (250ml) - Plasma Sanguin IV (250ml) - Podaj osocze IV (250ml) - - - Give Saline IV (1000ml) - Влить физраствор (1000 мл) - Give Saline IV (1000ml) - Intravenöse Kochsalzlösung (1000ml) - Solución Salina Intravenosa (1000ml) - Solution Saline 0.9% IV (1000ml) - Podaj solankę 0,9% IV (1000ml) - - - Give Saline IV (500ml) - Влить физраствор (500 мл) - Give Saline IV (500ml) - Intravenöse Kochsalzlösung (500ml) - Solución Salina Intravenosa (500ml) - Solution Saline 0.9% IV (500ml) - Podaj solankę 0,9% IV (500ml) - - - Give Saline IV (250ml) - Влить физраствор (250 мл) - Give Saline IV (250ml) - Intravenöse Kochsalzlösung (250ml) - Solución Salina Intravenosa (250ml) - Solution Saline 0.9% IV (250ml) - Podaj solankę 0,9% IV (250ml) - - - Full Heal (Personal Aid Kit) - Полное лечение (аптечка) - Full Heal (Personal Aid Kit) - Ambulante Versorgung (Erste-Hilfe-Tasche) - Tratamiento Avanzado (Kit de Soporte Vital Avanzado) - Soin Complet (Équipement de support vitale - Pełne leczenie (Apteczka) - - - Perform CPR - Провести СЛР - Perform CPR - Herz-Lungen-Wiederbelebung - Realizar CPR - Effectuer RCR - Wykonaj RKO - - - Stop CPR - Прекратить СЛР - Stop CPR - Przerwij RKO - Abortar CPR - - - Give the patient a Blood IV of 1000ml. Read the label for further information. - Перелить пациенту 1000 мл крови. См. информацию на этикетке. - Give the patient a Blood IV of 1000ml. Read the label for further information. - Verabreicht dem Patienten 1000ml Spenderblut. Weitere Informationen auf der Verpackung. - Administrar Sangre de 1000ml. Lea la etiqueta para más información. - Administrer Cullot Sanguin de 1000ml. Lire l'étiquette pour plus d'information. - Przetacza pacjentowi 1000ml krwi dożylnie (IV). Przeczytaj etykietę, aby dowiedzieć się więcej. - - - Give the patient a Blood IV of 500ml. Read the label for further information. - Перелить пациенту 500 мл крови. См. информацию на этикетке. - Give the patient a Blood IV of 500ml. Read the label for further information. - Verabreicht dem Patienten 500ml Spenderblut. Weitere Informationen auf der Verpackung. - Administrar Sangre de 500ml. Lea la etiqueta para más información. - Administrer Cullot Sanguin de 500ml. Lire l'étiquette pour plus d'information. - Przetacza pacjentowi 500ml krwi dożylnie (IV). Przeczytaj etykietę, aby dowiedzieć się więcej. - - - Give the patient a Blood IV of 250ml. Read the label for further information. - Перелить раненому 500 мл крови. См. информацию на этикетке. - Give the patient a Blood IV of 250ml. Read the label for further information. - Verabreicht dem Patienten 250ml Spenderblut. Weitere Informationen auf der Verpackung. - Administrar Sangre de 250ml. Lea la etiqueta para más información. - Administrer Cullot Sanguin de 250ml. Lire l'étiquette pour plus d'information. - Przetacza pacjentowi 250ml krwi dożylnie (IV). Przeczytaj etykietę, aby dowiedzieć się więcej. - - - Give the patient a Plasma IV of 1000ml. Read the label for further information. - Влить раненому 1000 мл плазмы. См. информацию на этикетке. - Give the patient a Plasma IV of 1000ml. Read the label for further information. - Verabreicht dem Patienten 1000ml Blutplasma. Weitere Informationen auf der Verpackung. - Administrar Plasma de 1000ml. Lea la etiqueta para más información. - Administrer Plasma Sanguin de 1000ml. Lire l'étiquette pour plus d'information. - Przetacza pacjentowi 1000ml osocza dożylnie (IV). Przeczytaj etykietę, aby dowiedzieć się więcej. - - - Give the patient a Plasma IV of 500ml. Read the label for further information. - Влить раненому 500 мл плазмы. См. информацию на этикетке. - Give the patient a Plasma IV of 500ml. Read the label for further information. - Verabreicht dem Patienten 500ml Blutplasma. Weitere Informationen auf der Verpackung. - Administrar Plasma de 500ml. Lea la etiqueta para más información. - Administrer Plasma Sanguin de 500ml. Lire l'étiquette pour plus d'information. - Przetacza pacjentowi 500ml osocza dożylnie (IV). Przeczytaj etykietę, aby dowiedzieć się więcej. - - - Give the patient a Plasma IV of 250ml. Read the label for further information. - Влить раненому 250 мл плазмы. См. информацию на этикетке. - Give the patient a Plasma IV of 250ml. Read the label for further information. - Verabreicht dem Patienten 250ml Blutplasma. Weitere Informationen auf der Verpackung. - Administrar Plasma de 250ml. Lea la etiqueta para más información. - Administrer Plasma Sanguin de 250ml. Lire l'étiquette pour plus d'information. - Przetacza pacjentowi 250ml osocza dożylnie (IV). Przeczytaj etykietę, aby dowiedzieć się więcej. - - - Give the patient a Saline IV of 1000ml. Read the label for further information. - Влить раненому 1000 мл физраствора. См. информацию на этикетке. - Give the patient a Saline IV of 1000ml. Read the label for further information. - Verabreicht dem Patienten 1000ml Kochsalzlösung. Weitere Informationen auf der Verpackung. - Administrar Solución Salina de 1000ml. Lea la etiqueta para más información. - Administrer Solution Saline 0.9% de 1000ml. Lire l'étiquette pour plus d'information. - Przetacza pacjentowi 1000ml 0,9% roztworu soli fizjologicznej dożylnie (IV). Przeczytaj etykietę, aby dowiedzieć się więcej. - - - Give the patient a Saline IV of 500ml. Read the label for further information. - Влить раненому 500 мл физраствора. См. информацию на этикетке. - Give the patient a Saline IV of 500ml. Read the label for further information. - Verabreicht dem Patienten 500ml Kochsalzlösung. Weitere Informationen auf der Verpackung. - Administrar Solución Salina de 500ml. Lea la etiqueta para más información. - Administrer Solution Saline 0.9% de 500ml. Lire l'étiquette pour plus d'information. - Przetacza pacjentowi 500ml 0,9% roztworu soli fizjologicznej dożylnie (IV). Przeczytaj etykietę, aby dowiedzieć się więcej. - - - Give the patient a Saline IV of 250ml. Read the label for further information. - Влить раненому 250 мл физраствора. См. информацию на этикетке. - Give the patient a Saline IV of 250ml. Read the label for further information. - Verabreicht dem Patienten 250ml Kochsalzlösung. Weitere Informationen auf der Verpackung. - Administrar Solución Salina de 250ml. Lea la etiqueta para más información. - Administrer Solution Saline 0.9% de 250ml. Lire l'étiquette pour plus d'information. - Przetacza pacjentowi 250ml 0,9% roztworu soli fizjologicznej dożylnie (IV). Przeczytaj etykietę, aby dowiedzieć się więcej. - - - Fully heal a soldier. - Полностью вылечить раненого. - Fully heal a soldier. - Heilt einen Soldaten vollständig. - Curar completamente al herido. - Soigner Complêtement le Soldat. - Pozwala w pełni wyleczyć pacjenta. - - - Perform CPR. Success can stabilize heart rate and blood pressure. - Провести сердечно-легочную реанимацию. В случае успеха стабилизируются пульс и давление. - Perform CPR. Success can stabilize heart rate and blood pressure. - Herz-Lungen-Wiederbelebung, bei Erfolg können sich Puls und Blutdruck stabilisieren. - Realizar CPR. Puede estabilizar la frecuencia cardiaca y la presión arterial. - Effectuer RCR. Le succes de la maneuvre peut retablir un pouls et une tention artériel. - Wykonaj RKO. Sukces może ustabilizować puls oraz ciśnienie krwi. - - - Stop providing CPR. - Прекратить сердечно-легочную реанимацию. - Stop providing CPR. - Przerwij wykonywanie RKO. - Dejar de aplicar CPR - - - Stitch Wounds. - Зашить раны. - Suturar Heridas - - - Stitch bandaged wounds. - Зашить перевязанные раны. - Suturar Heridas Vendadas - - - - - Field Dressing (Basic) - Повязка (обычная) - Vendaje de Campaña (Básico) - - - - Apply when wounds have been bandaged - Накладывается после остановки кровотечения - Aplicar cuando las heridas han sido vendadas - - - Field Dressing (QuikClot) - Первичный перевязочный пакет (QuikClot) - Vendaje de Campaña (QuikClot) - - - Apply to cloth the wound and stop bleeding - Применяется для остановки кровотечения - Aplicar para detener el sangrado - - - Field Dressing (Elastic) - Повязка (давящая) - Vendaje de Campaña (Elástico) - - - For extra pressure, apply when wounds have been bandaged - Обеспечивает прижатие раны после остановки кровотечения - Aplicar a las heridas vendadas para más presión - - - Packing Bandage - Тампонирующая повязка - Vendaje Compresivo - - - Apply on medium to large wounds - Применяется при ранениях среднего и большого размера - Aplicar en heridas medianas o grandes - - - Remove Tourniquet - Снять жгут - Quitar Torniquete - - - Remove applied Tourniquet - Снять ранее наложенный жгут - Quitar Torniquetes - - - Tourniquet - Жгут - Torniquete - - - Apply on limbs only. Limits blood loss on limb. - Накладывается только на конечности. Ограничивает кровопотерю из конечности. - Aplicar sólo en las extremidades. Limita la pérdida de sangre en las extremidades. - - - - - Drag - Тащить - Arrastrar - - - Drag %2 - Тащить раненого %2 - Arrastrar a %2r - - - Carry - Нести - Cargar - - - Carry %2 - Нести раненого %2 - Cargar a %2 - - - Bodybag - Мешок для трупов - Bolsa para cadáveres - - - Put body in bodybag - Поместить труп в мешок - Meter cuerpo en la bolsa para cadáveres - - - Drop - Положить - Soltar - - - Drop %2 - Положить %2 - Soltar a %2 - - - Load in Vehicle - Погрузить в транспорт - Meter en vehículo - - - Load %2 - Погрузить раненого %2 - Cargar a %2 - - - Unload - Выгрузить - Descargar - - - Unload %2 - Выгрузить раненого %2 - Descargar a %2 - - - - - Check Pulse - Проверить пульс - Comprobar Pulso - - - Find the Heart Rate - Нащупать пульс - Encontrar el ritmo cardiaco - - - Check Blood Pressure - Проверить давление - Comprobar Presión Arterial - - - Find out what Blood Pressure patient has - Узнать артериальное давление раненого - Comprobar Presión Arterial - - - Check Response - Проверить реакцию - Comprobar Respuesta - - - - Check if patient is responsive - Проверить, реагирует ли раненый на раздражители - Comprobar si el paciente reacciona - - - - - Morphine - Морфин - Morfina - - - Good to counter pain - Эффективное обезболивающее средство - Alivia el dolor - - - Atropine - Атропин - Atropina - - - Relaxes mussles - Расслабляет мышцы - Antiarrítmico - - - Epinephrine - Адреналин - Epinefrina - - - Adrenaline to get the heart going - Для возобновления сердечной деятельности - Incrementa la frecuencia cardiaca - - - - - EXAMINE & TREATMENT - ОСМОТР И ЛЕЧЕНИЕ - EXAMINE & TREATMENT - EXAMINAR & TRATAMIENTO - EXAMINER & TRAITEMENTS - BADANIE & LECZENIE - - - STATUS - СОСТОЯНИЕ - STATUS - ESTADO - ÉTATS - STATUS - - - OVERVIEW - ОБЩАЯ ИНФОРМАЦИЯ - OVERVIEW - DESCRIPCIÓN - DESCRIPTION - OPIS - - - ACTIVITY LOG - ПРОВЕДЕННЫЕ МАНИПУЛЯЦИИ - ACTIVITY LOG - REGISTRO DE ACTIVIDAD - REGISTRE DES SOINS - LOGI AKTYWNOŚCI - - - QUICK VIEW - БЫСТРЫЙ ОСМОТР - QUICK VIEW - VISTA RÁPIDA - VUE RAPIDE - SZYBKI PODGLĄD - - - None - Не ранен - Ninguno - Aucun - Brak - - - Minor - Несрочная помощь - Menor - Mineur - Normalny - - - Delayed - Срочная помощь - Diferido - Urgent - Opóźniony - - - Immediate - Неотложная помощь - Inmediato - Immédiat - Natychmiastowy - - - Deceased - Морг - Fallecido - Décédé - Nie żyje - - - View triage Card - Смотреть первичную карточку - Ver Triage - Voir Carte de Triage - Pokaż kartę segregacyjną - - - Examine Patient - Осмотреть пациента - Examinar Paciente - Examiner Patient - Zbadaj pacjenta - - - Bandage / Fractures - Раны / переломы - Vendajes/Fracturas - Bandages / Fractures - Bandaże / Złamania - - - Medication - Медикаменты - Medicación - Médications - Leki - - - Airway Management - Дыхательные пути - Vías Aéreas - Gestion Des Voie REspiratoire - Drogi oddechowe - - - Advanced Treatments - Специальная медпомощь - Tratamientos Avanzados - Traitement Avancé - Zaawansowane zabiegi - - - Drag/Carry - Тащить/нести - Arrastrar/Cargar - Glisser/Porter - Ciągnij/Nieś - - - Toggle (Self) - Лечить себя/другого раненого - Activer (sois) - Przełącz (na siebie) - Alternar - - - Select triage status - Сортировка - Seleccionar estado de Triage - Selectioner l'état de Triage - Wybierz priorytet - - - Select Head - Выбрать голову - Seleccionar Cabeza - Selectioner Tête - Wybierz głowę - - - Select Torso - Выбрать торс - Seleccionar Torso - Selectioner Torse - Wybierz tors - - - Select Left Arm - Выбрать левую руку - Seleccionar Brazo Izquierdo - Selectioner Bras Gauche - Wybierz lewą rękę - - - Select Right Arm - Выбрать правую руку - Seleccionar Brazo Derecho - Selectioner Bras Droit - Wybierz prawą rękę - - - Select Left Leg - Выбрать левую ногу - Seleccionar Pierna Izquierda - Selectioner Jambe Gauche - Wybierz lewą nogę - - - Select Right Leg - Выбрать правую ногу - Seleccionar Pierna Derecha - Selectioner Jambe Droite - Wybierz prawą nogę - - - Head - Голова - Cabeza - Tête - Głowa - - - Torso - Торс - Torse - Tors - - - Left Arm - Левая рука - Brazo Izquierdo - Bras Gauche - Lewa ręka - - - Right Arm - Правая рука - Brazo Derecho - Bras Droit - Prawa ręka - - - Left Leg - Левая нога - Pierna Izquierda - Jambe Gauche - Lewa noga - - - Right Leg - Правая нога - Pierna Derecha - Jambe Droite - Prawa noga - - - Body Part: %1 - Часть тела: %1 - Parte del cuerpo: %1 - Partie du corps: %1 - Część ciała: %1 - - - Small - малого размера - Pequeña - Petite - małym - - - Medium - среднего размера - Mediana - moyenne - średnim - - - Large - большого размера - Grande - Grande - dużym - - - There are %2 %1 Open Wounds - %2 открытые раны %1 - Hay %2 Heridas Abiertas %1 - Il y a %2 %1 Blessure Ouverte - Widzisz otwarte rany w ilości %2 o %1 rozmiarze - - - There is 1 %1 Open Wound - Открытая рана %1 - Hay 1 Herida Abierta %1 - Il y a 1 blessure ouverte %1 - Widzisz 1 otwartą ranę o %1 rozmiarze - - - There is a partial %1 Open wound - Частично открытая рана %1 - Hay una herida parcial abierta %1 - Il y a une Blessure Patiellement Ouverte %1 - Widzisz częściowo otwartą ranę o %1 rozmiarze - - - There are %2 %1 Bandaged Wounds - %2 перевязанные раны %1 - Hay %2 Heridas %1 Vendadas - Il y a %2 %1 Blessure Bandée - Widzisz %2 zabandażowanych ran o %1 rozmiarze - - - There is 1 %1 Bandaged Wound - 1 перевязанная рана %1 - Hay 1 Herida Vendada %1 - Il y a 1 %1 Blessure Bandée - Widzisz 1 zabandażowaną ranę o %1 rozmiarze - - - There is a partial %1 Bandaged wound - Частично перевязанная рана %1 - Hay una Herida parcial %1 Vendada - Il y a %1 Blessure Partielment Bandée - Widzisz 1 częściowo zabandażowaną ranę o %1 rozmiarze - - - Normal breathing - Дыхание в норме - Respiración normal - Respiration Normale - Normalny oddech - - - No breathing - Дыхания нет - No respira - Apnée - Brak oddechu - - - Difficult breathing - Дыхание затруднено - Dificultad para respirar - Difficultée Respiratoire - Trudności z oddychaniem - - - Almost no breathing - Дыхания почти нет - Casi sin respirar - Respiration Faible - Prawie brak oddechu - - - Bleeding - Кровотечение - Sangrando - Seignement - Krwawienie zewnętrzne - - - in Pain - Испытывает боль - Con Dolor - A De La Douleur - W bólu - - - Lost a lot of Blood - Большая кровопотеря - Mucha Sangre perdida - A Perdu Bcp de Sang - Stracił dużo krwi - - - Tourniquet [CAT] - Жгут - Torniquete [CAT] - Garot [CAT] - Opaska uciskowa [CAT] - - - Nasopharyngeal Tube [NPA] - Назотрахеальная трубка - Torniquete [CAT] - Canule Naseaupharyngée [NPA] - Rurka nosowo-gardłowa [NPA] - - - - + + + + Bandage (Basic) Повязка (обычная) Vendaje (Básico) Bandage (Standard) Bandaż (jałowy) - + Used to cover a wound Для перевязки ран Utilizado para cubrir una herida Utilisé Pour Couvrir Une Blessure Używany w celu przykrycia i ochrony miejsca zranienia - + A dressing, that is a particular material used to cover a wound, which is applied over the wound once bleeding has been stemmed. Повязка, накладываемая поверх раны после остановки кровотечения. Un apósito, material específico utilizado para cubrir una herida, se aplica sobre la herida una vez ha dejado de sangrar. C'est un bandage, qui est fait d'un matériel spécial utiliser pour couvrir une blessure, qui peut etre appliquer des que le seignement as ete stopper. Opatrunek materiałowy, używany do przykrywania ran, zakładany na ranę po zatamowaniu krwawienia. - + Packing Bandage Тампонирующая повязка Vendaje Compresivo Bandage Mèche Bandaż (uciskowy) - + Used to pack medium to large wounds and stem the bleeding Для тампонирования ран среднего и большого размера и остановки кровотечения. Se utiliza para vendar heridas medianas y grandes y detener el sangrado Utiliser pour remplire la cavité créé dans une blessure moyenne et grande. Używany w celu opatrywania średnich i dużych ran oraz tamowania krwawienia. - + A bandage used to pack the wound to stem bleeding and facilitate wound healing. Packing a wound is an option in large polytrauma injuries. Повязка для тампонирования раны, остановки кровотечения и лучшего заживления. При тяжелых сочетанных ранениях возможно тампонирование раны. Se utiliza para detener la hemorragia de una herida y favorecer su cicatrización. Se usa en grandes lesiones o politraumatismos. Un bandage servent a etre inseré dans les blessure pour éponger le seignement et faciliter la guerrison. Ce bandage est une option pour soigner les lession de politrauma. Opatrunek stosowany w celu zatrzymania krwawienia i osłony większych ran. - + Bandage (Elastic) Повязка (давящая) Vendaje (Elástico) Bandage (Élastique) Bandaż (elastyczny) - + Bandage kit, Elastic Давящая повязка Vendaje (Elástico) Bandage Compressif Élastique Zestaw bandaży elastycznych. - + Ce bandage peut etre utiliser pour compresser la plaie afin de ralentire le seignement et assurer la tenue du bandage lors de mouvment. Elastyczna opaska podtrzymująca opatrunek oraz usztywniająca okolice stawów. Brinda una compresión uniforme y ofrece soporte extra a una zona lesionada - + Tourniquet (CAT) Жгут Torniquete (CAT) Garot (CAT) Staza (typ. CAT) - + Slows down blood loss when bleeding Уменьшает кровопотерю при кровотечении. Reduce la velocidad de pérdida de sangre Ralentit le seignement Zmniejsza ubytek krwi z kończyn w przypadku krwawienia. - + A constricting device used to compress venous and arterial circulation in effect inhibiting or slowing blood flow and therefore decreasing loss of blood. Жгут используется для прижатия сосудов, приводящего к остановке или значительному уменьшению кровотечения и сокращению кровопотери. Dispositivo utilizado para eliminar el pulso distal y de ese modo controlar la pérdida de sangre Un appareil servent a compresser les artères et veines afin de reduire la perte de sang. Opaska zaciskowa CAT służy do tamowanie krwotoków w sytuacji zranienia kończyn z masywnym krwawieniem tętniczym lub żylnym. - - Splint - Шина - Férula - Attelle - Szyna - - - An immobilization device used to support, immobilize and to a degree compress the associated wound. Usually used on the limbs but can be used on the hip. - Приспособление для поддержки и иммобилизации конечности, а также частичного прижатия ее раны. Обычно накладывается на конечности, но может накладываться и на бедро. - Un dispositivo de inmovilización utilizado para apoyar, inmovilizar y comprimir la herida asociada. Normalmente se usa en las extremidades, pero puede ser utilizado en la cadera. - Un dispositif d'immobilisation servant a supporter, immobiliser, et meme comprimer les blessure relier a une fracture. Normalement utiliser sur les extrémités - Szyna jest urządzeniem służącym do wsparcia lub unieruchomienia kończyny lub kręgosłupa. - - - A Splint, for broken bones - Шина для переломов - Férula, para huesos rotos - Une attelle, pour les os brisé - Szyna, na złamane kości. - - + Morphine auto-injector Морфин в автоматическом шприце Morfina auto-inyectable Auto-injecteur de Morphine Autostrzykawka z morfiną - + Used to combat moderate to severe pain experiences Для снятия средних и сильных болевых ощущений. Usado para combatir los estados dolorosos moderados a severos Utiliser pour contrer les douleurs modéré à severes. Morfina. Ma silne działanie przeciwbólowe. - + An analgesic used to combat moderate to severe pain experiences. Анальгетик для снятия средних и сильных болевых ощущений. Analgésico usado para combatir los estados dolorosos de moderado a severo. Un Analgésique puissant servant a contrer les douleur modéré a severe. Organiczny związek chemiczny z grupy alkaloidów. Ma silne działanie przeciwbólowe. - + Atropin auto-injector Атропин в автоматическом шприце Atropina auto-inyectable Auto-injecteur d'Atropine Autostrzykawka AtroPen - + Used in NBC scenarios Применяется для защиты от ОМП Usado en escenarios NBQ Utiliser en cas d'attaque CBRN Atropina. Stosowana jako lek rozkurczowy i środek rozszerzający źrenice. - + A drug used by the Military in NBC scenarios. Препарат, используемый в войсках для защиты от оружия массового поражения. Medicamento usado por Militares en escenarios NBQ Médicament utilisé par l'armée en cas d'attaque CBRN Atropina. Stosowana jako lek rozkurczowy i środek rozszerzający źrenice. Środek stosowany w przypadku zagrożeń NBC. - + Epinephrine auto-injector Адреналин в автоматическом шприце Epinefrina auto-inyectable Auto-injecteur d'épinéphrine Autostrzykawka EpiPen - + Increase heart rate and counter effects given by allergic reactions Стимулирует работу сердца и купирует аллергические реакции. Aumenta la frecuencia cardiaca y contraresta los efectos de las reacciones alérgicas Augmente la Fréquance cadiaque et contré les effet d'une reaction Anaphylactique Adrenalina. Zwiększa puls i przeciwdziała efektom wywołanym przez reakcje alergiczne - + A drug that works on a sympathetic response to dilate the bronchi, increase heart rate and counter such effects given by allergic reactions (anaphylaxis). Used in sudden cardiac arrest scenarios with decreasing positive outcomes. Препарат, вызывающий симпатическую реакцию, приводящую к расширению бронхов, увеличению частоты сердечных сокращений и купированию аллергических реакций (анафилактического шока). Применяется при остановке сердца с уменьшением вероятности благоприятного исхода. Medicamento que dilata los bronquios, aumenta la frecuencia cardiaca y contrarresta los efectos de las reacciones alérgicas (anafilaxis). Se utiliza en caso de paros cardiacos repentinos. Un medicament qui fonctione sur le systeme sympatique créan une dilatation des bronches, augmente la fréquance cardiaque et contre les effet d'une reaction alergique (anaphylaxie). Utiliser lors d'arret cardio-respiratoire pour augmenté les chances retrouver un ryhtme. EpiPen z adrenaliną ma działanie sympatykomimetyczne, tj. pobudza receptory alfa- i beta-adrenergiczne. Pobudzenie układu współczulnego prowadzi do zwiększenia częstotliwości pracy serca, zwiększenia pojemności wyrzutowej serca i przyśpieszenia krążenia wieńcowego. Pobudzenie oskrzelowych receptorów beta-adrenergicznych wywołuje rozkurcz mięśni gładkich oskrzeli, co w efekcie zmniejsza towarzyszące oddychaniu świsty i duszności. - + Plasma IV (1000ml) Плазма для в/в вливания (1000 мл) Plasma Intravenoso (1000ml) Plasma Sanguin IV (1000ml) Osocze IV (1000ml) - + A volume-expanding blood supplement. Дополнительный препарат, применяемый при возмещении объема крови. Suplemento para expandir el volumen sanguíneo. Supplement visant a remplacer les volume sanguin Składnik krwi, używany do zwiększenia jej objętości. - + A volume-expanding blood supplement. Дополнительный препарат, применяемый при возмещении объема крови. Suplemento para expandir el volumen sanguíneo. Supplement visant a remplacer le volume sanguin et remplace les plaquettes. Składnik krwi, używany do zwiększenia jej objętości. - + Plasma IV (500ml) Плазма для в/в вливания (500 мл) Plasma Intravenoso (500ml) Plasma Sanguin IV (500ml) Osocze IV (500ml) - + Plasma IV (250ml) Плазма для в/в вливания (250 мл) Plasma Intravenoso (250ml) Plasma Sanguin (250ml) Osocze IV (250ml) - + Blood IV (1000ml) Кровь для переливания (1000 мл) Sangre Intravenosa (1000ml) Cullot Sanguin IV (1000ml) Krew IV (1000ml) - + Blood IV, for restoring a patients blood (keep cold) Пакет крови для возмещения объема потерянной крови (хранить в холодильнике) Sangre Intravenosa, para restarurar el volumen sanguíneo (mantener frío) Cullot Sanguin IV, pour remplacer le volume sanguin (garder Réfrigeré) Krew IV, używana do uzupełnienia krwi u pacjenta, trzymać w warunkach chłodniczych - + O Negative infusion blood used in strict and rare events to replenish blood supply usually conducted in the transport phase of medical care. Кровь I группы, резус-отрицательная, применяется по жизненным показаниям для возмещения объема потерянной крови на догоспитальном этапе оказания медицинской помощи. Cullot Sanguin O- ,utiliser seulement lors de perte sanguine majeur afin de remplacer le volume sanguin perdu. Habituelment utiliser lors du transport ou dans un etablisement de soin. Krew 0 Rh-, używana w rzadkich i szczególnych przypadkach do uzupełnienia krwi u pacjenta, zazwyczaj w trakcie fazie transportu rannej osoby do szpitala. Utilice sólo durante gran pérdida de sangre para reemplazar el volumen de sangre perdido. Uso habitual durante el transporte de heridos. - + Blood IV (500ml) Кровь для переливания (500 мл) Sangre Intravenosa (500ml) Cullot Sanguin IV (500ml) Krew IV (500ml) - + Blood IV (250ml) Кровь для переливания (250 мл) Sangre Intravenosa (250ml) Cullot Sanguin IV (250ml) Krew IV (250ml) - + Saline IV (1000ml) Физраствор для в/в вливания (1000 мл) Solución Salina Intravenosa (1000ml) solution Saline 0.9% IV (1000ml) Solanka 0,9% IV (1000ml) - + Saline IV, for restoring a patients blood Пакет физраствора для возмещения объема потерянной крови Solución Salina Intravenosa, para restaurar el volumen sanguíneo Solution Saline 0.9% IV, pour retablir temporairement la tention arteriel Solanka 0,9%, podawana dożylnie (IV), używana w celu uzupełnienia krwi u pacjenta - + A medical volume-replenishing agent introduced into the blood system through an IV infusion. Пакет физиологического раствора для возмещения объема потерянной крови путем внутривенного вливания. Suero fisiológico inoculado al torrente sanguíneo de forma intravenosa. Un remplacment temporaire pour rétablir la tention artériel lors de perte sanguine, étant ajouter par intraveineuse Używany w medycynie w formie płynu infuzyjnego jako środek nawadniający i uzupełniający niedobór elektrolitów, podawany dożylnie (IV). - + Saline IV (500ml) Физраствор для в/в вливания (500 мл) Solución Salina Intravenosa (500ml) Solution Saline 0.9% IV (500ml) Solanka 0,9% IV (500ml) - + Saline IV (250ml) Физраствор для в/в вливания (250 мл) Solución Salina Intravenosa (250ml) Solution Saline 0.9% IV (250ml) Solanka 0,9% IV (250ml) - + Basic Field Dressing (QuikClot) Первичный перевязочный пакет (QuikClot) Vendaje Básico (Coagulante) Bandage Regulier (Coagulant) Opatrunek QuikClot - + QuikClot bandage Гемостатический пакет QuikClot Venda Coagulante Bandage coagulant Podstawowy opatrunek stosowany na rany - + Un bandage servant a coaguler les seignements mineur à moyen. Proszkowy opatrunek adsorbcyjny przeznaczony do tamowania zagrażających życiu krwawień średniej i dużej intensywności. Vendaje Hemostático con coagulante que detiene el sangrado. - - Nasopharyngeal tube - Назотрахеальная трубка - Cánula Nasofaríngea - Canule Nasopharyngée - Rurka nosowo-gardłowa - - - Nasopharyngeal tube, for mataining the airway - Назотрахеальная трубка для поддержания проходимости дыхательных путей - Cánula Nasofaríngea, mantiene despejadas las vías aéreas - Canule Naso, sert a mintenir ouverte les voix respiratoire. - Rurka nosowo-gardłowa, używana w celu udrożnienia dróg oddechowych - - - Nasopharyngeal airway. An airway adjunct inserted nasally which is then used to keep the airway patent which allows the field medic to ventilate the patient as appropriate. - Назотрахеальная трубка. Интубационная трубка, вводимая через нос для поддержания проходимости дыхательных путей, позволяющая санитару при необходимости осуществлять вентиляцию легких раненого. - Cánula Nasofaríngea. Dispositivo de vía aérea insertado por vía nasal que se utiliza para mantener libre la vía aérea permitiendo ventilar al paciente según sea apropiado. - Canule Naso. Dispositif, incere par le nez, servant a maintenir les voie respiratoire du patient ouverte, permetant sa ventilation par le personel medical. - Rurki nosowo-gardłowe stosuje się do ratunkowego udrożnienia dróg oddechowych u osób nieprzytomnych. Rurka nosowo-gardłowa jest znacznie lepiej tolerowana np. przez osobę przytomną, niż rurka ustno-gardłowa. - - - Oropharyngeal tube - Оротрахеальная трубка - Cánula Orofaríngea - Canule Oropharyngée - Rurka ustno-gardłowa - - - Oropharyngeal Airway, for maintaining the airway - Оротрахеальная трубка для поддержания проходимости дыхательных путей - Cánula Orofaríngea, para mantener despejada las vía aéreas - Canule Oropharyngée, sert a maintenir les voie respiratoires ouverte. - Rurka ustno-gardłowa, używana w celu udrożnienia dróg oddechowych - - - Oropharyngeal airway. An airway adjunct inserted via the oral airway (i.e. mouth) which is then used to keep the airway patent which allows the field medic to ventilate the patient as appropriate. - Оротрахеальная трубка. Интубационная трубка, вводимая через рот для поддержания проходимости дыхательных путей, позволяющая санитару при необходимости осуществлять вентиляцию легких раненого. - Cánula Orofaríngea. Dispositivo de vía aérea insertado a través de la vía respiratoria oral (es decir, la boca) que se utiliza para mantener despejada las vías aéreas permitiendo ventilar al paciente según sea apropiado. - Canule Oropharyngée. Un dispositif, inseré par la bouche, qui est utiliser pour garder les voie respiratoire overte et permetre la ventilation par le personel de soin. - Rurkę ustno - gardłową stosuje się podczas zabiegów sztucznej wentylacji płuc. Zadaniem rurki ustno - gardłowej jest zapewnienie drożności górnych dróg oddechowych, a użycie jej zapewnia ratownikowi komfort prowadzenia zabiegów i podnosi skuteczność prowadzonej akcji. - - - Liquid skin - «Жидкая кожа» - Pomada tópica - Pomade Topique - Bandaż (w płynie) - - - Liquid Skin, for use on burns - Препарат «жидкая кожа» для лечения ожогов - Pomada tópica, para quemaduras - Pomade Topique, appliquer sur les brulures. - Bandaż w płynie, używany na poparzenia i lekkie urazy - - - Liquid bandage is a topical skin treatment for minor cuts and sores that is sold by several companies. The products are mixtures of chemicals which create a polymeric layer which binds to the skin. This protects the wound by keeping dirt and germs out, and keeping moisture in. - Медицинский клей («жидкая повязка») – наружное средство для лечения небольших порезов и ссадин. Продукт представляет собой смесь химических веществ, создающих полимерный слой, который приклеивается к коже. Таким образом предотвращается попадание в рану грязи и микробов, а также высыхание раны. - Bandage liquide est un traitement de la peau topique pour les coupures et les plaies mineures qui est vendu par plusieurs compagnies. Les produits sont des mélanges de produits chimiques qui créent une couche polymère qui se lie à la peau. Cela protège la plaie en gardant la saleté et les germes, et de garder l'humidité. - Opatrunek nakładany na skórę atomizerem tworzący na powierzchni skóry warstwę przyśpieszającą gojenie - stosowany przy drobnych ranach i poparzeniach. - Líquido tópico para pequeños cortes, heridas y quemaduras. Compuesto de sustancias químicas que crean una capa polimérica que se une a la piel. Esto protege la herida manteniéndola libre de suciedad y gérmenes. - - - Chest seal - Окклюзионная повязка - Parche Oclusivo - Bandage Occlusif - Opatrunek Chest Seal - - - A Chest seal - Окклюзионная повязка на грудную клетку - Parche Torácico - Bandage toracique pour les pneumothorax - Opatrunek uszczelniający na rany penetracyjne klatki piersiowej - - - Chest Seal is a high performance occlusive dressing designed to treat penetrating chest wounds along with securing other wound dressings. The patented hydro-gel provides superior adhesion to the wound area even when moisture, pleural fluids or blood is present. It will work on patients with heavy perspiration or very wet environments. The highly aggressive tack adhesive of the hydro-gel will enable the dressing to conform and hold to the patient's body. - Окклюзионная повязка предназначена для лечения проникающих ранений в грудную клетку с одновременной фиксацией других повязок. Патентованный гидрогель обеспечивает отличное крепление к области ранения даже при наличии влаги, плевральной жидкости или крови. Может применяться даже при обильном потоотделении или в очень влажной среде. Благодаря высокоадгезивному пластырю повязка плотно прилегает к телу раненого и не отклеивается. - Le pensement occlusif est un pansement occlusif de haute performance conçu pour traiter les plaies pénétrantes de la poitrine ainsi que la sécurisation d'autres pansements. L'hydro-gel brevetée offre une adhérence supérieure à la surface de la plaie, même lorsque l'humidité, liquide pleural ou le sang est présent, elle le laisse couller. Il fonctionne sur les patients atteints d'une transpiration abondante ou dans des environnements très humides. - Chest Seal to opatrunek przeznaczony do opatrywania penetracyjnych (otwartych) ran klatki piersiowej, staniowiących sytuację zagrażającą życiu wskutek możliwości powstawania odmy prężnej. Jest to druga co do częstotliwości występowania przyczyna śmierci na polu walki, której można zapobiec stosując odpowiednie procedury medyczne. Chest Seal charakteryzuje się trwałym i szczelnym przyleganiem do skóry pokrytej krwią, piaskiem, włosami, potem lub wodą. Materiałem klejącym opatrunku uszczelniającego jest środek hydrożelowy umożliwiający wielokrotne odklejanie i przyklejanie opatrunku, co pozwala na wentylowanie rany. - Vendaje oclusivo utilizado para el tratamiento de las lesiones penetrantes en el tórax - - + Personal Aid Kit Аптечка Kit de Soporte Vital Avanzado Équipement de support Vitale Apteczka osobista - + Includes various treatment kit needed for stitching or advanced treatment Содержит различные материалы и инструменты для зашивания ран и оказания специальной медпомощи. Incluye material médico para tratamientos avanzados Inclue du matériel medical pour les traitement avancé, tel les point de suture. Zestaw środków medycznych do opatrywania ran i dodatkowego leczenia po-urazowego - + - + Surgical Kit Хирургический набор Kit Quirúrgico - + Surgical Kit for in field advanced medical treatment Набор для хирургической помощи в полевых условиях Kit Quirúrgico para el tratamiento avanzado en el campo de batalla - + Surgical Kit for in field advanced medical treatment Набор для хирургической помощи в полевых условиях Kit Quirúrgico para el tratamiento avanzado en el campo de batalla - + Bodybag Мешок для трупов Bolsa para cadáveres - + A bodybag for dead bodies Мешок для упаковки трупов Bolsa para cadáveres - + A bodybag for dead bodies Мешок для упаковки трупов Bolsa para cadáveres - - - Canceled - Отменено - Cancelado - - - Action has been canceled - Действие отменено - Acción cancelada - - - You moved away - Вы отошли от раненого - Te estás alejando - - - Blood Pressure - Артериальное давление - Presión Arterial - - - Checking Blood Pressure.. - Проверка артериального давления... - Comprobando Presión Arterial... - - - You checked %1 - Вы осмотрели раненого %1 - Examinando a %1 - - - You find a blood pressure of %2/%3 - Артериальное давление %2/%3 - La Presión Arterial es %2/%3 - - - You find a low blood pressure - Давление низкое - La Presión Arterial es baja - - - You find a normal blood pressure - Давление нормальное - La Presión Arterial es normal - - - You find a high blood pressure - Давление высокое - La Presión Arterial es alta - - - You find no blood pressure - Давления нет - No hay Presión Arterial - - - You fail to find a blood pressure - Артериальное давление не определяется - No puedes encontrar Presión Arterial - - - Pulse - Пульс - Pulso - - - Checking Heart Rate.. - Проверка пульса... - Comprobando Pulso... - - - You checked %1 - Вы осмотрели раненого %1 - Examinando a %1 - - - You find a Heart Rate of %2 - Пульс %2 уд./мин. - El Pulso es %2 - - - You find a weak Heart Rate - Пульс слабый - El Pulso es débil - - - You find a strong Heart Rate - Пульс учащенный - El Pulso está acelerado - - - You find a normal Heart Rate - Пульс в норме - El Pulso es bueno - - - You find no Heart Rate - Пульс не прощупывается - No tiene Pulso - - - Response - Реакция - Reacciona - - - You check response of patient - Вы проверяете реакцию раненого - Compruebas si el paciente reacciona - - - %1 is responsive - %1 реагирует на раздражители - %1 ha reaccionado - - - - %1 is not responsive - %1 не реагирует - %1 no reacciona - - - You checked %1 - Вы осмотрели раненого %1 - Examinas a %1 - - - Bandaging - Перевязка... - Vendando - - - Bandaged - Повязка наложена - Vendado - - - You bandage %1 (%2) - Вы перевязали раненого %1 (%2) - Aplicas vendaje a %1 en %2 - - - %1 is bandaging you - %1 перевязывает вас - %1 te está vendando - - - You start stitching injures from %1 (%2) - Вы зашиваете ранения от %1 (%2) - Estás suturando heridas de %1 en %2 - - - Stitching - Наложение швов - Suturando - - - You treat the airway of %1 - Вы интубируете раненого %1 - Estás intubando a %1 - - - Airway - Дыхательные пути - Vías Aéreas - - - %1 is treating your airway - %1 проводит вам интубацию - %1 te está intubando - - diff --git a/addons/medical/ui/RscTitles.hpp b/addons/medical/ui/RscTitles.hpp index 524a1c0ad3..d16577fd07 100644 --- a/addons/medical/ui/RscTitles.hpp +++ b/addons/medical/ui/RscTitles.hpp @@ -1,74 +1,69 @@ +class ACE_gui_backgroundBase; +class ACE_gui_listBoxBase; + class Rsctitles { - class GVAR(ScreenEffectsBlack) { - duration = 10e10; - idd = 1111; - movingenable = 0; - onLoad = QUOTE(uiNamespace setVariable [ARR_2(QUOTE(QUOTE(GVAR(ScreenEffectsBlack))), _this select 0)]); - + class GVAR(DisplayInformation) { + duration = 10e10; + idd = 1111; + movingenable = 0; + onLoad = QUOTE(uiNamespace setVariable [ARR_2(QUOTE(QUOTE(GVAR(DisplayInformation))), _this select 0)]); + onUnload = QUOTE(uiNamespace setVariable [ARR_2(QUOTE(QUOTE(GVAR(DisplayInformation))), nil)]); class controlsBackground { - class blackScreen: ACE_gui_backgroundBase { - text = QUOTE(PATHTOF(data\black_out.paa)); - colorText[] = {0.0, 0.0, 0.0, 0.0}; - idc = 11112; - x = safezoneX; - y = safezoneY; - w = safezoneW; - h = safezoneH; - }; + class bodyImgBackground: ACE_gui_backgroundBase { + idc = -1; + x = "safezoneX + (2 * (((safezoneW / safezoneH) min 1.2) / 40))"; + y = "1.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + safezoneY"; + w = "8.5 * (((safezoneW / safezoneH) min 1.2) / 40)"; + h = "8.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; + SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1.4)"; + colorBackground[] = {1,1,1,1}; + colorPicture[] = {1,1,1,1}; + colorText[] = {1,1,1,1}; + text = QUOTE(PATHTOF(ui\body_background.paa)); + }; + class bodyImgHead: bodyImgBackground { + idc = 50; + colorBackground[] = {1,1,1,1}; + colorPicture[] = {1,1,1,1}; + colorText[] = {1,1,1,1}; + text = QUOTE(PATHTOF(ui\body_head.paa)); + }; + class bodyImgTorso: bodyImgHead { + idc = 51; + text = QUOTE(PATHTOF(ui\body_torso.paa)); + }; + class bodyImgArms_l: bodyImgHead { + idc = 52; + text = QUOTE(PATHTOF(ui\body_arm_left.paa)); + }; + class bodyImgArms_r: bodyImgHead { + idc = 53; + text = QUOTE(PATHTOF(ui\body_arm_right.paa)); + }; + class bodyImgLegs_l: bodyImgHead { + idc = 54; + text = QUOTE(PATHTOF(ui\body_leg_left.paa)); + }; + class bodyImgLegs_r: bodyImgHead { + idc = 55; + text = QUOTE(PATHTOF(ui\body_leg_right.paa)); + }; + class InjuryList: ACE_gui_listBoxBase { + idc = 200; + x = "safezoneX + (2 * (((safezoneW / safezoneH) min 1.2) / 40))"; + y = "11 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + safezoneY"; + w = "8.5 * (((safezoneW / safezoneH) min 1.2) / 40)"; + h = "9 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; + SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.7)"; + rowHeight = 0.03; + colorBackground[] = {0, 0, 0, 0.2}; + colorText[] = {1,1, 1, 1.0}; + colorScrollbar[] = {0.95, 0.95, 0.95, 1}; + colorSelect[] = {0.95, 0.95, 0.95, 1}; + colorSelect2[] = {0.95, 0.95, 0.95, 1}; + colorSelectBackground[] = {0, 0, 0, 0.0}; + colorSelectBackground2[] = {0.0, 0.0, 0.0, 0.5}; + }; }; }; - class GVAR(ScreenEffectsBleeding) { - duration = 1; - idd = 1111; - movingenable = 0; - onLoad = QUOTE(uiNamespace setVariable [ARR_2(QUOTE(QUOTE(GVAR(ScreenEffectsBleeding))), _this select 0)]); - - class controlsBackground { - class bleedingScreen: ACE_gui_backgroundBase { - text = QUOTE(PATHTOF(data\bleeding.paa)); - colorText[] = {0.9, 0.2, 0.2, 0.6}; - idc = 11113; - x = safezoneX; - y = safezoneY; - w = safezoneW; - h = safezoneH; - }; - }; - }; - class GVAR(ScreenEffectsHit) { - duration = 1.1; - idd = 1111; - movingenable = 0; - onLoad = QUOTE(uiNamespace setVariable [ARR_2(QUOTE(QUOTE(GVAR(ScreenEffectsHit))), _this select 0)]); - - class controlsBackground { - class effectHit: ACE_gui_backgroundBase { - text = QUOTE(PATHTOF(data\hit.paa)); - colorText[] = {0.7, 0.2, 0.2, 0.4}; - idc = 11113; - x = safezoneX; - y = safezoneY; - w = safezoneW; - h = safezoneH; - }; - }; - }; - class GVAR(ScreenEffectsPain) { - duration = 1; - idd = 1111; - movingenable = 0; - onLoad = QUOTE(uiNamespace setVariable [ARR_2(QUOTE(QUOTE(GVAR(ScreenEffectsPain))), _this select 0)]); - - class controlsBackground { - class painScreen: ACE_gui_backgroundBase { - text = QUOTE(PATHTOF(data\painScreen.paa)); - colorText[] = {1, 1, 1, 0.5}; - idc = 11115; - x = safezoneX; - y = safezoneY; - w = safezoneW; - h = safezoneH; - }; - }; - }; -}; \ No newline at end of file +}; diff --git a/addons/medical/data/body_arm_left.paa b/addons/medical/ui/body_arm_left.paa similarity index 100% rename from addons/medical/data/body_arm_left.paa rename to addons/medical/ui/body_arm_left.paa diff --git a/addons/medical/data/body_arm_right.paa b/addons/medical/ui/body_arm_right.paa similarity index 100% rename from addons/medical/data/body_arm_right.paa rename to addons/medical/ui/body_arm_right.paa diff --git a/addons/medical/ui/body_background.paa b/addons/medical/ui/body_background.paa new file mode 100644 index 0000000000..525d9c4b6a Binary files /dev/null and b/addons/medical/ui/body_background.paa differ diff --git a/addons/medical/ui/body_background.png b/addons/medical/ui/body_background.png new file mode 100644 index 0000000000..65791a01c0 Binary files /dev/null and b/addons/medical/ui/body_background.png differ diff --git a/addons/medical/data/body_head.paa b/addons/medical/ui/body_head.paa similarity index 100% rename from addons/medical/data/body_head.paa rename to addons/medical/ui/body_head.paa diff --git a/addons/medical/data/body_leg_left.paa b/addons/medical/ui/body_leg_left.paa similarity index 100% rename from addons/medical/data/body_leg_left.paa rename to addons/medical/ui/body_leg_left.paa diff --git a/addons/medical/data/body_leg_right.paa b/addons/medical/ui/body_leg_right.paa similarity index 100% rename from addons/medical/data/body_leg_right.paa rename to addons/medical/ui/body_leg_right.paa diff --git a/addons/medical/data/body_torso.paa b/addons/medical/ui/body_torso.paa similarity index 100% rename from addons/medical/data/body_torso.paa rename to addons/medical/ui/body_torso.paa diff --git a/addons/medical/ui/define.hpp b/addons/medical/ui/define.hpp deleted file mode 100644 index 3af837e4f1..0000000000 --- a/addons/medical/ui/define.hpp +++ /dev/null @@ -1 +0,0 @@ -#include "\z\ace\addons\gui\UI\define.hpp" \ No newline at end of file diff --git a/addons/medical/equipment/img/atropine.paa b/addons/medical/ui/items/atropine.paa similarity index 100% rename from addons/medical/equipment/img/atropine.paa rename to addons/medical/ui/items/atropine.paa diff --git a/addons/medical/equipment/img/bloodbag.paa b/addons/medical/ui/items/bloodIV.paa similarity index 100% rename from addons/medical/equipment/img/bloodbag.paa rename to addons/medical/ui/items/bloodIV.paa diff --git a/addons/medical/equipment/img/bodybag.paa b/addons/medical/ui/items/bodybag.paa similarity index 100% rename from addons/medical/equipment/img/bodybag.paa rename to addons/medical/ui/items/bodybag.paa diff --git a/addons/medical/equipment/img/bandageElastic.paa b/addons/medical/ui/items/elasticBandage.paa similarity index 100% rename from addons/medical/equipment/img/bandageElastic.paa rename to addons/medical/ui/items/elasticBandage.paa diff --git a/addons/medical/equipment/img/epinephrine.paa b/addons/medical/ui/items/epinephrine.paa similarity index 100% rename from addons/medical/equipment/img/epinephrine.paa rename to addons/medical/ui/items/epinephrine.paa diff --git a/addons/medical/equipment/img/field_dressing.paa b/addons/medical/ui/items/fieldDressing.paa similarity index 100% rename from addons/medical/equipment/img/field_dressing.paa rename to addons/medical/ui/items/fieldDressing.paa diff --git a/addons/medical/equipment/img/morphine.paa b/addons/medical/ui/items/morphine.paa similarity index 100% rename from addons/medical/equipment/img/morphine.paa rename to addons/medical/ui/items/morphine.paa diff --git a/addons/medical/equipment/img/packing_bandage.paa b/addons/medical/ui/items/packingBandage.paa similarity index 100% rename from addons/medical/equipment/img/packing_bandage.paa rename to addons/medical/ui/items/packingBandage.paa diff --git a/addons/medical/equipment/img/plasma_iv.paa b/addons/medical/ui/items/plasmaIV.paa similarity index 100% rename from addons/medical/equipment/img/plasma_iv.paa rename to addons/medical/ui/items/plasmaIV.paa diff --git a/addons/medical/equipment/img/quickclot.paa b/addons/medical/ui/items/quickclot.paa similarity index 100% rename from addons/medical/equipment/img/quickclot.paa rename to addons/medical/ui/items/quickclot.paa diff --git a/addons/medical/equipment/img/saline_iv.paa b/addons/medical/ui/items/salineIV.paa similarity index 100% rename from addons/medical/equipment/img/saline_iv.paa rename to addons/medical/ui/items/salineIV.paa diff --git a/addons/medical/equipment/img/surgical_kit.paa b/addons/medical/ui/items/surgicalKit.paa similarity index 100% rename from addons/medical/equipment/img/surgical_kit.paa rename to addons/medical/ui/items/surgicalKit.paa diff --git a/addons/medical/equipment/img/tourniquet.paa b/addons/medical/ui/items/tourniquet.paa similarity index 100% rename from addons/medical/equipment/img/tourniquet.paa rename to addons/medical/ui/items/tourniquet.paa diff --git a/addons/medical/ui/menu.hpp b/addons/medical/ui/menu.hpp deleted file mode 100644 index f65b5ab807..0000000000 --- a/addons/medical/ui/menu.hpp +++ /dev/null @@ -1,568 +0,0 @@ -class GVAR(medicalMenu) { - idd = 314412; - movingEnable = true; - onLoad = QUOTE(uiNamespace setVariable [ARR_2(QUOTE(QGVAR(medicalMenu)), _this select 0)]; [ARR_2(QUOTE(QGVAR(id)), true)] call EFUNC(gui,blurScreen); [_this select 0] call FUNC(onMenuOpen);); - onUnload = QUOTE([ARR_2(QUOTE(QGVAR(id)), false)] call EFUNC(gui,blurScreen); [ARR_2(QUOTE(QGVAR(onMenuOpen)), 'onEachFrame')] call BIS_fnc_removeStackedEventHandler;); - class controlsBackground { - class HeaderBackground: ACE_gui_backgroundBase{ - idc = -1; - SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; - x = "1 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; - y = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; - w = "38 * (((safezoneW / safezoneH) min 1.2) / 40)"; - h = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - text = "#(argb,8,8,3)color(0,0,0,0)"; - }; - class CenterBackground: HeaderBackground { - y = "2.1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; - h = "16 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - text = "#(argb,8,8,3)color(0,0,0,0.8)"; - colorText[] = {0, 0, 0, "(profilenamespace getvariable ['GUI_BCG_RGB_A',0.9])"}; - colorBackground[] = {0,0,0,"(profilenamespace getvariable ['GUI_BCG_RGB_A',0.9])"}; - }; - class BottomBackground: CenterBackground { - y = "(18.6 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2))"; - h = "9 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - }; - }; - - class controls { - class HeaderName { - idc = 1; - type = CT_STATIC; - x = "1 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; - y = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; - w = "38 * (((safezoneW / safezoneH) min 1.2) / 40)"; - h = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - style = ST_LEFT + ST_SHADOW; - font = "PuristaMedium"; - SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; - colorText[] = {0.95, 0.95, 0.95, 0.75}; - colorBackground[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.69])","(profilenamespace getvariable ['GUI_BCG_RGB_G',0.75])","(profilenamespace getvariable ['GUI_BCG_RGB_B',0.5])", "(profilenamespace getvariable ['GUI_BCG_RGB_A',0.9])"}; - text = ""; - }; - - class IconsBackGroundBar: ACE_gui_backgroundBase{ - idc = -1; - SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; - x = "1 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; - y = "2.1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; - w = "38 * (((safezoneW / safezoneH) min 1.2) / 40)"; - h = "3.1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - text = QUOTE(PATHTOF(data\background_img.paa)); - colorText[] = {1, 1, 1, 0.0}; - }; - class CatagoryLeft: HeaderName { - x = "1 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; - y = "2.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; - w = "12.33 * (((safezoneW / safezoneH) min 1.2) / 40)"; - h = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - style = ST_CENTER; - colorText[] = {1, 1, 1.0, 0.9}; - colorBackground[] = {0,0,0,0}; - SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1.2)"; - text = $STR_ACE_UI_EXAMINE_TREATMENT; - }; - class CatagoryCenter: CatagoryLeft { - x = "13.33 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; - text = $STR_ACE_UI_STATUS; - }; - class CatagoryRight: CatagoryCenter{ - x = "25.66 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; - text = $STR_ACE_UI_OVERVIEW; - }; - class Line: ACE_gui_backgroundBase { - idc = -1; - SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; - x = "1.5 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; - y = "3.7 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; - w = "37 * (((safezoneW / safezoneH) min 1.2) / 40)"; - h = "0.03 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - text = "#(argb,8,8,3)color(1,1,1,0.5)"; - }; - - class iconImg1: ACE_gui_backgroundBase { - idc = 111; - x = "1.5 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; - y = "3.73 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; - w = "1.5 * (((safezoneW / safezoneH) min 1.2) / 40)"; - h = "1.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - size = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1.4)"; - SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.1)"; - colorBackground[] = {0,0,0,1}; - colorPicture[] = {1,1,1,1}; - colorText[] = {1,1,1,1}; - text = QUOTE(PATHTOF(data\icons\triage_card_small.paa)); - }; - class iconImg2: iconImg1 { - idc = 112; - x = "3 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; - text = QUOTE(PATHTOF(data\icons\examine_patient_small.paa)); - }; - class iconImg3: iconImg1 { - idc = 113; - x = "4.5 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; - text = QUOTE(PATHTOF(data\icons\bandage_fracture_small.paa)); - }; - class iconImg4: iconImg1 { - idc = 114; - x = "6 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; - text = QUOTE(PATHTOF(data\icons\medication_small.paa)); - }; - class iconImg5: iconImg1 { - idc = 115; - x = "7.5 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; - text = QUOTE(PATHTOF(data\icons\airway_management_small.paa)); - }; - class iconImg6: iconImg1 { - idc = 116; - x = "9 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; - text = QUOTE(PATHTOF(data\icons\advanced_treatment_small.paa)); - }; - class iconImg7: iconImg1 { - idc = 117; - x = "10.5 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; - text = QUOTE(PATHTOF(data\icons\icon_carry.paa)); - }; - class iconImg8: iconImg1 { - idc = 118; - x = "12 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; - text = QUOTE(PATHTOF(data\icons\toggle_self_small.paa)); - }; - - - class BtnIconLeft1: ACE_gui_buttonBase { - idc = 11; - x = "1.5 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; - y = "3.73 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; - w = "1.5 * (((safezoneW / safezoneH) min 1.2) / 40)"; - h = "1.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - size = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1.4)"; - SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.1)"; - animTextureNormal = "#(argb,8,8,3)color(0,0,0,0.0)"; - animTextureDisabled = "#(argb,8,8,3)color(0,0,0,0.0)"; - animTextureOver = "#(argb,8,8,3)color(0,0,0,0.0)"; - animTextureFocused = "#(argb,8,8,3)color(0,0,0,0.0)"; - animTexturePressed = "#(argb,8,8,3)color(0,0,0,0.0)"; - animTextureDefault = "#(argb,8,8,3)color(0,0,0,0.0)"; - action = QUOTE(['triage'] call FUNC(handleUI_DisplayOptions);); - }; - class BtnIconLeft2: BtnIconLeft1 { - idc = 12; - x = "3 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; - action = QUOTE(['examine'] call FUNC(handleUI_DisplayOptions);); - }; - class BtnIconLeft3: BtnIconLeft1 { - idc = 13; - x = "4.5 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; - action = QUOTE(['bandage'] call FUNC(handleUI_DisplayOptions);); - }; - class BtnIconLeft4: BtnIconLeft1 { - idc = 14; - x = "6 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; - action = QUOTE(['medication'] call FUNC(handleUI_DisplayOptions);); - }; - class BtnIconLeft5: BtnIconLeft1 { - idc = 15; - x = "7.5 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; - action = QUOTE(['airway'] call FUNC(handleUI_DisplayOptions);); - }; - class BtnIconLeft6: BtnIconLeft1 { - idc = 16; - x = "9 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; - action = QUOTE(['advanced'] call FUNC(handleUI_DisplayOptions);); - }; - class BtnIconLeft7: BtnIconLeft1 { - idc = 17; - x = "10.5 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; - action = QUOTE(['drag'] call FUNC(handleUI_DisplayOptions);); - }; - class BtnIconLeft8: BtnIconLeft1 { - idc = 18; - x = "12 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; - action = QUOTE(['toggle'] call FUNC(handleUI_DisplayOptions);); - }; - - class TriageCardList: ACE_gui_listBoxBase { - idc = 212; - x = "1.5 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; - y = "5.4 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; - w = "12 * (((safezoneW / safezoneH) min 1.2) / 40)"; - h = "10 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.7)"; - rowHeight = 0.03; - colorBackground[] = {0, 0, 0, 0.2}; - colorText[] = {1,1, 1, 1.0}; - colorScrollbar[] = {0.95, 0.95, 0.95, 1}; - colorSelect[] = {0.95, 0.95, 0.95, 1}; - colorSelect2[] = {0.95, 0.95, 0.95, 1}; - colorSelectBackground[] = {0, 0, 0, 0.0}; - colorSelectBackground2[] = {0.0, 0.0, 0.0, 0.0}; - }; - - // Left side - class BtnMenu1: BtnIconLeft1 { - idc = 20; - y = "5.4 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; - w = "12 * (((safezoneW / safezoneH) min 1.2) / 40)"; - h = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - text = ""; - size = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.9)"; - animTextureNormal = "#(argb,8,8,3)color(0,0,0,0.8)"; - animTextureDisabled = "#(argb,8,8,3)color(0,0,0,0.5)"; - animTextureOver = "#(argb,8,8,3)color(1,1,1,1)"; - animTextureFocused = "#(argb,8,8,3)color(1,1,1,1)"; - animTexturePressed = "#(argb,8,8,3)color(1,1,1,1)"; - animTextureDefault = "#(argb,8,8,3)color(1,1,1,1)"; - color[] = {1, 1, 1, 1}; - color2[] = {0,0,0, 1}; - colorBackgroundFocused[] = {1,1,1,1}; - colorBackground[] = {1,1,1,1}; - colorbackground2[] = {1,1,1,1}; - colorDisabled[] = {0.5,0.5,0.5,0.8}; - colorFocused[] = {0,0,0,1}; - periodFocus = 1; - periodOver = 1; - action = ""; - }; - class BtnMenu2: BtnMenu1 { - idc = 21; - y = "6.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; - text = ""; - }; - class BtnMenu3: BtnMenu1 { - idc = 22; - y = "7.6 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; - text = ""; - }; - class BtnMenu4: BtnMenu1 { - idc = 23; - y = "8.7 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; - text =""; - }; - class BtnMenu5: BtnMenu1 { - idc = 24; - y = "9.8 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; - text = ""; - }; - class BtnMenu6: BtnMenu1 { - idc = 25; - y = "10.9 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; - text = ""; - }; - class BtnMenu7: BtnMenu1 { - idc = 26; - y = "12 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; - text = ""; - }; - class BtnMenu8: BtnMenu1 { - idc = 27; - y = "13.1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; - text = ""; - }; - // center - - class bodyImgBackground: ACE_gui_backgroundBase { - idc = -1; - x = "13.33 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; - y = "3.73 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; - w = "12.33 * (((safezoneW / safezoneH) min 1.2) / 40)"; - h = "12.33 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1.4)"; - colorBackground[] = {1,1,1,1}; - colorPicture[] = {1,1,1,1}; - colorText[] = {1,1,1,1}; - text = QUOTE(PATHTOF(data\body_background.paa)); - }; - class bodyImgHead: bodyImgBackground { - idc = 50; - x = "13.33 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; - y = "3.73 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; - w = "12.33 * (((safezoneW / safezoneH) min 1.2) / 40)"; - h = "12.33 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1.4)"; - colorBackground[] = {1,1,1,1}; - colorPicture[] = {1,1,1,1}; - colorText[] = {1,1,1,1}; - text = QUOTE(PATHTOF(data\body_head.paa)); - }; - - class bodyImgTorso: bodyImgHead { - idc = 51; - text = QUOTE(PATHTOF(data\body_torso.paa)); - }; - class bodyImgArms_l: bodyImgHead { - idc = 52; - text = QUOTE(PATHTOF(data\body_arm_left.paa)); - }; - class bodyImgArms_r: bodyImgHead { - idc = 53; - text = QUOTE(PATHTOF(data\body_arm_right.paa)); - }; - class bodyImgLegs_l: bodyImgHead { - idc = 54; - text = QUOTE(PATHTOF(data\body_leg_left.paa)); - }; - class bodyImgLegs_r: bodyImgHead { - idc = 55; - text = QUOTE(PATHTOF(data\body_leg_right.paa)); - }; - - - class selectHead: ACE_gui_buttonBase { - idc = 301; - x = "18.8 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; - y = "3.9 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; - w = "1.4 * (((safezoneW / safezoneH) min 1.2) / 40)"; - h = "1.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - size = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1.4)"; - SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.1)"; - animTextureNormal = "#(argb,8,8,3)color(0,0,0,0.0)"; - animTextureDisabled = "#(argb,8,8,3)color(0,0,0,0.0)"; - animTextureOver = "#(argb,8,8,3)color(0,0,0,0.0)"; - animTextureFocused = "#(argb,8,8,3)color(0,0,0,0.0)"; - animTexturePressed = "#(argb,8,8,3)color(0,0,0,0.0)"; - animTextureDefault = "#(argb,8,8,3)color(0,0,0,0.0)"; - action = QUOTE(GVAR(selectedBodyPart) = 'head'; [GVAR(INTERACTION_TARGET)] call FUNC(updateUIInfo);); - }; - class selectTorso : selectHead { - idc = 302; - x = "18.4 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; - y = "5.4 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; - w = "2.2 * (((safezoneW / safezoneH) min 1.2) / 40)"; - h = "4.1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - action = QUOTE(GVAR(selectedBodyPart) = 'body'; [GVAR(INTERACTION_TARGET)] call FUNC(updateUIInfo);); - }; - class selectLeftArm: selectHead{ - idc = 303; - x = "17.4 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; - y = "5.9 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; - w = "1.1 * (((safezoneW / safezoneH) min 1.2) / 40)"; - h = "4.3 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - action = QUOTE(GVAR(selectedBodyPart) = 'hand_r'; [GVAR(INTERACTION_TARGET)] call FUNC(updateUIInfo);); - }; - class selectRightArm: selectLeftArm{ - idc = 304; - x = "20.6 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; - action = QUOTE(GVAR(selectedBodyPart) = 'hand_l'; [GVAR(INTERACTION_TARGET)] call FUNC(updateUIInfo);); - }; - class selectLeftLeg :selectHead { - idc = 305; - x = "18.5 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; - y = "9.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; - w = "1.1 * (((safezoneW / safezoneH) min 1.2) / 40)"; - h = "6 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - action = QUOTE(GVAR(selectedBodyPart) = 'leg_r'; [GVAR(INTERACTION_TARGET)] call FUNC(updateUIInfo);); - }; - class selectRightLeg :selectLeftLeg { - idc = 306; - x = "19.6 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; - action = QUOTE(GVAR(selectedBodyPart) = 'leg_l'; [GVAR(INTERACTION_TARGET)] call FUNC(updateUIInfo);); - }; - - - class TriageTextBottom: HeaderName { - idc = 2000; - x = "13.33 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; - y = "16.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; - w = "12.33 * (((safezoneW / safezoneH) min 1.2) / 40)"; - h = "1.1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - style = ST_CENTER; - colorText[] = {1, 1, 1.0, 1}; - colorBackground[] = {0,0.0,0.0,0.7}; - SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; - text = ""; - }; - - // Right side - class InjuryList: ACE_gui_listBoxBase { - idc = 213; - x = "25.66 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; - y = "5.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; - w = "12.33 * (((safezoneW / safezoneH) min 1.2) / 40)"; - h = "10 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.7)"; - rowHeight = 0.03; - colorBackground[] = {0, 0, 0, 0.2}; - colorText[] = {1,1, 1, 1.0}; - colorScrollbar[] = {0.95, 0.95, 0.95, 1}; - colorSelect[] = {0.95, 0.95, 0.95, 1}; - colorSelect2[] = {0.95, 0.95, 0.95, 1}; - colorSelectBackground[] = {0, 0, 0, 0.0}; - colorSelectBackground2[] = {0.0, 0.0, 0.0, 0.5}; - }; - // bottom - - class ActivityLogHeader: CatagoryLeft { - x = "1 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; - y = "18.6 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; - w = "18.5 * (((safezoneW / safezoneH) min 1.2) / 40)"; - h = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - style = ST_CENTER; - colorText[] = {0.6, 0.7, 1.0, 1}; - colorBackground[] = {0,0,0,0}; - SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; - text = $STR_ACE_UI_ACTIVITY_LOG; - }; - class QuickViewHeader: ActivityLogHeader { - x = "19.5 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; - text = $STR_ACE_UI_QUICK_VIEW; - }; - class LineBottomHeaders: Line { - y = "19.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; - }; - class ActivityLog: InjuryList { - idc = 214; - style = 16; - type = 102; - rows=1; - colorBackground[] = {0, 0, 0, 1}; - x = "1.5 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; - y = "(19.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2))"; - w = "18.5 * (((safezoneW / safezoneH) min 1.2) / 40)"; - h = "6.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.7)"; - colorSelectBackground[] = {0, 0, 0, 0.0}; - colorSelectBackground2[] = {0.0, 0.0, 0.0, 0.0}; - columns[] = {0.0, 0.08}; - canDrag=true; - arrowEmpty = "#(argb,8,8,3)color(1,1,1,1)"; - arrowFull = "#(argb,8,8,3)color(1,1,1,1)"; - drawSideArrows = 0; - idcLeft = -1; - idcRight = -1; - }; - - class QuikViewLog: InjuryList { - idc = 215; - style = 16; - type = 102; - rows=1; - colorBackground[] = {0, 0, 0, 1}; - x = "21.5 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; - y = "(19.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2))"; - w = "18.5 * (((safezoneW / safezoneH) min 1.2) / 40)"; - h = "6.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.7)"; - colorSelectBackground[] = {0, 0, 0, 0.0}; - colorSelectBackground2[] = {0.0, 0.0, 0.0, 0.0}; - - columns[] = {0.0, 0.08}; - canDrag=true; - arrowEmpty = "#(argb,8,8,3)color(1,1,1,1)"; - arrowFull = "#(argb,8,8,3)color(1,1,1,1)"; - drawSideArrows = 0; - idcLeft = -1; - idcRight = -1; - }; - - class selectTriageStatus: ACE_gui_buttonBase { - idc = 2001; - x = "13.33 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; - y = "16.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; - w = "12.33 * (((safezoneW / safezoneH) min 1.2) / 40)"; - h = "1.1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - style = ST_CENTER; - size = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1.4)"; - SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; - animTextureNormal = "#(argb,8,8,3)color(0,0,0,0.0)"; - animTextureDisabled = "#(argb,8,8,3)color(0,0,0,0.0)"; - animTextureOver = "#(argb,8,8,3)color(0,0,0,0.0)"; - animTextureFocused = "#(argb,8,8,3)color(0,0,0,0.0)"; - animTexturePressed = "#(argb,8,8,3)color(0,0,0,0.0)"; - animTextureDefault = "#(argb,8,8,3)color(0,0,0,0.0)"; - action = QUOTE([] call FUNC(handleUI_dropDownTriageCard);); - }; - class selectTriageStatusNone: selectTriageStatus { - idc = 2002; - x = 0; - y = 0; - w = 0; - h = 0; - text = $STR_ACE_UI_TRIAGE_NONE; - style = ST_CENTER; - size = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; - SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; - animTextureNormal = "#(argb,8,8,3)color(0,0,0,0.9)"; - animTextureDisabled = "#(argb,8,8,3)color(0,0,0,0.9)"; - animTextureOver = "#(argb,8,8,3)color(0,0,0,0.9)"; - animTextureFocused = "#(argb,8,8,3)color(0,0,0,0.9)"; - animTexturePressed = "#(argb,8,8,3)color(0,0,0,0.9)"; - animTextureDefault = "#(argb,8,8,3)color(0,0,0,0.9)"; - action = QUOTE([] call FUNC(handleUI_dropDownTriageCard); [ARR_2(GVAR(INTERACTION_TARGET),0)] call FUNC(setTriageStatus);); - }; - - class selectTriageStatusMinor: selectTriageStatus { - idc = 2003; - x = 0; - y = 0; - w = 0; - h = 0; - text = $STR_ACE_UI_TRIAGE_MINOR; - style = ST_CENTER; - size = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; - SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; - animTextureNormal = "#(argb,8,8,3)color(0,0.5,0,0.9)"; - animTextureDisabled = "#(argb,8,8,3)color(0,0.5,0,0.9)"; - animTextureOver = "#(argb,8,8,3)color(0,0.5,0,0.9)"; - animTextureFocused = "#(argb,8,8,3)color(0,0.5,0,0.9)"; - animTexturePressed = "#(argb,8,8,3)color(0,0.5,0,0.9)"; - animTextureDefault = "#(argb,8,8,3)color(0,0.5,0,0.9)"; - action = QUOTE([] call FUNC(handleUI_dropDownTriageCard); [ARR_2(GVAR(INTERACTION_TARGET),1)] call FUNC(setTriageStatus);); - }; - class selectTriageStatusDelayed: selectTriageStatus { - idc = 2004; - x = 0; - y = 0; - w = 0; - h = 0; - text = $STR_ACE_UI_TRIAGE_DELAYED; - style = ST_CENTER; - size = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; - SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; - animTextureNormal = "#(argb,8,8,3)color(0.77,0.51,0.08,0.9)"; - animTextureDisabled = "#(argb,8,8,3)color(0.77,0.51,0.08,0.9)"; - animTextureOver = "#(argb,8,8,3)color(0.77,0.51,0.08,0.9)"; - animTextureFocused = "#(argb,8,8,3)color(0.77,0.51,0.08,0.9)"; - animTexturePressed = "#(argb,8,8,3)color(0.77,0.51,0.08,0.9)"; - animTextureDefault = "#(argb,8,8,3)color(0.77,0.51,0.08,0.9)"; - action = QUOTE([] call FUNC(handleUI_dropDownTriageCard); [ARR_2(GVAR(INTERACTION_TARGET),2)] call FUNC(setTriageStatus);); - }; - class selectTriageStatusImmediate: selectTriageStatus { - idc = 2005; - x = 0; - y = 0; - w = 0; - h = 0; - text = $STR_ACE_UI_TRIAGE_IMMEDIATE; - style = ST_CENTER; - size = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; - SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; - animTextureNormal = "#(argb,8,8,3)color(1,0.2,0.2,0.9)"; - animTextureDisabled = "#(argb,8,8,3)color(1,0.2,0.2,0.9)"; - animTextureOver = "#(argb,8,8,3)color(1,0.2,0.2,0.9)"; - animTextureFocused = "#(argb,8,8,3)color(1,0.2,0.2,0.9)"; - animTexturePressed = "#(argb,8,8,3)color(1,0.2,0.2,0.9)"; - animTextureDefault = "#(argb,8,8,3)color(1,0.2,0.2,0.9)"; - action = QUOTE([] call FUNC(handleUI_dropDownTriageCard); [ARR_2(GVAR(INTERACTION_TARGET),3)] call FUNC(setTriageStatus);); - }; - class selectTriageStatusDeceased: selectTriageStatus { - idc = 2006; - x = 0; - y = 0; - w = 0; - h = 0; - text = $STR_ACE_UI_TRIAGE_DECEASED; - style = ST_CENTER; - size = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; - SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; - animTextureNormal = "#(argb,8,8,3)color(0,0,0,0.9)"; - animTextureDisabled = "#(argb,8,8,3)color(0,0,0,0.9)"; - animTextureOver = "#(argb,8,8,3)color(0,0,0,0.9)"; - animTextureFocused = "#(argb,8,8,3)color(0,0,0,0.9)"; - animTexturePressed = "#(argb,8,8,3)color(0,0,0,0.9)"; - animTextureDefault = "#(argb,8,8,3)color(0,0,0,0.9)"; - action = QUOTE([] call FUNC(handleUI_dropDownTriageCard); [ARR_2(GVAR(INTERACTION_TARGET),4)] call FUNC(setTriageStatus);); - }; - }; -}; \ No newline at end of file diff --git a/addons/medical/variable_defines.sqf b/addons/medical/variable_defines.sqf deleted file mode 100644 index 86ada8a01b..0000000000 --- a/addons/medical/variable_defines.sqf +++ /dev/null @@ -1,60 +0,0 @@ -// public variables -[QGVAR(openWounds),[[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0]],true, QUOTE(ADDON)] call EFUNC(common,defineVariable); -[QGVAR(bandagedWounds),[[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0]],true, QUOTE(ADDON)] call EFUNC(common,defineVariable); -[QGVAR(fractures),[[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0]],true, QUOTE(ADDON)] call EFUNC(common,defineVariable); -[QGVAR(airway), 0, true, QUOTE(ADDON)] call EFUNC(common,defineVariable); -[QGVAR(tourniquets),[0,0,0,0,0,0],true, QUOTE(ADDON)] call EFUNC(common,defineVariable); -[QGVAR(splints),[0,0,0,0,0,0],true, QUOTE(ADDON)] call EFUNC(common,defineVariable); -[QGVAR(isBleeding),false,true, QUOTE(ADDON)] call EFUNC(common,defineVariable); -[QGVAR(hasPain),false,true, QUOTE(ADDON)] call EFUNC(common,defineVariable); -[QGVAR(hasLostBlood),false,true, QUOTE(ADDON)] call EFUNC(common,defineVariable); -[QGVAR(airwayTreated),false,true, QUOTE(ADDON)] call EFUNC(common,defineVariable); - -// Airway -[QGVAR(airwayOccluded), false, true, QUOTE(ADDON)] call EFUNC(common,defineVariable); -[QGVAR(airwayRespiratoryArrest), false, true, QUOTE(ADDON)] call EFUNC(common,defineVariable); -[QGVAR(airwayCollapsed), false, true, QUOTE(ADDON)] call EFUNC(common,defineVariable); -[QGVAR(airwayStatus), 100, false, QUOTE(ADDON)] call EFUNC(common,defineVariable); - -// logs -[QGVAR(quickViewLog),[],true, QUOTE(ADDON)] call EFUNC(common,defineVariable); -[QGVAR(activityLog),[],true, QUOTE(ADDON)] call EFUNC(common,defineVariable); -[QGVAR(triageLevel),0,true, QUOTE(ADDON)] call EFUNC(common,defineVariable); -[QGVAR(triageCard),[],true, QUOTE(ADDON)] call EFUNC(common,defineVariable); - -[QGVAR(medicClass),0,true, QUOTE(ADDON),0,true] call EFUNC(common,defineVariable); // should be a persistent variable; must not be removed by a reset all defaults call -[QGVAR(isMedicalFacility),0,true, QUOTE(ADDON),0,true] call EFUNC(common,defineVariable); // should be a persistent variable; must not be removed by a reset all defaults call - -[QGVAR(noInstantDeath),false,true, QUOTE(ADDON)] call EFUNC(common,defineVariable); -[QGVAR(inCardiacArrest),false,true, QUOTE(ADDON)] call EFUNC(common,defineVariable); - -// private variables -[QGVAR(bloodVolume),100,false, QUOTE(ADDON)] call EFUNC(common,defineVariable); -[QGVAR(bloodIVVolume),0,false, QUOTE(ADDON)] call EFUNC(common,defineVariable); -[QGVAR(plasmaIVVolume),0,false, QUOTE(ADDON)] call EFUNC(common,defineVariable); -[QGVAR(salineIVVolume),0,false, QUOTE(ADDON)] call EFUNC(common,defineVariable); - -[QGVAR(amountOfPain),0,false, QUOTE(ADDON)] call EFUNC(common,defineVariable); -[QGVAR(heartRate),80,false, QUOTE(ADDON)] call EFUNC(common,defineVariable); -[QGVAR(andrenaline),0,false, QUOTE(ADDON)] call EFUNC(common,defineVariable); -[QGVAR(heartRateAdjustments),[],false, QUOTE(ADDON)] call EFUNC(common,defineVariable); - -[QGVAR(bloodPressure), [80,120],false, QUOTE(ADDON)] call EFUNC(common,defineVariable); -[QGVAR(peripheralResistance), 100,false, QUOTE(ADDON)] call EFUNC(common,defineVariable); -[QGVAR(cardiacOutput), 5.25,false, QUOTE(ADDON)] call EFUNC(common,defineVariable); // Source for default: http://en.wikipedia.org/wiki/Cardiac_output#Example_values - -[QGVAR(givenMorphine),0,false, QUOTE(ADDON)] call EFUNC(common,defineVariable); -[QGVAR(givenAtropine),0,false, QUOTE(ADDON)] call EFUNC(common,defineVariable); -[QGVAR(givenEpinephrine),0,false, QUOTE(ADDON)] call EFUNC(common,defineVariable); - -[QGVAR(bodyPartStatus),[0,0,0,0,0,0],false, QUOTE(ADDON)] call EFUNC(common,defineVariable); -[QGVAR(bodyPartStatusPrevious),[0,0,0,0,0,0],false, QUOTE(ADDON)] call EFUNC(common,defineVariable); - -[QGVAR(addedToUnitLoop),false,false, QUOTE(ADDON)] call EFUNC(common,defineVariable); -["ACE_reviveCounterValue", 0, false, QGVAR(ADDON)] call FUNC(defineVariable); -["ACE_inReviveState", false, true, QGVAR(ADDON)] call FUNC(defineVariable); -["ACE_isDead",false,true,QUOTE(ADDON)] call FUNC(defineVariable); -["ACE_isUnconscious",false,true,QUOTE(ADDON)] call FUNC(defineVariable); -["ACE_isDeadPlayer", false, true, QUOTE(ADDON)] call FUNC(defineVariable); - -GVAR(VarDefinesCompleted) = true; diff --git a/addons/missionmodules/$PBOPREFIX$ b/addons/missionmodules/$PBOPREFIX$ new file mode 100644 index 0000000000..6e7c7ebfc1 --- /dev/null +++ b/addons/missionmodules/$PBOPREFIX$ @@ -0,0 +1 @@ +z\ace\addons\missionmodules \ No newline at end of file diff --git a/addons/missionmodules/CfgEventHandlers.hpp b/addons/missionmodules/CfgEventHandlers.hpp new file mode 100644 index 0000000000..f0a9f14d91 --- /dev/null +++ b/addons/missionmodules/CfgEventHandlers.hpp @@ -0,0 +1,6 @@ + +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preInit)); + }; +}; diff --git a/addons/missionmodules/CfgFactionClasses.hpp b/addons/missionmodules/CfgFactionClasses.hpp new file mode 100644 index 0000000000..792f4d31e3 --- /dev/null +++ b/addons/missionmodules/CfgFactionClasses.hpp @@ -0,0 +1,6 @@ +class CfgFactionClasses { + class NO_CATEGORY; + class ACE_missionModules: NO_CATEGORY { + displayName = "ACE Mission Modules"; + }; +}; \ No newline at end of file diff --git a/addons/missionmodules/CfgVehicles.hpp b/addons/missionmodules/CfgVehicles.hpp new file mode 100644 index 0000000000..92c379efb2 --- /dev/null +++ b/addons/missionmodules/CfgVehicles.hpp @@ -0,0 +1,68 @@ +class CfgVehicles { + class Logic; + class Module_F: Logic { + class ArgumentsBaseUnits { + }; + }; + + // TODO make a curator variant for this + class ACE_moduleAmbianceSound: Module_F { + scope = 2; + displayName = "Ambiance Sounds [ACE]"; + icon = QUOTE(PATHTOF(data\moduleSound.paa)); + category = "ACE_missionModules"; + function = QUOTE(FUNC(moduleAmbianceSound)); + functionPriority = 1; + isGlobal = 1; + isTriggerActivated = 0; + author = "Glowbal"; + class Arguments { + class soundFiles { + displayName = "Sounds"; + description = "Classnames of the ambiance sounds played. Seperated by ','. "; + typeName = "STRING"; + defaultValue = ""; + }; + class minimalDistance { + displayName = "Minimal Distance"; + description = "Minimal Distance"; + typeName = "NUMBER"; + defaultValue = 400; + }; + class maximalDistance { + displayName = "Maximal Distance"; + description = "Maximal Distance"; + typeName = "NUMBER"; + defaultValue = 900; + }; + class minimalDelay { + displayName = "Minimal Delay"; + description = "Minimal Delay between sounds played"; + typeName = "NUMBER"; + defaultValue = 10; + }; + class maximalDelay { + displayName = "Maximal Delay"; + description = "Maximal Delay between sounds played"; + typeName = "NUMBER"; + defaultValue = 170; + }; + class followPlayers { + displayName = "Follow Players"; + description = "Follow players. If set to false, loop will play sounds only nearby logic position."; + typeName = "BOOL"; + defaultValue = 0; + }; + class soundVolume { + displayName = "Volume"; + description = "The volume of the sounds played"; + typeName = "NUMBER"; + defaultValue = 1; + }; + }; + class ModuleDescription { + description = "Ambiance sounds loop (synced across MP)"; + sync[] = {}; + }; + }; +}; diff --git a/addons/missionmodules/XEH_preInit.sqf b/addons/missionmodules/XEH_preInit.sqf new file mode 100644 index 0000000000..cadbbabdd1 --- /dev/null +++ b/addons/missionmodules/XEH_preInit.sqf @@ -0,0 +1,7 @@ +#include "script_component.hpp" + +ADDON = false; + +PREP(moduleAmbianceSound); + +ADDON = true; diff --git a/addons/missionmodules/config.cpp b/addons/missionmodules/config.cpp new file mode 100644 index 0000000000..0867b486c6 --- /dev/null +++ b/addons/missionmodules/config.cpp @@ -0,0 +1,17 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + units[] = {"cse_moduleAmbianceSound"}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"ace_common"}; + author[] = {"Glowbal"}; + authorUrl = ""; + VERSION_CONFIG; + }; +}; + +#include "CfgEventHandlers.hpp" +#include "CfgFactionClasses.hpp" +#include "CfgVehicles.hpp" diff --git a/addons/missionmodules/data/moduleSound.paa b/addons/missionmodules/data/moduleSound.paa new file mode 100644 index 0000000000..bfe3b80327 Binary files /dev/null and b/addons/missionmodules/data/moduleSound.paa differ diff --git a/addons/missionmodules/functions/fnc_moduleAmbianceSound.sqf b/addons/missionmodules/functions/fnc_moduleAmbianceSound.sqf new file mode 100644 index 0000000000..943d795b7a --- /dev/null +++ b/addons/missionmodules/functions/fnc_moduleAmbianceSound.sqf @@ -0,0 +1,123 @@ +/* + * Author: Glowbal + * Plays synchronized ambiance sounds while the module is alive. + * + * Arguments: + * 0: Logic + * 1: Units + * 2: Activated + * + * Return Value: + * Nothing + * + * Example: + * N/A + * + * Public: No + */ + +#include "script_component.hpp" + +private ["_logic", "_units", "_activated","_ambianceSounds", "_soundFiles", "_minimalDistance","_maximalDistance", "_minimalDistance", "_maxDelayBetweenSounds", "_allUnits", "_newPos", "_targetUnit", "_soundToPlay", "_soundPath", "_unparsedSounds", "_list", "_splittedList", "_nilCheckPassedList"]; +_logic = [_this,0,objNull,[objNull]] call BIS_fnc_param; +_units = [_this,1,[],[[]]] call BIS_fnc_param; +_activated = [_this,2,true,[true]] call BIS_fnc_param; + +// We only play this on the locality of the logic, since the sounds are broadcasted across the network +if (_activated && local _logic) then { + _ambianceSounds = []; + _unparsedSounds = _logic getvariable ["soundFiles", ""]; + _minimalDistance = (_logic getvariable ["minimalDistance", 400]) max 1; + _maximalDistance = (_logic getvariable ["maximalDistance", 10]) max _minimalDistance; + _minDelayBetweensounds = (_logic getvariable ["minimalDelay", 10]) max 1; + _maxDelayBetweenSounds = (_logic getvariable ["maximalDelay", 170]) max _minDelayBetweensounds; + _volume = (_logic getvariable ["soundVolume", 30]) max 1; + _followPlayers = _logic getvariable ["followPlayers", false]; + + _splittedList = [_unparsedSounds, ","] call BIS_fnc_splitString; + + _nilCheckPassedList = ""; + { + _x = [_x] call EFUNC(common,string_removeWhiteSpace); + _splittedList set [_foreachIndex, _x]; + }foreach _splittedList; + + _soundPath = [(str missionConfigFile), 0, -15] call BIS_fnc_trimString; + { + if (isclass (missionConfigFile >> "CfgSounds" >> _x)) then { + _ambianceSounds pushback (_soundPath + (getArray(missionConfigFile >> "CfgSounds" >> _x >> "sound") select 0)); + } else { + if (isclass (configFile >> "CfgSounds" >> _x)) then { + _ambianceSounds pushback ((getArray(configFile >> "CfgSounds" >> _x >> "sound") select 0)); + }; + }; + }foreach _splittedList; + + if (count _ambianceSounds == 0) exitwith {}; + { + if !([".", _x, true] call BIS_fnc_inString) then { + _ambianceSounds set [_foreachIndex, _x + ".wss"]; + }; + }foreach _ambianceSounds; + + [{ + private ["_args", "_logic", "_ambianceSounds", "_minimalDistance", "_maximalDistance", "_minDelayBetweensounds", "_maxDelayBetweenSounds", "_volume", "_followPlayers","_lastTimePlayed", "_newPos"]; + _args = _this select 0; + _logic = _args select 0; + _minDelayBetweensounds = _args select 4; + _maxDelayBetweenSounds = _args select 5; + _lastTimePlayed = _args select 8; + + if (!alive _logic) exitwith { + [(_this select 1)] call cba_fnc_removePerFrameHandler; + }; + + if (time - _lastTimePlayed >= ((_minDelayBetweensounds + random(_maxDelayBetweenSounds)) min _maxDelayBetweenSounds)) then { + _ambianceSounds = _args select 1; + _minimalDistance = _args select 2; + _maximalDistance = _args select 3; + + _volume = _args select 6; + _followPlayers = _args select 7; + + // Find all players in session. + _allUnits = if (isMultiplayer) then {playableUnits} else {[ACE_player]}; + + // Check if there are enough players to even start playing this sound. + if (count _allUnits > 0) then { + + // Select a target unit at random. + _targetUnit = _allUnits select (round(random((count _allUnits)-1))); + + // find the position from which we are going to play this sound from. + _newPos = (getPos _targetUnit); + if (!_followPlayers) then { + _newPos = getPos _logic; + }; + + // Randomize this position. + if (random(1) >= 0.5) then { + if (random(1) >= 0.5) then { + _newPos set [0, (_newPos select 0) + (_minimalDistance + random(_maximalDistance))]; + } else { + _newPos set [0, (_newPos select 0) - (_minimalDistance + random(_maximalDistance))]; + }; + } else { + if (random(1) >= 0.5) then { + _newPos set [1, (_newPos select 1) + (_minimalDistance + random(_maximalDistance))]; + } else { + _newPos set [1, (_newPos select 1) - (_minimalDistance + random(_maximalDistance))]; + }; + }; + + // If no unit is to close to this position, we will play the sound. + if ({(_newPos distance _x < (_minimalDistance / 2))}count _allUnits == 0) then { + playSound3D [_ambianceSounds select (round(random((count _ambianceSounds)-1))), ObjNull, false, _newPos, _volume, 1, 1000]; + _args set [8, time]; + }; + }; + }; + }, 0.1, [_logic, _ambianceSounds, _minimalDistance, _maximalDistance, _minDelayBetweensounds, _maxDelayBetweenSounds, _volume, _followPlayers, time] ] call cba_fnc_addPerFrameHandler; +}; + +true; diff --git a/addons/missionmodules/functions/script_component.hpp b/addons/missionmodules/functions/script_component.hpp new file mode 100644 index 0000000000..42d34d4801 --- /dev/null +++ b/addons/missionmodules/functions/script_component.hpp @@ -0,0 +1 @@ +#include "\z\ace\addons\missionmodules\script_component.hpp" \ No newline at end of file diff --git a/addons/missionmodules/script_component.hpp b/addons/missionmodules/script_component.hpp new file mode 100644 index 0000000000..a567966c7b --- /dev/null +++ b/addons/missionmodules/script_component.hpp @@ -0,0 +1,12 @@ +#define COMPONENT missionModules +#include "\z\ace\addons\main\script_mod.hpp" + +#ifdef DEBUG_ENABLED_MISSIONMODULES + #define DEBUG_MODE_FULL +#endif + +#ifdef DEBUG_SETTINGS_MISSIONMODULES + #define DEBUG_SETTINGS DEBUG_SETTINGS_MISSIONMODULES +#endif + +#include "\z\ace\addons\main\script_macros.hpp" \ No newline at end of file diff --git a/addons/movement/functions/fnc_canClimb.sqf b/addons/movement/functions/fnc_canClimb.sqf index bd62bfb768..27753d8a12 100644 --- a/addons/movement/functions/fnc_canClimb.sqf +++ b/addons/movement/functions/fnc_canClimb.sqf @@ -1,4 +1,18 @@ -// by commy2 +/* + * Author: commy2 + * Tests the the player can climb. + * + * Arguments: + * 0: The Unit (usually the player) + * + * Return Value: + * The return value + * + * Example: + * _bool = [player] call ace_movement_fnc_canClimb + * + * Public: No + */ #include "script_component.hpp" private ["_unit", "_pos", "_dir"]; @@ -20,6 +34,6 @@ _checkPos1end = _checkPos1beg vectorAdd _dir; /* drawLine3D [ASLToATL _checkPos0beg, ASLToATL _checkPos0end, [1,0,0,1]]; drawLine3D [ASLToATL _checkPos1beg, ASLToATL _checkPos1end, [1,0,0,1]]; -*/ + */ lineIntersects [_checkPos0beg, _checkPos0end] && {!(lineIntersects [_checkPos1beg, _checkPos1end])} diff --git a/addons/movement/functions/fnc_climb.sqf b/addons/movement/functions/fnc_climb.sqf index 3f09b82a15..aff27ffe9d 100644 --- a/addons/movement/functions/fnc_climb.sqf +++ b/addons/movement/functions/fnc_climb.sqf @@ -1,4 +1,18 @@ -// by commy2 +/* + * Author: commy2 + * Make the player climb over short walls. + * + * Arguments: + * 0: The Unit (usually the player) + * + * Return Value: + * Nothing + * + * Example: + * [player] call ace_movement_fnc_climb + * + * Public: No + */ #include "script_component.hpp" private "_unit"; @@ -6,15 +20,15 @@ private "_unit"; _unit = _this select 0; if !([_unit] call FUNC(canClimb)) exitWith { - [localize "STR_ACE_Movement_CanNotClimb"] call EFUNC(common,displayTextStructured); + [localize "STR_ACE_Movement_CanNotClimb"] call EFUNC(common,displayTextStructured); }; if !(_unit getVariable [QGVAR(isClimbInit), false]) then { - _unit addEventHandler ["AnimDone", { - if (local (_this select 0) && {_this select 1 == "ACE_Climb"}) then {_this call FUNC(handleClimb)}; - }]; + _unit addEventHandler ["AnimDone", { + if (local (_this select 0) && {_this select 1 == "ACE_Climb"}) then {_this call FUNC(handleClimb)}; + }]; - _unit setVariable [QGVAR(isClimbInit), true]; + _unit setVariable [QGVAR(isClimbInit), true]; }; [_unit] call EFUNC(common,fixLoweredRifleAnimation); diff --git a/addons/movement/functions/fnc_getWeight.sqf b/addons/movement/functions/fnc_getWeight.sqf index 254b706d56..955be1a215 100644 --- a/addons/movement/functions/fnc_getWeight.sqf +++ b/addons/movement/functions/fnc_getWeight.sqf @@ -1,4 +1,18 @@ -// by commy2 +/* + * Author: commy2 + * Returns the weight (from the loadAbs command) in lbs/kg (based on user option) + * + * Arguments: + * 0: The Unit (usually the player) + * + * Return Value: + * The return value + * + * Example: + * _bool = [player] call ace_movement_fnc_getWeight + * + * Public: No + */ #include "script_component.hpp" private ["_unit", "_weight"]; diff --git a/addons/movement/functions/fnc_handleClimb.sqf b/addons/movement/functions/fnc_handleClimb.sqf index a96beccc2c..da0f8e0224 100644 --- a/addons/movement/functions/fnc_handleClimb.sqf +++ b/addons/movement/functions/fnc_handleClimb.sqf @@ -1,4 +1,19 @@ -// by commy2 +/* + * Author: commy2 + * Handles the climb animation finishing. Called from "AnimDone" event handler. + * + * Arguments: + * 0: The Unit (usually the player) + * 1: The finisehd animation + * + * Return Value: + * Nothing + * + * Example: + * [player, "ACE_climb"] call ace_movement_fnc_handleClimb + * + * Public: No + */ #include "script_component.hpp" private ["_unit", "_anim", "_pos"]; diff --git a/addons/nametags/CfgVehicles.hpp b/addons/nametags/CfgVehicles.hpp index e3c4227834..d61c761bfc 100644 --- a/addons/nametags/CfgVehicles.hpp +++ b/addons/nametags/CfgVehicles.hpp @@ -55,6 +55,15 @@ class CfgVehicles { }; }; }; + class showCursorTagForVehicles { + displayName = "Show for Vehicles"; + description = "Show cursor NameTag for vehicle commander (only if client has name tags enabled)Default: No"; + typeName = "BOOL"; + class values { + class Yes {name = "Yes"; value = 1;}; + class No {default = 1; name = "No"; value = 0;}; + }; + }; }; }; }; diff --git a/addons/nametags/UI/soundwave0.paa b/addons/nametags/UI/soundwave0.paa new file mode 100644 index 0000000000..27f34b38ab Binary files /dev/null and b/addons/nametags/UI/soundwave0.paa differ diff --git a/addons/nametags/UI/soundwave1.paa b/addons/nametags/UI/soundwave1.paa new file mode 100644 index 0000000000..ce4f85eb69 Binary files /dev/null and b/addons/nametags/UI/soundwave1.paa differ diff --git a/addons/nametags/UI/soundwave2.paa b/addons/nametags/UI/soundwave2.paa new file mode 100644 index 0000000000..0bc59cde24 Binary files /dev/null and b/addons/nametags/UI/soundwave2.paa differ diff --git a/addons/nametags/UI/soundwave3.paa b/addons/nametags/UI/soundwave3.paa new file mode 100644 index 0000000000..39f3e8e95b Binary files /dev/null and b/addons/nametags/UI/soundwave3.paa differ diff --git a/addons/nametags/UI/soundwave4.paa b/addons/nametags/UI/soundwave4.paa new file mode 100644 index 0000000000..7ab8b6d944 Binary files /dev/null and b/addons/nametags/UI/soundwave4.paa differ diff --git a/addons/nametags/UI/soundwave5.paa b/addons/nametags/UI/soundwave5.paa new file mode 100644 index 0000000000..f3e98d47aa Binary files /dev/null and b/addons/nametags/UI/soundwave5.paa differ diff --git a/addons/nametags/UI/soundwave6.paa b/addons/nametags/UI/soundwave6.paa new file mode 100644 index 0000000000..3f29976c9f Binary files /dev/null and b/addons/nametags/UI/soundwave6.paa differ diff --git a/addons/nametags/UI/soundwave7.paa b/addons/nametags/UI/soundwave7.paa new file mode 100644 index 0000000000..e705c70b42 Binary files /dev/null and b/addons/nametags/UI/soundwave7.paa differ diff --git a/addons/nametags/UI/soundwave8.paa b/addons/nametags/UI/soundwave8.paa new file mode 100644 index 0000000000..e6027d878a Binary files /dev/null and b/addons/nametags/UI/soundwave8.paa differ diff --git a/addons/nametags/UI/soundwave9.paa b/addons/nametags/UI/soundwave9.paa new file mode 100644 index 0000000000..91ddfd02df Binary files /dev/null and b/addons/nametags/UI/soundwave9.paa differ diff --git a/addons/nametags/XEH_postInit.sqf b/addons/nametags/XEH_postInit.sqf index c73ec08cfe..1ad0e38879 100644 --- a/addons/nametags/XEH_postInit.sqf +++ b/addons/nametags/XEH_postInit.sqf @@ -1,6 +1,8 @@ // by commy2 and CAA-Picard #include "script_component.hpp" +[] call FUNC(initIsSpeaking); + if (!hasInterface) exitWith {}; @@ -25,57 +27,4 @@ if (!hasInterface) exitWith {}; // Draw handle -addMissionEventHandler ["Draw3D", { - if (GVAR(showPlayerNames) == 0) exitWith {}; - - _player = ACE_player; - if (GVAR(showPlayerNames) in [2,4]) then { //only on cursor - _target = cursorTarget; - _target = if (_target in allUnitsUAV) then {objNull} else {effectiveCommander _target}; - - if (!isNull _target && {side group _target == playerSide} && {_target != _player} && {isPlayer _target || {GVAR(ShowNamesForAI)}} && {!(_target getVariable ["ACE_hideName", false])}) then { - _distance = _player distance _target; - _alpha = ((1 - 0.2 * (_distance - GVAR(PlayerNamesViewDistance))) min 1) * GVAR(PlayerNamesMaxAlpha); - if ((GVAR(showPlayerNames) in [3,4])) then { //only on keypress - _alpha = _alpha min (1 - (time - GVAR(ShowNamesTime) - 1)); - }; - [_player, _target, _alpha, _distance * 0.026] call FUNC(drawNameTagIcon); - }; - } else { - _pos = positionCameraToWorld [0, 0, 0]; - _targets = _pos nearObjects ["Man", GVAR(PlayerNamesViewDistance) + 5]; - - if (!surfaceIsWater _pos) then { - _pos = ATLtoASL _pos; - }; - _pos2 = positionCameraToWorld [0, 0, 1]; - if (!surfaceIsWater _pos2) then { - _pos2 = ATLtoASL _pos2; - }; - _vecy = _pos2 vectorDiff _pos; - - { - _target = if (_x in allUnitsUAV) then {objNull} else {effectiveCommander _x}; - - if (!isNull _target && {side group _target == playerSide} && {_target != _player} && {isPlayer _target || {GVAR(ShowNamesForAI)}} && {!(_target getVariable ["ACE_hideName", false])}) then { - _relPos = (visiblePositionASL _target) vectorDiff _pos; - _distance = vectorMagnitude _relPos; - _projDist = _relPos vectorDistance (_vecy vectorMultiply (_relPos vectorDotProduct _vecy)); - - _alpha = ((1 - 0.2 * (_distance - GVAR(PlayerNamesViewDistance))) min (1 - 0.15 * (_projDist * 5 - _distance - 3)) min 1) * GVAR(PlayerNamesMaxAlpha); - - if ((GVAR(showPlayerNames) in [3,4])) then { //only on keypress - _alpha = _alpha min (1 - (time - GVAR(ShowNamesTime) - 1)); - }; - - // Check if there is line of sight - if (_alpha > 0) then { - if (lineIntersects [_pos, (visiblePositionASL _target) vectorAdd [0,0,1], vehicle _player, _target]) then { - _alpha = 0; - }; - }; - [_player, _target, _alpha, _distance * 0.026] call FUNC(drawNameTagIcon); - }; - } forEach _targets; - }; -}]; +addMissionEventHandler ["Draw3D", {_this call FUNC(onDraw3d);}]; diff --git a/addons/nametags/XEH_preInit.sqf b/addons/nametags/XEH_preInit.sqf index 79258c5cec..80c06cff1f 100644 --- a/addons/nametags/XEH_preInit.sqf +++ b/addons/nametags/XEH_preInit.sqf @@ -6,7 +6,9 @@ PREP(canShow); PREP(doShow); PREP(drawNameTagIcon); PREP(getVehicleData); +PREP(initIsSpeaking); PREP(moduleNameTags); +PREP(onDraw3d); PREP(onMouseZChanged); PREP(setText); diff --git a/addons/nametags/config.cpp b/addons/nametags/config.cpp index aa55dd2aad..25992c0174 100644 --- a/addons/nametags/config.cpp +++ b/addons/nametags/config.cpp @@ -16,6 +16,12 @@ class CfgPatches { #include "CfgVehicles.hpp" class ACE_Settings { + class GVAR(defaultNametagColor) { + value[] = {0.77, 0.51, 0.08, 1}; + typeName = "COLOR"; + isClientSetable = 1; + displayName = "$STR_ACE_NameTags_DefaultNametagColor"; + }; class GVAR(showPlayerNames) { value = 1; typeName = "SCALAR"; @@ -40,8 +46,19 @@ class ACE_Settings { typeName = "BOOL"; isClientSetable = 1; displayName = "$STR_ACE_NameTags_ShowNamesForAI"; + }; + class GVAR(showCursorTagForVehicles) { + value = 0; + typeName = "BOOL"; + isClientSetable = 0; + }; + class GVAR(showSoundWaves) { + value = 1; + typeName = "SCALAR"; + isClientSetable = 1; + displayName = "$STR_ACE_NameTags_ShowSoundWaves"; + values[] = {"Disabled", "Use Nametag settings", "Always Show All"}; }; - class GVAR(PlayerNamesViewDistance) { value = 5; typeName = "SCALAR"; diff --git a/addons/nametags/functions/fnc_drawNameTagIcon.sqf b/addons/nametags/functions/fnc_drawNameTagIcon.sqf index af3932f118..8ccbfc9b4a 100644 --- a/addons/nametags/functions/fnc_drawNameTagIcon.sqf +++ b/addons/nametags/functions/fnc_drawNameTagIcon.sqf @@ -4,16 +4,18 @@ * Draw the nametag and rank icon. * * Argument: - * 0: Unit (Array) - * 1: alpha (Number) - * 2: Height offset (Number) + * 0: Unit (Player) + * 1: Target + * 2: alpha (Number) + * 4: Height offset (Number) + * 5: Draw Type * * Return value: * None. */ #include "script_component.hpp" - + #define TEXTURES_RANKS [ \ "", \ "\A3\Ui_f\data\GUI\Cfg\Ranks\private_gs.paa", \ @@ -23,41 +25,58 @@ "\A3\Ui_f\data\GUI\Cfg\Ranks\captain_gs.paa", \ "\A3\Ui_f\data\GUI\Cfg\Ranks\major_gs.paa", \ "\A3\Ui_f\data\GUI\Cfg\Ranks\colonel_gs.paa" \ -] + ] -private ["_player", "_target", "_alpha", "_heightOffset", "_height", "_position", "_color", "_name", "_rank", "_size"]; +private ["_height", "_position", "_color", "_name", "_rank", "_size"]; -_player = _this select 0; -_target = _this select 1; -_alpha = _this select 2; -_heightOffset = _this select 3; +PARAMS_5(_player,_target,_alpha,_heightOffset,_iconType); -_height = [2, 1.5, 1, 1.5, 1] select (["STAND", "CROUCH", "PRONE", "UNDEFINED", ""] find stance _target); +if (_alpha < 0) exitWith {}; //Don't waste time if not visable +if (_iconType == ICON_NONE) exitWith {}; //Don't waste time if not visable -_position = visiblePositionASL _target; -// Convert position to ASLW (expected by drawIcon3D) and add height offsets -_position set [2, ((_target modelToWorld [0,0,0]) select 2) + _height + _heightOffset]; -_color = if !(group _target == group _player) then { - [0.77, 0.51, 0.08, _alpha] +//Set Text: +_name = if (_iconType in [ICON_NAME, ICON_NAME_RANK, ICON_NAME_SPEAK]) then { + [_target, true] call EFUNC(common,getName) } else { - [[1, 1, 1, _alpha], [1, 0, 0, _alpha], [0, 1, 0, _alpha], [0, 0, 1, _alpha], [1, 1, 0, _alpha]] select (["MAIN", "RED", "GREEN", "BLUE", "YELLOW"] find (if (_target == _player) then {0} else {assignedTeam _target})) max 0 + "" }; -_name = [_target, true] call EFUNC(common,getName); +//Set Icon: +_icon = ""; +_size = 0; +if ((_iconType == ICON_NAME_SPEAK) || (_iconType == ICON_SPEAK)) then { + _icon = QUOTE(PATHTOF(UI\soundwave)) + str (floor (random 10)) + ".paa"; + _size = 0.75; + _alpha = _alpha + 0.6;//Boost alpha when speaking +} else { + if (_iconType == ICON_NAME_RANK) then { + _icon = TEXTURES_RANKS select ((["PRIVATE", "CORPORAL", "SERGEANT", "LIEUTENANT", "CAPTAIN", "MAJOR", "COLONEL"] find (rank _target)) + 1); + _size = 0.75; + }; +}; -_rank = TEXTURES_RANKS select ((["PRIVATE", "CORPORAL", "SERGEANT", "LIEUTENANT", "CAPTAIN", "MAJOR", "COLONEL"] find rank _target) + 1); -_size = [0, 1] select GVAR(showPlayerRanks); +//Set Color: +if !(group _target == group _player) then { + _color = +GVAR(defaultNametagColor); //Make a copy, then multiply both alpha values (allows client to decrease alpha in settings) + _color set [3, (_color select 3) * _alpha]; +} else { + _color = [[1, 1, 1, _alpha], [1, 0, 0, _alpha], [0, 1, 0, _alpha], [0, 0, 1, _alpha], [1, 1, 0, _alpha]] select (["MAIN", "RED", "GREEN", "BLUE", "YELLOW"] find (if (_target == _player) then {0} else {assignedTeam _target})) max 0 +}; + +_height = [2, 1.5, 1, 1.5, 1] select (["STAND", "CROUCH", "PRONE", "UNDEFINED", ""] find (stance _target)); +// Convert position to ASLW (expected by drawIcon3D) and add height offsets +_position = _target modelToWorldVisual [0, 0, (_height + _heightOffset)]; drawIcon3D [ - _rank, - _color, - _position, - _size, - _size, - 0, - _name, - 2, - 0.033, - "PuristaMedium" +_icon, +_color, +_position, +_size, +_size, +0, +_name, +2, +0.033, +"PuristaMedium" ]; diff --git a/addons/nametags/functions/fnc_initIsSpeaking.sqf b/addons/nametags/functions/fnc_initIsSpeaking.sqf new file mode 100644 index 0000000000..b7dc920fa2 --- /dev/null +++ b/addons/nametags/functions/fnc_initIsSpeaking.sqf @@ -0,0 +1,76 @@ +/* + * Author: Glowbal, PabstMirror + * Starts up a PFEH to monitor the when players are talking. + * Compatiblity with TFR/ACRE and Arma's VON + * + * Arguments: + * NONE + * + * Return Value: + * NONE + * + * Example: + * [] call ACE_nametags_fnc_initIsSpeaking + * + * Public: No + */ +#include "script_component.hpp" + +if (isServer) then { + //If someone disconnects while speaking, reset their variable + addMissionEventHandler ["HandleDisconnect", { + PARAMS_1(_disconnectedPlayer); + if (_disconnectedPlayer getVariable [QGVAR(isSpeaking), false]) then { + _disconnectedPlayer setVariable [QGVAR(isSpeaking), false, true]; + }; + }]; +}; + +if (!hasInterface) exitWith {}; + +["playerChanged", { + //When player changes, make sure to reset old unit's variable + PARAMS_2(_newUnit,_oldUnit); + if (_oldUnit getVariable [QGVAR(isSpeaking), false]) then { + _oldUnit setVariable [QGVAR(isSpeaking), false, true]; + }; +}] call EFUNC(common,addEventHandler); + + +//For performance, chose different code paths at mission start based on installed mods (once, instead of checking each time) +_pfEHCode = switch (true) do { +case (isClass (configFile >> "cfgPatches" >> "acre_api")): { + { + _oldSetting = ACE_player getVariable [QGVAR(isSpeaking), false]; + _newSetting = ([ACE_player] call ACRE_api_fnc_isBroadcasting) || {!(isNull findDisplay 55)}; + if (!(_oldSetting isEqualTo _newSetting)) then { + ACE_player setVariable [QGVAR(isSpeaking), _newSetting, true]; + }; + }; + }; +case (isClass (configFile >> "cfgPatches" >> "task_force_radio")): { + //Note: TFAR has a TFAR_fnc_isSpeaking function, but it has a fairly costly `callExtension` + //I think it's much faster to use the internal "tf_isSpeaking" variable + //If we don't care about the built-in VON, we could switch this to a pure event driven system + { + _oldSetting = ACE_player getVariable [QGVAR(isSpeaking), false]; + _newSetting = (ACE_player getVariable ["tf_isSpeaking", false]) || {!(isNull findDisplay 55)}; + if (!(_oldSetting isEqualTo _newSetting)) then { + ACE_player setVariable [QGVAR(isSpeaking), _newSetting, true]; + }; + }; + }; + default { + //Note: class RscDisplayVoiceChat {idd = 55}; //only present when talking + { + _oldSetting = ACE_player getVariable [QGVAR(isSpeaking), false]; + _newSetting = (!(isNull findDisplay 55)); + if (!(_oldSetting isEqualTo _newSetting)) then { + ACE_player setVariable [QGVAR(isSpeaking), _newSetting, true]; + }; + }; + }; +}; + +//Is 0.05sec precision enough?? +[_pfEHCode, 0.05, []] call CBA_fnc_addPerFrameHandler; diff --git a/addons/nametags/functions/fnc_moduleNameTags.sqf b/addons/nametags/functions/fnc_moduleNameTags.sqf index 24b30e5d6b..a998e5d8a3 100644 --- a/addons/nametags/functions/fnc_moduleNameTags.sqf +++ b/addons/nametags/functions/fnc_moduleNameTags.sqf @@ -25,5 +25,6 @@ GVAR(Module) = true; [_logic, QGVAR(PlayerNamesViewDistance), "PlayerNamesViewDistance" ] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(ShowNamesForAI), "ShowNamesForAI" ] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(showVehicleCrewInfo), "showVehicleCrewInfo" ] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(showCursorTagForVehicles), "showCursorTagForVehicles" ] call EFUNC(common,readSettingFromModule); diag_log text "[ACE]: NameTags Module Initialized."; diff --git a/addons/nametags/functions/fnc_onDraw3d.sqf b/addons/nametags/functions/fnc_onDraw3d.sqf new file mode 100644 index 0000000000..8aa503d377 --- /dev/null +++ b/addons/nametags/functions/fnc_onDraw3d.sqf @@ -0,0 +1,108 @@ +#include "script_component.hpp" + +_player = ACE_player; + +//don't show nametags in spectator +if (!alive _player) exitWith {}; + +_onKeyPressAlphaMax = if ((GVAR(showPlayerNames) in [3,4])) then { + 2 + (GVAR(ShowNamesTime) - time); //after release 1 second of full opacity, 1 second of fading to 0 +} else { + 1 +}; + +_defaultIcon = if (GVAR(showPlayerRanks)) then { + ICON_NAME_RANK; +} else { + ICON_NAME; +}; + +//When cursorTarget is on a vehicle show the nametag for the commander. +//If set to "Only On Keypress" settings, fade just like main tags +if (GVAR(showCursorTagForVehicles) && {_onKeyPressAlphaMax > 0}) then { + _target = cursorTarget; + if ((!(_target isKindOf "CAManBase")) && {!(_target in allUnitsUAV)}) then { + _target = effectiveCommander _target; + if ((!isNull _target) && + {(side (group _target)) == (side (group _player))} && + {_target != _player} && + {GVAR(ShowNamesForAI) || {[_target] call EFUNC(common,isPlayer)}} && + {!(_target getVariable ["ACE_hideName", false])}) then { + _distance = _player distance _target; + _alpha = ((1 - 0.2 * (_distance - GVAR(PlayerNamesViewDistance))) min 1) * GVAR(PlayerNamesMaxAlpha); + _alpha = _alpha min _onKeyPressAlphaMax; + [_player, _target, _alpha, _distance * 0.026, _defaultIcon] call FUNC(drawNameTagIcon); + }; + }; +}; + +//"Only Cursor" mode, only show nametags for humans on cursorTarget +if ((GVAR(showPlayerNames) in [2,4]) && {_onKeyPressAlphaMax > 0}) then { + _target = cursorTarget; + if ((!isNull _target) && + {_target isKindOf "CAManBase"} && + {(side (group _target)) == (side (group _player))} && + {_target != _player} && + {GVAR(ShowNamesForAI) || {[_target] call EFUNC(common,isPlayer)}} && + {!(_target getVariable ["ACE_hideName", false])}) then { + _distance = _player distance _target; + _alpha = ((1 - 0.2 * (_distance - GVAR(PlayerNamesViewDistance))) min 1) * GVAR(PlayerNamesMaxAlpha); + _alpha = _alpha min _onKeyPressAlphaMax; + _icon = ICON_NONE; + if (GVAR(showSoundWaves) == 2) then { //icon will be drawn below, so only show name here + _icon = if ((_target getVariable [QGVAR(isSpeaking), false]) && {(vehicle _target) == _target}) then {ICON_NAME} else {_defaultIcon}; + } else { + _icon = if ((_target getVariable [QGVAR(isSpeaking), false]) && {(vehicle _target) == _target} && {GVAR(showSoundWaves) > 0}) then {ICON_NAME_SPEAK} else {_defaultIcon}; + }; + + [_player, _target, _alpha, _distance * 0.026, _icon] call FUNC(drawNameTagIcon); + }; +}; + +if (((GVAR(showPlayerNames) in [1,3]) && {_onKeyPressAlphaMax > 0}) || {GVAR(showSoundWaves) == 2}) then { + _pos = positionCameraToWorld [0, 0, 0]; + _targets = _pos nearObjects ["CAManBase", GVAR(PlayerNamesViewDistance) + 5]; + + if (!surfaceIsWater _pos) then { + _pos = ATLtoASL _pos; + }; + _pos2 = positionCameraToWorld [0, 0, 1]; + if (!surfaceIsWater _pos2) then { + _pos2 = ATLtoASL _pos2; + }; + _vecy = _pos2 vectorDiff _pos; + + { + _target = _x; + + _icon = ICON_NONE; + if ((GVAR(showPlayerNames) in [1,3]) && {_onKeyPressAlphaMax > 0}) then { + if ((_target getVariable [QGVAR(isSpeaking), false]) && {(vehicle _target) == _target} && {GVAR(showSoundWaves) > 0}) then {_icon = ICON_NAME_SPEAK;} else {_icon = _defaultIcon}; + } else { + //showSoundWaves must be 2, only draw speak icon + if ((_target getVariable [QGVAR(isSpeaking), false]) && {(vehicle _target) == _target}) then {_icon = ICON_SPEAK;}; + }; + + if ((_icon != ICON_NONE) && + {(side (group _target)) == (side (group _player))} && + {_target != _player} && + {GVAR(ShowNamesForAI) || {[_target] call EFUNC(common,isPlayer)}} && + {!(_target getVariable ["ACE_hideName", false])}) then { + + if (lineIntersects [_pos, (visiblePositionASL _target) vectorAdd [0,0,1], vehicle _player, _target]) exitWith {}; // Check if there is line of sight + _relPos = (visiblePositionASL _target) vectorDiff _pos; + _distance = vectorMagnitude _relPos; + _projDist = _relPos vectorDistance (_vecy vectorMultiply (_relPos vectorDotProduct _vecy)); + + _alpha = ((1 - 0.2 * (_distance - GVAR(PlayerNamesViewDistance))) min (1 - 0.15 * (_projDist * 5 - _distance - 3)) min 1) * GVAR(PlayerNamesMaxAlpha); + + if ((GVAR(showSoundWaves) == 2) && {(_target getVariable [QGVAR(isSpeaking), false]) && {(vehicle _target) == _target}}) then { + _alpha = 1; + } else { + _alpha = _alpha min _onKeyPressAlphaMax; + }; + + [_player, _target, _alpha, _distance * 0.026, _icon] call FUNC(drawNameTagIcon); + }; + } forEach _targets; +}; diff --git a/addons/nametags/script_component.hpp b/addons/nametags/script_component.hpp index 6cffb95618..e80768a723 100644 --- a/addons/nametags/script_component.hpp +++ b/addons/nametags/script_component.hpp @@ -9,4 +9,10 @@ #define DEBUG_SETTINGS DEBUG_SETTINGS_NAMETAGS #endif -#include "\z\ace\addons\main\script_macros.hpp" \ No newline at end of file +#include "\z\ace\addons\main\script_macros.hpp" + +#define ICON_NONE 0 +#define ICON_NAME 1 +#define ICON_NAME_RANK 2 +#define ICON_NAME_SPEAK 3 +#define ICON_SPEAK 4 diff --git a/addons/nametags/stringtable.xml b/addons/nametags/stringtable.xml index 9cd99adaef..622df44aca 100644 --- a/addons/nametags/stringtable.xml +++ b/addons/nametags/stringtable.xml @@ -1,5 +1,5 @@  - + @@ -69,5 +69,13 @@ Show name tags for AI units + + Show SoundWaves (requires player names) + Zeigen Schallwelle (benötigt spielernamen) + Mostrar onda sonora (requiere Mostrar nombres de jugadores) + + + Default Nametag Color (Non Group Members) + - + \ No newline at end of file diff --git a/addons/nightvision/CfgEventHandlers.hpp b/addons/nightvision/CfgEventHandlers.hpp index d76482dd7f..380f190f47 100644 --- a/addons/nightvision/CfgEventHandlers.hpp +++ b/addons/nightvision/CfgEventHandlers.hpp @@ -1,19 +1,19 @@ class Extended_PreInit_EventHandlers { - class ADDON { - init = QUOTE(call COMPILE_FILE(XEH_preInit) ); - }; + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preInit) ); + }; }; class Extended_PostInit_EventHandlers { - class ADDON { - clientInit = QUOTE(call COMPILE_FILE(XEH_postInitClient) ); - }; + class ADDON { + clientInit = QUOTE(call COMPILE_FILE(XEH_postInitClient) ); + }; }; class Extended_FiredBIS_EventHandlers { - class AllVehicles { - class ADDON { - clientFiredBIS = QUOTE( _this call FUNC(blending) ); + class AllVehicles { + class ADDON { + clientFiredBIS = QUOTE( _this call FUNC(blending) ); + }; }; - }; }; diff --git a/addons/nightvision/CfgVehicles.hpp b/addons/nightvision/CfgVehicles.hpp index 63abfb47e2..d53ce54467 100644 --- a/addons/nightvision/CfgVehicles.hpp +++ b/addons/nightvision/CfgVehicles.hpp @@ -1,22 +1,22 @@ class CfgVehicles { - class All { - ACE_NightVision_grain = 0.75; - ACE_NightVision_blur = 0.055; - }; - - #define MACRO_ADDITEM(ITEM,COUNT) class _xx_##ITEM { \ - name = #ITEM; \ - count = COUNT; \ - }; - - class Box_NATO_Support_F; - class ACE_Box_Misc: Box_NATO_Support_F { - class TransportItems { - MACRO_ADDITEM(ACE_NVG_Gen1,6) - MACRO_ADDITEM(ACE_NVG_Gen2,6) - //MACRO_ADDITEM(ACE_NVG_Gen3,6) - MACRO_ADDITEM(ACE_NVG_Gen4,6) - MACRO_ADDITEM(ACE_NVG_Wide,6) + class All { + ACE_NightVision_grain = 0.75; + ACE_NightVision_blur = 0.055; + }; + +#define MACRO_ADDITEM(ITEM,COUNT) class _xx_##ITEM { \ + name = #ITEM; \ + count = COUNT; \ + }; + + class Box_NATO_Support_F; + class ACE_Box_Misc: Box_NATO_Support_F { + class TransportItems { + MACRO_ADDITEM(ACE_NVG_Gen1,6) + MACRO_ADDITEM(ACE_NVG_Gen2,6) + //MACRO_ADDITEM(ACE_NVG_Gen3,6) + MACRO_ADDITEM(ACE_NVG_Gen4,6) + MACRO_ADDITEM(ACE_NVG_Wide,6) + }; }; - }; }; diff --git a/addons/nightvision/CfgWeapons.hpp b/addons/nightvision/CfgWeapons.hpp index 99cc55db20..c40885c2c4 100644 --- a/addons/nightvision/CfgWeapons.hpp +++ b/addons/nightvision/CfgWeapons.hpp @@ -1,56 +1,56 @@ class CfgWeapons { - class Binocular; - class NVGoggles: Binocular { - displayName = "$STR_ACE_NightVision_NVG_Gen3_brown"; - ACE_NightVision_grain = 0.75; - ACE_NightVision_blur = 0.055; - ACE_NightVision_radBlur = 0.001; - }; - class NVGoggles_OPFOR: NVGoggles { - displayName = "$STR_ACE_NightVision_NVG_Gen3_black"; - }; - class NVGoggles_INDEP: NVGoggles { - displayName = "$STR_ACE_NightVision_NVG_Gen3_green"; - }; + class Binocular; + class NVGoggles: Binocular { + displayName = "$STR_ACE_NightVision_NVG_Gen3_brown"; + ACE_NightVision_grain = 0.75; + ACE_NightVision_blur = 0.055; + ACE_NightVision_radBlur = 0.001; + }; + class NVGoggles_OPFOR: NVGoggles { + displayName = "$STR_ACE_NightVision_NVG_Gen3_black"; + }; + class NVGoggles_INDEP: NVGoggles { + displayName = "$STR_ACE_NightVision_NVG_Gen3_green"; + }; - class ACE_NVG_Gen1: NVGoggles_OPFOR { - author = "$STR_ACE_Common_ACETeam"; - modelOptics = "\A3\weapons_f\reticle\optics_night"; - displayName = "$STR_ACE_NightVision_NVG_Gen1"; - ACE_NightVision_grain = 2.25; - ACE_NightVision_blur = 0.22; - ACE_NightVision_radBlur = 0.004; - }; - class ACE_NVG_Gen2: NVGoggles_INDEP { - author = "$STR_ACE_Common_ACETeam"; - modelOptics = "\A3\weapons_f\reticle\optics_night"; - displayName = "$STR_ACE_NightVision_NVG_Gen2"; - ACE_NightVision_grain = 1.5; - ACE_NightVision_blur = 0.11; - ACE_NightVision_radBlur = 0.002; - }; - /*class ACE_NVG_Gen3: NVGoggles { + class ACE_NVG_Gen1: NVGoggles_OPFOR { + author = "$STR_ACE_Common_ACETeam"; + modelOptics = "\A3\weapons_f\reticle\optics_night"; + displayName = "$STR_ACE_NightVision_NVG_Gen1"; + ACE_NightVision_grain = 2.25; + ACE_NightVision_blur = 0.22; + ACE_NightVision_radBlur = 0.004; + }; + class ACE_NVG_Gen2: NVGoggles_INDEP { + author = "$STR_ACE_Common_ACETeam"; + modelOptics = "\A3\weapons_f\reticle\optics_night"; + displayName = "$STR_ACE_NightVision_NVG_Gen2"; + ACE_NightVision_grain = 1.5; + ACE_NightVision_blur = 0.11; + ACE_NightVision_radBlur = 0.002; + }; + /*class ACE_NVG_Gen3: NVGoggles { author = "$STR_ACE_Common_ACETeam"; modelOptics = "\A3\weapons_f\reticle\optics_night"; displayName = "$STR_ACE_NightVision_NVG_Gen3"; ACE_NightVision_grain = 0.75; ACE_NightVision_blur = 0.055; ACE_NightVision_radBlur = 0.001; - };*/ - class ACE_NVG_Gen4: NVGoggles { - author = "$STR_ACE_Common_ACETeam"; - modelOptics = "\A3\weapons_f\reticle\optics_night"; - displayName = "$STR_ACE_NightVision_NVG_Gen4"; - ACE_NightVision_grain = 0.0; - ACE_NightVision_blur = 0.0; - ACE_NightVision_radBlur = 0.0; - }; - class ACE_NVG_Wide: NVGoggles { - author = "$STR_ACE_Common_ACETeam"; - modelOptics = QUOTE(PATHTOF(ACE_nvg_wide_optics)); - displayName = "$STR_ACE_NightVision_NVG_FullScreen"; - ACE_NightVision_grain = 0.75; - ACE_NightVision_blur = 0.055; - ACE_NightVision_radBlur = 0.001; - }; +};*/ + class ACE_NVG_Gen4: NVGoggles { + author = "$STR_ACE_Common_ACETeam"; + modelOptics = "\A3\weapons_f\reticle\optics_night"; + displayName = "$STR_ACE_NightVision_NVG_Gen4"; + ACE_NightVision_grain = 0.0; + ACE_NightVision_blur = 0.0; + ACE_NightVision_radBlur = 0.0; + }; + class ACE_NVG_Wide: NVGoggles { + author = "$STR_ACE_Common_ACETeam"; + modelOptics = QUOTE(PATHTOF(models\ACE_nvg_wide_optics)); + displayName = "$STR_ACE_NightVision_NVG_FullScreen"; + ACE_NightVision_grain = 0.75; + ACE_NightVision_blur = 0.055; + ACE_NightVision_radBlur = 0.001; + }; }; diff --git a/addons/nightvision/XEH_postInitClient.sqf b/addons/nightvision/XEH_postInitClient.sqf index b81bedc07b..7513b1df16 100644 --- a/addons/nightvision/XEH_postInitClient.sqf +++ b/addons/nightvision/XEH_postInitClient.sqf @@ -35,3 +35,40 @@ GVAR(ppEffectMuzzleFlash) ppEffectCommit 0; ["cameraViewChanged", {_this call FUNC(updatePPEffects)}] call EFUNC(common,addEventHandler); ["playerVehicleChanged", {_this call FUNC(updatePPEffects)}] call EFUNC(common,addEventHandler); ["playerTurretChanged", {_this call FUNC(updatePPEffects)}] call EFUNC(common,addEventHandler); + +// Add keybinds +["ACE3", +localize "STR_ACE_NightVision_IncreaseNVGBrightness", +{ + // Conditions: canInteract + _exceptions = [QEGVAR(captives,isNotEscorting)]; + if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; + // Conditions: specific + if ((currentVisionMode _player != 1)) exitWith {false}; + + // Statement + [ACE_player, 1] call FUNC(changeNVGBrightness); + true +}, +[201, [false, false, true]], //PageUp + ALT +false, +"keydown" +] call cba_fnc_registerKeybind; + +["ACE3", +localize "STR_ACE_NightVision_DecreaseNVGBrightness", +{ + // Conditions: canInteract + _exceptions = [QEGVAR(captives,isNotEscorting)]; + if !(_exceptions call EGVAR(common,canInteract)) exitWith {false}; + // Conditions: specific + if ((currentVisionMode _player != 1)) exitWith {false}; + + // Statement + [ACE_player, -1] call FUNC(changeNVGBrightness); + true +}, +[209, [false, false, true]], //PageDown + ALT +false, +"keydown" +] call cba_fnc_registerKeybind; diff --git a/addons/nightvision/XEH_preInit.sqf b/addons/nightvision/XEH_preInit.sqf index 9f59a01418..27f8ea7d48 100644 --- a/addons/nightvision/XEH_preInit.sqf +++ b/addons/nightvision/XEH_preInit.sqf @@ -3,8 +3,7 @@ ADDON = false; PREP(blending); -PREP(decreaseNVGBrightness); -PREP(increaseNVGBrightness); +PREP(changeNVGBrightness); PREP(updatePPEffects); ADDON = true; diff --git a/addons/nightvision/config.cpp b/addons/nightvision/config.cpp index 32c563bfb6..4e6aa2e39a 100644 --- a/addons/nightvision/config.cpp +++ b/addons/nightvision/config.cpp @@ -1,42 +1,17 @@ #include "script_component.hpp" class CfgPatches { - class ADDON { - units[] = {}; - weapons[] = {"ACE_NVG_Gen1", "ACE_NVG_Gen2", /*"ACE_NVG_Gen3",*/ "ACE_NVG_Gen4", "ACE_NVG_Wide"}; - requiredVersion = REQUIRED_VERSION; - requiredAddons[] = {"ace_common"}; - author[] = {"commy2", "KoffeinFlummi", "PabstMirror"}; - authorUrl = "https://github.com/commy2/"; - VERSION_CONFIG; - }; + class ADDON { + units[] = {}; + weapons[] = {"ACE_NVG_Gen1", "ACE_NVG_Gen2", /*"ACE_NVG_Gen3",*/ "ACE_NVG_Gen4", "ACE_NVG_Wide"}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"ace_common"}; + author[] = {"commy2", "KoffeinFlummi", "PabstMirror"}; + authorUrl = "https://github.com/commy2/"; + VERSION_CONFIG; + }; }; #include "CfgEventHandlers.hpp" #include "CfgVehicles.hpp" #include "CfgWeapons.hpp" - - -// class EGVAR(common,Default_Keys) { //??? -class ACE_common_Default_Keys { - class increaseNVGBrightness { - displayName = "$STR_ACE_NightVision_IncreaseNVGBrightness"; - condition = QUOTE( currentVisionMode _player == 1 ); - statement = QUOTE( [_player, _vehicle] call FUNC(increaseNVGBrightness) ); - key = 201; - shift = 0; - control = 0; - alt = 1; - allowHolding = 1; - }; - class decreaseNVGBrightness { - displayName = "$STR_ACE_NightVision_DecreaseNVGBrightness"; - condition = QUOTE( currentVisionMode _player == 1 ); - statement = QUOTE( [_player, _vehicle] call FUNC(decreaseNVGBrightness) ); - key = 209; - shift = 0; - control = 0; - alt = 1; - allowHolding = 1; - }; -}; diff --git a/addons/nightvision/functions/fnc_blending.sqf b/addons/nightvision/functions/fnc_blending.sqf index df46c62b58..96e7f404a5 100644 --- a/addons/nightvision/functions/fnc_blending.sqf +++ b/addons/nightvision/functions/fnc_blending.sqf @@ -1,4 +1,24 @@ -// by commy2 +/* + * Author: commy2 + * Change the blending when the player fires?? + * + * Arguments: + * 0: unit - Object the event handler is assigned to + * 1: weapon - Fired weapon + * 2: muzzle - Muzzle that was used + * 3: mode - Current mode of the fired weapon + * 4: ammo - Ammo used + * 5: magazine - magazine name which was used + * 6: projectile - Object of the projectile that was shot + * + * Return Value: + * Nothing + * + * Example: + * [clientFiredBIS-XEH] call ace_nightvision_fnc_blending + * + * Public: No + */ #include "script_component.hpp" private ["_vehicle", "_weapon", "_ammo", "_magazine", "_player"]; @@ -8,26 +28,26 @@ _weapon = _this select 1; _ammo = _this select 4; _magazine = _this select 5; -if ((_vehicle != (vehicle ACE_player)) || {(currentVisionMode _vehicle) != 1}) exitWith {}; - _player = ACE_player; - +//If our vehicle didn't shoot, or we're not in NVG mode, exit +if ((_vehicle != (vehicle _player)) || {(currentVisionMode _player) != 1}) exitWith {}; +//If we are mounted, and it wasn't our weapon system that fired, exit if (_player != _vehicle && {!(_weapon in (_vehicle weaponsTurret ([_player] call EFUNC(common,getTurretIndex))))}) exitWith {}; private ["_silencer", "_visibleFireCoef", "_visibleFireTimeCoef", "_visibleFire", "_visibleFireTime", "_nvgBrightnessCoef", "_fnc_isTracer", "_darkness"]; _silencer = switch (_weapon) do { - case (primaryWeapon _player) : {primaryWeaponItems _player select 0}; - case (secondaryWeapon _player) : {secondaryWeaponItems _player select 0}; - case (handgunWeapon _player) : {handgunItems _player select 0}; - default {""}; +case (primaryWeapon _player) : {primaryWeaponItems _player select 0}; +case (secondaryWeapon _player) : {secondaryWeaponItems _player select 0}; +case (handgunWeapon _player) : {handgunItems _player select 0}; + default {""}; }; _visibleFireCoef = 1; _visibleFireTimeCoef = 1; if (_silencer != "") then { - _visibleFireCoef = getNumber (configFile >> "CfgWeapons" >> _silencer >> "ItemInfo" >> "AmmoCoef" >> "visibleFire"); - _visibleFireTimeCoef = getNumber (configFile >> "CfgWeapons" >> _silencer >> "ItemInfo" >> "AmmoCoef" >> "visibleFireTime"); + _visibleFireCoef = getNumber (configFile >> "CfgWeapons" >> _silencer >> "ItemInfo" >> "AmmoCoef" >> "visibleFire"); + _visibleFireTimeCoef = getNumber (configFile >> "CfgWeapons" >> _silencer >> "ItemInfo" >> "AmmoCoef" >> "visibleFireTime"); }; _visibleFire = getNumber (configFile >> "CfgAmmo" >> _ammo >> "visibleFire"); @@ -36,24 +56,24 @@ _visibleFireTime = getNumber (configFile >> "CfgAmmo" >> _ammo >> "visibleFireTi _nvgBrightnessCoef = 1 + (_player getVariable [QGVAR(NVGBrightness), 0]) / 4; _fnc_isTracer = { - private ["_indexShot", "_lastRoundsTracer", "_tracersEvery"]; + private ["_indexShot", "_lastRoundsTracer", "_tracersEvery"]; - if (getNumber (configFile >> "CfgAmmo" >> _ammo >> "nvgOnly") > 0) exitWith {false}; + if (getNumber (configFile >> "CfgAmmo" >> _ammo >> "nvgOnly") > 0) exitWith {false}; - _indexShot = (_player ammo _weapon) + 1; + _indexShot = (_player ammo _weapon) + 1; - _lastRoundsTracer = getNumber (configFile >> "CfgMagazines" >> _magazine >> "lastRoundsTracer"); - if (_indexShot <= _lastRoundsTracer) exitWith {true}; + _lastRoundsTracer = getNumber (configFile >> "CfgMagazines" >> _magazine >> "lastRoundsTracer"); + if (_indexShot <= _lastRoundsTracer) exitWith {true}; - _tracersEvery = getNumber (configFile >> "CfgMagazines" >> _magazine >> "tracersEvery"); - if (_tracersEvery == 0) exitWith {false}; + _tracersEvery = getNumber (configFile >> "CfgMagazines" >> _magazine >> "tracersEvery"); + if (_tracersEvery == 0) exitWith {false}; - (_indexShot - _lastRoundsTracer) % _tracersEvery == 0 + (_indexShot - _lastRoundsTracer) % _tracersEvery == 0 }; if (call _fnc_isTracer) then { - _visibleFire = _visibleFire + 2; - _visibleFireTime = _visibleFireTime + 2; + _visibleFire = _visibleFire + 2; + _visibleFireTime = _visibleFireTime + 2; }; _darkness = 1 - (call EFUNC(common,ambientBrightness)); diff --git a/addons/nightvision/functions/fnc_changeNVGBrightness.sqf b/addons/nightvision/functions/fnc_changeNVGBrightness.sqf new file mode 100644 index 0000000000..e1894aba00 --- /dev/null +++ b/addons/nightvision/functions/fnc_changeNVGBrightness.sqf @@ -0,0 +1,33 @@ +/* + * Author: commy2 + * Change the brightness of the unit's NVG + * + * Arguments: + * 0: The Unit + * 1: Change in brightness (1 or -1) + * + * Return Value: + * Nothing + * + * Example: + * [player, 1] call ace_nightvision_fnc_changeNVGBrightness + * + * Public: No + */ +#include "script_component.hpp" + +private ["_brightness"]; + +PARAMS_2(_player,_changeInBrightness); + +_brightness = _player getVariable [QGVAR(NVGBrightness), 0]; + +_brightness = ((round (10 * _brightness + _changeInBrightness) / 10) min 1) max -1; + +_player setVariable [QGVAR(NVGBrightness), _brightness, false]; + +GVAR(ppEffectNVGBrightness) ppEffectAdjust [1, 1, _brightness / 4, [0, 0, 0, 0], [0, 0, 0, 1], [0, 0, 0, 1]]; +GVAR(ppEffectNVGBrightness) ppEffectCommit 0; + +[format [(localize "STR_ACE_NightVision_NVGBrightness"), (_brightness * 100)]] call EFUNC(common,displayTextStructured); +playSound "ACE_Sound_Click"; diff --git a/addons/nightvision/functions/fnc_decreaseNVGBrightness.sqf b/addons/nightvision/functions/fnc_decreaseNVGBrightness.sqf deleted file mode 100644 index 0fb2de9d33..0000000000 --- a/addons/nightvision/functions/fnc_decreaseNVGBrightness.sqf +++ /dev/null @@ -1,21 +0,0 @@ -// by commy2 -#include "script_component.hpp" - -private ["_player", "_vehicle", "_brightness"]; - -_player = _this select 0; -_vehicle = _this select 1; - -_brightness = _player getVariable [QGVAR(NVGBrightness), 0]; - -if (_brightness > -1) then { - _brightness = round (10 * _brightness - 1) / 10; - - _player setVariable [QGVAR(NVGBrightness), _brightness, false]; - - GVAR(ppEffectNVGBrightness) ppEffectAdjust [1, 1, _brightness / 4, [0, 0, 0, 0], [0, 0, 0, 1], [0, 0, 0, 1]]; - GVAR(ppEffectNVGBrightness) ppEffectCommit 0; - - [format [localize "STR_ACE_NightVision_NVGBrightness", format ["%1%", _brightness * 100]]] call EFUNC(common,displayTextStructured); - playSound "ACE_Sound_Click"; -}; diff --git a/addons/nightvision/functions/fnc_increaseNVGBrightness.sqf b/addons/nightvision/functions/fnc_increaseNVGBrightness.sqf deleted file mode 100644 index e2143d5a5e..0000000000 --- a/addons/nightvision/functions/fnc_increaseNVGBrightness.sqf +++ /dev/null @@ -1,21 +0,0 @@ -// by commy2 -#include "script_component.hpp" - -private ["_player", "_vehicle", "_brightness"]; - -_player = _this select 0; -_vehicle = _this select 1; - -_brightness = _player getVariable [QGVAR(NVGBrightness), 0]; - -if (_brightness < 1) then { - _brightness = round (10 * _brightness + 1) / 10; - - _player setVariable [QGVAR(NVGBrightness), _brightness, false]; - - GVAR(ppEffectNVGBrightness) ppEffectAdjust [1, 1, _brightness / 4, [0, 0, 0, 0], [0, 0, 0, 1], [0, 0, 0, 1]]; - GVAR(ppEffectNVGBrightness) ppEffectCommit 0; - - [format [localize "STR_ACE_NightVision_NVGBrightness", format ["%1%", _brightness * 100]]] call EFUNC(common,displayTextStructured); - playSound "ACE_Sound_Click"; -}; diff --git a/addons/nightvision/functions/fnc_updatePPEffects.sqf b/addons/nightvision/functions/fnc_updatePPEffects.sqf index 1fdfbb9778..3edfe28e74 100644 --- a/addons/nightvision/functions/fnc_updatePPEffects.sqf +++ b/addons/nightvision/functions/fnc_updatePPEffects.sqf @@ -1,4 +1,18 @@ -//by commy2, PabstMirror and CAA-Picard +/* + * Author: commy2, PabstMirror and CAA-Picard + * Update the ppEffects everytime something changes + * + * Arguments: + * Nothing + * + * Return Value: + * Nothing + * + * Example: + * [someEvent] call ace_nightvision_fnc_updatePPEffects + * + * Public: No + */ #include "script_component.hpp" private ["_currentVehicle", "_grainSetting", "_blurSetting", "_radBlurSetting", "_config"]; diff --git a/addons/nightvision/ace_nvg_wide_optics.p3d b/addons/nightvision/models/ace_nvg_wide_optics.p3d similarity index 100% rename from addons/nightvision/ace_nvg_wide_optics.p3d rename to addons/nightvision/models/ace_nvg_wide_optics.p3d diff --git a/addons/realisticnames/config.cpp b/addons/realisticnames/config.cpp index ea1318686b..e7a7984721 100644 --- a/addons/realisticnames/config.cpp +++ b/addons/realisticnames/config.cpp @@ -223,43 +223,46 @@ class CfgVehicles { class B_Truck_01_Repair_F: B_Truck_01_mover_F { displayName = "$STR_ACE_RealisticNames_Truck_01_Repair_Name"; }; - - class Truck_02_base_F; - class O_Truck_02_transport_F: Truck_02_base_F { + class Truck_02_transport_base_F; + class O_Truck_02_transport_F: Truck_02_transport_base_F { displayName = "$STR_ACE_RealisticNames_Truck_02_transport_Name"; }; + class Truck_02_base_F; class O_Truck_02_covered_F: Truck_02_base_F { displayName = "$STR_ACE_RealisticNames_Truck_02_covered_Name"; }; - class O_Truck_02_ammo_F: Truck_02_base_F { + class Truck_02_Ammo_base_F; + class O_Truck_02_ammo_F: Truck_02_Ammo_base_F { displayName = "$STR_ACE_RealisticNames_Truck_02_ammo_Name"; }; - class O_Truck_02_fuel_F: Truck_02_base_F { + class Truck_02_fuel_base_F; + class O_Truck_02_fuel_F: Truck_02_fuel_base_F { displayName = "$STR_ACE_RealisticNames_Truck_02_fuel_Name"; }; - class O_Truck_02_box_F: Truck_02_base_F { + class Truck_02_box_base_F; + class O_Truck_02_box_F: Truck_02_box_base_F { displayName = "$STR_ACE_RealisticNames_Truck_02_box_Name"; }; - class O_Truck_02_medical_F: O_Truck_02_box_F { + class Truck_02_medical_base_F; + class O_Truck_02_medical_F: Truck_02_medical_base_F { displayName = "$STR_ACE_RealisticNames_Truck_02_medical_Name"; }; - - class I_Truck_02_transport_F: Truck_02_base_F { + class I_Truck_02_transport_F: Truck_02_transport_base_F { displayName = "$STR_ACE_RealisticNames_Truck_02_transport_Name"; }; class I_Truck_02_covered_F: Truck_02_base_F { displayName = "$STR_ACE_RealisticNames_Truck_02_covered_Name"; }; - class I_Truck_02_ammo_F: Truck_02_base_F { + class I_Truck_02_ammo_F: Truck_02_Ammo_base_F { displayName = "$STR_ACE_RealisticNames_Truck_02_ammo_Name"; }; - class I_Truck_02_fuel_F: Truck_02_base_F { + class I_Truck_02_fuel_F: Truck_02_fuel_base_F { displayName = "$STR_ACE_RealisticNames_Truck_02_fuel_Name"; }; - class I_Truck_02_box_F: Truck_02_base_F { + class I_Truck_02_box_F: Truck_02_box_base_F { displayName = "$STR_ACE_RealisticNames_Truck_02_box_Name"; }; - class I_Truck_02_medical_F: I_Truck_02_box_F { + class I_Truck_02_medical_F: Truck_02_medical_base_F { displayName = "$STR_ACE_RealisticNames_Truck_02_medical_Name"; }; @@ -306,13 +309,12 @@ class CfgVehicles { displayName = "$STR_ACE_RealisticNames_Heli_Light_01_civil_Name"; }; - class B_Heli_Transport_03_base_F; - class B_Heli_Transport_03_F: B_Heli_Transport_03_base_F { + class Heli_Transport_03_base_F; + class B_Heli_Transport_03_F: Heli_Transport_03_base_F { displayName = "$STR_ACE_RealisticNames_Heli_Transport_03_Name"; }; - - class B_Heli_Transport_03_unarmed_base_F: B_Heli_Transport_03_base_F {}; - class B_Heli_Transport_03_unarmed_F: B_Heli_Transport_03_unarmed_base_F { + class Heli_Transport_03_unarmed_base_F; + class B_Heli_Transport_03_unarmed_F: Heli_Transport_03_unarmed_base_F { displayName = "$STR_ACE_RealisticNames_Heli_Transport_03_unarmed_Name"; }; @@ -320,17 +322,18 @@ class CfgVehicles { class O_Heli_Light_02_F: Heli_Light_02_base_F { displayName = "$STR_ACE_RealisticNames_Heli_Light_02_Name"; }; - class O_Heli_Light_02_unarmed_F: Heli_Light_02_base_F { + class Heli_Light_02_unarmed_base_F; + class O_Heli_Light_02_unarmed_F: Heli_Light_02_unarmed_base_F { displayName = "$STR_ACE_RealisticNames_Heli_Light_02_unarmed_Name"; }; - class I_Heli_light_03_base_F; - class I_Heli_light_03_F: I_Heli_light_03_base_F { + class Heli_light_03_base_F; + class I_Heli_light_03_F: Heli_light_03_base_F { displayName = "$STR_ACE_RealisticNames_Heli_light_03_Name"; }; - class I_Heli_light_03_unarmed_base_F; - class I_Heli_light_03_unarmed_F: I_Heli_light_03_unarmed_base_F { + class Heli_light_03_unarmed_base_F; + class I_Heli_light_03_unarmed_F: Heli_light_03_unarmed_base_F { displayName = "$STR_ACE_RealisticNames_Heli_light_03_unarmed_Name"; }; diff --git a/addons/reload/CfgEventHandlers.hpp b/addons/reload/CfgEventHandlers.hpp index 8de6a01f06..754ff0db87 100644 --- a/addons/reload/CfgEventHandlers.hpp +++ b/addons/reload/CfgEventHandlers.hpp @@ -14,7 +14,7 @@ class Extended_PostInit_EventHandlers { class Extended_Take_EventHandlers { class CAManBase { class ACE_AmmoIndicatorReload { - clientTake = QUOTE(if (_this select 0 == ACE_player && {(_this select 1) in [ARR_3(uniformContainer (_this select 0), vestContainer (_this select 0), backpackContainer (_this select 0))]} && {_this select 2 == currentMagazine (_this select 0)}) then {[ARR_3(_this select 0, vehicle (_this select 0), true)] call FUNC(checkAmmo)};); + clientTake = QUOTE(if (_this select 0 == ACE_player && {(_this select 1) in [ARR_3(uniformContainer (_this select 0), vestContainer (_this select 0), backpackContainer (_this select 0))]} && {_this select 2 == currentMagazine (_this select 0)}) then {[ARR_2(_this select 0, vehicle (_this select 0))] call FUNC(displayAmmo)};); }; }; }; diff --git a/addons/reload/CfgMagazines.hpp b/addons/reload/CfgMagazines.hpp new file mode 100644 index 0000000000..6811a49494 --- /dev/null +++ b/addons/reload/CfgMagazines.hpp @@ -0,0 +1,12 @@ +class CfgMagazines { + + class CA_Magazine; + class 150Rnd_762x51_Box : CA_Magazine { + ACE_isBelt = 1; + }; + + class 100Rnd_65x39_caseless_mag; + class 200Rnd_65x39_cased_Box : 100Rnd_65x39_caseless_mag { + ACE_isBelt = 1; + }; +}; \ No newline at end of file diff --git a/addons/reload/CfgVehicles.hpp b/addons/reload/CfgVehicles.hpp new file mode 100644 index 0000000000..84333a1a09 --- /dev/null +++ b/addons/reload/CfgVehicles.hpp @@ -0,0 +1,35 @@ +class CfgVehicles { + class Man; + class CAManBase: Man { + class ACE_Actions { + class ACE_Weapon { + class ACE_LinkBelt { + displayName = "$STR_ACE_Reload_LinkBelt"; + distance = 2.0; + condition = QUOTE([ARR_2(_player, _target)] call FUNC(canLinkBelt)); + statement = QUOTE([ARR_2(_player, _target)] call FUNC(startLinkingBelt)); + }; + class ACE_CheckAmmo { + displayName = "$STR_ACE_Reload_checkAmmo"; + distance = 2.0; + condition = QUOTE([ARR_2(_player, _target)] call FUNC(canCheckAmmo)); + statement = QUOTE([ARR_2(_player, _target)] call FUNC(checkAmmo)); + }; + }; + }; + }; + + class LandVehicle; + class StaticWeapon: LandVehicle { + class ACE_Actions { + class ACE_MainActions { + class ACE_CheckAmmo { + displayName = "$STR_ACE_Reload_checkAmmo"; + distance = 2.0; + condition = QUOTE([ARR_2(_player, _target)] call FUNC(canCheckAmmo)); + statement = QUOTE([ARR_2(_player, _target)] call FUNC(checkAmmo)); + }; + }; + }; + }; +}; diff --git a/addons/reload/XEH_postInit.sqf b/addons/reload/XEH_postInit.sqf index d40e5e0442..b39b357ad0 100644 --- a/addons/reload/XEH_postInit.sqf +++ b/addons/reload/XEH_postInit.sqf @@ -15,10 +15,55 @@ if !(hasInterface) exitWith {}; {(vehicle ACE_player) isKindOf 'StaticWeapon'}) exitWith {false}; // Statement - [ACE_player, vehicle ACE_player, false] call FUNC(checkAmmo); + [ACE_player] call FUNC(checkAmmo); true }, [19, [false, true, false]], false, "keydown" ] call cba_fnc_registerKeybind; + + +// Listen for attempts to link ammo +["linkedAmmo", { + EXPLODE_3_PVT(_this,_receiver,_giver,_magazine); + diag_log "linkedAmmo"; + diag_log _this; + + private ["_magazineCfg","_magazineType"]; + _magazineType = currentMagazine _receiver; + _magazineCfg = configFile >> "CfgMagazines" >> _magazineType; + + // Return the magazine if it's the wrong type + if (_magazineType != (_magazine select 0)) exitWith { + ["returnedAmmo", [_giver], [_giver,_receiver,_magazine]] call EFUNC(common,targetEvent); + }; + + private ["_ammoCount","_ammoMissing","_ammoAdded","_ammoRemaining"]; + _ammoCount = _receiver ammo currentWeapon _receiver; + _ammoMissing = getNumber (_magazineCfg >> "count") - _ammoCount; + + // Return the magazine if the belt is full or empty + if ((_ammoCount == 0) || _ammoMissing == 0) exitWith { + ["returnedAmmo", [_giver], [_giver,_receiver,_magazine]] call EFUNC(common,targetEvent); + }; + + // Add the ammo + _ammoAdded = _ammoMissing min (_magazine select 1); + _receiver setAmmo [currentWeapon _receiver, _ammoCount + _ammoAdded]; + + if ((_magazine select 1) - _ammoAdded > 0) then { + ["returnedAmmo", [_giver], [_giver,_receiver,[_magazineType,(_magazine select 1) - _ammoAdded]]] call EFUNC(common,targetEvent); + }; + +}] call EFUNC(common,addEventhandler); + + +// Listen for returned magazines +["returnedAmmo", { + EXPLODE_3_PVT(_this,_receiver,_giver,_magazine); + diag_log "returnedAmmo"; + diag_log _this; + + _receiver addMagazine _magazine; +}] call EFUNC(common,addEventhandler); diff --git a/addons/reload/XEH_preInit.sqf b/addons/reload/XEH_preInit.sqf index b5c8e45d35..278abf7bd2 100644 --- a/addons/reload/XEH_preInit.sqf +++ b/addons/reload/XEH_preInit.sqf @@ -2,6 +2,10 @@ ADDON = false; +PREP(canCheckAmmo); +PREP(canLinkBelt); PREP(checkAmmo); +PREP(displayAmmo); +PREP(startLinkingBelt); ADDON = true; diff --git a/addons/reload/config.cpp b/addons/reload/config.cpp index 6e0c14049d..932fe89840 100644 --- a/addons/reload/config.cpp +++ b/addons/reload/config.cpp @@ -5,13 +5,17 @@ class CfgPatches { units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; - requiredAddons[] = {"ace_common"}; - author[] = {"commy2","KoffeinFlummi"}; + requiredAddons[] = {"ace_interaction"}; + author[] = {"commy2","KoffeinFlummi","CAA-Picard"}; authorUrl = "https://github.com/commy2/"; VERSION_CONFIG; }; }; +#include "CfgVehicles.hpp" + +#include "CfgMagazines.hpp" + #include "CfgEventHandlers.hpp" #include "CfgActions.hpp" diff --git a/addons/reload/functions/fnc_canCheckAmmo.sqf b/addons/reload/functions/fnc_canCheckAmmo.sqf new file mode 100644 index 0000000000..3e83281b43 --- /dev/null +++ b/addons/reload/functions/fnc_canCheckAmmo.sqf @@ -0,0 +1,35 @@ +/* + * Author: CAA-Picard + * Check if the player can check the ammo of the target. + * + * Argument: + * 0: Player + * 1: Target + * + * Return value: + * Can link belt + */ +#include "script_component.hpp" + +EXPLODE_2_PVT(_this,_player,_target); + +// Return true for static weapons if they have been fired once +if (_target isKindOf "StaticWeapon") exitWith { + (currentMagazine _target) != "" +}; + +// Return false for all other vehicles +if !(_target isKindOf "CAManBase") exitWith {false}; + +// For men +if (currentWeapon _target == "") exitWith {false}; + +// Check if their current magazine is a belt +_magazineType = currentMagazine _target; +_magazineCfg = configFile >> "CfgMagazines" >> _magazineType; +if (getNumber (_magazineCfg >> "ACE_isBelt") == 1) exitWith {true}; + +// Check for rocket launchers +if (currentWeapon _target == secondaryWeapon _target) exitWith {true}; + +false diff --git a/addons/reload/functions/fnc_canLinkBelt.sqf b/addons/reload/functions/fnc_canLinkBelt.sqf new file mode 100644 index 0000000000..b06a69fafa --- /dev/null +++ b/addons/reload/functions/fnc_canLinkBelt.sqf @@ -0,0 +1,39 @@ +/* + * Author: CAA-Picard + * Check if the target has an MG equiped with belt system that the player can link + * + * Argument: + * 0: Player + * 1: Target + * + * Return value: + * Can link belt + */ +#include "script_component.hpp" + +EXPLODE_2_PVT(_this,_player,_target); + +if (vehicle _target != _target) exitWith {false}; + +private ["_magazineCfg","_magazineType"]; +_magazineType = currentMagazine _target; +_magazineCfg = configFile >> "CfgMagazines" >> _magazineType; +if (getNumber (_magazineCfg >> "ACE_isBelt") == 0) exitWith {false}; + +// Check if the ammo is not empty or full +private "_ammoCount"; +_ammoCount = _target ammo currentWeapon _target; + +// Exit if the belt is full or empty +if ((_ammoCount == 0) || (getNumber (_magazineCfg >> "count") - _ammoCount) == 0) exitWith {false}; + +// Check if the player has any of the same magazines +// Calculate max ammo +private "_maxAmmo"; +_maxAmmo = 0; + +{ + _maxAmmo = _maxAmmo max (_x select 1); +} forEach ([magazinesAmmo _player, {_this select 0 == _magazineType}] call EFUNC(common,filter)); + +_maxAmmo > 0 diff --git a/addons/reload/functions/fnc_checkAmmo.sqf b/addons/reload/functions/fnc_checkAmmo.sqf index fab1ebf333..7c24ff1ff3 100644 --- a/addons/reload/functions/fnc_checkAmmo.sqf +++ b/addons/reload/functions/fnc_checkAmmo.sqf @@ -1,13 +1,11 @@ /* - * Author: commy2 - * + * Author: commy2 and CAA-Picard * Count the ammo of the currently loaded magazine or count rifle grenades. Play animation and display message. - * + * * Argument: - * 0: The player (Object) - * 1: The vehicle (Object) - * 2: Skip the animation? Used after reloading (Bool) - * + * 0: Player + * 1: Target. Optional, if not suplied the player counts his personal or static weapon ammo + * * Return value: * Nothing */ @@ -15,87 +13,24 @@ #define COUNT_BARS 12 -private ["_unit", "_vehicle"]; +EXPLODE_1_PVT(_this,_unit); -_unit = _this select 0; -_vehicle = _this select 1; +private ["_target"]; +_target = vehicle _unit; -if (_unit != _vehicle && !(_vehicle isKindOf "StaticWeapon")) then { - _vehicle = _unit; +if (count _this > 1) then { + _target = _this select 1; +} else { + + // If the unit is on foot, count it's own ammo + if (_unit == _target) exitWith {}; + + // If it's mounted on a movile weapon, count it's own ammo + if !(_target isKindOf "StaticWeapon") then { + _target = _unit; + }; }; -[_vehicle, currentWeapon _vehicle, currentMuzzle _vehicle, currentMagazine _vehicle, _this select 2] spawn { - _vehicle = _this select 0; - _weapon = _this select 1; - _muzzle = _this select 2; - _magazine = _this select 3; - _skipDelay = _this select 4; +_unit playActionNow "Gear"; - if (currentWeapon _vehicle == "") exitWith {}; - if (typeName _muzzle != "STRING") then {_muzzle = _weapon}; - - _showNumber = false; - _ammo = 0; - _maxRounds = 1; - _count = 0; - - // not grenade launcher - if (_muzzle == _weapon) then { - _maxRounds = getNumber (configFile >> "CfgMagazines" >> _magazine >> "count") max 1; - - _ammo = _vehicle ammo _weapon; - if (_maxRounds >= COUNT_BARS) then { - _count = round (COUNT_BARS * _ammo / _maxRounds); - - if (_ammo > 0) then {_count = _count max 1}; - if (_ammo < _maxRounds) then {_count = _count min (COUNT_BARS - 1)}; - } else { - _count = _ammo; - }; - - // grenade launcher - } else { - _showNumber = true; - - _count = if (_magazine != "") then { - {_x == _magazine} count (magazines _vehicle + [_magazine]) - } else { - {_x in getArray (configFile >> "CfgWeapons" >> _weapon >> _muzzle >> "Magazines")} count magazines _vehicle - }; - }; - - if !(_skipDelay) then { - _vehicle playActionNow "Gear"; - sleep 1 - }; - - _text = if (_showNumber) then { - parseText format ["%1x", _count] - } else { - _color = [ - 2 * (1 - _ammo / _maxRounds) min 1, - 2 * _ammo / _maxRounds min 1, - 00 - ]; - - _string = ""; - for "_a" from 1 to _count do { - _string = _string + "|"; - }; - _text = [_string, _color] call EFUNC(common,stringToColoredText); - - _string = ""; - for "_a" from (_count + 1) to (_maxRounds min COUNT_BARS) do { - _string = _string + "|"; - }; - - composeText [ - _text, - [_string, [0.5, 0.5, 0.5]] call EFUNC(common,stringToColoredText) - ] - }; - - _picture = getText (configFile >> "CfgMagazines" >> _magazine >> "picture"); - - [_text, _picture] call EFUNC(common,displayTextPicture); -}; +[FUNC(displayAmmo), [_target], 1, 0.1] call EFUNC(common,waitAndExecute); diff --git a/addons/reload/functions/fnc_displayAmmo.sqf b/addons/reload/functions/fnc_displayAmmo.sqf new file mode 100644 index 0000000000..07e1a4593a --- /dev/null +++ b/addons/reload/functions/fnc_displayAmmo.sqf @@ -0,0 +1,94 @@ +/* + * Author: commy2 and CAA-Picard + * Display the ammo of the currently loaded magazine of the target or count rifle grenades. + * + * Argument: + * 0: Target + * + * Return value: + * Nothing + */ +#include "script_component.hpp" + +#define COUNT_BARS 12 + +EXPLODE_1_PVT(_this,_target); + +private ["_weapon","_muzzle","_magazine","_showNumber","_ammo","_maxRounds","_count","_text","_color","_picture"]; + +_weapon = currentWeapon _target; +_muzzle = currentMuzzle _target; +_magazine = currentMagazine _target; + +// currentWeapon returns "" for static weapons before they are shot once +if (_target isKindOf "StaticWeapon") then { + if (_weapon == "") then { + if (count (weapons _target) == 1) then { + _weapon = (weapons _target) select 0; + _muzzle = _weapon; + }; + }; +}; + +if (_weapon == "") exitWith {}; +if (typeName _muzzle != "STRING") then {_muzzle = _weapon}; + +_showNumber = false; +_ammo = 0; +_maxRounds = 1; +_count = 0; + +// not grenade launcher +if (_muzzle == _weapon) then { + _maxRounds = getNumber (configFile >> "CfgMagazines" >> _magazine >> "count") max 1; + + _ammo = _target ammo _weapon; + if (_maxRounds >= COUNT_BARS) then { + _count = round (COUNT_BARS * _ammo / _maxRounds); + + if (_ammo > 0) then {_count = _count max 1}; + if (_ammo < _maxRounds) then {_count = _count min (COUNT_BARS - 1)}; + } else { + _count = _ammo; + }; + +// grenade launcher +} else { + _showNumber = true; + + _count = if (_magazine != "") then { + {_x == _magazine} count (magazines _target + [_magazine]) + } else { + {_x in getArray (configFile >> "CfgWeapons" >> _weapon >> _muzzle >> "Magazines")} count magazines _target + }; +}; + +_text = if (_showNumber) then { + parseText format ["%1x", _count] +} else { + _color = [ + 2 * (1 - _ammo / _maxRounds) min 1, + 2 * _ammo / _maxRounds min 1, + 00 + ]; + + _string = ""; + for "_a" from 1 to _count do { + _string = _string + "|"; + }; + _text = [_string, _color] call EFUNC(common,stringToColoredText); + + _string = ""; + for "_a" from (_count + 1) to (_maxRounds min COUNT_BARS) do { + _string = _string + "|"; + }; + + composeText [ + _text, + [_string, [0.5, 0.5, 0.5]] call EFUNC(common,stringToColoredText) + ] +}; + +_picture = getText (configFile >> "CfgMagazines" >> _magazine >> "picture"); + +[_text, _picture] call EFUNC(common,displayTextPicture); diff --git a/addons/reload/functions/fnc_startLinkingBelt.sqf b/addons/reload/functions/fnc_startLinkingBelt.sqf new file mode 100644 index 0000000000..3b35a5a72a --- /dev/null +++ b/addons/reload/functions/fnc_startLinkingBelt.sqf @@ -0,0 +1,69 @@ +/* + * Author: CAA-Picard + * Start linking the belt + * + * Argument: + * 0: Player + * 1: Target + * + * Return value: + * None + */ +#include "script_component.hpp" + +EXPLODE_2_PVT(_this,_player,_target); + +if (vehicle _target != _target) exitWith {false}; + +private ["_magazineCfg","_magazineType"]; +_magazineType = currentMagazine _target; +_magazineCfg = configFile >> "CfgMagazines" >> _magazineType; +if (getNumber (_magazineCfg >> "ACE_isBelt") == 0) exitWith {false}; + +// Check if the ammo is not empty or full +private "_ammoCount"; +_ammoCount = _target ammo currentWeapon _target; + +// Exit if the belt is full or empty +if ((_ammoCount == 0) || (getNumber (_magazineCfg >> "count") - _ammoCount) == 0) exitWith {false}; + +// Check if the player has any of the same same magazines +// Calculate max ammo it can link +private "_maxAmmo"; +_maxAmmo = 0; + +{ + _maxAmmo = _maxAmmo max (_x select 1); +} forEach ([magazinesAmmo _player, {_this select 0 == _magazineType}] call EFUNC(common,filter)); + +if (_maxAmmo == 0) exitWith {}; + + +// Condition to call each frame +_condition = { + EXPLODE_2_PVT((_this select 0),_player,_target); + ([_player, _target] call EFUNC(common,canInteract)) && ((_player distance _target) < 3) && ((speed _target) < 1) +}; + +_onFinish = { + EXPLODE_3_PVT((_this select 0),_player,_target,_magazine); + + // Raise event on remote unit + ["linkedAmmo", [_target], [_target, _player, _magazine]] call EFUNC(common,targetEvent); +}; + +_onFailure = { + EXPLODE_3_PVT((_this select 0),_player,_target,_magazine); + [_caller, "AmovPknlMstpSrasWrflDnon", 1] call EFUNC(common,doAnimation); + + // Add back the magazine with the former ammo count + _player addMagazine _magazine; +}; + +[_player, "AinvPknlMstpSnonWnonDr_medic5", 0] call EFUNC(common,doAnimation); + +// Remove the magazine with maximum remaining ammo +[_player, _magazineType, _maxAmmo] call EFUNC(common,removeSpecificMagazine); + +// Call progress bar +[4, [_player, _target, [_magazineType, _maxAmmo]], _onFinish, _onFailure, (localize "STR_ACE_Reload_LinkingBelt"), _condition] call EFUNC(common,progressBar); diff --git a/addons/reload/stringtable.xml b/addons/reload/stringtable.xml index 1f39b0e743..18af718873 100644 --- a/addons/reload/stringtable.xml +++ b/addons/reload/stringtable.xml @@ -26,5 +26,11 @@ Munições Боеприпасы + + Link belt + + + Linking belt... + diff --git a/addons/respawn/CfgVehicles.hpp b/addons/respawn/CfgVehicles.hpp index bdf4576eb3..2a5d96ff95 100644 --- a/addons/respawn/CfgVehicles.hpp +++ b/addons/respawn/CfgVehicles.hpp @@ -78,13 +78,18 @@ class CfgVehicles { init = QUOTE((_this select 0) setFlagTexture '\A3\Data_F\Flags\Flag_nato_CO.paa'; _this call FUNC(initRallypoint)); }; class ACE_Actions : ACE_Actions { - class ACE_Teleport { - displayName = "Teleport to Rallypoint"; - distance = 4; - condition = QUOTE(side group _player == west); - statement = QUOTE([ARR_3(_player, side group _player, false)] call FUNC(teleportToRallypoint)); - showDisabled = 1; - priority = 1; + class ACE_MainActions { + distance = 5; + condition = "true"; + selection = ""; + class ACE_Teleport { + displayName = "Teleport to Rallypoint"; + distance = 4; + condition = QUOTE(side group _player == west); + statement = QUOTE([ARR_3(_player, side group _player, false)] call FUNC(teleportToRallypoint)); + showDisabled = 1; + priority = 1; + }; }; }; }; @@ -98,13 +103,18 @@ class CfgVehicles { init = QUOTE((_this select 0) setFlagTexture '\A3\Data_F\Flags\Flag_CSAT_CO.paa'; _this call FUNC(initRallypoint)); }; class ACE_Actions : ACE_Actions { - class ACE_Teleport { - displayName = "Teleport to Rallypoint"; - distance = 4; - condition = QUOTE(side group _player == east); - statement = QUOTE([ARR_3(_player, side group _player, false)] call FUNC(teleportToRallypoint)); - showDisabled = 1; - priority = 1; + class ACE_MainActions { + distance = 5; + condition = "true"; + selection = ""; + class ACE_Teleport { + displayName = "Teleport to Rallypoint"; + distance = 4; + condition = QUOTE(side group _player == east); + statement = QUOTE([ARR_3(_player, side group _player, false)] call FUNC(teleportToRallypoint)); + showDisabled = 1; + priority = 1; + }; }; }; }; @@ -118,13 +128,18 @@ class CfgVehicles { init = QUOTE((_this select 0) setFlagTexture '\A3\Data_F\Flags\Flag_AAF_CO.paa'; _this call FUNC(initRallypoint)); }; class ACE_Actions : ACE_Actions { - class ACE_Teleport { - displayName = "Teleport to Rallypoint"; - distance = 4; - condition = QUOTE(side group _player == independent); - statement = QUOTE([ARR_3(_player, side group _player, false)] call FUNC(teleportToRallypoint)); - showDisabled = 1; - priority = 1; + class ACE_MainActions { + distance = 5; + condition = "true"; + selection = ""; + class ACE_Teleport { + displayName = "Teleport to Rallypoint"; + distance = 4; + condition = QUOTE(side group _player == independent); + statement = QUOTE([ARR_3(_player, side group _player, false)] call FUNC(teleportToRallypoint)); + showDisabled = 1; + priority = 1; + }; }; }; }; @@ -139,13 +154,18 @@ class CfgVehicles { init = QUOTE((_this select 0) setFlagTexture '\A3\Data_F\Flags\Flag_nato_CO.paa'; _this call FUNC(initRallypoint)); }; class ACE_Actions : ACE_Actions { - class ACE_Teleport { - displayName = "Teleport to Base"; - distance = 4; - condition = QUOTE(side group _player == west); - statement = QUOTE([ARR_3(_player, side group _player, true)] call FUNC(teleportToRallypoint)); - showDisabled = 1; - priority = 1; + class ACE_MainActions { + distance = 5; + condition = "true"; + selection = ""; + class ACE_Teleport { + displayName = "Teleport to Base"; + distance = 4; + condition = QUOTE(side group _player == west); + statement = QUOTE([ARR_3(_player, side group _player, true)] call FUNC(teleportToRallypoint)); + showDisabled = 1; + priority = 1; + }; }; }; }; @@ -159,13 +179,18 @@ class CfgVehicles { init = QUOTE((_this select 0) setFlagTexture '\A3\Data_F\Flags\Flag_CSAT_CO.paa'; _this call FUNC(initRallypoint)); }; class ACE_Actions : ACE_Actions { - class ACE_Teleport { - displayName = "Teleport to Base"; - distance = 4; - condition = QUOTE(side group _player == east); - statement = QUOTE([ARR_3(_player, side group _player, true)] call FUNC(teleportToRallypoint)); - showDisabled = 1; - priority = 1; + class ACE_MainActions { + distance = 5; + condition = "true"; + selection = ""; + class ACE_Teleport { + displayName = "Teleport to Base"; + distance = 4; + condition = QUOTE(side group _player == east); + statement = QUOTE([ARR_3(_player, side group _player, true)] call FUNC(teleportToRallypoint)); + showDisabled = 1; + priority = 1; + }; }; }; }; @@ -179,13 +204,18 @@ class CfgVehicles { init = QUOTE((_this select 0) setFlagTexture '\A3\Data_F\Flags\Flag_AAF_CO.paa'; _this call FUNC(initRallypoint)); }; class ACE_Actions : ACE_Actions { - class ACE_Teleport { - displayName = "Teleport to Base"; - distance = 4; - condition = QUOTE(side group _player == independent); - statement = QUOTE([ARR_3(_player, side group _player, true)] call FUNC(teleportToRallypoint)); - showDisabled = 1; - priority = 1; + class ACE_MainActions { + distance = 5; + condition = "true"; + selection = ""; + class ACE_Teleport { + displayName = "Teleport to Base"; + distance = 4; + condition = QUOTE(side group _player == independent); + statement = QUOTE([ARR_3(_player, side group _player, true)] call FUNC(teleportToRallypoint)); + showDisabled = 1; + priority = 1; + }; }; }; }; diff --git a/addons/resting/data/icons/icon_bipod.paa b/addons/resting/data/icons/icon_bipod.paa new file mode 100644 index 0000000000..c2b6a2fb3e Binary files /dev/null and b/addons/resting/data/icons/icon_bipod.paa differ diff --git a/addons/resting/functions/fnc_restWeapon.sqf b/addons/resting/functions/fnc_restWeapon.sqf index 52b1932f62..793ef4fff3 100644 --- a/addons/resting/functions/fnc_restWeapon.sqf +++ b/addons/resting/functions/fnc_restWeapon.sqf @@ -27,6 +27,9 @@ _intersects = _this call FUNC(getIntersection); if (true in _intersects) then { _unit setVariable ["ACE_weaponRested", true]; + if (_unit == ACE_PLAYER) then { + [QGVAR(bipodDeployed), true, QUOTE(PATHTOF(data\icons\icon_bipod.paa)), [1,1,1,1], -1] call EFUNC(common,displayIcon); + }; private "_restedPosition"; _restedPosition = getPosASL _unit; diff --git a/addons/resting/functions/fnc_unRestWeapon.sqf b/addons/resting/functions/fnc_unRestWeapon.sqf index 86caa31ac8..2cf885676f 100644 --- a/addons/resting/functions/fnc_unRestWeapon.sqf +++ b/addons/resting/functions/fnc_unRestWeapon.sqf @@ -47,3 +47,7 @@ playSound QGVAR(unrest); _unit setVariable ["ACE_weaponRested", false]; _unit setVariable ["ACE_bipodDeployed", false]; + +if (_unit == ACE_PLAYER) then { + [QGVAR(bipodDeployed), false, "", [1,1,1,1], -1] call EFUNC(common,displayIcon); +}; \ No newline at end of file diff --git a/addons/smallarms/CfgWeapons.hpp b/addons/smallarms/CfgWeapons.hpp index 8c42847bd8..c0f4b4daef 100644 --- a/addons/smallarms/CfgWeapons.hpp +++ b/addons/smallarms/CfgWeapons.hpp @@ -1,6 +1,7 @@ class Mode_SemiAuto; class Mode_Burst; class Mode_FullAuto; +class MuzzleSlot; // config inheritance of weapon slot info v1.32 class SlotInfo; @@ -21,7 +22,7 @@ class CfgWeapons { class RifleCore; class Rifle: RifleCore { class WeaponSlotsInfo { - class MuzzleSlot: SlotInfo {}; + class MuzzleSlot: MuzzleSlot {}; class CowsSlot: CowsSlot {}; class PointerSlot: PointerSlot {}; }; diff --git a/addons/switchunits/CfgEventHandlers.hpp b/addons/switchunits/CfgEventHandlers.hpp index 38f9883743..689e06c529 100644 --- a/addons/switchunits/CfgEventHandlers.hpp +++ b/addons/switchunits/CfgEventHandlers.hpp @@ -9,3 +9,4 @@ class Extended_PostInit_EventHandlers { clientInit = QUOTE( call COMPILE_FILE(XEH_clientInit) ); }; }; + diff --git a/addons/switchunits/XEH_clientInit.sqf b/addons/switchunits/XEH_clientInit.sqf index 3075d67941..6a908071c9 100644 --- a/addons/switchunits/XEH_clientInit.sqf +++ b/addons/switchunits/XEH_clientInit.sqf @@ -16,24 +16,13 @@ #include "script_component.hpp" -DFUNC(pfhClientInit) = { - - if (GVAR(EnableSwitchUnits)) exitWith { - - private ["_sides"]; - _sides = []; - - if(GVAR(SwitchToWest)) then {_sides pushBack west;}; - if(GVAR(SwitchToEast)) then {_sides pushBack east;}; - if(GVAR(SwitchToIndependent)) then {_sides pushBack independent;}; - if(GVAR(SwitchToCivilian)) then {_sides pushBack civilian;}; - - if (player getVariable ["ACE_CanSwitchUnits", false]) then { - [player, _sides] call FUNC(initPlayer); +if (missionNamespace getVariable [QGVAR(EnableSwitchUnits), false]) then { + [player] call FUNC(startSwitchUnits); +} else { + ["SettingChanged", { + PARAMS_2(_name,_value); + if ((_name == QGVAR(EnableSwitchUnits)) && {_value}) then { + [player] call FUNC(startSwitchUnits); }; - - [(_this select 1)] call cba_fnc_removePerFrameHandler; - }; + }] call EFUNC(common,addEventhandler); }; - -[FUNC(pfhClientInit), 0.5, []] call cba_fnc_addPerFrameHandler; diff --git a/addons/switchunits/XEH_preInit.sqf b/addons/switchunits/XEH_preInit.sqf index 04e81330cb..c120608357 100644 --- a/addons/switchunits/XEH_preInit.sqf +++ b/addons/switchunits/XEH_preInit.sqf @@ -9,6 +9,7 @@ PREP(isValidAi); PREP(markAiOnMap); PREP(module); PREP(nearestPlayers); +PREP(startSwitchUnits); PREP(switchBack); PREP(switchUnit); diff --git a/addons/switchunits/config.cpp b/addons/switchunits/config.cpp index 09d3e05594..c400be855c 100644 --- a/addons/switchunits/config.cpp +++ b/addons/switchunits/config.cpp @@ -16,10 +16,6 @@ class CfgPatches { #include "CfgVehicles.hpp" class ACE_Settings { - class GVAR(SafeZoneRadius) { - value = 100; - typeName = "SCALAR"; - }; class GVAR(EnableSwitchUnits) { value = 0; typeName = "BOOL"; @@ -44,4 +40,8 @@ class ACE_Settings { value = 1; typeName = "BOOL"; }; + class GVAR(SafeZoneRadius) { + value = 100; + typeName = "SCALAR"; + }; }; diff --git a/addons/switchunits/functions/fnc_markAiOnMap.sqf b/addons/switchunits/functions/fnc_markAiOnMap.sqf index ed94c31b0b..d51c1b888e 100644 --- a/addons/switchunits/functions/fnc_markAiOnMap.sqf +++ b/addons/switchunits/functions/fnc_markAiOnMap.sqf @@ -40,9 +40,6 @@ DFUNC(pfhMarkAiOnMap) = { if (([_x] call FUNC(isValidAi) && (side group _x in _sides)) || (_x getVariable [QGVAR(IsPlayerControlled), false])) then { private ["_markerName", "_marker", "_markerColor"]; - hint format ["marker. %1", time]; - - //_markerName = format ["%1", [_x] call EFUNC(common,getName)]; _markerName = str _x; _marker = createMarkerLocal [_markerName, position _x]; diff --git a/addons/switchunits/functions/fnc_module.sqf b/addons/switchunits/functions/fnc_module.sqf index e622a65338..9563dea71f 100644 --- a/addons/switchunits/functions/fnc_module.sqf +++ b/addons/switchunits/functions/fnc_module.sqf @@ -20,8 +20,7 @@ if !(isServer) exitWith {}; -_logic = _this select 0; -_activated = _this select 2; +EXPLODE_3_PVT(_this,_logic,_units,_activated); if !(_activated) exitWith {}; diff --git a/addons/switchunits/functions/fnc_startSwitchUnits.sqf b/addons/switchunits/functions/fnc_startSwitchUnits.sqf new file mode 100644 index 0000000000..ef344475b9 --- /dev/null +++ b/addons/switchunits/functions/fnc_startSwitchUnits.sqf @@ -0,0 +1,36 @@ +/* + * Author: bux578 + * Starts the SwitchUnits functionality + * + * Arguments: + * 0: player + * + * Return Value: + * None + * + * Example: + * [_player] call FUNC(startSwitchUnits) + * + * Public: No + */ + +#include "script_component.hpp" + + +private "_player"; +_player = _this select 0; + + +if (GVAR(EnableSwitchUnits)) then { + private ["_sides"]; + _sides = []; + + if(GVAR(SwitchToWest)) then {_sides pushBack west;}; + if(GVAR(SwitchToEast)) then {_sides pushBack east;}; + if(GVAR(SwitchToIndependent)) then {_sides pushBack independent;}; + if(GVAR(SwitchToCivilian)) then {_sides pushBack civilian;}; + + if (_player getVariable ["ACE_CanSwitchUnits", false]) then { + [_player, _sides] call FUNC(initPlayer); + }; +}; diff --git a/addons/switchunits/script_component.hpp b/addons/switchunits/script_component.hpp index 989c1c2e0c..4e76fb1495 100644 --- a/addons/switchunits/script_component.hpp +++ b/addons/switchunits/script_component.hpp @@ -2,11 +2,11 @@ #include "\z\ace\addons\main\script_mod.hpp" #ifdef DEBUG_ENABLED_SWITCHUNITS - #define DEBUG_MODE_FULL + #define DEBUG_MODE_FULL #endif #ifdef DEBUG_SETTINGS_SWITCHUNITS - #define DEBUG_SETTINGS DEBUG_SETTINGS_SwitchUnits + #define DEBUG_SETTINGS DEBUG_SETTINGS_SwitchUnits #endif #include "\z\ace\addons\main\script_macros.hpp" diff --git a/addons/switchunits/stringtable.xml b/addons/switchunits/stringtable.xml index b12e8dc17d..842bf89127 100644 --- a/addons/switchunits/stringtable.xml +++ b/addons/switchunits/stringtable.xml @@ -1,5 +1,4 @@  - diff --git a/addons/vehiclelock/CfgVehicles.hpp b/addons/vehiclelock/CfgVehicles.hpp index 79591280d8..5be796c126 100644 --- a/addons/vehiclelock/CfgVehicles.hpp +++ b/addons/vehiclelock/CfgVehicles.hpp @@ -1,29 +1,31 @@ #define MACRO_LOCK_ACTIONS \ - class ACE_unlockVehicle { \ - displayName = "$STR_ACE_Vehicle_Action_UnLock"; \ - distance = 4; \ - condition = QUOTE(([ARR_2(_player, _target)] call FUNC(hasKeyForVehicle)) && {(locked _target) in [ARR_2(2,3)]}); \ - statement = QUOTE([ARR_3('SetVehicleLock', [_target], [ARR_2(_target,false)])] call EFUNC(common,targetEvent)); \ - showDisabled = 0; \ - priority = 0.3; \ - icon = QUOTE(PATHTOF(ui\key_menuIcon_ca.paa)); \ - }; \ - class ACE_lockVehicle { \ - displayName = "$STR_ACE_Vehicle_Action_Lock"; \ - distance = 4; \ - condition = QUOTE(([ARR_2(_player, _target)] call FUNC(hasKeyForVehicle)) && {(locked _target) in [ARR_2(0,1)]}); \ - statement = QUOTE([ARR_3('SetVehicleLock', [_target], [ARR_2(_target,true)])] call EFUNC(common,targetEvent)); \ - showDisabled = 0; \ - priority = 0.2; \ - icon = QUOTE(PATHTOF(ui\key_menuIcon_ca.paa)); \ - }; \ - class ACE_lockpickVehicle { \ - displayName = "$STR_ACE_Vehicle_Action_Lockpick"; \ - distance = 4; \ - condition = QUOTE([ARR_3(_player, _target, 'canLockpick')] call FUNC(lockpick)); \ - statement = QUOTE([ARR_3(_player, _target, 'startLockpick')] call FUNC(lockpick)); \ - showDisabled = 0; \ - priority = 0.1; \ + class ACE_MainActions { \ + class ACE_unlockVehicle { \ + displayName = "$STR_ACE_Vehicle_Action_UnLock"; \ + distance = 4; \ + condition = QUOTE(([ARR_2(_player, _target)] call FUNC(hasKeyForVehicle)) && {(locked _target) in [ARR_2(2,3)]}); \ + statement = QUOTE([ARR_3('SetVehicleLock', [_target], [ARR_2(_target,false)])] call EFUNC(common,targetEvent)); \ + showDisabled = 0; \ + priority = 0.3; \ + icon = QUOTE(PATHTOF(ui\key_menuIcon_ca.paa)); \ + }; \ + class ACE_lockVehicle { \ + displayName = "$STR_ACE_Vehicle_Action_Lock"; \ + distance = 4; \ + condition = QUOTE(([ARR_2(_player, _target)] call FUNC(hasKeyForVehicle)) && {(locked _target) in [ARR_2(0,1)]}); \ + statement = QUOTE([ARR_3('SetVehicleLock', [_target], [ARR_2(_target,true)])] call EFUNC(common,targetEvent)); \ + showDisabled = 0; \ + priority = 0.2; \ + icon = QUOTE(PATHTOF(ui\key_menuIcon_ca.paa)); \ + }; \ + class ACE_lockpickVehicle { \ + displayName = "$STR_ACE_Vehicle_Action_Lockpick"; \ + distance = 4; \ + condition = QUOTE([ARR_3(_player, _target, 'canLockpick')] call FUNC(lockpick)); \ + statement = QUOTE([ARR_3(_player, _target, 'startLockpick')] call FUNC(lockpick)); \ + showDisabled = 0; \ + priority = 0.1; \ + }; \ }; class CfgVehicles { diff --git a/addons/vehicles/CfgAmmo.hpp b/addons/vehicles/CfgAmmo.hpp index 60a3d0835b..96dd290625 100644 --- a/addons/vehicles/CfgAmmo.hpp +++ b/addons/vehicles/CfgAmmo.hpp @@ -1,7 +1,8 @@ class CfgAmmo { - class MissileBase; - class M_Mo_120mm_AT: MissileBase { + + class Missile_AGM_02_F; + class M_Mo_120mm_AT: Missile_AGM_02_F { cost = 400000; // Stop it from aiming at FUCKING RABBITS. weaponLockSystem = 2; }; @@ -11,6 +12,7 @@ class CfgAmmo { weaponLockSystem = 4; }; + class MissileBase; class M_Mo_82mm_AT: MissileBase { cost = 400000; weaponLockSystem = 2; diff --git a/addons/weather/XEH_postInit.sqf b/addons/weather/XEH_postInit.sqf index 7a97a1a788..caed3aa254 100644 --- a/addons/weather/XEH_postInit.sqf +++ b/addons/weather/XEH_postInit.sqf @@ -10,7 +10,8 @@ 30 setFog (ACE_MISC_PARAMS select 2); }; }; - +ACE_wind = wind; +if (true) exitwith {}; // Update Wind simulWeatherSync;