ACE3/addons/interact_menu/XEH_clientInit.sqf
SilentSpike 108ff4f644 Replace ACE event system calls with CBA counterparts
Regex used:

\[(.+?),(.+?),(.+?)\]\s+call\s+E?FUNC\((common,)?(target|object)Event\)
[$1,$3,$2] call CBA_fnc_targetEvent

E?FUNC\((common,)?(server|global|local)Event\)
CBA_fnc_$2Event

E?FUNC\((common,)?(add|remove)EventHandler\)
CBA_fnc_$2EventHandler
2016-05-22 16:47:39 +01:00

68 lines
2.5 KiB
Plaintext

//XEH_clientInit.sqf
#include "script_component.hpp"
if (!hasInterface) exitWith {};
GVAR(cachedBuildingTypes) = [];
GVAR(cachedBuildingActionPairs) = [];
GVAR(ParsedTextCached) = [];
["SettingChanged", {
params ["_name"];
if (({_x == _name} count [QGVAR(colorTextMax), QGVAR(colorTextMin), QGVAR(colorShadowMax), QGVAR(colorShadowMin), QGVAR(textSize), QGVAR(shadowSetting)]) == 1) then {
[] call FUNC(setupTextColors);
};
}] call CBA_fnc_addEventHandler;
["SettingsInitialized", {
//Setup text/shadow/size/color settings matrix
[] call FUNC(setupTextColors);
// Install the render EH on the main display
addMissionEventHandler ["Draw3D", DFUNC(render)];
}] call CBA_fnc_addEventHandler;
//Add Actions to Houses:
["interactMenuOpened", {_this call FUNC(userActions_addHouseActions)}] call CBA_fnc_addEventHandler;
["ACE3 Common", QGVAR(InteractKey), (localize LSTRING(InteractKey)),
{
// Statement
[0] call FUNC(keyDown)
},{[0,false] call FUNC(keyUp)},
[219, [false, false, false]], false] call CBA_fnc_addKeybind; //Left Windows Key
["ACE3 Common", QGVAR(SelfInteractKey), (localize LSTRING(SelfInteractKey)),
{
// Statement
[1] call FUNC(keyDown)
},{[1,false] call FUNC(keyUp)},
[219, [false, true, false]], false] call CBA_fnc_addKeybind; //Left Windows Key + Ctrl/Strg
// Listens for the falling unconscious event, just in case the menu needs to be closed
["medical_onUnconscious", {
// If no menu is open just quit
if (GVAR(openedMenuType) < 0) exitWith {};
params ["_unit", "_isUnconscious"];
if (_unit != ACE_player || !_isUnconscious) exitWith {};
GVAR(actionSelected) = false;
[GVAR(openedMenuType), false] call FUNC(keyUp);
}] call CBA_fnc_addEventHandler;
// disable firing while the interact menu is is is opened
["playerChanged", {_this call FUNC(handlePlayerChanged)}] call CBA_fnc_addEventHandler;
// background options
["interactMenuOpened", {
if (GVAR(menuBackground)==1) then {[QGVAR(menuBackground), true] call EFUNC(common,blurScreen);};
if (GVAR(menuBackground)==2) then {0 cutRsc[QGVAR(menuBackground), "PLAIN", 1, false];};
}] call CBA_fnc_addEventHandler;
["interactMenuClosed", {
if (GVAR(menuBackground)==1) then {[QGVAR(menuBackground), false] call EFUNC(common,blurScreen);};
if (GVAR(menuBackground)==2) then {(uiNamespace getVariable [QGVAR(menuBackground), displayNull]) closeDisplay 0;};
}] call CBA_fnc_addEventHandler;