ACE3/addons/common/XEH_postInit.sqf

78 lines
2.4 KiB
Plaintext
Raw Normal View History

2015-01-12 18:22:58 +00:00
// ACE - Common
#include "script_component.hpp"
2015-01-11 18:20:14 +00:00
QGVAR(remoteFnc) addPublicVariableEventHandler {
2015-01-12 21:34:01 +00:00
(_this select 1) call FUNC(execRemoteFnc);
};
2015-01-11 18:20:14 +00:00
[missionNamespace] call FUNC(executePersistent);
// check previous version number from profile
2015-01-13 19:56:02 +00:00
_currentVersion = getText (configFile >> "CfgPatches" >> ADDON >> "version");
_previousVersion = profileNamespace getVariable ["ACE_VersionNumberString", ""];
if (_currentVersion != _previousVersion) then {
2015-01-12 21:34:01 +00:00
// do something
2015-01-12 21:34:01 +00:00
profileNamespace setVariable ["ACE_VersionNumberString", _currentVersion];
};
2015-01-12 13:12:50 +00:00
0 spawn COMPILE_FILE(scripts\Version\checkVersionNumber);
//add network event handlers
"ACEg" addPublicVariableEventHandler { _this call FUNC(_handletNetEvent); };
"ACEc" addPublicVariableEventHandler { _this call FUNC(_handletNetEvent); };
// everything that only player controlled machines need, goes below this
if (!hasInterface) exitWith {};
2015-01-12 13:12:50 +00:00
call COMPILE_FILE(scripts\assignedItemFix);
2015-01-12 13:12:50 +00:00
GVAR(keyInput) = COMPILE_FILE(scripts\keyInput);
GVAR(keyRelease) = COMPILE_FILE(scripts\keyRelease);
GVAR(editKey) = COMPILE_FILE(scripts\editKey);
GVAR(openMenu) = COMPILE_FILE(scripts\openMenu);
GVAR(closeMenu) = COMPILE_FILE(scripts\closeMenu);
GVAR(nextKeys) = COMPILE_FILE(scripts\nextKeys);
GVAR(toggleState) = COMPILE_FILE(scripts\toggleState);
2015-01-11 18:20:14 +00:00
[false] call FUNC(setKeyDefault);
GVAR(keyStates) = [];
GVAR(keyTimes) = [];
for "_index" from 0 to 300 do {
2015-01-12 21:34:01 +00:00
GVAR(keyStates) set [_index, 0];
GVAR(keyTimes) set [_index, -1];
};
2015-01-12 13:12:50 +00:00
call COMPILE_FILE(scripts\KeyInput\initCanInteractFunction);
call COMPILE_FILE(scripts\KeyInput\initKeys);
call COMPILE_FILE(scripts\KeyInput\initScrollWheel);
0 spawn {
2015-01-12 21:34:01 +00:00
while {true} do {
waitUntil {!isNull (findDisplay 46)}; sleep 0.1;
findDisplay 46 displayAddEventHandler ["KeyDown", QUOTE( _this call GVAR(onKeyDown) )];
findDisplay 46 displayAddEventHandler ["KeyUp", QUOTE( _this call GVAR(onKeyUp) )];
findDisplay 46 displayAddEventHandler ["MouseZChanged", QUOTE( _this call GVAR(onScrollWheel) )];
[false] call FUNC(disableUserInput);
waitUntil {isNull (findDisplay 46)};
};
};
enableCamShake true;
// Set the name for the current player
["playerChanged", {
EXPLODE_2_PVT(_this,_newPlayer,_oldPlayer);
if (alive _newPlayer) then {
[_newPlayer] call FUNC(setName)
2015-01-12 21:34:01 +00:00
};
if (alive _oldPlayer) then {
[_oldPlayer] call FUNC(setName)
2015-01-12 21:34:01 +00:00
};
}] call FUNC(addEventhandler);