mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge pull request #2551 from acemod/commoncleanup11
common code cleanup part 11
This commit is contained in:
commit
a1b2d63417
@ -1,16 +1,18 @@
|
||||
// ACE - Common
|
||||
|
||||
// #define ENABLE_PERFORMANCE_COUNTERS
|
||||
#include "script_component.hpp"
|
||||
|
||||
//IGNORE_PRIVATE_WARNING("_handleNetEvent", "_handleRequestAllSyncedEvents", "_handleRequestSyncedEvent", "_handleSyncedEvent");
|
||||
// #define ENABLE_PERFORMANCE_COUNTERS
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
// PFHs
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
//Singe PFEH to handle execNextFrame and waitAndExec:
|
||||
[{
|
||||
private ["_entry"];
|
||||
private "_entry";
|
||||
|
||||
//Handle the waitAndExec array:
|
||||
while {((count GVAR(waitAndExecArray)) > 0) && {((GVAR(waitAndExecArray) select 0) select 0) <= ACE_Time}} do {
|
||||
while {!(GVAR(waitAndExecArray) isEqualTo []) && {GVAR(waitAndExecArray) select 0 select 0 <= ACE_Time}} do {
|
||||
_entry = GVAR(waitAndExecArray) deleteAt 0;
|
||||
(_entry select 2) call (_entry select 1);
|
||||
};
|
||||
@ -18,7 +20,9 @@
|
||||
//Handle the execNextFrame array:
|
||||
{
|
||||
(_x select 0) call (_x select 1);
|
||||
} forEach GVAR(nextFrameBufferA);
|
||||
false
|
||||
} count GVAR(nextFrameBufferA);
|
||||
|
||||
//Swap double-buffer:
|
||||
GVAR(nextFrameBufferA) = GVAR(nextFrameBufferB);
|
||||
GVAR(nextFrameBufferB) = [];
|
||||
@ -26,39 +30,46 @@
|
||||
}, 0, []] call CBA_fnc_addPerFrameHandler;
|
||||
|
||||
|
||||
// Listens for global "SettingChanged" events, to update the force status locally
|
||||
["SettingChanged", {
|
||||
PARAMS_2(_name,_value);
|
||||
if !(count _this > 2) exitWith {};
|
||||
private ["_force", "_settingData"];
|
||||
_force = _this select 2;
|
||||
if (_force) then {
|
||||
_settingData = [_name] call FUNC(getSettingData);
|
||||
if (count _settingData == 0) exitWith {};
|
||||
_settingData set [6,_force];
|
||||
};
|
||||
}] call FUNC(addEventhandler);
|
||||
//////////////////////////////////////////////////
|
||||
// Get Map Data
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
|
||||
["HeadbugFixUsed", {
|
||||
PARAMS_2(_profileName,_animation);
|
||||
ACE_LOGINFO_2("Headbug Used: Name: %1, Animation: %2",_profileName,_animation);
|
||||
}] call FUNC(addEventHandler);
|
||||
|
||||
|
||||
//~~~~~Get Map Data~~~~~
|
||||
//Find MGRS zone and 100km grid for current map
|
||||
[] call FUNC(getMGRSdata);
|
||||
//Prepare variables for FUNC(getMapGridFromPos)/FUNC(getMapPosFromGrid)
|
||||
[] call FUNC(getMapGridData);
|
||||
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
// Eventhandlers
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
["fixCollision", DFUNC(fixCollision)] call FUNC(addEventhandler);
|
||||
["fixFloating", DFUNC(fixFloating)] call FUNC(addEventhandler);
|
||||
["fixPosition", DFUNC(fixPosition)] call FUNC(addEventhandler);
|
||||
// Listens for global "SettingChanged" events, to update the force status locally
|
||||
["SettingChanged", {
|
||||
params ["_name", "_value", "_force"];
|
||||
|
||||
["unloadPersonEvent", DFUNC(unloadPersonLocal)] call FUNC(addEventhandler);
|
||||
if (_force) then {
|
||||
private "_settingData";
|
||||
_settingData = [_name] call FUNC(getSettingData);
|
||||
|
||||
if (_settingData isEqualTo []) exitWith {};
|
||||
|
||||
_settingData set [6, _force];
|
||||
};
|
||||
}] call FUNC(addEventhandler);
|
||||
|
||||
|
||||
// Event to log Fix Headbug output
|
||||
["HeadbugFixUsed", {
|
||||
params ["_profileName", "_animation"];
|
||||
ACE_LOGINFO_2("Headbug Used: Name: %1, Animation: %2",_profileName,_animation);
|
||||
}] call FUNC(addEventHandler);
|
||||
|
||||
["fixCollision", FUNC(fixCollision)] call FUNC(addEventhandler);
|
||||
["fixFloating", FUNC(fixFloating)] call FUNC(addEventhandler);
|
||||
["fixPosition", FUNC(fixPosition)] call FUNC(addEventhandler);
|
||||
|
||||
["unloadPersonEvent", FUNC(unloadPersonLocal)] call FUNC(addEventhandler);
|
||||
|
||||
["lockVehicle", {
|
||||
_this setVariable [QGVAR(lockStatus), locked _this];
|
||||
@ -77,22 +88,10 @@ if (isServer) then {
|
||||
["hideObjectGlobal", {(_this select 0) hideObjectGlobal (_this select 1)}] call FUNC(addEventHandler);
|
||||
};
|
||||
|
||||
QGVAR(remoteFnc) addPublicVariableEventHandler {
|
||||
(_this select 1) call FUNC(execRemoteFnc);
|
||||
};
|
||||
|
||||
[missionNamespace] call FUNC(executePersistent);
|
||||
|
||||
private ["_currentVersion", "_previousVersion"];
|
||||
// check previous version number from profile
|
||||
_currentVersion = getText (configFile >> "CfgPatches" >> QUOTE(ADDON) >> "version");
|
||||
_previousVersion = profileNamespace getVariable ["ACE_VersionNumberString", ""];
|
||||
|
||||
if (_currentVersion != _previousVersion) then {
|
||||
// do something
|
||||
|
||||
profileNamespace setVariable ["ACE_VersionNumberString", _currentVersion];
|
||||
};
|
||||
//////////////////////////////////////////////////
|
||||
// Set up remote execution
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
// ACE events
|
||||
"ACEg" addPublicVariableEventHandler { _this call FUNC(_handleNetEvent); };
|
||||
@ -100,7 +99,7 @@ if (_currentVersion != _previousVersion) then {
|
||||
|
||||
// Synced ACE events
|
||||
// Handle JIP scenario
|
||||
if(!isServer) then {
|
||||
if (!isServer) then {
|
||||
["PlayerJip", {
|
||||
ACE_LOGINFO("JIP event synchronization initialized");
|
||||
["SEH_all", [player]] call FUNC(serverEvent);
|
||||
@ -108,31 +107,72 @@ if(!isServer) then {
|
||||
} else {
|
||||
["SEH_all", FUNC(_handleRequestAllSyncedEvents)] call FUNC(addEventHandler);
|
||||
};
|
||||
|
||||
["SEH", FUNC(_handleSyncedEvent)] call FUNC(addEventHandler);
|
||||
["SEH_s", FUNC(_handleRequestSyncedEvent)] call FUNC(addEventHandler);
|
||||
|
||||
if (isServer) then {
|
||||
[FUNC(syncedEventPFH), 0.5, []] call CBA_fnc_addPerFrameHandler;
|
||||
};
|
||||
|
||||
// @todo deprecated
|
||||
QGVAR(remoteFnc) addPublicVariableEventHandler {
|
||||
(_this select 1) call FUNC(execRemoteFnc);
|
||||
};
|
||||
|
||||
// @todo figure out what this does.
|
||||
[missionNamespace] call FUNC(executePersistent);
|
||||
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
// Check files, previous installed version etc.
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
private ["_currentVersion", "_previousVersion"];
|
||||
|
||||
_currentVersion = getText (configFile >> "CfgPatches" >> QUOTE(ADDON) >> "version");
|
||||
_previousVersion = profileNamespace getVariable ["ACE_VersionNumberString", ""];
|
||||
|
||||
// check previous version number from profile
|
||||
if (_currentVersion != _previousVersion) then {
|
||||
// do something
|
||||
|
||||
profileNamespace setVariable ["ACE_VersionNumberString", _currentVersion];
|
||||
};
|
||||
|
||||
call FUNC(checkFiles);
|
||||
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
// Set up SettingsInitialized eventhandler
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
["SettingsInitialized", {
|
||||
[
|
||||
GVAR(checkPBOsAction),
|
||||
GVAR(checkPBOsCheckAll),
|
||||
call compile GVAR(checkPBOsWhitelist)
|
||||
] call FUNC(checkPBOs)
|
||||
}] call FUNC(addEventHandler);
|
||||
|
||||
// Create a pfh to wait until all postinits are ready and settings are initialized
|
||||
[{
|
||||
PARAMS_1(_args);
|
||||
EXPLODE_1_PVT(_args,_waitingMsgSent);
|
||||
params ["_args"];
|
||||
|
||||
_args params ["_waitingMsgSent"];
|
||||
|
||||
// If post inits are not ready then wait
|
||||
if !(SLX_XEH_MACHINE select 8) exitWith {};
|
||||
|
||||
// If settings are not initialized then wait
|
||||
if (isNil QGVAR(settings) || {(!isServer) && (isNil QEGVAR(modules,serverModulesRead))}) exitWith {
|
||||
if (!_waitingMsgSent) then {
|
||||
if (isNil QGVAR(settings) || {!isServer && isNil QEGVAR(modules,serverModulesRead)}) exitWith {
|
||||
if !(_waitingMsgSent) then {
|
||||
_args set [0, true];
|
||||
ACE_LOGINFO("Waiting on settings from server...");
|
||||
};
|
||||
};
|
||||
|
||||
[(_this select 1)] call cba_fnc_removePerFrameHandler;
|
||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||
|
||||
ACE_LOGINFO("Settings received from server.");
|
||||
|
||||
@ -152,230 +192,272 @@ call FUNC(checkFiles);
|
||||
|
||||
//Set init finished and run all delayed functions:
|
||||
GVAR(settingsInitFinished) = true;
|
||||
diag_log text format ["[ACE] %1 delayed functions running", (count GVAR(runAtSettingsInitialized))];
|
||||
ACE_LOGINFO_1("%1 delayed functions running.",count GVAR(runAtSettingsInitialized));
|
||||
|
||||
{
|
||||
_x params ["_func", "_params"];
|
||||
_params call _func;
|
||||
} forEach GVAR(runAtSettingsInitialized);
|
||||
(_x select 1) call (_x select 0);
|
||||
false
|
||||
} count GVAR(runAtSettingsInitialized);
|
||||
|
||||
GVAR(runAtSettingsInitialized) = nil; //cleanup
|
||||
|
||||
}, 0, [false]] call CBA_fnc_addPerFrameHandler;
|
||||
|
||||
|
||||
["SettingsInitialized", {
|
||||
[
|
||||
GVAR(checkPBOsAction),
|
||||
GVAR(checkPBOsCheckAll),
|
||||
call compile GVAR(checkPBOsWhitelist)
|
||||
] call FUNC(checkPBOs)
|
||||
}] call FUNC(addEventHandler);
|
||||
/***************************************************************************/
|
||||
/***************************************************************************/
|
||||
/** everything that only player controlled machines need, goes below this **/
|
||||
/***************************************************************************/
|
||||
/***************************************************************************/
|
||||
|
||||
|
||||
/***************************************************************/
|
||||
/***************************************************************/
|
||||
/***************************************************************/
|
||||
/***************************************************************/
|
||||
/***************************************************************/
|
||||
|
||||
// everything that only player controlled machines need, goes below this
|
||||
if (!hasInterface) exitWith {};
|
||||
|
||||
call COMPILE_FILE(scripts\assignedItemFix);
|
||||
call COMPILE_FILE(scripts\initScrollWheel);
|
||||
//////////////////////////////////////////////////
|
||||
// Set up mouse wheel eventhandler
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
DFUNC(mouseZHandler) = {
|
||||
waitUntil {!isNull (findDisplay 46)}; sleep 0.1;
|
||||
findDisplay 46 displayAddEventHandler ["MouseZChanged", QUOTE( _this call GVAR(onScrollWheel) )];
|
||||
[false] call FUNC(disableUserInput);
|
||||
};
|
||||
call FUNC(assignedItemFix);
|
||||
|
||||
addMissionEventHandler ["Loaded", {[] spawn FUNC(mouseZHandler)}];
|
||||
[] spawn FUNC(mouseZHandler);
|
||||
GVAR(ScrollWheelFrame) = diag_frameno;
|
||||
|
||||
addMissionEventHandler ["Loaded", {call FUNC(handleScrollWheelInit)}];
|
||||
call FUNC(handleScrollWheelInit);
|
||||
|
||||
// @todo remove?
|
||||
enableCamShake true;
|
||||
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
// Eventhandler to set player names
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
// Set the name for the current player
|
||||
["playerChanged", {
|
||||
EXPLODE_2_PVT(_this,_newPlayer,_oldPlayer);
|
||||
params ["_newPlayer","_oldPlayer"];
|
||||
|
||||
if (alive _newPlayer) then {
|
||||
[_newPlayer] call FUNC(setName)
|
||||
};
|
||||
if (alive _oldPlayer) then {
|
||||
[_oldPlayer] call FUNC(setName)
|
||||
[_newPlayer] call FUNC(setName);
|
||||
};
|
||||
|
||||
if (alive _oldPlayer) then {
|
||||
[_oldPlayer] call FUNC(setName);
|
||||
};
|
||||
}] call FUNC(addEventhandler);
|
||||
|
||||
GVAR(OldPlayerInventory) = [ACE_player] call FUNC(getAllGear);
|
||||
GVAR(OldPlayerVisionMode) = currentVisionMode ACE_player;
|
||||
GVAR(OldZeusDisplayIsOpen) = !(isNull findDisplay 312);
|
||||
GVAR(OldCameraView) = cameraView;
|
||||
GVAR(OldPlayerVehicle) = vehicle ACE_player;
|
||||
GVAR(OldPlayerTurret) = [ACE_player] call FUNC(getTurretIndex);
|
||||
GVAR(OldPlayerWeapon) = currentWeapon ACE_player;
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
// Set up numerous eventhanders for player controlled units
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
// default variables
|
||||
GVAR(OldPlayerVehicle) = vehicle objNull;
|
||||
GVAR(OldPlayerTurret) = [objNull] call FUNC(getTurretIndex);
|
||||
GVAR(OldPlayerWeapon) = currentWeapon objNull;
|
||||
GVAR(OldPlayerInventory) = [objNull] call FUNC(getAllGear);
|
||||
GVAR(OldPlayerVisionMode) = currentVisionMode objNull;
|
||||
GVAR(OldCameraView) = "";
|
||||
GVAR(OldVisibleMap) = false;
|
||||
GVAR(OldInventoryDisplayIsOpen) = nil; //@todo check this
|
||||
GVAR(OldZeusDisplayIsOpen) = false;
|
||||
GVAR(OldIsCamera) = false;
|
||||
|
||||
// clean up playerChanged eventhandler from preinit and put it in the same PFH as the other events to reduce overhead and guarantee advantageous execution order
|
||||
if (!isNil QGVAR(PreInit_playerChanged_PFHID)) then {
|
||||
[GVAR(PreInit_playerChanged_PFHID)] call CBA_fnc_removePerFrameHandler;
|
||||
GVAR(PreInit_playerChanged_PFHID) = nil;
|
||||
};
|
||||
|
||||
// PFH to raise varios events
|
||||
[{
|
||||
BEGIN_COUNTER(stateChecker);
|
||||
private ["_newCameraView", "_newInventoryDisplayIsOpen", "_newPlayerInventory", "_newPlayerTurret", "_newPlayerVehicle", "_newPlayerVisionMode", "_newPlayerWeapon", "_newZeusDisplayIsOpen", "_newVisibleMap"];
|
||||
// "playerInventoryChanged" event
|
||||
_newPlayerInventory = [ACE_player] call FUNC(getAllGear);
|
||||
if !(_newPlayerInventory isEqualTo GVAR(OldPlayerInventory)) then {
|
||||
// Raise ACE event locally
|
||||
GVAR(OldPlayerInventory) = _newPlayerInventory;
|
||||
["playerInventoryChanged", [ACE_player, _newPlayerInventory]] call FUNC(localEvent);
|
||||
};
|
||||
private "_data"; // reuse one variable to reduce number of variables that have to be set to private each frame
|
||||
|
||||
// "playerVisionModeChanged" event
|
||||
_newPlayerVisionMode = currentVisionMode ACE_player;
|
||||
if !(_newPlayerVisionMode isEqualTo GVAR(OldPlayerVisionMode)) then {
|
||||
// Raise ACE event locally
|
||||
GVAR(OldPlayerVisionMode) = _newPlayerVisionMode;
|
||||
["playerVisionModeChanged", [ACE_player, _newPlayerVisionMode]] call FUNC(localEvent);
|
||||
};
|
||||
// "playerChanged" event
|
||||
_data = call FUNC(player);
|
||||
if !(_data isEqualTo GVAR(OldPlayerVehicle)) then {
|
||||
private "_oldPlayer";
|
||||
_oldPlayer = ACE_player;
|
||||
|
||||
// "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);
|
||||
};
|
||||
ACE_player = _data;
|
||||
uiNamespace setVariable ["ACE_player", _data];
|
||||
|
||||
// "zeusDisplayChanged" event
|
||||
_newZeusDisplayIsOpen = !(isNull findDisplay 312);
|
||||
if !(_newZeusDisplayIsOpen isEqualTo GVAR(OldZeusDisplayIsOpen)) then {
|
||||
// Raise ACE event locally
|
||||
GVAR(OldZeusDisplayIsOpen) = _newZeusDisplayIsOpen;
|
||||
["zeusDisplayChanged", [ACE_player, _newZeusDisplayIsOpen]] call FUNC(localEvent);
|
||||
};
|
||||
|
||||
// "cameraViewChanged" event
|
||||
_newCameraView = cameraView;
|
||||
if !(_newCameraView isEqualTo GVAR(OldCameraView)) then {
|
||||
// Raise ACE event locally
|
||||
GVAR(OldCameraView) = _newCameraView;
|
||||
["cameraViewChanged", [ACE_player, _newCameraView]] call FUNC(localEvent);
|
||||
["playerChanged", [ACE_player, _oldPlayer]] call FUNC(localEvent);
|
||||
};
|
||||
|
||||
// "playerVehicleChanged" event
|
||||
_newPlayerVehicle = vehicle ACE_player;
|
||||
if !(_newPlayerVehicle isEqualTo GVAR(OldPlayerVehicle)) then {
|
||||
_data = vehicle ACE_player;
|
||||
if !(_data isEqualTo GVAR(OldPlayerVehicle)) then {
|
||||
// Raise ACE event locally
|
||||
GVAR(OldPlayerVehicle) = _newPlayerVehicle;
|
||||
["playerVehicleChanged", [ACE_player, _newPlayerVehicle]] call FUNC(localEvent);
|
||||
GVAR(OldPlayerVehicle) = _data;
|
||||
["playerVehicleChanged", [ACE_player, _data]] call FUNC(localEvent);
|
||||
};
|
||||
|
||||
// "playerTurretChanged" event
|
||||
_newPlayerTurret = [ACE_player] call FUNC(getTurretIndex);
|
||||
if !(_newPlayerTurret isEqualTo GVAR(OldPlayerTurret)) then {
|
||||
_data = [ACE_player] call FUNC(getTurretIndex);
|
||||
if !(_data isEqualTo GVAR(OldPlayerTurret)) then {
|
||||
// Raise ACE event locally
|
||||
GVAR(OldPlayerTurret) = _newPlayerTurret;
|
||||
["playerTurretChanged", [ACE_player, _newPlayerTurret]] call FUNC(localEvent);
|
||||
GVAR(OldPlayerTurret) = _data;
|
||||
["playerTurretChanged", [ACE_player, _data]] call FUNC(localEvent);
|
||||
};
|
||||
|
||||
// "playerWeaponChanged" event
|
||||
_newPlayerWeapon = currentWeapon ACE_player;
|
||||
if (_newPlayerWeapon != GVAR(OldPlayerWeapon)) then {
|
||||
_data = currentWeapon ACE_player;
|
||||
if (_data != GVAR(OldPlayerWeapon)) then {
|
||||
// Raise ACE event locally
|
||||
GVAR(OldPlayerWeapon) = _newPlayerWeapon;
|
||||
["playerWeaponChanged", [ACE_player, _newPlayerWeapon]] call FUNC(localEvent);
|
||||
GVAR(OldPlayerWeapon) = _data;
|
||||
["playerWeaponChanged", [ACE_player, _data]] call FUNC(localEvent);
|
||||
};
|
||||
|
||||
// "playerInventoryChanged" event
|
||||
_data = [ACE_player] call FUNC(getAllGear);
|
||||
if !(_data isEqualTo GVAR(OldPlayerInventory)) then {
|
||||
// Raise ACE event locally
|
||||
GVAR(OldPlayerInventory) = _data;
|
||||
["playerInventoryChanged", [ACE_player, _data]] call FUNC(localEvent);
|
||||
};
|
||||
|
||||
// "playerVisionModeChanged" event
|
||||
_data = currentVisionMode ACE_player;
|
||||
if !(_data isEqualTo GVAR(OldPlayerVisionMode)) then {
|
||||
// Raise ACE event locally
|
||||
GVAR(OldPlayerVisionMode) = _data;
|
||||
["playerVisionModeChanged", [ACE_player, _data]] call FUNC(localEvent);
|
||||
};
|
||||
|
||||
// "cameraViewChanged" event
|
||||
_data = cameraView;
|
||||
if !(_data isEqualTo GVAR(OldCameraView)) then {
|
||||
// Raise ACE event locally
|
||||
GVAR(OldCameraView) = _data;
|
||||
["cameraViewChanged", [ACE_player, _data]] call FUNC(localEvent);
|
||||
};
|
||||
|
||||
// "visibleMapChanged" event
|
||||
_newVisibleMap = visibleMap;
|
||||
if (!_newVisibleMap isEqualTo GVAR(OldVisibleMap)) then {
|
||||
_data = visibleMap;
|
||||
if (!_data isEqualTo GVAR(OldVisibleMap)) then {
|
||||
// Raise ACE event locally
|
||||
GVAR(OldVisibleMap) = _newVisibleMap;
|
||||
["visibleMapChanged", [ACE_player, _newVisibleMap]] call FUNC(localEvent);
|
||||
GVAR(OldVisibleMap) = _data;
|
||||
["visibleMapChanged", [ACE_player, _data]] call FUNC(localEvent);
|
||||
};
|
||||
|
||||
// "inventoryDisplayChanged" event
|
||||
_data = !(isNull findDisplay 602);
|
||||
if !(_data isEqualTo GVAR(OldInventoryDisplayIsOpen)) then {
|
||||
// Raise ACE event locally
|
||||
GVAR(OldInventoryDisplayIsOpen) = _data;
|
||||
["inventoryDisplayChanged", [ACE_player, _data]] call FUNC(localEvent);
|
||||
};
|
||||
|
||||
// "zeusDisplayChanged" event
|
||||
_data = !(isNull findDisplay 312);
|
||||
if !(_data isEqualTo GVAR(OldZeusDisplayIsOpen)) then {
|
||||
// Raise ACE event locally
|
||||
GVAR(OldZeusDisplayIsOpen) = _data;
|
||||
["zeusDisplayChanged", [ACE_player, _data]] call FUNC(localEvent);
|
||||
};
|
||||
|
||||
// "activeCameraChanged" event
|
||||
_data = call FUNC(isfeatureCameraActive);
|
||||
if !(_data isEqualTo GVAR(OldIsCamera)) then {
|
||||
// Raise ACE event locally
|
||||
GVAR(OldIsCamera) = _data;
|
||||
["activeCameraChanged", [ACE_player, _data]] call FUNC(localEvent);
|
||||
};
|
||||
|
||||
END_COUNTER(stateChecker);
|
||||
|
||||
}, 0, []] call CBA_fnc_addPerFrameHandler;
|
||||
|
||||
|
||||
GVAR(OldIsCamera) = false;
|
||||
//////////////////////////////////////////////////
|
||||
// Eventhandlers for player controlled machines
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
[{
|
||||
|
||||
// "activeCameraChanged" event
|
||||
private ["_isCamera"];
|
||||
_isCamera = call FUNC(isfeatureCameraActive);
|
||||
if !(_isCamera isEqualTo GVAR(OldIsCamera)) then {
|
||||
// Raise ACE event locally
|
||||
GVAR(OldIsCamera) = _isCamera;
|
||||
["activeCameraChanged", [ACE_player, _isCamera]] call FUNC(localEvent);
|
||||
};
|
||||
|
||||
}, 1, []] call CBA_fnc_addPerFrameHandler; // feel free to decrease the sleep ACE_time if you need it.
|
||||
|
||||
|
||||
[QGVAR(StateArrested),false,true,QUOTE(ADDON)] call FUNC(defineVariable);
|
||||
// @todo still needed?
|
||||
[QGVAR(StateArrested), false, true, QUOTE(ADDON)] call FUNC(defineVariable);
|
||||
|
||||
["displayTextStructured", FUNC(displayTextStructured)] call FUNC(addEventhandler);
|
||||
["displayTextPicture", FUNC(displayTextPicture)] call FUNC(addEventhandler);
|
||||
["medical_onUnconscious", {if (local (_this select 0) && {!(_this select 1)}) then {[ _this select 0, false, QUOTE(FUNC(loadPerson)), west /* dummy side */] call FUNC(switchToGroupSide);};}] call FUNC(addEventhandler);
|
||||
|
||||
["medical_onUnconscious", {
|
||||
params ["_unit", "_isUnconscious"];
|
||||
|
||||
if (local _unit && {!_isUnconscious}) then {
|
||||
[_unit, false, QFUNC(loadPerson), west /* dummy side */] call FUNC(switchToGroupSide);
|
||||
};
|
||||
}] call FUNC(addEventhandler);
|
||||
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
// Add various canInteractWith conditions
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
["notOnMap", {!visibleMap}] call FUNC(addCanInteractWithCondition);
|
||||
|
||||
["isNotInside", {
|
||||
params ["_unit", "_target"];
|
||||
|
||||
// Players can always interact with himself if not boarded
|
||||
vehicle (_this select 0) == (_this select 0) ||
|
||||
vehicle _unit == _unit ||
|
||||
// Players can always interact with his vehicle
|
||||
{vehicle (_this select 0) == (_this select 1)} ||
|
||||
{vehicle _unit == _target} ||
|
||||
// Players can always interact with passengers of the same vehicle
|
||||
{!((_this select 0) isEqualTo (_this select 1)) && {vehicle (_this select 0) == vehicle (_this select 1)}}
|
||||
{_unit != _target && {vehicle _unit == vehicle _target}}
|
||||
}] call FUNC(addCanInteractWithCondition);
|
||||
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
// Set up PlayerJIP eventhandler
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
// Lastly, do JIP events
|
||||
// JIP Detection and event trigger. Run this at the very end, just in case anything uses it
|
||||
// Note: usage of player is most likely on purpose
|
||||
if (didJip) then {
|
||||
// We are jipping! Get ready and wait, and throw the event
|
||||
[{
|
||||
if((!(isNull player)) && GVAR(settingsInitFinished)) then {
|
||||
["PlayerJip", [player] ] call FUNC(localEvent);
|
||||
[(_this select 1)] call cba_fnc_removePerFrameHandler;
|
||||
if(!isNull player && GVAR(settingsInitFinished)) then {
|
||||
["PlayerJip", [player]] call FUNC(localEvent);
|
||||
[_this select 1] call CBA_fnc_removePerFrameHandler;
|
||||
};
|
||||
}, 0, []] call CBA_fnc_addPerFrameHandler;
|
||||
};
|
||||
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
// CBA key input handling
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
//Device Handler:
|
||||
GVAR(deviceKeyHandlingArray) = [];
|
||||
GVAR(deviceKeyCurrentIndex) = -1;
|
||||
|
||||
// Register localizations for the Keybinding categories
|
||||
["ACE3 Equipment", localize LSTRING(ACEKeybindCategoryEquipment)] call cba_fnc_registerKeybindModPrettyName;
|
||||
["ACE3 Common", localize LSTRING(ACEKeybindCategoryCommon)] call cba_fnc_registerKeybindModPrettyName;
|
||||
["ACE3 Weapons", localize LSTRING(ACEKeybindCategoryWeapons)] call cba_fnc_registerKeybindModPrettyName;
|
||||
["ACE3 Movement", localize LSTRING(ACEKeybindCategoryMovement)] call cba_fnc_registerKeybindModPrettyName;
|
||||
["ACE3 Scope Adjustment", localize LSTRING(ACEKeybindCategoryScopeAdjustment)] call cba_fnc_registerKeybindModPrettyName;
|
||||
["ACE3 Vehicles", localize LSTRING(ACEKeybindCategoryVehicles)] call cba_fnc_registerKeybindModPrettyName;
|
||||
["ACE3 Equipment", localize LSTRING(ACEKeybindCategoryEquipment)] call CBA_fnc_registerKeybindModPrettyName;
|
||||
["ACE3 Common", localize LSTRING(ACEKeybindCategoryCommon)] call CBA_fnc_registerKeybindModPrettyName;
|
||||
["ACE3 Weapons", localize LSTRING(ACEKeybindCategoryWeapons)] call CBA_fnc_registerKeybindModPrettyName;
|
||||
["ACE3 Movement", localize LSTRING(ACEKeybindCategoryMovement)] call CBA_fnc_registerKeybindModPrettyName;
|
||||
["ACE3 Scope Adjustment", localize LSTRING(ACEKeybindCategoryScopeAdjustment)] call CBA_fnc_registerKeybindModPrettyName;
|
||||
["ACE3 Vehicles", localize LSTRING(ACEKeybindCategoryVehicles)] call CBA_fnc_registerKeybindModPrettyName;
|
||||
|
||||
["ACE3 Equipment", QGVAR(openDevice), (localize "STR_ACE_Common_toggleHandheldDevice"),
|
||||
{
|
||||
["ACE3 Equipment", QGVAR(openDevice), (localize "STR_ACE_Common_toggleHandheldDevice"), {
|
||||
[] call FUNC(deviceKeyFindValidIndex);
|
||||
if (GVAR(deviceKeyCurrentIndex) == -1) exitWith {false};
|
||||
[] call ((GVAR(deviceKeyHandlingArray) select GVAR(deviceKeyCurrentIndex)) select 3);
|
||||
true
|
||||
},
|
||||
{false},
|
||||
[0xC7, [false, false, false]], false] call cba_fnc_addKeybind; //Home Key
|
||||
[0xC7, [false, false, false]], false] call CBA_fnc_addKeybind; //Home Key
|
||||
|
||||
["ACE3 Equipment", QGVAR(closeDevice), (localize "STR_ACE_Common_closeHandheldDevice"),
|
||||
{
|
||||
["ACE3 Equipment", QGVAR(closeDevice), (localize "STR_ACE_Common_closeHandheldDevice"), {
|
||||
[] call FUNC(deviceKeyFindValidIndex);
|
||||
if (GVAR(deviceKeyCurrentIndex) == -1) exitWith {false};
|
||||
[] call ((GVAR(deviceKeyHandlingArray) select GVAR(deviceKeyCurrentIndex)) select 4);
|
||||
true
|
||||
},
|
||||
{false},
|
||||
[0xC7, [false, true, false]], false] call cba_fnc_addKeybind; //CTRL + Home Key
|
||||
[0xC7, [false, true, false]], false] call CBA_fnc_addKeybind; //CTRL + Home Key
|
||||
|
||||
["ACE3 Equipment", QGVAR(cycleDevice), (localize "STR_ACE_Common_cycleHandheldDevices"),
|
||||
{
|
||||
["ACE3 Equipment", QGVAR(cycleDevice), (localize "STR_ACE_Common_cycleHandheldDevices"), {
|
||||
[1] call FUNC(deviceKeyFindValidIndex);
|
||||
if (GVAR(deviceKeyCurrentIndex) == -1) exitWith {false};
|
||||
_displayName = ((GVAR(deviceKeyHandlingArray) select GVAR(deviceKeyCurrentIndex)) select 0);
|
||||
@ -384,6 +466,6 @@ GVAR(deviceKeyCurrentIndex) = -1;
|
||||
true
|
||||
},
|
||||
{false},
|
||||
[0xC7, [true, false, false]], false] call cba_fnc_addKeybind; //SHIFT + Home Key
|
||||
[0xC7, [true, false, false]], false] call CBA_fnc_addKeybind; //SHIFT + Home Key
|
||||
|
||||
GVAR(commonPostInited) = true;
|
||||
|
@ -1,16 +1,13 @@
|
||||
// by commy2
|
||||
#include "script_component.hpp"
|
||||
|
||||
//IGNORE_PRIVATE_WARNING("_handleNetEvent", "_handleRequestAllSyncedEvents", "_handleRequestSyncedEvent", "_handleSyncedEvent");
|
||||
|
||||
ADDON = false;
|
||||
|
||||
// ACE Common Function
|
||||
|
||||
PREP(addCanInteractWithCondition);
|
||||
PREP(addLineToDebugDraw);
|
||||
PREP(addSetting);
|
||||
PREP(addToInventory);
|
||||
PREP(assignedItemFix);
|
||||
PREP(assignObjectsInList);
|
||||
PREP(ambientBrightness);
|
||||
PREP(applyForceWalkStatus);
|
||||
@ -82,14 +79,6 @@ PREP(getTargetAzimuthAndInclination);
|
||||
PREP(getTargetDistance);
|
||||
PREP(getTargetObject);
|
||||
PREP(getTurnedOnLights);
|
||||
PREP(getTurretCommander);
|
||||
PREP(getTurretConfigPath);
|
||||
PREP(getTurretCopilot);
|
||||
PREP(getTurretGunner);
|
||||
PREP(getTurretIndex);
|
||||
PREP(getTurrets);
|
||||
PREP(getTurretsFFV);
|
||||
PREP(getTurretsOther);
|
||||
PREP(getTurretDirection);
|
||||
PREP(getUavControlPosition);
|
||||
PREP(getVehicleCargo);
|
||||
@ -102,6 +91,8 @@ PREP(getWindDirection);
|
||||
PREP(getZoom);
|
||||
PREP(goKneeling);
|
||||
PREP(hadamardProduct);
|
||||
PREP(handleScrollWheel);
|
||||
PREP(handleScrollWheelInit);
|
||||
PREP(hasItem);
|
||||
PREP(hasMagazine);
|
||||
PREP(headBugFix);
|
||||
@ -251,6 +242,17 @@ PREP(localEvent);
|
||||
PREP(removeEventHandler);
|
||||
PREP(removeAlLEventHandlers);
|
||||
|
||||
// Synchronized Events
|
||||
PREP(syncedEventPFH);
|
||||
PREP(addSyncedEventHandler);
|
||||
PREP(removeSyncedEventHandler);
|
||||
PREP(requestSyncedEvent);
|
||||
PREP(syncedEvent);
|
||||
|
||||
PREP(_handleSyncedEvent);
|
||||
PREP(_handleRequestSyncedEvent);
|
||||
PREP(_handleRequestAllSyncedEvents);
|
||||
|
||||
// other eventhandlers
|
||||
PREP(addActionEventHandler);
|
||||
PREP(addActionMenuEventHandler);
|
||||
@ -274,17 +276,6 @@ PREP(hashListSelect);
|
||||
PREP(hashListSet);
|
||||
PREP(hashListPush);
|
||||
|
||||
// Synchronized Events
|
||||
PREP(syncedEventPFH);
|
||||
PREP(addSyncedEventHandler);
|
||||
PREP(removeSyncedEventHandler);
|
||||
PREP(requestSyncedEvent);
|
||||
PREP(syncedEvent);
|
||||
|
||||
PREP(_handleSyncedEvent);
|
||||
PREP(_handleRequestSyncedEvent);
|
||||
PREP(_handleRequestAllSyncedEvents);
|
||||
|
||||
GVAR(syncedEvents) = HASH_CREATE;
|
||||
|
||||
//GVARS for execNextFrame and waitAndExec
|
||||
@ -296,7 +287,7 @@ GVAR(nextFrameBufferB) = [];
|
||||
GVAR(settingsInitFinished) = false;
|
||||
GVAR(runAtSettingsInitialized) = [];
|
||||
|
||||
// @TODO: Generic local-managed global-synced objects (createVehicleLocal)
|
||||
// @todo: Generic local-managed global-synced objects (createVehicleLocal)
|
||||
|
||||
//Debug
|
||||
ACE_COUNTERS = [];
|
||||
@ -306,11 +297,18 @@ if (isServer) then {
|
||||
call FUNC(loadSettingsOnServer);
|
||||
};
|
||||
|
||||
ACE_player = player;
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
// Set up PlayerChanged eventhandler for pre init
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
ACE_player = objNull;
|
||||
uiNamespace setVariable ["ACE_player", objNull];
|
||||
|
||||
// @todo check if this can be removed
|
||||
if (hasInterface) then {
|
||||
// PFH to update the ACE_player variable
|
||||
[{
|
||||
GVAR(PreInit_playerChanged_PFHID) = [{
|
||||
if !(ACE_player isEqualTo (call FUNC(player))) then {
|
||||
private ["_oldPlayer"];
|
||||
_oldPlayer = ACE_player;
|
||||
@ -324,7 +322,11 @@ if (hasInterface) then {
|
||||
}, 0, []] call CBA_fnc_addPerFrameHandler;
|
||||
};
|
||||
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
// Time handling
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
ACE_time = diag_tickTime;
|
||||
ACE_realTime = diag_tickTime;
|
||||
ACE_virtualTime = diag_tickTime;
|
||||
@ -339,6 +341,8 @@ PREP(timePFH);
|
||||
// Init toHex
|
||||
[0] call FUNC(toHex);
|
||||
|
||||
ADDON = true;
|
||||
isHC = !hasInterface && !isDedicated; // deprecated because no tag
|
||||
missionNamespace setVariable ["ACE_isHC", ACE_isHC];
|
||||
uiNamespace setVariable ["ACE_isHC", ACE_isHC];
|
||||
|
||||
isHC = !(hasInterface || isDedicated);
|
||||
ADDON = true;
|
||||
|
75
addons/common/functions/fnc_assignedItemFix.sqf
Normal file
75
addons/common/functions/fnc_assignedItemFix.sqf
Normal file
@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
* Initialized the assigned item fix.
|
||||
*
|
||||
* Arguments:
|
||||
* None
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public : No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
private "_config";
|
||||
|
||||
ACE_isMapEnabled = call {_config = missionConfigFile >> "showMap"; !isNumber _config || {getNumber _config == 1}}; // default value is 1, so do isNumber check first
|
||||
ACE_isCompassEnabled = call {_config = missionConfigFile >> "showCompass"; !isNumber _config || {getNumber _config == 1}};
|
||||
ACE_isWatchEnabled = call {_config = missionConfigFile >> "showWatch"; !isNumber _config || {getNumber _config == 1}};
|
||||
ACE_isRadioEnabled = call {_config = missionConfigFile >> "showRadio"; !isNumber _config || {getNumber _config == 1}};
|
||||
ACE_isGPSEnabled = call {_config = missionConfigFile >> "showGPS"; !isNumber _config || {getNumber _config == 1}};
|
||||
|
||||
GVAR(AssignedItems) = [];
|
||||
GVAR(AssignedItemsInfo) = [];
|
||||
GVAR(AssignedItemsShownItems) = [
|
||||
ACE_isMapEnabled,
|
||||
ACE_isCompassEnabled,
|
||||
ACE_isWatchEnabled,
|
||||
ACE_isRadioEnabled,
|
||||
ACE_isGPSEnabled
|
||||
];
|
||||
|
||||
["playerInventoryChanged", {
|
||||
params ["_unit", "_assignedItems"];
|
||||
|
||||
_assignedItems = _assignedItems select 17;
|
||||
|
||||
GVAR(AssignedItemsShownItems) = [true, true, true, true, true];
|
||||
|
||||
{
|
||||
if !(_x in GVAR(AssignedItems)) then {
|
||||
GVAR(AssignedItems) pushBack _x;
|
||||
GVAR(AssignedItemsInfo) pushBack toLower getText (configFile >> "CfgWeapons" >> _x >> "ACE_hideItemType");
|
||||
};
|
||||
|
||||
switch (GVAR(AssignedItemsInfo) select (GVAR(AssignedItems) find _x)) do {
|
||||
case ("map"): {
|
||||
GVAR(AssignedItemsShownItems) set [0, false];
|
||||
};
|
||||
case ("compass"): {
|
||||
GVAR(AssignedItemsShownItems) set [1, false];
|
||||
};
|
||||
case ("watch"): {
|
||||
GVAR(AssignedItemsShownItems) set [2, false];
|
||||
};
|
||||
case ("radio"): {
|
||||
GVAR(AssignedItemsShownItems) set [3, false];
|
||||
};
|
||||
case ("gps"): {
|
||||
GVAR(AssignedItemsShownItems) set [4, false];
|
||||
};
|
||||
};
|
||||
false
|
||||
} count _assignedItems;
|
||||
|
||||
//systemChat str GVAR(AssignedItemsShownItems);
|
||||
|
||||
GVAR(AssignedItemsShownItems) params ["_showMap", "_showCompass", "_showWatch", "_showRadio", "_showGPS"];
|
||||
|
||||
showMap _showMap;
|
||||
showCompass _showCompass;
|
||||
showWatch _showWatch;
|
||||
showRadio _showRadio;
|
||||
showGPS (_showGPS || {cameraOn == getConnectedUAV _unit}); //If player is activly controling a UAV, showGPS controls showing the map (m key)
|
||||
}] call FUNC(addEventHandler);
|
@ -15,7 +15,7 @@
|
||||
|
||||
params ["_item"];
|
||||
|
||||
private ["_cfgType", "_config", "_type", "_default"];
|
||||
private ["_cfgType", "_config", "_type", "_simulation", "_default"];
|
||||
|
||||
_cfgType = [_item] call FUNC(getConfigType);
|
||||
|
||||
@ -25,6 +25,7 @@ if (_cfgType == "CfgGlasses") exitWith {["item", "glasses"]};
|
||||
|
||||
_config = configFile >> _cfgType >> _item;
|
||||
_type = getNumber (_config >> "type");
|
||||
_simulation = getText (_config >> "simulation");
|
||||
|
||||
if (isNumber (_config >> "ItemInfo" >> "type")) then {
|
||||
_type = getNumber (_config >> "ItemInfo" >> "type");
|
||||
@ -63,7 +64,7 @@ switch (true) do {
|
||||
case (_type == 801): {["item", "uniform"]};
|
||||
|
||||
case (_type == 2^12): {
|
||||
switch (toLower getText (_config >> "simulation")) do {
|
||||
switch (toLower _simulation) do {
|
||||
case ("weapon"): {["weapon", "binocular"]};
|
||||
case ("binocular"): {["weapon", "binocular"]};
|
||||
case ("nvgoggles"): {["item", "nvgoggles"]};
|
||||
@ -73,6 +74,15 @@ switch (true) do {
|
||||
};
|
||||
|
||||
case (_type == 2^16): {["weapon", "vehicle"]};
|
||||
case (_type == 2^17): {[_default, "unknown"]}; // ???
|
||||
case (_type == 2^17): {
|
||||
switch (toLower _simulation) do {
|
||||
case ("itemmap"): {["item", "map"]};
|
||||
case ("itemgps"): {["item", "gps"]};
|
||||
case ("itemradio"): {["item", "radio"]};
|
||||
case ("itemcompass"): {["item", "compass"]};
|
||||
case ("itemwatch"): {["item", "watch"]};
|
||||
default {[_default, "unknown"]};
|
||||
};
|
||||
};
|
||||
default {[_default, "unknown"]};
|
||||
};
|
||||
|
25
addons/common/functions/fnc_handleScrollWheel.sqf
Normal file
25
addons/common/functions/fnc_handleScrollWheel.sqf
Normal file
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
* Handles MouseZChanged event.
|
||||
*
|
||||
* Arguments:
|
||||
* None
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public : No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
// prevents a bug that causes the MouseZChanged to trigger N-times, where N is the number of times you consecutively pressed "Restart" instead of "Preview" in the editor
|
||||
if (GVAR(ScrollWheelFrame) == diag_frameno) exitWith {};
|
||||
|
||||
GVAR(ScrollWheelFrame) = diag_frameno;
|
||||
|
||||
{
|
||||
[_this select 1] call _x;
|
||||
false
|
||||
} count ((missionNamespace getVariable ["ACE_EventHandler_ScrollWheel", [-1, [], []]]) select 2);
|
||||
|
||||
nil
|
15
addons/common/functions/fnc_handleScrollWheelInit.sqf
Normal file
15
addons/common/functions/fnc_handleScrollWheelInit.sqf
Normal file
@ -0,0 +1,15 @@
|
||||
/*
|
||||
* Author: commy2
|
||||
* Initializes the MouseZChanged eventhandler.
|
||||
*
|
||||
* Arguments:
|
||||
* None
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
*
|
||||
* Public : No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
(findDisplay 46) displayAddEventHandler ["MouseZChanged", QUOTE(_this call FUNC(handleScrollWheel))];
|
@ -1,64 +0,0 @@
|
||||
// by commy2
|
||||
#include "script_component.hpp"
|
||||
|
||||
private ["_config"];
|
||||
|
||||
ACE_isMapEnabled = call {_config = missionConfigFile >> "showMap"; !isNumber _config || {getNumber _config == 1}}; // default value is 1, so do isNumber check first
|
||||
ACE_isCompassEnabled = call {_config = missionConfigFile >> "showCompass"; !isNumber _config || {getNumber _config == 1}};
|
||||
ACE_isWatchEnabled = call {_config = missionConfigFile >> "showWatch"; !isNumber _config || {getNumber _config == 1}};
|
||||
ACE_isRadioEnabled = call {_config = missionConfigFile >> "showRadio"; !isNumber _config || {getNumber _config == 1}};
|
||||
ACE_isGPSEnabled = call {_config = missionConfigFile >> "showGPS"; !isNumber _config || {getNumber _config == 1}};
|
||||
|
||||
GVAR(AssignedItems) = [];
|
||||
GVAR(AssignedItemsInfo) = [];
|
||||
|
||||
["playerInventoryChanged", {
|
||||
private ["_unit", "_assignedItems", "_shownItems"];
|
||||
|
||||
_unit = _this select 0;
|
||||
_assignedItems = _this select 1 select 17;
|
||||
|
||||
_shownItems = [
|
||||
ACE_isMapEnabled,
|
||||
ACE_isCompassEnabled,
|
||||
ACE_isWatchEnabled,
|
||||
ACE_isRadioEnabled,
|
||||
ACE_isGPSEnabled
|
||||
];
|
||||
|
||||
{
|
||||
if !(_x in GVAR(AssignedItems)) then {
|
||||
GVAR(AssignedItems) pushBack _x;
|
||||
GVAR(AssignedItemsInfo) pushBack toLower getText (configFile >> "CfgWeapons" >> _x >> "ACE_hideItemType")
|
||||
};
|
||||
|
||||
private "_hideItemType";
|
||||
_hideItemType = GVAR(AssignedItemsInfo) select (GVAR(AssignedItems) find _x);
|
||||
|
||||
switch (_hideItemType) do {
|
||||
case ("map"): {
|
||||
_shownItems set [0, false];
|
||||
};
|
||||
case ("compass"): {
|
||||
_shownItems set [1, false];
|
||||
};
|
||||
case ("watch"): {
|
||||
_shownItems set [2, false];
|
||||
};
|
||||
case ("radio"): {
|
||||
_shownItems set [3, false];
|
||||
};
|
||||
case ("gps"): {
|
||||
_shownItems set [4, false];
|
||||
};
|
||||
};
|
||||
} forEach _assignedItems;
|
||||
|
||||
//systemChat str _shownItems;
|
||||
|
||||
showMap (_shownItems select 0);
|
||||
showCompass (_shownItems select 1);
|
||||
showWatch (_shownItems select 2);
|
||||
showRadio (_shownItems select 3);
|
||||
showGPS (_shownItems select 4 || {cameraOn == getConnectedUAV _unit}); //If player is activly controling a UAV, showGPS controls showing the map (m key)
|
||||
}] call FUNC(addEventHandler);
|
@ -1,16 +0,0 @@
|
||||
// by commy2
|
||||
#include "script_component.hpp"
|
||||
|
||||
GVAR(ScrollWheelFrame) = diag_frameno;
|
||||
|
||||
GVAR(onScrollWheel) = {
|
||||
private ["_scroll"];
|
||||
_scroll = _this select 1;
|
||||
|
||||
if (GVAR(ScrollWheelFrame) == diag_frameno) exitWith {};
|
||||
GVAR(ScrollWheelFrame) = diag_frameno;
|
||||
|
||||
{
|
||||
[_scroll] call _x;
|
||||
} count ((missionNamespace getVariable ["ACE_EventHandler_ScrollWheel", [-1, [], []]]) select 2);
|
||||
};
|
@ -97,6 +97,8 @@
|
||||
// Time functions for accuracy per frame
|
||||
#define ACE_tickTime (ACE_time + (diag_tickTime - ACE_diagTime))
|
||||
|
||||
#define ACE_isHC (!hasInterface && !isDedicated)
|
||||
|
||||
#define ACE_LOG(module,level,message) diag_log text ACE_LOGFORMAT(module,level,message)
|
||||
#define ACE_LOGFORMAT(module,level,message) FORMAT_2(QUOTE([ACE] (module) %1: %2),level,message)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user