2015-01-12 18:22:58 +00:00
|
|
|
// ACE - Common
|
2015-01-12 04:02:33 +00:00
|
|
|
#include "script_component.hpp"
|
2015-01-11 16:42:31 +00:00
|
|
|
|
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 16:42:31 +00:00
|
|
|
};
|
|
|
|
|
2015-01-11 18:20:14 +00:00
|
|
|
[missionNamespace] call FUNC(executePersistent);
|
2015-01-11 16:42:31 +00:00
|
|
|
|
|
|
|
// check previous version number from profile
|
2015-01-17 11:35:59 +00:00
|
|
|
_currentVersion = getText (configFile >> "CfgPatches" >> QUOTE(ADDON) >> "version");
|
2015-01-12 04:02:33 +00:00
|
|
|
_previousVersion = profileNamespace getVariable ["ACE_VersionNumberString", ""];
|
2015-01-11 16:42:31 +00:00
|
|
|
|
|
|
|
if (_currentVersion != _previousVersion) then {
|
2015-01-12 21:34:01 +00:00
|
|
|
// do something
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-01-12 21:34:01 +00:00
|
|
|
profileNamespace setVariable ["ACE_VersionNumberString", _currentVersion];
|
2015-01-11 16:42:31 +00:00
|
|
|
};
|
|
|
|
|
2015-01-12 13:12:50 +00:00
|
|
|
0 spawn COMPILE_FILE(scripts\Version\checkVersionNumber);
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-01-17 01:12:37 +00:00
|
|
|
"ACEg" addPublicVariableEventHandler { _this call FUNC(_handleNetEvent); };
|
|
|
|
"ACEc" addPublicVariableEventHandler { _this call FUNC(_handleNetEvent); };
|
2015-01-13 23:27:42 +00:00
|
|
|
|
2015-01-11 16:42:31 +00:00
|
|
|
// 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-11 16:42:31 +00:00
|
|
|
|
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 16:42:31 +00:00
|
|
|
|
2015-01-11 18:20:14 +00:00
|
|
|
[false] call FUNC(setKeyDefault);
|
2015-01-11 16:42:31 +00:00
|
|
|
|
|
|
|
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-11 16:42:31 +00:00
|
|
|
};
|
|
|
|
|
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);
|
2015-01-11 16:42:31 +00:00
|
|
|
|
|
|
|
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)};
|
|
|
|
};
|
2015-01-11 16:42:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enableCamShake true;
|
|
|
|
|
2015-01-12 04:02:33 +00:00
|
|
|
// Set the name for the current player
|
2015-01-16 15:14:18 +00:00
|
|
|
["playerChanged", {
|
|
|
|
EXPLODE_2_PVT(_this,_newPlayer,_oldPlayer);
|
|
|
|
|
|
|
|
if (alive _newPlayer) then {
|
|
|
|
[_newPlayer] call FUNC(setName)
|
2015-01-12 21:34:01 +00:00
|
|
|
};
|
2015-01-16 15:14:18 +00:00
|
|
|
if (alive _oldPlayer) then {
|
|
|
|
[_oldPlayer] call FUNC(setName)
|
2015-01-12 21:34:01 +00:00
|
|
|
};
|
2015-01-16 23:21:47 +00:00
|
|
|
|
2015-01-16 15:14:18 +00:00
|
|
|
}] call FUNC(addEventhandler);
|
2015-01-13 23:27:42 +00:00
|
|
|
|
2015-01-16 18:28:37 +00:00
|
|
|
GVAR(OldPlayerInventory) = ACE_player call FUNC(getAllGear);
|
2015-01-16 18:39:19 +00:00
|
|
|
GVAR(OldPlayerVisionMode) = currentVisionMode ACE_player;
|
2015-01-16 18:39:38 +00:00
|
|
|
GVAR(OldZeusDisplayIsOpen) = !(isNull findDisplay 312);
|
2015-01-16 20:16:42 +00:00
|
|
|
GVAR(OldCameraView) = cameraView;
|
|
|
|
GVAR(OldPlayerVehicle) = vehicle ACE_player;
|
|
|
|
GVAR(OldPlayerTurret) = [ACE_player] call FUNC(getTurretIndex);
|
2015-01-13 23:27:42 +00:00
|
|
|
|
2015-01-16 18:39:19 +00:00
|
|
|
// PFH to raise varios events
|
2015-01-16 18:28:37 +00:00
|
|
|
[{
|
2015-01-16 18:39:38 +00:00
|
|
|
|
2015-01-16 18:39:19 +00:00
|
|
|
// "playerInventoryChanged" event
|
2015-01-16 18:28:37 +00:00
|
|
|
_newPlayerInventory = ACE_player call FUNC(getAllGear);
|
2015-01-16 19:30:48 +00:00
|
|
|
if !(_newPlayerInventory isEqualTo GVAR(OldPlayerInventory)) then {
|
2015-01-16 18:39:19 +00:00
|
|
|
// Raise ACE event locally
|
2015-01-16 18:28:37 +00:00
|
|
|
GVAR(OldPlayerInventory) = _newPlayerInventory;
|
|
|
|
["playerInventoryChanged", [ACE_player, _newPlayerInventory]] call FUNC(localEvent);
|
|
|
|
};
|
2015-01-16 18:39:19 +00:00
|
|
|
|
|
|
|
// "playerVisionModeChanged" event
|
2015-01-16 19:30:48 +00:00
|
|
|
_newPlayerVisionMode = currentVisionMode ACE_player;
|
|
|
|
if !(_newPlayerVisionMode isEqualTo GVAR(OldPlayerVisionMode)) then {
|
2015-01-16 18:39:19 +00:00
|
|
|
// Raise ACE event locally
|
|
|
|
GVAR(OldPlayerVisionMode) = _newPlayerVisionMode;
|
|
|
|
["playerVisionModeChanged", [ACE_player, _newPlayerVisionMode]] call FUNC(localEvent);
|
|
|
|
};
|
|
|
|
|
2015-01-18 05:45:28 +00:00
|
|
|
// "inventoryDisplayChanged" event
|
|
|
|
_newInventoryDisplayIsOpen = !(isNull findDisplay 602);
|
|
|
|
if !(_newInventoryDisplayIsOpen isEqualTo GVAR(OldInventoryDisplayIsOpen)) then {
|
|
|
|
// Raise ACE event locally
|
|
|
|
GVAR(OldInventoryDisplayIsOpen) = _newInventoryDisplayIsOpen;
|
|
|
|
["inventoryDisplayChanged", [ACE_player, _newInventoryDisplayIsOpen]] call FUNC(localEvent);
|
|
|
|
};
|
|
|
|
|
2015-01-16 18:39:38 +00:00
|
|
|
// "zeusDisplayChanged" event
|
|
|
|
_newZeusDisplayIsOpen = !(isNull findDisplay 312);
|
2015-01-16 19:30:48 +00:00
|
|
|
if !(_newZeusDisplayIsOpen isEqualTo GVAR(OldZeusDisplayIsOpen)) then {
|
2015-01-16 18:39:38 +00:00
|
|
|
// Raise ACE event locally
|
|
|
|
GVAR(OldZeusDisplayIsOpen) = _newZeusDisplayIsOpen;
|
|
|
|
["zeusDisplayChanged", [ACE_player, _newZeusDisplayIsOpen]] call FUNC(localEvent);
|
|
|
|
};
|
2015-01-16 18:39:19 +00:00
|
|
|
|
2015-01-16 20:16:42 +00:00
|
|
|
// "cameraViewChanged" event
|
|
|
|
_newCameraView = cameraView;
|
|
|
|
if !(_newCameraView isEqualTo GVAR(OldCameraView)) then {
|
|
|
|
// Raise ACE event locally
|
|
|
|
GVAR(OldCameraView) = _newCameraView;
|
|
|
|
["cameraViewChanged", [ACE_player, _newCameraView]] call FUNC(localEvent);
|
|
|
|
};
|
|
|
|
|
|
|
|
// "playerVehicleChanged" event
|
|
|
|
_newPlayerVehicle = vehicle ACE_player;
|
|
|
|
if !(_newPlayerVehicle isEqualTo GVAR(OldPlayerVehicle)) then {
|
|
|
|
// Raise ACE event locally
|
|
|
|
GVAR(OldPlayerVehicle) = _newPlayerVehicle;
|
|
|
|
["playerVehicleChanged", [ACE_player, _newPlayerVehicle]] call FUNC(localEvent);
|
|
|
|
};
|
|
|
|
|
|
|
|
// "playerTurretChanged" event
|
|
|
|
[ACE_player] call FUNC(getTurretIndex);
|
|
|
|
if !(_newPlayerTurret isEqualTo GVAR(OldPlayerTurret)) then {
|
|
|
|
// Raise ACE event locally
|
|
|
|
GVAR(OldPlayerTurret) = _newPlayerTurret;
|
|
|
|
["playerTurretChanged", [ACE_player, _newPlayerTurret]] call FUNC(localEvent);
|
|
|
|
};
|
|
|
|
|
2015-01-16 18:28:37 +00:00
|
|
|
}, 0, []] call cba_fnc_addPerFrameHandler;
|
2015-01-16 23:21:47 +00:00
|
|
|
|
|
|
|
|
2015-01-17 12:35:15 +00:00
|
|
|
[QGVAR(reviveCounter_f), 0, false, QGVAR(ADDON)] call FUNC(defineVariable);
|
2015-01-16 23:21:47 +00:00
|
|
|
[QGVAR(inReviveState), false, true, QGVAR(ADDON)] call FUNC(defineVariable);
|
|
|
|
[QGVAR(isDead),false,true,QUOTE(ADDON)] call FUNC(defineVariable);
|
|
|
|
[QGVAR(isDeadPlayer), false, true, QUOTE(ADDON)] call FUNC(defineVariable);
|
|
|
|
[QGVAR(StateArrested),false,true,QUOTE(ADDON)] call FUNC(defineVariable);
|
2015-01-17 13:13:37 +00:00
|
|
|
["ACE_isUnconscious",false,true,QUOTE(ADDON)] call FUNC(defineVariable);
|
2015-01-16 23:21:47 +00:00
|
|
|
[QGVAR(ENABLE_REVIVE_SETDEAD_F),0,false,QUOTE(ADDON)] call FUNC(defineVariable);
|
|
|
|
[QGVAR(carriedBy),objNull,false,QUOTE(ADDON)] call FUNC(defineVariable);
|
|
|
|
|
|
|
|
if (isNil QGVAR(ENABLE_REVIVE_F)) then {
|
|
|
|
GVAR(ENABLE_REVIVE_F) = 0;
|
2015-01-17 12:35:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
[
|
|
|
|
{((_this select 0) getvariable [QGVAR(inReviveState), false])}
|
|
|
|
] call EFUNC(common,registerUnconsciousCondition);
|