diff --git a/AUTHORS.txt b/AUTHORS.txt index 8cdf9a99a9..5eee93a7f6 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -54,7 +54,7 @@ Crusty Dharma Bellamkonda Dimaslg Drill -Dudakov +Dudakov aka [OMCB]Kaban Dslyecxi eRazeri evromalarkey diff --git a/README.md b/README.md index f313999923..d95c152904 100644 --- a/README.md +++ b/README.md @@ -4,9 +4,9 @@

- ACE3 Version + ACE3 Version - + ACE3 Download diff --git a/addons/attach/CfgVehicles.hpp b/addons/attach/CfgVehicles.hpp index daf91a43df..e462c0cefa 100644 --- a/addons/attach/CfgVehicles.hpp +++ b/addons/attach/CfgVehicles.hpp @@ -61,7 +61,6 @@ class CfgVehicles { showDisabled = 0; priority = 5; icon = PATHTOF(UI\attach_ca.paa); - // hotkey = "T"; }; class GVAR(Detach) { displayName = CSTRING(Detach); @@ -71,7 +70,6 @@ class CfgVehicles { showDisabled = 0; priority = 5; icon = PATHTOF(UI\detach_ca.paa); - hotkey = "T"; }; }; }; diff --git a/addons/backpacks/functions/fnc_backpackOpened.sqf b/addons/backpacks/functions/fnc_backpackOpened.sqf index 4e61e8fbcc..b7ab4cd1f4 100644 --- a/addons/backpacks/functions/fnc_backpackOpened.sqf +++ b/addons/backpacks/functions/fnc_backpackOpened.sqf @@ -17,24 +17,17 @@ params ["_target", "_backpack"]; // do cam shake if the target is the player -if ([_target] call EFUNC(common,isPlayer)) then { +if (_target call EFUNC(common,isPlayer)) then { addCamShake [4, 0.5, 5]; }; // play a zipper sound effect -private ["_sounds", "_position"]; - -_sounds = [ - /*"a3\sounds_f\characters\ingame\AinvPknlMstpSlayWpstDnon_medic.wss", - "a3\sounds_f\characters\ingame\AinvPknlMstpSlayWrflDnon_medic.wss", - "a3\sounds_f\characters\ingame\AinvPpneMstpSlayWpstDnon_medic.wss", - "a3\sounds_f\characters\ingame\AinvPpneMstpSlayWrflDnon_medic.wss"*/ - +private _sounds = [ QUOTE(PATHTO_R(sounds\zip_in.wav)), QUOTE(PATHTO_R(sounds\zip_out.wav)) ]; -_position = AGLToASL (_target modelToWorldVisual (_target selectionPosition "Spine3")); +private _position = AGLToASL (_target modelToWorldVisual (_target selectionPosition "Spine3")); playSound3D [ _sounds select floor random count _sounds, diff --git a/addons/backpacks/functions/fnc_isBackpack.sqf b/addons/backpacks/functions/fnc_isBackpack.sqf index 68b59f803e..d6b0fb1071 100644 --- a/addons/backpacks/functions/fnc_isBackpack.sqf +++ b/addons/backpacks/functions/fnc_isBackpack.sqf @@ -12,13 +12,12 @@ */ #include "script_component.hpp" -params ["_backpack"]; +params [["_backpack", objNull, [objNull]]]; if (_backpack isEqualType objNull) then { _backpack = typeOf _backpack; }; -private "_config"; -_config = configFile >> "CfgVehicles" >> _backpack; +private _config = configFile >> "CfgVehicles" >> _backpack; getText (_config >> "vehicleClass") == "backpacks" && {getNumber (_config >> "maximumLoad") > 0} // return diff --git a/addons/backpacks/functions/fnc_onOpenInventory.sqf b/addons/backpacks/functions/fnc_onOpenInventory.sqf index 154000202d..d9a99535eb 100644 --- a/addons/backpacks/functions/fnc_onOpenInventory.sqf +++ b/addons/backpacks/functions/fnc_onOpenInventory.sqf @@ -16,11 +16,10 @@ params ["_unit", "_backpack"]; // exit if the target is not a real backpack, i.e. parachute, static weapon bag etc. -if !([_backpack] call FUNC(isBackpack)) exitWith {false}; +if !(_backpack call FUNC(isBackpack)) exitWith {false}; // get the unit that wears the backpack object -private "_target"; -_target = objectParent _backpack; +private _target = objectParent _backpack; if (isNull _target) exitWith {false}; diff --git a/addons/captives/CfgVehicles.hpp b/addons/captives/CfgVehicles.hpp index 0cfda46128..a8215c0cdc 100644 --- a/addons/captives/CfgVehicles.hpp +++ b/addons/captives/CfgVehicles.hpp @@ -32,7 +32,6 @@ class CfgVehicles { showDisabled = 0; icon = QUOTE(PATHTOF(UI\captive_ca.paa)); priority = 2.3; - hotkey = "E"; }; class ACE_StopEscorting { displayName = CSTRING(StopEscorting); @@ -43,7 +42,6 @@ class CfgVehicles { showDisabled = 0; icon = QUOTE(PATHTOF(UI\captive_ca.paa)); priority = 2.3; - hotkey = "E"; }; class ACE_LoadCaptive { displayName = CSTRING(LoadCaptive); @@ -54,7 +52,6 @@ class CfgVehicles { showDisabled = 0; icon = QUOTE(PATHTOF(UI\captive_ca.paa)); priority = 2.2; - hotkey = "L"; }; class GVAR(UnloadCaptive) { displayName = CSTRING(UnloadCaptive); @@ -74,7 +71,6 @@ class CfgVehicles { exceptions[] = {"isNotEscorting"}; showDisabled = 0; priority = 2.3; - hotkey = "C"; }; class ACE_StartSurrenderingSelf { displayName = CSTRING(StartSurrendering); @@ -165,7 +161,7 @@ class CfgVehicles { description = CSTRING(ModuleSurrender_Description); sync[] = {"AnyAI"}; }; - }; + }; class GVAR(ModuleHandcuffed): Module_F { author = ECSTRING(common,ACETeam); category = "ACE"; diff --git a/addons/cargo/stringtable.xml b/addons/cargo/stringtable.xml index cdd718006c..65c0ceb433 100644 --- a/addons/cargo/stringtable.xml +++ b/addons/cargo/stringtable.xml @@ -110,24 +110,28 @@ Carregando carga Ładowanie cargo Nakládám + Погрузка Unloading Cargo Descarregando carga Rozładowywanie cargo Vykládám + Выгрузка %1<br/>could not be loaded %1<br/>não pode ser carregado %1<br/>nie mógł zostać załadowany %1<br/>nemůže být naloženo + %1<br/>не может быть погружен %1<br/>could not be unloaded %1<br/>não pode ser descarregado %1<br/>nie mógł zostać rozładowany %1<br/>nemůže být vyloženo + %1<br/>не может быть выгружен \ No newline at end of file diff --git a/addons/common/XEH_postInit.sqf b/addons/common/XEH_postInit.sqf index ce75ad5187..22cf7a944e 100644 --- a/addons/common/XEH_postInit.sqf +++ b/addons/common/XEH_postInit.sqf @@ -1,7 +1,7 @@ // ACE - Common +// #define ENABLE_PERFORMANCE_COUNTERS #include "script_component.hpp" -// #define ENABLE_PERFORMANCE_COUNTERS ////////////////////////////////////////////////// // PFHs @@ -57,13 +57,30 @@ // Eventhandlers ////////////////////////////////////////////////// +//Add a fix for BIS's zeus remoteControl module not reseting variables on DC when RC a unit +//This variable is used for isPlayer checks +if (isServer) then { + addMissionEventHandler ["HandleDisconnect", { + params ["_dcPlayer"]; + private _zeusLogic = getAssignedCuratorLogic _dcPlayer; + if ((!isNil "_zeusLogic") && {!isNull _zeusLogic}) then { + { + if ((_x getvariable ["bis_fnc_moduleRemoteControl_owner", objnull]) isEqualTo _dcPlayer) exitWith { + ACE_LOGINFO_3("[%1] DC - Was Zeus [%2] while controlling unit [%3] - manually clearing `bis_fnc_moduleRemoteControl_owner`", [_x] call FUNC(getName), _dcPlayer, _x); + _x setVariable ["bis_fnc_moduleRemoteControl_owner", nil, true]; + }; + nil + } count (curatorEditableObjects _zeusLogic); + }; + }]; +}; + // Listens for global "SettingChanged" events, to update the force status locally ["SettingChanged", { params ["_name", "_value", "_force"]; if (_force) then { - private "_settingData"; - _settingData = [_name] call FUNC(getSettingData); + private _settingData = [_name] call FUNC(getSettingData); if (_settingData isEqualTo []) exitWith {}; @@ -144,10 +161,8 @@ QGVAR(remoteFnc) addPublicVariableEventHandler { // Check files, previous installed version etc. ////////////////////////////////////////////////// -private ["_currentVersion", "_previousVersion"]; - -_currentVersion = getText (configFile >> "CfgPatches" >> QUOTE(ADDON) >> "version"); -_previousVersion = profileNamespace getVariable ["ACE_VersionNumberString", ""]; +private _currentVersion = getText (configFile >> "CfgPatches" >> QUOTE(ADDON) >> "version"); +private _previousVersion = profileNamespace getVariable ["ACE_VersionNumberString", ""]; // check previous version number from profile if (_currentVersion != _previousVersion) then { @@ -251,8 +266,7 @@ GVAR(ScrollWheelFrame) = diag_frameno; }] call FUNC(addEventHandler); // add PFH to execute event that fires when the main display (46) is created -private "_fnc_initMainDisplayCheck"; -_fnc_initMainDisplayCheck = { +private _fnc_initMainDisplayCheck = { [{ if !(isNull findDisplay 46) then { // Raise ACE event locally @@ -293,6 +307,17 @@ enableCamShake true; // Set up numerous eventhanders for player controlled units ////////////////////////////////////////////////// +//CBA has events for zeus's display onLoad and onUnload (Need to delay a frame for display to be ready) +private _zeusDisplayChangedFNC = { + [{ + private _data = !(isNull findDisplay 312); + ["zeusDisplayChanged", [ACE_player, _data]] call FUNC(localEvent); + }, []] call FUNC(execNextFrame); +}; +["CBA_curatorOpened", _zeusDisplayChangedFNC] call CBA_fnc_addEventHandler; +["CBA_curatorClosed", _zeusDisplayChangedFNC] call CBA_fnc_addEventHandler; + + // default variables GVAR(OldPlayerVehicle) = vehicle objNull; GVAR(OldPlayerTurret) = [objNull] call FUNC(getTurretIndex); @@ -302,7 +327,6 @@ 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 @@ -314,13 +338,11 @@ if (!isNil QGVAR(PreInit_playerChanged_PFHID)) then { // PFH to raise varios events [{ BEGIN_COUNTER(stateChecker); - private "_data"; // reuse one variable to reduce number of variables that have to be set to private each frame // "playerChanged" event - _data = call FUNC(player); + private _data = call FUNC(player); if !(_data isEqualTo ACE_player) then { - private "_oldPlayer"; - _oldPlayer = ACE_player; + private _oldPlayer = ACE_player; ACE_player = _data; uiNamespace setVariable ["ACE_player", _data]; @@ -393,14 +415,6 @@ if (!isNil QGVAR(PreInit_playerChanged_PFHID)) then { ["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 { @@ -449,6 +463,7 @@ if (!isNil QGVAR(PreInit_playerChanged_PFHID)) then { {_unit != _target && {vehicle _unit == vehicle _target}} }] call FUNC(addCanInteractWithCondition); +["isNotInZeus", {isNull curatorCamera}] call FUNC(addCanInteractWithCondition); ////////////////////////////////////////////////// // Set up PlayerJIP eventhandler diff --git a/addons/common/XEH_preInit.sqf b/addons/common/XEH_preInit.sqf index 8073b9345b..1b7bdc624c 100644 --- a/addons/common/XEH_preInit.sqf +++ b/addons/common/XEH_preInit.sqf @@ -329,8 +329,7 @@ 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; + private _oldPlayer = ACE_player; ACE_player = call FUNC(player); uiNamespace setVariable ["ACE_player", ACE_player]; diff --git a/addons/common/functions/fnc__handleNetEvent.sqf b/addons/common/functions/fnc__handleNetEvent.sqf index e409afe6a3..e3b2ac609c 100644 --- a/addons/common/functions/fnc__handleNetEvent.sqf +++ b/addons/common/functions/fnc__handleNetEvent.sqf @@ -16,15 +16,12 @@ params ["_eventType", "_event"]; if (_eventType == "ACEg") then { _event params ["_eventName", "_eventArgs"]; + GVAR(events) params ["_eventNames"]; - private ["_eventNames", "_eventIndex"]; - - _eventNames = GVAR(events) select 0; - _eventIndex = _eventNames find _eventName; + private _eventIndex = _eventNames find _eventName; if (_eventIndex != -1) then { - private "_events"; - _events = (GVAR(events) select 1) select _eventIndex; + private _events = (GVAR(events) select 1) select _eventIndex; #ifdef DEBUG_EVENTS ACE_LOGINFO_1("* Net Event %1",_eventName); @@ -46,9 +43,8 @@ if (_eventType == "ACEc") then { if (isServer) then { _event params ["_eventName", "_eventTargets", "_eventArgs"]; - private ["_sentEvents", "_owner", "_serverFlagged"]; + private _sentEvents = []; - _sentEvents = []; if (!IS_ARRAY(_eventTargets)) then { _eventTargets = [_eventTargets]; }; @@ -59,9 +55,11 @@ if (_eventType == "ACEc") then { ["ACEg", ACEg] call FUNC(_handleNetEvent); }; - _serverFlagged = false; + private _serverFlagged = false; + { - _owner = _x; + private _owner = _x; + if (IS_OBJECT(_x)) then { _owner = owner _x; }; diff --git a/addons/common/functions/fnc__handleRequestAllSyncedEvents.sqf b/addons/common/functions/fnc__handleRequestAllSyncedEvents.sqf index 4e755562b5..8c8cbd1486 100644 --- a/addons/common/functions/fnc__handleRequestAllSyncedEvents.sqf +++ b/addons/common/functions/fnc__handleRequestAllSyncedEvents.sqf @@ -15,10 +15,8 @@ params ["_client"]; { - private ["_eventEntry", "_eventLog"]; - - _eventEntry = HASH_GET(GVAR(syncedEvents),_x); - _eventLog = _eventEntry select 1; + private _eventEntry = HASH_GET(GVAR(syncedEvents),_x); + _eventEntry params ["", "_eventLog"]; ["SEH_s", _client, [_x, _eventLog]] call FUNC(targetEvent); false diff --git a/addons/common/functions/fnc__handleRequestSyncedEvent.sqf b/addons/common/functions/fnc__handleRequestSyncedEvent.sqf index d4d9b2cf76..605af2fa85 100644 --- a/addons/common/functions/fnc__handleRequestSyncedEvent.sqf +++ b/addons/common/functions/fnc__handleRequestSyncedEvent.sqf @@ -27,10 +27,8 @@ if (isServer) then { false }; - private ["_eventEntry", "_eventLog"]; - - _eventEntry = HASH_GET(GVAR(syncedEvents),_eventName); - _eventLog = _eventEntry select 1; + private _eventEntry = HASH_GET(GVAR(syncedEvents),_eventName); + _eventEntry params ["", "_eventLog"]; ["SEH_s", _client, [_eventName, _eventLog]] call FUNC(targetEvent); } else { diff --git a/addons/common/functions/fnc__handleSyncedEvent.sqf b/addons/common/functions/fnc__handleSyncedEvent.sqf index a14ee2680e..41f7ed429c 100644 --- a/addons/common/functions/fnc__handleSyncedEvent.sqf +++ b/addons/common/functions/fnc__handleSyncedEvent.sqf @@ -21,20 +21,17 @@ if (!HASH_HASKEY(GVAR(syncedEvents),_name)) exitWith { false }; -private ["_internalData", "_eventCode"]; - -_internalData = HASH_GET(GVAR(syncedEvents),_name); +private _internalData = HASH_GET(GVAR(syncedEvents),_name); if (isServer) then { // Server needs to internally log it for synchronization if (_ttl > -1) then { _internalData = HASH_GET(GVAR(syncedEvents),_name); - private "_eventLog"; - _eventLog = _internalData select 1; + _internalData params ["", "_eventLog"]; _eventLog pushBack [ACE_diagTime, _args, _ttl]; }; }; -_eventCode = _internalData select 0; +_internalData params ["_eventCode"]; _args call _eventCode; diff --git a/addons/common/functions/fnc_addActionEventHandler.sqf b/addons/common/functions/fnc_addActionEventHandler.sqf index ae04933cdd..fe641010e4 100644 --- a/addons/common/functions/fnc_addActionEventHandler.sqf +++ b/addons/common/functions/fnc_addActionEventHandler.sqf @@ -25,10 +25,8 @@ if (_statement isEqualType "") then { _statement = compile _statement; }; -private ["_name", "_actionsVar"]; - -_name = format ["ACE_Action_%1", _action]; -_actionsVar = _unit getVariable [_name, [-1, [-1, [], []], objNull]]; +private _name = format ["ACE_Action_%1", _action]; +private _actionsVar = _unit getVariable [_name, [-1, [-1, [], []], objNull]]; if (_unit != _actionsVar select 2) then { // check if the unit is still valid, fixes respawn issues _actionsVar = [-1, [-1, [], []], objNull]; @@ -44,8 +42,7 @@ _actions pushBack [_condition, _statement]; // first action to add, unit needs addAction command if (_actionID == -1) then { - private "_addAction"; - _addAction = call compile format [ + private _addAction = call compile format [ "[ '', {if (inputAction '%1' == 0) exitWith {}; {if (_this call (_x select 0)) then {_this call (_x select 1)}} forEach (((_this select 0) getVariable '%2') select 1 select 2)}, diff --git a/addons/common/functions/fnc_addActionMenuEventHandler.sqf b/addons/common/functions/fnc_addActionMenuEventHandler.sqf index d9beb977f7..e68507ae7b 100644 --- a/addons/common/functions/fnc_addActionMenuEventHandler.sqf +++ b/addons/common/functions/fnc_addActionMenuEventHandler.sqf @@ -37,23 +37,19 @@ if (_statement2 isEqualType "") then { _statement2 = compile _statement2; }; -private ["_name", "_actionsVar"]; - -_name = format ["ACE_ActionMenu_%1", _action]; -_actionsVar = _unit getVariable [_name, [-1, [], []]]; +private _name = format ["ACE_ActionMenu_%1", _action]; +private _actionsVar = _unit getVariable [_name, [-1, [], []]]; _actionsVar params ["_id", "_actionIDs", "_actions"]; _id = _id + 1; -private ["_nameVar", "_addAction", "_actionID"]; - -_nameVar = format ["%1_ID%2", _name, _id]; +private _nameVar = format ["%1_ID%2", _name, _id]; missionNamespace setVariable [_nameVar, [_condition, _statement, _condition2, _statement2]]; _actionIDs pushBack _id; -_addAction = call compile format [ +private _addAction = call compile format [ "[ '%2', {if (inputAction '%1' == 0) then {if (_this call (%3 select 2)) then {_this call (%3 select 3)}} else {_this call (%3 select 1)}}, @@ -70,7 +66,7 @@ _addAction = call compile format [ _priority ]; -_actionID = _unit addAction _addAction; +private _actionID = _unit addAction _addAction; _actions pushBack [_actionID, _nameVar]; diff --git a/addons/common/functions/fnc_addCanInteractWithCondition.sqf b/addons/common/functions/fnc_addCanInteractWithCondition.sqf index 740fa9bb9f..294dac1c72 100644 --- a/addons/common/functions/fnc_addCanInteractWithCondition.sqf +++ b/addons/common/functions/fnc_addCanInteractWithCondition.sqf @@ -17,12 +17,10 @@ params ["_conditionName", "_conditionFunc"]; _conditionName = toLower _conditionName; -private ["_conditions", "_index"]; - -_conditions = missionNamespace getVariable [QGVAR(InteractionConditions), [[],[]]]; +private _conditions = missionNamespace getVariable [QGVAR(InteractionConditions), [[],[]]]; _conditions params ["_conditionNames", "_conditionFuncs"]; -_index = _conditionNames find _conditionName; +private _index = _conditionNames find _conditionName; if (_index == -1) then { _index = count _conditionNames; diff --git a/addons/common/functions/fnc_addCuratorUnloadEventhandler.sqf b/addons/common/functions/fnc_addCuratorUnloadEventhandler.sqf index c739177288..1bb92130bc 100644 --- a/addons/common/functions/fnc_addCuratorUnloadEventhandler.sqf +++ b/addons/common/functions/fnc_addCuratorUnloadEventhandler.sqf @@ -13,8 +13,7 @@ disableSerialization; -private "_dlg"; -_dlg = ctrlParent _this; +private _dlg = ctrlParent _this; _dlg displayAddEventHandler ["unload", { if (_this select 1 == 1) then { diff --git a/addons/common/functions/fnc_addEventHandler.sqf b/addons/common/functions/fnc_addEventHandler.sqf index 599e937918..128f489701 100644 --- a/addons/common/functions/fnc_addEventHandler.sqf +++ b/addons/common/functions/fnc_addEventHandler.sqf @@ -15,17 +15,15 @@ params ["_eventName", "_eventCode"]; -private ["_eventNames", "_eventFunctions", "_eventIndex"]; +GVAR(events) params ["_eventNames"]; -_eventNames = GVAR(events) select 0; -_eventFunctions = []; -_eventIndex = _eventNames find _eventName; +private _eventFunctions = []; +private _eventIndex = _eventNames find _eventName; if (_eventIndex != -1) then { _eventFunctions = (GVAR(events) select 1) select _eventIndex; } else { - private "_eventNameCount"; - _eventNameCount = count _eventNames; + private _eventNameCount = count _eventNames; _eventNames set [_eventNameCount, _eventName]; (GVAR(events) select 1) set [_eventNameCount, _eventFunctions]; diff --git a/addons/common/functions/fnc_addMapMarkerCreatedEventHandler.sqf b/addons/common/functions/fnc_addMapMarkerCreatedEventHandler.sqf index 05e23cf099..2201426e48 100644 --- a/addons/common/functions/fnc_addMapMarkerCreatedEventHandler.sqf +++ b/addons/common/functions/fnc_addMapMarkerCreatedEventHandler.sqf @@ -18,8 +18,7 @@ if (_statement isEqualType "") then { _statement = compile _statement; }; -private "_actionsVar"; -_actionsVar = missionNamespace getVariable ["ACE_EventHandler_MapMarker", [-1, [], []]]; +private _actionsVar = missionNamespace getVariable ["ACE_EventHandler_MapMarker", [-1, [], []]]; _actionsVar params ["_id", "_actionIDs", "_actions"]; diff --git a/addons/common/functions/fnc_addScrollWheelEventHandler.sqf b/addons/common/functions/fnc_addScrollWheelEventHandler.sqf index 45f935812f..aef88543be 100644 --- a/addons/common/functions/fnc_addScrollWheelEventHandler.sqf +++ b/addons/common/functions/fnc_addScrollWheelEventHandler.sqf @@ -19,8 +19,7 @@ if (_statement isEqualType "") then { _statement = compile _statement; }; -private "_actionsVar"; -_actionsVar = missionNamespace getVariable ["ACE_EventHandler_ScrollWheel", [-1, [], []]]; +private _actionsVar = missionNamespace getVariable ["ACE_EventHandler_ScrollWheel", [-1, [], []]]; _actionsVar params ["_id", "_actionIDs", "_actions"]; diff --git a/addons/common/functions/fnc_addSetting.sqf b/addons/common/functions/fnc_addSetting.sqf index 06162de6b1..0cf25b860a 100644 --- a/addons/common/functions/fnc_addSetting.sqf +++ b/addons/common/functions/fnc_addSetting.sqf @@ -22,8 +22,7 @@ params ["_name", "", "", "", "", "", "", "_value"]; //["_name", "_typeName", "_isClientSetable", "_localizedName", "_localizedDescription", "_possibleValues", "_isForced", "_value"]; -private "_settingData"; -_settingData = [_name] call FUNC(getSettingData); +private _settingData = [_name] call FUNC(getSettingData); // Exit if the setting already exists if (count _settingData > 0) exitWith {}; diff --git a/addons/common/functions/fnc_addSyncedEventHandler.sqf b/addons/common/functions/fnc_addSyncedEventHandler.sqf index 801a915dc5..0964e419bc 100644 --- a/addons/common/functions/fnc_addSyncedEventHandler.sqf +++ b/addons/common/functions/fnc_addSyncedEventHandler.sqf @@ -21,9 +21,7 @@ if (HASH_HASKEY(GVAR(syncedEvents),_name)) exitWith { false }; -private ["_eventId", "_data"]; - -_eventId = [_name, FUNC(_handleSyncedEvent)] call FUNC(addEventHandler); -_data = [_handler, [], _ttl, _eventId]; +private _eventId = [_name, FUNC(_handleSyncedEvent)] call FUNC(addEventHandler); +private _data = [_handler, [], _ttl, _eventId]; HASH_SET(GVAR(syncedEvents),_name,_data); diff --git a/addons/common/functions/fnc_addToInventory.sqf b/addons/common/functions/fnc_addToInventory.sqf index 4019de93ac..9d796d6018 100644 --- a/addons/common/functions/fnc_addToInventory.sqf +++ b/addons/common/functions/fnc_addToInventory.sqf @@ -18,9 +18,9 @@ params ["_unit", "_classname", ["_container", ""], ["_ammoCount", -1]]; -private ["_type", "_canAdd", "_addedToUnit"]; +private _type = _classname call FUNC(getItemType); -_type = [_classname] call FUNC(getItemType); +private ["_canAdd", "_addedToUnit"]; switch (_container) do { case "vest": { @@ -59,8 +59,7 @@ switch (_type select 0) do { } else { _addedToUnit = false; - private "_pos"; - _pos = _unit modelToWorldVisual [0,1,0.05]; + private _pos = _unit modelToWorldVisual [0,1,0.05]; _unit = createVehicle ["WeaponHolder_Single_F", _pos, [], 0, "NONE"]; _unit addWeaponCargoGlobal [_classname, 1]; @@ -93,8 +92,7 @@ switch (_type select 0) do { } else { _addedToUnit = false; - private "_pos"; - _pos = _unit modelToWorldVisual [0,1,0.05]; + private _pos = _unit modelToWorldVisual [0,1,0.05]; _unit = createVehicle ["WeaponHolder_Single_F", _pos, [], 0, "NONE"]; _unit addMagazineCargoGlobal [_classname, 1/*_ammoCount*/]; //@todo Bug! This isn't really the ammo, but magazine count. No such command. @@ -123,8 +121,7 @@ switch (_type select 0) do { } else { _addedToUnit = false; - private "_pos"; - _pos = _unit modelToWorldVisual [0,1,0.05]; + private _pos = _unit modelToWorldVisual [0,1,0.05]; _unit = createVehicle ["WeaponHolder_Single_F", _pos, [], 0, "NONE"]; _unit addItemCargoGlobal [_classname, 1]; diff --git a/addons/common/functions/fnc_applyForceWalkStatus.sqf b/addons/common/functions/fnc_applyForceWalkStatus.sqf index d3b58a25a4..656e4a6d25 100644 --- a/addons/common/functions/fnc_applyForceWalkStatus.sqf +++ b/addons/common/functions/fnc_applyForceWalkStatus.sqf @@ -17,7 +17,6 @@ params ["_unit"]; -private "_forceWalkNumber"; -_forceWalkNumber = _unit getVariable ["ACE_forceWalkStatusNumber", 0]; +private _forceWalkNumber = _unit getVariable ["ACE_forceWalkStatusNumber", 0]; _unit forceWalk (_forceWalkNumber > 0); diff --git a/addons/common/functions/fnc_assignObjectsInList.sqf b/addons/common/functions/fnc_assignObjectsInList.sqf index edfeb1b709..5724521a7b 100644 --- a/addons/common/functions/fnc_assignObjectsInList.sqf +++ b/addons/common/functions/fnc_assignObjectsInList.sqf @@ -41,4 +41,5 @@ if (_list isEqualType "") then { }; }; }; + false } count _list; diff --git a/addons/common/functions/fnc_assignedItemFix.sqf b/addons/common/functions/fnc_assignedItemFix.sqf index 9f804eaa4d..d93409ce7c 100644 --- a/addons/common/functions/fnc_assignedItemFix.sqf +++ b/addons/common/functions/fnc_assignedItemFix.sqf @@ -12,13 +12,11 @@ */ #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}}; +ACE_isMapEnabled = call {private _config = missionConfigFile >> "showMap"; !isNumber _config || {getNumber _config == 1}}; // default value is 1, so do isNumber check first +ACE_isCompassEnabled = call {private _config = missionConfigFile >> "showCompass"; !isNumber _config || {getNumber _config == 1}}; +ACE_isWatchEnabled = call {private _config = missionConfigFile >> "showWatch"; !isNumber _config || {getNumber _config == 1}}; +ACE_isRadioEnabled = call {private _config = missionConfigFile >> "showRadio"; !isNumber _config || {getNumber _config == 1}}; +ACE_isGPSEnabled = call {private _config = missionConfigFile >> "showGPS"; !isNumber _config || {getNumber _config == 1}}; GVAR(AssignedItems) = []; GVAR(AssignedItemsInfo) = []; diff --git a/addons/common/functions/fnc_binarizeNumber.sqf b/addons/common/functions/fnc_binarizeNumber.sqf index aff2f9dc17..0945afa770 100644 --- a/addons/common/functions/fnc_binarizeNumber.sqf +++ b/addons/common/functions/fnc_binarizeNumber.sqf @@ -17,19 +17,17 @@ params ["_number", ["_minLength", 8]]; _number = round _number; -private ["_array", "_index", "_rest"]; - -_array = []; +private _array = []; _array resize _minLength; for "_index" from 0 to (_minLength - 1) do { _array set [_index, false]; }; -_index = 0; +private _index = 0; while {_number > 0} do { - _rest = _number mod 2; + private _rest = _number mod 2; _number = floor (_number / 2); _array set [_index, _rest == 1]; diff --git a/addons/common/functions/fnc_cachedCall.sqf b/addons/common/functions/fnc_cachedCall.sqf index 59350d0483..2c7cdd4b27 100644 --- a/addons/common/functions/fnc_cachedCall.sqf +++ b/addons/common/functions/fnc_cachedCall.sqf @@ -24,10 +24,8 @@ if ((_namespace getVariable [_uid, [-99999]]) select 0 < ACE_diagTime) then { // Does the cache needs to be cleared on an event? if (!isNil "_event") then { - private ["_varName", "_cacheList"]; - - _varName = format [QGVAR(clearCache_%1), _event]; - _cacheList = missionNamespace getVariable _varName; + private _varName = format [QGVAR(clearCache_%1), _event]; + private _cacheList = missionNamespace getVariable _varName; // If there was no EH to clear these caches, add one if (isNil "_cacheList") then { @@ -35,14 +33,13 @@ if ((_namespace getVariable [_uid, [-99999]]) select 0 < ACE_diagTime) then { missionNamespace setVariable [_varName, _cacheList]; [_event, { - private ["_varName", "_cacheList"]; // _eventName is defined on the function that calls the event #ifdef DEBUG_MODE_FULL ACE_LOGINFO_1("Clear cached variables on event: %1",_eventName); #endif // Get the list of caches to clear - _varName = format [QGVAR(clearCache_%1), _eventName]; - _cacheList = missionNamespace getVariable [_varName, []]; + private _varName = format [QGVAR(clearCache_%1), _eventName]; + private _cacheList = missionNamespace getVariable [_varName, []]; // Erase all the cached results { _x call FUNC(eraseCache); diff --git a/addons/common/functions/fnc_canGetInPosition.sqf b/addons/common/functions/fnc_canGetInPosition.sqf index 45a2642655..c470337d6a 100644 --- a/addons/common/functions/fnc_canGetInPosition.sqf +++ b/addons/common/functions/fnc_canGetInPosition.sqf @@ -27,19 +27,19 @@ _position = toLower _position; // general if (!alive _vehicle || {locked _vehicle > 1}) exitWith {false}; -private ["_config", "_turret", "_radius", "_selectionPosition", "_selectionPosition2", "_enemiesInVehicle", "_return"]; +private ["_selectionPosition", "_selectionPosition2"]; -_config = configFile >> "CfgVehicles" >> typeOf _vehicle; -_turret = []; +private _config = configFile >> "CfgVehicles" >> typeOf _vehicle; +private _turret = []; -_radius = 0; +private _radius = 0; -_enemiesInVehicle = false; //Possible Side Restriction +private _enemiesInVehicle = false; //Possible Side Restriction { if (side _unit getFriend side _x < 0.6) exitWith {_enemiesInVehicle = true}; } forEach crew _vehicle; -_return = false; +private _return = false; switch (_position) do { case "driver" : { _radius = getNumber (_config >> "getInRadius"); @@ -60,11 +60,10 @@ switch (_position) do { }; case "gunner" : { - private "_turretConfig"; _turret = [_vehicle] call FUNC(getTurretGunner); if (_turret isEqualTo []) exitWith {false}; - _turretConfig = [_config, _turret] call FUNC(getTurretConfigPath); + private _turretConfig = [_config, _turret] call FUNC(getTurretConfigPath); _radius = getNumber (_config >> "getInRadius"); _selectionPosition = _vehicle selectionPosition (getText (_turretConfig >> "memoryPointsGetInGunner")); @@ -73,11 +72,10 @@ switch (_position) do { }; case "commander" : { - private "_turretConfig"; _turret = [_vehicle] call FUNC(getTurretCommander); if (_turret isEqualTo []) exitWith {false}; - _turretConfig = [_config, _turret] call FUNC(getTurretConfigPath); + private _turretConfig = [_config, _turret] call FUNC(getTurretConfigPath); _radius = getNumber (_config >> "getInRadius"); _selectionPosition = _vehicle selectionPosition (getText (_turretConfig >> "memoryPointsGetInGunner")); @@ -86,11 +84,10 @@ switch (_position) do { }; case "copilot" : { - private "_turretConfig"; _turret = [_vehicle] call FUNC(getTurretCopilot); if (_turret isEqualTo []) exitWith {false}; - _turretConfig = [_config, _turret] call FUNC(getTurretConfigPath); + private _turretConfig = [_config, _turret] call FUNC(getTurretConfigPath); _radius = getNumber (_config >> "getInRadius"); _selectionPosition = _vehicle selectionPosition (getText (_turretConfig >> "memoryPointsGetInGunner")); @@ -99,13 +96,12 @@ switch (_position) do { }; case "turret" : { - private ["_turrets", "_turretConfig"]; - _turrets = [_vehicle] call FUNC(getTurretsOther); + private _turrets = [_vehicle] call FUNC(getTurretsOther); if (_index != -1 && {_turret = _turrets select _index; CANGETINTURRETINDEX }) then { - _turretConfig = [_config, _turret] call FUNC(getTurretConfigPath); + private _turretConfig = [_config, _turret] call FUNC(getTurretConfigPath); _radius = getNumber (_config >> "getInRadius"); _selectionPosition = _vehicle selectionPosition (getText (_turretConfig >> "memoryPointsGetInGunner")); @@ -115,7 +111,7 @@ switch (_position) do { for "_index" from 0 to (count _turrets - 1) do { _turret = _turrets select _index; if (CANGETINTURRETINDEX) exitWith { - _turretConfig = [_config, _turret] call FUNC(getTurretConfigPath); + private _turretConfig = [_config, _turret] call FUNC(getTurretConfigPath); _radius = getNumber (_config >> "getInRadius"); _selectionPosition = _vehicle selectionPosition (getText (_turretConfig >> "memoryPointsGetInGunner")); @@ -127,13 +123,12 @@ switch (_position) do { }; case "ffv" : { - private ["_turrets", "_turretConfig"]; - _turrets = [_vehicle] call FUNC(getTurretsFFV); + private _turrets = [_vehicle] call FUNC(getTurretsFFV); if (_index != -1 && {_turret = _turrets select _index; CANGETINTURRETINDEX }) then { - _turretConfig = [_config, _turret] call FUNC(getTurretConfigPath); + private _turretConfig = [_config, _turret] call FUNC(getTurretConfigPath); _radius = getNumber (_config >> "getInRadius"); _selectionPosition = _vehicle selectionPosition (getText (_turretConfig >> "memoryPointsGetInGunner")); @@ -143,7 +138,7 @@ switch (_position) do { for "_index" from 0 to (count _turrets - 1) do { _turret = _turrets select _index; if (CANGETINTURRETINDEX) exitWith { - _turretConfig = [_config, _turret] call FUNC(getTurretConfigPath); + private _turretConfig = [_config, _turret] call FUNC(getTurretConfigPath); _radius = getNumber (_config >> "getInRadius"); _selectionPosition = _vehicle selectionPosition (getText (_turretConfig >> "memoryPointsGetInGunner")); @@ -155,8 +150,7 @@ switch (_position) do { }; case "codriver" : { - private "_positions"; - _positions = [typeOf _vehicle] call FUNC(getVehicleCodriver); + private _positions = [typeOf _vehicle] call FUNC(getVehicleCodriver); { if (alive _x) then {_positions deleteAt (_positions find (_vehicle getCargoIndex _x))}; @@ -189,8 +183,7 @@ switch (_position) do { }; case "cargo" : { - private "_positions"; - _positions = [typeOf _vehicle] call FUNC(getVehicleCargo); + private _positions = [typeOf _vehicle] call FUNC(getVehicleCargo); { if (alive _x) then {_positions deleteAt (_positions find (_vehicle getCargoIndex _x))}; @@ -226,14 +219,11 @@ switch (_position) do { default {}; }; -private "_fnc_isInRange"; -_fnc_isInRange = { +private _fnc_isInRange = { if (_radius == 0) exitWith {true}; - private ["_unitPosition", "_distance"]; - _unitPosition = getPos _unit; - - _distance = _unitPosition distance (_vehicle modelToWorldVisual _selectionPosition); + private _unitPosition = getPos _unit; + private _distance = _unitPosition distance (_vehicle modelToWorldVisual _selectionPosition); if (!isNil "_selectionPosition2") then { _distance = _distance min (_unitPosition distance (_vehicle modelToWorldVisual _selectionPosition2)); diff --git a/addons/common/functions/fnc_canInteractWith.sqf b/addons/common/functions/fnc_canInteractWith.sqf index 31ebf6b89f..4b4382a14e 100644 --- a/addons/common/functions/fnc_canInteractWith.sqf +++ b/addons/common/functions/fnc_canInteractWith.sqf @@ -18,20 +18,17 @@ params ["_unit", "_target", ["_exceptions", []]]; _exceptions = [_exceptions, {toLower _this}] call FUNC(map); -private "_owner"; -_owner = _target getVariable [QGVAR(owner), objNull]; +private _owner = _target getVariable [QGVAR(owner), objNull]; // exit if the target is not free to interact if (!isNull _owner && {_unit != _owner}) exitWith {false}; // check general conditions -private ["_conditions", "_canInteract"]; - -_conditions = missionNamespace getVariable [QGVAR(InteractionConditions), [[],[]]]; - +private _conditions = missionNamespace getVariable [QGVAR(InteractionConditions), [[],[]]]; _conditions params ["_conditionNames", "_conditionFuncs"]; -_canInteract = true; +private _canInteract = true; + { if (!(_x in _exceptions) && {!([_unit, _target] call (_conditionFuncs select _forEachIndex))}) exitWith { _canInteract = false; diff --git a/addons/common/functions/fnc_canUseWeapon.sqf b/addons/common/functions/fnc_canUseWeapon.sqf index 31aaba17a2..a92d0a2b97 100644 --- a/addons/common/functions/fnc_canUseWeapon.sqf +++ b/addons/common/functions/fnc_canUseWeapon.sqf @@ -13,12 +13,11 @@ */ #include "script_component.hpp" -params ["_unit"]; +params [["_unit", objNull, [objNull]]]; if (_unit == vehicle _unit) exitWith {true}; -private "_config"; -_config = configFile >> "CfgMovesMaleSdr" >> "States" >> animationState _unit; +private _config = configFile >> "CfgMovesMaleSdr" >> "States" >> animationState _unit; isClass _config && {getNumber (_config >> "canPullTrigger") == 1} diff --git a/addons/common/functions/fnc_changeProjectileDirection.sqf b/addons/common/functions/fnc_changeProjectileDirection.sqf index 79b8c8aeea..89a8988306 100644 --- a/addons/common/functions/fnc_changeProjectileDirection.sqf +++ b/addons/common/functions/fnc_changeProjectileDirection.sqf @@ -17,14 +17,12 @@ params ["_projectile", "_adjustDir", "_adjustUp", ["_adjustSpeed",0]]; -private ["_vdir", "_dir", "_up", "_vlat", "_vup", "_vel"]; - // get old direction vector -_vdir = vectorNormalized velocity _projectile; +private _vdir = vectorNormalized velocity _projectile; // get azimuth and inclination and apply corrections -_dir = (_vdir select 0) atan2 (_vdir select 1) + _adjustDir; -_up = asin (_vdir select 2) + _adjustUp; +private _dir = (_vdir select 0) atan2 (_vdir select 1) + _adjustDir; +private _up = asin (_vdir select 2) + _adjustUp; // get new direction vector (this is a unit vector) _vdir = [ @@ -34,11 +32,11 @@ _vdir = [ ]; // get best up vector -_vlat = vectorNormalized (_vdir vectorCrossProduct [0,0,1]); -_vup = _vlat vectorCrossProduct _vdir; +private _vlat = vectorNormalized (_vdir vectorCrossProduct [0,0,1]); +private _vup = _vlat vectorCrossProduct _vdir; // get new speed vector. Keep total speed, but change to new direction. Yay for vector commands. -_vel = _vdir vectorMultiply (_adjustSpeed + vectorMagnitude velocity _projectile); +private _vel = _vdir vectorMultiply (_adjustSpeed + vectorMagnitude velocity _projectile); // set projectile direction dir and up. Projectiles are long objects, especially with tracers, so it would look dumb otherwise. _projectile setVectorDirAndUp [_vdir, _vup]; diff --git a/addons/common/functions/fnc_checkFiles.sqf b/addons/common/functions/fnc_checkFiles.sqf index 2c8976f042..cdf5cb3d93 100644 --- a/addons/common/functions/fnc_checkFiles.sqf +++ b/addons/common/functions/fnc_checkFiles.sqf @@ -15,21 +15,18 @@ /////////////// // check addons /////////////// -private "_version"; -_version = getText (configFile >> "CfgPatches" >> "ace_main" >> "versionStr"); +private _version = getText (configFile >> "CfgPatches" >> "ace_main" >> "versionStr"); ACE_LOGINFO_1("ACE is version %1.",_version); -private "_addons"; -//_addons = activatedAddons; // broken with High-Command module, see #2134 -_addons = "true" configClasses (configFile >> "CfgPatches");// +//private _addons = activatedAddons; // broken with High-Command module, see #2134 +private _addons = "true" configClasses (configFile >> "CfgPatches");// _addons = [_addons, {toLower configName _this}] call FUNC(map);// _addons = [_addons, {_this find "ace_" == 0}] call FUNC(filter); { if (getText (configFile >> "CfgPatches" >> _x >> "versionStr") != _version) then { - private "_errorMsg"; - _errorMsg = format ["File %1.pbo is outdated.", _x]; + private _errorMsg = format ["File %1.pbo is outdated.", _x]; ACE_LOGERROR(_errorMsg); @@ -44,12 +41,10 @@ _addons = [_addons, {_this find "ace_" == 0}] call FUNC(filter); // check dlls /////////////// { - private "_versionEx"; - _versionEx = _x callExtension "version"; + private _versionEx = _x callExtension "version"; if (_versionEx == "") then { - private "_errorMsg"; - _errorMsg = format ["Extension %1.dll not installed.", _x]; + private _errorMsg = format ["Extension %1.dll not installed.", _x]; ACE_LOGERROR(_errorMsg); @@ -84,8 +79,7 @@ if (isMultiplayer) then { (_this select 0) params ["_version", "_addons"]; if (_version != GVAR(ServerVersion)) then { - private "_errorMsg"; - _errorMsg = format ["Client/Server Version Mismatch. Server: %1, Client: %2.", GVAR(ServerVersion), _version]; + private _errorMsg = format ["Client/Server Version Mismatch. Server: %1, Client: %2.", GVAR(ServerVersion), _version]; ACE_LOGERROR(_errorMsg); diff --git a/addons/common/functions/fnc_checkPBOs.sqf b/addons/common/functions/fnc_checkPBOs.sqf index a196e8d4ca..f447d126af 100644 --- a/addons/common/functions/fnc_checkPBOs.sqf +++ b/addons/common/functions/fnc_checkPBOs.sqf @@ -41,10 +41,8 @@ if (!isServer) then { // Display error message. if (_missingAddon || {_missingAddonServer} || {_oldVersionClient} || {_oldVersionServer}) then { - private ["_text", "_error"]; - - _text = "[ACE] Version mismatch:

"; - _error = format ["ACE version mismatch: %1: ", profileName]; + private _text = "[ACE] Version mismatch:

"; + private _error = format ["ACE version mismatch: %1: ", profileName]; if (_missingAddon) then { _text = _text + "Detected missing addon on client
"; @@ -69,13 +67,11 @@ if (!isServer) then { if (_mode < 2) then { _text = composeText [lineBreak, parseText format ["%1", _text]]; - private ["_rscLayer", "_ctrlHint"]; - - _rscLayer = "ACE_RscErrorHint" call BIS_fnc_rscLayer; + private _rscLayer = "ACE_RscErrorHint" call BIS_fnc_rscLayer; _rscLayer cutRsc ["ACE_RscErrorHint", "PLAIN", 0, true]; disableSerialization; - _ctrlHint = uiNamespace getVariable "ACE_ctrlErrorHint"; + private _ctrlHint = uiNamespace getVariable "ACE_ctrlErrorHint"; _ctrlHint ctrlSetStructuredText _text; if (_mode == 0) then { diff --git a/addons/common/functions/fnc_claim.sqf b/addons/common/functions/fnc_claim.sqf index ac89a80172..cc514a2a6f 100644 --- a/addons/common/functions/fnc_claim.sqf +++ b/addons/common/functions/fnc_claim.sqf @@ -16,8 +16,7 @@ params ["_unit", "_target", ["_lockTarget", false]]; -private "_owner"; -_owner = _target getVariable [QGVAR(owner), objNull]; +private _owner = _target getVariable [QGVAR(owner), objNull]; if (!isNull _owner && {!isNull _unit} && {_unit != _owner}) then { ACE_LOGERROR("Claiming already owned object."); diff --git a/addons/common/functions/fnc_createOrthonormalReference.sqf b/addons/common/functions/fnc_createOrthonormalReference.sqf index 4a8db8bba1..e45bf269aa 100644 --- a/addons/common/functions/fnc_createOrthonormalReference.sqf +++ b/addons/common/functions/fnc_createOrthonormalReference.sqf @@ -14,10 +14,10 @@ */ #include "script_component.hpp" -private ["_v1", "_v2", "_v3"]; +[_this] params [["_vector", [0,0,1], [[]], 3]]; -_v1 = vectorNormalized _this; -_v2 = vectorNormalized (_v1 vectorCrossProduct [0,0,1]); -_v3 = _v2 vectorCrossProduct _v1; +private _v1 = vectorNormalized _this; +private _v2 = vectorNormalized (_v1 vectorCrossProduct [0,0,1]); +private _v3 = _v2 vectorCrossProduct _v1; -[_v1,_v2,_v3] +[_v1, _v2, _v3] diff --git a/addons/common/functions/fnc_currentChannel.sqf b/addons/common/functions/fnc_currentChannel.sqf index 82dd66b485..a78e2b0204 100644 --- a/addons/common/functions/fnc_currentChannel.sqf +++ b/addons/common/functions/fnc_currentChannel.sqf @@ -15,8 +15,7 @@ #define CHANNELS ["global", "side", "command", "group", "vehicle", "direct"] #define CHANNELS_LOCALIZED [localize "str_channel_global", localize "str_channel_side", localize "str_channel_command", localize "str_channel_group", localize "str_channel_vehicle", localize "str_channel_direct"] -private "_currentChannel"; -_currentChannel = currentChannel; +private _currentChannel = currentChannel; if (_currentChannel < count CHANNELS) then { _currentChannel = CHANNELS select _currentChannel; diff --git a/addons/common/functions/fnc_debug.sqf b/addons/common/functions/fnc_debug.sqf index 6dd1f04163..862f7fe764 100644 --- a/addons/common/functions/fnc_debug.sqf +++ b/addons/common/functions/fnc_debug.sqf @@ -18,20 +18,15 @@ params ["_msg", ["_level", 2, [0]]]; -private ["_defaultLoglevel", "_defaultLogDisplayLevel"]; - -_defaultLoglevel = [GVAR(LOGLEVEL), DEFAULT_LOGGING_LEVEL] select isNil QGVAR(LOGLEVEL); +private _defaultLoglevel = [GVAR(LOGLEVEL), DEFAULT_LOGGING_LEVEL] select isNil QGVAR(LOGLEVEL); if (_defaultLoglevel < 0) exitWith {false}; -_defaultLogDisplayLevel = [GVAR(LOGDISPLAY_LEVEL), DEFAULT_TEXT_DISPLAY] select isNil QGVAR(LOGDISPLAY_LEVEL); +private _defaultLogDisplayLevel = [GVAR(LOGDISPLAY_LEVEL), DEFAULT_TEXT_DISPLAY] select isNil QGVAR(LOGDISPLAY_LEVEL); if (_level <= _defaultLoglevel) then { - private ["_prefix", "_message"]; - - _prefix = ["Unknown", "Error", "Warn", "Debug", "Info"] select ([0, 1, 2, 3] find _level + 1); - - _message = format ["[ACE %1] %2", _prefix, _msg]; + private _prefix = ["Unknown", "Error", "Warn", "Debug", "Info"] select ([0, 1, 2, 3] find _level + 1); + private _message = format ["[ACE %1] %2", _prefix, _msg]; if (_level <= _defaultLogDisplayLevel) then { systemChat _message; diff --git a/addons/common/functions/fnc_deviceKeyFindValidIndex.sqf b/addons/common/functions/fnc_deviceKeyFindValidIndex.sqf index 16a80d6e3f..02135e59db 100644 --- a/addons/common/functions/fnc_deviceKeyFindValidIndex.sqf +++ b/addons/common/functions/fnc_deviceKeyFindValidIndex.sqf @@ -18,9 +18,7 @@ params [["_searchOffsetOrName", 0]]; -private ["_validIndex", "_realIndex"]; - -_validIndex = -1; +private _validIndex = -1; if (_searchOffsetOrName isEqualType "") then { { @@ -33,7 +31,7 @@ if (_searchOffsetOrName isEqualType "") then { _baseIndex = [GVAR(deviceKeyCurrentIndex) + _searchOffsetOrName, 0] select (GVAR(deviceKeyCurrentIndex) == -1); for "_offset" from _baseIndex to (count GVAR(deviceKeyHandlingArray) - 1 + _baseIndex) do { - _realIndex = _offset % (count GVAR(deviceKeyHandlingArray)); + private _realIndex = _offset % (count GVAR(deviceKeyHandlingArray)); if ([] call ((GVAR(deviceKeyHandlingArray) select _realIndex) select 2)) exitWith { _validIndex = _realIndex; diff --git a/addons/common/functions/fnc_disableAI.sqf b/addons/common/functions/fnc_disableAI.sqf index 1a66628ffb..75c59d1a9a 100644 --- a/addons/common/functions/fnc_disableAI.sqf +++ b/addons/common/functions/fnc_disableAI.sqf @@ -16,7 +16,7 @@ */ #include "script_component.hpp" -params ["_unit", "_disable"]; +params [["_unit", objNull, [objNull]], ["_disable", true, [false]]]; if (!local _unit) exitWith {}; diff --git a/addons/common/functions/fnc_disableUserInput.sqf b/addons/common/functions/fnc_disableUserInput.sqf index 8b00cedeac..8e28edc5f0 100644 --- a/addons/common/functions/fnc_disableUserInput.sqf +++ b/addons/common/functions/fnc_disableUserInput.sqf @@ -31,8 +31,7 @@ if (_state) then { closeDialog 0; createDialog QGVAR(DisableMouse_Dialog); - private "_dlg"; - _dlg = uiNamespace getVariable QGVAR(dlgDisableMouse); + private _dlg = uiNamespace getVariable QGVAR(dlgDisableMouse); _dlg displayAddEventHandler ["KeyDown", { params ["", "_key"]; @@ -42,15 +41,13 @@ if (_state) then { disableSerialization; - private ["_dlg", "_ctrl"]; - - _dlg = findDisplay 49; + private _dlg = findDisplay 49; for "_index" from 100 to 2000 do { (_dlg displayCtrl _index) ctrlEnable false; }; - _ctrl = _dlg displayctrl 103; + private _ctrl = _dlg displayctrl 103; _ctrl ctrlSetEventHandler ["buttonClick", QUOTE(while {!isNull (uiNamespace getVariable [ARR_2(QUOTE(QGVAR(dlgDisableMouse)),displayNull)])} do {closeDialog 0}; failMission 'LOSER'; [false] call DFUNC(disableUserInput);)]; _ctrl ctrlEnable true; _ctrl ctrlSetText "ABORT"; @@ -58,7 +55,7 @@ if (_state) then { _ctrl = _dlg displayctrl ([104, 1010] select isMultiplayer); _ctrl ctrlSetEventHandler ["buttonClick", QUOTE(closeDialog 0; player setDamage 1; [false] call DFUNC(disableUserInput);)]; - _ctrl ctrlEnable (call {private "_config"; _config = missionConfigFile >> "respawnButton"; !isNumber _config || {getNumber _config == 1}}); + _ctrl ctrlEnable (call {private _config = missionConfigFile >> "respawnButton"; !isNumber _config || {getNumber _config == 1}}); _ctrl ctrlSetText "RESPAWN"; _ctrl ctrlSetTooltip "Respawn."; }; @@ -66,8 +63,7 @@ if (_state) then { if (_key in actionKeys "TeamSwitch" && {teamSwitchEnabled}) then { (uiNamespace getVariable [QGVAR(dlgDisableMouse), displayNull]) closeDisplay 0; - private "_acc"; - _acc = accTime; + private _acc = accTime; teamSwitch; setAccTime _acc; }; diff --git a/addons/common/functions/fnc_displayIcon.sqf b/addons/common/functions/fnc_displayIcon.sqf index 23c5631fa6..c51b3bd454 100644 --- a/addons/common/functions/fnc_displayIcon.sqf +++ b/addons/common/functions/fnc_displayIcon.sqf @@ -45,14 +45,11 @@ disableSerialization; params ["_iconId", "_show", "_icon", "_color", ["_timeAlive", DEFAULT_TIME]]; -private ["_list", "_refresh"]; +private _list = missionNamespace getVariable [QGVAR(displayIconList), []]; -_list = missionNamespace getVariable [QGVAR(displayIconList), []]; - -_refresh = { +private _refresh = { // Refreshing of all icons.. - private "_allControls"; - _allControls = missionNamespace getVariable [QGVAR(displayIconListControls), []]; + private _allControls = missionNamespace getVariable [QGVAR(displayIconListControls), []]; { ctrlDelete _x; @@ -61,18 +58,16 @@ _refresh = { _allControls = []; - private ["_setting", "_ctrl", "_position"]; - - _setting = missionNamespace getVariable [QGVAR(settingFeedbackIcons), 0]; + private _setting = missionNamespace getVariable [QGVAR(settingFeedbackIcons), 0]; if (_setting > 0) then { { _x params ["", "_xicon", "_xcolor"]; // +19000 because we want to make certain we are using free IDCs.. - _ctrl = (findDisplay 46) ctrlCreate ["RscPicture", _forEachIndex + 19000]; + private _ctrl = (findDisplay 46) ctrlCreate ["RscPicture", _forEachIndex + 19000]; - _position = switch (_setting) do { + private _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]}; @@ -115,8 +110,7 @@ if (_show) then { } else { if ({_x select 0 == _iconId} count _list == 1) then { - private "_newList"; - _newList = []; + private _newList = []; { if (_x select 0 != _iconId) then { diff --git a/addons/common/functions/fnc_displayText.sqf b/addons/common/functions/fnc_displayText.sqf index fce8fdd832..3c68327535 100644 --- a/addons/common/functions/fnc_displayText.sqf +++ b/addons/common/functions/fnc_displayText.sqf @@ -23,12 +23,9 @@ if (isNil QGVAR(lastHint)) then { if !(typeName _text in ["STRING", "TEXT"]) then {_text = str _text}; -private ["_lastHintTime", "_lastHintPriority", "_time"]; +GVAR(lastHint) params ["_lastHintTime", "_lastHintPriority"]; -_lastHintTime = GVAR(lastHint) select 0; -_lastHintPriority = GVAR(lastHint) select 1; - -_time = ACE_time; +private _time = ACE_time; if (_time > _lastHintTime + _delay || {_priority >= _lastHintPriority}) then { hintSilent _text; diff --git a/addons/common/functions/fnc_displayTextStructured.sqf b/addons/common/functions/fnc_displayTextStructured.sqf index ce088163a6..9fff7bb056 100644 --- a/addons/common/functions/fnc_displayTextStructured.sqf +++ b/addons/common/functions/fnc_displayTextStructured.sqf @@ -35,36 +35,34 @@ if (typeName _text != "TEXT") then { _text = composeText [lineBreak, parseText format ["%1", _text]]; }; -private ["_isShown", "_ctrlHint", "_xPos", "_yPos", "_wPos", "_hPos", "_position"]; - -_isShown = ctrlShown (uiNamespace getVariable ["ACE_ctrlHint", controlNull]); +private _isShown = ctrlShown (uiNamespace getVariable ["ACE_ctrlHint", controlNull]); ("ACE_RscHint" call BIS_fnc_rscLayer) cutRsc ["ACE_RscHint", "PLAIN", 0, true]; disableSerialization; -_ctrlHint = uiNamespace getVariable "ACE_ctrlHint"; +private _ctrlHint = uiNamespace getVariable "ACE_ctrlHint"; _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))]; +private _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))]; +private _yPos = profilenamespace getVariable ["IGUI_GRID_ACE_displayText_Y", safeZoneY + 0.175 * safezoneH]; +private _wPos = profilenamespace getVariable ["IGUI_GRID_ACE_displayText_W", (10 *(((safezoneW / safezoneH) min 1.2) / 40))]; +private _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)); +private _xPos = ((safezoneX + safezoneW) - (10 *(((safezoneW / safezoneH) min 1.2) / 40)) - 2.9 *(((safezoneW / safezoneH) min 1.2) / 40)); +private _yPos = safeZoneY + 0.175 * safezoneH; +private _wPos = (10 *(((safezoneW / safezoneH) min 1.2) / 40)); +private _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]; +private _position = [_xPos, _yPos, _wPos, _size * _hPos]; _ctrlHint ctrlSetPosition _position; _ctrlHint ctrlCommit 0; diff --git a/addons/common/functions/fnc_dropBackpack.sqf b/addons/common/functions/fnc_dropBackpack.sqf index 26c902a057..7b7ee5765e 100644 --- a/addons/common/functions/fnc_dropBackpack.sqf +++ b/addons/common/functions/fnc_dropBackpack.sqf @@ -12,11 +12,9 @@ */ #include "script_component.hpp" -params ["_unit"]; +params [["_unit", objNull, [objNull]]]; -private ["_backpackObject", "_holder"]; - -_backpackObject = backpackContainer _unit; +private _backpackObject = backpackContainer _unit; _unit addBackpack "ACE_FakeBackpack"; removeBackpack _unit; diff --git a/addons/common/functions/fnc_dumpPerformanceCounters.sqf b/addons/common/functions/fnc_dumpPerformanceCounters.sqf index e076831c6f..bdc4588b05 100644 --- a/addons/common/functions/fnc_dumpPerformanceCounters.sqf +++ b/addons/common/functions/fnc_dumpPerformanceCounters.sqf @@ -19,8 +19,7 @@ if (!isNil "ACE_PFH_COUNTER") then { { _x params ["_pfh", "_parameters"]; - private "_isActive"; - _isActive = ["ACTIVE", "REMOVED"] select isNil {CBA_common_PFHhandles select (_pfh select 0)}; + private _isActive = ["ACTIVE", "REMOVED"] select isNil {CBA_common_PFHhandles select (_pfh select 0)}; diag_log text format ["Registered PFH: id=%1 [%2, delay %3], %4:%5", _pfh select 0, _isActive, _parameters select 1, _pfh select 1, _pfh select 2]; false @@ -31,20 +30,18 @@ diag_log text format ["ACE COUNTER RESULTS"]; diag_log text format ["-------------------------------------------"]; { - private ["_counterEntry", "_iter", "_total", "_count", "_averageResult", "_delta"]; - - _counterEntry = _x; - _iter = 0; - _total = 0; - _count = 0; - _averageResult = 0; + private _counterEntry = _x; + private _iter = 0; + private _total = 0; + private _count = 0; + private _averageResult = 0; if (count _counterEntry > 3) then { // calc { if (_iter > 2) then { _count = _count + 1; - _delta = (_x select 1) - (_x select 0); + private _delta = (_x select 1) - (_x select 0); _total = _total + _delta; }; @@ -69,8 +66,7 @@ diag_log text format ["-------------------------------------------"]; diag_log text format["ACE_PERFORMANCE_EXCESSIVE_STEP_TRACKER"]; diag_log text format["-------------------------------------------"]; { - private["_delay"]; - _delay = _x select 2; + private _delay = _x select 2; //if(_delay > 0) then { _delay = _delay / 1000; }; diag_log text format["%1: %2s, delay=%3, handle=%4",(_x select 0), _delay, (_x select 3), (_x select 4)]; @@ -80,8 +76,7 @@ diag_log text format["-------------------------------------------"]; diag_log text format["ACE_PERFORMANCE_EXCESSIVE_FRAME_TRACKER"]; diag_log text format["-------------------------------------------"]; { - private["_delta"]; - _delta = _x select 1; + private _delta = _x select 1; //if(_delta > 0) then { _delta = _delta / 1000; }; diag_log text format[" DELTA: %1s", _delta]; } forEach ACE_PERFORMANCE_EXCESSIVE_FRAME_TRACKER; diff --git a/addons/common/functions/fnc_errorMessage.sqf b/addons/common/functions/fnc_errorMessage.sqf index aa2b872d47..88e0a3b90f 100644 --- a/addons/common/functions/fnc_errorMessage.sqf +++ b/addons/common/functions/fnc_errorMessage.sqf @@ -37,35 +37,29 @@ if (_textMessage isEqualType "") then { (ARR_SELECT(_this,4,call BIS_fnc_displayMission)) createDisplay "RscDisplayCommonMessagePause"; -private ["_display", "_ctrlRscMessageBox", "_ctrlBcgCommonTop", "_ctrlBcgCommon", "_ctrlText", "_ctrlBackgroundButtonOK", "_ctrlBackgroundButtonMiddle", "_ctrlBackgroundButtonCancel", "_ctrlButtonOK", "_ctrlButtonCancel"]; - -_display = uiNamespace getVariable "RscDisplayCommonMessage_display"; -_ctrlRscMessageBox = _display displayCtrl 2351; -_ctrlBcgCommonTop = _display displayCtrl 235100; -_ctrlBcgCommon = _display displayCtrl 235101; -_ctrlText = _display displayCtrl 235102; -_ctrlBackgroundButtonOK = _display displayCtrl 235103; -_ctrlBackgroundButtonMiddle = _display displayCtrl 235104; -_ctrlBackgroundButtonCancel = _display displayCtrl 235105; -_ctrlButtonOK = _display displayCtrl 235106; -_ctrlButtonCancel = _display displayCtrl 235107; +private _display = uiNamespace getVariable "RscDisplayCommonMessage_display"; +private _ctrlRscMessageBox = _display displayCtrl 2351; +private _ctrlBcgCommonTop = _display displayCtrl 235100; +private _ctrlBcgCommon = _display displayCtrl 235101; +private _ctrlText = _display displayCtrl 235102; +private _ctrlBackgroundButtonOK = _display displayCtrl 235103; +private _ctrlBackgroundButtonMiddle = _display displayCtrl 235104; +private _ctrlBackgroundButtonCancel = _display displayCtrl 235105; +private _ctrlButtonOK = _display displayCtrl 235106; +private _ctrlButtonCancel = _display displayCtrl 235107; _ctrlBcgCommonTop ctrlSetText _textHeader; -private ["_ctrlButtonOKPos", "_ctrlBcgCommonPos", "_bottomSpaceY", "_ctrlTextPos", "_marginX", "_marginY"]; +private _ctrlButtonOKPos = ctrlPosition _ctrlButtonOK; +private _ctrlBcgCommonPos = ctrlPosition _ctrlBcgCommon; +private _bottomSpaceY = (_ctrlButtonOKPos select 1) - ((_ctrlBcgCommonPos select 1) + (_ctrlBcgCommonPos select 3)); -_ctrlButtonOKPos = ctrlPosition _ctrlButtonOK; -_ctrlBcgCommonPos = ctrlPosition _ctrlBcgCommon; -_bottomSpaceY = (_ctrlButtonOKPos select 1) - ((_ctrlBcgCommonPos select 1) + (_ctrlBcgCommonPos select 3)); - -_ctrlTextPos = ctrlPosition _ctrlText; -_marginX = (_ctrlTextPos select 0) - (_ctrlBcgCommonPos select 0); -_marginY = (_ctrlTextPos select 1) - (_ctrlBcgCommonPos select 1); - -private ["_ctrlTextPosH", "_bottomPosY"]; +private _ctrlTextPos = ctrlPosition _ctrlText; +private _marginX = (_ctrlTextPos select 0) - (_ctrlBcgCommonPos select 0); +private _marginY = (_ctrlTextPos select 1) - (_ctrlBcgCommonPos select 1); _ctrlText ctrlSetStructuredText _textMessage; -_ctrlTextPosH = ctrlTextHeight _ctrlText; +private _ctrlTextPosH = ctrlTextHeight _ctrlText; _ctrlBcgCommon ctrlSetPosition [ _ctrlBcgCommonPos select 0, @@ -83,11 +77,10 @@ _ctrlText ctrlSetPosition [ ]; _ctrlText ctrlCommit 0; -_bottomPosY = (_ctrlBcgCommonPos select 1) + _ctrlTextPosH + (_marginY * 2) + _bottomSpaceY; +private _bottomPosY = (_ctrlBcgCommonPos select 1) + _ctrlTextPosH + (_marginY * 2) + _bottomSpaceY; { - private "_xPos"; - _xPos = ctrlPosition _x; + private _xPos = ctrlPosition _x; _xPos set [1, _bottomPosY]; _x ctrlSetPosition _xPos; @@ -100,10 +93,8 @@ _bottomPosY = (_ctrlBcgCommonPos select 1) + _ctrlTextPosH + (_marginY * 2) + _b _ctrlButtonCancel ]; -private ["_ctrlRscMessageBoxPos", "_ctrlRscMessageBoxPosH"]; - -_ctrlRscMessageBoxPos = ctrlPosition _ctrlRscMessageBox; -_ctrlRscMessageBoxPosH = _bottomPosY + (_ctrlButtonOKPos select 3); +private _ctrlRscMessageBoxPos = ctrlPosition _ctrlRscMessageBox; +private _ctrlRscMessageBoxPosH = _bottomPosY + (_ctrlButtonOKPos select 3); _ctrlRscMessageBox ctrlSetPosition [ 0.5 - (_ctrlBcgCommonPos select 2) / 2, diff --git a/addons/common/functions/fnc_execPersistentFnc.sqf b/addons/common/functions/fnc_execPersistentFnc.sqf index 0b7bccb69a..06e1397f01 100644 --- a/addons/common/functions/fnc_execPersistentFnc.sqf +++ b/addons/common/functions/fnc_execPersistentFnc.sqf @@ -28,12 +28,11 @@ _function = call compile _function; [[_arguments, _unit], _this select 1, 2] call FUNC(execRemoteFnc); // save persistent function for JIP -private ["_persistentFunctions", "_index"]; - -_persistentFunctions = _unit getVariable ["ACE_PersistentFunctions", []]; +private _persistentFunctions = _unit getVariable ["ACE_PersistentFunctions", []]; // find index to overwrite function with the same name, add to end otherwise -_index = count _persistentFunctions; +private _index = count _persistentFunctions; + { if (_x select 2 == _name) exitWith { _index = _forEachIndex; diff --git a/addons/common/functions/fnc_exportConfig.sqf b/addons/common/functions/fnc_exportConfig.sqf index 2a4890c49c..c175254e5a 100644 --- a/addons/common/functions/fnc_exportConfig.sqf +++ b/addons/common/functions/fnc_exportConfig.sqf @@ -15,26 +15,22 @@ */ #include "script_component.hpp" -private "_fnc_logEntries"; -_fnc_logEntries = { +private _fnc_logEntries = { params ["_c", "_d"]; - private ["_p", "_t", "_e", "_a", "_i"]; + private _p = inheritsFrom _c; - _p = inheritsFrom _c; - - _t = format [["class %1: %2 {", "class %1 {"] select (configName _p == ""), configName _c, configName _p]; + private _t = format [["class %1: %2 {", "class %1 {"] select (configName _p == ""), configName _c, configName _p]; for "_a" from 1 to _d do { _t = " " + _t; }; diag_log text _t; - _e = []; + private _e = []; for "_i" from 0 to (count _c - 1) do { - private ["_e1, _e2"]; - _e1 = _c select _i; + private _e1 = _c select _i; - _e2 = switch (true) do { + private _e2 = switch (true) do { case (isNumber _e1): {getNumber _e1}; case (isText _e1): {getText _e1}; case (isArray _e1): {getArray _e1}; diff --git a/addons/common/functions/fnc_filter.sqf b/addons/common/functions/fnc_filter.sqf index 0b30e59cf9..36ff328ef0 100644 --- a/addons/common/functions/fnc_filter.sqf +++ b/addons/common/functions/fnc_filter.sqf @@ -16,10 +16,9 @@ */ #include "script_component.hpp" -params ["_array", "_code"]; +params [["_array", [], [[]]], ["_code", {}, [{}]]]; -private "_result"; -_result = []; +private _result = []; { if (_x call _code) then { diff --git a/addons/common/functions/fnc_fixCrateContent.sqf b/addons/common/functions/fnc_fixCrateContent.sqf index a067c29c63..06d73c39b1 100644 --- a/addons/common/functions/fnc_fixCrateContent.sqf +++ b/addons/common/functions/fnc_fixCrateContent.sqf @@ -14,11 +14,9 @@ params ["_crate"]; -private ["_weapons", "_items"]; - // get all weapons inside the crate -_weapons = weaponCargo _crate; -_items = []; +private _weapons = weaponCargo _crate; +private _items = []; // if the "weapon" is supposed to be an item, move those from the weapon array to the item array { diff --git a/addons/common/functions/fnc_fixFloating.sqf b/addons/common/functions/fnc_fixFloating.sqf index 2eb6f2b4e4..5391402ca4 100644 --- a/addons/common/functions/fnc_fixFloating.sqf +++ b/addons/common/functions/fnc_fixFloating.sqf @@ -12,15 +12,13 @@ */ #include "script_component.hpp" -private "_object"; -_object = _this; +params ["_object"]; // setHitPointDamage requires local object if (!local _object) exitWith {}; // save and restore hitpoints, see below why -private "_hitPointDamages"; -_hitPointDamages = getAllHitPointsDamage _object; +private _hitPointDamages = getAllHitPointsDamage _object; // get correct format for objects without hitpoints if (_hitPointDamages isEqualTo []) then { diff --git a/addons/common/functions/fnc_fixPosition.sqf b/addons/common/functions/fnc_fixPosition.sqf index 54d0cdfbf6..e2e2d71059 100644 --- a/addons/common/functions/fnc_fixPosition.sqf +++ b/addons/common/functions/fnc_fixPosition.sqf @@ -16,8 +16,7 @@ // setVectorUp requires local object if (!local _this) exitWith {}; -private "_position"; -_position = getPos _this; +private _position = getPos _this; // don't place the object below the ground if (_position select 2 < -0.1) then { diff --git a/addons/common/functions/fnc_getAllDefinedSetVariables.sqf b/addons/common/functions/fnc_getAllDefinedSetVariables.sqf index 7205a943d9..a5d973767f 100644 --- a/addons/common/functions/fnc_getAllDefinedSetVariables.sqf +++ b/addons/common/functions/fnc_getAllDefinedSetVariables.sqf @@ -22,12 +22,10 @@ params ["_object", ["_category", ""]]; if (isNil QGVAR(OBJECT_VARIABLES_STORAGE)) exitWith {[]}; -private ["_return", "_val"]; - -_return = []; +private _return = []; { - _val = _object getVariable (_x select 0); + private _val = _object getVariable (_x select 0); if (!isNil "_val") then { if (_category == "" || _category == _x select 3) then { diff --git a/addons/common/functions/fnc_getCaptivityStatus.sqf b/addons/common/functions/fnc_getCaptivityStatus.sqf index 36bf0ff183..e2663a892e 100644 --- a/addons/common/functions/fnc_getCaptivityStatus.sqf +++ b/addons/common/functions/fnc_getCaptivityStatus.sqf @@ -14,13 +14,10 @@ params ["_unit"]; -private ["_captivityReasons", "_unitCaptivityStatus", "_unitCaptivityReasons"]; +private _captivityReasons = missionNamespace getVariable ["ACE_captivityReasons", []]; +private _unitCaptivityStatus = [captiveNum _unit, count _captivityReasons] call FUNC(binarizeNumber); -_captivityReasons = missionNamespace getVariable ["ACE_captivityReasons", []]; - -_unitCaptivityStatus = [captiveNum _unit, count _captivityReasons] call FUNC(binarizeNumber); - -_unitCaptivityReasons = []; +private _unitCaptivityReasons = []; { if (_unitCaptivityStatus select _forEachIndex) then { diff --git a/addons/common/functions/fnc_getChildren.sqf b/addons/common/functions/fnc_getChildren.sqf index d5212dd9a5..19fdf287fe 100644 --- a/addons/common/functions/fnc_getChildren.sqf +++ b/addons/common/functions/fnc_getChildren.sqf @@ -14,7 +14,6 @@ params ["_name", "_cfgClass"]; -private "_classes"; -_classes = format ["configName inheritsFrom _x == '%1'", _name] configClasses (configFile >> _cfgClass); +private _classes = format ["configName inheritsFrom _x == '%1'", _name] configClasses (configFile >> _cfgClass); [_classes, {configName _this}] call FUNC(map) // return diff --git a/addons/common/functions/fnc_getConfigCommander.sqf b/addons/common/functions/fnc_getConfigCommander.sqf index bfa5fbc379..d4a53905b8 100644 --- a/addons/common/functions/fnc_getConfigCommander.sqf +++ b/addons/common/functions/fnc_getConfigCommander.sqf @@ -14,9 +14,7 @@ params ["_vehicle"]; -private ["_config", "_turret"]; - -_config = configFile >> "CfgVehicles" >> typeOf _vehicle; -_turret = [_vehicle] call FUNC(getTurretCommander); +private _config = configFile >> "CfgVehicles" >> typeOf _vehicle; +private _turret = _vehicle call FUNC(getTurretCommander); [_config, _turret] call FUNC(getTurretConfigPath) // return diff --git a/addons/common/functions/fnc_getConfigGunner.sqf b/addons/common/functions/fnc_getConfigGunner.sqf index bc3131d798..abbbd5f014 100644 --- a/addons/common/functions/fnc_getConfigGunner.sqf +++ b/addons/common/functions/fnc_getConfigGunner.sqf @@ -14,9 +14,7 @@ params ["_vehicle"]; -private ["_config", "_turret"]; - -_config = configFile >> "CfgVehicles" >> typeOf _vehicle; -_turret = [_vehicle] call FUNC(getTurretGunner); +private _config = configFile >> "CfgVehicles" >> typeOf _vehicle; +private _turret = _vehicle call FUNC(getTurretGunner); [_config, _turret] call FUNC(getTurretConfigPath) // return diff --git a/addons/common/functions/fnc_getDeathAnim.sqf b/addons/common/functions/fnc_getDeathAnim.sqf index 590418bf25..60aaf3bc0c 100644 --- a/addons/common/functions/fnc_getDeathAnim.sqf +++ b/addons/common/functions/fnc_getDeathAnim.sqf @@ -17,25 +17,23 @@ params ["_unit"]; -private ["_returnAnimation", "_animationState", "_unitAnimationCfg", "_unitActionsCfg", "_interpolateArray", "_indexAnimation"]; +private _returnAnimation = ""; -_returnAnimation = ""; - -_animationState = animationState _unit; -_unitAnimationCfg = configFile >> "CfgMovesMaleSdr" >> "States" >> _animationState; +private _animationState = animationState _unit; +private _unitAnimationCfg = configFile >> "CfgMovesMaleSdr" >> "States" >> _animationState; //If we're already in a terminal animation just return current if (getNumber (_unitAnimationCfg >> "terminal") == 1) exitWith {_animationState}; -_unitActionsCfg = configFile >> "CfgMovesBasic" >> "Actions" >> getText (_unitAnimationCfg >> "actions"); +private _unitActionsCfg = configFile >> "CfgMovesBasic" >> "Actions" >> getText (_unitAnimationCfg >> "actions"); TRACE_2("Animation/Action", configName _unitAnimationCfg, configName _unitActionsCfg); if (vehicle _unit != _unit) then { - _interpolateArray = getArray (_unitAnimationCfg >> "interpolateTo"); + private _interpolateArray = getArray (_unitAnimationCfg >> "interpolateTo"); for "_index" from 0 to (count _interpolateArray - 1) step 2 do { - _indexAnimation = _interpolateArray select _index; + private _indexAnimation = _interpolateArray select _index; //No guarentee that first animation will be right so scan for the first "terminal" animation //E.G.: interpolateTo[] = {"passenger_apc_generic04still",1,"KIA_passenger_apc_generic04",1}; diff --git a/addons/common/functions/fnc_getDefaultAnim.sqf b/addons/common/functions/fnc_getDefaultAnim.sqf index 372a2424eb..c2c0e1e7c4 100644 --- a/addons/common/functions/fnc_getDefaultAnim.sqf +++ b/addons/common/functions/fnc_getDefaultAnim.sqf @@ -17,12 +17,10 @@ params ["_unit"]; -private ["_anim", "_stance"]; - -_anim = toLower animationState _unit; +private _anim = toLower animationState _unit; // stance is broken for some animations. -_stance = stance _unit; +private _stance = stance _unit; if (_anim find "ppne" == 4) then { _stance = "PRONE"; diff --git a/addons/common/functions/fnc_getDefinedVariable.sqf b/addons/common/functions/fnc_getDefinedVariable.sqf index ea22163622..32a75edb5e 100644 --- a/addons/common/functions/fnc_getDefinedVariable.sqf +++ b/addons/common/functions/fnc_getDefinedVariable.sqf @@ -15,15 +15,13 @@ params ["_unit", "_variable", "_defaultValue"]; -private "_value"; -_value = _unit getVariable _variable; +private _value = _unit getVariable _variable; if (isNil "_value") then { if (!isNil "_defaultValue") then { _value = _defaultValue; } else { - private "_definedVariable"; - _definedVariable = [_variable] call FUNC(getDefinedVariableInfo); + private _definedVariable = _variable call FUNC(getDefinedVariableInfo); if (count _definedVariable > 1) then { _value = _definedVariable select 1; diff --git a/addons/common/functions/fnc_getDefinedVariableDefault.sqf b/addons/common/functions/fnc_getDefinedVariableDefault.sqf index ba9ff20e23..c6f4f7711c 100644 --- a/addons/common/functions/fnc_getDefinedVariableDefault.sqf +++ b/addons/common/functions/fnc_getDefinedVariableDefault.sqf @@ -14,8 +14,7 @@ params ["_varName"]; -private "_variableDefinition"; -_variableDefinition = [_varName] call FUNC(getDefinedVariableInfo); +private _variableDefinition = _varName call FUNC(getDefinedVariableInfo); if !(_variableDefinition isEqualTo []) exitWith { _variableDefinition select 1; diff --git a/addons/common/functions/fnc_getDisplayConfigName.sqf b/addons/common/functions/fnc_getDisplayConfigName.sqf index 7a0d9ffa95..1660bbf804 100644 --- a/addons/common/functions/fnc_getDisplayConfigName.sqf +++ b/addons/common/functions/fnc_getDisplayConfigName.sqf @@ -16,12 +16,10 @@ params ["_idd"]; -private ["_configNames", "_config"]; - -_configNames = []; +private _configNames = []; for "_index" from 0 to (count configFile - 1) do { - _config = configFile select _index; + private _config = configFile select _index; if (isClass _config && {isNumber (_config >> "idd")} && {getNumber (_config >> "idd") == _idd}) then { _configNames pushBack configName _config; diff --git a/addons/common/functions/fnc_getDoorTurrets.sqf b/addons/common/functions/fnc_getDoorTurrets.sqf index cab259a214..533e2a7489 100644 --- a/addons/common/functions/fnc_getDoorTurrets.sqf +++ b/addons/common/functions/fnc_getDoorTurrets.sqf @@ -14,14 +14,12 @@ params ["_vehicle"]; -private ["_turrets", "_doorTurrets", "_config"]; +private _turrets = allTurrets [_vehicle, true]; -_turrets = allTurrets [_vehicle, true]; - -_doorTurrets = []; +private _doorTurrets = []; { - _config = configFile >> "CfgVehicles" >> typeOf _vehicle; + private _config = configFile >> "CfgVehicles" >> typeOf _vehicle; _config = [_config, _x] call FUNC(getTurretConfigPath); diff --git a/addons/common/functions/fnc_getFirstObjectIntersection.sqf b/addons/common/functions/fnc_getFirstObjectIntersection.sqf index 1111094ed0..c4cc46ab9b 100644 --- a/addons/common/functions/fnc_getFirstObjectIntersection.sqf +++ b/addons/common/functions/fnc_getFirstObjectIntersection.sqf @@ -17,20 +17,16 @@ params ["_source", "_destination", "_accuracy"]; -private ["_result", "_distance"]; +private _result = [false, [0, 0, 0]]; -_result = [false, [0, 0, 0]]; - -_distance = _source vectorDistance _destination; +private _distance = _source vectorDistance _destination; if !(lineIntersectsWith [_source, _destination] isEqualTo []) then { - private ["_lower", "_upper", "_mid", "_dir"]; + private _lower = 0; + private _upper = 1; + private _mid = 0.5; - _lower = 0; - _upper = 1; - _mid = 0.5; - - _dir = _source vectorFromTo _destination; + private _dir = _source vectorFromTo _destination; while {(_upper - _lower) * _distance > _accuracy} do { _mid = _lower + (_upper - _lower) / 2; diff --git a/addons/common/functions/fnc_getFirstTerrainIntersection.sqf b/addons/common/functions/fnc_getFirstTerrainIntersection.sqf index a5065413d9..27a6f3c613 100644 --- a/addons/common/functions/fnc_getFirstTerrainIntersection.sqf +++ b/addons/common/functions/fnc_getFirstTerrainIntersection.sqf @@ -17,20 +17,16 @@ params ["_source", "_destination", "_accuracy"]; -private ["_result", "_distance"]; +private _result = [false, [0, 0, 0]]; -_result = [false, [0, 0, 0]]; - -_distance = _source vectorDistance _destination; +private _distance = _source vectorDistance _destination; if (terrainIntersectASL [_source, _destination]) then { - private ["_lower", "_upper", "_mid", "_dir"]; + private _lower = 0; + private _upper = 1; + private _mid = 0.5; - _lower = 0; - _upper = 1; - _mid = 0.5; - - _dir = _source vectorFromTo _destination; + private _dir = _source vectorFromTo _destination; while {(_upper - _lower) * _distance > _accuracy} do { _mid = _lower + (_upper - _lower) / 2; diff --git a/addons/common/functions/fnc_getForceWalkStatus.sqf b/addons/common/functions/fnc_getForceWalkStatus.sqf index acdc2f1a05..16eca5ccc7 100644 --- a/addons/common/functions/fnc_getForceWalkStatus.sqf +++ b/addons/common/functions/fnc_getForceWalkStatus.sqf @@ -17,15 +17,11 @@ params ["_unit"]; -private ["_forceWalkReasons", "_unitForceWalkNumber", "_unitForceWalkStatus", "_unitForceWalkReasons"]; +private _forceWalkReasons = missionNamespace getVariable ["ACE_forceWalkReasons", []]; +private _unitForceWalkNumber = _unit getVariable ["ACE_forceWalkStatusNumber", 0]; +private _unitForceWalkStatus = [_unitForceWalkNumber, count _forceWalkReasons] call FUNC(binarizeNumber); -_forceWalkReasons = missionNamespace getVariable ["ACE_forceWalkReasons", []]; - -_unitForceWalkNumber = _unit getVariable ["ACE_forceWalkStatusNumber", 0]; - -_unitForceWalkStatus = [_unitForceWalkNumber, count _forceWalkReasons] call FUNC(binarizeNumber); - -_unitForceWalkReasons = []; +private _unitForceWalkReasons = []; { if (_unitForceWalkStatus select _forEachIndex) then { diff --git a/addons/common/functions/fnc_getGunner.sqf b/addons/common/functions/fnc_getGunner.sqf index dac42ce535..fb8c19ce45 100644 --- a/addons/common/functions/fnc_getGunner.sqf +++ b/addons/common/functions/fnc_getGunner.sqf @@ -13,14 +13,13 @@ */ #include "script_component.hpp" -params ["_vehicle", "_weapon"]; +params [["_vehicle", objNull, [objNull]], ["_weapon", "", [""]]]; // on foot if (gunner _vehicle == _vehicle && {_weapon in weapons _vehicle || {toLower _weapon in ["throw", "put"]}}) exitWith {gunner _vehicle}; // inside vehicle -private "_gunner"; -_gunner = objNull; +private _gunner = objNull; { if (_weapon in (_vehicle weaponsTurret _x)) exitWith { diff --git a/addons/common/functions/fnc_getHitPoints.sqf b/addons/common/functions/fnc_getHitPoints.sqf index 84099b659a..9fb69dd50c 100644 --- a/addons/common/functions/fnc_getHitPoints.sqf +++ b/addons/common/functions/fnc_getHitPoints.sqf @@ -18,8 +18,7 @@ ACE_DEPRECATED("ace_common_fnc_getHitPoints","3.5.0","getAllHitPointsDamage"); params ["_vehicle"]; -private "_hitPointsWithSelections"; -_hitPointsWithSelections = getAllHitPointsDamage _vehicle; +private _hitPointsWithSelections = getAllHitPointsDamage _vehicle; // get correct format on vehicles without any hitpoints if (_hitPointsWithSelections isEqualTo []) then { diff --git a/addons/common/functions/fnc_getHitPointsWithSelections.sqf b/addons/common/functions/fnc_getHitPointsWithSelections.sqf index aef415a54f..d1c81ad3a6 100644 --- a/addons/common/functions/fnc_getHitPointsWithSelections.sqf +++ b/addons/common/functions/fnc_getHitPointsWithSelections.sqf @@ -19,8 +19,7 @@ ACE_DEPRECATED("ace_common_fnc_getHitPointsWithSelections","3.5.0","getAllHitPoi params ["_vehicle"]; -private "_hitPointsWithSelections"; -_hitPointsWithSelections = getAllHitPointsDamage _vehicle; +private _hitPointsWithSelections = getAllHitPointsDamage _vehicle; // get correct format on vehicles without any hitpoints if (_hitPointsWithSelections isEqualTo []) then { diff --git a/addons/common/functions/fnc_getInPosition.sqf b/addons/common/functions/fnc_getInPosition.sqf index dc3ad38cde..9ab15bacd5 100644 --- a/addons/common/functions/fnc_getInPosition.sqf +++ b/addons/common/functions/fnc_getInPosition.sqf @@ -25,15 +25,13 @@ _position = toLower _position; // general if (!alive _vehicle || {locked _vehicle > 1}) exitWith {false}; -private ["_config", "_turret", "_isInside", "_script", "_enemiesInVehicle"]; +private _config = configFile >> "CfgVehicles" >> typeOf _vehicle; +private _turret = []; -_config = configFile >> "CfgVehicles" >> typeOf _vehicle; -_turret = []; +private _isInside = vehicle _unit == _vehicle; -_isInside = vehicle _unit == _vehicle; - -_script = {}; -_enemiesInVehicle = false; //Possible Side Restriction +private _script = {}; +private _enemiesInVehicle = false; //Possible Side Restriction { if (side _unit getFriend side _x < 0.6) exitWith {_enemiesInVehicle = true}; @@ -96,8 +94,7 @@ switch (_position) do { }; case "turret" : { - private "_turrets"; - _turrets = [_vehicle] call FUNC(getTurretsOther); + private _turrets = [_vehicle] call FUNC(getTurretsOther); if (_index != -1 && {_turret = _turrets select _index; CANGETINTURRETINDEX}) then { _script = [ @@ -122,8 +119,7 @@ switch (_position) do { }; case "ffv" : { - private "_turrets"; - _turrets = [_vehicle] call FUNC(getTurretsFFV); + private _turrets = [_vehicle] call FUNC(getTurretsFFV); if (_index != -1 && {_turret = _turrets select _index; CANGETINTURRETINDEX}) then { _script = [ @@ -148,8 +144,7 @@ switch (_position) do { }; case "codriver" : { - private "_positions"; - _positions = [typeOf _vehicle] call FUNC(getVehicleCodriver); + private _positions = [typeOf _vehicle] call FUNC(getVehicleCodriver); { if (alive _x) then {_positions deleteAt (_positions find (_vehicle getCargoIndex _x))}; @@ -207,11 +202,9 @@ switch (_position) do { }; // this will execute all config based event handlers. Not script based ones unfortunately, but atleast we don't use any. -private "_fnc_getInEH"; -_fnc_getInEH = { - private "_config"; +private _fnc_getInEH = { // config based getIn EHs are assigned to the soldier, not the vehicle. Why Bis? Why? - _config = configFile >> "CfgVehicles" >> typeOf _unit >> "EventHandlers"; + private _config = configFile >> "CfgVehicles" >> typeOf _unit >> "EventHandlers"; if (isClass _config) then { //getIn is local effects with global arguments. It doesn't trigger if the unit was already inside and only switched seats diff --git a/addons/common/functions/fnc_getItemType.sqf b/addons/common/functions/fnc_getItemType.sqf index ec20b46f74..d3eb511949 100644 --- a/addons/common/functions/fnc_getItemType.sqf +++ b/addons/common/functions/fnc_getItemType.sqf @@ -15,23 +15,21 @@ params ["_item"]; -private ["_cfgType", "_config", "_type", "_simulation", "_default"]; - -_cfgType = [_item] call FUNC(getConfigType); +private _cfgType = [_item] call FUNC(getConfigType); if (_cfgType == "") exitWith {["", ""]}; if (_cfgType == "CfgGlasses") exitWith {["item", "glasses"]}; -_config = configFile >> _cfgType >> _item; -_type = getNumber (_config >> "type"); -_simulation = getText (_config >> "simulation"); +private _config = configFile >> _cfgType >> _item; +private _type = getNumber (_config >> "type"); +private _simulation = getText (_config >> "simulation"); if (isNumber (_config >> "ItemInfo" >> "type")) then { _type = getNumber (_config >> "ItemInfo" >> "type"); }; -_default = ["item", "magazine"] select (_cfgType == "CfgMagazines"); +private _default = ["item", "magazine"] select (_cfgType == "CfgMagazines"); switch (true) do { case (_type == 0): {[_default, "unknown"]}; diff --git a/addons/common/functions/fnc_getLightProperties.sqf b/addons/common/functions/fnc_getLightProperties.sqf index bbaf955a8b..a376dff841 100644 --- a/addons/common/functions/fnc_getLightProperties.sqf +++ b/addons/common/functions/fnc_getLightProperties.sqf @@ -19,14 +19,12 @@ params ["_vehicle", "_light"]; -private ["_config", "_intensity", "_position", "_direction", "_innerAngle", "_outerAngle"]; +private _config = configFile >> "CfgVehicles" >> typeOf _vehicle >> "Reflectors" >> _light; -_config = configFile >> "CfgVehicles" >> typeOf _vehicle >> "Reflectors" >> _light; - -_intensity = getNumber (_config >> "intensity"); -_position = getText (_config >> "position"); -_direction = getText (_config >> "direction"); -_innerAngle = getNumber (_config >> "innerAngle"); -_outerAngle = getNumber (_config >> "outerAngle"); +private _intensity = getNumber (_config >> "intensity"); +private _position = getText (_config >> "position"); +private _direction = getText (_config >> "direction"); +private _innerAngle = getNumber (_config >> "innerAngle"); +private _outerAngle = getNumber (_config >> "outerAngle"); [_intensity, _position, _direction, _innerAngle, _outerAngle] diff --git a/addons/common/functions/fnc_getLightPropertiesWeapon.sqf b/addons/common/functions/fnc_getLightPropertiesWeapon.sqf index 01567fee58..44c866e67f 100644 --- a/addons/common/functions/fnc_getLightPropertiesWeapon.sqf +++ b/addons/common/functions/fnc_getLightPropertiesWeapon.sqf @@ -18,16 +18,12 @@ params ["_weapon"]; -// @todo: Can weapons themselves still have flashlights (no attachment)? +private _config = configFile >> "CfgWeapons" >> _weapon >> "ItemInfo" >> "FlashLight"; -private ["_config", "_intensity", "_position", "_direction", "_innerAngle", "_outerAngle"]; - -_config = configFile >> "CfgWeapons" >> _weapon >> "ItemInfo" >> "FlashLight"; - -_intensity = getNumber (_config >> "intensity"); -_position = getText (_config >> "position"); -_direction = getText (_config >> "direction"); -_innerAngle = getNumber (_config >> "innerAngle"); -_outerAngle = getNumber (_config >> "outerAngle"); +private _intensity = getNumber (_config >> "intensity"); +private _position = getText (_config >> "position"); +private _direction = getText (_config >> "direction"); +private _innerAngle = getNumber (_config >> "innerAngle"); +private _outerAngle = getNumber (_config >> "outerAngle"); [_intensity, _position, _direction, _innerAngle, _outerAngle] diff --git a/addons/common/functions/fnc_getMGRSdata.sqf b/addons/common/functions/fnc_getMGRSdata.sqf index b4f10db8a4..ee6d1e11dc 100644 --- a/addons/common/functions/fnc_getMGRSdata.sqf +++ b/addons/common/functions/fnc_getMGRSdata.sqf @@ -18,11 +18,9 @@ params [["_map", worldName]]; -private ["_long", "_lat", "_altitude", "_UTM", "_easting", "_northing", "_zone", "_band", "_GZD"]; - -_long = getNumber (configFile >> "CfgWorlds" >> _map >> "longitude"); -_lat = getNumber (configFile >> "CfgWorlds" >> _map >> "latitude"); -_altitude = getNumber (configFile >> "CfgWorlds" >> _map >> "elevationOffset"); +private _long = getNumber (configFile >> "CfgWorlds" >> _map >> "longitude"); +private _lat = getNumber (configFile >> "CfgWorlds" >> _map >> "latitude"); +private _altitude = getNumber (configFile >> "CfgWorlds" >> _map >> "elevationOffset"); if (_map in ["Chernarus", "Bootcamp_ACR", "Woodland_ACR", "utes"]) then { _lat = 50; _altitude = 0; }; if (_map in ["Altis", "Stratis"]) then { _lat = 40; _altitude = 0; }; @@ -46,14 +44,14 @@ if (_map in ["lingor"]) then { _lat = -4; _altitude = 0; }; if (_map in ["Panthera3"]) then { _lat = 46; _altitude = 0; }; if (_map in ["Kunduz"]) then { _lat = 37; _altitude = 400; }; -_UTM = [_long,_lat] call BIS_fnc_posDegToUTM; -_easting = _UTM select 0; -_northing = _UTM select 1; -//_zone = _UTM select 2; +private _UTM = [_long,_lat] call BIS_fnc_posDegToUTM; +private _easting = _UTM select 0; +private _northing = _UTM select 1; +//private _zone = _UTM select 2; TRACE_4("",_UTM,_easting,_northing,_zone); /* -_band = switch (true) do { +private _band = switch (true) do { case (_lat<-72): {"C"}; case (_lat<-64): {"D"}; case (_lat<-56): {"E"}; @@ -77,8 +75,8 @@ _band = switch (true) do { }; */ -_zone = 1 + (floor ((_long + 180) / 6)); -_band = "Z"; +private _zone = 1 + (floor ((_long + 180) / 6)); +private _band = "Z"; if (_lat <= -80) then { _band = "A"; @@ -90,17 +88,17 @@ if (_lat <= -80) then { if (_map == "VR") then {_zone = 0; _band = "RV";}; -_GZD = format ["%1%2",_zone,_band]; +private _GZD = format ["%1%2",_zone,_band]; TRACE_3("",_zone,_band,_GZD); -private ["_set1", "_set2", "_set3", "_set4", "_set5", "_set6", "_metaE", "_metaN", "_letterE", "_letterN", "_grid100km"]; +private ["_metaE", "_metaN", "_letterE", "_letterN"]; -_set1 = [1,7,13,19,25,31,37,43,49,55]; -_set2 = [2,8,14,20,26,32,38,44,50,56]; -_set3 = [3,9,15,21,27,33,39,45,51,57]; -_set4 = [4,10,16,22,28,34,40,46,52,58]; -_set5 = [5,11,17,23,29,35,41,47,53,59]; -_set6 = [6,12,18,24,30,36,42,48,54,60]; +private _set1 = [1,7,13,19,25,31,37,43,49,55]; +private _set2 = [2,8,14,20,26,32,38,44,50,56]; +private _set3 = [3,9,15,21,27,33,39,45,51,57]; +private _set4 = [4,10,16,22,28,34,40,46,52,58]; +private _set5 = [5,11,17,23,29,35,41,47,53,59]; +private _set6 = [6,12,18,24,30,36,42,48,54,60]; switch (true) do { case (_zone in _set1): {_metaE = 1; _metaN = 1;}; @@ -154,7 +152,7 @@ switch (true) do { }; TRACE_1("",_letterN); -_grid100km = _letterE + _letterN; +private _grid100km = _letterE + _letterN; TRACE_1("",_grid100km); if (_map == worldName) then { diff --git a/addons/common/functions/fnc_getMapGridData.sqf b/addons/common/functions/fnc_getMapGridData.sqf index c74f378d75..be87a8585b 100644 --- a/addons/common/functions/fnc_getMapGridData.sqf +++ b/addons/common/functions/fnc_getMapGridData.sqf @@ -19,20 +19,18 @@ GVAR(mapGridData) = []; -private ["_cfgGrid", "_offsetX", "_offsetY", "_zoomMax", "_formatX", "_formatY", "_stepX", "_stepY", "_zoom", "_letterGrid", "_heightOffset", "_startGrid", "_originGrid", "_realOffsetY"]; - //--- Extract grid values from world config (Borrowed from BIS_fnc_gridToPos) -_cfgGrid = configFile >> "CfgWorlds" >> worldName >> "Grid"; -_offsetX = getNumber (_cfgGrid >> "offsetX"); -_offsetY = getNumber (_cfgGrid >> "offsetY"); -_zoomMax = 1e99; -_formatX = ""; -_formatY = ""; -_stepX = 1e10; -_stepY = 1e10; +private _cfgGrid = configFile >> "CfgWorlds" >> worldName >> "Grid"; +private _offsetX = getNumber (_cfgGrid >> "offsetX"); +private _offsetY = getNumber (_cfgGrid >> "offsetY"); +private _zoomMax = 1e99; +private _formatX = ""; +private _formatY = ""; +private _stepX = 1e10; +private _stepY = 1e10; { - _zoom = getnumber (_x >> "zoomMax"); + private _zoom = getnumber (_x >> "zoomMax"); if (_zoom < _zoomMax) then { _zoomMax = _zoom; _formatX = getText (_x >> "formatX"); @@ -43,7 +41,7 @@ _stepY = 1e10; false } count configProperties [_cfgGrid, "isClass _x", false]; -_letterGrid = false; +private _letterGrid = false; if (toLower _formatX find "a" != -1) then {_letterGrid = true}; if (toLower _formatY find "a" != -1) then {_letterGrid = true}; @@ -53,9 +51,9 @@ if (_letterGrid) exitWith { }; //Start at [0, 500] and move north until we get a change in grid -_heightOffset = 500; -_startGrid = mapGridPosition [0, _heightOffset]; -_originGrid = _startGrid; +private _heightOffset = 500; +private _startGrid = mapGridPosition [0, _heightOffset]; +private _originGrid = _startGrid; while {_startGrid == _originGrid} do { _heightOffset = _heightOffset + 1; @@ -63,7 +61,7 @@ while {_startGrid == _originGrid} do { }; //Calculate the real y offset -_realOffsetY = (parseNumber (_originGrid select [count _formatX, count _formatY])) * _stepY + _heightOffset - 1; +private _realOffsetY = (parseNumber (_originGrid select [count _formatX, count _formatY])) * _stepY + _heightOffset - 1; //Calculate MGRS 10digit step - they should both be 1 meter: _stepXat5 = _stepX * 10 ^ ((count _formatX) - 5); diff --git a/addons/common/functions/fnc_getMapGridFromPos.sqf b/addons/common/functions/fnc_getMapGridFromPos.sqf index 1f946a6e80..8604d68fa6 100644 --- a/addons/common/functions/fnc_getMapGridFromPos.sqf +++ b/addons/common/functions/fnc_getMapGridFromPos.sqf @@ -19,24 +19,22 @@ params ["_pos", ["_returnSingleString", false]]; -private ["_nativeGrid", "_count", "_easting", "_northing"]; - //Fallback, when map data is weird (letters) if (GVAR(mapGridData) isEqualTo []) exitWith { - _nativeGrid = mapGridPosition _pos; + private _nativeGrid = mapGridPosition _pos; if (_returnSingleString) then { _nativeGrid } else { - _count = floor ((count _nativeGrid) / 2); + private _count = floor ((count _nativeGrid) / 2); [_nativeGrid select [0, _count], _nativeGrid select [_count, _count]] }; }; GVAR(mapGridData) params ["_offsetX", "_realOffsetY", "_stepXat5", "_stepYat5"]; -_easting = floor (((_pos select 0) - _offsetX) / _stepXat5); -_northing = floor (((_pos select 1) - _realOffsetY) / _stepYat5); +private _easting = floor (((_pos select 0) - _offsetX) / _stepXat5); +private _northing = floor (((_pos select 1) - _realOffsetY) / _stepYat5); //Attempt to handle negative east/north (e.g.: moving west of map bounds) if (_easting > 0) then { diff --git a/addons/common/functions/fnc_getMapPosFromGrid.sqf b/addons/common/functions/fnc_getMapPosFromGrid.sqf index 5ba67a40bf..a148679fa9 100644 --- a/addons/common/functions/fnc_getMapPosFromGrid.sqf +++ b/addons/common/functions/fnc_getMapPosFromGrid.sqf @@ -25,17 +25,15 @@ if (count GVAR(mapGridData) == 0) exitWith { GVAR(mapGridData) params ["_offsetX", "_realOffsetY", "_stepXat5", "_stepYat5"]; -private ["_countInput", "_countInputHalf", "_xPart", "_yPart", "_xPos", "_yPos"]; - -_countInput = count _inputString; -_countInputHalf = floor (_countInput / 2); +private _countInput = count _inputString; +private _countInputHalf = floor (_countInput / 2); //Split string, ignoring middle -_xPart = _inputString select [0, _countInputHalf]; -_yPart = _inputString select [ceil (_countInput / 2), _countInputHalf]; +private _xPart = _inputString select [0, _countInputHalf]; +private _yPart = _inputString select [ceil (_countInput / 2), _countInputHalf]; -_xPos = ((parseNumber _xPart) * _stepXat5 * 10 ^ (5 - _countInputHalf)) + _offsetX; -_yPos = ((parseNumber _yPart) * _stepYat5 * 10 ^ (5 - _countInputHalf)) + _realOffsetY; +private _xPos = ((parseNumber _xPart) * _stepXat5 * 10 ^ (5 - _countInputHalf)) + _offsetX; +private _yPos = ((parseNumber _yPart) * _stepYat5 * 10 ^ (5 - _countInputHalf)) + _realOffsetY; if (_getCenterOfGrid) then { _xPos = _xPos + 0.5 * _stepXat5 * 10 ^ (5 - _countInputHalf); diff --git a/addons/common/functions/fnc_getMarkerType.sqf b/addons/common/functions/fnc_getMarkerType.sqf index 7c99302d8f..0da7f1a46e 100644 --- a/addons/common/functions/fnc_getMarkerType.sqf +++ b/addons/common/functions/fnc_getMarkerType.sqf @@ -14,11 +14,9 @@ params ["_group"]; -private ["_leader", "_vehicle", "_side"]; - -_leader = leader _group; -_vehicle = vehicle _leader; -_side = side _leader; +private _leader = leader _group; +private _vehicle = vehicle _leader; +private _side = side _leader; if (_vehicle == _leader) exitWith { if ( diff --git a/addons/common/functions/fnc_getName.sqf b/addons/common/functions/fnc_getName.sqf index a7facd2c6d..4c49e8dc11 100644 --- a/addons/common/functions/fnc_getName.sqf +++ b/addons/common/functions/fnc_getName.sqf @@ -5,24 +5,27 @@ * Arguments: * 0: Object * 1: Use effective commander name when used on vehicles (default: false) + * 2: Get Raw Name (Don't sanatize HTML tags ``) (default: false) * * Return Value: * Object Name * + * Example: + * [player, false, true] call ace_common_fnc_getName; + * * Public: Yes */ #include "script_component.hpp" -params ["_unit", ["_showEffective", false]]; +params ["_unit", ["_showEffective", false], ["_useRaw", false]]; -private "_name"; -_name = ""; +private _name = ""; if (_unit isKindOf "CAManBase") then { - _name = _unit getVariable ["ACE_Name", localize QUOTE(DOUBLES(STR,GVAR(Unknown)))]; + _name = _unit getVariable [(["ACE_Name", "ACE_NameRaw"] select _useRaw), localize QUOTE(DOUBLES(STR,GVAR(Unknown)))]; } else { if (_showEffective) then { - _name = [effectiveCommander _unit] call FUNC(getName); + _name = [effectiveCommander _unit, false, _useRaw] call FUNC(getName); } else { _name = getText (configFile >> "CfgVehicles" >> typeOf _unit >> "displayName"); }; diff --git a/addons/common/functions/fnc_getNumberMagazinesIn.sqf b/addons/common/functions/fnc_getNumberMagazinesIn.sqf index df1f7ed64b..87f92979eb 100644 --- a/addons/common/functions/fnc_getNumberMagazinesIn.sqf +++ b/addons/common/functions/fnc_getNumberMagazinesIn.sqf @@ -15,8 +15,7 @@ params ["_unit", "_magazine"]; -private "_return"; -_return = 0; +private _return = 0; if (_unit isKindOf "CAManBase") then { _return = {_x == _magazine} count magazines _unit; diff --git a/addons/common/functions/fnc_getReflectorsWithSelections.sqf b/addons/common/functions/fnc_getReflectorsWithSelections.sqf index ef2b908bde..248050486c 100644 --- a/addons/common/functions/fnc_getReflectorsWithSelections.sqf +++ b/addons/common/functions/fnc_getReflectorsWithSelections.sqf @@ -18,23 +18,18 @@ params ["_vehicle"]; -private ["_config", "_hitpoints", "_selections"]; +private _config = configFile >> "CfgVehicles" >> typeOf _vehicle; -_config = configFile >> "CfgVehicles" >> typeOf _vehicle; - -_hitpoints = []; -_selections = []; +private _hitpoints = []; +private _selections = []; // iterate through all parents while {isClass _config} do { - private "_class"; - _class = _config >> "Reflectors"; + private _class = _config >> "Reflectors"; for "_i" from 0 to (count _class - 1) do { - private ["_entry", "_selection"]; - - _entry = _class select _i; - _selection = getText (_entry >> "hitpoint"); + private _entry = _class select _i; + private _selection = getText (_entry >> "hitpoint"); if (!(_selection in _selections) && {!isNil {_vehicle getHit _selection}}) then { _hitpoints pushBack configName _entry; diff --git a/addons/common/functions/fnc_getSelectionsWithoutHitPoints.sqf b/addons/common/functions/fnc_getSelectionsWithoutHitPoints.sqf index 277155108a..b46ec308ec 100644 --- a/addons/common/functions/fnc_getSelectionsWithoutHitPoints.sqf +++ b/addons/common/functions/fnc_getSelectionsWithoutHitPoints.sqf @@ -13,11 +13,9 @@ params ["_vehicle"]; -private ["_hitPointsFull", "_allSelectionsWithoutHitpoints"]; +private _hitPointsFull = getAllHitPointsDamage _vehicle; -_hitPointsFull = getAllHitPointsDamage _vehicle; - -_allSelectionsWithoutHitpoints = []; +private _allSelectionsWithoutHitpoints = []; { if (_x == "") then { diff --git a/addons/common/functions/fnc_getSettingData.sqf b/addons/common/functions/fnc_getSettingData.sqf index de9ef40447..ae9dd5351e 100644 --- a/addons/common/functions/fnc_getSettingData.sqf +++ b/addons/common/functions/fnc_getSettingData.sqf @@ -23,12 +23,13 @@ params ["_name"]; -private "_value"; -_value = []; +scopeName "main"; { - if (_x select 0 == _name) exitWith {_value = _x}; + if (_x select 0 == _name) then { + _x breakOut "main"; + }; false } count GVAR(settings); -_value +[] diff --git a/addons/common/functions/fnc_getStringFromMissionSQM.sqf b/addons/common/functions/fnc_getStringFromMissionSQM.sqf index 6b6a34cfb7..0893b7bb0d 100644 --- a/addons/common/functions/fnc_getStringFromMissionSQM.sqf +++ b/addons/common/functions/fnc_getStringFromMissionSQM.sqf @@ -14,13 +14,11 @@ */ #include "script_component.hpp" -private ["_path", "_mission", "_class", "_index", "_array", "_entry"]; - -_path = _this; +[_this] params ["_path", [], [[]]]; if (missionName == "") exitWith {""}; -_mission = toArray toLower loadFile "mission.sqm"; +private _mission = toArray toLower loadFile "mission.sqm"; _mission resize 65536; { @@ -34,11 +32,9 @@ _mission = toString (_mission - [-1]); {_path set [_forEachIndex, toLower _x]} forEach _path; for "_a" from 0 to (count _path - 2) do { - _class = format ["class%1{", _path select _a]; - - _index = _mission find _class; - - _array = toArray _mission; + private _class = format ["class%1{", _path select _a]; + private _index = _mission find _class; + private _array = toArray _mission; for "_b" from 0 to (_index + count toArray _class - 1) do { _array set [_b, -1]; @@ -49,7 +45,7 @@ for "_a" from 0 to (count _path - 2) do { _mission = toString _array; }; -_entry = format ["%1=", _path select (count _path - 1)]; +private _entry = format ["%1=", _path select (count _path - 1)]; _index = _mission find _entry; if (_index == -1) exitWith {""}; diff --git a/addons/common/functions/fnc_getTargetAzimuthAndInclination.sqf b/addons/common/functions/fnc_getTargetAzimuthAndInclination.sqf index da23e600aa..0d2343bec9 100644 --- a/addons/common/functions/fnc_getTargetAzimuthAndInclination.sqf +++ b/addons/common/functions/fnc_getTargetAzimuthAndInclination.sqf @@ -13,13 +13,11 @@ */ #include "script_component.hpp" -private ["_position", "_direction", "_azimuth", "_inclination"]; +private _position = ATLToASL positionCameraToWorld [0, 0, 0]; +private _direction = ATLToASL positionCameraToWorld [0, 0, 1]; -_position = ATLToASL positionCameraToWorld [0, 0, 0]; -_direction = ATLToASL positionCameraToWorld [0, 0, 1]; - -_azimuth = ((_direction select 0) - (_position select 0)) atan2 ((_direction select 1) - (_position select 1)); -_inclination = asin ((_direction select 2) - (_position select 2)); +private _azimuth = ((_direction select 0) - (_position select 0)) atan2 ((_direction select 1) - (_position select 1)); +private _inclination = asin ((_direction select 2) - (_position select 2)); if (_azimuth < 0) then {_azimuth = _azimuth + 360}; diff --git a/addons/common/functions/fnc_getTargetDistance.sqf b/addons/common/functions/fnc_getTargetDistance.sqf index fe75268cea..4bd050a2c5 100644 --- a/addons/common/functions/fnc_getTargetDistance.sqf +++ b/addons/common/functions/fnc_getTargetDistance.sqf @@ -16,16 +16,14 @@ params ["_interval", "_maxDistance", "_minDistance"]; -private ["_position", "_laser", "_line", "_distance", "_iteration"]; - -_position = ATLToASL positionCameraToWorld [0, 0, 0]; +private _position = ATLToASL positionCameraToWorld [0, 0, 0]; _position set [2, (_position select 2) - (getTerrainHeightASL _position min 0)]; -_laser = + _position; -_line = [_position, _laser]; +private _laser = + _position; +private _line = [_position, _laser]; -_distance = _maxDistance; -_iteration = _distance; +private _distance = _maxDistance; +private _iteration = _distance; while { _iteration > _interval / 2 diff --git a/addons/common/functions/fnc_getTargetObject.sqf b/addons/common/functions/fnc_getTargetObject.sqf index adaaa3e344..ed757dedf4 100644 --- a/addons/common/functions/fnc_getTargetObject.sqf +++ b/addons/common/functions/fnc_getTargetObject.sqf @@ -14,15 +14,13 @@ params ["_maxDistance"]; -private ["_position", "_laser", "_intersects"]; - -_position = ATLToASL positionCameraToWorld [0, 0, 0]; +private _position = ATLToASL positionCameraToWorld [0, 0, 0]; _position set [2, (_position select 2) - (getTerrainHeightASL _position min 0)]; -_laser = ATLToASL positionCameraToWorld [0, 0, _maxDistance]; +private _laser = ATLToASL positionCameraToWorld [0, 0, _maxDistance]; _laser set [2, (_laser select 2) - (getTerrainHeightASL _laser min 0)]; -_intersects = lineIntersectsObjs [_position, _laser, objNull, objNull, true, 2]; +private _intersects = lineIntersectsObjs [_position, _laser, objNull, objNull, true, 2]; if (_intersects isEqualTo []) exitWith {objNull}; diff --git a/addons/common/functions/fnc_getTurnedOnLights.sqf b/addons/common/functions/fnc_getTurnedOnLights.sqf index 0d71a3362e..a996e146d2 100644 --- a/addons/common/functions/fnc_getTurnedOnLights.sqf +++ b/addons/common/functions/fnc_getTurnedOnLights.sqf @@ -16,15 +16,12 @@ params ["_vehicle"]; if (!isLightOn _vehicle) exitWith {[]}; -private ["_reflectorsWithSelections", "_lights", "_hitpoints", "_turnedOnLights"]; - -_reflectorsWithSelections = [[_vehicle], FUNC(getReflectorsWithSelections), uiNamespace, format [QEGVAR(cache,%1_%2), QUOTE(DFUNC(getReflectorsWithSelections)), typeOf _vehicle], 1E11] call FUNC(cachedCall); +private _reflectorsWithSelections = [[_vehicle], FUNC(getReflectorsWithSelections), uiNamespace, format [QEGVAR(cache,%1_%2), QUOTE(DFUNC(getReflectorsWithSelections)), typeOf _vehicle], 1E11] call FUNC(cachedCall); //_reflectorsWithSelections = [_vehicle] call FUNC(getReflectorsWithSelections); -_lights = _reflectorsWithSelections select 0; -_hitpoints = _reflectorsWithSelections select 1; +_reflectorsWithSelections params ["_lights", "_hitpoints"]; -_turnedOnLights = []; +private _turnedOnLights = []; { if (_vehicle getHit _x <= 0.9) then { diff --git a/addons/common/functions/fnc_getTurretCommander.sqf b/addons/common/functions/fnc_getTurretCommander.sqf index e045c2d46f..e73795e148 100644 --- a/addons/common/functions/fnc_getTurretCommander.sqf +++ b/addons/common/functions/fnc_getTurretCommander.sqf @@ -12,16 +12,14 @@ */ #include "script_component.hpp" -params ["_vehicle"]; +params [["_vehicle", objNull, [objNull]]]; -private ["_turrets", "_turret", "_config"]; +private _turrets = allTurrets [_vehicle, true]; -_turrets = allTurrets [_vehicle, true]; - -_turret = []; +private _turret = []; { - _config = configFile >> "CfgVehicles" >> typeOf _vehicle; + private _config = configFile >> "CfgVehicles" >> typeOf _vehicle; _config = [_config, _x] call FUNC(getTurretConfigPath); diff --git a/addons/common/functions/fnc_getTurretConfigPath.sqf b/addons/common/functions/fnc_getTurretConfigPath.sqf index 07d7ac4e0c..95d0773fd3 100644 --- a/addons/common/functions/fnc_getTurretConfigPath.sqf +++ b/addons/common/functions/fnc_getTurretConfigPath.sqf @@ -15,14 +15,12 @@ params ["_config", "_turretIndex"]; -private ["_offset", "_config2", "_foundClasses"]; - for "_index" from 0 to (count _turretIndex - 1) do { _config = _config >> "Turrets"; - _offset = 0; - _config2 = _config select 0; - _foundClasses = 0; + private _offset = 0; + private _config2 = _config select 0; + private _foundClasses = 0; for "_a" from 0 to (count _config - 1) do { if (isClass _config2) then { diff --git a/addons/common/functions/fnc_getTurretCopilot.sqf b/addons/common/functions/fnc_getTurretCopilot.sqf index 94a30b7697..6161f5c4cc 100644 --- a/addons/common/functions/fnc_getTurretCopilot.sqf +++ b/addons/common/functions/fnc_getTurretCopilot.sqf @@ -12,16 +12,14 @@ */ #include "script_component.hpp" -params ["_vehicle"]; +params [["_vehicle", objNull, [objNull]]]; -private ["_turrets", "_turret", "_config"]; +private _turrets = allTurrets [_vehicle, true]; -_turrets = allTurrets [_vehicle, true]; - -_turret = []; +private _turret = []; { - _config = configFile >> "CfgVehicles" >> typeOf _vehicle; + private _config = configFile >> "CfgVehicles" >> typeOf _vehicle; _config = [_config, _x] call FUNC(getTurretConfigPath); diff --git a/addons/common/functions/fnc_getTurretDirection.sqf b/addons/common/functions/fnc_getTurretDirection.sqf index ced29a9a85..92c84cdca9 100644 --- a/addons/common/functions/fnc_getTurretDirection.sqf +++ b/addons/common/functions/fnc_getTurretDirection.sqf @@ -16,30 +16,25 @@ params ["_vehicle", "_position"]; -private ["_turret", "_pov", "_gunBeg", "_gunEnd", "_povPos", "_povDir"]; +private _turret = [_vehicle, _position] call CBA_fnc_getTurret; -_turret = [_vehicle, _position] call CBA_fnc_getTurret; - -_pov = getText (_turret >> "memoryPointGunnerOptics"); -_gunBeg = getText (_turret >> "gunBeg"); -_gunEnd = getText (_turret >> "gunEnd"); +private _pov = getText (_turret >> "memoryPointGunnerOptics"); +private _gunBeg = getText (_turret >> "gunBeg"); +private _gunEnd = getText (_turret >> "gunEnd"); TRACE_3("", _pov, _gunBeg, _gunEnd); // Pull the PIP pov or barrel direction, depending on how the model is set up -_povPos = ATLtoASL (_vehicle modelToWorldVisual (_vehicle selectionPosition _pov)); //@todo AGLToASL ? -_povDir = [0,0,0]; +private _povPos = ATLtoASL (_vehicle modelToWorldVisual (_vehicle selectionPosition _pov)); //@todo AGLToASL ? +private _povDir = [0,0,0]; if (_pov == "pip0_pos") then { - private "_pipDir"; - _pipDir = ATLtoASL (_vehicle modelToWorldVisual (_vehicle selectionPosition "pip0_dir")); + private _pipDir = ATLtoASL (_vehicle modelToWorldVisual (_vehicle selectionPosition "pip0_dir")); _povDir = _pipDir vectorDiff _povPos; } else { - private ["_gunBeginPos", "_gunEndPos"]; - - _gunBeginPos = ATLtoASL (_vehicle modelToWorldVisual (_vehicle selectionPosition _gunBeg)); - _gunEndPos = ATLtoASL (_vehicle modelToWorldVisual (_vehicle selectionPosition _gunEnd)); + private _gunBeginPos = ATLtoASL (_vehicle modelToWorldVisual (_vehicle selectionPosition _gunBeg)); + private _gunEndPos = ATLtoASL (_vehicle modelToWorldVisual (_vehicle selectionPosition _gunEnd)); _povDir = _gunBeginPos vectorDiff _gunEndPos; }; diff --git a/addons/common/functions/fnc_getTurretGunner.sqf b/addons/common/functions/fnc_getTurretGunner.sqf index 9a71d292bd..6f59798cc6 100644 --- a/addons/common/functions/fnc_getTurretGunner.sqf +++ b/addons/common/functions/fnc_getTurretGunner.sqf @@ -12,16 +12,14 @@ */ #include "script_component.hpp" -params ["_vehicle"]; +params [["_vehicle", objNull, [objNull]]]; -private ["_turrets", "_turret", "_config"]; +private _turrets = allTurrets [_vehicle, true]; -_turrets = allTurrets [_vehicle, true]; - -_turret = []; +private _turret = []; { - _config = configFile >> "CfgVehicles" >> typeOf _vehicle; + private _config = configFile >> "CfgVehicles" >> typeOf _vehicle; _config = [_config, _x] call FUNC(getTurretConfigPath); diff --git a/addons/common/functions/fnc_getTurretIndex.sqf b/addons/common/functions/fnc_getTurretIndex.sqf index 20ee178bf1..df2d540873 100644 --- a/addons/common/functions/fnc_getTurretIndex.sqf +++ b/addons/common/functions/fnc_getTurretIndex.sqf @@ -15,7 +15,7 @@ */ #include "script_component.hpp" -params ["_unit"]; +params [["_unit", objNull, [objNull]]]; private _vehicle = vehicle _unit; if (_unit == _vehicle) exitWith {[]}; diff --git a/addons/common/functions/fnc_getTurrets.sqf b/addons/common/functions/fnc_getTurrets.sqf index 9a1a48e2bd..229f3ab1f7 100644 --- a/addons/common/functions/fnc_getTurrets.sqf +++ b/addons/common/functions/fnc_getTurrets.sqf @@ -16,33 +16,25 @@ params ["_type"]; -private ["_varName", "_turrets"]; - -_varName = format [QGVAR(CachedTurrets_%1), _type]; -_turrets = + (uiNamespace getVariable _varName); +private _varName = format [QGVAR(CachedTurrets_%1), _type]; +private _turrets = + (uiNamespace getVariable _varName); if (!isNil "_turrets") exitWith {_turrets}; -private ["_config", "_fnc_addTurret"]; - -_config = configFile >> "CfgVehicles" >> _type; +private _config = configFile >> "CfgVehicles" >> _type; _turrets = []; -_fnc_addTurret = { +private _fnc_addTurret = { params ["_config", "_path"]; _config = _config >> "Turrets"; - private ["_count", "_offset", "_path2", "_config2"]; + private _offset = 0; - _count = count _config; - - _offset = 0; - - for "_index" from 0 to (_count - 1) do { - _path2 = _path + [_index - _offset]; - _config2 = _config select _index; + for "_index" from 0 to (count _config - 1) do { + private _path2 = _path + [_index - _offset]; + private _config2 = _config select _index; if (isClass _config2) then { _turrets pushBack _path2; diff --git a/addons/common/functions/fnc_getTurretsFFV.sqf b/addons/common/functions/fnc_getTurretsFFV.sqf index ff7726d1be..8c471824cf 100644 --- a/addons/common/functions/fnc_getTurretsFFV.sqf +++ b/addons/common/functions/fnc_getTurretsFFV.sqf @@ -12,16 +12,14 @@ */ #include "script_component.hpp" -params ["_vehicle"]; +params [["_vehicle", objNull, [objNull]]]; -private ["_turrets", "_turret", "_config"]; +private _turrets = allTurrets [_vehicle, true]; -_turrets = allTurrets [_vehicle, true]; - -_turret = []; +private _turret = []; { - _config = configFile >> "CfgVehicles" >> typeOf _vehicle; + private _config = configFile >> "CfgVehicles" >> typeOf _vehicle; _config = [_config, _x] call FUNC(getTurretConfigPath); diff --git a/addons/common/functions/fnc_getTurretsOther.sqf b/addons/common/functions/fnc_getTurretsOther.sqf index 93ab3f2321..408a5529d5 100644 --- a/addons/common/functions/fnc_getTurretsOther.sqf +++ b/addons/common/functions/fnc_getTurretsOther.sqf @@ -12,23 +12,22 @@ */ #include "script_component.hpp" -params ["_vehicle"]; +params [["_vehicle", objNull, [objNull]]]; -private ["_turrets", "_turret", "_config"]; +private _turrets = allTurrets [_vehicle, true]; -_turrets = allTurrets [_vehicle, true]; - -_turret = []; +private _turret = []; { - _config = configFile >> "CfgVehicles" >> typeOf _vehicle; + private _config = configFile >> "CfgVehicles" >> typeOf _vehicle; _config = [_config, _x] call FUNC(getTurretConfigPath); - if ( getNumber (_config >> "isCopilot") != 1 - && {getNumber (_config >> "primaryGunner") != 1} - && {getNumber (_config >> "primaryObserver") != 1} - && {getNumber (_config >> "isPersonTurret") != 1} + if ( + getNumber (_config >> "isCopilot") != 1 + && {getNumber (_config >> "primaryGunner") != 1} + && {getNumber (_config >> "primaryObserver") != 1} + && {getNumber (_config >> "isPersonTurret") != 1} ) then { _turret pushBack _x; }; diff --git a/addons/common/functions/fnc_getUavControlPosition.sqf b/addons/common/functions/fnc_getUavControlPosition.sqf index a9b5340eb2..c98004c7e7 100644 --- a/addons/common/functions/fnc_getUavControlPosition.sqf +++ b/addons/common/functions/fnc_getUavControlPosition.sqf @@ -18,16 +18,14 @@ */ #include "script_component.hpp" -params ["_unit"]; +params [["_unit", objNull, [objNull]]]; -private ["_uav", "_positionArray", "_playerIndex"]; - -_uav = getConnectedUAV _unit; +private _uav = getConnectedUAV _unit; if (isNull _uav) exitWith {""}; -_positionArray = UAVControl _uav; -_playerIndex = _positionArray find _unit; +private _positionArray = UAVControl _uav; +private _playerIndex = _positionArray find _unit; if (_playerIndex == -1) exitWith {""}; diff --git a/addons/common/functions/fnc_getVehicleCargo.sqf b/addons/common/functions/fnc_getVehicleCargo.sqf index 5be213aa68..68599c919b 100644 --- a/addons/common/functions/fnc_getVehicleCargo.sqf +++ b/addons/common/functions/fnc_getVehicleCargo.sqf @@ -12,14 +12,12 @@ */ #include "script_component.hpp" -params ["_vehicle"]; +params [["_vehicle", objNull, [objNull]]]; -private ["_config", "_cargo", "_codrivers"]; +private _config = configFile >> "CfgVehicles" >> _vehicle; -_config = configFile >> "CfgVehicles" >> _vehicle; - -_cargo = []; -_codrivers = getArray (_config >> "cargoIsCoDriver"); +private _cargo = []; +private _codrivers = getArray (_config >> "cargoIsCoDriver"); for "_index" from 0 to (getNumber (_config >> "transportSoldier") - 1) do { if !(_index in _codrivers && {_vehicle isKindOf "Car"} && {!(_vehicle isKindOf "Wheeled_APC_F")}) then { diff --git a/addons/common/functions/fnc_getVehicleCodriver.sqf b/addons/common/functions/fnc_getVehicleCodriver.sqf index e23cfcd0d4..a1cc5814e1 100644 --- a/addons/common/functions/fnc_getVehicleCodriver.sqf +++ b/addons/common/functions/fnc_getVehicleCodriver.sqf @@ -12,14 +12,12 @@ */ #include "script_component.hpp" -params ["_vehicle"]; +params [["_vehicle", objNull, [objNull]]]; -private ["_config", "_cargo", "_codrivers"]; +private _config = configFile >> "CfgVehicles" >> _vehicle; -_config = configFile >> "CfgVehicles" >> _vehicle; - -_cargo = []; -_codrivers = getArray (_config >> "cargoIsCoDriver"); +private _cargo = []; +private _codrivers = getArray (_config >> "cargoIsCoDriver"); for "_index" from 0 to (getNumber (_config >> "transportSoldier") - 1) do { if (_index in _codrivers && {_vehicle isKindOf "Car"} && {!(_vehicle isKindOf "Wheeled_APC_F")}) then { diff --git a/addons/common/functions/fnc_getVehicleCrew.sqf b/addons/common/functions/fnc_getVehicleCrew.sqf index 58d0067b85..adb0e9701a 100644 --- a/addons/common/functions/fnc_getVehicleCrew.sqf +++ b/addons/common/functions/fnc_getVehicleCrew.sqf @@ -15,8 +15,7 @@ params ["_vehicle", ["_types", ["driver", "commander", "gunner", "turret", "cargo", "ffv"]]]; -private "_crew"; -_crew = []; +private _crew = []; // iterate through all crew members { diff --git a/addons/common/functions/fnc_getVehicleUAVCrew.sqf b/addons/common/functions/fnc_getVehicleUAVCrew.sqf index 8d9156810a..fcb48ee216 100644 --- a/addons/common/functions/fnc_getVehicleUAVCrew.sqf +++ b/addons/common/functions/fnc_getVehicleUAVCrew.sqf @@ -12,6 +12,6 @@ */ #include "script_component.hpp" -params ["_vehicle"]; +params [["_vehicle", objNull, [objNull]]]; [crew _vehicle, {getText (configFile >> "CfgVehicles" >> typeOf _this >> "simulation") == "UAVPilot"}] call FUNC(filter) // return diff --git a/addons/common/functions/fnc_getWeaponAzimuthAndInclination.sqf b/addons/common/functions/fnc_getWeaponAzimuthAndInclination.sqf index 09968d8e39..f7c7909e01 100644 --- a/addons/common/functions/fnc_getWeaponAzimuthAndInclination.sqf +++ b/addons/common/functions/fnc_getWeaponAzimuthAndInclination.sqf @@ -15,12 +15,10 @@ params ["_weapon"]; -private ["_direction", "_azimuth", "_inclination"]; +private _direction = ACE_player weaponDirection _weapon; -_direction = ACE_player weaponDirection _weapon; - -_azimuth = (_direction select 0) atan2 (_direction select 1); -_inclination = asin (_direction select 2); +private _azimuth = (_direction select 0) atan2 (_direction select 1); +private _inclination = asin (_direction select 2); if (_azimuth < 0) then {_azimuth = _azimuth + 360}; diff --git a/addons/common/functions/fnc_getWeaponModes.sqf b/addons/common/functions/fnc_getWeaponModes.sqf index a2bb9c3205..48755d3a9b 100644 --- a/addons/common/functions/fnc_getWeaponModes.sqf +++ b/addons/common/functions/fnc_getWeaponModes.sqf @@ -12,13 +12,11 @@ */ #include "script_component.hpp" -params ["_weapon"]; +params [["_weapon", "", [""]]]; -private ["_config", "_modes"]; +private _config = configFile >> "CfgWeapons" >> _weapon; -_config = configFile >> "CfgWeapons" >> _weapon; - -_modes = []; +private _modes = []; { if (getNumber (_config >> _x >> "showToPlayer") == 1) then { diff --git a/addons/common/functions/fnc_getWeaponMuzzles.sqf b/addons/common/functions/fnc_getWeaponMuzzles.sqf index cdfd58f238..d75a01f2e3 100644 --- a/addons/common/functions/fnc_getWeaponMuzzles.sqf +++ b/addons/common/functions/fnc_getWeaponMuzzles.sqf @@ -12,13 +12,14 @@ */ #include "script_component.hpp" -params ["_weapon"]; +params [["_weapon", "", [""]]]; -private "_muzzles"; -_muzzles = getArray (configFile >> "CfgWeapons" >> _weapon >> "muzzles"); +private _muzzles = getArray (configFile >> "CfgWeapons" >> _weapon >> "muzzles"); -if ("this" in _muzzles) then { - _muzzles set [_muzzles find "this", _weapon]; -}; +{ + if (_x == "this") then { + _muzzles set [_forEachIndex, _weapon]; + }; +} forEach _muzzles; _muzzles diff --git a/addons/common/functions/fnc_getWeaponState.sqf b/addons/common/functions/fnc_getWeaponState.sqf index 8ee1610f4e..e7b7bb80ec 100644 --- a/addons/common/functions/fnc_getWeaponState.sqf +++ b/addons/common/functions/fnc_getWeaponState.sqf @@ -18,17 +18,13 @@ params ["_unit", "_weapon"]; -private ["_muzzles", "_weaponInfo"]; +private _muzzles = _weapon call FUNC(getWeaponMuzzles); -_muzzles = [_weapon] call FUNC(getWeaponMuzzles); - -_weaponInfo = [["","","",""], primaryWeaponItems _unit, secondaryWeaponItems _unit, handgunItems _unit] select ((["", primaryWeapon _unit, secondaryWeapon _unit, handgunWeapon _unit] find _weapon) max 0); +private _weaponInfo = [["","","",""], primaryWeaponItems _unit, secondaryWeaponItems _unit, handgunItems _unit] select ((["", primaryWeapon _unit, secondaryWeapon _unit, handgunWeapon _unit] find _weapon) max 0); // get loaded magazines and ammo -private ["_magazines", "_ammo"]; - -_magazines = []; -_ammo = []; +private _magazines = []; +private _ammo = []; { _magazines pushBack ""; @@ -38,8 +34,7 @@ _ammo = []; { if (_x select 2) then { - private "_index"; - _index = _muzzles find (_x select 4); + private _index = _muzzles find (_x select 4); if (_index != -1) then { _magazines set [_index, _x select 0]; diff --git a/addons/common/functions/fnc_getWeaponType.sqf b/addons/common/functions/fnc_getWeaponType.sqf index f8ee7f9fe4..5666ea5bc0 100644 --- a/addons/common/functions/fnc_getWeaponType.sqf +++ b/addons/common/functions/fnc_getWeaponType.sqf @@ -18,11 +18,9 @@ params ["_weapon"]; -private ["_type", "_index"]; +private _type = [getNumber (configFile >> "CfgWeapons" >> _weapon >> "type")] call FUNC(binarizeNumber); -_type = [getNumber (configFile >> "CfgWeapons" >> _weapon >> "type")] call FUNC(binarizeNumber); - -_index = 0; +private _index = 0; while {!(_type select _index) && {_index < 16}} do { _index = _index + 1; diff --git a/addons/common/functions/fnc_hadamardProduct.sqf b/addons/common/functions/fnc_hadamardProduct.sqf index b4ed7f9be1..cdaf707395 100644 --- a/addons/common/functions/fnc_hadamardProduct.sqf +++ b/addons/common/functions/fnc_hadamardProduct.sqf @@ -16,8 +16,7 @@ params ["_vector1", "_vector2"]; -private "_newVector"; -_newVector = []; +private _newVector = []; for "_i" from 0 to ((count _vector1 min count _vector2) - 1) do { _newVector pushBack ((_vector1 select _i) * (_vector2 select _i)); diff --git a/addons/common/functions/fnc_hasHatch.sqf b/addons/common/functions/fnc_hasHatch.sqf index a67ad0b0d3..e39c52f897 100644 --- a/addons/common/functions/fnc_hasHatch.sqf +++ b/addons/common/functions/fnc_hasHatch.sqf @@ -12,7 +12,7 @@ */ #include "script_component.hpp" -params ["_unit"]; +params [["_unit", objNull, [objNull]]]; private _vehicle = vehicle _unit; diff --git a/addons/common/functions/fnc_hasItem.sqf b/addons/common/functions/fnc_hasItem.sqf index 526f5a46f2..8ca785d78e 100644 --- a/addons/common/functions/fnc_hasItem.sqf +++ b/addons/common/functions/fnc_hasItem.sqf @@ -10,9 +10,11 @@ * has Item * * Public: yes + * + * Note: Case sensitive */ #include "script_component.hpp" -params ["_unit", "_item"]; +params [["_unit", objNull, [objNull]], ["_item", "", [""]]]; _item in items _unit // return diff --git a/addons/common/functions/fnc_hasMagazine.sqf b/addons/common/functions/fnc_hasMagazine.sqf index 27150ea5d5..eaa9bc0556 100644 --- a/addons/common/functions/fnc_hasMagazine.sqf +++ b/addons/common/functions/fnc_hasMagazine.sqf @@ -10,9 +10,11 @@ * has Magazine * * Public: yes + * + * Note: Case sensitive */ #include "script_component.hpp" -params ["_unit", "_magazine"]; +params [["_unit", objNull, [objNull]], ["_magazine", "", [""]]]; _magazine in magazines _unit // return diff --git a/addons/common/functions/fnc_hashGet.sqf b/addons/common/functions/fnc_hashGet.sqf index df5d294beb..d0a5cdf22e 100644 --- a/addons/common/functions/fnc_hashGet.sqf +++ b/addons/common/functions/fnc_hashGet.sqf @@ -13,15 +13,13 @@ */ #include "script_component.hpp" -private ["_val", "_index"]; - params ["_hash", "_key"]; ERRORDATA(2); -_val = nil; +private _val = nil; try { if(VALIDHASH(_hash)) then { - _index = (_hash select 0) find _key; + private _index = (_hash select 0) find _key; if(_index != -1) then { _val = (_hash select 1) select _index; if(IS_STRING(_val) && {_val == "ACREHASHREMOVEDONOTUSETHISVAL"}) then { diff --git a/addons/common/functions/fnc_hashHasKey.sqf b/addons/common/functions/fnc_hashHasKey.sqf index 5c6293fc85..b2978f9cc4 100644 --- a/addons/common/functions/fnc_hashHasKey.sqf +++ b/addons/common/functions/fnc_hashHasKey.sqf @@ -12,16 +12,15 @@ */ #include "script_component.hpp" -private ["_val", "_index"]; // diag_log text format["%1 HASH HAS KEY: %2", ACE_diagTime, _this]; params ["_hash", "_key"]; ERRORDATA(2); -_val = false; +private _val = false; try { if(VALIDHASH(_hash)) then { - _index = (_hash select 0) find _key; + private _index = (_hash select 0) find _key; if(_index != -1) then { _val = true; }; diff --git a/addons/common/functions/fnc_hashListCreateHash.sqf b/addons/common/functions/fnc_hashListCreateHash.sqf index d6a94445eb..d5cc323c8d 100644 --- a/addons/common/functions/fnc_hashListCreateHash.sqf +++ b/addons/common/functions/fnc_hashListCreateHash.sqf @@ -12,12 +12,10 @@ */ #include "script_component.hpp" -private ["_hashKeys"]; - params ["_hashList"]; ERRORDATA(1); -_hashKeys = []; +private _hashKeys = []; try { if(VALIDHASH(_hashList)) then { _hashKeys = (_hashList select 0); diff --git a/addons/common/functions/fnc_hashListSelect.sqf b/addons/common/functions/fnc_hashListSelect.sqf index df072d55bd..f5e3d85b31 100644 --- a/addons/common/functions/fnc_hashListSelect.sqf +++ b/addons/common/functions/fnc_hashListSelect.sqf @@ -12,18 +12,16 @@ */ #include "script_component.hpp" -private ["_hash", "_keys", "_hashes", "_values"]; - params ["_hashList", "_index"]; ERRORDATA(2); -_hash = nil; +private _hash = nil; try { if(VALIDHASH(_hashList)) then { - _keys = _hashList select 0; - _hashes = _hashList select 1; + _hashList params ["_keys", "_hashes"]; + if(_index < (count _hashes)) then { - _values = _hashes select _index; + private _values = _hashes select _index; _hash = [_keys, _values, 1]; } else { diff --git a/addons/common/functions/fnc_hashListSet.sqf b/addons/common/functions/fnc_hashListSet.sqf index 5fea048327..ee0a8dc7eb 100644 --- a/addons/common/functions/fnc_hashListSet.sqf +++ b/addons/common/functions/fnc_hashListSet.sqf @@ -12,15 +12,13 @@ */ #include "script_component.hpp" -private ["_vals"]; - params ["_hashList", "_index", "_value"]; ERRORDATA(3); try { if(VALIDHASH(_hashList)) then { if(VALIDHASH(_value)) then { - _vals = _value select 1; + _value params ["", "_vals"]; (_hashList select 1) set[_index, _vals]; } else { diff --git a/addons/common/functions/fnc_hashRem.sqf b/addons/common/functions/fnc_hashRem.sqf index 4346a509cf..bd0c8f2a2d 100644 --- a/addons/common/functions/fnc_hashRem.sqf +++ b/addons/common/functions/fnc_hashRem.sqf @@ -12,15 +12,13 @@ */ #include "script_component.hpp" -private ["_val", "_index"]; - params ["_hash", "_key"]; ERRORDATA(2); -_val = nil; +private _val = nil; try { if(VALIDHASH(_hash)) then { - _index = (_hash select 0) find _key; + private _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? diff --git a/addons/common/functions/fnc_hashSet.sqf b/addons/common/functions/fnc_hashSet.sqf index af7a361dd6..10e2881c10 100644 --- a/addons/common/functions/fnc_hashSet.sqf +++ b/addons/common/functions/fnc_hashSet.sqf @@ -12,7 +12,6 @@ */ #include "script_component.hpp" -private ["_index"]; // diag_log text format["%1 HASH SET: %2", ACE_diagTime, _this]; params ["_hash", "_key", "_val"]; @@ -20,7 +19,7 @@ params ["_hash", "_key", "_val"]; ERRORDATA(3); try { if(VALIDHASH(_hash)) then { - _index = (_hash select 0) find _key; + private _index = (_hash select 0) find _key; if(_index == -1) then { _index = (_hash select 0) find "ACREHASHREMOVEDONOTUSETHISVAL"; if(_index == -1) then { diff --git a/addons/common/functions/fnc_headBugFix.sqf b/addons/common/functions/fnc_headBugFix.sqf index 78b1a602df..dffb28ff4b 100644 --- a/addons/common/functions/fnc_headBugFix.sqf +++ b/addons/common/functions/fnc_headBugFix.sqf @@ -14,24 +14,22 @@ */ #include "script_component.hpp" -private ["_unit", "_anim", "_pos", "_dir", "_dummy"]; - -_unit = ACE_player; -_anim = animationState _unit; +private _unit = ACE_player; +private _anim = animationState _unit; ["HeadbugFixUsed", [profileName, _anim]] call FUNC(serverEvent); ["HeadbugFixUsed", [profileName, _anim]] call FUNC(localEvent); if (_unit != vehicle _unit || {!([_unit, objNull, ["isNotSitting"]] call FUNC(canInteractWith))}) exitWith {false}; -_pos = getPosATL _unit; -_dir = getDir _unit; +private _pos = getPosATL _unit; +private _dir = getDir _unit; titleCut ["", "BLACK"]; [_unit, "headBugFix"] call FUNC(hideUnit); // create invisible headbug fix vehicle -_dummy = createVehicle ["ACE_Headbug_Fix", _pos, [], 0, "NONE"]; +private _dummy = createVehicle ["ACE_Headbug_Fix", _pos, [], 0, "NONE"]; _dummy setDir _dir; _unit moveInAny _dummy; sleep 0.1; // @todo diff --git a/addons/common/functions/fnc_hideUnit.sqf b/addons/common/functions/fnc_hideUnit.sqf index 7fdd901848..85636a08f7 100644 --- a/addons/common/functions/fnc_hideUnit.sqf +++ b/addons/common/functions/fnc_hideUnit.sqf @@ -12,7 +12,7 @@ * Example: * [ACE_Player, "SpectatorMode"] call ace_common_fnc_hideUnit * - * Public: No + * Public: Yes */ #include "script_component.hpp" @@ -20,8 +20,7 @@ params ["_unit", "_reason"]; if (isNull _unit) exitWith {}; -private "_setHiddenReasons"; -_setHiddenReasons = _unit getVariable [QGVAR(setHiddenReasons), []]; +private _setHiddenReasons = _unit getVariable [QGVAR(setHiddenReasons), []]; if !(_reason in _setHiddenReasons) then { _setHiddenReasons pushBack _reason; diff --git a/addons/common/functions/fnc_inheritsFrom.sqf b/addons/common/functions/fnc_inheritsFrom.sqf index 7f881ff746..4ec39d8cc3 100644 --- a/addons/common/functions/fnc_inheritsFrom.sqf +++ b/addons/common/functions/fnc_inheritsFrom.sqf @@ -24,8 +24,7 @@ params ["_configEntry", "_configMatch"]; if (configName _configEntry == _configMatch) exitWith {true}; if (configName _configEntry == ",") exitWith {false}; -private "_match"; -_match = false; +private _match = false; while {configName _configEntry != ""} do { if (configName _configEntry == _configMatch) exitWith { diff --git a/addons/common/functions/fnc_insertionSort.sqf b/addons/common/functions/fnc_insertionSort.sqf index 9f8c95e095..d2f89a039e 100644 --- a/addons/common/functions/fnc_insertionSort.sqf +++ b/addons/common/functions/fnc_insertionSort.sqf @@ -17,10 +17,8 @@ params ["_list", ["_ascending", true]]; _list = + _list; // copy array to not alter the original one -private "_tmp"; - for "_i" from 1 to (count _list - 1) do { - _tmp = _list select _i; + private _tmp = _list select _i; _j = _i; while {_j >= 1 && {_tmp < _list select (_j - 1)}} do { diff --git a/addons/common/functions/fnc_interpolateFromArray.sqf b/addons/common/functions/fnc_interpolateFromArray.sqf index 5ce59bde62..07207071e7 100644 --- a/addons/common/functions/fnc_interpolateFromArray.sqf +++ b/addons/common/functions/fnc_interpolateFromArray.sqf @@ -15,9 +15,7 @@ params ["_array", "_value"]; -private ["_min", "_max"]; - -_min = _array select floor _value; -_max = _array select ceil _value; +private _min = _array select floor _value; +private _max = _array select ceil _value; _min + (_max - _min) * (_value % 1) // return diff --git a/addons/common/functions/fnc_isInBuilding.sqf b/addons/common/functions/fnc_isInBuilding.sqf index 577b865aee..e5234b9200 100644 --- a/addons/common/functions/fnc_isInBuilding.sqf +++ b/addons/common/functions/fnc_isInBuilding.sqf @@ -14,13 +14,11 @@ #define CHECK_DISTANCE 10 -params ["_unit"]; +params [["_unit", objNull, [objNull]]]; -private ["_position", "_intersections"]; +private _position = eyePos _unit; -_position = eyePos _unit; - -_intersections = 0; +private _intersections = 0; if (lineIntersects [_position, _position vectorAdd [0, 0, +CHECK_DISTANCE]]) then { _intersections = _intersections + 1; diff --git a/addons/common/functions/fnc_isModLoaded.sqf b/addons/common/functions/fnc_isModLoaded.sqf index cb62a90440..46e1bc03a8 100644 --- a/addons/common/functions/fnc_isModLoaded.sqf +++ b/addons/common/functions/fnc_isModLoaded.sqf @@ -12,6 +12,6 @@ */ #include "script_component.hpp" -params ["_modName"]; +params [["_modName", "", [""]]]; isClass (configFile >> "CfgPatches" >> _modName) // return diff --git a/addons/common/functions/fnc_isPlayer.sqf b/addons/common/functions/fnc_isPlayer.sqf index 8bea7e9771..fe265bd925 100644 --- a/addons/common/functions/fnc_isPlayer.sqf +++ b/addons/common/functions/fnc_isPlayer.sqf @@ -1,7 +1,7 @@ /* * Author: bux578, commy2, akalegman * Checks if a unit is a player / curator controlled unit. - * Currently returns false for non-local remote controlled zeus units. (Remotes from another zeus machine) + * This now includes both local and non-local remote controlled zeus units. (Remotes from another zeus machine) * * Arguments: * 0: unit to be checked @@ -10,10 +10,13 @@ * Return Value: * Is unit a player? * + * Example: + * [cursorTarget, false] call ace_common_fnc_isPlayer; + * * Public: Yes */ #include "script_component.hpp" params ["_unit", ["_excludeRemoteControlled", false]]; -isPlayer _unit || (!_excludeRemoteControlled && {_unit == call FUNC(player)}) // return +(isPlayer _unit) || {(!_excludeRemoteControlled) && {!isNull (_unit getVariable ["bis_fnc_moduleRemoteControl_owner", objNull])}} diff --git a/addons/common/functions/fnc_isUnderwater.sqf b/addons/common/functions/fnc_isUnderwater.sqf index d2f399b770..637ed49f3d 100644 --- a/addons/common/functions/fnc_isUnderwater.sqf +++ b/addons/common/functions/fnc_isUnderwater.sqf @@ -12,14 +12,12 @@ */ #include "script_component.hpp" -params ["_unit"]; +params [["_unit", objNull, [objNull]]]; -private "_return"; -_return = false; +private _return = false; if (surfaceIsWater getPosASL _unit) then { - private "_pos"; - _pos = _unit modelToWorldVisual (_unit selectionPosition "head"); + private _pos = _unit modelToWorldVisual (_unit selectionPosition "head"); if (_pos select 2 < 0) then { _return = true; diff --git a/addons/common/functions/fnc_lightIntensityFromObject.sqf b/addons/common/functions/fnc_lightIntensityFromObject.sqf index df88671405..a495897dea 100644 --- a/addons/common/functions/fnc_lightIntensityFromObject.sqf +++ b/addons/common/functions/fnc_lightIntensityFromObject.sqf @@ -15,79 +15,60 @@ params ["_unit", "_lightSource"]; -private ["_unitPos", "_lightLevel"]; - -_unitPos = _unit modelToWorld (_unit selectionPosition "spine3"); -_lightLevel = 0; +private _unitPos = _unit modelToWorld (_unit selectionPosition "spine3"); +private _lightLevel = 0; if (_lightSource isKindOf "CAManBase") then { // handle persons with flashlights - private "_weapon"; - _weapon = currentWeapon _lightSource; + private _weapon = currentWeapon _lightSource; if !(_lightSource isFlashlightOn _weapon) exitWith {}; - private ["_flashlight", "_properties", "_intensity", "_innerAngle", "_outerAngle", "_position", "_direction", "_directionToUnit", "_distance", "_angle"]; - - _flashlight = switch (_weapon) do { - case (primaryWeapon _lightSource): { - primaryWeaponItems _lightSource select 1 - }; - case (secondaryWeapon _lightSource): { - secondaryWeaponItems _lightSource select 1 - }; - case (handgunWeapon _lightSource): { - handgunItems _lightSource select 1 - }; - default {""}; - }; + private _flashlight = (_lightSource weaponAccessories _weapon) select 1; if (getNumber (configFile >> "CfgWeapons" >> _flashlight >> "ACE_laserpointer") == 1) exitWith {_lightLevel = 0}; - _properties = [[_flashlight], FUNC(getLightPropertiesWeapon), uiNamespace, format [QEGVAR(cache,%1_%2), QUOTE(DFUNC(getLightPropertiesWeapon)), _flashlight], 1E11] call FUNC(cachedCall); + private _properties = [[_flashlight], FUNC(getLightPropertiesWeapon), uiNamespace, format [QEGVAR(cache,%1_%2), QUOTE(DFUNC(getLightPropertiesWeapon)), _flashlight], 1E11] call FUNC(cachedCall); //_properties = [_flashlight] call FUNC(getLightPropertiesWeapon); - _innerAngle = (_properties select 3) / 2; - _outerAngle = (_properties select 4) / 2; + private _innerAngle = (_properties select 3) / 2; + private _outerAngle = (_properties select 4) / 2; - _position = _lightSource modelToWorld (_lightSource selectionPosition "rightHand"); - _direction = _lightSource weaponDirection _weapon; + private _position = _lightSource modelToWorld (_lightSource selectionPosition "rightHand"); + private _direction = _lightSource weaponDirection _weapon; - _directionToUnit = _position vectorFromTo _unitPos; + private _directionToUnit = _position vectorFromTo _unitPos; - _distance = _unitPos distance _position; - _angle = acos (_direction vectorDotProduct _directionToUnit); + private _distance = _unitPos distance _position; + private _angle = acos (_direction vectorDotProduct _directionToUnit); _lightLevel = (linearConversion [0, 30, _distance, 1, 0, true]) * (linearConversion [_innerAngle, _outerAngle, _angle, 1, 0, true]); } else { // handle any object, strcutures, cars, tanks, etc. @todo campfires, burning vehicles - private "_lights"; - _lights = [_lightSource] call FUNC(getTurnedOnLights); + private _lights = _lightSource call FUNC(getTurnedOnLights); { - private ["_properties", "_intensity", "_innerAngle", "_outerAngle", "_position", "_direction", "_directionToUnit", "_distance", "_angle"]; - - _properties = [[_lightSource, _x], FUNC(getLightProperties), uiNamespace, format [QEGVAR(cache,%1_%2_%3), QUOTE(DFUNC(getLightProperties)), typeOf _lightSource, _x], 1E11] call FUNC(cachedCall); + private _properties = [[_lightSource, _x], FUNC(getLightProperties), uiNamespace, format [QEGVAR(cache,%1_%2_%3), QUOTE(DFUNC(getLightProperties)), typeOf _lightSource, _x], 1E11] call FUNC(cachedCall); //_properties = [_lightSource, _x] call FUNC(getLightProperties); // @todo intensity affects range? - //_intensity = _properties select 0; + //_properties params ["_intensity"]; - _innerAngle = (_properties select 3) / 2; - _outerAngle = (_properties select 4) / 2; + private _innerAngle = (_properties select 3) / 2; + private _outerAngle = (_properties select 4) / 2; // get world position and direction - _position = _lightSource modelToWorld (_lightSource selectionPosition (_properties select 1)); - _direction = _lightSource modelToWorld (_lightSource selectionPosition (_properties select 2)); + private _position = _lightSource modelToWorld (_lightSource selectionPosition (_properties select 1)); + private _direction = _lightSource modelToWorld (_lightSource selectionPosition (_properties select 2)); _direction = _position vectorFromTo _direction; - _directionToUnit = _position vectorFromTo _unitPos; + private _directionToUnit = _position vectorFromTo _unitPos; - _distance = _unitPos distance _position; - _angle = acos (_direction vectorDotProduct _directionToUnit); + private _distance = _unitPos distance _position; + private _angle = acos (_direction vectorDotProduct _directionToUnit); _lightLevel = _lightLevel max ((linearConversion [0, 30, _distance, 1, 0, true]) * (linearConversion [_innerAngle, _outerAngle, _angle, 1, 0, true])); @@ -97,8 +78,7 @@ if (_lightSource isKindOf "CAManBase") then { // handle campfires if (inflamed _lightSource) then { - private "_distance"; - _distance = _unitPos distance position _lightSource; + private _distance = _unitPos distance position _lightSource; _lightLevel = _lightLevel max linearConversion [0, 30, _distance, 0.5, 0, true]; }; diff --git a/addons/common/functions/fnc_loadPerson.sqf b/addons/common/functions/fnc_loadPerson.sqf index 659d63224a..3071ffbd47 100644 --- a/addons/common/functions/fnc_loadPerson.sqf +++ b/addons/common/functions/fnc_loadPerson.sqf @@ -17,28 +17,26 @@ params ["_caller", "_unit"]; -private ["_vehicle", "_loadcar", "_loadair", "_loadtank", "_loadboat"]; - -_vehicle = objNull; +private _vehicle = objNull; if (!([_caller, _unit, ["isNotDragging", "isNotCarrying"]] call FUNC(canInteractWith)) || {_caller == _unit}) exitWith {_vehicle}; -_loadcar = nearestObject [_unit, "Car"]; +private _loadcar = nearestObject [_unit, "Car"]; if (_unit distance _loadcar <= 10) then { _vehicle = _loadcar; } else { - _loadair = nearestObject [_unit, "Air"]; + private _loadair = nearestObject [_unit, "Air"]; if (_unit distance _loadair <= 10) then { _vehicle = _loadair; } else { - _loadtank = nearestObject [_unit, "Tank"]; + private _loadtank = nearestObject [_unit, "Tank"]; if (_unit distance _loadtank <= 10) then { _vehicle = _loadtank; } else { - _loadboat = nearestObject [_unit, "Ship_F"]; + private _loadboat = nearestObject [_unit, "Ship_F"]; if (_unit distance _loadboat <= 10) then { _vehicle = _loadboat; diff --git a/addons/common/functions/fnc_loadPersonLocal.sqf b/addons/common/functions/fnc_loadPersonLocal.sqf index 5b52b38b05..db0248a901 100644 --- a/addons/common/functions/fnc_loadPersonLocal.sqf +++ b/addons/common/functions/fnc_loadPersonLocal.sqf @@ -20,9 +20,7 @@ if (!alive _unit) then { // _unit = [_unit, _caller] call FUNC(makeCopyOfBody); //func does not exist }; -private "_slotsOpen"; - -_slotsOpen = false; +private _slotsOpen = false; if (_vehicle emptyPositions "cargo" > 0) then { _unit moveInCargo _vehicle; @@ -35,8 +33,7 @@ if (_vehicle emptyPositions "cargo" > 0) then { }; if (_slotsOpen) then { - private "_loaded"; - _loaded = _vehicle getVariable [QGVAR(loaded_persons),[]]; + private _loaded = _vehicle getVariable [QGVAR(loaded_persons),[]]; _loaded pushBack _unit; _vehicle setVariable [QGVAR(loaded_persons), _loaded, true]; diff --git a/addons/common/functions/fnc_loadSettingsFromProfile.sqf b/addons/common/functions/fnc_loadSettingsFromProfile.sqf index a596583a5c..46b0134740 100644 --- a/addons/common/functions/fnc_loadSettingsFromProfile.sqf +++ b/addons/common/functions/fnc_loadSettingsFromProfile.sqf @@ -21,8 +21,7 @@ if (_isClientSetable) then { // If setting is not forced if !(_isForced) then { - private "_profileValue"; - _profileValue = profileNamespace getVariable _name; + private _profileValue = profileNamespace getVariable _name; // If the setting is stored on the profile if !(isNil "_profileValue") then { diff --git a/addons/common/functions/fnc_loadSettingsLocalizedText.sqf b/addons/common/functions/fnc_loadSettingsLocalizedText.sqf index 225c2d9675..f846fa9354 100644 --- a/addons/common/functions/fnc_loadSettingsLocalizedText.sqf +++ b/addons/common/functions/fnc_loadSettingsLocalizedText.sqf @@ -12,14 +12,12 @@ */ #include "script_component.hpp" -private "_fnc_parseConfigForDisplayNames"; -_fnc_parseConfigForDisplayNames = { +private _fnc_parseConfigForDisplayNames = { params ["_optionEntry"]; if !(isClass _optionEntry) exitWith {false}; - private "_values"; - _values = getArray (_optionEntry >> "values"); + private _values = getArray (_optionEntry >> "values"); _x set [3, getText (_optionEntry >> "displayName")]; _x set [4, getText (_optionEntry >> "description")]; @@ -27,8 +25,7 @@ _fnc_parseConfigForDisplayNames = { _x set [8, getText (_optionEntry >> "category")]; { - private "_text"; - _text = _x; + private _text = _x; if (_text isEqualType "" && {count _text > 1} && {_text select [0, 1] == "$"}) then { _text = localize (_text select [1]); //chop off the leading $ diff --git a/addons/common/functions/fnc_loadSettingsOnServer.sqf b/addons/common/functions/fnc_loadSettingsOnServer.sqf index cdf8b48041..4498c9d058 100644 --- a/addons/common/functions/fnc_loadSettingsOnServer.sqf +++ b/addons/common/functions/fnc_loadSettingsOnServer.sqf @@ -15,15 +15,13 @@ GVAR(settings) = []; -private "_fnc_parseConfigForSettings"; -_fnc_parseConfigForSettings = { - private ["_config", "_countOptions", "_optionEntry"]; +private _fnc_parseConfigForSettings = { + params ["_config"]; - _config = _this select 0; - _countOptions = count _config; + private _countOptions = count _config; for "_index" from 0 to (_countOptions - 1) do { - _optionEntry = _config select _index; + private _optionEntry = _config select _index; [_optionEntry] call FUNC(setSettingFromConfig); }; diff --git a/addons/common/functions/fnc_localEvent.sqf b/addons/common/functions/fnc_localEvent.sqf index f5a121c088..43f6209d0d 100644 --- a/addons/common/functions/fnc_localEvent.sqf +++ b/addons/common/functions/fnc_localEvent.sqf @@ -17,12 +17,10 @@ params ["_eventName", "_eventArgs"]; GVAR(events) params ["_eventNames", "_eventArray"]; -private "_eventIndex"; -_eventIndex = _eventNames find _eventName; +private _eventIndex = _eventNames find _eventName; if (_eventIndex != -1) then { - private "_events"; - _events = _eventArray select _eventIndex; + private _events = _eventArray select _eventIndex; #ifdef DEBUG_EVENTS ACE_LOGINFO_1("* Local Event: %1",_eventName); diff --git a/addons/common/functions/fnc_map.sqf b/addons/common/functions/fnc_map.sqf index a727de08bf..5d24e13b38 100644 --- a/addons/common/functions/fnc_map.sqf +++ b/addons/common/functions/fnc_map.sqf @@ -16,7 +16,7 @@ */ #include "script_component.hpp" -params ["_array", "_code"]; +params [["_array", [], [[]]], ["_code", {}, [{}]]]; // copy array to not alter the original one _array = + _array; diff --git a/addons/common/functions/fnc_muteUnit.sqf b/addons/common/functions/fnc_muteUnit.sqf index 84d56f92bd..d4648155b6 100644 --- a/addons/common/functions/fnc_muteUnit.sqf +++ b/addons/common/functions/fnc_muteUnit.sqf @@ -17,17 +17,15 @@ params ["_unit", "_reason"]; if (isNull _unit) exitWith {}; -private ["_muteUnitReasons", "_speaker"]; - // add reason to mute to the unit -_muteUnitReasons = _unit getVariable [QGVAR(muteUnitReasons), []]; +private _muteUnitReasons = _unit getVariable [QGVAR(muteUnitReasons), []]; if !(_reason in _muteUnitReasons) then { _muteUnitReasons pushBack _reason; _unit setVariable [QGVAR(muteUnitReasons), _muteUnitReasons, true]; }; -_speaker = speaker _unit; +private _speaker = speaker _unit; if (_speaker == "ACE_NoVoice") exitWith {}; diff --git a/addons/common/functions/fnc_numberToDigits.sqf b/addons/common/functions/fnc_numberToDigits.sqf index c5e1b6d7b6..b90f0eefd7 100644 --- a/addons/common/functions/fnc_numberToDigits.sqf +++ b/addons/common/functions/fnc_numberToDigits.sqf @@ -18,8 +18,7 @@ params ["_number", "_minLength"]; _number = _number min 999999; _number = str _number; -private "_length"; -_length = count _number; +private _length = count _number; if (isNil "_minLength") then {_minLength = _length}; @@ -30,8 +29,7 @@ while {_length < _minLength} do { _length = _length + 1; }; -private "_digits"; -_digits = []; +private _digits = []; for "_x" from 0 to (_length - 1) do { _digits pushBack parseNumber (_number select [_x, 1]); diff --git a/addons/common/functions/fnc_numberToDigitsString.sqf b/addons/common/functions/fnc_numberToDigitsString.sqf index f8f192e0e3..7e2c78f8b4 100644 --- a/addons/common/functions/fnc_numberToDigitsString.sqf +++ b/addons/common/functions/fnc_numberToDigitsString.sqf @@ -18,8 +18,7 @@ params ["_number", "_minLength"]; _number = _number min 999999; _number = str _number; -private "_length"; -_length = count _number; +private _length = count _number; if (isNil "_minLength") then {_minLength = _length}; diff --git a/addons/common/functions/fnc_numberToString.sqf b/addons/common/functions/fnc_numberToString.sqf index 4dd810607c..1cb2f521f8 100644 --- a/addons/common/functions/fnc_numberToString.sqf +++ b/addons/common/functions/fnc_numberToString.sqf @@ -14,8 +14,7 @@ params ["_number"]; -private "_decimals"; -_decimals = str (abs _number mod 1); +private _decimals = str (abs _number mod 1); _decimals = toArray _decimals; _decimals deleteAt 0; diff --git a/addons/common/functions/fnc_onAnswerRequest.sqf b/addons/common/functions/fnc_onAnswerRequest.sqf index 2f7aef43a5..d88969b059 100644 --- a/addons/common/functions/fnc_onAnswerRequest.sqf +++ b/addons/common/functions/fnc_onAnswerRequest.sqf @@ -14,17 +14,12 @@ params ["_unit", "_id", "_accepted"]; -private ["_requestID", "_info", "_callBack", "_caller", "_replyParams", "_requestMessage", "_target"]; - -_info = _unit getVariable _id; +private _info = _unit getVariable _id; if (!isNil "_info") then { - _caller = _info select 0; - _target = _info select 1; - _requestID = _info select 2; - _requestMessage = _info select 3; - _callBack = _info select 4; - _replyParams = [_info, _accepted]; + _info params ["_caller", "_target", "_requestID", "_requestMessage", "_callBack"]; + + private _replyParams = [_info, _accepted]; [_replyParams, QFUNC(requestCallback), _caller, false] call FUNC(execRemoteFnc); _unit setVariable [_id, nil]; }; diff --git a/addons/common/functions/fnc_parseList.sqf b/addons/common/functions/fnc_parseList.sqf index ef7eaae92a..fc92605682 100644 --- a/addons/common/functions/fnc_parseList.sqf +++ b/addons/common/functions/fnc_parseList.sqf @@ -19,36 +19,34 @@ params ["_list", ["_removeWhitespace", false], ["_checkNil", false]]; -private ["_whitespaceList", "_nilCheckedList"]; - // Split using comma delimiter _list = _list splitString ","; TRACE_1("Splitted List",_list); - // Remove or Trim Whitespace -_whitespaceList = []; +private _whitespaceList = []; + { if (_removeWhitespace) then { _whitespaceList pushBack ([_x] call FUNC(stringRemoveWhiteSpace)); } else { _whitespaceList pushBack ([_x] call CBA_fnc_trim); }; - nil + false } count _list; _list = _whitespaceList; TRACE_1("Whitespace List",_list); - // Check for object existence if (_checkNil) then { - _nilCheckedList = []; + private _nilCheckedList = []; + { if !(isNil _x) then { _nilCheckedList pushBack (missionNamespace getVariable _x); }; - nil + false } count _list; _list = _nilCheckedList; diff --git a/addons/common/functions/fnc_progressBar.sqf b/addons/common/functions/fnc_progressBar.sqf index 170d0060c0..e842590f35 100644 --- a/addons/common/functions/fnc_progressBar.sqf +++ b/addons/common/functions/fnc_progressBar.sqf @@ -24,9 +24,7 @@ params ["_totalTime", "_args", "_onFinish", "_onFail", ["_localizedTitle", ""], ["_condition", {true}], ["_exceptions", []]]; -private ["_player", "_ctrlPos", "_fnc_perFrameFunction"]; - -_player = ACE_player; +private _player = ACE_player; //Open Dialog and set the title closeDialog 0; @@ -35,7 +33,7 @@ createDialog QGVAR(ProgressBar_Dialog); (uiNamespace getVariable QGVAR(ctrlProgressBarTitle)) ctrlSetText _localizedTitle; //Adjust position based on user setting: -_ctrlPos = ctrlPosition (uiNamespace getVariable QGVAR(ctrlProgressBarTitle)); +private _ctrlPos = ctrlPosition (uiNamespace getVariable QGVAR(ctrlProgressBarTitle)); _ctrlPos set [1, ((0 + 29 * GVAR(SettingProgressBarLocation)) * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2))]; (uiNamespace getVariable QGVAR(ctrlProgressBG)) ctrlSetPosition _ctrlPos; @@ -45,13 +43,11 @@ _ctrlPos set [1, ((0 + 29 * GVAR(SettingProgressBarLocation)) * ((((safezoneW / (uiNamespace getVariable QGVAR(ctrlProgressBarTitle)) ctrlSetPosition _ctrlPos; (uiNamespace getVariable QGVAR(ctrlProgressBarTitle)) ctrlCommit 0; -_fnc_perFrameFunction = { +[{ (_this select 0) params ["_args", "_onFinish", "_onFail", "_condition", "_player", "_startTime", "_totalTime", "_exceptions"]; - private ["_elapsedTime", "_errorCode"]; - - _elapsedTime = ACE_time - _startTime; - _errorCode = -1; + private _elapsedTime = ACE_time - _startTime; + private _errorCode = -1; // this does not check: target fell unconscious, target died, target moved inside vehicle / left vehicle, target moved outside of players range, target moves at all. if (isNull (uiNamespace getVariable [QGVAR(ctrlProgressBar), controlNull])) then { @@ -101,6 +97,4 @@ _fnc_perFrameFunction = { //Update Progress Bar (ratio of elepased:total) (uiNamespace getVariable QGVAR(ctrlProgressBar)) progressSetPosition (_elapsedTime / _totalTime); }; -}; - -[_fnc_perFrameFunction, 0, [_args, _onFinish, _onFail, _condition, _player, ACE_time, _totalTime, _exceptions]] call CBA_fnc_addPerFrameHandler; +}, 0, [_args, _onFinish, _onFail, _condition, _player, ACE_time, _totalTime, _exceptions]] call CBA_fnc_addPerFrameHandler; diff --git a/addons/common/functions/fnc_receiveRequest.sqf b/addons/common/functions/fnc_receiveRequest.sqf index e5885d70ce..75f684f5dd 100644 --- a/addons/common/functions/fnc_receiveRequest.sqf +++ b/addons/common/functions/fnc_receiveRequest.sqf @@ -19,9 +19,9 @@ _requestID = ("ace_recieveRequest_f_id_"+_requestID); _target setVariable [_requestID, _this]; if (isLocalized _requestMessage) then { - _requestMessage = format [localize _requestMessage, [_caller] call FUNC(getName)]; + _requestMessage = format [localize _requestMessage, [_caller, false, true] call FUNC(getName)]; } else { - _requestMessage = format [_requestMessage, [_caller] call FUNC(getName)]; + _requestMessage = format [_requestMessage, [_caller, false, true] call FUNC(getName)]; }; hint format ["%1", _requestMessage]; // @todo ? @@ -50,8 +50,7 @@ GVAR(RECIEVE_REQUEST_TIME_OUT_SCRIPT) = [ACE_time, _target, _requestID] spawn { _time = _time + 40; - private "_id"; - _id = _target getVariable _requestID; + private _id = _target getVariable _requestID; waitUntil { _id = _target getVariable _requestID; diff --git a/addons/common/functions/fnc_removeActionEventHandler.sqf b/addons/common/functions/fnc_removeActionEventHandler.sqf index b22ed0f152..60e551590d 100644 --- a/addons/common/functions/fnc_removeActionEventHandler.sqf +++ b/addons/common/functions/fnc_removeActionEventHandler.sqf @@ -18,10 +18,8 @@ params ["_unit", "_action", "_id"]; if (_id == -1) exitWith {}; -private ["_name", "_actionsVar"]; - -_name = format ["ACE_Action_%1", _action]; -_actionsVar = _unit getVariable [_name, [-1, [-1, [], []], objNull]]; +private _name = format ["ACE_Action_%1", _action]; +private _actionsVar = _unit getVariable [_name, [-1, [-1, [], []], objNull]]; _actionsVar params ["_actionID", "_actionsArray"]; _actionsArray params ["_currentID", "_actionIDs", "_actions"]; diff --git a/addons/common/functions/fnc_removeActionMenuEventHandler.sqf b/addons/common/functions/fnc_removeActionMenuEventHandler.sqf index e5adbe0c01..943e3b4e22 100644 --- a/addons/common/functions/fnc_removeActionMenuEventHandler.sqf +++ b/addons/common/functions/fnc_removeActionMenuEventHandler.sqf @@ -18,10 +18,8 @@ params ["_unit", "_action", "_id"]; if (_id == -1) exitWith {}; -private ["_name", "_actionsVar"]; - -_name = format ["ACE_ActionMenu_%1", _action]; -_actionsVar = _unit getVariable [_name, [-1, [-1, [], []]]]; +private _name = format ["ACE_ActionMenu_%1", _action]; +private _actionsVar = _unit getVariable [_name, [-1, [-1, [], []]]]; _actionsVar params ["_currentID", "_actionIDs", "_actions"]; diff --git a/addons/common/functions/fnc_removeAllEventHandlers.sqf b/addons/common/functions/fnc_removeAllEventHandlers.sqf index 1a1a6e255f..a309d18d02 100644 --- a/addons/common/functions/fnc_removeAllEventHandlers.sqf +++ b/addons/common/functions/fnc_removeAllEventHandlers.sqf @@ -16,10 +16,8 @@ params ["_eventName"]; GVAR(events) params ["_eventNames", "_events"]; -private ["_eventFunctions", "_eventIndex"]; - -_eventFunctions = []; -_eventIndex = _eventNames find _eventName; +private _eventFunctions = []; +private _eventIndex = _eventNames find _eventName; if (_eventIndex != -1) then { _events set [_eventIndex, []]; diff --git a/addons/common/functions/fnc_removeBinocularMagazine.sqf b/addons/common/functions/fnc_removeBinocularMagazine.sqf index ee35f28f1b..487295ccc3 100644 --- a/addons/common/functions/fnc_removeBinocularMagazine.sqf +++ b/addons/common/functions/fnc_removeBinocularMagazine.sqf @@ -9,19 +9,16 @@ * None * * Example: - * [player] call ace_common_fnc_removeBinocularMagazine + * player call ace_common_fnc_removeBinocularMagazine * * Public: Yes */ #include "script_component.hpp" -params ["_unit"]; +params [["_unit", objNull, [objNull]]]; -private ["_binocular", "_selectBinocular"]; - -_binocular = binocular _unit; - -_selectBinocular = currentWeapon _unit == _binocular; +private _binocular = binocular _unit; +private _selectBinocular = currentWeapon _unit == _binocular; _unit addWeapon _binocular; diff --git a/addons/common/functions/fnc_removeCanInteractWithCondition.sqf b/addons/common/functions/fnc_removeCanInteractWithCondition.sqf index 6c3fa8354b..b267e84557 100644 --- a/addons/common/functions/fnc_removeCanInteractWithCondition.sqf +++ b/addons/common/functions/fnc_removeCanInteractWithCondition.sqf @@ -16,13 +16,11 @@ params ["_conditionName"]; _conditionName = toLower _conditionName; -private "_conditions"; -_conditions = missionNamespace getVariable [QGVAR(InteractionConditions), [[],[]]]; +private _conditions = missionNamespace getVariable [QGVAR(InteractionConditions), [[],[]]]; _conditions params ["_conditionNames", "_conditionFuncs"]; -private "_index"; -_index = _conditionNames find _conditionName; +private _index = _conditionNames find _conditionName; if (_index == -1) exitWith {}; diff --git a/addons/common/functions/fnc_removeEventHandler.sqf b/addons/common/functions/fnc_removeEventHandler.sqf index 0c70046706..5e307ad896 100644 --- a/addons/common/functions/fnc_removeEventHandler.sqf +++ b/addons/common/functions/fnc_removeEventHandler.sqf @@ -17,10 +17,8 @@ params ["_eventName", "_eventCodeIndex"]; GVAR(events) params ["_eventNames", "_events"]; -private ["_eventFunctions", "_eventIndex"]; - -_eventFunctions = []; -_eventIndex = _eventNames find _eventName; +private _eventFunctions = []; +private _eventIndex = _eventNames find _eventName; if (_eventIndex != -1) then { _eventFunctions = _events select _eventIndex; diff --git a/addons/common/functions/fnc_removeMapMarkerCreatedEventHandler.sqf b/addons/common/functions/fnc_removeMapMarkerCreatedEventHandler.sqf index d156359ebf..825281c3e0 100644 --- a/addons/common/functions/fnc_removeMapMarkerCreatedEventHandler.sqf +++ b/addons/common/functions/fnc_removeMapMarkerCreatedEventHandler.sqf @@ -14,8 +14,7 @@ params ["_id"]; -private "_actionsVar"; -_actionsVar = missionNamespace getVariable ["ACE_EventHandler_MapMarker", [-1, [], []]]; +private _actionsVar = missionNamespace getVariable ["ACE_EventHandler_MapMarker", [-1, [], []]]; _actionsVar params ["_currentId", "_actionIDs", "_actions"]; diff --git a/addons/common/functions/fnc_removeScrollWheelEventHandler.sqf b/addons/common/functions/fnc_removeScrollWheelEventHandler.sqf index b277467cce..d7a8ae28cc 100644 --- a/addons/common/functions/fnc_removeScrollWheelEventHandler.sqf +++ b/addons/common/functions/fnc_removeScrollWheelEventHandler.sqf @@ -14,8 +14,7 @@ params ["_id"]; -private "_actionsVar"; -_actionsVar = missionNamespace getVariable ["ACE_EventHandler_ScrollWheel", [-1, [], []]]; +private _actionsVar = missionNamespace getVariable ["ACE_EventHandler_ScrollWheel", [-1, [], []]]; _actionsVar params ["_currentId", "_actionIDs", "_actions"]; diff --git a/addons/common/functions/fnc_removeSpecificMagazine.sqf b/addons/common/functions/fnc_removeSpecificMagazine.sqf index 46950cc1d8..e703a56296 100644 --- a/addons/common/functions/fnc_removeSpecificMagazine.sqf +++ b/addons/common/functions/fnc_removeSpecificMagazine.sqf @@ -14,15 +14,14 @@ */ #include "script_component.hpp" -params ["_unit", "_magazineType", "_ammoCount"]; +params [["_unit", objNull, [objNull]], ["_magazineType", "", [""]], ["_ammoCount", 0, [0]]]; -private ["_isRemoved", "_magazines", "_index"]; - -_isRemoved = false; +private _isRemoved = false; // Check uniform -_magazines = [magazinesAmmoCargo uniformContainer _unit, {_this select 0 == _magazineType}] call FUNC(filter); -_index = _magazines find [_magazineType, _ammoCount]; +private _magazines = [magazinesAmmoCargo uniformContainer _unit, {_this select 0 == _magazineType}] call FUNC(filter); +private _index = _magazines find [_magazineType, _ammoCount]; + if (_index > -1) exitWith { { _unit removeItemFromUniform (_x select 0); @@ -41,7 +40,8 @@ if (_index > -1) exitWith { // Check vest _magazines = [magazinesAmmoCargo vestContainer _unit, {_this select 0 == _magazineType}] call FUNC(filter); -_index = _magazines find [_magazineType,_ammoCount]; +_index = _magazines find [_magazineType, _ammoCount]; + if (_index > -1) exitWith { { _unit removeItemFromVest (_x select 0); @@ -60,7 +60,8 @@ if (_index > -1) exitWith { // Check backpack _magazines = [magazinesAmmoCargo backpackContainer _unit, {_this select 0 == _magazineType}] call FUNC(filter); -_index = _magazines find [_magazineType,_ammoCount]; +_index = _magazines find [_magazineType, _ammoCount]; + if (_index > -1) exitWith { { _unit removeItemFromBackpack (_x select 0); diff --git a/addons/common/functions/fnc_removeSyncedEventHandler.sqf b/addons/common/functions/fnc_removeSyncedEventHandler.sqf index ffc4a364f3..126bf0b70f 100644 --- a/addons/common/functions/fnc_removeSyncedEventHandler.sqf +++ b/addons/common/functions/fnc_removeSyncedEventHandler.sqf @@ -19,10 +19,8 @@ if (!HASH_HASKEY(GVAR(syncedEvents),_name)) exitWith { false }; -private ["_data", "_eventId"]; - -_data = HASH_GET(GVAR(syncedEvents),_name); -_eventId = _data select 3; +private _data = HASH_GET(GVAR(syncedEvents),_name); +_data params ["", "", "", "_eventId"]; [_eventId] call FUNC(removeEventHandler); HASH_REM(GVAR(syncedEvents),_name); diff --git a/addons/common/functions/fnc_restoreVariablesJIP.sqf b/addons/common/functions/fnc_restoreVariablesJIP.sqf index 491ce89bb4..39626514bb 100644 --- a/addons/common/functions/fnc_restoreVariablesJIP.sqf +++ b/addons/common/functions/fnc_restoreVariablesJIP.sqf @@ -14,8 +14,7 @@ params ["_unit"]; -private "_respawnVariables"; -_respawnVariables = _unit getVariable ["ACE_respawnVariables", []]; +private _respawnVariables = _unit getVariable ["ACE_respawnVariables", []]; // yes those _respawnVariables pushBack "ACE_PersistentFunctions"; diff --git a/addons/common/functions/fnc_sanitizeString.sqf b/addons/common/functions/fnc_sanitizeString.sqf index fff3288db6..6e0db2cda2 100644 --- a/addons/common/functions/fnc_sanitizeString.sqf +++ b/addons/common/functions/fnc_sanitizeString.sqf @@ -7,7 +7,10 @@ * 1: Remove html tags (default: false) * * Return Value: - * Sanitized string + * Sanitized string + * + * Example: + * ["CoolGuy", true] call ace_common_fnc_sanitizeString; * * Public: Yes */ @@ -15,19 +18,18 @@ params ["_string", ["_removeTags", false]]; -private "_array"; -_array = []; +private _array = []; { switch _x do { - case 60 : { + case 60 : { // less than symbol: `<` if (_removeTags) then { _array append toArray "<"; } else { _array pushBack _x; }; }; - case 62 : { + case 62 : { // greater than symbol: `>` if (_removeTags) then { _array append toArray ">"; } else { diff --git a/addons/common/functions/fnc_serverLog.sqf b/addons/common/functions/fnc_serverLog.sqf index 45ab03891c..2525f81c95 100644 --- a/addons/common/functions/fnc_serverLog.sqf +++ b/addons/common/functions/fnc_serverLog.sqf @@ -1,19 +1,24 @@ /* * Author: esteldunedain - * ? + * Log a RPT messaged on just the server * * Arguments: - * ? + * 0: Text to display * * Return Value: * None * + * Example: + * ["x happened"] call ace_common_fnc_serverLog; + * * Public: no */ #include "script_component.hpp" +params [["_msg", "", [""]]]; + if (isServer) then { - diag_log _this; + diag_log text _msg; } else { [_this, QFUNC(serverLog), 1] call FUNC(execRemoteFnc); }; diff --git a/addons/common/functions/fnc_setCaptivityStatus.sqf b/addons/common/functions/fnc_setCaptivityStatus.sqf index ecb7b3152a..3e84c1753d 100644 --- a/addons/common/functions/fnc_setCaptivityStatus.sqf +++ b/addons/common/functions/fnc_setCaptivityStatus.sqf @@ -10,15 +10,13 @@ * Return Value: * None * - * Public: No + * Public: Yes */ #include "script_component.hpp" params ["_unit", "_reason", "_status"]; -private ["_captivityReasons", "_unitCaptivityReasons", "_captivityReasonsBooleans", "_bitmask"]; - -_captivityReasons = missionNamespace getVariable ["ACE_captivityReasons", []]; +private _captivityReasons = missionNamespace getVariable ["ACE_captivityReasons", []]; // register new reason (these reasons are shared publicly, since units can change ownership, but keep their captivity status) if !(_reason in _captivityReasons) then { @@ -29,16 +27,17 @@ if !(_reason in _captivityReasons) then { }; // get reasons why the unit is captive already and update to the new status -_unitCaptivityReasons = [_unit] call FUNC(getCaptivityStatus); +private _unitCaptivityReasons = _unit call FUNC(getCaptivityStatus); + +private _captivityReasonsBooleans = []; -_captivityReasonsBooleans = []; { _captivityReasonsBooleans set [_forEachIndex, (_captivityReasons select _forEachIndex) in _unitCaptivityReasons]; } forEach _captivityReasons; _captivityReasonsBooleans set [_captivityReasons find _reason, _status]; -_bitmask = _captivityReasonsBooleans call FUNC(toBitmask); +private _bitmask = _captivityReasonsBooleans call FUNC(toBitmask); // actually apply the setCaptive command globaly [[_unit, _bitmask], "{(_this select 0) setCaptive (_this select 1)}", _unit] call FUNC(execRemoteFnc); diff --git a/addons/common/functions/fnc_setDefinedVariable.sqf b/addons/common/functions/fnc_setDefinedVariable.sqf index 9b7812ee82..6f1f0c2e58 100644 --- a/addons/common/functions/fnc_setDefinedVariable.sqf +++ b/addons/common/functions/fnc_setDefinedVariable.sqf @@ -17,8 +17,7 @@ params ["_unit", "_variable", "_value", "_global"]; if (isNil "_global") then { - private "_definedVariable"; - _definedVariable = [_variable] call FUNC(getDefinedVariableInfo); + private _definedVariable = [_variable] call FUNC(getDefinedVariableInfo); _definedVariable params ["", "", ["_global", false]]; }; diff --git a/addons/common/functions/fnc_setForceWalkStatus.sqf b/addons/common/functions/fnc_setForceWalkStatus.sqf index aaa594b9a9..3842457395 100644 --- a/addons/common/functions/fnc_setForceWalkStatus.sqf +++ b/addons/common/functions/fnc_setForceWalkStatus.sqf @@ -14,15 +14,13 @@ * Example: * [ACE_Player, "BrokenLeg", true] call FUNC(setForceWalkStatus) * - * Public: No + * Public: Yes */ #include "script_component.hpp" params ["_unit", "_reason", "_status"]; -private ["_forceWalkReasons", "_unitForceWalkReasons", "_forceWalkReasonsBooleans", "_bitmaskNumber"]; - -_forceWalkReasons = missionNamespace getVariable ["ACE_forceWalkReasons", []]; +private _forceWalkReasons = missionNamespace getVariable ["ACE_forceWalkReasons", []]; // register new reason (these reasons are shared publicly, since units can change ownership, but keep their forceWalk status) if !(_reason in _forceWalkReasons) then { @@ -32,16 +30,17 @@ if !(_reason in _forceWalkReasons) then { }; // get reasons why the unit is forceWalking already and update to the new status -_unitForceWalkReasons = [_unit] call FUNC(getForceWalkStatus); +private _unitForceWalkReasons = [_unit] call FUNC(getForceWalkStatus); + +private _forceWalkReasonsBooleans = []; -_forceWalkReasonsBooleans = []; { _forceWalkReasonsBooleans set [_forEachIndex, (_forceWalkReasons select _forEachIndex) in _unitForceWalkReasons]; } forEach _forceWalkReasons; _forceWalkReasonsBooleans set [_forceWalkReasons find _reason, _status]; -_bitmaskNumber = _forceWalkReasonsBooleans call FUNC(toBitmask); +private _bitmaskNumber = _forceWalkReasonsBooleans call FUNC(toBitmask); _unit setVariable ["ACE_forceWalkStatusNumber", _bitmaskNumber, true]; diff --git a/addons/common/functions/fnc_setHearingCapability.sqf b/addons/common/functions/fnc_setHearingCapability.sqf index d24f8d0d9d..7bd375a58b 100644 --- a/addons/common/functions/fnc_setHearingCapability.sqf +++ b/addons/common/functions/fnc_setHearingCapability.sqf @@ -18,11 +18,10 @@ params ["_id", "_settings", ["_add", true]]; -private ["_map", "_exists", "_lowestVolume"]; +private _map = missionNamespace getVariable [QGVAR(setHearingCapabilityMap),[]]; -_map = missionNamespace getVariable [QGVAR(setHearingCapabilityMap),[]]; +private _exists = false; -_exists = false; { if (_id == _x select 0) exitWith { _exists = true; @@ -42,7 +41,8 @@ if (!_exists && _add) then { missionNamespace setVariable [QGVAR(setHearingCapabilityMap), _map]; // find lowest volume -_lowestVolume = 1; +private _lowestVolume = 1; + { _lowestVolume = (_x select 1) min _lowestVolume; false diff --git a/addons/common/functions/fnc_setName.sqf b/addons/common/functions/fnc_setName.sqf index 117445b561..b9ecbdc3a6 100644 --- a/addons/common/functions/fnc_setName.sqf +++ b/addons/common/functions/fnc_setName.sqf @@ -17,9 +17,15 @@ params ["_unit"]; if (isNull _unit || {!alive _unit}) exitWith {}; if (_unit isKindOf "CAManBase") then { - _name = [name _unit, true] call FUNC(sanitizeString); - + private _sanitizedName = [name _unit, true] call FUNC(sanitizeString); + private _rawName = [name _unit, false] call FUNC(sanitizeString); + + //Debug Testing Code (with html tags): + // private _sanitizedName = ["Name", true] call FUNC(sanitizeString); + // private _rawName = ["Name", false] call FUNC(sanitizeString); + //if (_name != _unit getVariable ["ACE_Name", ""]) then { - _unit setVariable ["ACE_Name", _name, true]; + _unit setVariable ["ACE_Name", _sanitizedName, true]; + _unit setVariable ["ACE_NameRaw", _rawName, true]; //}; }; diff --git a/addons/common/functions/fnc_setPitchBankYaw.sqf b/addons/common/functions/fnc_setPitchBankYaw.sqf index ea7f27a906..fecc16208c 100644 --- a/addons/common/functions/fnc_setPitchBankYaw.sqf +++ b/addons/common/functions/fnc_setPitchBankYaw.sqf @@ -19,14 +19,12 @@ params ["_object", "_aroundX", "_aroundY", "_aroundZ"]; _aroundZ = - _aroundZ; -private ["_dirX", "_dirY", "_dirZ", "_upX", "_upY", "_upZ", "_dir", "_up"]; - -_dirX = 0; -_dirY = 1; -_dirZ = 0; -_upX = 0; -_upY = 0; -_upZ = 1; +private _dirX = 0; +private _dirY = 1; +private _dirZ = 0; +private _upX = 0; +private _upY = 0; +private _upZ = 1; if (_aroundX != 0) then { _dirY = cos _aroundX; @@ -43,18 +41,16 @@ if (_aroundY != 0) then { }; if (_aroundZ != 0) then { - private ["_dirXTemp", "_upXTemp"]; - - _dirXTemp = _dirX; + private _dirXTemp = _dirX; _dirX = (_dirXTemp* cos _aroundZ) - (_dirY * sin _aroundZ); _dirY = (_dirY * cos _aroundZ) + (_dirXTemp * sin _aroundZ); - _upXTemp = _upX; + private _upXTemp = _upX; _upX = (_upXTemp * cos _aroundZ) - (_upY * sin _aroundZ); _upY = (_upY * cos _aroundZ) + (_upXTemp * sin _aroundZ); }; -_dir = [_dirX, _dirY, _dirZ]; -_up = [_upX, _upY, _upZ]; +private _dir = [_dirX, _dirY, _dirZ]; +private _up = [_upX, _upY, _upZ]; _object setVectorDirAndUp [_dir,_up]; diff --git a/addons/common/functions/fnc_setSettingFromConfig.sqf b/addons/common/functions/fnc_setSettingFromConfig.sqf index 5dc55f51f7..ac7a0f4875 100644 --- a/addons/common/functions/fnc_setSettingFromConfig.sqf +++ b/addons/common/functions/fnc_setSettingFromConfig.sqf @@ -14,13 +14,11 @@ params ["_optionEntry"]; -private ["_fnc_getValueWithType", "_value", "_name", "_typeName", "_settingData", "_valueConfig", "_text"]; - -_fnc_getValueWithType = { +private _fnc_getValueWithType = { params ["_optionEntry", "_typeName"]; - _valueConfig = (_optionEntry >> "value"); - _value = if (isNumber (_optionEntry >> "value")) then {getNumber (_optionEntry >> "value")} else {0}; + private _valueConfig = (_optionEntry >> "value"); + private _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 @@ -37,27 +35,27 @@ _fnc_getValueWithType = { _value }; -_name = configName _optionEntry; +private _name = configName _optionEntry; // Check if the variable is already defined if (isNil _name) then { // That setting was not loaded yet // Get type from config - _typeName = getText (_optionEntry >> "typeName"); + private _typeName = getText (_optionEntry >> "typeName"); if (_typeName == "") then { _typeName = "SCALAR"; }; // Read entry and cast it to the correct type - _value = [_optionEntry, _typeName] call _fnc_getValueWithType; + private _value = [_optionEntry, _typeName] call _fnc_getValueWithType; // Init the variable missionNamespace setVariable [_name, _value]; // Add the setting to a list on the server // Set the variable to not forced - /*_settingData = [ + /*private _settingData = [ name, typeName, isClientSettable, @@ -68,7 +66,7 @@ if (isNil _name) then { defaultValue, category ];*/ - _settingData = [ + private _settingData = [ _name, _typeName, (getNumber (_optionEntry >> "isClientSettable")) > 0, @@ -81,10 +79,10 @@ if (isNil _name) then { ]; //Strings in the values array won't be localized from the config, so just do that now: - /*private "_values"; - _values = _settingData select 5; + /*private _values = _settingData select 5; + { - _text = _x; + private _text = _x; if (((typeName _text) == "STRING") && {(count _text) > 1} && {(_text select [0,1]) == "$"}) then { _text = localize (_text select [1, ((count _text) - 1)]); //chop off the leading $ _values set [_forEachIndex, _text]; @@ -98,13 +96,13 @@ if (isNil _name) then { // The setting already exists. // Check if it's already forced and quit - _settingData = [_name] call FUNC(getSettingData); + private _settingData = [_name] call FUNC(getSettingData); if (_settingData select 6) exitWith {}; // The setting is not forced, so update the value // Read entry and cast it to the correct type from the existing variable - _value = [_optionEntry, _settingData select 1] call _fnc_getValueWithType; + private _value = [_optionEntry, _settingData select 1] call _fnc_getValueWithType; // Update the variable missionNamespace setVariable [_name, _value]; diff --git a/addons/common/functions/fnc_setVariableJIP.sqf b/addons/common/functions/fnc_setVariableJIP.sqf index d1bd27ea4e..35e8c0d116 100644 --- a/addons/common/functions/fnc_setVariableJIP.sqf +++ b/addons/common/functions/fnc_setVariableJIP.sqf @@ -16,8 +16,7 @@ params ["_unit", "_varName", "_value"]; -private "_respawnVariables"; -_respawnVariables = _unit getVariable ["ACE_respawnVariables", []]; +private _respawnVariables = _unit getVariable ["ACE_respawnVariables", []]; if !(_varName in _respawnVariables) then { _respawnVariables pushBack _varName; diff --git a/addons/common/functions/fnc_sortAlphabeticallyBy.sqf b/addons/common/functions/fnc_sortAlphabeticallyBy.sqf index 9bbec92d40..0bf0c6432f 100644 --- a/addons/common/functions/fnc_sortAlphabeticallyBy.sqf +++ b/addons/common/functions/fnc_sortAlphabeticallyBy.sqf @@ -18,34 +18,32 @@ ACE_DEPRECATED("ace_common_fnc_sortAlphabeticallyBy","3.5.0","sort"); params ["_array", "_elementN"]; -private ["_elements", "_indexes", "_theElement", "_tmp", "_tempIndex", "_returnArray"]; - -_indexes = []; -_elements = []; +private _indices = []; +private _elements = []; { - _theElement = toArray (_x select _elementN); - _indexes pushBack _forEachIndex; + private _theElement = toArray (_x select _elementN); + _indices pushBack _forEachIndex; _elements pushBack _theElement; } forEach _array; for "_i" from 1 to (count _elements) - 1 do { - _tmp = _elements select _i; - _tempIndex = _indexes select _i; + private _tmp = _elements select _i; + private _tempIndex = _indices select _i; _j = _i; while {_j >= 1 && {_tmp < _elements select (_j - 1)}} do { _elements set [_j, _elements select (_j - 1)]; - _indexes set [_j, _indexes select (_j - 1)]; + _indices set [_j, _indices select (_j - 1)]; _j = _j - 1; }; _elements set[_j, _tmp]; - _indexes set [_j, _tempIndex]; + _indices set [_j, _tempIndex]; }; -_returnArray = []; +private _returnArray = []; { _returnArray pushBack (_array select _x); -} forEach _indexes; +} forEach _indices; _returnArray diff --git a/addons/common/functions/fnc_stringCompare.sqf b/addons/common/functions/fnc_stringCompare.sqf index da65c676f8..ad3073eb1e 100644 --- a/addons/common/functions/fnc_stringCompare.sqf +++ b/addons/common/functions/fnc_stringCompare.sqf @@ -18,16 +18,14 @@ params ["_string", "_searchTerm"]; _string = toLower _string; // removes case sensitivity _searchTerm = toLower _searchTerm; -private ["_arraySearchTerm", "_arrayString", "_sizeSearchTerm", "_sizeString", "_matchingCharacters", "_searchIterator", "_targetIterator"]; +private _arraySearchTerm = toArray _searchTerm; // splits string into array of unicode decimals +private _arrayString = toArray _string; +private _sizeSearchTerm = count _arraySearchTerm; // We only measure the array once +private _sizeString = count _arrayString; -_arraySearchTerm = toArray _searchTerm; // splits string into array of unicode decimals -_arrayString = toArray _string; -_sizeSearchTerm = count _arraySearchTerm; // We only measure the array once -_sizeString = count _arrayString; - -_matchingCharacters = 0; -_searchIterator = 0; -_targetIterator = 0; +private _matchingCharacters = 0; +private _searchIterator = 0; +private _targetIterator = 0; while {_searchIterator < _sizeSearchTerm && _targetIterator < _sizeString} do { // Prevents us from going out of bounds if (_arraySearchTerm select _searchIterator == _arrayString select _targetIterator) then { // If we have a match, start looking for the next character in the search term diff --git a/addons/common/functions/fnc_switchToGroupSide.sqf b/addons/common/functions/fnc_switchToGroupSide.sqf index 7d23e6442a..3a559a7a65 100644 --- a/addons/common/functions/fnc_switchToGroupSide.sqf +++ b/addons/common/functions/fnc_switchToGroupSide.sqf @@ -17,29 +17,24 @@ params [["_unit", objNull], ["_switch", false], ["_id", ""], ["_side", side _unit]]; -private "_previousGroupsList"; -_previousGroupsList = _unit getVariable [QGVAR(previousGroupSwitchTo), []]; +private _previousGroupsList = _unit getVariable [QGVAR(previousGroupSwitchTo), []]; if (_switch) then { // go forward - private ["_previousGroup", "_originalSide", "_newGroup"]; - - _previousGroup = group _unit; - _originalSide = side group _unit; + private _previousGroup = group _unit; + private _originalSide = side group _unit; if (count units _previousGroup == 1 && _originalSide == _side) exitWith { [format ["Current group has only 1 member and is of same side as switch. Not switching unit %1", _id]] call FUNC(debug); }; - _newGroup = createGroup _side; + private _newGroup = createGroup _side; [_unit] joinSilent _newGroup; _previousGroupsList pushBack [_previousGroup, _originalSide, _id, true]; _unit setVariable [QGVAR(previousGroupSwitchTo), _previousGroupsList, true]; } else { // go one back - private ["_currentGroup", "_newGroup"]; - { if (_id == (_x select 2)) exitWith { _x set [ 3, false]; @@ -53,11 +48,11 @@ if (_switch) then { { if (_x select 3) exitWith {}; // stop at first id set to true if !(_x select 3) then { - _currentGroup = group _unit; + private _currentGroup = group _unit; if (!isNull (_x select 0)) then { [_unit] joinSilent (_x select 0); } else { - _newGroup = createGroup (_x select 1); + private _newGroup = createGroup (_x select 1); [_unit] joinSilent _newGroup; }; if (count units _currentGroup == 0) then { diff --git a/addons/common/functions/fnc_syncedEvent.sqf b/addons/common/functions/fnc_syncedEvent.sqf index 34043fa8ae..4ed8107330 100644 --- a/addons/common/functions/fnc_syncedEvent.sqf +++ b/addons/common/functions/fnc_syncedEvent.sqf @@ -21,7 +21,6 @@ if (!HASH_HASKEY(GVAR(syncedEvents),_name)) exitWith { false }; -private "_eventData"; -_eventData = [_name, _args, _ttl]; +private _eventData = [_name, _args, _ttl]; ["SEH", _eventData] call FUNC(globalEvent); diff --git a/addons/common/functions/fnc_syncedEventPFH.sqf b/addons/common/functions/fnc_syncedEventPFH.sqf index 1b2f634ace..62df8f10a7 100644 --- a/addons/common/functions/fnc_syncedEventPFH.sqf +++ b/addons/common/functions/fnc_syncedEventPFH.sqf @@ -19,21 +19,17 @@ if (!isServer) exitWith {false}; // @TODO: This should be iteration limited to prevent FPS lag { - private ["_name", "_data", "_newEventLog"]; + private _name = _x; - _name = _x; - - _data = HASH_GET(GVAR(syncedEvents),_name); + private _data = HASH_GET(GVAR(syncedEvents),_name); _data params ["_eventTime", "_eventLog", "_globalEventTTL"]; - _newEventLog = []; + private _newEventLog = []; // @TODO: This should be iteration limited to prevent FPS lag { - private ["_eventEntry", "_ttlReturn"]; - - _eventEntry = _x; - _ttlReturn = true; + private _eventEntry = _x; + private _ttlReturn = true; if (_globalEventTTL isEqualType {}) then { _ttlReturn = [_eventTime, _eventEntry] call _globalEventTTL; diff --git a/addons/common/functions/fnc_toBin.sqf b/addons/common/functions/fnc_toBin.sqf index 9f3296597d..f8ec0bac68 100644 --- a/addons/common/functions/fnc_toBin.sqf +++ b/addons/common/functions/fnc_toBin.sqf @@ -14,15 +14,13 @@ params ["_number", ["_minLength", 1]]; -private ["_sign", "_bin", "_rest"]; - -_sign = ["", "-"] select (_number < 0); +private _sign = ["", "-"] select (_number < 0); _number = round abs _number; -_bin = ["", "0"] select (_number == 0); +private _bin = ["", "0"] select (_number == 0); while {_number > 0} do { - _rest = str (_number mod 2); + private _rest = str (_number mod 2); _number = floor (_number / 2); _bin = _rest + _bin; }; diff --git a/addons/common/functions/fnc_toBitmask.sqf b/addons/common/functions/fnc_toBitmask.sqf index 35b1e06f9f..333e5c737b 100644 --- a/addons/common/functions/fnc_toBitmask.sqf +++ b/addons/common/functions/fnc_toBitmask.sqf @@ -12,8 +12,7 @@ */ #include "script_component.hpp" -private "_result"; -_result = 0; +private _result = 0; { if (_x) then {_result = _result + 2 ^ _forEachIndex}; diff --git a/addons/common/functions/fnc_toHex.sqf b/addons/common/functions/fnc_toHex.sqf index 80d8757b80..c558aab04b 100644 --- a/addons/common/functions/fnc_toHex.sqf +++ b/addons/common/functions/fnc_toHex.sqf @@ -19,16 +19,14 @@ _number = ((round abs _number) max 0) min 255; if (isNil QGVAR(hexArray)) then { GVAR(hexArray) = []; - private ["_minLength", "_num", "_hex", "_rest"]; - - _minLength = 2; + private _minLength = 2; for [{_i = 0;}, {_i < 256}, {_i = _i + 1}] do { - _num = _i; - _hex = ["", "0"] select (_i == 0); + private _num = _i; + private _hex = ["", "0"] select (_i == 0); while {_num > 0} do { - _rest = _num mod 16; + private _rest = _num mod 16; _rest = switch _rest do { case 10 : {"A"}; case 11 : {"B"}; diff --git a/addons/common/functions/fnc_translateToModelSpace.sqf b/addons/common/functions/fnc_translateToModelSpace.sqf index b05a19bed6..b9fa35243a 100644 --- a/addons/common/functions/fnc_translateToModelSpace.sqf +++ b/addons/common/functions/fnc_translateToModelSpace.sqf @@ -14,8 +14,7 @@ params ["_object", "_matrix", "_offset"]; -private "_origin"; -_origin = getPosASL _object; +private _origin = getPosASL _object; _matrix params ["_xVec", "_yVec", "_zVec"]; diff --git a/addons/common/functions/fnc_translateToWeaponSpace.sqf b/addons/common/functions/fnc_translateToWeaponSpace.sqf index db3a5eaf37..cd360bd874 100644 --- a/addons/common/functions/fnc_translateToWeaponSpace.sqf +++ b/addons/common/functions/fnc_translateToWeaponSpace.sqf @@ -14,8 +14,7 @@ params ["_object", "_matrix", "_offset"]; -private "_origin"; -_origin = getPosASL _object; +private _origin = getPosASL _object; _matrix params ["_xVec", "_yVec", "_zVec"]; diff --git a/addons/common/functions/fnc_unhideUnit.sqf b/addons/common/functions/fnc_unhideUnit.sqf index 5bcafc3509..908dbf3dc8 100644 --- a/addons/common/functions/fnc_unhideUnit.sqf +++ b/addons/common/functions/fnc_unhideUnit.sqf @@ -20,8 +20,7 @@ params ["_unit", "_reason"]; if (isNull _unit) exitWith {}; -private "_setHiddenReasons"; -_setHiddenReasons = _unit getVariable [QGVAR(setHiddenReasons), []]; +private _setHiddenReasons = _unit getVariable [QGVAR(setHiddenReasons), []]; if (_reason in _setHiddenReasons) then { _setHiddenReasons deleteAt (_setHiddenReasons find _reason); diff --git a/addons/common/functions/fnc_uniqueElements.sqf b/addons/common/functions/fnc_uniqueElements.sqf index 55d8c4ef5f..471ba47457 100644 --- a/addons/common/functions/fnc_uniqueElements.sqf +++ b/addons/common/functions/fnc_uniqueElements.sqf @@ -12,6 +12,6 @@ */ #include "script_component.hpp" -params ["_array"]; +params [["_array", [], [[]]]]; _array arrayIntersect _array // return diff --git a/addons/common/functions/fnc_unloadPerson.sqf b/addons/common/functions/fnc_unloadPerson.sqf index 73e02cd7ce..0c1b53bc61 100644 --- a/addons/common/functions/fnc_unloadPerson.sqf +++ b/addons/common/functions/fnc_unloadPerson.sqf @@ -16,15 +16,13 @@ params ["_unit"]; -private "_vehicle"; -_vehicle = vehicle _unit; +private _vehicle = vehicle _unit; if (_vehicle == _unit) exitWith {false}; if (speed _vehicle > 1 || getPos _vehicle select 2 > 2) exitWith {false}; -private "_emptyPos"; -_emptyPos = (getPos _vehicle) findEmptyPosition [0, 10, typeOf _unit]; // @todo to small? +private _emptyPos = (getPos _vehicle) findEmptyPosition [0, 10, typeOf _unit]; // @todo to small? if (count _emptyPos == 0) exitWith {false}; diff --git a/addons/common/functions/fnc_unloadPersonLocal.sqf b/addons/common/functions/fnc_unloadPersonLocal.sqf index a7e61a7868..5e8300c139 100644 --- a/addons/common/functions/fnc_unloadPersonLocal.sqf +++ b/addons/common/functions/fnc_unloadPersonLocal.sqf @@ -17,9 +17,8 @@ params ["_unit", "_vehicle"]; TRACE_2("params",_unit,_vehicle); -private ["_validVehiclestate", "_emptyPos", "_loaded"]; - -_validVehiclestate = true; +private _validVehiclestate = true; +private _emptyPos = []; if (_vehicle isKindOf "Ship") then { if (speed _vehicle > 1 || {getPos _vehicle select 2 > 2}) then { @@ -78,8 +77,7 @@ _unit action ["Eject", vehicle _unit]; TRACE_1("Check if isAwake", [_unit] call FUNC(isAwake)); if (driver _unit == _unit) then { - private "_anim"; - _anim = [_unit] call FUNC(getDeathAnim); + private _anim = [_unit] call FUNC(getDeathAnim); [_unit, _anim, 1, true] call FUNC(doAnimation); @@ -96,7 +94,7 @@ _unit action ["Eject", vehicle _unit]; [_unit, false, GROUP_SWITCH_ID, side group _unit] call FUNC(switchToGroupSide); -_loaded = _vehicle getVariable [QGVAR(loaded_persons),[]]; +private _loaded = _vehicle getVariable [QGVAR(loaded_persons),[]]; _loaded deleteAt (_loaded find _unit); _vehicle setVariable [QGVAR(loaded_persons), _loaded, true]; diff --git a/addons/common/functions/fnc_unmuteUnit.sqf b/addons/common/functions/fnc_unmuteUnit.sqf index bf02fe676f..a995eed244 100644 --- a/addons/common/functions/fnc_unmuteUnit.sqf +++ b/addons/common/functions/fnc_unmuteUnit.sqf @@ -18,8 +18,7 @@ params ["_unit", "_reason"]; if (isNull _unit) exitWith {}; // remove reason to mute to the unit -private "_muteUnitReasons"; -_muteUnitReasons = _unit getVariable [QGVAR(muteUnitReasons), []]; +private _muteUnitReasons = _unit getVariable [QGVAR(muteUnitReasons), []]; if (_reason in _muteUnitReasons) then { _muteUnitReasons deleteAt (_muteUnitReasons find _reason); @@ -29,8 +28,7 @@ if (_reason in _muteUnitReasons) then { // don't unmute if there is another mute reason! if (count _muteUnitReasons > 0) exitWith {}; -private "_speaker"; -_speaker = _unit getVariable ["ACE_OriginalSpeaker", ""]; +private _speaker = _unit getVariable ["ACE_OriginalSpeaker", ""]; if (_speaker == "") exitWith {}; diff --git a/addons/common/functions/fnc_useItem.sqf b/addons/common/functions/fnc_useItem.sqf index acf359813c..2d2116b38f 100644 --- a/addons/common/functions/fnc_useItem.sqf +++ b/addons/common/functions/fnc_useItem.sqf @@ -15,8 +15,7 @@ params ["_unit", "_item", ["_vehicleUsage", false]]; -private "_return"; -_return = false; +private _return = false; if !(_vehicleUsage) then { if (_item != "") then { diff --git a/addons/common/functions/fnc_useMagazine.sqf b/addons/common/functions/fnc_useMagazine.sqf index 1a77d0b3f3..4dc6136fa6 100644 --- a/addons/common/functions/fnc_useMagazine.sqf +++ b/addons/common/functions/fnc_useMagazine.sqf @@ -15,8 +15,7 @@ params ["_unit", "_magazine", ["_vehicleUsage", false]]; -private "_return"; -_return = false; +private _return = false; if !(_vehicleUsage) then { if (_magazine != "") then { diff --git a/addons/common/functions/fnc_waveHeightAt.sqf b/addons/common/functions/fnc_waveHeightAt.sqf index a3f2447729..bc278a9b70 100644 --- a/addons/common/functions/fnc_waveHeightAt.sqf +++ b/addons/common/functions/fnc_waveHeightAt.sqf @@ -1,6 +1,5 @@ /* * Author: jaynus - * * Gets the wave height at a specific location. Uses a logic, so may be performance iffy * * Arguments: diff --git a/addons/common/functions/fnc_worldToScreenBounds.sqf b/addons/common/functions/fnc_worldToScreenBounds.sqf index 2de07c7bbd..c9e5551d19 100644 --- a/addons/common/functions/fnc_worldToScreenBounds.sqf +++ b/addons/common/functions/fnc_worldToScreenBounds.sqf @@ -1,6 +1,5 @@ /* * Author: zGuba 2011 - * * Function helper for framing objects on screen. * * Arguments: @@ -26,14 +25,12 @@ params ["_object", "_margins", "_offsets"]; -private ["_minX", "_minY", "_maxX", "_maxY", "_bounds", "_boundsCorners"]; +private _minX = 10; +private _minY = 10; +private _maxX = -10; +private _maxY = -10; -_minX = 10; -_minY = 10; -_maxX = -10; -_maxY = -10; - -_bounds = boundingBox _object; +private _bounds = boundingBox _object; _margins params ["_marginsX", "_marginsY", "_marginsZ"]; _offsets params ["_offsetsX", "_offsetsY", "_offsetsZ"]; @@ -49,22 +46,23 @@ _boundsMaxX = _boundsMaxX + _marginsX + _offsetsX; _boundsMaxY = _boundsMaxY + _marginsY + _offsetsY; _boundsMaxZ = _boundsMaxZ + _marginsZ + _offsetsZ; -_boundsCorners = [ - [_boundsMinX,_boundsMinY,_boundsMinZ], - [_boundsMinX,_boundsMinY,_boundsMaxZ], - [_boundsMinX,_boundsMaxY,_boundsMinZ], - [_boundsMinX,_boundsMaxY,_boundsMaxZ], - [_boundsMaxX,_boundsMinY,_boundsMinZ], - [_boundsMaxX,_boundsMinY,_boundsMaxZ], - [_boundsMaxX,_boundsMaxY,_boundsMinZ], - [_boundsMaxX,_boundsMaxY,_boundsMaxZ] +private _boundsCorners = [ + [_boundsMinX, _boundsMinY, _boundsMinZ], + [_boundsMinX, _boundsMinY, _boundsMaxZ], + [_boundsMinX, _boundsMaxY, _boundsMinZ], + [_boundsMinX, _boundsMaxY, _boundsMaxZ], + [_boundsMaxX, _boundsMinY, _boundsMinZ], + [_boundsMaxX, _boundsMinY, _boundsMaxZ], + [_boundsMaxX, _boundsMaxY, _boundsMinZ], + [_boundsMaxX, _boundsMaxY, _boundsMaxZ] ]; { - private "_ppos"; - _ppos = worldToScreen (_object modelToWorld _x); + private _ppos = worldToScreen (_object modelToWorld _x); + if (count _ppos >= 2) then { _ppos params ["_pposX", "_pposY"]; + if (_pposX < _minX) then {_minX = _pposX}; if (_pposX > _maxX) then {_maxX = _pposX}; if (_pposY < _minY) then {_minY = _pposY}; @@ -73,4 +71,4 @@ _boundsCorners = [ false } count _boundsCorners; -[_minX,_minY,_maxX,_maxY] +[_minX, _minY, _maxX, _maxY] diff --git a/addons/common/stringtable.xml b/addons/common/stringtable.xml index 6d935f27a5..111300e87c 100644 --- a/addons/common/stringtable.xml +++ b/addons/common/stringtable.xml @@ -705,7 +705,6 @@ Nicht erzwingen Nie wymuszaj No forzar - Nicht erzwingen Nevynucovat Não forçar Не обязывать diff --git a/addons/concertina_wire/CfgVehicles.hpp b/addons/concertina_wire/CfgVehicles.hpp index 81304da853..2a0b8cead2 100644 --- a/addons/concertina_wire/CfgVehicles.hpp +++ b/addons/concertina_wire/CfgVehicles.hpp @@ -1,7 +1,7 @@ class CfgVehicles { class Fence; - class thingX; + class ThingX; class NonStrategic; class ACE_ConcertinaWireNoGeo: Fence { @@ -94,7 +94,7 @@ class CfgVehicles { }; }; }; - class ACE_ConcertinaWireCoil: thingX { + class ACE_ConcertinaWireCoil: ThingX { XEH_ENABLED; scope = 2; displayName = $STR_ACE_CONCERTINA_WIRECOIL; diff --git a/addons/dagr/stringtable.xml b/addons/dagr/stringtable.xml index dea42275f2..61d226377d 100644 --- a/addons/dagr/stringtable.xml +++ b/addons/dagr/stringtable.xml @@ -3,6 +3,7 @@ DAGR + DAGR DAGR DAGR DAGR @@ -11,6 +12,7 @@ Configure DAGR + DAGR konfigurien Konfiguruj DAGR Configurar DAGR Настроить DAGR @@ -19,6 +21,7 @@ Toggle DAGR + DAGR umschalten Przełącz DAGR Mostrar DAGR Вкл./выкл. DAGR @@ -27,6 +30,7 @@ Defense Advanced GPS Receiver + Defense Advanced GPS Receiver Defense Advanced GPS Receiver Defense Advanced GPS Receiver Военный многофункциональный GPS-приёмник @@ -34,4 +38,4 @@ Defense Advanced GPS Receiver - \ No newline at end of file + diff --git a/addons/disarming/functions/fnc_openDisarmDialog.sqf b/addons/disarming/functions/fnc_openDisarmDialog.sqf index c18b3ab7ac..92f98a0756 100644 --- a/addons/disarming/functions/fnc_openDisarmDialog.sqf +++ b/addons/disarming/functions/fnc_openDisarmDialog.sqf @@ -72,7 +72,7 @@ GVAR(disarmTarget) = _target; _icon = format [DEFUALTPATH, toLower (rank _target)]; if (_icon isEqualTo DEFUALTPATH) then {_icon = ""}; _rankPicture ctrlSetText _icon; - _playerName ctrlSetText ([GVAR(disarmTarget)] call EFUNC(common,getName)); + _playerName ctrlSetText ([GVAR(disarmTarget), false, true] call EFUNC(common,getName)); //Clear both inventory lists: lbClear _groundContainer; diff --git a/addons/disposable/functions/fnc_replaceATWeapon.sqf b/addons/disposable/functions/fnc_replaceATWeapon.sqf index f0cee0a048..88e27190ed 100644 --- a/addons/disposable/functions/fnc_replaceATWeapon.sqf +++ b/addons/disposable/functions/fnc_replaceATWeapon.sqf @@ -24,15 +24,13 @@ params ["_unit", "_weapon", "", "", "", "", "_projectile"]; TRACE_3("params",_unit,_weapon,_projectile); -if ((!local _unit) || {_weapon != (secondaryWeapon _unit)}) exitWith {}; +if (!local _unit || {_weapon != secondaryWeapon _unit}) exitWith {}; -private ["_replacementTube", "_items"]; -_replacementTube = getText (configFile >> "CfgWeapons" >> _weapon >> "ACE_UsedTube"); +private _replacementTube = getText (configFile >> "CfgWeapons" >> _weapon >> "ACE_UsedTube"); if (_replacementTube == "") exitWith {}; //If no replacement defined just exit - //Save array of items attached to launcher -_items = secondaryWeaponItems _unit; +private _items = secondaryWeaponItems _unit; //Replace the orginal weapon with the 'usedTube' weapon _unit addWeapon _replacementTube; //Makes sure the used tube is still equiped @@ -55,12 +53,10 @@ if !([_unit] call EFUNC(common,isPlayer)) then { [_idPFH] call CBA_fnc_removePerFrameHandler; //If (tube is dropped) OR (is dead) OR (is player) just exit - if (((secondaryWeapon _unit) != _tube) || {!alive _unit} || {([_unit] call EFUNC(common,isPlayer))}) exitWith {}; + if (secondaryWeapon _unit != _tube || {!alive _unit} || {[_unit] call EFUNC(common,isPlayer)}) exitWith {}; - private ["_items", "_container"]; - - // _items = secondaryWeaponItems _unit; - _container = createVehicle ["GroundWeaponHolder", position _unit, [], 0, "CAN_COLLIDE"]; + //private _items = secondaryWeaponItems _unit; + private _container = createVehicle ["GroundWeaponHolder", position _unit, [], 0, "CAN_COLLIDE"]; _container setPosAsl (getPosAsl _unit); _container addWeaponCargoGlobal [_tube, 1]; diff --git a/addons/disposable/functions/fnc_takeLoadedATWeapon.sqf b/addons/disposable/functions/fnc_takeLoadedATWeapon.sqf index c371c8d5a5..bd6dec057c 100644 --- a/addons/disposable/functions/fnc_takeLoadedATWeapon.sqf +++ b/addons/disposable/functions/fnc_takeLoadedATWeapon.sqf @@ -20,17 +20,12 @@ TRACE_1("params",_unit); if (!local _unit) exitWith {}; -private ["_launcher", "_config"]; - -_launcher = secondaryWeapon _unit; -_config = configFile >> "CfgWeapons" >> _launcher; +private _launcher = secondaryWeapon _unit; +private _config = configFile >> "CfgWeapons" >> _launcher; if (isClass _config && {getText (_config >> "ACE_UsedTube") != ""} && {getNumber (_config >> "ACE_isUsedLauncher") != 1} && {count secondaryWeaponMagazine _unit == 0}) then { - private ["_magazine", "_isLauncherSelected", "_didAdd"]; - - _magazine = getArray (_config >> "magazines") select 0; - - _isLauncherSelected = currentWeapon _unit == _launcher; + private _magazine = getArray (_config >> "magazines") select 0; + private _isLauncherSelected = currentWeapon _unit == _launcher; _unit removeMagazines _magazine; @@ -38,8 +33,9 @@ if (isClass _config && {getText (_config >> "ACE_UsedTube") != ""} && {getNumber _unit addBackpack "ACE_FakeBackpack"; _unit removeWeapon _launcher; _unit addMagazine _magazine; - _didAdd = _magazine in (magazines _unit); + private _didAdd = _magazine in magazines _unit; _unit addWeapon _launcher; + if (!_didAdd) then { TRACE_1("Failed To Add Disposable Magazine Normally, doing backup method (no backpack)",_unit); _unit addSecondaryWeaponItem _magazine; @@ -48,8 +44,9 @@ if (isClass _config && {getText (_config >> "ACE_UsedTube") != ""} && {getNumber } else { _unit removeWeapon _launcher; _unit addMagazine _magazine; - _didAdd = _magazine in (magazines _unit); + private _didAdd = _magazine in magazines _unit; _unit addWeapon _launcher; + if (!_didAdd) then { TRACE_2("Failed To Add Disposable Magazine Normally, doing backup method",_unit,(backpack _unit)); _unit addSecondaryWeaponItem _magazine; diff --git a/addons/disposable/functions/fnc_updateInventoryDisplay.sqf b/addons/disposable/functions/fnc_updateInventoryDisplay.sqf index 7f50e45089..9908c86186 100644 --- a/addons/disposable/functions/fnc_updateInventoryDisplay.sqf +++ b/addons/disposable/functions/fnc_updateInventoryDisplay.sqf @@ -24,13 +24,11 @@ _player removeMagazines "ACE_FiredMissileDummy"; if (isNull _display) exitWith {}; -private ["_launcher", "_control", "_config"]; - -_launcher = secondaryWeapon _player; +private _launcher = secondaryWeapon _player; if (_launcher == "" || {getText (configFile >> "CfgWeapons" >> _launcher >> "ACE_UsedTube") == ""}) then { - _control = _display displayCtrl 627; - _config = configFile >> "RscDisplayInventory" >> "controls" >> "SlotSecondaryMagazine"; + private _control = _display displayCtrl 627; + private _config = configFile >> "RscDisplayInventory" >> "controls" >> "SlotSecondaryMagazine"; _control ctrlSetPosition [getNumber (_config >> "x"), getNumber (_config >> "y"), getNumber (_config >> "w"), getNumber (_config >> "h")]; _control ctrlCommit 0; @@ -39,7 +37,7 @@ if (_launcher == "" || {getText (configFile >> "CfgWeapons" >> _launcher >> "ACE _control ctrlSetPosition [getNumber (_config >> "x"), getNumber (_config >> "y"), getNumber (_config >> "w"), getNumber (_config >> "h")]; _control ctrlCommit 0; } else { - _control = _display displayCtrl 627; + private _control = _display displayCtrl 627; _control ctrlSetPosition [0, 0, 0, 0]; _control ctrlCommit 0; diff --git a/addons/dragging/CfgVehicles.hpp b/addons/dragging/CfgVehicles.hpp index b7128341bb..bbd362f758 100644 --- a/addons/dragging/CfgVehicles.hpp +++ b/addons/dragging/CfgVehicles.hpp @@ -85,7 +85,7 @@ class CfgVehicles { }; // Barrier - class RoadCone_F: thingX { + class RoadCone_F: ThingX { XEH_ENABLED; GVAR(canCarry) = 1; GVAR(carryPosition[]) = {0,1,1}; diff --git a/addons/explosives/CfgAmmo.hpp b/addons/explosives/CfgAmmo.hpp index 8299a979b3..843ecdb8e3 100644 --- a/addons/explosives/CfgAmmo.hpp +++ b/addons/explosives/CfgAmmo.hpp @@ -21,7 +21,6 @@ class CfgAmmo { class DirectionalBombCore: TimeBombCore; class DirectionalBombBase: DirectionalBombCore; - class APERSTripMine_Wire_Ammo: DirectionalBombBase; class SLAMDirectionalMine_Wire_Ammo: DirectionalBombBase; @@ -31,11 +30,16 @@ class CfgAmmo { class DirectionalBombBase; class ClaymoreDirectionalMine_Remote_Ammo: DirectionalBombBase { ACE_Explosive = "ClaymoreDirectionalMine_Remote_Ammo_Scripted"; + GVAR(defuseObjectPosition[]) = {0, 0, 0.038}; soundActivation[] = {"", 0, 0, 0}; soundDeactivation[] = {"", 0, 0, 0}; }; //class ClaymoreDirectionalMine_Remote_Ammo_Scripted: ClaymoreDirectionalMine_Remote_Ammo; + class APERSTripMine_Wire_Ammo: DirectionalBombBase { + GVAR(defuseObjectPosition[]) = {-1.415, 0, 0.12}; + }; + class SLAMDirectionalMine_Wire_Ammo: DirectionalBombBase { indirectHitRange = 20; ACE_explodeOnDefuse = 1; @@ -55,6 +59,7 @@ class CfgAmmo { class PipeBombBase; class DemoCharge_Remote_Ammo: PipeBombBase { ACE_Explosive = "DemoCharge_Remote_Ammo_Scripted"; + GVAR(defuseObjectPosition[]) = {0.07, 0, 0.055}; soundActivation[] = {"", 0, 0, 0}; soundDeactivation[] = {"", 0, 0, 0}; hit = 500; @@ -63,17 +68,18 @@ class CfgAmmo { }; class SatchelCharge_Remote_Ammo: PipeBombBase { ACE_Explosive = "SatchelCharge_Remote_Ammo_Scripted"; + GVAR(defuseObjectPosition[]) = {0.1, 0.1, 0.05}; soundActivation[] = {"", 0, 0, 0}; soundDeactivation[] = {"", 0, 0, 0}; }; - + /*class DemoCharge_Remote_Ammo_Scripted: DemoCharge_Remote_Ammo; class SatchelCharge_Remote_Ammo_Scripted: SatchelCharge_Remote_Ammo;*/ - + class IEDUrbanBig_Remote_Ammo: PipeBombBase { triggerWhenDestroyed = 1; ACE_explodeOnDefuse = 0.02; - soundTrigger[] = {"A3\Sounds_F\weapons\mines\mech_trigger_1", 0.8, 1, 40}; + soundTrigger[] = {"A3\Sounds_F\weapons\mines\mech_trigger_1", 0.8, 1, 40}; }; class IEDUrbanBig_Command_Ammo: IEDUrbanBig_Remote_Ammo { mineTrigger = "RemoteTrigger"; @@ -81,19 +87,19 @@ class CfgAmmo { class IEDUrbanBig_Range_Ammo: IEDUrbanBig_Remote_Ammo { mineTrigger = "RangeTrigger"; }; - + class IEDUrbanSmall_Remote_Ammo: PipeBombBase { triggerWhenDestroyed = 1; ACE_explodeOnDefuse = 0.02; soundTrigger[] = {"A3\Sounds_F\weapons\mines\mech_trigger_1", 0.8, 1, 40}; - }; - class IEDUrbanSmall_Command_Ammo: IEDUrbanSmall_Remote_Ammo { + }; + class IEDUrbanSmall_Command_Ammo: IEDUrbanSmall_Remote_Ammo { mineTrigger = "RemoteTrigger"; }; class IEDUrbanSmall_Range_Ammo: IEDUrbanSmall_Remote_Ammo { mineTrigger = "RangeTrigger"; }; - + class IEDLandBig_Remote_Ammo: PipeBombBase { triggerWhenDestroyed = 1; ACE_explodeOnDefuse = 0.02; @@ -105,7 +111,7 @@ class CfgAmmo { class IEDLandBig_Range_Ammo: IEDLandBig_Remote_Ammo { mineTrigger = "RangeTrigger"; }; - + class IEDLandSmall_Remote_Ammo: PipeBombBase { triggerWhenDestroyed = 1; ACE_explodeOnDefuse = 0.02; diff --git a/addons/explosives/CfgVehicles.hpp b/addons/explosives/CfgVehicles.hpp index 7a51a7d765..24de2f5a44 100644 --- a/addons/explosives/CfgVehicles.hpp +++ b/addons/explosives/CfgVehicles.hpp @@ -10,7 +10,6 @@ class CfgVehicles { showDisabled = 1; priority = 4; icon = PATHTOF(UI\Explosives_Menu_ca.paa); - hotkey = "X"; //Sub-menu items class ACE_Detonate { displayName = CSTRING(Detonate); @@ -21,7 +20,6 @@ class CfgVehicles { showDisabled = 1; icon = PATHTOF(UI\Explosives_Menu_ca.paa); priority = 2; - hotkey = "T"; }; class ACE_Place { displayName = CSTRING(Place); @@ -32,7 +30,6 @@ class CfgVehicles { showDisabled = 1; icon = PATHTOF(UI\Place_Explosive_ca.paa); priority = 1; - hotkey = "P"; }; class ACE_Cellphone { displayName = CSTRING(cellphone_displayName); @@ -62,7 +59,7 @@ class CfgVehicles { class ACE_Actions { class ACE_MainActions { selection = ""; - distance = 5; + distance = 1; condition = "true"; class ACE_Defuse { displayName = CSTRING(Defuse); @@ -72,8 +69,7 @@ class CfgVehicles { showDisabled = 0; icon = PATHTOF(UI\Defuse_ca.paa); priority = 0.8; - hotkey = "F"; - distance = 5; + distance = 1; }; }; }; @@ -89,16 +85,15 @@ class CfgVehicles { scope = 2; scopeCurator = 1; vehicleClass = "Cargo"; - ACE_offset[] = {0,0,0}; class ACE_Actions { class ACE_MainActions { selection = ""; - distance = 5; + distance = 1; condition = "true"; class ACE_SetTrigger { selection = ""; displayName = CSTRING(TriggerMenu); - distance = 4; + distance = 1; condition = "true"; statement = ""; insertChildren = QUOTE([ARR_3(_target getVariable QUOTE(QGVAR(class)),_target,_player)] call FUNC(addTriggerActions);); @@ -110,7 +105,7 @@ class CfgVehicles { class ACE_PickUp { selection = ""; displayName = CSTRING(Pickup); - distance = 4; + distance = 1; condition = "true"; statement = QUOTE([ARR_2(_player,_target getVariable QUOTE(QGVAR(class)))] call EFUNC(common,addToInventory);deleteVehicle _target;); showDisabled = 0; @@ -125,6 +120,11 @@ class CfgVehicles { class ACE_Explosives_Place_DemoCharge:ACE_Explosives_Place { displayName = "Demo Charge"; model = "\A3\Weapons_F\explosives\c4_charge_small_d"; + class ACE_Actions: ACE_Actions { + class ACE_MainActions: ACE_MainActions { + position = "[-0.07,0,0.055]"; + }; + }; }; class ACE_Explosives_Place_APERSBoundingMine:ACE_Explosives_Place { displayName = "APERS Bounding Mine"; @@ -137,7 +137,11 @@ class CfgVehicles { class ACE_Explosives_Place_APERSTripwireMine:ACE_Explosives_Place { displayName = "APERS Tripwire Mine"; model = "\A3\Weapons_F\explosives\mine_AP_tripwire"; - ACE_offset[] = {1,0,0}; + class ACE_Actions: ACE_Actions { + class ACE_MainActions: ACE_MainActions { + position = "[1.415,0,0.12]"; + }; + }; }; class ACE_Explosives_Place_ATMine:ACE_Explosives_Place { @@ -148,11 +152,21 @@ class CfgVehicles { class ACE_Explosives_Place_Claymore:ACE_Explosives_Place { displayName = "Claymore"; model = "\A3\Weapons_F\explosives\mine_AP_miniclaymore"; + class ACE_Actions: ACE_Actions { + class ACE_MainActions: ACE_MainActions { + position = "[0,0,0.038]"; + }; + }; }; class ACE_Explosives_Place_SatchelCharge:ACE_Explosives_Place { displayName = "Satchel Charge"; model = "\A3\Weapons_F\Explosives\satchel"; + class ACE_Actions: ACE_Actions { + class ACE_MainActions: ACE_MainActions { + position = "[-0.1,-0.1,0.05]"; + }; + }; }; class ACE_Explosives_Place_SLAM:ACE_Explosives_Place { diff --git a/addons/explosives/functions/fnc_interactEH.sqf b/addons/explosives/functions/fnc_interactEH.sqf index 9be7568530..da5e5ec149 100644 --- a/addons/explosives/functions/fnc_interactEH.sqf +++ b/addons/explosives/functions/fnc_interactEH.sqf @@ -45,7 +45,17 @@ if (!("ACE_DefusalKit" in (items ACE_player))) exitWith {}; if (((_x distance ACE_player) < 15) && {!(_x in _minesHelped)}) then { TRACE_2("Making Defuse Helper",(_x),(typeOf _x)); _defuseHelper = "ACE_DefuseObject" createVehicleLocal (getPos _x); - _defuseHelper attachTo [_x, [0,0,0]]; + + private _config = configFile >> "CfgAmmo" >> typeOf _x; + + private _defuseObjectPosition = getArray (_config >> QGVAR(defuseObjectPosition)); + if (_defuseObjectPosition isEqualTo []) then { + _defuseObjectPosition = [0,0,0]; + }; + + TRACE_1("DefuseObjectPosition",(_defuseObjectPosition)); + + _defuseHelper attachTo [_x, _defuseObjectPosition]; _defuseHelper setVariable [QGVAR(Explosive),_x]; _addedDefuseHelpers pushBack _defuseHelper; _minesHelped pushBack _x; diff --git a/addons/explosives/stringtable.xml b/addons/explosives/stringtable.xml index f23cb2fc00..6cf03d7be2 100644 --- a/addons/explosives/stringtable.xml +++ b/addons/explosives/stringtable.xml @@ -582,6 +582,7 @@ Explode on defusal? + Explodieren beim Entschärfen? Explosão no desarmamento? Eksplozja przy rozbrajaniu? Explodovat při zneškodňování? @@ -592,6 +593,7 @@ Enable certain explosives to explode on defusal? Default: Yes + Sollen bestimmte Sprengladungen beim Entschärfen explodieren? Standard: Ja Ativa certos explosivos para detonar no desarmamento? Padrão: Sim Spraw, aby niektóre ładunki wybuchowe eksplodowały przy próbie ich rozbrojenia? Domyślnie:Tak Umožnit u některých výbušnin explozi při pokusu je zneškodnit? Výchozí: Ano diff --git a/addons/fcs/CfgEventHandlers.hpp b/addons/fcs/CfgEventHandlers.hpp index a03ca847ea..ab41fa904b 100644 --- a/addons/fcs/CfgEventHandlers.hpp +++ b/addons/fcs/CfgEventHandlers.hpp @@ -1,3 +1,4 @@ + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); @@ -6,7 +7,7 @@ class Extended_PreInit_EventHandlers { class Extended_PostInit_EventHandlers { class ADDON { - clientInit = QUOTE(call COMPILE_FILE(XEH_clientInit)); + init = QUOTE(call COMPILE_FILE(XEH_postInit)); }; }; diff --git a/addons/fcs/CfgVehicles.hpp b/addons/fcs/CfgVehicles.hpp index 53b279ef88..f1b896c612 100644 --- a/addons/fcs/CfgVehicles.hpp +++ b/addons/fcs/CfgVehicles.hpp @@ -26,7 +26,7 @@ class CfgVehicles { class ACE_SelfActions { class ResetFCS { displayName = CSTRING(ResetFCS); - condition = QUOTE(call FUNC(canResetFCS)); + condition = QUOTE(_player call FUNC(canResetFCS)); statement = QUOTE([ARR_2(vehicle _player,[_player] call DEFUNC(common,getTurretIndex))] call DFUNC(reset);); showDisabled = 0; priority = 1; @@ -39,7 +39,7 @@ class CfgVehicles { class ACE_SelfActions { class ResetFCS { displayName = CSTRING(ResetFCS); - condition = QUOTE(call FUNC(canResetFCS)); + condition = QUOTE(_player call FUNC(canResetFCS)); statement = QUOTE([ARR_2(vehicle _player,[_player] call DEFUNC(common,getTurretIndex))] call DFUNC(reset);); showDisabled = 0; priority = 1; @@ -321,9 +321,13 @@ class CfgVehicles { discreteDistance[] = {}; discreteDistanceInitIndex = 0; - /*class Turrets: Turrets { - class CommanderOptics: CommanderOptics {}; - };*/ + class Turrets: Turrets { + class CommanderOptics: CommanderOptics { + GVAR(Enabled) = 1; + discreteDistance[] = {}; + discreteDistanceInitIndex = 0; + }; + }; }; }; }; @@ -346,9 +350,13 @@ class CfgVehicles { discreteDistance[] = {}; discreteDistanceInitIndex = 0; - /*class Turrets: Turrets { - class CommanderOptics: CommanderOptics {}; - };*/ + class Turrets: Turrets { + class CommanderOptics: CommanderOptics { + GVAR(Enabled) = 1; + discreteDistance[] = {}; + discreteDistanceInitIndex = 0; + }; + }; }; }; }; @@ -362,6 +370,8 @@ class CfgVehicles { class Turrets: Turrets { class CommanderOptics: CommanderOptics { GVAR(Enabled) = 1; + discreteDistance[] = {}; + discreteDistanceInitIndex = 0; }; }; }; diff --git a/addons/fcs/XEH_clientInit.sqf b/addons/fcs/XEH_postInit.sqf similarity index 83% rename from addons/fcs/XEH_clientInit.sqf rename to addons/fcs/XEH_postInit.sqf index 3338e739e1..8a8b379318 100644 --- a/addons/fcs/XEH_clientInit.sqf +++ b/addons/fcs/XEH_postInit.sqf @@ -16,4 +16,4 @@ if (!hasInterface) exitWith {}; }] call EFUNC(common,addEventHandler); // Register event for global updates -[QGVAR(forceUpdate), FUNC(onForceUpdate)] call EFUNC(common,addEventHandler); +[QGVAR(forceUpdate), {ACE_player call FUNC(onForceUpdate)}] call EFUNC(common,addEventHandler); diff --git a/addons/fcs/XEH_preInit.sqf b/addons/fcs/XEH_preInit.sqf index 8fdc43df11..2bcda4f464 100644 --- a/addons/fcs/XEH_preInit.sqf +++ b/addons/fcs/XEH_preInit.sqf @@ -14,6 +14,7 @@ PREP(onForceUpdate); PREP(keyDown); PREP(keyUp); PREP(reset); +PREP(updateRangeHUD); PREP(vehicleInit); ADDON = true; diff --git a/addons/fcs/functions/fnc_adjustRange.sqf b/addons/fcs/functions/fnc_adjustRange.sqf index 4b7f4b6b88..f6f543d35a 100644 --- a/addons/fcs/functions/fnc_adjustRange.sqf +++ b/addons/fcs/functions/fnc_adjustRange.sqf @@ -1,29 +1,27 @@ /* * Author: KoffeinFlummi - * * Adjusts the currently zeroed distance. * * Arguments: - * 0: The vehicle in question - * 1: The amount to add to the distance (can be negative) + * 0: The vehicle in question + * 1: The Turrets that the Vehicle has + * 2: The amount to add to the distance (can be negative) * * Return Value: * None + * + * Public: No */ - #include "script_component.hpp" -private ["_vehicle", "_turret", "_delta", "_turretConfig", "_min", "_max", "_distance"]; +params ["_vehicle", "_turret", "_delta"]; -_vehicle = _this select 0; -_turret = _this select 1; -_delta = _this select 2; +private _turretConfig = [configFile >> "CfgVehicles" >> typeOf _vehicle, _turret] call EFUNC(common,getTurretConfigPath); -_turretConfig = [configFile >> "CfgVehicles" >> typeOf _vehicle, _turret] call EFUNC(common,getTurretConfigPath); +private _min = getNumber (_turretConfig >> QGVAR(MinDistance)); +private _max = getNumber (_turretConfig >> QGVAR(MaxDistance)); -_min = getNumber (_turretConfig >> QGVAR(MinDistance)); -_max = getNumber (_turretConfig >> QGVAR(MaxDistance)); -_distance = _vehicle getVariable [format ["%1_%2", QGVAR(Distance), _turret], _min]; +private _distance = _vehicle getVariable [format ["%1_%2", QGVAR(Distance), _turret], _min]; _distance = _distance + _delta; _distance = _distance min _max; diff --git a/addons/fcs/functions/fnc_canResetFCS.sqf b/addons/fcs/functions/fnc_canResetFCS.sqf index 488f1eebf4..b57435f388 100644 --- a/addons/fcs/functions/fnc_canResetFCS.sqf +++ b/addons/fcs/functions/fnc_canResetFCS.sqf @@ -1,15 +1,17 @@ /* * Author: KoffeinFlummi - * * Called from config. Can player reset FCS? * * Argument: * Nothing * - * Return value: - * Boolean (Bool) + * Return Value: + * Boolean + * + * Public: No */ - #include "script_component.hpp" -count ((vehicle ACE_player) getVariable [format ["%1_%2", QGVAR(Magazines), [ACE_player] call EFUNC(common,getTurretIndex)], []]) > 1 +params ["_unit"]; + +count ((vehicle _unit) getVariable [format ["%1_%2", QGVAR(Magazines), [_unit] call EFUNC(common,getTurretIndex)], []]) > 1 // return diff --git a/addons/fcs/functions/fnc_canUseFCS.sqf b/addons/fcs/functions/fnc_canUseFCS.sqf index cb4a1b608d..91b49554c2 100644 --- a/addons/fcs/functions/fnc_canUseFCS.sqf +++ b/addons/fcs/functions/fnc_canUseFCS.sqf @@ -1,16 +1,16 @@ /* * Author: commy2 - * * Called from config. Returns true if the player is a gunner and the players current vehicle has a FCS. * - * Argument: - * Nothing + * Arguments: + * None * - * Return value: - * Boolean (Bool) + * Return Value: + * Boolean + * + * Public: No */ - #include "script_component.hpp" getNumber ([configFile >> "CfgVehicles" >> typeOf vehicle ACE_player, [ACE_player] call EFUNC(common,getTurretIndex)] call EFUNC(common,getTurretConfigPath) >> QGVAR(Enabled)) == 1 -&& {cameraView == "GUNNER"} +&& {cameraView == "GUNNER"} // return diff --git a/addons/fcs/functions/fnc_canUseRangefinder.sqf b/addons/fcs/functions/fnc_canUseRangefinder.sqf index f6bb3b2e52..7403c74ac1 100644 --- a/addons/fcs/functions/fnc_canUseRangefinder.sqf +++ b/addons/fcs/functions/fnc_canUseRangefinder.sqf @@ -1,16 +1,16 @@ /* * Author: commy2 - * * Returns true if the laser distance measurement can be read from the engine. * - * Argument: - * Nothing + * Arguments: + * None * - * Return value: - * Boolean (Bool) + * Return Value: + * Boolean + * + * Public: No */ - #include "script_component.hpp" !isNull ((uiNamespace getVariable ["ACE_dlgRangefinder", displayNull]) displayCtrl 1713151) -&& {cameraView == "GUNNER"} +&& {cameraView == "GUNNER"} // return diff --git a/addons/fcs/functions/fnc_firedEH.sqf b/addons/fcs/functions/fnc_firedEH.sqf index 31fe38335d..237aed8ac1 100644 --- a/addons/fcs/functions/fnc_firedEH.sqf +++ b/addons/fcs/functions/fnc_firedEH.sqf @@ -1,6 +1,5 @@ /* * Author: KoffeinFlummi - * * Adjusts the direction of a shell. * * Arguments: @@ -8,58 +7,48 @@ * * Return Value: * None + * + * Public: No */ - #include "script_component.hpp" -private ["_vehicle", "_weapon", "_ammo", "_magazine", "_projectile", "_sumVelocity"]; +params ["_vehicle", "_weapon", "", "", "_ammo", "_magazine", "_projectile"]; -_vehicle = _this select 0; -_weapon = _this select 1; -_ammo = _this select 4; -_magazine = _this select 5; -_projectile = _this select 6; - -private ["_gunner", "_turret"]; - -_gunner = [_vehicle, _weapon] call EFUNC(common,getGunner); -_turret = [_gunner] call EFUNC(common,getTurretIndex); +private _gunner = [_vehicle, _weapon] call EFUNC(common,getGunner); +private _turret = _gunner call EFUNC(common,getTurretIndex); // Exit if the unit isn't a player if !([_gunner] call EFUNC(common,isPlayer)) exitWith {}; -private ["_FCSMagazines", "_FCSElevation", "_offset"]; - -_FCSMagazines = _vehicle getVariable [(format ["%1_%2", QGVAR(Magazines), _turret]), []]; -_FCSElevation = _vehicle getVariable format ["%1_%2", QGVAR(Elevation), _turret]; +private _FCSMagazines = _vehicle getVariable [format ["%1_%2", QGVAR(Magazines), _turret], []]; +private _FCSElevation = _vehicle getVariable format ["%1_%2", QGVAR(Elevation), _turret]; if !(_magazine in _FCSMagazines) exitWith {}; // GET ELEVATION OFFSET OF CURRENT MAGAZINE -_offset = 0; +private _offset = 0; + { if (_x == _magazine) exitWith { _offset = _FCSElevation select _forEachIndex; }; } forEach _FCSMagazines; - [_projectile, (_vehicle getVariable format ["%1_%2", QGVAR(Azimuth), _turret]), _offset, 0] call EFUNC(common,changeProjectileDirection); // Remove the platform velocity -if( (vectorMagnitude velocity _vehicle) > 2) then { - _sumVelocity = (velocity _projectile) vectorDiff (velocity _vehicle); +if (vectorMagnitude velocity _vehicle > 2) then { + private _sumVelocity = (velocity _projectile) vectorDiff (velocity _vehicle); + _projectile setVelocity _sumVelocity; }; // Air burst missile - // handle locally only if (!local _gunner) exitWith {}; if (getNumber (configFile >> "CfgAmmo" >> _ammo >> QGVAR(Airburst)) == 1) then { - private "_zeroing"; - _zeroing = _vehicle getVariable [format ["%1_%2", QGVAR(Distance), _turret], currentZeroing _vehicle]; + private _zeroing = _vehicle getVariable [format ["%1_%2", QGVAR(Distance), _turret], currentZeroing _vehicle]; if (_zeroing < 50) exitWith {}; if (_zeroing > 1500) exitWith {}; diff --git a/addons/fcs/functions/fnc_getAngle.sqf b/addons/fcs/functions/fnc_getAngle.sqf index 91150c110d..d2c51a9542 100644 --- a/addons/fcs/functions/fnc_getAngle.sqf +++ b/addons/fcs/functions/fnc_getAngle.sqf @@ -1,91 +1,82 @@ /* * Author: KoffeinFlummi - * * Calculates the angle offset necessary to hit the current target. * * Arguments: - * 0: distance to target in meters - * 1: current angle of the turret - * 2: maximum elevation of the turret - * 3: initSpeed of the projectile - * 4: airFriction of the projectile - * 5: maximum timeToLive of the projectile - * 6: simulationStep of the projectile + * 0: distance to target in meters + * 1: current angle of the turret + * 2: maximum elevation of the turret + * 3: initSpeed of the projectile + * 4: airFriction of the projectile + * 5: maximum timeToLive of the projectile + * 6: simulationStep of the projectile * * Return Value: - * offset from the current angle necessary to hit the target + * offset from the current angle necessary to hit the target + * + * Public: No */ - #include "script_component.hpp" + #define PRECISION 0.1 -private ["_distance", "_angleTarget", "_maxElev", "_initSpeed", "_airFriction", "_timeToLive", "_simulationStep", "_angle1", "_angle2", "_it2", "_f1", "_f2", "_temp", "_it1", "_angle"]; - -_distance = _this select 0; -_angleTarget = _this select 1; -_maxElev = _this select 2; -_initSpeed = _this select 3; -_airFriction = _this select 4; -_timeToLive = _this select 5; -_simulationStep = _this select 6; +params ["_distance", "_angleTarget", "_maxElev", "_initSpeed", "_airFriction", "_timeToLive", "_simulationStep"]; if (_simulationStep == 0) exitWith {_angleTarget}; -FUNC(traceBullet) = { - private ["_distance", "_angleTarget", "_maxElev", "_initSpeed", "_airFriction", "_timeToLive", "_simulationStep", "_angle", "_posTargetX", "_posTargetY", "_posX", "_posY", "_velocityX", "_velocityY", "_velocityMagnitude", "_i"]; - - _distance = _this select 0; - _angleTarget = _this select 1; - _maxElev = _this select 2; - _initSpeed = _this select 3; - _airFriction = _this select 4; - _timeToLive = _this select 5; - _simulationStep = _this select 6; - _angle = _this select 7; +private _fnc_traceBullet = { + params ["_distance", "_angleTarget", "_maxElev", "_initSpeed", "_airFriction", "_timeToLive", "_simulationStep", "_angle"]; _angle = _angle - _angleTarget; _angleTarget = 0; - _posTargetX = (cos _angleTarget) * _distance; - _posTargetY = (sin _angleTarget) * _distance; + private _posTargetX = (cos _angleTarget) * _distance; + private _posTargetY = (sin _angleTarget) * _distance; - _posX = 0; - _posY = 0; + private _posX = 0; + private _posY = 0; - _velocityX = (cos _angle) * _initSpeed; - _velocityY = (sin _angle) * _initSpeed; + private _velocityX = (cos _angle) * _initSpeed; + private _velocityY = (sin _angle) * _initSpeed; // trace the path of the bullet for "_i" from 1 to ((floor (_timeToLive / _simulationStep)) + 1) do { - _velocityMagnitude = sqrt (_velocityX^2 + _velocityY^2); + private _velocityMagnitude = sqrt (_velocityX^2 + _velocityY^2); + _velocityX = _velocityX + _simulationStep * (_velocityX * _velocityMagnitude * _airFriction); _velocityY = _velocityY + _simulationStep * (_velocityY * _velocityMagnitude * _airFriction - 9.81); + _posX = _posX + _velocityX * _simulationStep; _posY = _posY + _velocityY * _simulationStep; + if (_posX >= _posTargetX) exitWith {}; // bullet passed the target }; - _posY - _posTargetY }; -if ((_this + [_maxElev]) call FUNC(traceBullet) < 0) exitWith {_maxElev - _angleTarget}; +private _data = [_distance, _angleTarget, _maxElev, _initSpeed, _airFriction, _timeToLive, _simulationStep, _maxElev]; + +if (_data call _fnc_traceBullet < 0) exitWith {_maxElev - _angleTarget}; // Newton Method / Secand Method -_angle1 = _angleTarget; -_angle2 = _maxElev; -_it2 = 0; -_f1 = (_this + [_angle1]) call FUNC(traceBullet); +private _angle1 = _angleTarget; +private _angle2 = _maxElev; +private _it2 = 0; + +_data set [7, _maxElev]; +private _f1 = _data call _fnc_traceBullet; + +if (abs _f1 <= PRECISION) exitWith {0}; + +while {abs _f1 > PRECISION} do { + _data set [7, _angle2]; + private _f2 = _data call _fnc_traceBullet; -if ((abs _f1) <= PRECISION) exitWith {0}; -while {(abs _f1) > PRECISION} do { - _f2 = (_this + [_angle2]) call FUNC(traceBullet); - _temp = _angle2-_f2*(_angle2-_angle1)/(_f2-_f1); _angle1 = _angle2; - _angle2 = _temp; - _f1 = _f2; - _it2 = _it2+1; -}; -//player globalChat format ["it1: %1 | _angle1: %2 | it2: %3 | _angle2: %4",_it1, _angle-_angleTarget, _it2, _angle2-_angleTarget]; + _angle2 = _angle2 - _f2 * (_angle2 - _angle1) / (_f2 - _f1); -_angle=_angle2; -_angle - _angleTarget + _f1 = _f2; + _it2 = _it2 + 1; +}; + +_angle2 - _angleTarget diff --git a/addons/fcs/functions/fnc_getRange.sqf b/addons/fcs/functions/fnc_getRange.sqf index 3618fa446e..51cdf564df 100644 --- a/addons/fcs/functions/fnc_getRange.sqf +++ b/addons/fcs/functions/fnc_getRange.sqf @@ -1,23 +1,18 @@ /* * Author: commy2 - * - * Read laser distance measurement from engine and update compatible info elements. + * Read laser distance measurement from engine. * * Argument: - * Nothing + * None * * Return value: - * Measured distance (Number) + * Measured distance + * + * Public: No */ - #include "script_component.hpp" -private ["_dlgRangefinder", "_range"]; - disableSerialization; -_dlgRangefinder = uiNamespace getVariable ["ACE_dlgRangefinder", displayNull]; +private _dlgRangefinder = uiNamespace getVariable ["ACE_dlgRangefinder", displayNull]; -_range = ctrlText (_dlgRangefinder displayCtrl 151); -(_dlgRangefinder displayCtrl 1713151) ctrlSetText _range; - -parseNumber _range +parseNumber ctrlText (_dlgRangefinder displayCtrl 151); diff --git a/addons/fcs/functions/fnc_handleAirBurstAmmunitionPFH.sqf b/addons/fcs/functions/fnc_handleAirBurstAmmunitionPFH.sqf index 899cf0da76..aa166ece12 100644 --- a/addons/fcs/functions/fnc_handleAirBurstAmmunitionPFH.sqf +++ b/addons/fcs/functions/fnc_handleAirBurstAmmunitionPFH.sqf @@ -1,21 +1,32 @@ -// by commy2 +/* + * Author: commy2 + * Handle Air burst ammunition. Called from per frame handler. + * + * Arguments: + * - + * + * Return Value: + * None + * + * Public: No + */ #include "script_component.hpp" -private ["_vehicle", "_projectile", "_zeroing", "_position", "_subMunition"]; - -_vehicle = _this select 0 select 0; -_projectile = _this select 0 select 1; -_zeroing = _this select 0 select 2; +(_this select 0) params ["_vehicle", "_projectile", "_zeroing"]; +// remove pfh if the projectile died before arriving if (isNull _projectile || {!alive _projectile}) exitWith { [_this select 1] call CBA_fnc_removePerFrameHandler; }; +// wait if not there if (_projectile distance _vehicle < _zeroing) exitWith {}; -_position = getPosATL _projectile; +// explode +private _position = getPosATL _projectile; + +private _subMunition = createVehicle ["ACE_B_35mm_ABM_Helper", _position, [], 0, "FLY"]; -_subMunition = createVehicle ["ACE_B_35mm_ABM_Helper", _position, [], 0, "FLY"]; _subMunition setPosATL _position; _subMunition setVelocity [0, 0, -10]; diff --git a/addons/fcs/functions/fnc_keyDown.sqf b/addons/fcs/functions/fnc_keyDown.sqf index cea7196570..a34233bc91 100644 --- a/addons/fcs/functions/fnc_keyDown.sqf +++ b/addons/fcs/functions/fnc_keyDown.sqf @@ -1,23 +1,22 @@ /* * Author: KoffeinFlummi - * * Starts watching the target for sideways correction. * * Arguments: - * 0: Vehicle + * 0: Vehicle + * 1: Turret * * Return Value: - * none + * None + * + * Public: No */ - #include "script_component.hpp" -private ["_vehicle", "_turret", "_distance", "_weaponDirection"]; +params ["_vehicle", "_turret"]; -_vehicle = _this select 0; -_turret = _this select 1; - -_distance = call FUNC(getRange); +private _distance = call FUNC(getRange); +call (updateRangeHUD); if !(!GVAR(enabled) && FUNC(canUseFCS)) exitWith {}; @@ -28,7 +27,7 @@ if (_distance == 0) then { _distance = [5, 5000, 0] call EFUNC(common,getTargetDistance); // maximum distance: 5000m, 5m precision }; -_weaponDirection = _vehicle weaponDirection (_vehicle currentWeaponTurret _turret); // @todo doesn't work for sub turrets +private _weaponDirection = _vehicle weaponDirection (_vehicle currentWeaponTurret _turret); // @todo doesn't work for sub turrets if (_turret isEqualTo ([_vehicle] call EFUNC(common,getTurretCommander))) then { _weaponDirection = eyeDirection _vehicle; @@ -38,8 +37,4 @@ if (_weaponDirection isEqualTo [0,0,0]) then { // dummy value for non main turr _weaponDirection = [1,0,0]; }; -GVAR(Position) = [ - (getPos _vehicle select 0) + _distance * (_weaponDirection select 0), - (getPos _vehicle select 1) + _distance * (_weaponDirection select 1), - (getPos _vehicle select 2) + _distance * (_weaponDirection select 2) -]; +GVAR(Position) = (getPosASL _vehicle) vectorAdd (_weaponDirection vectorMultiply _distance); diff --git a/addons/fcs/functions/fnc_keyUp.sqf b/addons/fcs/functions/fnc_keyUp.sqf index 37390c0b47..ebbd6e3a06 100644 --- a/addons/fcs/functions/fnc_keyUp.sqf +++ b/addons/fcs/functions/fnc_keyUp.sqf @@ -1,40 +1,38 @@ /* * Author: KoffeinFlummi - * * Calculates the offsets for all weapons needed to hit the current target. * * Arguments: - * 0: The vehicle + * 0: Vehicle + * 1: Turret * * Return Value: - * none + * None + * + * Public: No */ - #include "script_component.hpp" -private ["_vehicle", "_turret", "_turretConfig", "_distance", "_weapons", "_magazines", "_showHint", "_playSound", "_i"]; +params ["_vehicle", "_turret", "_distance", ["_showHint", false], ["_playSound", true]]; -_vehicle = _this select 0; -_turret = _this select 1; +private _turretConfig = [configFile >> "CfgVehicles" >> typeOf _vehicle, _turret] call EFUNC(common,getTurretConfigPath); -_turretConfig = [configFile >> "CfgVehicles" >> typeOf _vehicle, _turret] call EFUNC(common,getTurretConfigPath); +call (updateRangeHUD); -_distance = call FUNC(getRange); +if (isNil "_distance") then { + _distance = call FUNC(getRange); -_weapons = _vehicle weaponsTurret _turret; -_magazines = _vehicle magazinesTurret _turret; - -if (_distance == 0) then { - _distance = [ - getNumber (_turretConfig >> QGVAR(DistanceInterval)), - getNumber (_turretConfig >> QGVAR(MaxDistance)), - getNumber (_turretConfig >> QGVAR(MinDistance)) - ] call EFUNC(common,getTargetDistance); // maximum distance: 5000m, 5m precision + if (_distance == 0) then { + _distance = [ + getNumber (_turretConfig >> QGVAR(DistanceInterval)), + getNumber (_turretConfig >> QGVAR(MaxDistance)), + getNumber (_turretConfig >> QGVAR(MinDistance)) + ] call EFUNC(common,getTargetDistance); // maximum distance: 5000m, 5m precision + }; }; -private ["_weapon", "_weaponDirection", "_angleTarget"]; -_weapon = _vehicle currentWeaponTurret _turret; -_weaponDirection = _vehicle weaponDirection _weapon; // @todo doesn't work for sub turrets +private _weapon = _vehicle currentWeaponTurret _turret; +private _weaponDirection = _vehicle weaponDirection _weapon; // @todo doesn't work for sub turrets if (_turret isEqualTo ([_vehicle] call EFUNC(common,getTurretCommander))) then { _weaponDirection = eyeDirection _vehicle; @@ -44,176 +42,139 @@ if (_weaponDirection isEqualTo [0,0,0]) then { // dummy value for non main turr _weaponDirection = [1,0,0]; }; -_angleTarget = asin (_weaponDirection select 2); - -if (count _this > 2) then { - if((_this select 2) > -1) then { - _distance = _this select 2; - }; -}; - -if (!(isNil QGVAR(backgroundCalculation)) and {!(scriptDone GVAR(backgroundCalculation))}) then { - terminate GVAR(backgroundCalculation); -}; - -private ["_movingAzimuth", "_posTarget", "_velocityTarget"]; +private _angleTarget = asin (_weaponDirection select 2); // MOVING TARGETS -_movingAzimuth = 0; -if (ACE_time - GVAR(time) > 1 and GVAR(time) != -1 and count _this < 3) then { - // calculate speed of target - _posTarget = [ - (getPos _vehicle select 0) + _distance * (_weaponDirection select 0), - (getPos _vehicle select 1) + _distance * (_weaponDirection select 1), - (getPos _vehicle select 2) + _distance * (_weaponDirection select 2) - ]; - _velocityTarget = [ - ((_posTarget select 0) - (GVAR(position) select 0)) / (ACE_time - GVAR(time)), - ((_posTarget select 1) - (GVAR(position) select 1)) / (ACE_time - GVAR(time)), - ((_posTarget select 2) - (GVAR(position) select 2)) / (ACE_time - GVAR(time)) - ]; +private _movingAzimuth = 0; - private ["_magazineType", "_ammoType", "_initSpeed", "_airFriction", "_timeToLive", "_simulationStep", "_initSpeedCoef", "_velocityMagnitude"]; +if (ACE_time - GVAR(time) > 1 && GVAR(time) != -1 && isNil {_this select 2}) then { + // calculate speed of target + private _posTarget = (getPosASL _vehicle) vectorAdd (_weaponDirection vectorMultiply _distance); + private _velocityTarget = (_posTarget vectorDiff GVAR(position)) vectorMultiply (1 / (ACE_time - GVAR(time))); // estimate time to target - _magazineType = _vehicle currentMagazineTurret _turret; - _ammoType = getText (configFile >> "CfgMagazines" >> _magazineType >> "ammo"); - _initSpeed = getNumber (configFile >> "CfgMagazines" >> _magazineType >> "initSpeed"); - _airFriction = getNumber (configFile >> "CfgAmmo" >> _ammoType >> "airFriction"); - _timeToLive = getNumber (configFile >> "CfgAmmo" >> _ammoType >> "timeToLive"); - _simulationStep = getNumber (configFile >> "CfgAmmo" >> _ammoType >> "simulationStep"); + private _magazine = _vehicle currentMagazineTurret _turret; + private _ammo = getText (configFile >> "CfgMagazines" >> _magazine >> "ammo"); + private _initSpeed = getNumber (configFile >> "CfgMagazines" >> _magazine >> "initSpeed"); + private _airFriction = getNumber (configFile >> "CfgAmmo" >> _ammo >> "airFriction"); + private _timeToLive = getNumber (configFile >> "CfgAmmo" >> _ammo >> "timeToLive"); + private _simulationStep = getNumber (configFile >> "CfgAmmo" >> _ammo >> "simulationStep"); + private _initSpeedCoef = getNumber (configFile >> "CfgWeapons" >> _weapon >> "initSpeed"); - _initSpeedCoef = getNumber(configFile >> "CfgWeapons" >> _weapon >> "initSpeed"); if (_initSpeedCoef < 0) then { - _initSpeed = _initSpeed * -_initSpeedCoef; + _initSpeed = _initSpeed * - _initSpeedCoef; }; + if (_initSpeedCoef > 0) then { _initSpeed = _initSpeedCoef; }; if (_simulationStep != 0) then { - private ["_posX", "_velocityX", "_velocityY", "_timeToTarget"]; + private _posX = 0; + private _velocityX = _initSpeed; + private _velocityY = 0; + private _timeToTarget = 0; - _posX = 0; - _velocityX = _initSpeed; - _velocityY = 0; - _timeToTarget = 0; - - for "_i" from 1 to ((floor (_timeToLive / _simulationStep)) + 1) do { + for "_i" from 1 to (floor (_timeToLive / _simulationStep) + 1) do { _posX = _posX + _velocityX * _simulationStep; + if (_posX >= _distance) exitWith { // bullet passed the target _timeToTarget = _i * _simulationStep; }; - _velocityMagnitude = sqrt (_velocityX^2 + _velocityY^2); + + private _velocityMagnitude = sqrt (_velocityX ^ 2 + _velocityY ^ 2); + _velocityX = _velocityX + _velocityX * _velocityMagnitude * _airFriction * _simulationStep; _velocityY = _velocityY + _velocityY * _velocityMagnitude * _airFriction * _simulationStep - 9.81 * _simulationStep; }; - private ["_posArrival", "_dirArrival"]; - // calculate offsets - _posArrival = [ - (_posTarget select 0) + (_velocityTarget select 0) * _timeToTarget, - (_posTarget select 1) + (_velocityTarget select 1) * _timeToTarget, - (_posTarget select 2) + (_velocityTarget select 2) * _timeToTarget - ]; - - _dirArrival = [ - ((_posArrival select 0) - (getPos _vehicle select 0)) / (_posArrival distance (getPos _vehicle)), - ((_posArrival select 1) - (getPos _vehicle select 1)) / (_posArrival distance (getPos _vehicle)), - ((_posArrival select 2) - (getPos _vehicle select 2)) / (_posArrival distance (getPos _vehicle)) - ]; + private _posArrival = _posTarget vectorAdd (_velocityTarget vectorMultiply _timeToTarget); + private _dirArrival = (_posArrival vectorDiff getPosASL _vehicle) vectorMultiply (1 / (_posArrival vectorDistance getPosASL _vehicle)); _movingAzimuth = ((_dirArrival select 0) atan2 (_dirArrival select 1)) - ((_weaponDirection select 0) atan2 (_weaponDirection select 1)); _angleTarget = asin (_dirArrival select 2); - _distance = floor (_posArrival distance (getPos _vehicle)); + _distance = floor (_posArrival distance (getPosASL _vehicle)); }; }; + GVAR(enabled) = false; GVAR(time) = -1; -private ["_viewDiff", "_FCSAzimuth", "_FCSMagazines", "_FCSElevation"]; - // CALCULATE AZIMUTH CORRECTION -_viewDiff = _vehicle getVariable format ["%1_%2", QGVAR(ViewDiff), _turret]; -_FCSAzimuth = _movingAzimuth; +private _viewDiff = _vehicle getVariable format ["%1_%2", QGVAR(ViewDiff), _turret]; +private _FCSAzimuth = _movingAzimuth; if (_viewDiff != 0) then { _FCSAzimuth = (atan (_distance / _viewDiff) - (abs _viewDiff / _viewDiff) * 90) + _movingAzimuth; }; // CALCULATE OFFSET -_FCSMagazines = []; -_FCSElevation = []; +private _FCSMagazines = []; +private _FCSElevation = []; { - private ["_magazine", "_ammoType"]; - _magazine = _x; - _ammoType = getText (configFile >> "CfgMagazines" >> _magazine >> "ammo"); + private _magazine = _x; + private _ammo = getText (configFile >> "CfgMagazines" >> _magazine >> "ammo"); - if !(getText (configFile >> "CfgAmmo" >> _ammoType >> "simulation") == "shotMissile") then { - private ["_maxElev", "_initSpeed", "_airFriction", "_offset"]; - - _maxElev = getNumber (_turretConfig >> "maxElev"); - _initSpeed = getNumber (configFile >> "CfgMagazines" >> _magazine >> "initSpeed"); - _airFriction = getNumber (configFile >> "CfgAmmo" >> _ammoType >> "airFriction"); + if !(getText (configFile >> "CfgAmmo" >> _ammo >> "simulation") == "shotMissile") then { + private _maxElev = getNumber (_turretConfig >> "maxElev"); + private _initSpeed = getNumber (configFile >> "CfgMagazines" >> _magazine >> "initSpeed"); + private _airFriction = getNumber (configFile >> "CfgAmmo" >> _ammo >> "airFriction"); { private ["_weapon", "_muzzles", "_weaponMagazines", "_muzzleMagazines"]; _weapon = _x; _muzzles = getArray (configFile >> "CfgWeapons" >> _weapon >> "muzzles"); _weaponMagazines = getArray (configFile >> "CfgWeapons" >> _weapon >> "magazines"); + { if (_x != "this") then { _muzzleMagazines = getArray (configFile >> "CfgWeapons" >> _weapon >> _x >> "magazines"); _weaponMagazines append _muzzleMagazines; }; - } forEach _muzzles; + false + } count _muzzles; + if (_magazine in _weaponMagazines) exitWith { _initSpeedCoef = getNumber(configFile >> "CfgWeapons" >> _weapon >> "initSpeed"); + if (_initSpeedCoef < 0) then { _initSpeed = _initSpeed * -_initSpeedCoef; }; + if (_initSpeedCoef > 0) then { _initSpeed = _initSpeedCoef; }; }; - } forEach _weapons; + false + } count (_vehicle weaponsTurret _turret); - _offset = "ace_fcs" callExtension format ["%1,%2,%3,%4", _initSpeed, _airFriction, _angleTarget, _distance]; + private _offset = "ace_fcs" callExtension format ["%1,%2,%3,%4", _initSpeed, _airFriction, _angleTarget, _distance]; _offset = parseNumber _offset; - _FCSMagazines = _FCSMagazines + [_magazine]; - _FCSElevation = _FCSElevation + [_offset]; + _FCSMagazines pushBack _magazine; + _FCSElevation pushBack _offset; }; -} forEach _magazines; + false +} count (_vehicle magazinesTurret _turret); -[_vehicle, format ["%1_%2", QGVAR(Distance), _turret], _distance] call EFUNC(common,setVariablePublic); +[_vehicle, format ["%1_%2", QGVAR(Distance), _turret], _distance] call EFUNC(common,setVariablePublic); [_vehicle, format ["%1_%2", QGVAR(Magazines), _turret], _FCSMagazines] call EFUNC(common,setVariablePublic); [_vehicle, format ["%1_%2", QGVAR(Elevation), _turret], _FCSElevation] call EFUNC(common,setVariablePublic); -[_vehicle, format ["%1_%2", QGVAR(Azimuth), _turret], _FCSAzimuth] call EFUNC(common,setVariablePublic); +[_vehicle, format ["%1_%2", QGVAR(Azimuth), _turret], _FCSAzimuth] call EFUNC(common,setVariablePublic); -_showHint = false; -if( (count _this) > 3) then { - _showHint = _this select 3; -}; - -_playSound = true; -if( (count _this) > 3) then { - _playSound = _this select 4; -}; - -if(_playSound) then { +if (_playSound) then { playSound "ACE_Sound_Click"; }; -if(_showHint) then { +if (_showHint) then { [format ["%1: %2", localize LSTRING(ZeroedTo), _distance]] call EFUNC(common,displayTextStructured); }; //Update the hud's distance display to the new value or "----" if out of range //(10m fudge because of EFUNC(common,getTargetDistance)) -if ((_distance + 10) >= (getNumber (_turretConfig >> QGVAR(MaxDistance)))) then { +if (_distance + 10 >= getNumber (_turretConfig >> QGVAR(MaxDistance))) then { ((uiNamespace getVariable ["ACE_dlgRangefinder", displayNull]) displayCtrl 1713151) ctrlSetText "----"; } else { ((uiNamespace getVariable ["ACE_dlgRangefinder", displayNull]) displayCtrl 1713151) ctrlSetText ([_distance, 4, 0] call CBA_fnc_formatNumber); diff --git a/addons/fcs/functions/fnc_onForceUpdate.sqf b/addons/fcs/functions/fnc_onForceUpdate.sqf index 6f477fd3f6..005a0d7801 100644 --- a/addons/fcs/functions/fnc_onForceUpdate.sqf +++ b/addons/fcs/functions/fnc_onForceUpdate.sqf @@ -1,7 +1,13 @@ #include "script_component.hpp" -if !([ACE_player, vehicle ACE_player, []] call EFUNC(common,canInteractWith)) exitWith {false}; +params ["_unit"]; + +private _vehicle = vehicle _unit; + +if !([_unit, _vehicle, []] call EFUNC(common,canInteractWith)) exitWith {false}; if !((!GVAR(enabled) && FUNC(canUseFCS)) || FUNC(canUseRangefinder)) exitWith {false}; -[vehicle ACE_player, [ACE_player] call EFUNC(common,getTurretIndex), -1, false] call FUNC(keyDown); -[vehicle ACE_player, [ACE_player] call EFUNC(common,getTurretIndex), -1, false, false] call FUNC(keyUp); \ No newline at end of file +private _turret = _unit call EFUNC(common,getTurretIndex); + +[_vehicle, _turret, -1, false] call FUNC(keyDown); +[_vehicle, _turret, -1, false, false] call FUNC(keyUp); diff --git a/addons/fcs/functions/fnc_reset.sqf b/addons/fcs/functions/fnc_reset.sqf index 48e3803c83..dcb1718b3f 100644 --- a/addons/fcs/functions/fnc_reset.sqf +++ b/addons/fcs/functions/fnc_reset.sqf @@ -1,21 +1,19 @@ /* * Author: KoffeinFlummi - * * Resets the FCS to default. * * Arguments: - * 0: Vehicle + * 0: Vehicle + * 1: Turret * * Return Value: * none + * + * Public: No */ - #include "script_component.hpp" -private ["_vehicle", "_turret"]; - -_vehicle = _this select 0; -_turret = _this select 1; +params ["_vehicle", "_turret"]; [_vehicle, format ["%1_%2", QGVAR(Distance), _turret], 0] call EFUNC(common,setVariablePublic); [_vehicle, format ["%1_%2", QGVAR(Magazines), _turret], []] call EFUNC(common,setVariablePublic); diff --git a/addons/fcs/functions/fnc_updateRangeHUD.sqf b/addons/fcs/functions/fnc_updateRangeHUD.sqf new file mode 100644 index 0000000000..374254c620 --- /dev/null +++ b/addons/fcs/functions/fnc_updateRangeHUD.sqf @@ -0,0 +1,18 @@ +/* + * Author: commy2 + * Update compatible info elements. + * + * Argument: + * None + * + * Return value: + * None + * + * Public: No + */ +#include "script_component.hpp" + +disableSerialization; +private _dlgRangefinder = uiNamespace getVariable ["ACE_dlgRangefinder", displayNull]; + +(_dlgRangefinder displayCtrl 1713151) ctrlSetText ctrlText (_dlgRangefinder displayCtrl 151); diff --git a/addons/fcs/functions/fnc_vehicleInit.sqf b/addons/fcs/functions/fnc_vehicleInit.sqf index 8ac23073f6..901e0477ab 100644 --- a/addons/fcs/functions/fnc_vehicleInit.sqf +++ b/addons/fcs/functions/fnc_vehicleInit.sqf @@ -1,6 +1,5 @@ /* * Author: KoffeinFlummi, commy2 - * * Checks if a vehicle is equipped with an FCS and if so, adds the fired event handler. Execute on server. * * Arguments: @@ -8,17 +7,15 @@ * * Return Value: * none + * + * Public: No */ - #include "script_component.hpp" -private "_vehicle"; - -_vehicle = _this select 0; +params ["_vehicle"]; { - private "_turretConfig"; - _turretConfig = [configFile >> "CfgVehicles" >> typeOf _vehicle, _x] call EFUNC(common,getTurretConfigPath); + private _turretConfig = [configFile >> "CfgVehicles" >> typeOf _vehicle, _x] call EFUNC(common,getTurretConfigPath); if (getNumber (_turretConfig >> QGVAR(Enabled)) == 1) then { _vehicle setVariable [format ["%1_%2", QGVAR(Distance), _x], 0, true]; @@ -42,4 +39,5 @@ _vehicle = _this select 0; _vehicle setVariable [format ["%1_%2", QGVAR(ViewDiff), _x], 0, true]; }; }; -} forEach allTurrets _vehicle; + false +} count allTurrets _vehicle; diff --git a/addons/finger/functions/fnc_incomingFinger.sqf b/addons/finger/functions/fnc_incomingFinger.sqf index 5a1e23a278..02c870a519 100644 --- a/addons/finger/functions/fnc_incomingFinger.sqf +++ b/addons/finger/functions/fnc_incomingFinger.sqf @@ -27,7 +27,7 @@ _fingerPos = if (_sourceUnit == ACE_player) then { _fingerPosPrecise vectorAdd [random (2*FP_RANDOMIZATION_X) - FP_RANDOMIZATION_X, random (2*FP_RANDOMIZATION_X) - FP_RANDOMIZATION_X, random (2*FP_RANDOMIZATION_Y) - FP_RANDOMIZATION_Y] }; -_data = [ACE_diagTime, _fingerPos, ([_sourceUnit] call EFUNC(common,getName))]; +_data = [ACE_diagTime, _fingerPos, ([_sourceUnit, false, true] call EFUNC(common,getName))]; HASH_SET(GVAR(fingersHash), _sourceUnit, _data); if (GVAR(pfeh_id) == -1) then { diff --git a/addons/gestures/ACE_Settings.hpp b/addons/gestures/ACE_Settings.hpp new file mode 100644 index 0000000000..a9e77807c0 --- /dev/null +++ b/addons/gestures/ACE_Settings.hpp @@ -0,0 +1,11 @@ +class ACE_Settings { + class GVAR(showOnInteractionMenu) { + value = 2; + typeName = "SCALAR"; + isClientSettable = 1; + category = ECSTRING(interact_menu,Category_InteractionMenu); + displayName = CSTRING(showOnInteractionMenu_displayName); + description = CSTRING(showOnInteractionMenu_description); + values[] = {"$STR_A3_OPTIONS_DISABLED", CSTRING(justKeybinds), CSTRING(keysAndInteractionMenu)}; + }; +}; diff --git a/addons/gestures/CfgVehicles.hpp b/addons/gestures/CfgVehicles.hpp index 019cffdb45..6ada84c736 100644 --- a/addons/gestures/CfgVehicles.hpp +++ b/addons/gestures/CfgVehicles.hpp @@ -5,12 +5,12 @@ class CfgVehicles { class ACE_SelfActions { class ADDON { displayName = CSTRING(Gestures); - condition = QUOTE(canStand _target && GVAR(ReloadMutex)); + condition = QUOTE((canStand _target) && GVAR(ReloadMutex) && {GVAR(showOnInteractionMenu) == 2}); statement = ""; showDisabled = 1; priority = 3.5; icon = PATHTOF(UI\gestures_ca.paa); - + class GVAR(Advance) { displayName = CSTRING(BIgestureAdvance); condition = QUOTE(canStand _target); @@ -116,7 +116,6 @@ class CfgVehicles { statement = QUOTE(_target playActionNow ([ARR_2('gestureYes','gestureNod')] select floor random 2);); showDisabled = 1; priority = 1.1; - hotkey = "8"; }; class class GVAR(No) { @@ -125,7 +124,6 @@ class CfgVehicles { statement = QUOTE(_target playActionNow 'gestureNo';); showDisabled = 1; priority = 1.0; - hotkey = "9"; }; class class GVAR(Hi) { @@ -134,7 +132,6 @@ class CfgVehicles { statement = QUOTE(_target playActionNow ([ARR_3('gestureHi','gestureHiB','gestureHiC')] select floor random 3);); showDisabled = 1; priority = 0.9; - hotkey = "0"; }; */ diff --git a/addons/gestures/config.cpp b/addons/gestures/config.cpp index 6a3fa402d0..39cb8f0951 100644 --- a/addons/gestures/config.cpp +++ b/addons/gestures/config.cpp @@ -12,6 +12,7 @@ class CfgPatches { }; }; +#include "ACE_Settings.hpp" #include "CfgMovesBasic.hpp" #include "CfgEventHandlers.hpp" #include "CfgVehicles.hpp" diff --git a/addons/gestures/functions/fnc_playSignal.sqf b/addons/gestures/functions/fnc_playSignal.sqf index b8a218f565..feb79f5370 100644 --- a/addons/gestures/functions/fnc_playSignal.sqf +++ b/addons/gestures/functions/fnc_playSignal.sqf @@ -18,10 +18,14 @@ TRACE_1("params",_this); if (!GVAR(ReloadMutex)) exitWith {false}; +if (GVAR(showOnInteractionMenu) == 0) exitWith {false}; +if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false}; -private _gesture = if (_this select [0,2] == "BI") then { +private _gesture = if ((_this select [0,2]) == "BI") then { + //If it starts with BI, just strip off the leading BI and use it directly _this select [2] } else { + //Adjust gesture based on stance: if (((animationState ACE_player) select [0, 12]) in ["amovpercmstp", "amovpercmwlk", "amovpercmtac"] && weaponLowered ACE_player) then { format ["%1StandLowered", _this] } else { @@ -29,5 +33,6 @@ private _gesture = if (_this select [0,2] == "BI") then { }; }; +TRACE_1("playing gesture",_gesture); ACE_player playAction _gesture; true diff --git a/addons/gestures/key.sqf b/addons/gestures/key.sqf index 125463d4d1..54d6d50c0c 100644 --- a/addons/gestures/key.sqf +++ b/addons/gestures/key.sqf @@ -3,11 +3,15 @@ { _x params ["_currentName","_key"]; - if (_currentName select [0,1] == "BI") then { - _currentName = _currentName select [2]; + private _signalName = format [QGVAR(%1), _currentName]; + if (_currentName select [0,2] == "BI") then { + //Don't add "ace_gestures_" prefix to BI gestures + _signalName = _currentName; }; - private _code = (compile format [QUOTE(QUOTE(QGVAR(%1)) call FUNC(playSignal);), _currentName]); + private _code = (compile format [QUOTE('%1' call FUNC(playSignal);), _signalName]); + + TRACE_4("Adding KeyBind",_currentName,_signalName,_code,_key); [ "ACE3 Gestures", diff --git a/addons/gestures/stringtable.xml b/addons/gestures/stringtable.xml index cc9b776cd1..0d21846d58 100644 --- a/addons/gestures/stringtable.xml +++ b/addons/gestures/stringtable.xml @@ -92,7 +92,7 @@ Wskazać Ukázat Pointer - Точка + Показать направление Mutat Apontar Puntare a @@ -115,6 +115,8 @@ Stop Stop Stop + Стоп + Parar @@ -135,6 +137,8 @@ Regroupement Sammeln Zbiórka + Собраться + Reagrupar @@ -142,12 +146,16 @@ En avant Vorwärts Bewegen Naprzód + Вперед + Mover em frente Engage Engager Atak + Открыть огонь + Engajar @@ -155,6 +163,8 @@ Pointer Zeigen Wskaż + Показать направление + Ponta @@ -162,6 +172,8 @@ Tenir Anhalten Wstrzymać + Ждать + Esperar @@ -169,6 +181,8 @@ Attention Achtung Uwaga + Внимание + Aviso Hi @@ -194,5 +208,17 @@ Atacar Attaccare + + Show Gestures On Interaction Menu + + + Show gestures on the self interaction menu, or just use keybinds, or disable completely + + + Just Keybinds + + + Keybinds + Interaction Menu + \ No newline at end of file diff --git a/addons/goggles/CfgEventHandlers.hpp b/addons/goggles/CfgEventHandlers.hpp index 67f17fda18..8c24b6d5ec 100644 --- a/addons/goggles/CfgEventHandlers.hpp +++ b/addons/goggles/CfgEventHandlers.hpp @@ -14,15 +14,15 @@ class Extended_PostInit_EventHandlers { class Extended_Killed_EventHandlers { class CAManBase { class ADDON { - killed = QUOTE(_this call FUNC(handleKilled)); + clientKilled = QUOTE(_this call FUNC(handleKilled)); }; }; }; -class Extended_Fired_EventHandlers { +class Extended_FiredBIS_EventHandlers { class CAManBase { class ADDON { - fired = QUOTE(if (local (_this select 0)) then {_this call FUNC(handleFired)}); + clientFiredBIS = QUOTE(if (local (_this select 0)) then {_this call FUNC(handleFired)}); }; }; }; @@ -30,7 +30,7 @@ class Extended_Fired_EventHandlers { class Extended_Explosion_EventHandlers { class CAManBase { class ADDON { - explosion = QUOTE(if (local (_this select 0)) then {_this call FUNC(handleExplosion)}); + clientExplosion = QUOTE(if (local (_this select 0)) then {_this call FUNC(handleExplosion)}); }; }; }; diff --git a/addons/goggles/XEH_postInit.sqf b/addons/goggles/XEH_postInit.sqf index 09a84ad151..a4872f6a3f 100644 --- a/addons/goggles/XEH_postInit.sqf +++ b/addons/goggles/XEH_postInit.sqf @@ -114,16 +114,20 @@ private _fnc_checkGoggles = { // goggles effects main PFH [{ + BEGIN_COUNTER(goggles); + // rain call FUNC(applyRainEffect); // auto remove effects under water - if (GVAR(EffectsActive) && {[goggles ACE_player] call FUNC(isDivingGoggles) && {underwater ACE_player}}) then { + if (GVAR(EffectsActive) && {underwater ACE_player} && {[goggles ACE_player] call FUNC(isDivingGoggles)}) then { call FUNC(removeRainEffect); call FUNC(removeDirtEffect); call FUNC(removeDustEffect); }; // rotor wash effect - call FUNC(applyRotorWashEffect) -}, 0.5, _fnc_checkGoggles] call CBA_fnc_addPerFrameHandler; + call FUNC(applyRotorWashEffect); + + END_COUNTER(goggles); +}, 0.5, []] call CBA_fnc_addPerFrameHandler; diff --git a/addons/goggles/functions/fnc_applyDirtEffect.sqf b/addons/goggles/functions/fnc_applyDirtEffect.sqf index c7ff386f9d..4b5ee13a0f 100644 --- a/addons/goggles/functions/fnc_applyDirtEffect.sqf +++ b/addons/goggles/functions/fnc_applyDirtEffect.sqf @@ -15,7 +15,6 @@ */ #include "script_component.hpp" -if (GVAR(showInThirdPerson)) exitWith {false}; if (call FUNC(externalCamera)) exitWith {false}; private ["_unit", "_effects"]; diff --git a/addons/goggles/functions/fnc_applyDustEffect.sqf b/addons/goggles/functions/fnc_applyDustEffect.sqf index 75f4853c01..944b98f127 100644 --- a/addons/goggles/functions/fnc_applyDustEffect.sqf +++ b/addons/goggles/functions/fnc_applyDustEffect.sqf @@ -15,7 +15,6 @@ */ #include "script_component.hpp" -if (GVAR(showInThirdPerson)) exitWith {}; if (call FUNC(ExternalCamera)) exitWith {}; private ["_unit", "_amount"]; diff --git a/addons/goggles/functions/fnc_externalCamera.sqf b/addons/goggles/functions/fnc_externalCamera.sqf index 1af09827ab..85776fb0d6 100644 --- a/addons/goggles/functions/fnc_externalCamera.sqf +++ b/addons/goggles/functions/fnc_externalCamera.sqf @@ -15,4 +15,8 @@ */ #include "script_component.hpp" -cameraView in ["EXTERNAL", "GROUP"] || EFUNC(common,isFeatureCameraActive) // return +if (GVAR(showInThirdPerson)) then { + cameraView in ["GROUP"] || EFUNC(common,isFeatureCameraActive) +} else { + cameraView in ["EXTERNAL", "GROUP"] || EFUNC(common,isFeatureCameraActive) +}; diff --git a/addons/goggles/functions/fnc_handleExplosion.sqf b/addons/goggles/functions/fnc_handleExplosion.sqf index 795cdd78b1..b5c71a3d94 100644 --- a/addons/goggles/functions/fnc_handleExplosion.sqf +++ b/addons/goggles/functions/fnc_handleExplosion.sqf @@ -37,7 +37,6 @@ _effects set [BROKEN, true]; SETGLASSES(_unit,_effects); if (getText (_config >> "ACE_OverlayCracked") != "") then { - if (GVAR(showInThirdPerson)) exitWith {}; if (call FUNC(ExternalCamera)) exitWith {}; if (isNull (GLASSDISPLAY)) then { diff --git a/addons/grenades/functions/fnc_flare.sqf b/addons/grenades/functions/fnc_flare.sqf index bf1d571640..74360e39b9 100644 --- a/addons/grenades/functions/fnc_flare.sqf +++ b/addons/grenades/functions/fnc_flare.sqf @@ -20,8 +20,7 @@ params ["_projectile", "_color", "_intensity", "_timeToLive"]; -private "_light"; -_light = "#lightpoint" createVehicleLocal position _projectile; +private _light = "#lightpoint" createVehicleLocal position _projectile; _light setLightColor _color; _light setLightAmbient _color; diff --git a/addons/grenades/functions/fnc_flashbangExplosionEH.sqf b/addons/grenades/functions/fnc_flashbangExplosionEH.sqf index 0ac6502284..06466c70d4 100644 --- a/addons/grenades/functions/fnc_flashbangExplosionEH.sqf +++ b/addons/grenades/functions/fnc_flashbangExplosionEH.sqf @@ -17,14 +17,12 @@ params ["_grenade"]; -private ["_affected", "_strength", "_posGrenade", "_eyePos", "_losCount", "_eyeDir", "_dirToUnitVector", "_angleDiff", "_light"]; - -_affected = _grenade nearEntities ["CAManBase", 20]; +private _affected = _grenade nearEntities ["CAManBase", 20]; { if (local _x && {alive _x}) then { - _strength = 1 - ((_x distance _grenade) min 15) / 15; + private _strength = 1 - ((_x distance _grenade) min 15) / 15; TRACE_3("FlashBangEffect Start",_x,(_x distance _grenade),_strength); @@ -47,12 +45,12 @@ _affected = _grenade nearEntities ["CAManBase", 20]; } else { //Do effects for player // is there line of sight to the grenade? - _posGrenade = getPosASL _grenade; - _eyePos = eyePos ACE_player; //PositionASL + private _posGrenade = getPosASL _grenade; + private _eyePos = eyePos ACE_player; //PositionASL _posGrenade set [2, (_posGrenade select 2) + 0.2]; // compensate for grenade glitching into ground //Check for line of sight (check 4 points in case grenade is stuck in an object or underground) - _losCount = { + private _losCount = { !lineIntersects [_posGrenade vectorAdd _x, _eyePos, _grenade, ACE_player] } count [[0,0,0], [0,0,0.2], [0.1, 0.1, 0.1], [-0.1, -0.1, 0.1]]; @@ -68,9 +66,9 @@ _affected = _grenade nearEntities ["CAManBase", 20]; // account for people looking away by slightly // reducing the effect for visual effects. - _eyeDir = (positionCameraToWorld [0,0,1] vectorDiff positionCameraToWorld [0,0,0]); - _dirToUnitVector = _eyePos vectorFromTo _posGrenade; - _angleDiff = acos (_eyeDir vectorDotProduct _dirToUnitVector); + private _eyeDir = (positionCameraToWorld [0,0,1] vectorDiff positionCameraToWorld [0,0,0]); + private _dirToUnitVector = _eyePos vectorFromTo _posGrenade; + private _angleDiff = acos (_eyeDir vectorDotProduct _dirToUnitVector); // from 0-45deg, full effect if (_angleDiff > 45) then { @@ -85,7 +83,8 @@ _affected = _grenade nearEntities ["CAManBase", 20]; }; // create flash to illuminate environment - _light = "#lightpoint" createVehicleLocal (getPos _grenade); + private _light = "#lightpoint" createVehicleLocal getPos _grenade; + _light setLightBrightness 200; _light setLightAmbient [1,1,1]; _light setLightColor [1,1,1]; diff --git a/addons/grenades/functions/fnc_flashbangThrownFuze.sqf b/addons/grenades/functions/fnc_flashbangThrownFuze.sqf index ae50e96e39..ef6224f8ce 100644 --- a/addons/grenades/functions/fnc_flashbangThrownFuze.sqf +++ b/addons/grenades/functions/fnc_flashbangThrownFuze.sqf @@ -20,7 +20,7 @@ params ["_projectile"]; if (alive _projectile) then { playSound3D ["A3\Sounds_F\weapons\Explosion\explosion_mine_1.wss", _projectile, false, getPosASL _projectile, 5, 1.2, 400]; - private _affected = _projectile nearEntities ["CAManBase", 20]; + private _affected = _projectile nearEntities ["CAManBase", 50]; ["flashbangExplosion", _affected, [_projectile]] call EFUNC(common,targetEvent); }; diff --git a/addons/grenades/functions/fnc_nextMode.sqf b/addons/grenades/functions/fnc_nextMode.sqf index 7789e12ac4..99149f5185 100644 --- a/addons/grenades/functions/fnc_nextMode.sqf +++ b/addons/grenades/functions/fnc_nextMode.sqf @@ -15,9 +15,7 @@ */ #include "script_component.hpp" -private ["_mode", "_hint"]; - -_mode = missionNamespace getVariable [QGVAR(currentThrowMode), 0]; +private _mode = missionNamespace getVariable [QGVAR(currentThrowMode), 0]; if (_mode == 4) then { _mode = 0; @@ -30,13 +28,13 @@ if (_mode == 3) then { _mode = 4; }; -_hint = [ -localize LSTRING(NormalThrow), -localize LSTRING(HighThrow), -localize LSTRING(PreciseThrow), -localize LSTRING(RollGrenade), -localize LSTRING(DropGrenade) -] select _mode; +private _hint = localize ([ + LSTRING(NormalThrow), + LSTRING(HighThrow), + LSTRING(PreciseThrow), + LSTRING(RollGrenade), + LSTRING(DropGrenade) +] select _mode); [_hint] call EFUNC(common,displayTextStructured); diff --git a/addons/grenades/functions/fnc_throwGrenade.sqf b/addons/grenades/functions/fnc_throwGrenade.sqf index 9439aef4bd..e66498a854 100644 --- a/addons/grenades/functions/fnc_throwGrenade.sqf +++ b/addons/grenades/functions/fnc_throwGrenade.sqf @@ -30,24 +30,22 @@ if (isNull _projectile) then { _projectile = nearestObject [_unit, _ammo]; }; +private _config = configFile >> "CfgAmmo" >> _ammo; + // handle special grenades if (local _unit) then { - if (getNumber (configFile >> "CfgAmmo" >> _ammo >> QGVAR(flashbang)) == 1) then { - private "_fuzeTime"; - _fuzeTime = getNumber (configFile >> "CfgAmmo" >> _ammo >> "explosionTime"); + if (getNumber (_config >> QGVAR(flashbang)) == 1) then { + private _fuzeTime = getNumber (_config >> "explosionTime"); [FUNC(flashbangThrownFuze), [_projectile], _fuzeTime, 0] call EFUNC(common,waitAndExecute); }; }; -if (getNumber (configFile >> "CfgAmmo" >> _ammo >> QGVAR(flare)) == 1) then { - private ["_fuzeTime", "_timeToLive", "_color", "_intensity"]; - - _fuzeTime = getNumber (configFile >> "CfgAmmo" >> _ammo >> "explosionTime"); - _timeToLive = getNumber (configFile >> "CfgAmmo" >> _ammo >> "timeToLive"); - _color = getArray (configFile >> "CfgAmmo" >> _ammo >> QGVAR(color)); - _intensity = _color select 3; - _color resize 3; +if (getNumber (_config >> QGVAR(flare)) == 1) then { + private _fuzeTime = getNumber (_config >> "explosionTime"); + private _timeToLive = getNumber (_config >> "timeToLive"); + private _color = getArray (_config >> QGVAR(color)); + private _intensity = _color deleteAt 3; [FUNC(flare), [_projectile, _color, _intensity, _timeToLive], _fuzeTime, 0] call EFUNC(common,waitAndExecute); }; @@ -55,12 +53,10 @@ if (getNumber (configFile >> "CfgAmmo" >> _ammo >> QGVAR(flare)) == 1) then { // handle throw modes if (_unit != ACE_player) exitWith {}; -private "_mode"; -_mode = missionNamespace getVariable [QGVAR(currentThrowMode), 0]; +private _mode = missionNamespace getVariable [QGVAR(currentThrowMode), 0]; if (_mode != 0) then { - private "_velocity"; - _velocity = velocity _projectile; + private _velocity = velocity _projectile; switch (_mode) do { //high throw diff --git a/addons/hearing/CfgVehicles.hpp b/addons/hearing/CfgVehicles.hpp index 76a2f90a80..3873377052 100644 --- a/addons/hearing/CfgVehicles.hpp +++ b/addons/hearing/CfgVehicles.hpp @@ -11,7 +11,6 @@ class CfgVehicles { showDisabled = 0; priority = 2.5; icon = PATHTOF(UI\ACE_earplugs_x_ca.paa); - hotkey = "E"; }; class ACE_RemoveEarplugs { displayName = CSTRING(EarPlugs_Off); @@ -21,7 +20,6 @@ class CfgVehicles { showDisabled = 0; priority = 2.5; icon = PATHTOF(UI\ACE_earplugs_x_ca.paa); - hotkey = "E"; }; }; }; diff --git a/addons/hearing/stringtable.xml b/addons/hearing/stringtable.xml index 14517b54ce..71767a0cb0 100644 --- a/addons/hearing/stringtable.xml +++ b/addons/hearing/stringtable.xml @@ -172,10 +172,14 @@ Add earplugs to units Dodaj stopery dla jednostek + Добавлять юнитам беруши + Adiciona protetores de ouvido as unidades Add the `ACE_EarPlugs` item to all units that have loud weapons. Can disable if using custom loadouts. Dodaje `ACE_EarPlugs` - stopery - do wszystkich jednostek, które posiadają głośną broń. Można wyłaczyć w przypadku korzystania z niestandardowych loadoutów. + Добавляет предмет `ACE_EarPlugs` всем юнитам, которые имеют громкое оружие. Можно отключить при ручной настройке снаряжения. + Adicionar o item `ACE_EarPlugs` a todas as unidades que tenham armas barulhentas. Pode ser desabilitado com carregamentos customizados. \ No newline at end of file diff --git a/addons/hitreactions/XEH_preInit.sqf b/addons/hitreactions/XEH_preInit.sqf index d3c0973ee7..88df4102a1 100644 --- a/addons/hitreactions/XEH_preInit.sqf +++ b/addons/hitreactions/XEH_preInit.sqf @@ -3,5 +3,6 @@ ADDON = false; PREP(fallDown); +PREP(getRandomAnimation); ADDON = true; diff --git a/addons/hitreactions/functions/fnc_fallDown.sqf b/addons/hitreactions/functions/fnc_fallDown.sqf index d93b99bd6b..9ed43ae14f 100644 --- a/addons/hitreactions/functions/fnc_fallDown.sqf +++ b/addons/hitreactions/functions/fnc_fallDown.sqf @@ -35,8 +35,7 @@ if (!isNil QUOTE(EFUNC(medical,playInjuredSound))) then { [_unit] call EFUNC(medical,playInjuredSound); }; -private "_vehicle"; -_vehicle = vehicle _unit; +private _vehicle = vehicle _unit; // handle static weapons if (_vehicle isKindOf "StaticWeapon") exitWith { @@ -53,61 +52,20 @@ if (_vehicle != _unit) exitWith {}; if !([_unit, _vehicle] call EFUNC(common,canInteractWith)) exitWith {}; // handle ladders -if (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> animationState _unit >> "AGM_isLadder") == 1) exitWith { +if (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> animationState _unit >> "ACE_isLadder") == 1) exitWith { _unit action ["LadderOff", nearestObject [position _unit, "House"]]; }; // only play animation when standing due to lack of animations, sry if !(stance _unit in ["CROUCH", "STAND"]) exitWith {}; -private "_velocity"; -_velocity = vectorMagnitude velocity _unit; +private _velocity = vectorMagnitude velocity _unit; // only fall when moving if (_velocity < 2) exitWith {}; // get correct animation by weapon -private "_anim"; - -call { - private "_weapon"; - _weapon = currentWeapon _unit; - - if (_weapon == "") exitWith { - _anim = "AmovPercMsprSnonWnonDf_AmovPpneMstpSnonWnonDnon" - }; - - if (_weapon == primaryWeapon _unit) exitWith { - if ([_unit] call EFUNC(common,isPlayer)) then { - private "_isRunning"; - _isRunning = _velocity > 4; - - _anim = [ - ["AmovPercMsprSlowWrfldf_AmovPpneMstpSrasWrflDnon_2", "AmovPercMsprSlowWrfldf_AmovPpneMstpSrasWrflDnon"] select _isRunning, - ["AmovPercMsprSlowWrfldf_AmovPpneMstpSrasWrflDnon_2", "AmovPercMsprSlowWrfldf_AmovPpneMstpSrasWrflDnon"] select _isRunning, - "AmovPercMstpSrasWrflDnon_AadjPpneMstpSrasWrflDleft", - "AmovPercMstpSrasWrflDnon_AadjPpneMstpSrasWrflDright" - ] select floor random 4; - } else { - _anim = "AmovPercMsprSlowWrfldf_AmovPpneMstpSrasWrflDnon"; - }; - }; - - if (_weapon == handgunWeapon _unit) exitWith { - if ([_unit] call EFUNC(common,isPlayer)) then { - _anim = [ - "AmovPercMsprSlowWpstDf_AmovPpneMstpSrasWpstDnon", - "AmovPercMsprSlowWpstDf_AmovPpneMstpSrasWpstDnon", - "AmovPercMstpSrasWpstDnon_AadjPpneMstpSrasWpstDleft", - "AmovPercMstpSrasWpstDnon_AadjPpneMstpSrasWpstDright" - ] select floor random 4; - } else { - _anim = "AmovPercMsprSlowWpstDf_AmovPpneMstpSrasWpstDnon"; - }; - }; - - _anim = ""; -}; +private _anim = _unit call FUNC(getRandomAnimation); // exit if no animation for this weapon exists, i.e. binocular or rocket launcher if (_anim == "") exitWith {}; diff --git a/addons/hitreactions/functions/fnc_getRandomAnimation.sqf b/addons/hitreactions/functions/fnc_getRandomAnimation.sqf new file mode 100644 index 0000000000..996901a31e --- /dev/null +++ b/addons/hitreactions/functions/fnc_getRandomAnimation.sqf @@ -0,0 +1,51 @@ +/* + * Author: commy2 + * Get a random fall animation for the unit. + * + * Arguments: + * 0: unit + * + * Return Value: + * Fall animation + * + * Public: No + */ +#include "script_component.hpp" + +params ["_unit"]; + +private _weapon = currentWeapon _unit; + +if (_weapon == "") exitWith { + "AmovPercMsprSnonWnonDf_AmovPpneMstpSnonWnonDnon" +}; + +if (_weapon == primaryWeapon _unit) exitWith { + if (_unit call EFUNC(common,isPlayer)) then { + private _isRunning = _velocity > 4; + + [ + ["AmovPercMsprSlowWrfldf_AmovPpneMstpSrasWrflDnon_2", "AmovPercMsprSlowWrfldf_AmovPpneMstpSrasWrflDnon"] select _isRunning, + ["AmovPercMsprSlowWrfldf_AmovPpneMstpSrasWrflDnon_2", "AmovPercMsprSlowWrfldf_AmovPpneMstpSrasWrflDnon"] select _isRunning, + "AmovPercMstpSrasWrflDnon_AadjPpneMstpSrasWrflDleft", + "AmovPercMstpSrasWrflDnon_AadjPpneMstpSrasWrflDright" + ] select floor random 4 + } else { + "AmovPercMsprSlowWrfldf_AmovPpneMstpSrasWrflDnon" + }; +}; + +if (_weapon == handgunWeapon _unit) exitWith { + if (_unit call EFUNC(common,isPlayer)) then { + [ + "AmovPercMsprSlowWpstDf_AmovPpneMstpSrasWpstDnon", + "AmovPercMsprSlowWpstDf_AmovPpneMstpSrasWpstDnon", + "AmovPercMstpSrasWpstDnon_AadjPpneMstpSrasWpstDleft", + "AmovPercMstpSrasWpstDnon_AadjPpneMstpSrasWpstDright" + ] select floor random 4 + } else { + "AmovPercMsprSlowWpstDf_AmovPpneMstpSrasWpstDnon" + }; +}; + +"" diff --git a/addons/interact_menu/XEH_clientInit.sqf b/addons/interact_menu/XEH_clientInit.sqf index 1dd1401a7d..f5e8a57db5 100644 --- a/addons/interact_menu/XEH_clientInit.sqf +++ b/addons/interact_menu/XEH_clientInit.sqf @@ -77,37 +77,6 @@ GVAR(ParsedTextCached) = []; if (GVAR(menuBackground)==2) then {(uiNamespace getVariable [QGVAR(menuBackground), displayNull]) closeDisplay 0;}; }] call EFUNC(common,addEventHandler); -// Let key work with zeus open (not perfect, contains workaround to prevent other CBA keybindings) -["zeusDisplayChanged",{ - if (_this select 1) then { - (finddisplay 312) displayAddEventHandler ["KeyUp", { - _key = ["ACE3 Common","ace_interact_menu_InteractKey"] call CBA_fnc_getKeybind; - _key = _key select 5; - _dik = _key select 0; - _mods = _key select 1; - - if ((_this select 1) == _dik) then { - if ((_this select [2,3]) isEqualTo _mods) then { - [_this,'keyup'] call CBA_events_fnc_keyHandler - }; - }; - }]; - (finddisplay 312) displayAddEventHandler ["KeyDown", { - _key = ["ACE3 Common","ace_interact_menu_InteractKey"] call CBA_fnc_getKeybind; - _key = _key select 5; - _dik = _key select 0; - _mods = _key select 1; - - if ((_this select 1) == _dik) then { - if ((_this select [2,3]) isEqualTo _mods) then { - [_this,'keydown'] call CBA_events_fnc_keyHandler - }; - }; - }]; - }; -}] call EFUNC(common,addEventHandler); - - //Debug to help end users identify mods that break CBA's XEH [{ private ["_badClassnames"]; diff --git a/addons/interact_menu/functions/fnc_userActions_addHouseActions.sqf b/addons/interact_menu/functions/fnc_userActions_addHouseActions.sqf index fdd7d14573..98abfdccd1 100644 --- a/addons/interact_menu/functions/fnc_userActions_addHouseActions.sqf +++ b/addons/interact_menu/functions/fnc_userActions_addHouseActions.sqf @@ -80,11 +80,10 @@ if ((vehicle ACE_player) != ACE_player) exitWith {}; // systemChat format ["Add Actions for [%1] (count %2) @ %3", _typeOfHouse, (count _memPoints), diag_tickTime]; { _helperPos = (_houseBeingScaned modelToWorld (_houseBeingScaned selectionPosition _x)) call EFUNC(common,positionToASL); - _helperObject = "Sign_Sphere25cm_F" createVehicleLocal _helperPos; + _helperObject = "ACE_LogicDummy" createVehicleLocal _helperPos; _addedHelpers pushBack _helperObject; _helperObject setVariable [QGVAR(building), _houseBeingScaned]; _helperObject setPosASL _helperPos; - _helperObject hideObject true; TRACE_3("Making New Helper",_helperObject,_x,_houseBeingScaned); { diff --git a/addons/interact_menu/stringtable.xml b/addons/interact_menu/stringtable.xml index 424426f653..3f3ad122f2 100644 --- a/addons/interact_menu/stringtable.xml +++ b/addons/interact_menu/stringtable.xml @@ -302,10 +302,14 @@ Interaction Animation Speed Szybkość animacji interakcji + Скорость анимации меню взаимодействия + Velocidade da animação de interação Makes menu animations faster and decreases the time needed to hover to show sub actions Przyśpiesza animacje menu interakcji oraz czas wymagany do pokazania podmenu + Ускоряет анимацию меню и уменьшает задержку при наведении мыши для раскрытия подменю + Faz com que as animações do menu de interação sejam mais rápidas, dimiuindo a necessidade de esperar para mostrar as ações \ No newline at end of file diff --git a/addons/interaction/CfgVehicles.hpp b/addons/interaction/CfgVehicles.hpp index 55bc0b1159..494f1d109e 100644 --- a/addons/interaction/CfgVehicles.hpp +++ b/addons/interaction/CfgVehicles.hpp @@ -69,7 +69,6 @@ class CfgVehicles { showDisabled = 0; priority = 3.2; icon = PATHTOF(UI\team\team_management_ca.paa); - hotkey = "M"; class ACE_AssignTeamRed { displayName = CSTRING(AssignTeamRed); @@ -78,7 +77,6 @@ class CfgVehicles { showDisabled = 1; icon = PATHTOF(UI\team\team_red_ca.paa); priority = 2.4; - hotkey = "R"; }; class ACE_AssignTeamGreen { displayName = CSTRING(AssignTeamGreen); @@ -87,7 +85,6 @@ class CfgVehicles { showDisabled = 1; icon = PATHTOF(UI\team\team_green_ca.paa); priority = 2.3; - hotkey = "G"; }; class ACE_AssignTeamBlue { displayName = CSTRING(AssignTeamBlue); @@ -96,7 +93,6 @@ class CfgVehicles { showDisabled = 1; icon = PATHTOF(UI\team\team_blue_ca.paa); priority = 2.2; - hotkey = "B"; }; class ACE_AssignTeamYellow { displayName = CSTRING(AssignTeamYellow); @@ -105,7 +101,6 @@ class CfgVehicles { showDisabled = 1; icon = PATHTOF(UI\team\team_yellow_ca.paa); priority = 2.1; - hotkey = "Y"; }; class ACE_UnassignTeam { displayName = CSTRING(LeaveTeam); @@ -114,7 +109,6 @@ class CfgVehicles { showDisabled = 1; icon = PATHTOF(UI\team\team_white_ca.paa); priority = 2.5; - hotkey = "N"; }; }; @@ -125,7 +119,6 @@ class CfgVehicles { showDisabled = 0; priority = 2.6; icon = PATHTOF(UI\team\team_management_ca.paa); - hotkey = "J"; }; class ACE_GetDown { displayName = CSTRING(GetDown); @@ -224,7 +217,6 @@ class CfgVehicles { showDisabled = 1; priority = 3.2; icon = PATHTOF(UI\team\team_management_ca.paa); - hotkey = "M"; class ACE_JoinTeamRed { displayName = CSTRING(JoinTeamRed); @@ -234,7 +226,6 @@ class CfgVehicles { showDisabled = 1; priority = 2.4; icon = PATHTOF(UI\team\team_red_ca.paa); - hotkey = "R"; }; class ACE_JoinTeamGreen { displayName = CSTRING(JoinTeamGreen); @@ -244,7 +235,6 @@ class CfgVehicles { showDisabled = 1; priority = 2.3; icon = PATHTOF(UI\team\team_green_ca.paa); - hotkey = "G"; }; class ACE_JoinTeamBlue { displayName = CSTRING(JoinTeamBlue); @@ -254,7 +244,6 @@ class CfgVehicles { showDisabled = 1; priority = 2.2; icon = PATHTOF(UI\team\team_blue_ca.paa); - hotkey = "B"; }; class ACE_JoinTeamYellow { displayName = CSTRING(JoinTeamYellow); @@ -264,7 +253,6 @@ class CfgVehicles { showDisabled = 1; priority = 2.1; icon = PATHTOF(UI\team\team_yellow_ca.paa); - hotkey = "Y"; }; class ACE_LeaveTeam { displayName = CSTRING(LeaveTeam); @@ -274,7 +262,6 @@ class CfgVehicles { showDisabled = 1; priority = 2.5; icon = PATHTOF(UI\team\team_white_ca.paa); - hotkey = "N"; }; class ACE_BecomeLeader { displayName = CSTRING(BecomeLeader); @@ -284,7 +271,6 @@ class CfgVehicles { showDisabled = 1; priority = 1.0; icon = PATHTOF(UI\team\team_white_ca.paa); - hotkey = "L"; }; class ACE_LeaveGroup { displayName = CSTRING(LeaveGroup); @@ -294,7 +280,6 @@ class CfgVehicles { showDisabled = 1; priority = 1.2; icon = PATHTOF(UI\team\team_management_ca.paa); - hotkey = "M"; }; }; class ACE_Equipment { @@ -305,7 +290,6 @@ class CfgVehicles { showDisabled = 1; priority = 4.5; icon = ""; // @todo - hotkey = "E"; }; }; }; @@ -485,7 +469,7 @@ class CfgVehicles { }; }; }; - + class StaticMGWeapon: StaticWeapon {}; class HMG_01_base_F: StaticMGWeapon {}; @@ -513,8 +497,8 @@ class CfgVehicles { }; }; - class thingX; - class ReammoBox_F: thingX { + class ThingX; + class ReammoBox_F: ThingX { class ACE_Actions { class ACE_MainActions { displayName = CSTRING(MainAction); @@ -535,7 +519,7 @@ class CfgVehicles { class ACE_SelfActions {}; }; - class ACE_RepairItem_Base: thingX { + class ACE_RepairItem_Base: ThingX { class ACE_Actions { class ACE_MainActions { displayName = CSTRING(MainAction); @@ -548,7 +532,7 @@ class CfgVehicles { class ACE_SelfActions {}; }; - class RoadCone_F: thingX { + class RoadCone_F: ThingX { class ACE_Actions { class ACE_MainActions { displayName = CSTRING(MainAction); diff --git a/addons/interaction/stringtable.xml b/addons/interaction/stringtable.xml index b84a987a9c..4171789b22 100644 --- a/addons/interaction/stringtable.xml +++ b/addons/interaction/stringtable.xml @@ -695,26 +695,36 @@ Pass magazine Magazin geben Podaj magazynek + Передать магазин + Passar carregador Primary magazine Gewehrmagazin Magazynek karabinowy + Основной магазин + Carregador primário Pistol magazine Pistolenmagazin Magazynek pistoletowy + Магазин к пистолету + Carregador da pistola %1 passed you a %2 magazine. %1 hat dir ein %2 Magazin gegeben. %1 podał Ci magazynek %2. + %1 передал вам магазин %2. + %1 passou a você um carregador %2. Show "pass magazine" interaction Zeige "Magazine geben" Interaktion Pokaż interakcję "podaj magazynek" + Показывать действие "передать магазин" + Mostrar a interação "Passar carregador" \ No newline at end of file diff --git a/addons/inventory/CfgEventHandlers.hpp b/addons/inventory/CfgEventHandlers.hpp new file mode 100644 index 0000000000..0cd959a047 --- /dev/null +++ b/addons/inventory/CfgEventHandlers.hpp @@ -0,0 +1,12 @@ + +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preInit)); + }; +}; + +class Extended_PostInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_postInit)); + }; +}; diff --git a/addons/inventory/XEH_postInit.sqf b/addons/inventory/XEH_postInit.sqf new file mode 100644 index 0000000000..d0e3fb042a --- /dev/null +++ b/addons/inventory/XEH_postInit.sqf @@ -0,0 +1,50 @@ +#include "script_component.hpp" + +if (!hasInterface) exitWith {}; + +GVAR(customFilters) = []; +GVAR(selectedFilterIndex) = -1; + +["inventoryDisplayLoaded", {_this call FUNC(inventoryDisplayLoaded)}] call EFUNC(common,addEventHandler); + +// add custom filters + +// generate list of grenades +GVAR(Grenades_ItemList) = []; + +{ + GVAR(Grenades_ItemList) append getArray (configFile >> "CfgWeapons" >> "Throw" >> _x >> "magazines"); + false +} count getArray (configFile >> "CfgWeapons" >> "Throw" >> "muzzles"); + +// make list case insensitive +GVAR(Grenades_ItemList) = [GVAR(Grenades_ItemList), {toLower _this}] call EFUNC(common,map); + +// filter duplicates +GVAR(Grenades_ItemList) = GVAR(Grenades_ItemList) arrayIntersect GVAR(Grenades_ItemList); + +[localize LSTRING(Grenades), QFUNC(filterGrenades)] call FUNC(addCustomFilter); + +[localize LSTRING(Backpacks), QFUNC(filterBackpacks)] call FUNC(addCustomFilter); +[localize LSTRING(Uniforms), QFUNC(filterUniforms)] call FUNC(addCustomFilter); +[localize LSTRING(Vests), QFUNC(filterVests)] call FUNC(addCustomFilter); +[localize LSTRING(Headgear), QFUNC(filterHeadgear)] call FUNC(addCustomFilter); + +// generate list of medical items +GVAR(Medical_ItemList) = []; + +{ + GVAR(Medical_ItemList) append getArray (_x >> "items"); + false +} count ( + ("true" configClasses (configFile >> QEGVAR(Medical,Actions) >> "Basic")) + + ("true" configClasses (configFile >> QEGVAR(Medical,Actions) >> "Advanced")) +); + +// make list case insensitive +GVAR(Medical_ItemList) = [GVAR(Medical_ItemList), {if (_this isEqualType "") then {toLower _this}}] call EFUNC(common,map); + +// filter duplicates +GVAR(Medical_ItemList) = GVAR(Medical_ItemList) arrayIntersect GVAR(Medical_ItemList); + +[localize LSTRING(Medical), QFUNC(filterMedical)] call FUNC(addCustomFilter); diff --git a/addons/inventory/XEH_preInit.sqf b/addons/inventory/XEH_preInit.sqf new file mode 100644 index 0000000000..d574cacf3b --- /dev/null +++ b/addons/inventory/XEH_preInit.sqf @@ -0,0 +1,64 @@ +#include "script_component.hpp" + +ADDON = false; + +PREP(addCustomFilter); +PREP(currentItemListBox); +PREP(forceItemListUpdate); +PREP(inventoryDisplayLoaded); +PREP(onLBSelChanged); + +// cache config +// items in the inventory display can only be distinguished by their lb names and pictures +// this can cause collisions (mainly weapons with attachments), +// but if the item has the same name and picture it at least shouldn't change the filter anyway +// luckily we don't need private items, so dummy and parent classes are out of the picture + +if !(uiNamespace getVariable [QGVAR(configCached), false]) then { + private _fnc_addToCache = { + private _displayName = getText (_this >> "displayName"); + private _picture = getText (_this >> "picture"); + + // list box seems to delete the leading backslash + if (_picture select [0,1] == "\") then { + _picture = _picture select [1]; + }; + + uiNamespace setVariable [format [QGVAR(ItemKey:%1:%2), _displayName, _picture], _this]; + }; + + // weapons and items + { + if (getNumber (_x >> "scope") > 0) then {_x call _fnc_addToCache}; + false + } count ( + ("true" configClasses (configFile >> "CfgWeapons")) + + ("true" configClasses (configFile >> "CfgGlasses")) + ); + + // magazines + { + if (getNumber (_x >> "scope") == 2) then {_x call _fnc_addToCache}; + false + } count ("true" configClasses (configFile >> "CfgMagazines")); + + // backpacks + { + if (getNumber (_x >> "scope") > 0 && {getNumber (_x >> "isBackpack") == 1}) then {_x call _fnc_addToCache}; + false + } count ("true" configClasses (configFile >> "CfgVehicles")); + + uiNamespace setVariable [QGVAR(configCached), true]; +}; + +PREP(filterWeapons); +PREP(filterMagazines); +PREP(filterItems); +PREP(filterHeadgear); +PREP(filterUniforms); +PREP(filterVests); +PREP(filterBackpacks); +PREP(filterGrenades); +PREP(filterMedical); + +ADDON = true; diff --git a/addons/inventory/config.cpp b/addons/inventory/config.cpp index 1190525901..f0982a46b4 100644 --- a/addons/inventory/config.cpp +++ b/addons/inventory/config.cpp @@ -6,11 +6,13 @@ class CfgPatches { weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_common"}; - author[] = {"Pabst Mirror"}; + author[] = {"Pabst Mirror, commy2"}; authorUrl = "https://github.com/PabstMirror/"; VERSION_CONFIG; }; }; +#include "CfgEventHandlers.hpp" + #include "RscDisplayInventory.hpp" #include "ACE_Settings.hpp" diff --git a/addons/inventory/functions/fnc_addCustomFilter.sqf b/addons/inventory/functions/fnc_addCustomFilter.sqf new file mode 100644 index 0000000000..44e43bdbf0 --- /dev/null +++ b/addons/inventory/functions/fnc_addCustomFilter.sqf @@ -0,0 +1,19 @@ +/* + * Author: commy2 + * Adds a custom filter list to the inventory display. + * Functions are here as strings, because list boxes can only store numbers and strings. + * + * Arguments: + * 0: Localized filter display name + * 1: Filter function name + * + * Return Value: + * None + * + * Public: No + */ +#include "script_component.hpp" + +params [["_filterName", "ERROR: No Name", [""]], ["_fncName", "", [""]]]; + +GVAR(customFilters) pushBack [_filterName, _fncName]; diff --git a/addons/inventory/functions/fnc_currentItemListBox.sqf b/addons/inventory/functions/fnc_currentItemListBox.sqf new file mode 100644 index 0000000000..1f1b528e93 --- /dev/null +++ b/addons/inventory/functions/fnc_currentItemListBox.sqf @@ -0,0 +1,30 @@ +/* + * Author: commy2 + * Returns the current item list box of given inventory display. + * These can be Ground, Soldier, Uniform, Backpack or Vest. + * Can also be Weapon since 1.52, but that apparently uses one of the above. + * + * Arguments: + * 0: Inventory display + * + * Return Value: + * Currently selected item list box + * + * Public: No + */ +#include "script_component.hpp" + +params ["_display"]; + +scopeName "main"; + +{ + private _control = _display displayCtrl _x; + + if (ctrlShown _control) then { + _control breakOut "main"; + }; + false +} count [IDC_ITEMLIST_GROUND, IDC_ITEMLIST_SOLDIER, IDC_ITEMLIST_UNIFORM, IDC_ITEMLIST_VEST, IDC_ITEMLIST_BACKPACK]; + +-1 diff --git a/addons/inventory/functions/fnc_filterBackpacks.sqf b/addons/inventory/functions/fnc_filterBackpacks.sqf new file mode 100644 index 0000000000..9b629de66f --- /dev/null +++ b/addons/inventory/functions/fnc_filterBackpacks.sqf @@ -0,0 +1,17 @@ +/* + * Author: commy2 + * Filter condition for the Backpacks filter list + * + * Arguments: + * 0: Item config entry + * + * Return Value: + * Item should appear in this list? + * + * Public: No + */ +#include "script_component.hpp" + +params ["_config"]; + +getNumber (_config >> "isBackpack") == 1 diff --git a/addons/inventory/functions/fnc_filterGrenades.sqf b/addons/inventory/functions/fnc_filterGrenades.sqf new file mode 100644 index 0000000000..0acfbcaa2c --- /dev/null +++ b/addons/inventory/functions/fnc_filterGrenades.sqf @@ -0,0 +1,17 @@ +/* + * Author: commy2 + * Filter condition for the Grenades filter list + * + * Arguments: + * 0: Item config entry + * + * Return Value: + * Item should appear in this list? + * + * Public: No + */ +#include "script_component.hpp" + +params ["_config"]; + +toLower configName _config in GVAR(Grenades_ItemList) diff --git a/addons/inventory/functions/fnc_filterHeadgear.sqf b/addons/inventory/functions/fnc_filterHeadgear.sqf new file mode 100644 index 0000000000..056406a3d1 --- /dev/null +++ b/addons/inventory/functions/fnc_filterHeadgear.sqf @@ -0,0 +1,17 @@ +/* + * Author: commy2 + * Filter condition for the Headgear filter list + * + * Arguments: + * 0: Item config entry + * + * Return Value: + * Item should appear in this list? + * + * Public: No + */ +#include "script_component.hpp" + +params ["_config"]; + +getNumber (_config >> "ItemInfo" >> "type") in [TYPE_HEADGEAR, TYPE_HMD] || {isClass (configFile >> "CfgGlasses" >> configName _config)} diff --git a/addons/inventory/functions/fnc_filterItems.sqf b/addons/inventory/functions/fnc_filterItems.sqf new file mode 100644 index 0000000000..b9bf9baeea --- /dev/null +++ b/addons/inventory/functions/fnc_filterItems.sqf @@ -0,0 +1,17 @@ +/* + * Author: commy2 + * Remove uniforms, vests and backpacks from Items filter. + * + * Arguments: + * 0: Item config entry + * + * Return Value: + * Item should appear in this list? + * + * Public: No + */ +#include "script_component.hpp" + +params ["_config"]; + +!(getNumber (_config >> "ItemInfo" >> "type") in [TYPE_UNIFORM, TYPE_VESTS, TYPE_HEADGEAR]) && {!(_this call FUNC(filterBackpacks))} diff --git a/addons/inventory/functions/fnc_filterMagazines.sqf b/addons/inventory/functions/fnc_filterMagazines.sqf new file mode 100644 index 0000000000..dfd357f61d --- /dev/null +++ b/addons/inventory/functions/fnc_filterMagazines.sqf @@ -0,0 +1,15 @@ +/* + * Author: commy2 + * Remove backpacks and grenades from Magazines filter. + * + * Arguments: + * 0: Item config entry + * + * Return Value: + * Item should appear in this list? + * + * Public: No + */ +#include "script_component.hpp" + +!(_this call FUNC(filterBackpacks)) && {!(_this call FUNC(filterGrenades))} diff --git a/addons/inventory/functions/fnc_filterMedical.sqf b/addons/inventory/functions/fnc_filterMedical.sqf new file mode 100644 index 0000000000..397be50f06 --- /dev/null +++ b/addons/inventory/functions/fnc_filterMedical.sqf @@ -0,0 +1,17 @@ +/* + * Author: commy2 + * Filter condition for the Medical filter list + * + * Arguments: + * 0: Item config entry + * + * Return Value: + * Item should appear in this list? + * + * Public: No + */ +#include "script_component.hpp" + +params ["_config"]; + +toLower configName _config in GVAR(Medical_ItemList) diff --git a/addons/inventory/functions/fnc_filterUniforms.sqf b/addons/inventory/functions/fnc_filterUniforms.sqf new file mode 100644 index 0000000000..4c135dfa88 --- /dev/null +++ b/addons/inventory/functions/fnc_filterUniforms.sqf @@ -0,0 +1,17 @@ +/* + * Author: commy2 + * Filter condition for the Uniforms filter list + * + * Arguments: + * 0: Item config entry + * + * Return Value: + * Item should appear in this list? + * + * Public: No + */ +#include "script_component.hpp" + +params ["_config"]; + +getNumber (_config >> "ItemInfo" >> "type") == TYPE_UNIFORM diff --git a/addons/inventory/functions/fnc_filterVests.sqf b/addons/inventory/functions/fnc_filterVests.sqf new file mode 100644 index 0000000000..646e23d04d --- /dev/null +++ b/addons/inventory/functions/fnc_filterVests.sqf @@ -0,0 +1,17 @@ +/* + * Author: commy2 + * Filter condition for the Vests filter list + * + * Arguments: + * 0: Item config entry + * + * Return Value: + * Item should appear in this list? + * + * Public: No + */ +#include "script_component.hpp" + +params ["_config"]; + +getNumber (_config >> "ItemInfo" >> "type") == TYPE_VEST diff --git a/addons/inventory/functions/fnc_filterWeapons.sqf b/addons/inventory/functions/fnc_filterWeapons.sqf new file mode 100644 index 0000000000..94a92814ae --- /dev/null +++ b/addons/inventory/functions/fnc_filterWeapons.sqf @@ -0,0 +1,15 @@ +/* + * Author: commy2 + * Remove backpacks from Weapons filter. + * + * Arguments: + * 0: Item config entry + * + * Return Value: + * Item should appear in this list? + * + * Public: No + */ +#include "script_component.hpp" + +!(_this call FUNC(filterBackpacks)) diff --git a/addons/inventory/functions/fnc_forceItemListUpdate.sqf b/addons/inventory/functions/fnc_forceItemListUpdate.sqf new file mode 100644 index 0000000000..89142b99ff --- /dev/null +++ b/addons/inventory/functions/fnc_forceItemListUpdate.sqf @@ -0,0 +1,40 @@ +/* + * Author: commy2 + * Updates item list and removes every entry that does not fit in the currently selected filter list. + * + * Arguments: + * 0: Inventory display + * + * Return Value: + * None + * + * Public: No + */ +#include "script_component.hpp" + +disableSerialization; +params ["_display"]; + +private _index = GVAR(selectedFilterIndex); +private _itemList = _display call FUNC(currentItemListBox); +private _filterFunction = missionNamespace getVariable ((_display displayCtrl IDC_FILTERLISTS) lbData _index); + +if (_filterFunction isEqualType {}) then { + private _i = 0; + + while {_i < lbSize _itemList} do { + private _config = uiNamespace getVariable [ + format [QGVAR(ItemKey:%1:%2), _itemList lbText _i, _itemList lbPicture _i], + configNull + ]; + + if (!isNull _config && {!(_config call _filterFunction)}) then { + _itemList lbDelete _i; + + // in case the filter function returns nil. Otherwise could lock up the game. + _i = _i - 1; + }; + + _i = _i + 1; + }; +}; diff --git a/addons/inventory/functions/fnc_inventoryDisplayLoaded.sqf b/addons/inventory/functions/fnc_inventoryDisplayLoaded.sqf new file mode 100644 index 0000000000..6e48c1ec2a --- /dev/null +++ b/addons/inventory/functions/fnc_inventoryDisplayLoaded.sqf @@ -0,0 +1,77 @@ +/* + * Author: commy2 + * Executed every time an inventory display is opened. + * + * Arguments: + * 0: Inventory display + * + * Return Value: + * None + * + * Public: No + */ +#include "script_component.hpp" + +disableSerialization; +params ["_display"]; + +private _filter = _display displayCtrl IDC_FILTERLISTS; + +// engine defined behaviour is the following: +// lb value, data and text don't matter, only the index. +// the first three indecies are hard coded: 0 - weapons , 1 - magazines, 2 - items +// all of them show backpacks, because BI +// all other indecies show everything, so all we have to do is delete stuff we dont like +_filter ctrlAddEventHandler ["LBSelChanged", {_this call FUNC(onLBSelChanged)}]; + +// have to add these a frame later, because this event happens before the engine adds the default filters +[{ + disableSerialization; + params ["_filter"]; + + // remove "All", so we can push it to the back later. + // to keep localization we can keep the lbText (displayed name). + private _index = lbSize _filter - 1; + private _nameAll = _filter lbText _index; + _filter lbDelete _index; + + // add additional filter functions to the default filters. These remove backpacks etc. + _filter lbSetData [0, QFUNC(filterWeapons)]; + _filter lbSetData [1, QFUNC(filterMagazines)]; + _filter lbSetData [2, QFUNC(filterItems)]; + + // add our custom filters + { + _x params ["_name", "_fncName"]; + + _index = _filter lbAdd _name; + _filter lbSetData [_index, _fncName]; + + false + } count GVAR(customFilters); + + // readd "All" filter to last position and select it + _index = _filter lbAdd _nameAll; + _filter lbSetCurSel _index; +}, [_filter]] call EFUNC(common,execNextFrame); + +// monitor changes that can happen and force our update +private _dummyControl = _display ctrlCreate ["RscMapControl", -1]; + +_dummyControl ctrlSetPosition [0,0,0,0]; +_dummyControl ctrlCommit 0; + +_dummyControl ctrlAddEventHandler ["Draw", { + disableSerialization; + params ["_dummyControl"]; + + private _display = ctrlParent _dummyControl; + + private _itemList = _display call FUNC(currentItemListBox); + + // monitoring is done by setting a lb value. These are unused here and are reset every time the list box updates. + if (_itemList lbValue 0 != DUMMY_VALUE) then { + _display call FUNC(forceItemListUpdate); + _itemList lbSetValue [0, DUMMY_VALUE]; + }; +}]; diff --git a/addons/inventory/functions/fnc_onLBSelChanged.sqf b/addons/inventory/functions/fnc_onLBSelChanged.sqf new file mode 100644 index 0000000000..61e4b12b10 --- /dev/null +++ b/addons/inventory/functions/fnc_onLBSelChanged.sqf @@ -0,0 +1,27 @@ +/* + * Author: commy2 + * Executed when the filter list box is changed. + * Sets new filter list index. + * + * Arguments: + * 0: Filter list box + * 1: Filter list index + * + * Return Value: + * None + * + * Public: No + */ +#include "script_component.hpp" + +disableSerialization; +params ["_filter", "_index"]; + +GVAR(selectedFilterIndex) = _index; + +[{ + disableSerialization; + params ["_display"]; + + [_display] call FUNC(forceItemListUpdate); +}, [ctrlParent _filter]] call EFUNC(common,execNextFrame); diff --git a/addons/inventory/functions/script_component.hpp b/addons/inventory/functions/script_component.hpp new file mode 100644 index 0000000000..07c5e38d2d --- /dev/null +++ b/addons/inventory/functions/script_component.hpp @@ -0,0 +1 @@ +#include "\z\ace\addons\inventory\script_component.hpp" \ No newline at end of file diff --git a/addons/inventory/script_component.hpp b/addons/inventory/script_component.hpp index 248f324b36..b013e08570 100644 --- a/addons/inventory/script_component.hpp +++ b/addons/inventory/script_component.hpp @@ -2,11 +2,20 @@ #include "\z\ace\addons\main\script_mod.hpp" #ifdef DEBUG_ENABLED_INVENTORY - #define DEBUG_MODE_FULL + #define DEBUG_MODE_FULL #endif #ifdef DEBUG_SETTINGS_INVENTORY - #define DEBUG_SETTINGS DEBUG_SETTINGS_INVENTORY + #define DEBUG_SETTINGS DEBUG_SETTINGS_INVENTORY #endif #include "\z\ace\addons\main\script_macros.hpp" + +#define IDC_FILTERLISTS 6554 +#define IDC_ITEMLIST_GROUND 632 +#define IDC_ITEMLIST_SOLDIER 640 +#define IDC_ITEMLIST_UNIFORM 633 +#define IDC_ITEMLIST_VEST 638 +#define IDC_ITEMLIST_BACKPACK 619 + +#define DUMMY_VALUE 127 diff --git a/addons/inventory/stringtable.xml b/addons/inventory/stringtable.xml index 04cac46b87..af21fe3ddf 100644 --- a/addons/inventory/stringtable.xml +++ b/addons/inventory/stringtable.xml @@ -25,5 +25,33 @@ Normalmente il menù inventario è scalato in base alle dimensioni interfaccia. Questa opzione di permette di ingrandirlo ulteriormente ma senza aumentare la dimensione del testo. Normalmente o tamanho da tela do inventário é ditada pelo tamanho da UI. Isso permite aumentar o tamanho da tela de inventário, mas não aumenta o tamanho da fonte, permitindo que mais linhas sejam visualizadas. + + Backpacks + Rucksäcke + + + Headgear + Kopfbedeckungen + + + Glasses + Brillen + + + Uniforms + Uniformen + + + Vests + Westen + + + Grenades + Granaten + + + Medical + Sanimaterial + diff --git a/addons/laser_selfdesignate/XEH_post_init.sqf b/addons/laser_selfdesignate/XEH_post_init.sqf index 6904ee6c47..dc30361926 100644 --- a/addons/laser_selfdesignate/XEH_post_init.sqf +++ b/addons/laser_selfdesignate/XEH_post_init.sqf @@ -1,3 +1,2 @@ #include "script_component.hpp" -NO_DEDICATED; diff --git a/addons/laserpointer/functions/fnc_drawLaserpoint.sqf b/addons/laserpointer/functions/fnc_drawLaserpoint.sqf index 29befe96cd..3ea9ed158b 100644 --- a/addons/laserpointer/functions/fnc_drawLaserpoint.sqf +++ b/addons/laserpointer/functions/fnc_drawLaserpoint.sqf @@ -81,7 +81,7 @@ _camPos = AGLToASL _camPos; if (terrainIntersectASL [_camPos, _pL2]) exitWith {}; if (lineIntersects [_camPos, _pL2]) exitWith {}; -private _size = 2 * (_range - (positionCameraToWorld [0,0,0] vectorDistance _pL)) / _range; +private _size = 2 * sqrt (1 / _distance) * (call EFUNC(common,getZoom)); drawIcon3D [ format ["\a3\weapons_f\acc\data\collimdot_%1_ca.paa", ["red", "green"] select _isGreen], diff --git a/addons/main/script_macros.hpp b/addons/main/script_macros.hpp index 62d0b33a6c..fdb020c114 100644 --- a/addons/main/script_macros.hpp +++ b/addons/main/script_macros.hpp @@ -38,25 +38,48 @@ #define MACRO_ADDWEAPON(WEAPON,COUNT) class _xx_##WEAPON { \ - weapon = #WEAPON; \ - count = COUNT; \ + weapon = #WEAPON; \ + count = COUNT; \ } #define MACRO_ADDITEM(ITEM,COUNT) class _xx_##ITEM { \ - name = #ITEM; \ - count = COUNT; \ + name = #ITEM; \ + count = COUNT; \ } #define MACRO_ADDMAGAZINE(MAGAZINE,COUNT) class _xx_##MAGAZINE { \ - magazine = #MAGAZINE; \ - count = COUNT; \ + magazine = #MAGAZINE; \ + count = COUNT; \ } #define MACRO_ADDBACKPACK(BACKPACK,COUNT) class _xx_##BACKPACK { \ - backpack = #BACKPACK; \ - count = COUNT; \ + backpack = #BACKPACK; \ + count = COUNT; \ } +// item types +#define TYPE_DEFAULT 0 +#define TYPE_MUZZLE 101 +#define TYPE_OPTICS 201 +#define TYPE_FLASHLIGHT 301 +#define TYPE_BIPOD 302 +#define TYPE_FIRST_AID_KIT 401 +#define TYPE_FINS 501 // not implemented +#define TYPE_BREATHING_BOMB 601 // not implemented +#define TYPE_NVG 602 +#define TYPE_GOGGLE 603 +#define TYPE_SCUBA 604 // not implemented +#define TYPE_HEADGEAR 605 +#define TYPE_FACTOR 607 +#define TYPE_RADIO 611 +#define TYPE_HMD 616 +#define TYPE_BINOCULAR 617 +#define TYPE_MEDIKIT 619 +#define TYPE_TOOLKIT 620 +#define TYPE_UAV_TERMINAL 621 +#define TYPE_VEST 701 +#define TYPE_UNIFORM 801 +#define TYPE_BACKPACK 901 #ifdef DISABLE_COMPILE_CACHE #define PREP(fncName) DFUNC(fncName) = compile preprocessFileLineNumbers QUOTE(PATHTOF(functions\DOUBLES(fnc,fncName).sqf)) diff --git a/addons/main/script_mod.hpp b/addons/main/script_mod.hpp index 91041e1f4c..912736c264 100644 --- a/addons/main/script_mod.hpp +++ b/addons/main/script_mod.hpp @@ -5,7 +5,7 @@ #define MAJOR 3 #define MINOR 4 -#define PATCHLVL 1 +#define PATCHLVL 2 #define BUILD 0 #define VERSION MAJOR.MINOR.PATCHLVL.BUILD diff --git a/addons/map/functions/fnc_determineMapLight.sqf b/addons/map/functions/fnc_determineMapLight.sqf index d023573cd9..9712b84515 100644 --- a/addons/map/functions/fnc_determineMapLight.sqf +++ b/addons/map/functions/fnc_determineMapLight.sqf @@ -73,7 +73,7 @@ _vehicle = vehicle _unit; // Do not obscure the map if the player is on a enclosed vehicle (assume internal illumination) if (_vehicle != _unit) then { // Player is in a vehicle - if (isTurnedOut _unit && { _vehicle isKindOf "Tank" || { ( _vehicle isKindOf "Helicopter" || _vehicle isKindOf "Plane" ) && { (driver _vehicle) == _unit || { (gunner _vehicle) == _unit } } } || {_vehicle isKindOf "Wheeled_APC"}}) then { + if (!isTurnedOut _unit && { _vehicle isKindOf "Tank" || { ( _vehicle isKindOf "Helicopter" || _vehicle isKindOf "Plane" ) && { (driver _vehicle) == _unit || { (gunner _vehicle) == _unit } } } || {_vehicle isKindOf "Wheeled_APC"}}) then { _isEnclosed = true; }; }; diff --git a/addons/map/stringtable.xml b/addons/map/stringtable.xml index e7b55c56b0..a7eb5482e2 100644 --- a/addons/map/stringtable.xml +++ b/addons/map/stringtable.xml @@ -14,9 +14,9 @@ Map illumination? + Kartenbeleuchtung Oświetlenie mapy ¿Iluminación de mapa? - Kartenausleuchtung Osvětlení mapy Iluminação do mapa? Luminosité @@ -25,6 +25,7 @@ Simulate map lighting based on ambient lighting and player's items? + Simuliere Kartenbeleuchtung auf Basis des Umgebungslichts sowie der mitgeführten Gegenstände? Symuluj oświetlenie mapy bazujące na oświetleniu otoczenia oraz przedmiotach gracza? Calcul la luminosité de la carte en fonction des conditions de lumière Симулировать освещение карты на основе окружающего света и приборов игрока? @@ -33,6 +34,7 @@ Map flashlight glow? + Kartenbeleuchtung durch Dritte erkennbar Poświata latarki Свет фонаря на карте? Brilho de lanterna no mapa? @@ -40,6 +42,7 @@ Add external glow to players who use flashlight on map? + Kartenbeleuchtung mittels Taschenlampe durch Dritte erkennbar? Pokaż poświatę światła latarki na graczu, który używa latarki na widoku mapy? Добавить свет при использовании фонаря на карте? Adicionar brilho externo para jogadores que usam lanterna no mapa? @@ -71,7 +74,7 @@ Limit map zoom? Ograniczony zoom ¿Limitar el zoom de mapa? - Kartenzoom einschränken + Kartenvergrößerung einschränken Omezit přiblížení mapy? Limitar zoom do mapa? Limiter le zoom de la carte? @@ -82,7 +85,7 @@ Limit the amount of zoom available for the map? Ogranicza maksymalny stopień przybliżenia mapy Limita la cantidad de zoom disponible para el mapa - Zoomstufe der Karte einschränken? + Schränkt die maximale Kartenvergrößerung ein. Omezit stupeň přiblížení pro mapu? Limitar a quantidade de zoom disponível para o mapa? Limite le zoom maximum pour la carte? @@ -93,7 +96,7 @@ Show cursor coordinates? Koordynaty pod kursorem ¿Mostrar coordenadas de cursor? - Zeige Cursor-Koordinaten? + Zeige Mauszeiger-Koordinaten? Zobrazit souřadnice u kurzoru? Mostrar coordenadas no cursor? Afficher les coordonnées sur le curseur? @@ -135,6 +138,7 @@ BFT Enable + BFT aktivieren RFA ativo Aktywuj BFT Povolit BFT @@ -145,6 +149,7 @@ Enable Blue Force Tracking. Default: No + Aktiviert Blue Force Tracking. Standard: Nein Ativa Rastreio de Forças Azuis. Padrão: Não Aktywuj Blue Force Tracking. Domyślnie: Nie Povolit Blue Force Tracking. Výchozí: Ne @@ -210,6 +215,7 @@ Flashlights + Taschenlampen Latarki Lanternas Фонари @@ -218,6 +224,7 @@ NVG + NSG Noktowizja Óculos de Visão Noturna ПНВ @@ -226,6 +233,7 @@ On + Ein Włącz Ligado Вкл. @@ -234,6 +242,7 @@ Off + Aus Wyłącz Desligado Выкл. @@ -242,6 +251,7 @@ Increase Brightness + Erhöhe Helligkeit Zwiększ czułość Aumentar brilho Увеличить яркость @@ -250,6 +260,7 @@ Decrease Brightness + Veringere Helligkeit Zmniejsz czułość Diminuir brilho Уменьшить яркость @@ -282,15 +293,17 @@ Set Channel At Start + Setzt Kanal am Spielstart Ust. domyślny kanał Definir canal no início Установить канал на старте Change the starting marker channel at mission start + Setzt den Chat/Markierungskanal am Missionsstart Ustaw domyślny kanał dla markerów przy starcie misji Muda o canal do marcador no início da missão Изменить начальный канал для установки маркеров при запуске миссии - \ No newline at end of file + diff --git a/addons/maptools/functions/fnc_handleMouseButton.sqf b/addons/maptools/functions/fnc_handleMouseButton.sqf index 19869ee3ce..cb1a4598ad 100644 --- a/addons/maptools/functions/fnc_handleMouseButton.sqf +++ b/addons/maptools/functions/fnc_handleMouseButton.sqf @@ -44,7 +44,7 @@ if (_dir != 1) then { deleteMarkerLocal (GVAR(drawing_tempLineMarker) select 0); ["drawing_addLineMarker", GVAR(drawing_tempLineMarker)] call EFUNC(common,globalEvent); // Log who drew on the briefing screen - (text format ["[ACE] Server: Player %1 drew on the briefing screen", profileName]) call EFUNC(common,serverLog); + [ACE_INFOFORMAT_1("Player %1 drew on the briefing screen", profileName)] call EFUNC(common,serverLog); } else { GVAR(drawing_tempLineMarker) call FUNC(updateLineMarker); GVAR(drawing_lineMarkers) pushBack (+GVAR(drawing_tempLineMarker)); diff --git a/addons/markers/CfgEventHandlers.hpp b/addons/markers/CfgEventHandlers.hpp index e75956f440..0cd959a047 100644 --- a/addons/markers/CfgEventHandlers.hpp +++ b/addons/markers/CfgEventHandlers.hpp @@ -1,3 +1,4 @@ + class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); diff --git a/addons/markers/InsertMarker.hpp b/addons/markers/InsertMarker.hpp index 82712fa8f1..5d7cc987e2 100644 --- a/addons/markers/InsertMarker.hpp +++ b/addons/markers/InsertMarker.hpp @@ -1,3 +1,4 @@ + class RscPicture; class RscText; class RscStructuredText; @@ -12,21 +13,9 @@ class RscXSliderH; class RscDisplayInsertMarker { onLoad = QUOTE(_this call DFUNC(initInsertMarker);); onUnload = QUOTE(_this call DFUNC(placeMarker);); - // idd = 54; movingEnable = 1; - class controlsBackground { - // class RscText_1000: RscText {idc = 1000;}; - }; - class controls { - // class ButtonMenuOK: RscButtonMenuOK {idc = 1;}; - // class ButtonMenuCancel: RscButtonMenuCancel {idc = 2;}; - // class Title: RscText {idc = 1001;}; - // class Description: RscStructuredText {idc = 1100;}; - // class DescriptionChannel: RscStructuredText {idc = 1101;}; - // class MarkerPicture: RscPicture {idc = 102;}; - // class MarkerText: RscEdit {idc = 101;}; - // class MarkerChannel: RscCombo {idc = 103;}; + class controls { class MarkerShape: RscCombo { idc = 1210; }; @@ -39,22 +28,5 @@ class RscDisplayInsertMarker { class MarkerAngleText: RscText { idc = 1221; }; - - /*class SizeX: RscEdit { - idc = 1200; - text = "10"; - x = "14 * ( ((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX)"; - y = "12.5 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + safezoneH - ( ((safezoneW / safezoneH) min 1.2) / 1.2))"; - w = "5 * ( ((safezoneW / safezoneH) min 1.2) / 40)"; - h = "1 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - }; - class SizeY: RscEdit { - idc = 1201; - text = "10"; - x = "19 * ( ((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX)"; - y = "12.5 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + safezoneH - ( ((safezoneW / safezoneH) min 1.2) / 1.2))"; - w = "5 * ( ((safezoneW / safezoneH) min 1.2) / 40)"; - h = "1 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - };*/ }; }; diff --git a/addons/markers/XEH_postInit.sqf b/addons/markers/XEH_postInit.sqf index ecb4d579fe..f7bf35093c 100644 --- a/addons/markers/XEH_postInit.sqf +++ b/addons/markers/XEH_postInit.sqf @@ -9,14 +9,13 @@ // request marker data for JIP if (isMultiplayer && {!isServer} && {hasInterface}) then { - private "_logic"; - _logic = createGroup sideLogic createUnit ["Logic", [0,0,0], [], 0, "NONE"]; + private _logic = createGroup sideLogic createUnit ["Logic", [0,0,0], [], 0, "NONE"]; + [QGVAR(sendMarkersJIP), [_logic]] call EFUNC(common,serverEvent); }; - GVAR(mapDisplaysWithDrawEHs) = []; GVAR(currentMarkerPosition) = []; GVAR(currentMarkerAngle) = 0; GVAR(currentMarkerColorConfigName) = ""; -GVAR(currentMarkerConfigName) = ""; \ No newline at end of file +GVAR(currentMarkerConfigName) = ""; diff --git a/addons/markers/XEH_preInit.sqf b/addons/markers/XEH_preInit.sqf index 2105ee4a6a..477632d225 100644 --- a/addons/markers/XEH_preInit.sqf +++ b/addons/markers/XEH_preInit.sqf @@ -2,8 +2,10 @@ ADDON = false; +PREP(getEnabledChannels); PREP(initInsertMarker); PREP(mapDrawEH); +PREP(onLBSelChangedChannel); PREP(onLBSelChangedColor); PREP(onLBSelChangedShape); PREP(onSliderPosChangedAngle); @@ -12,19 +14,19 @@ PREP(sendMarkersJIP); PREP(setMarkerJIP); PREP(setMarkerNetwork); -private ["_config", "_marker", "_a", "_scope", "_icon", "_rgba", "_name"]; - // init marker types if (isNil QGVAR(MarkersCache)) then { - _config = configFile >> "CfgMarkers"; GVAR(MarkersCache) = []; + private _config = configfile >> "CfgMarkers"; + for "_a" from 0 to (count _config - 1) do { - _marker = _config select _a; - _scope = getNumber (_marker >> "scope"); - if (_scope == 2) then { - _name = getText (_marker >> "name"); - _icon = getText (_marker >> "icon"); + private _marker = _config select _a; + + if (getNumber (_marker >> "scope") == 2) then { + private _name = getText (_marker >> "name"); + private _icon = getText (_marker >> "icon"); + GVAR(MarkersCache) pushBack [_name, _a, _icon]; }; }; @@ -32,22 +34,25 @@ if (isNil QGVAR(MarkersCache)) then { // init marker colors if (isNil QGVAR(MarkerColorsCache)) then { - _config = configFile >> "CfgMarkerColors"; GVAR(MarkerColorsCache) = []; + private _config = configfile >> "CfgMarkerColors"; + for "_a" from 0 to (count _config - 1) do { - _marker = _config select _a; - _scope = getNumber (_marker >> "scope"); - if (_scope == 2) then { - _name = getText (_marker >> "name"); - _rgba = getArray (_marker >> "color"); + private _marker = _config select _a; + + if (getNumber (_marker >> "scope") == 2) then { + private _name = getText (_marker >> "name"); + private _rgba = getArray (_marker >> "color"); + { - if (!( _x isEqualType 0)) then { + if !( _x isEqualType 0) then { _rgba set [_forEachIndex, call compile _x]; }; } forEach _rgba; + _rgba params ["_red", "_green", "_blue", "_alpha"]; - _icon = format ["#(argb,8,8,3)color(%1,%2,%3,%4)", _red, _green, _blue, _alpha]; + private _icon = format ["#(argb,8,8,3)color(%1,%2,%3,%4)", _red, _green, _blue, _alpha]; GVAR(MarkerColorsCache) pushBack [_name, _a, _icon]; }; diff --git a/addons/markers/functions/fnc_getEnabledChannels.sqf b/addons/markers/functions/fnc_getEnabledChannels.sqf new file mode 100644 index 0000000000..9a64ff06d4 --- /dev/null +++ b/addons/markers/functions/fnc_getEnabledChannels.sqf @@ -0,0 +1,54 @@ +/* + * Author: commy2 + * Return enabled channels. + * + * Arguments: + * 0: false - use channel id, true - use localized channel names (default: false) + * + * Return Value: + * Enabled Channels + * + * Public: No + */ +#include "script_component.hpp" + +params [["_localize", false, [false]]]; + +private _currentChannel = currentChannel; +private _enabledChannels = []; + +if (_localize) then { + if (setCurrentChannel 0) then { + _enabledChannels pushBack localize "str_channel_global"; + }; + + if (setCurrentChannel 1) then { + _enabledChannels pushBack localize "str_channel_side"; + }; + + if (setCurrentChannel 2) then { + _enabledChannels pushBack localize "str_channel_command"; + }; + + if (setCurrentChannel 3) then { + _enabledChannels pushBack localize "str_channel_group"; + }; + + if (setCurrentChannel 4) then { + _enabledChannels pushBack localize "str_channel_vehicle"; + }; + + if (setCurrentChannel 5) then { + _enabledChannels pushBack localize "str_channel_direct"; + }; +} else { + for "_i" from 0 to 5 do { + if (setCurrentChannel _i) then { + _enabledChannels pushBack _i; + }; + }; +}; + +setCurrentChannel _currentChannel; + +_enabledChannels diff --git a/addons/markers/functions/fnc_initInsertMarker.sqf b/addons/markers/functions/fnc_initInsertMarker.sqf index 07e2bc46c4..08c078c4f5 100644 --- a/addons/markers/functions/fnc_initInsertMarker.sqf +++ b/addons/markers/functions/fnc_initInsertMarker.sqf @@ -16,53 +16,61 @@ */ #include "script_component.hpp" -#define BORDER 0.005 +#define BORDER 0.005 [{ - private ["_text", "_picture", "_channel", "_buttonOK", "_buttonCancel", "_description", "_title", "_descriptionChannel", "_sizeX", "_sizeY", "_aceShapeLB", "_aceColorLB", "_aceAngleSlider", "_aceAngleSliderText", "_mapIDD", "_pos", "_offsetButtons", "_buttonOk", "_curSelShape", "_curSelColor", "_curSelAngle"]; - disableserialization; params ["_display"]; TRACE_1("params",_display); //Can't place markers when can't interact - if (!([ACE_player, objNull, ["notOnMap", "isNotInside", "isNotSitting"]] call EFUNC(common,canInteractWith))) exitWith { + if !([ACE_player, objNull, ["notOnMap", "isNotInside", "isNotSitting"]] call EFUNC(common,canInteractWith)) exitWith { _display closeDisplay 2; //emulate "Cancel" button }; //BIS Controls: - _text = _display displayctrl 101; - _picture = _display displayctrl 102; - _channel = _display displayctrl 103; - _buttonOK = _display displayctrl 1; - _buttonCancel = _display displayctrl 2; - _description = _display displayctrl 1100; - _title = _display displayctrl 1001; - _descriptionChannel = _display displayctrl 1101; + private _text = _display displayctrl 101; + private _picture = _display displayctrl 102; + private _channel = _display displayctrl 103; + private _buttonOK = _display displayctrl 1; + private _buttonCancel = _display displayctrl 2; + private _description = _display displayctrl 1100; + private _title = _display displayctrl 1001; + private _descriptionChannel = _display displayctrl 1101; //ACE Controls: // _sizeX = _display displayctrl 1200; // _sizeY = _display displayctrl 1201; - _aceShapeLB = _display displayctrl 1210; - _aceColorLB = _display displayctrl 1211; - _aceAngleSlider = _display displayctrl 1220; - _aceAngleSliderText = _display displayctrl 1221; + private _aceShapeLB = _display displayctrl 1210; + private _aceColorLB = _display displayctrl 1211; + private _aceAngleSlider = _display displayctrl 1220; + private _aceAngleSliderText = _display displayctrl 1221; + //////////////////// + // Install MapDrawEH on current map + private _mapIDD = -1; - //Install MapDrawEH on current map - _mapIDD = -1; { - if (!isNull (findDisplay _x)) exitWith {_mapIDD = _x}; - } forEach [12, 37, 52, 53, 160]; - if (_mapIDD == -1) exitWith {ERROR("No Map?");}; - if (!(_mapIDD in GVAR(mapDisplaysWithDrawEHs))) then { - GVAR(mapDisplaysWithDrawEHs) pushBack _mapIDD; - ((finddisplay _mapIDD) displayctrl 51) ctrlAddEventHandler ["Draw", {_this call FUNC(mapDrawEH)}]; + if (!isNull (findDisplay _x)) exitWith { + _mapIDD = _x; + }; + false + } count [12, 37, 52, 53, 160]; + + if (_mapIDD == -1) exitWith { + ERROR("No Map?"); }; - //Calculate center position of the marker placement ctrl - _pos = ctrlPosition _picture; + if !(_mapIDD in GVAR(mapDisplaysWithDrawEHs)) then { + GVAR(mapDisplaysWithDrawEHs) pushBack _mapIDD; + ((finddisplay _mapIDD) displayctrl 51) ctrlAddEventHandler ["Draw", {_this call FUNC(mapDrawEH)}]; // @todo check if persistent + }; + + //////////////////// + // Calculate center position of the marker placement ctrl + private _pos = ctrlPosition _picture; _pos = [(_pos select 0) + (_pos select 2) / 2, (_pos select 1) + (_pos select 3) / 2]; + GVAR(currentMarkerPosition) = ((findDisplay _mapIDD) displayCtrl 51) ctrlMapScreenToWorld _pos; //Hide the bis picture: @@ -77,98 +85,116 @@ //--- Background _pos = ctrlposition _text; - _pos params ["_posX", "_posY", "_posW", "_posH"]; + _pos params ["_posX", "_posY", "_posW", "_posH"]; _posX = _posX + 0.01; _posY = _posY min ((safeZoneH + safeZoneY) - (8 * _posH + 8 * BORDER)); //prevent buttons being placed below bottom edge of screen - _pos set [0,_posX]; - _pos set [1,_posY]; - _text ctrlsetposition _pos; - _text ctrlcommit 0; + _pos set [0, _posX]; + _pos set [1, _posY]; + _text ctrlSetPosition _pos; + _text ctrlCommit 0; //--- Title - _pos set [1,_posY - 2*_posH - BORDER]; - _pos set [3,_posH]; - _title ctrlsetposition _pos; - _title ctrlcommit 0; + _pos set [1, _posY - 2 * _posH - BORDER]; + _pos set [3, _posH]; + _title ctrlSetPosition _pos; + _title ctrlCommit 0; //--- Description - _pos set [1,_posY - 1*_posH]; - _pos set [3,6*_posH + 6 * BORDER]; - _description ctrlenable false; - _description ctrlsetposition _pos; - _description ctrlsetstructuredtext parsetext format ["%1", (localize "str_lib_label_description")]; - _description ctrlcommit 0; + _pos set [1, _posY - 1 * _posH]; + _pos set [3,6 * _posH + 6 * BORDER]; + _description ctrlEnable false; + _description ctrlSetPosition _pos; + _description ctrlSetStructuredText parseText format ["%1", localize "str_lib_label_description"]; + _description ctrlCommit 0; //--- Shape - _pos set [1,_posY + 1 * _posH + 2 * BORDER]; - _pos set [2,_posW]; - _pos set [3,_posH]; - _aceShapeLB ctrlsetposition _pos; - _aceShapeLB ctrlcommit 0; + _pos set [1, _posY + 1 * _posH + 2 * BORDER]; + _pos set [2, _posW]; + _pos set [3, _posH]; + _aceShapeLB ctrlSetPosition _pos; + _aceShapeLB ctrlCommit 0; //--- Color - _pos set [1,_posY + 2 * _posH + 3 * BORDER]; - _pos set [2,_posW]; - _aceColorLB ctrlsetposition _pos; - _aceColorLB ctrlcommit 0; + _pos set [1, _posY + 2 * _posH + 3 * BORDER]; + _pos set [2, _posW]; + _aceColorLB ctrlSetPosition _pos; + _aceColorLB ctrlCommit 0; //--- Angle - _pos set [1,_posY + 3 * _posH + 4 * BORDER]; - _pos set [2,_posW]; - _aceAngleSlider ctrlsetposition _pos; - _aceAngleSlider ctrlcommit 0; + _pos set [1, _posY + 3 * _posH + 4 * BORDER]; + _pos set [2, _posW]; + _aceAngleSlider ctrlSetPosition _pos; + _aceAngleSlider ctrlCommit 0; //--- Angle Text - _pos set [1,_posY + 4 * _posH + 5 * BORDER]; - _pos set [2,_posW]; - _aceAngleSliderText ctrlsetposition _pos; - _aceAngleSliderText ctrlcommit 0; + _pos set [1, _posY + 4 * _posH + 5 * BORDER]; + _pos set [2, _posW]; + _aceAngleSliderText ctrlSetPosition _pos; + _aceAngleSliderText ctrlCommit 0; + + private _offsetButtons = 0; - _offsetButtons = 0; if (isMultiplayer) then { _pos set [1,_posY + 5 * _posH + 7 * BORDER]; _pos set [3,_posH]; - _descriptionChannel ctrlsetstructuredtext parsetext format ["%1", (localize "str_a3_cfgvehicles_modulerespawnposition_f_arguments_marker_0") + ":"]; - _descriptionChannel ctrlsetposition _pos; - _descriptionChannel ctrlcommit 0; + _descriptionChannel ctrlSetStructuredText parseText format ["%1:", localize "str_a3_cfgvehicles_modulerespawnposition_f_arguments_marker_0"]; + _descriptionChannel ctrlSetPosition _pos; + _descriptionChannel ctrlCommit 0; _pos set [1,_posY + 6 * _posH + 7 * BORDER]; _pos set [3,_posH]; - _channel ctrlsetposition _pos; - _channel ctrlcommit 0; + _channel ctrlSetPosition _pos; + _channel ctrlCommit 0; + + // channels are added by engine and not script. we have to manually delete them. requires channel names to be unique? + private _enabledChannels = true call FUNC(getEnabledChannels); + private _i = 0; + + while {_i < lbSize _channel} do { + private _channelName = _channel lbText _i; + + // _enabledChannels can not include custom channels names. Therefore also check if it's a custom one. Blame BI if the unit should not access the channel. + if (_channelName in _enabledChannels || {!(_channelName in CHANNEL_NAMES)}) then { + _i = _i + 1; + } else { + _channel lbDelete _i; + }; + }; + + private _currentChannelName = CHANNEL_NAMES param [currentChannel, localize "str_channel_group"]; + + // select current channel in list box, must be done after lbDelete + for "_j" from 0 to (lbSize _channel - 1) do { + if (_channel lbText _j == _currentChannelName) then { + _channel lbSetCurSel _j; + }; + }; + + _channel ctrlAddEventHandler ["LBSelChanged", {_this call FUNC(onLBSelChangedChannel)}]; + _offsetButtons = 7 * _posH + 8 * BORDER; } else { - _descriptionChannel ctrlshow false; - _channel ctrlshow false; + _descriptionChannel ctrlShow false; + _channel ctrlShow false; _offsetButtons = 5 * _posH + 7 * BORDER; }; //--- ButtonOK - _pos set [1,_posY + _offsetButtons]; - _pos set [2,_posW / 2 - BORDER]; - _pos set [3,_posH]; - _buttonOk ctrlsetposition _pos; - _buttonOk ctrlcommit 0; + _pos set [1, _posY + _offsetButtons]; + _pos set [2, _posW / 2 - BORDER]; + _pos set [3, _posH]; + _buttonOk ctrlSetPosition _pos; + _buttonOk ctrlCommit 0; //--- ButtonCancel - _pos set [0,_posX + _posW / 2]; - _pos set [1,_posY + _offsetButtons]; - _pos set [2,_posW / 2]; - _pos set [3,_posH]; - _buttonCancel ctrlsetposition _pos; - _buttonCancel ctrlcommit 0; - - //--- PositionX - /*_pos set [1,_posY + 2 * _posH + 3 * BORDER]; - _sizeX ctrlsetposition _pos; - _sizeX ctrlcommit 0;*/ - - //--- PositionY - /*_pos set [1,_posY + 2 * _posH + 3 * BORDER]; - _sizeY ctrlsetposition _pos; - _sizeY ctrlcommit 0;*/ - + _pos set [0, _posX + _posW / 2]; + _pos set [1, _posY + _offsetButtons]; + _pos set [2, _posW / 2]; + _pos set [3, _posH]; + _buttonCancel ctrlSetPosition _pos; + _buttonCancel ctrlCommit 0; + //////////////////// // init marker shape lb lbClear _aceShapeLB; { @@ -177,14 +203,15 @@ _aceShapeLB lbSetValue [_forEachIndex, _set]; _aceShapeLB lbSetPicture [_forEachIndex, _pic]; } forEach GVAR(MarkersCache); - _curSelShape = GETGVAR(curSelMarkerShape,0); + + private _curSelShape = GETGVAR(curSelMarkerShape,0); _aceShapeLB lbSetCurSel _curSelShape; //Update now and add eventHandler: [_aceShapeLB, _curSelShape] call FUNC(onLBSelChangedShape); _aceShapeLB ctrlAddEventHandler ["LBSelChanged", {_this call FUNC(onLBSelChangedShape)}]; - + //////////////////// // init marker color lb lbClear _aceColorLB; { @@ -193,20 +220,22 @@ _aceColorLB lbSetValue [_forEachIndex, _set]; _aceColorLB lbSetPicture [_forEachIndex, _pic]; } forEach GVAR(MarkerColorsCache); - _curSelColor = GETGVAR(curSelMarkerColor,0); + + private _curSelColor = GETGVAR(curSelMarkerColor,0); _aceColorLB lbSetCurSel _curSelColor; //Update now and add eventHandler: [_aceColorLB, _curSelColor] call FUNC(onLBSelChangedColor); _aceColorLB ctrlAddEventHandler ["LBSelChanged", {_this call FUNC(onLBSelChangedColor)}]; - + //////////////////// // init marker angle slider _aceAngleSlider sliderSetRange [-180, 180]; - _curSelAngle = GETGVAR(currentMarkerAngle,0); + + private _curSelAngle = GETGVAR(currentMarkerAngle,0); _aceAngleSlider sliderSetPosition _curSelAngle; + //Update now and add eventHandler: [_aceAngleSlider, _curSelAngle] call FUNC(onSliderPosChangedAngle); _aceAngleSlider ctrlAddEventHandler ["SliderPosChanged", {_this call FUNC(onSliderPosChangedAngle)}]; - }, _this] call EFUNC(common,execNextFrame); diff --git a/addons/markers/functions/fnc_mapDrawEH.sqf b/addons/markers/functions/fnc_mapDrawEH.sqf index 05ab4f1ed4..7197c90cc7 100644 --- a/addons/markers/functions/fnc_mapDrawEH.sqf +++ b/addons/markers/functions/fnc_mapDrawEH.sqf @@ -15,32 +15,42 @@ */ #include "script_component.hpp" -private ["_sizeX", "_sizeY", "_textureConfig", "_texture", "_markerSize", "_markerShadow", "_colorConfig", "_drawColor"]; - params ["_theMap"]; // TRACE_1("params",_theMap); //Only show if marker place is open: -if (isNull (findDisplay 54)) exitWith {}; +if (isNull findDisplay 54) exitWith {}; //Error checking: -if ((GVAR(currentMarkerConfigName) == "") || {GVAR(currentMarkerColorConfigName) == ""} || {GVAR(currentMarkerPosition) isEqualTo []}) exitWith {ERROR("Bad Data");}; +if (GVAR(currentMarkerConfigName) == "" || {GVAR(currentMarkerColorConfigName) == ""} || {GVAR(currentMarkerPosition) isEqualTo []}) exitWith { + ERROR("Bad Data"); +}; -_sizeX = 1; -_sizeY = 1; +private _sizeX = 1; +private _sizeY = 1; -_textureConfig = configFile >> "CfgMarkers" >> GVAR(currentMarkerConfigName); -_texture = getText (_textureConfig >> "icon"); -_markerSize = getNumber (_textureConfig >> "size"); -_markerShadow = getNumber (_textureConfig >> "shadow"); -_colorConfig = (configFile >> "CfgMarkerColors" >> GVAR(currentMarkerColorConfigName)); -_drawColor = getArray (_colorConfig >> "color"); +private _textureConfig = configFile >> "CfgMarkers" >> GVAR(currentMarkerConfigName); +private _texture = getText (_textureConfig >> "icon"); +private _markerSize = getNumber (_textureConfig >> "size"); +private _markerShadow = getNumber (_textureConfig >> "shadow"); +private _colorConfig = (configFile >> "CfgMarkerColors" >> GVAR(currentMarkerColorConfigName)); +private _drawColor = getArray (_colorConfig >> "color"); //Convert possible code into numbers { if (_x isEqualType "") then { - _drawColor set [_forEachIndex, (call compile _x)]; + _drawColor set [_forEachIndex, call compile _x]; }; } forEach _drawColor; -_drawColor set [3, ((_drawColor select 3) * 0.875)]; //Arma adds a slight transparency -_theMap drawIcon [_texture, _drawColor, GVAR(currentMarkerPosition), (_sizeX * _markerSize), (_sizeY * _markerSize), GVAR(currentMarkerAngle), "", _markerShadow]; +_drawColor set [3, (_drawColor select 3) * 0.875]; //Arma adds a slight transparency + +_theMap drawIcon [ + _texture, + _drawColor, + GVAR(currentMarkerPosition), + _sizeX * _markerSize, + _sizeY * _markerSize, + GVAR(currentMarkerAngle), + "", + _markerShadow +]; diff --git a/addons/markers/functions/fnc_onLBSelChangedChannel.sqf b/addons/markers/functions/fnc_onLBSelChangedChannel.sqf new file mode 100644 index 0000000000..f63c4e5cf4 --- /dev/null +++ b/addons/markers/functions/fnc_onLBSelChangedChannel.sqf @@ -0,0 +1,21 @@ +/* + * Author: commy2 + * When the channel list box is changed. + * + * Arguments: + * 0: Channel ListBox (idc 103) + * 1: Selected Index + * + * Return Value: + * None + * + * Public: No + */ +#include "script_component.hpp" + +params ["_ctrl", "_index"]; +TRACE_2("params",_ctrl,_index); + +private _channelName = _ctrl lbText _index; + +setCurrentChannel (CHANNEL_NAMES find _channelName); diff --git a/addons/markers/functions/fnc_onLBSelChangedColor.sqf b/addons/markers/functions/fnc_onLBSelChangedColor.sqf index 6f0139e327..215cd72580 100644 --- a/addons/markers/functions/fnc_onLBSelChangedColor.sqf +++ b/addons/markers/functions/fnc_onLBSelChangedColor.sqf @@ -16,15 +16,13 @@ */ #include "script_component.hpp" -private ["_data", "_config"]; - params ["_ctrl", "_index"]; TRACE_2("params",_ctrl,_index); -_data = _ctrl lbValue _index; +private _data = _ctrl lbValue _index; GVAR(curSelMarkerColor) = _index; -_config = (configFile >> "CfgMarkerColors") select _data; +private _config = (configFile >> "CfgMarkerColors") select _data; -GVAR(currentMarkerColorConfigName) = (configName _config); +GVAR(currentMarkerColorConfigName) = configName _config; diff --git a/addons/markers/functions/fnc_onLBSelChangedShape.sqf b/addons/markers/functions/fnc_onLBSelChangedShape.sqf index f9fc48730f..41f0f30a0d 100644 --- a/addons/markers/functions/fnc_onLBSelChangedShape.sqf +++ b/addons/markers/functions/fnc_onLBSelChangedShape.sqf @@ -16,15 +16,13 @@ */ #include "script_component.hpp" -private ["_data", "_config"]; - params ["_ctrl", "_index"]; TRACE_2("params",_ctrl,_index); -_data = _ctrl lbValue _index; +private _data = _ctrl lbValue _index; GVAR(curSelMarkerShape) = _index; -_config = (configFile >> "CfgMarkers") select _data; +private _config = (configFile >> "CfgMarkers") select _data; -GVAR(currentMarkerConfigName) = (configName _config); +GVAR(currentMarkerConfigName) = configName _config; diff --git a/addons/markers/functions/fnc_onSliderPosChangedAngle.sqf b/addons/markers/functions/fnc_onSliderPosChangedAngle.sqf index 16c6acfad9..030e2314ab 100644 --- a/addons/markers/functions/fnc_onSliderPosChangedAngle.sqf +++ b/addons/markers/functions/fnc_onSliderPosChangedAngle.sqf @@ -16,12 +16,11 @@ */ #include "script_component.hpp" -private ["_direction"]; - params ["_ctrl", "_data"]; TRACE_2("params",_ctrl,_data); -_direction = round _data; +private _direction = round _data; + if (_direction < 0) then { _direction = _direction + 360; }; diff --git a/addons/markers/functions/fnc_placeMarker.sqf b/addons/markers/functions/fnc_placeMarker.sqf index 36b61151ee..5b0783b454 100644 --- a/addons/markers/functions/fnc_placeMarker.sqf +++ b/addons/markers/functions/fnc_placeMarker.sqf @@ -21,16 +21,15 @@ params ["_display", "_closeNum"]; TRACE_2("params",_display,_closeNum); if (_closeNum == 1) then { - // set and send marker data the next frame. the actual marker isn't created yet [{ [QGVAR(setMarkerNetwork), [ - allMapMarkers select (count allMapMarkers - 1), [ - GETGVAR(currentMarkerConfigName,""), - GETGVAR(currentMarkerColorConfigName,""), - GETGVAR(currentMarkerPosition,[]), - GETGVAR(currentMarkerAngle,0) - ] + allMapMarkers select (count allMapMarkers - 1), [ + GETGVAR(currentMarkerConfigName,""), + GETGVAR(currentMarkerColorConfigName,""), + GETGVAR(currentMarkerPosition,[]), + GETGVAR(currentMarkerAngle,0) + ] ]] call EFUNC(common,globalEvent); }, []] call EFUNC(common,execNextFrame); diff --git a/addons/markers/functions/fnc_setMarkerJIP.sqf b/addons/markers/functions/fnc_setMarkerJIP.sqf index acdda408df..bd8832fb36 100644 --- a/addons/markers/functions/fnc_setMarkerJIP.sqf +++ b/addons/markers/functions/fnc_setMarkerJIP.sqf @@ -21,31 +21,34 @@ params ["_allMapMarkers", "_allMapMarkersProperties", "_logic"]; TRACE_3("params",_allMapMarkers,_allMapMarkersProperties,_logic); { - private ["_index", "_data", "_config"]; - - _index = _allMapMarkers find _x; + private _index = _allMapMarkers find _x; if (_index != -1) then { - _data = _allMapMarkersProperties select _index; - _data params ["_name", "_color", "_pos", "_dir"]; + private _data = _allMapMarkersProperties select _index; + _data params ["_markerClassname", "_colorClassname", "_pos", "_dir"]; + + private _config = (configfile >> "CfgMarkers") >> _markerClassname; - _config = (configFile >> "CfgMarkers") >> _name; if (!isClass _config) then { WARNING("CfgMarker not found, changed to milDot"); - _config == (configFile >> "CfgMarkers" >> "MilDot"); + _config = configFile >> "CfgMarkers" >> "MilDot"; }; - _x setMarkerTypeLocal (configName _config); - _config = (configFile >> "CfgMarkerColors") >> _color; + _x setMarkerTypeLocal configName _config; + + _config = configfile >> "CfgMarkerColors" >> _colorClassname; + if (!isClass _config) then { WARNING("CfgMarkerColors not found, changed to Default"); - _config == (configFile >> "CfgMarkerColors" >> "Default"); + _config = configFile >> "CfgMarkerColors" >> "Default"; }; - _x setMarkerColorLocal (configName _config); + + _x setMarkerColorLocal configName _config; _x setMarkerPosLocal _pos; _x setMarkerDirLocal _dir; }; -} forEach allMapMarkers; + false +} count allMapMarkers; deleteVehicle _logic; diff --git a/addons/markers/functions/fnc_setMarkerNetwork.sqf b/addons/markers/functions/fnc_setMarkerNetwork.sqf index 61a0a74e3a..9d6d2d8ecf 100644 --- a/addons/markers/functions/fnc_setMarkerNetwork.sqf +++ b/addons/markers/functions/fnc_setMarkerNetwork.sqf @@ -17,38 +17,37 @@ */ #include "script_component.hpp" -private ["_config"]; - params ["_marker", "_data"]; -_data params ["_markerClassname", "_colorClassname", "_markerPos", "_markerDir"]; TRACE_2("params",_marker,_data); +_data params ["_markerClassname", "_colorClassname", "_pos", "_dir"]; +private _config = configfile >> "CfgMarkers" >> _markerClassname; -_config = (configFile >> "CfgMarkers") >> _markerClassname; if (!isClass _config) then { WARNING("CfgMarker not found, changed to milDot"); - _config == (configFile >> "CfgMarkers" >> "MilDot"); + _config = configFile >> "CfgMarkers" >> "MilDot"; }; -_marker setMarkerTypeLocal (configName _config); -_config = (configFile >> "CfgMarkerColors") >> _colorClassname; +_marker setMarkerTypeLocal configName _config; + +_config = configfile >> "CfgMarkerColors" >> _colorClassname; + if (!isClass _config) then { WARNING("CfgMarkerColors not found, changed to Default"); - _config == (configFile >> "CfgMarkerColors" >> "Default"); + _config = configFile >> "CfgMarkerColors" >> "Default"; }; + _marker setMarkerColorLocal configName _config; -_marker setMarkerPosLocal _markerPos; -_marker setMarkerDirLocal _markerDir; +_marker setMarkerPosLocal _pos; +_marker setMarkerDirLocal _dir; // save properties on server machine for JIP, marker editing ready if (isMultiplayer && {isServer}) then { - private ["_allMapMarkers", "_allMapMarkersProperties", "_index"]; + private _allMapMarkers = GETGVAR(allMapMarkers,[]); + private _allMapMarkersProperties = GETGVAR(allMapMarkersProperties,[]); - _allMapMarkers = GETGVAR(allMapMarkers,[]); - _allMapMarkersProperties = GETGVAR(allMapMarkersProperties,[]); - - _index = _allMapMarkers find _marker; + private _index = _allMapMarkers find _marker; if (_index == -1) then { _allMapMarkers pushBack _marker; diff --git a/addons/markers/script_component.hpp b/addons/markers/script_component.hpp index 2b1cb586a7..80ffa23b5b 100644 --- a/addons/markers/script_component.hpp +++ b/addons/markers/script_component.hpp @@ -9,4 +9,13 @@ #define DEBUG_SETTINGS DEBUG_ENABLED_MARKERS #endif -#include "\z\ace\addons\main\script_macros.hpp" \ No newline at end of file +#include "\z\ace\addons\main\script_macros.hpp" + +#define CHANNEL_NAMES [ \ + localize "str_channel_global", \ + localize "str_channel_side", \ + localize "str_channel_command", \ + localize "str_channel_group", \ + localize "str_channel_vehicle", \ + localize "str_channel_direct" \ +] diff --git a/addons/medical/ACE_Medical_Actions.hpp b/addons/medical/ACE_Medical_Actions.hpp index 2912c87011..48cf6c87dc 100644 --- a/addons/medical/ACE_Medical_Actions.hpp +++ b/addons/medical/ACE_Medical_Actions.hpp @@ -16,7 +16,6 @@ class ACE_Head { EXCEPTIONS showDisabled = 1; priority = 2; - hotkey = "B"; icon = PATHTOF(UI\icons\bandage.paa); }; // Advanced medical @@ -28,7 +27,6 @@ class ACE_Head { EXCEPTIONS showDisabled = 0; priority = 2; - hotkey = ""; icon = PATHTOF(UI\icons\bandage.paa); }; class PackingBandage: fieldDressing { @@ -95,7 +93,6 @@ class ACE_Torso { EXCEPTIONS showDisabled = 1; priority = 2; - hotkey = "B"; enableInside = 1; icon = PATHTOF(UI\icons\bandage.paa); }; @@ -107,7 +104,6 @@ class ACE_Torso { EXCEPTIONS showDisabled = 1; priority = 2; - hotkey = ""; enableInside = 1; }; class TriageCard { @@ -118,7 +114,6 @@ class ACE_Torso { EXCEPTIONS showDisabled = 1; priority = 2; - hotkey = ""; enableInside = 1; icon = PATHTOF(UI\icons\triageCard.paa); }; @@ -130,7 +125,6 @@ class ACE_Torso { EXCEPTIONS showDisabled = 0; priority = 2; - hotkey = ""; icon = ""; }; @@ -143,7 +137,6 @@ class ACE_Torso { EXCEPTIONS showDisabled = 0; priority = 2; - hotkey = ""; enableInside = 1; icon = PATHTOF(UI\icons\bandage.paa); }; @@ -208,7 +201,6 @@ class ACE_ArmLeft { EXCEPTIONS showDisabled = 1; priority = 2; - hotkey = "B"; icon = PATHTOF(UI\icons\bandage.paa); }; @@ -221,7 +213,6 @@ class ACE_ArmLeft { EXCEPTIONS showDisabled = 0; priority = 2; - hotkey = ""; icon = PATHTOF(UI\icons\bandage.paa); }; class PackingBandage: fieldDressing { @@ -366,7 +357,6 @@ class ACE_ArmRight { EXCEPTIONS showDisabled = 1; priority = 2; - hotkey = "B"; icon = PATHTOF(UI\icons\bandage.paa); }; @@ -379,7 +369,6 @@ class ACE_ArmRight { EXCEPTIONS showDisabled = 0; priority = 2; - hotkey = ""; icon = PATHTOF(UI\icons\bandage.paa); }; class PackingBandage: fieldDressing { @@ -521,7 +510,6 @@ class ACE_LegLeft { EXCEPTIONS showDisabled = 1; priority = 2; - hotkey = "B"; icon = PATHTOF(UI\icons\bandage.paa); }; @@ -535,7 +523,6 @@ class ACE_LegLeft { EXCEPTIONS showDisabled = 0; priority = 2; - hotkey = ""; icon = PATHTOF(UI\icons\bandage.paa); }; class PackingBandage: fieldDressing { @@ -664,7 +651,6 @@ class ACE_LegRight { EXCEPTIONS showDisabled = 1; priority = 2; - hotkey = "B"; icon = PATHTOF(UI\icons\bandage.paa); }; @@ -678,7 +664,6 @@ class ACE_LegRight { EXCEPTIONS showDisabled = 0; priority = 2; - hotkey = ""; icon = PATHTOF(UI\icons\bandage.paa); }; class PackingBandage: fieldDressing { diff --git a/addons/medical/ACE_Medical_SelfActions.hpp b/addons/medical/ACE_Medical_SelfActions.hpp index 0f85930f51..4217e43e91 100644 --- a/addons/medical/ACE_Medical_SelfActions.hpp +++ b/addons/medical/ACE_Medical_SelfActions.hpp @@ -1,7 +1,6 @@ class Medical { displayName = CSTRING(Actions_Medical); runOnHover = 1; - hotkey = "M"; exceptions[] = {"isNotInside", "isNotSitting"}; statement = QUOTE([ARR_3(_target, true, 0)] call DFUNC(displayPatientInformation)); condition = "true"; @@ -24,7 +23,6 @@ class Medical { statement = QUOTE([ARR_4(_player, _target, 'head', 'Bandage')] call DFUNC(treatment)); showDisabled = 1; priority = 2; - hotkey = "B"; icon = PATHTOF(UI\icons\bandage.paa); }; // Advanced medical @@ -36,7 +34,6 @@ class Medical { statement = QUOTE([ARR_4(_player, _target, 'head', 'FieldDressing')] call DFUNC(treatment)); showDisabled = 0; priority = 2; - hotkey = ""; icon = PATHTOF(UI\icons\bandage.paa); }; class PackingBandage: fieldDressing { @@ -84,7 +81,6 @@ class Medical { modifierFunction = QUOTE([ARR_4(_target,_player,1,_this select 3)] call FUNC(modifyMedicalAction)); showDisabled = 1; priority = 2; - hotkey = ""; icon = PATHTOF(UI\icons\medical_cross.paa); class Bandage { @@ -95,7 +91,6 @@ class Medical { statement = QUOTE([ARR_4(_player, _target, 'body', 'Bandage')] call DFUNC(treatment)); showDisabled = 1; priority = 2; - hotkey = "B"; icon = PATHTOF(UI\icons\bandage.paa); }; @@ -107,7 +102,6 @@ class Medical { statement = QUOTE([ARR_2(_target, true)] call DFUNC(displayTriageCard)); showDisabled = 1; priority = 2; - hotkey = ""; icon = PATHTOF(UI\icons\triageCard.paa); }; @@ -120,7 +114,6 @@ class Medical { statement = QUOTE([ARR_4(_player, _target, 'body', 'FieldDressing')] call DFUNC(treatment)); showDisabled = 0; priority = 2; - hotkey = ""; icon = PATHTOF(UI\icons\bandage.paa); }; class PackingBandage: fieldDressing { @@ -162,7 +155,6 @@ class Medical { statement = QUOTE([ARR_4(_player, _target, 'hand_l', 'Bandage')] call DFUNC(treatment)); showDisabled = 1; priority = 2; - hotkey = "B"; icon = PATHTOF(UI\icons\bandage.paa); }; @@ -175,7 +167,6 @@ class Medical { statement = QUOTE([ARR_4(_player, _target, 'hand_l', 'FieldDressing')] call DFUNC(treatment)); showDisabled = 0; priority = 2; - hotkey = ""; icon = PATHTOF(UI\icons\bandage.paa); }; class PackingBandage: fieldDressing { @@ -264,7 +255,6 @@ class Medical { statement = QUOTE([ARR_4(_player, _target, 'hand_r', 'Bandage')] call DFUNC(treatment)); showDisabled = 1; priority = 2; - hotkey = "B"; icon = PATHTOF(UI\icons\bandage.paa); }; @@ -277,7 +267,6 @@ class Medical { statement = QUOTE([ARR_4(_player, _target, 'hand_r', 'FieldDressing')] call DFUNC(treatment)); showDisabled = 0; priority = 2; - hotkey = ""; icon = PATHTOF(UI\icons\bandage.paa); }; class PackingBandage: fieldDressing { @@ -362,7 +351,6 @@ class Medical { statement = QUOTE([ARR_4(_player, _target, 'leg_l', 'Bandage')] call DFUNC(treatment)); showDisabled = 1; priority = 2; - hotkey = "B"; icon = PATHTOF(UI\icons\bandage.paa); }; @@ -376,7 +364,6 @@ class Medical { statement = QUOTE([ARR_4(_player, _target, 'leg_l', 'FieldDressing')] call DFUNC(treatment)); showDisabled = 0; priority = 2; - hotkey = ""; icon = PATHTOF(UI\icons\bandage.paa); }; class PackingBandage: fieldDressing { @@ -449,7 +436,6 @@ class Medical { statement = QUOTE([ARR_4(_player, _target, 'leg_r', 'Bandage')] call DFUNC(treatment)); showDisabled = 1; priority = 2; - hotkey = "B"; icon = PATHTOF(UI\icons\bandage.paa); }; @@ -463,7 +449,6 @@ class Medical { statement = QUOTE([ARR_4(_player, _target, 'leg_r', 'FieldDressing')] call DFUNC(treatment)); showDisabled = 0; priority = 2; - hotkey = ""; icon = PATHTOF(UI\icons\bandage.paa); }; class PackingBandage: fieldDressing { diff --git a/addons/medical/ACE_Medical_Treatments.hpp b/addons/medical/ACE_Medical_Treatments.hpp index 91f7c3aaf1..51fb4ca701 100644 --- a/addons/medical/ACE_Medical_Treatments.hpp +++ b/addons/medical/ACE_Medical_Treatments.hpp @@ -27,7 +27,10 @@ class ACE_Medical_Actions { animationCallerProne = "AinvPpneMstpSlayW[wpn]Dnon_medicOther"; animationCallerSelf = "AinvPknlMstpSlayW[wpn]Dnon_medic"; animationCallerSelfProne = "AinvPpneMstpSlayW[wpn]Dnon_medic"; - litter[] = { {"All", "_previousDamage > 0", {{"ACE_MedicalLitterBase", "ACE_MedicalLitter_bandage1", "ACE_MedicalLitter_bandage2", "ACE_MedicalLitter_bandage3"}}}, {"All", "_previousDamage <= 0", {"ACE_MedicalLitter_clean"}} }; + litter[] = { + {"All", "_bloodLossOnSelection > 0", {{"ACE_MedicalLitterBase", "ACE_MedicalLitter_bandage1", "ACE_MedicalLitter_bandage2", "ACE_MedicalLitter_bandage3"}}}, + {"All", "_bloodLossOnSelection <= 0", {"ACE_MedicalLitter_clean"}} + }; }; class Morphine: Bandage { displayName = CSTRING(Inject_Morphine); @@ -163,12 +166,19 @@ class ACE_Medical_Actions { animationCallerProne = "AinvPpneMstpSlayW[wpn]Dnon_medicOther"; animationCallerSelf = "AinvPknlMstpSlayW[wpn]Dnon_medic"; animationCallerSelfProne = "AinvPpneMstpSlayW[wpn]Dnon_medic"; - litter[] = { {"All", "_previousDamage > 0", {{"ACE_MedicalLitter_bandage2", "ACE_MedicalLitter_bandage3"}}}, {"All", "_previousDamage <= 0", {"ACE_MedicalLitter_clean"}} }; + litter[] = { + {"All", "_bloodLossOnSelection > 0", {{"ACE_MedicalLitter_bandage2", "ACE_MedicalLitter_bandage3"}}}, + {"All", "_bloodLossOnSelection <= 0", {"ACE_MedicalLitter_clean"}} + }; }; class PackingBandage: fieldDressing { displayName = CSTRING(Actions_PackingBandage); items[] = {"ACE_packingBandage"}; - litter[] = { {"All", "", {"ACE_MedicalLitter_packingBandage"}}}; + litter[] = { + {"All", "", {"ACE_MedicalLitter_packingBandage"}}, + {"All", "_bloodLossOnSelection > 0", {{"ACE_MedicalLitter_bandage2", "ACE_MedicalLitter_bandage3"}}}, + {"All", "_bloodLossOnSelection <= 0", {"ACE_MedicalLitter_clean"}} + }; }; class ElasticBandage: fieldDressing { displayName = CSTRING(Actions_ElasticBandage); @@ -177,7 +187,11 @@ class ACE_Medical_Actions { class QuikClot: fieldDressing { displayName = CSTRING(Actions_QuikClot); items[] = {"ACE_quikclot"}; - litter[] = { {"All", "", {"ACE_MedicalLitter_QuickClot"}}}; + litter[] = { + {"All", "", {"ACE_MedicalLitter_QuickClot"}}, + {"All", "_bloodLossOnSelection > 0", {{"ACE_MedicalLitter_bandage2", "ACE_MedicalLitter_bandage3"}}}, + {"All", "_bloodLossOnSelection <= 0", {"ACE_MedicalLitter_clean"}} + }; }; class Tourniquet: fieldDressing { displayName = CSTRING(Apply_Tourniquet); @@ -296,9 +310,9 @@ class ACE_Medical_Actions { animationCallerSelf = ""; animationCallerSelfProne = ""; litter[] = { {"All", "", {"ACE_MedicalLitter_gloves"}}, - {"All", "_previousDamage > 0", {{"ACE_MedicalLitterBase", "ACE_MedicalLitter_bandage1", "ACE_MedicalLitter_bandage2", "ACE_MedicalLitter_bandage3"}} }, - {"All", "_previousDamage > 0", {{"ACE_MedicalLitterBase", "ACE_MedicalLitter_bandage1", "ACE_MedicalLitter_bandage2", "ACE_MedicalLitter_bandage3"}}}, - {"All", "_previousDamage <= 0", {"ACE_MedicalLitter_clean"}} + {"All", "_bloodLossOnSelection > 0", {{"ACE_MedicalLitterBase", "ACE_MedicalLitter_bandage1", "ACE_MedicalLitter_bandage2", "ACE_MedicalLitter_bandage3"}}}, + {"All", "_bloodLossOnSelection > 0", {{"ACE_MedicalLitterBase", "ACE_MedicalLitter_bandage1", "ACE_MedicalLitter_bandage2", "ACE_MedicalLitter_bandage3"}}}, + {"All", "_bloodLossOnSelection <= 0", {"ACE_MedicalLitter_clean"}} }; }; class CheckPulse: fieldDressing { diff --git a/addons/medical/functions/fnc_actionCheckBloodPressureLocal.sqf b/addons/medical/functions/fnc_actionCheckBloodPressureLocal.sqf index 24b5bf4c6e..0fd9394f92 100644 --- a/addons/medical/functions/fnc_actionCheckBloodPressureLocal.sqf +++ b/addons/medical/functions/fnc_actionCheckBloodPressureLocal.sqf @@ -60,6 +60,6 @@ if (_selectionName in ["hand_l","hand_r"] && {[_unit, _selectionName] call FUNC( ["displayTextStructured", [_caller], [[_output, [_target] call EFUNC(common,getName), round(_bloodPressureHigh),round(_bloodPressureLow)], 1.75, _caller]] call EFUNC(common,targetEvent); if (_logOutPut != "") then { - [_target,"activity", LSTRING(Check_Bloodpressure_Log), [[_caller] call EFUNC(common,getName), _logOutPut]] call FUNC(addToLog); - [_target,"quick_view", LSTRING(Check_Bloodpressure_Log), [[_caller] call EFUNC(common,getName), _logOutPut]] call FUNC(addToLog); + [_target,"activity", LSTRING(Check_Bloodpressure_Log), [[_caller, false, true] call EFUNC(common,getName), _logOutPut]] call FUNC(addToLog); + [_target,"quick_view", LSTRING(Check_Bloodpressure_Log), [[_caller, false, true] 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 6910545a9d..d69fa90c86 100644 --- a/addons/medical/functions/fnc_actionCheckResponse.sqf +++ b/addons/medical/functions/fnc_actionCheckResponse.sqf @@ -21,5 +21,5 @@ _output = [LSTRING(Check_Response_Unresponsive), LSTRING(Check_Response_Responsi ["displayTextStructured", [_caller], [[_output, [_target] call EFUNC(common,getName)], 2, _caller]] call EFUNC(common,targetEvent); -[_target,"activity",_output, [[_target] call EFUNC(common,getName)]] call FUNC(addToLog); -[_target,"quick_view",_output, [[_target] call EFUNC(common,getName)]] call FUNC(addToLog); +[_target,"activity",_output, [[_target, false, true] call EFUNC(common,getName)]] call FUNC(addToLog); +[_target,"quick_view",_output, [[_target, false, true] call EFUNC(common,getName)]] call FUNC(addToLog); diff --git a/addons/medical/functions/fnc_actionPlaceInBodyBag.sqf b/addons/medical/functions/fnc_actionPlaceInBodyBag.sqf index f416535701..bf8bc0289f 100644 --- a/addons/medical/functions/fnc_actionPlaceInBodyBag.sqf +++ b/addons/medical/functions/fnc_actionPlaceInBodyBag.sqf @@ -28,10 +28,12 @@ _spinePos = _target modelToWorldVisual (_target selectionPosition "Spine3"); _dirVect = _headPos vectorFromTo _spinePos; _direction = _dirVect call CBA_fnc_vectDir; -deleteVehicle _target; - _bodyBag = createVehicle ["ACE_bodyBagObject", _position, [], 0, "CAN_COLLIDE"]; +["placedInBodyBag", [_target, _bodyBag]] call EFUNC(common,globalEvent); + +deleteVehicle _target; + // prevent body bag from flipping _bodyBag setPosASL _position; _bodyBag setDir _direction; diff --git a/addons/medical/functions/fnc_createLitter.sqf b/addons/medical/functions/fnc_createLitter.sqf index a87c2b6274..61931b9765 100644 --- a/addons/medical/functions/fnc_createLitter.sqf +++ b/addons/medical/functions/fnc_createLitter.sqf @@ -9,7 +9,7 @@ * 3: The treatment classname * 4: ? * 5: Users of Items - * 6: Previous Damage + * 6: Blood Loss on selection (previously called _previousDamage) * * Return Value: * None @@ -22,7 +22,10 @@ #define MIN_ENTRIES_LITTER_CONFIG 3 private ["_config", "_litter", "_createLitter", "_position", "_createdLitter"]; -params ["_caller", "_target", "_selectionName", "_className", "", "_usersOfItems", "_previousDamage"]; +params ["_caller", "_target", "_selectionName", "_className", "", "_usersOfItems", "_bloodLossOnSelection"]; + +//Ensures comptibilty with other possible medical treatment configs +private _previousDamage = _bloodLossOnSelection; if !(GVAR(allowLitterCreation)) exitwith {}; if (vehicle _caller != _caller || vehicle _target != _target) exitwith {}; @@ -72,7 +75,7 @@ _createdLitter = []; _litterCondition = missionNamespace getVariable _litterCondition; if (!(_litterCondition isEqualType {})) then {_litterCondition = {false}}; }; - if !([_caller, _target, _selectionName, _className, _usersOfItems, _previousDamage] call _litterCondition) exitwith {}; + if !([_caller, _target, _selectionName, _className, _usersOfItems, _bloodLossOnSelection] call _litterCondition) exitwith {}; if (_litterOptions isEqualType []) then { // Loop through through the litter options and place the litter diff --git a/addons/medical/functions/fnc_handleCreateLitter.sqf b/addons/medical/functions/fnc_handleCreateLitter.sqf index 9db65db732..c87d51a7e1 100644 --- a/addons/medical/functions/fnc_handleCreateLitter.sqf +++ b/addons/medical/functions/fnc_handleCreateLitter.sqf @@ -16,7 +16,7 @@ if(!hasInterface) exitWith { false }; -params ["_litterClass", "_position", "_unit"]; +params ["_litterClass", "_position", "_direction"]; private["_litterObject", "_maxLitterCount"]; //IGNORE_PRIVATE_WARNING(_values); diff --git a/addons/medical/functions/fnc_treatmentAdvanced_CPRLocal.sqf b/addons/medical/functions/fnc_treatmentAdvanced_CPRLocal.sqf index 7f273d1fad..07431ac66d 100644 --- a/addons/medical/functions/fnc_treatmentAdvanced_CPRLocal.sqf +++ b/addons/medical/functions/fnc_treatmentAdvanced_CPRLocal.sqf @@ -30,7 +30,7 @@ if (GVAR(level) > 1 && {(random 1) >= 0.6}) then { _target setVariable [QGVAR(bloodPressure), [50,70]]; }; -[_target, "activity", LSTRING(Activity_CPR), [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog); -[_target, "activity_view", LSTRING(Activity_CPR), [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog); // TODO expand message +[_target, "activity", LSTRING(Activity_CPR), [[_caller, false, true] call EFUNC(common,getName)]] call FUNC(addToLog); +[_target, "activity_view", LSTRING(Activity_CPR), [[_caller, false, true] call EFUNC(common,getName)]] call FUNC(addToLog); // TODO expand message true; diff --git a/addons/medical/functions/fnc_treatmentAdvanced_bandage.sqf b/addons/medical/functions/fnc_treatmentAdvanced_bandage.sqf index 2d9c383902..bb69a1e45a 100644 --- a/addons/medical/functions/fnc_treatmentAdvanced_bandage.sqf +++ b/addons/medical/functions/fnc_treatmentAdvanced_bandage.sqf @@ -19,8 +19,8 @@ #include "script_component.hpp" params ["_caller", "_target", "_selectionName", "_className", "_items", "", ["_specificSpot", -1]]; -[_target, "activity", LSTRING(Activity_bandagedPatient), [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog); -[_target, "activity_view", LSTRING(Activity_bandagedPatient), [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog); // TODO expand message +[_target, "activity", LSTRING(Activity_bandagedPatient), [[_caller, false, true] call EFUNC(common,getName)]] call FUNC(addToLog); +[_target, "activity_view", LSTRING(Activity_bandagedPatient), [[_caller, false, true] call EFUNC(common,getName)]] call FUNC(addToLog); // TODO expand message if !([_target] call FUNC(hasMedicalEnabled)) exitWith { _this call FUNC(treatmentBasic_bandage); diff --git a/addons/medical/functions/fnc_treatmentAdvanced_fullHealLocal.sqf b/addons/medical/functions/fnc_treatmentAdvanced_fullHealLocal.sqf index e3befb13a9..1bb3f23b15 100644 --- a/addons/medical/functions/fnc_treatmentAdvanced_fullHealLocal.sqf +++ b/addons/medical/functions/fnc_treatmentAdvanced_fullHealLocal.sqf @@ -68,6 +68,6 @@ if (alive _target) exitWith { // Resetting damage _target setDamage 0; - [_target, "activity", LSTRING(Activity_fullHeal), [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog); - [_target, "activity_view", LSTRING(Activity_fullHeal), [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog); // TODO expand message + [_target, "activity", LSTRING(Activity_fullHeal), [[_caller, false, true] call EFUNC(common,getName)]] call FUNC(addToLog); + [_target, "activity_view", LSTRING(Activity_fullHeal), [[_caller, false, true] call EFUNC(common,getName)]] call FUNC(addToLog); // TODO expand message }; diff --git a/addons/medical/functions/fnc_treatmentAdvanced_medication.sqf b/addons/medical/functions/fnc_treatmentAdvanced_medication.sqf index e551eb4afe..5949f53780 100644 --- a/addons/medical/functions/fnc_treatmentAdvanced_medication.sqf +++ b/addons/medical/functions/fnc_treatmentAdvanced_medication.sqf @@ -24,8 +24,8 @@ params ["_caller", "_target", "_selectionName", "_className", "_items"]; { if (_x != "") then { [_target, _x] call FUNC(addToTriageCard); - [_target, "activity", LSTRING(Activity_usedItem), [[_caller] call EFUNC(common,getName), getText (configFile >> "CfgWeapons" >> _x >> "displayName")]] call FUNC(addToLog); - [_target, "activity_view", LSTRING(Activity_usedItem), [[_caller] call EFUNC(common,getName), getText (configFile >> "CfgWeapons" >> _x >> "displayName")]] call FUNC(addToLog); + [_target, "activity", LSTRING(Activity_usedItem), [[_caller, false, true] call EFUNC(common,getName), getText (configFile >> "CfgWeapons" >> _x >> "displayName")]] call FUNC(addToLog); + [_target, "activity_view", LSTRING(Activity_usedItem), [[_caller, false, true] call EFUNC(common,getName), getText (configFile >> "CfgWeapons" >> _x >> "displayName")]] call FUNC(addToLog); }; } forEach _items; diff --git a/addons/medical/functions/fnc_treatmentIV.sqf b/addons/medical/functions/fnc_treatmentIV.sqf index bf18370a5e..ebf33c75c7 100644 --- a/addons/medical/functions/fnc_treatmentIV.sqf +++ b/addons/medical/functions/fnc_treatmentIV.sqf @@ -24,7 +24,7 @@ if (count _items == 0) exitWith {false}; _removeItem = _items select 0; [[_target, _className], QUOTE(DFUNC(treatmentIVLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ [_target, _removeItem] call FUNC(addToTriageCard); -[_target, "activity", LSTRING(Activity_gaveIV), [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog); -[_target, "activity_view", LSTRING(Activity_gaveIV), [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog); // TODO expand message +[_target, "activity", LSTRING(Activity_gaveIV), [[_caller, false, true] call EFUNC(common,getName)]] call FUNC(addToLog); +[_target, "activity_view", LSTRING(Activity_gaveIV), [[_caller, false, true] call EFUNC(common,getName)]] call FUNC(addToLog); // TODO expand message true diff --git a/addons/medical/functions/fnc_treatmentTourniquet.sqf b/addons/medical/functions/fnc_treatmentTourniquet.sqf index 8f45ada7c3..1c5c9282db 100644 --- a/addons/medical/functions/fnc_treatmentTourniquet.sqf +++ b/addons/medical/functions/fnc_treatmentTourniquet.sqf @@ -43,8 +43,8 @@ _removeItem = _items select 0; [[_target, _removeItem, _selectionName], QUOTE(DFUNC(treatmentTourniquetLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ [_target, _removeItem] call FUNC(addToTriageCard); -[_target, "activity", LSTRING(Activity_appliedTourniquet), [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog); -[_target, "activity_view", LSTRING(Activity_appliedTourniquet), [[_caller] call EFUNC(common,getName)]] call FUNC(addToLog); // TODO expand message +[_target, "activity", LSTRING(Activity_appliedTourniquet), [[_caller, false, true] call EFUNC(common,getName)]] call FUNC(addToLog); +[_target, "activity_view", LSTRING(Activity_appliedTourniquet), [[_caller, false, true] call EFUNC(common,getName)]] call FUNC(addToLog); // TODO expand message true diff --git a/addons/medical/functions/fnc_treatment_success.sqf b/addons/medical/functions/fnc_treatment_success.sqf index 9b21ff228f..55ddfa394e 100644 --- a/addons/medical/functions/fnc_treatment_success.sqf +++ b/addons/medical/functions/fnc_treatment_success.sqf @@ -65,15 +65,28 @@ if (isNil _callback) then { _callback = missionNamespace getVariable _callback; }; -//Get current damage before treatment (for litter) -_previousDamage = if (_selectionName in GVAR(SELECTIONS)) then { - _target getHitPointDamage ([_target, _selectionName, true] call FUNC(translateSelections)); +//Get current blood loose on limb (for "bloody" litter) +private _bloodLossOnSelection = 0; +private _partNumber = ([_selectionName] call FUNC(selectionNameToNumber)) max 0; +if ((GVAR(level) >= 2) && {([_target] call FUNC(hasMedicalEnabled))}) then { + //Advanced Medical - Add all bleeding from wounds on selection + private _openWounds = _target getvariable [QGVAR(openWounds), []]; + { + _x params ["", "", "_selectionX", "_amountOf", "_bleedingRatio"]; + if (_selectionX == _partNumber) then { + _bloodLossOnSelection = _bloodLossOnSelection + (_amountOf * _bleedingRatio); + }; + } forEach _openWounds; + TRACE_1("advanced",_bloodLossOnSelection); } else { - damage _target; + //Basic Medical (just use blodyPartStatus): + private _damageBodyParts = _target getvariable [QGVAR(bodyPartStatus), [0,0,0,0,0,0]]; + _bloodLossOnSelection = _damageBodyParts select _partNumber + TRACE_1("basic",_bloodLossOnSelection); }; _args call _callback; -_args pushBack _previousDamage; +_args pushBack _bloodLossOnSelection; _args call FUNC(createLitter); //If we're not already tracking vitals, start: diff --git a/addons/medical/stringtable.xml b/addons/medical/stringtable.xml index 533bd12a2d..a3ae483065 100644 --- a/addons/medical/stringtable.xml +++ b/addons/medical/stringtable.xml @@ -2115,6 +2115,7 @@ %1 użył apteczki %1 utilizou KPS %1 používá PAK + %1 использовал аптечку Heavily wounded diff --git a/addons/medical/ui/triagecard.hpp b/addons/medical/ui/triagecard.hpp index 74ce4a8e18..d07da4337e 100644 --- a/addons/medical/ui/triagecard.hpp +++ b/addons/medical/ui/triagecard.hpp @@ -113,7 +113,7 @@ class GVAR(triageCard) { 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([false] call FUNC(dropDownTriageCard); GVAR(TriageCardTarget) setVariable [ARR_3('ACE_medical_triageLevel',0,true)];); + action = QUOTE([false] call FUNC(dropDownTriageCard); (GVAR(TriageCardTarget)) setVariable [ARR_3('ACE_medical_triageLevel',0,true)];); }; class selectTriageStatusMinor: selectTriageStatus { idc = 2003; @@ -131,7 +131,7 @@ class GVAR(triageCard) { 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([false] call FUNC(dropDownTriageCard); GVAR(TriageCardTarget) setVariable [ARR_3('ACE_medical_triageLevel',1,true)];); + action = QUOTE([false] call FUNC(dropDownTriageCard); (GVAR(TriageCardTarget)) setVariable [ARR_3('ACE_medical_triageLevel',1,true)];); }; class selectTriageStatusDelayed: selectTriageStatus { idc = 2004; @@ -149,7 +149,7 @@ class GVAR(triageCard) { 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([false] call FUNC(dropDownTriageCard); GVAR(TriageCardTarget) setVariable [ARR_3('ACE_medical_triageLevel',2,true)];); + action = QUOTE([false] call FUNC(dropDownTriageCard); (GVAR(TriageCardTarget)) setVariable [ARR_3('ACE_medical_triageLevel',2,true)];); }; class selectTriageStatusImmediate: selectTriageStatus { idc = 2005; @@ -167,7 +167,7 @@ class GVAR(triageCard) { 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([false] call FUNC(dropDownTriageCard); GVAR(TriageCardTarget) setVariable [ARR_3('ACE_medical_triageLevel', 3, true)];); + action = QUOTE([false] call FUNC(dropDownTriageCard); (GVAR(TriageCardTarget)) setVariable [ARR_3('ACE_medical_triageLevel', 3, true)];); }; class selectTriageStatusDeceased: selectTriageStatus { idc = 2006; @@ -185,7 +185,7 @@ class GVAR(triageCard) { 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([false] call FUNC(dropDownTriageCard); GVAR(TriageCardTarget) setVariable [ARR_3('ACE_medical_triageLevel', 4, true)];); + action = QUOTE([false] call FUNC(dropDownTriageCard); (GVAR(TriageCardTarget)) setVariable [ARR_3('ACE_medical_triageLevel', 4, true)];); }; }; }; \ No newline at end of file diff --git a/addons/medical_menu/functions/fnc_onMenuOpen.sqf b/addons/medical_menu/functions/fnc_onMenuOpen.sqf index 806338b7a6..d8d1fde35a 100644 --- a/addons/medical_menu/functions/fnc_onMenuOpen.sqf +++ b/addons/medical_menu/functions/fnc_onMenuOpen.sqf @@ -77,11 +77,11 @@ GVAR(MenuPFHID) = [{ [GVAR(LatestDisplayOptionMenu)] call FUNC(handleUI_DisplayOptions); //Check that it's valid to stay open: - if !(([ACE_player, _target, ["isNotInside"]] call EFUNC(common,canInteractWith)) && {[ACE_player, _target] call FUNC(canOpenMenu)}) then { + if !(([ACE_player, GVAR(INTERACTION_TARGET), ["isNotInside"]] call EFUNC(common,canInteractWith)) && {[ACE_player, GVAR(INTERACTION_TARGET)] call FUNC(canOpenMenu)}) then { closeDialog 314412; //If we failed because of distance check, show UI message: if ((ACE_player distance GVAR(INTERACTION_TARGET)) > GVAR(maxRange)) then { - ["displayTextStructured", [ACE_player], [[ELSTRING(medical,DistanceToFar), [GVAR(INTERACTION_TARGET)] call EFUNC(common,getName)], 1.75, ACE_player]] call EFUNC(common,targetEvent); + ["displayTextStructured", [[ELSTRING(medical,DistanceToFar), [GVAR(INTERACTION_TARGET)] call EFUNC(common,getName)], 2, ACE_player]] call EFUNC(common,localEvent); }; }; diff --git a/addons/microdagr/functions/fnc_updateDisplay.sqf b/addons/microdagr/functions/fnc_updateDisplay.sqf index 826ea55e6c..4b609085a8 100644 --- a/addons/microdagr/functions/fnc_updateDisplay.sqf +++ b/addons/microdagr/functions/fnc_updateDisplay.sqf @@ -171,6 +171,9 @@ case (APP_MODE_WAYPOINTS): { _currentIndex = (_currentIndex max 0) min (count _waypoints); _wpListBox lbSetCurSel _currentIndex; + + //Reset focus to a dummy ctrl (top button), otherwise HOME/POS1 key goes to top of listBox and has keybind blocked + ctrlSetFocus (_display displayCtrl IDC_TOPMENUBUTTON); }; case (APP_MODE_SETUP): { @@ -190,5 +193,8 @@ case (APP_MODE_SETUP): { } else { _settingListBox lbSetTextRight [1, (localize LSTRING(settingOff))]; }; + + //Reset focus to a dummy ctrl (top button), otherwise HOME/POS1 key goes to top of listBox and has keybind blocked + ctrlSetFocus (_display displayCtrl IDC_TOPMENUBUTTON); }; }; diff --git a/addons/microdagr/gui_controls.hpp b/addons/microdagr/gui_controls.hpp index 270a3325bd..a8fbb8f83f 100644 --- a/addons/microdagr/gui_controls.hpp +++ b/addons/microdagr/gui_controls.hpp @@ -140,7 +140,7 @@ class controlsBackground { class controls { class TopMenuClick: GVAR(RscActiveTextPicture) { - idc = -1; + idc = IDC_TOPMENUBUTTON; text = "#(argb,8,8,3)color(0,0,0,0)"; x = X_PART(0); y = Y_PART(0); diff --git a/addons/microdagr/script_component.hpp b/addons/microdagr/script_component.hpp index 72c5c125bc..0710649aaa 100644 --- a/addons/microdagr/script_component.hpp +++ b/addons/microdagr/script_component.hpp @@ -54,6 +54,7 @@ #define IDC_MODEDISPLAY_TARGETRANGENUM 144023 #define IDC_MODEDISPLAY_TARGETELEVATIONNUM 144024 #define IDC_MODEDISPLAY_TARGETNAME 144025 +#define IDC_TOPMENUBUTTON 144030 #define IDC_MODECOMPASS 144100 #define IDC_MODECOMPASS_HEADING 144110 diff --git a/addons/missileguidance/stringtable.xml b/addons/missileguidance/stringtable.xml index 3a416007f4..c59c36fd50 100644 --- a/addons/missileguidance/stringtable.xml +++ b/addons/missileguidance/stringtable.xml @@ -30,7 +30,7 @@ Misil Hydra-70 DAGR Hydra-70 DAGR Hydra-70 DAGR - Hydra-70 DAGR Rackete + Hydra-70 DAGR Rakete Hydra-70 DAGR Missile Hydra-70 DAGR Míssil Hydra-70 DAGR diff --git a/addons/movement/XEH_postInit.sqf b/addons/movement/XEH_postInit.sqf index 108dc56792..7825134af3 100644 --- a/addons/movement/XEH_postInit.sqf +++ b/addons/movement/XEH_postInit.sqf @@ -6,15 +6,14 @@ if (!hasInterface) exitWith {}; ["inventoryDisplayLoaded", { [{ - private "_dialog"; - - _dialog = _this select 0; + disableSerialization; + params ["_dialog"]; if (isNull _dialog) exitWith { [_this select 1] call CBA_fnc_removePerFrameHandler; }; - _dialog displayCtrl 111 ctrlSetText format ["%1 - %2 %3", [ACE_player] call EFUNC(common,getName), localize LSTRING(Weight), [ACE_player] call FUNC(getWeight)]; + _dialog displayCtrl 111 ctrlSetText format ["%1 - %2 %3", [ACE_player, false, true] call EFUNC(common,getName), localize LSTRING(Weight), [ACE_player] call FUNC(getWeight)]; }, 0, _this select 0] call CBA_fnc_addPerFrameHandler; diff --git a/addons/movement/functions/fnc_canClimb.sqf b/addons/movement/functions/fnc_canClimb.sqf index 671ab0b808..ec4202dbd5 100644 --- a/addons/movement/functions/fnc_canClimb.sqf +++ b/addons/movement/functions/fnc_canClimb.sqf @@ -15,33 +15,30 @@ */ #include "script_component.hpp" -private ["_pos", "_dir"]; +params ["_unit"]; -PARAMS_1(_unit); +private _pos = getPosASL _unit; +private _dir = getDir _unit; -_pos = getPosASL _unit; -_dir = getDir _unit; _dir = [sin _dir, cos _dir, 0]; -private ["_checkPos0beg", "_checkPos0end", "_checkPos1beg", "_checkPos1end"]; +private _checkPos0beg = _pos vectorAdd [0, 0, 0.9]; +private _checkPos0end = _checkPos0beg vectorAdd (_dir vectorMultiply 1.3); -_checkPos0beg = _pos vectorAdd [0, 0, 0.9]; -_checkPos0end = _checkPos0beg vectorAdd (_dir vectorMultiply 1.3); +private _checkPos1beg = _pos vectorAdd [0, 0, 1.75]; +private _checkPos1end = _checkPos1beg vectorAdd (_dir vectorMultiply 1.3); -_checkPos1beg = _pos vectorAdd [0, 0, 1.75]; -_checkPos1end = _checkPos1beg vectorAdd (_dir vectorMultiply 1.3); +private _checkPos2beg = _pos vectorAdd [0.3 * (_dir select 1), 0.3 * -(_dir select 0), 2.0]; +private _checkPos2end = _checkPos2beg vectorAdd (_dir vectorMultiply 1.3); -_checkPos2beg = _pos vectorAdd [0.3 * (_dir select 1), 0.3 * -(_dir select 0), 2.0]; -_checkPos2end = _checkPos2beg vectorAdd (_dir vectorMultiply 1.3); +private _checkPos3beg = _pos vectorAdd [-0.2 * (_dir select 1), -0.2 * -(_dir select 0), 2.0]; +private _checkPos3end = _checkPos3beg vectorAdd (_dir vectorMultiply 1.3); -_checkPos3beg = _pos vectorAdd [-0.2 * (_dir select 1), -0.2 * -(_dir select 0), 2.0]; -_checkPos3end = _checkPos3beg vectorAdd (_dir vectorMultiply 1.3); +private _checkPos4beg = _pos vectorAdd [0.3 * (_dir select 1), 0.3 * -(_dir select 0), 1.5]; +private _checkPos4end = _checkPos4beg vectorAdd (_dir vectorMultiply 1.3); -_checkPos4beg = _pos vectorAdd [0.3 * (_dir select 1), 0.3 * -(_dir select 0), 1.5]; -_checkPos4end = _checkPos4beg vectorAdd (_dir vectorMultiply 1.3); - -_checkPos5beg = _pos vectorAdd [-0.2 * (_dir select 1), -0.2 * -(_dir select 0), 1.5]; -_checkPos5end = _checkPos5beg vectorAdd (_dir vectorMultiply 1.3); +private _checkPos5beg = _pos vectorAdd [-0.2 * (_dir select 1), -0.2 * -(_dir select 0), 1.5]; +private _checkPos5end = _checkPos5beg vectorAdd (_dir vectorMultiply 1.3); /* drawLine3D [ASLToATL _checkPos0beg, ASLToATL _checkPos0end, [0,1,0,1]]; diff --git a/addons/movement/functions/fnc_climb.sqf b/addons/movement/functions/fnc_climb.sqf index a0946b95d0..57df4e5991 100644 --- a/addons/movement/functions/fnc_climb.sqf +++ b/addons/movement/functions/fnc_climb.sqf @@ -15,9 +15,7 @@ */ #include "script_component.hpp" -private "_unit"; - -_unit = _this select 0; +params ["_unit"]; if !([_unit] call FUNC(canClimb)) exitWith { [localize LSTRING(CanNotClimb)] call EFUNC(common,displayTextStructured); diff --git a/addons/movement/functions/fnc_getWeight.sqf b/addons/movement/functions/fnc_getWeight.sqf index 6941173fde..11dd8c4ee6 100644 --- a/addons/movement/functions/fnc_getWeight.sqf +++ b/addons/movement/functions/fnc_getWeight.sqf @@ -15,11 +15,9 @@ */ #include "script_component.hpp" -private ["_unit", "_weight"]; +params ["_unit"]; -_unit = _this select 0; - -_weight = loadAbs _unit * 0.1; +private _weight = loadAbs _unit * 0.1; if (GVAR(useImperial)) then { _weight = format ["%1lb", (round (_weight * 100)) / 100]; diff --git a/addons/movement/functions/fnc_handleClimb.sqf b/addons/movement/functions/fnc_handleClimb.sqf index 39ca9b1e92..e6d8fed12c 100644 --- a/addons/movement/functions/fnc_handleClimb.sqf +++ b/addons/movement/functions/fnc_handleClimb.sqf @@ -16,12 +16,10 @@ */ #include "script_component.hpp" -private ["_unit", "_anim", "_pos"]; +params ["_unit", "_anim"]; -_unit = _this select 0; -_anim = _this select 1; +private _pos = _unit modelToWorldVisual (_unit selectionPosition "camera"); -_pos = _unit modelToWorldVisual (_unit selectionPosition "camera"); [_unit, "AmovPknlMstpSnonWnonDnon", 2] call EFUNC(common,doAnimation); _pos = _pos vectorDiff (_unit selectionPosition "camera"); diff --git a/addons/nametags/functions/fnc_drawNameTagIcon.sqf b/addons/nametags/functions/fnc_drawNameTagIcon.sqf index 8294a8db06..ac28a427d5 100644 --- a/addons/nametags/functions/fnc_drawNameTagIcon.sqf +++ b/addons/nametags/functions/fnc_drawNameTagIcon.sqf @@ -44,7 +44,7 @@ if (_alpha < 0) exitWith {}; //Don't waste time if not visable //Set Text: _name = if (_iconType in [ICON_NAME, ICON_NAME_RANK, ICON_NAME_SPEAK]) then { - [_target, true] call EFUNC(common,getName) + [_target, true, true] call EFUNC(common,getName) } else { "" }; diff --git a/addons/nightvision/stringtable.xml b/addons/nightvision/stringtable.xml index b6e35147f9..2a38b86c54 100644 --- a/addons/nightvision/stringtable.xml +++ b/addons/nightvision/stringtable.xml @@ -136,18 +136,26 @@ Nightvision Nachtsicht + Ночное виденье + Visão Noturna Settings for night vision. Einstellungen für Nachtsichtgeräte. + Настройки ночного виденья + Ajustes para visão noturna. Disable NVGs in scope Deakt. NVGs mit Visier + Убирать ПНВ при прицеливании + Desabilitar visão noturna nas lunetas Blocks the usage of night vision goggles whilst aiming down the sight. Blockiert das Benutzen von Nachtsichtbrillen beim Benutzen des Visiers. + Блокирует использование головного ПНВ при прицеливании через прицел. + Bloqueia o uso de visão noturna ao utilizar a mira. - + \ No newline at end of file diff --git a/addons/optics/XEH_postInit.sqf b/addons/optics/XEH_postInit.sqf index bed38a5ced..2048db76c6 100644 --- a/addons/optics/XEH_postInit.sqf +++ b/addons/optics/XEH_postInit.sqf @@ -6,6 +6,11 @@ if (!hasInterface) exitWith {}; GVAR(camera) = objNull; 0 = 0 spawn { + // Workarround for the ThreeDen Editor Camera + if ((!isNil {is3DEN}) && {is3DEN}) exitWith { + ACE_LOGINFO("Eden detected: disabling Optics PIP Camera"); + }; + waitUntil {!isNull ACE_player}; waitUntil {sleep 1; {_x != GVAR(camera)} count allMissionObjects "camera" == 0 && {isNull curatorCamera}}; diff --git a/addons/overheating/CfgVehicles.hpp b/addons/overheating/CfgVehicles.hpp index a198ef71b6..ec9b07f36c 100644 --- a/addons/overheating/CfgVehicles.hpp +++ b/addons/overheating/CfgVehicles.hpp @@ -11,7 +11,6 @@ class CfgVehicles { showDisabled = 0; priority = 3; icon = QUOTE(PATHTOF(UI\spare_barrel_ca.paa)); - hotkey = "B"; }; class ACE_CheckTemperature { displayName = CSTRING(CheckTemperatureShort); @@ -21,7 +20,6 @@ class CfgVehicles { showDisabled = 0; priority = 2.9; icon = QUOTE(PATHTOF(UI\temp_ca.paa)); - hotkey = "P"; }; }; }; @@ -117,4 +115,4 @@ class CfgVehicles { // Czech class I_Soldier_02_F; class I_Soldier_AR_F:I_Soldier_02_F {MACRO_ADDSPAREBARREL}; class I_Soldier_support_base_F; class I_Soldier_AAR_F:I_Soldier_support_base_F {MACRO_ADDSPAREBARREL}; -}; \ No newline at end of file +}; diff --git a/addons/parachute/CfgVehicles.hpp b/addons/parachute/CfgVehicles.hpp index aefadf2e63..c0f1676eb2 100644 --- a/addons/parachute/CfgVehicles.hpp +++ b/addons/parachute/CfgVehicles.hpp @@ -20,7 +20,6 @@ class CfgVehicles { showDisabled = 0; priority = 2.9; icon = QUOTE(PATHTOF(UI\cut_ca.paa)); - hotkey = "C"; // Did this realy Work? }; }; }; diff --git a/addons/rearm/stringtable.xml b/addons/rearm/stringtable.xml index da36dc4410..bbc7c36302 100644 --- a/addons/rearm/stringtable.xml +++ b/addons/rearm/stringtable.xml @@ -5,85 +5,120 @@ Rearm Settings Aufmunitioniereinstellungen Ustawienia przezbrajania + Настройки перевооружения + Ajustes de rearme This module allows you to tweak rearm system settings. + Mittels diesem Modul kann das Aufmunitioniersystem angepasst werden. Ten moduł pozwala dostosować ustawienia przezbrajania. + Этот модуль позволяет изменить настройки системы перевооружения. + Este módulo permite que você ajuste o sistema de rearme. Rearm Amount Aufmunitioniermenge Szybkość przezbrajania + Количество вооружения + Quantidade de rearme How fast should a vehicle be rearmed? Wie schnell soll ein Fahrzeug aufmunitioniert werden? Jak szybko pojazd zostanie przezbrojony? + Как быстро техника должна перевооружаться? + Quão rápido o veículo deve ser rearmado? Entire Vehicle Gesamtes Fahrzeug Cały pojazd + Полностью техника + Todo o veículo Entire Magazine Gesamtes Magazin Cały magazynek + Полный магазин + Todo o carregador Amount based on caliber Kaliberbasierte Anzahl Ilość zależna od kalibru + Количество зависит от калибра + Quantidade baseada no calibre Rearm Aufmunitionieren Przezbrój + Перевооружить + Rearmar Rearming %1 with %2 ... Munitioniere %1 auf mit %2 ... Przezbrajanie %1 przy pomocy %2 ... + Перевооружается %1 снарядами %2 ... + Rearmando %1 com %2 ... Rearming %1 ... Munitioniere %1 auf ... Przezbrajanie %1 ... + Перевооружается %1 ... + Rearmando %1 ... Taking %1 for %2 ... Nehme %1 für %2 ... Pobieranie %1 dla %2 ... + Забираем %1 для %2 ... + Pegando %1 para %2 ... Take ammo Munition nehmen Pobierz amunicję + Взять боекомплект + Tomar munição Pick up ammo Munition aufnehmen Podnieś amunicję + Поднять боекомплект + Pegar munição Store ammo Munition verstauen Przechowaj amunicję + Сохранить боекомплект + Guardar munição Storing %1 in %2 ... Verstaue %1 in %2 ... Przechowywanie %1 w %2 ... + Сохраняется %1 в %2 ... + Guardando %1 em %2 ... Picking up ammo ... Nehme Munition ... Podnoszenie amunicji ... + Поднятие боекомплекта ... + Pegando munição ... Rearmed %1 rounds of %2 on %3 - %1 Schuss %2 an %3 aufmunitioniert + %3 wurde mit %1 Patronen %2 aufmunitioniert Przezbrojono %1 pocisków %2 na %3 + Перевооружено %1 снарядов %2 на %3 + Rearmando %1 cartuchos de %2 em %3 Smoke Screen @@ -111,61 +146,85 @@ 30mm HEI 30mm HEI 30mm HEI + 30мм ОФЗ + 30mm HEI 30mm HEI-T 30mm HEI-T 30mm HEI-T + 30мм ОФЗТ + 30mm HEI-T AIM-9 Sidewinder AIM-9 Sidewinder AIM-9 Sidewinder + AIM-9 Sidewinder + AIM-9 Sidewinder Wympel R-73 Wympel R-73 Wympel R-73 + Р-73 (Вымпел) + Wympel R-73 AGM-65 Maverick AGM-65 Maverick AGM-65 Maverick + AGM-65 Maverick + AGM-65 Maverick Kh-25MTP Kh-25MTP Ch-25MTP + Х-25МТП + Ch-25MTP Hydra 70 HE Hydra 70 HE Hydra 70 HE + Hydra 70 HE + Hydra 70 HE S-8 HE S-8 HE S-8 HE + С-8 ОФ + S-8 HE Hydra 70 AP Hydra 70 AP Hydra 70 AP + Hydra 70 AP + Hydra 70 AP S-8 AP S-8 AP S-8 AP + С-8КОМ + S-8 AP GBU-12 GBU-12 GBU-12 + GBU-12 + GBU-12 FAB-250M-54 FAB-250M-54 FAB-250M-54 + ФАБ-250М-54 + FAB-250M-54 - \ No newline at end of file + diff --git a/addons/recoil/functions/fnc_camshake.sqf b/addons/recoil/functions/fnc_camshake.sqf index 806d48760b..a8e1af75d9 100644 --- a/addons/recoil/functions/fnc_camshake.sqf +++ b/addons/recoil/functions/fnc_camshake.sqf @@ -1,7 +1,21 @@ -// TMR: Small Arms - Recoil initialization and functions -// (C) 2013 Ryan Schultz. See LICENSE. -// Edited prefixes for compatability in AGM_Realism by KoffeinFlummi -// Edited by commy2 +/* + * Author: Orginal by Ryan Schultz, edited by KoffeinFlummi, commy2 + * Adds camera shake when firing + * From TMR: Small Arms + * + * Arguments: + * 0: Unit + * 1: Weapon + * 3: Muzzle + * + * Return Value: + * Nothing + * + * Example: + * [player, (currentWeapon player), (currentMuzzle player)] call ace_recoil_fnc_camShake; + * + * Public: No + */ #include "script_component.hpp" #define BASE_POWER 0.40 @@ -9,59 +23,53 @@ #define BASE_FREQ 13 #define RECOIL_COEF 40 -private ["_unit", "_weapon", "_muzzle"]; - -_unit = _this select 0; -_weapon = _this select 1; -_muzzle = _this select 2; +params ["_unit", "_weapon", "_muzzle"]; if (toLower _weapon in ["throw", "put"]) exitWith {}; -private ["_powerMod", "_timeMod", "_freqMod"]; - -_powerMod = ([0, -0.1, -0.1, 0, -0.2] select (["STAND", "CROUCH", "PRONE", "UNDEFINED", ""] find stance _unit)) + ([0, -1, 0, -1] select (["INTERNAL", "EXTERNAL", "GUNNER", "GROUP"] find cameraView)); -_timeMod = 0; -_freqMod = 0; +private _powerMod = ([0, -0.1, -0.1, 0, -0.2] select (["STAND", "CROUCH", "PRONE", "UNDEFINED", ""] find stance _unit)) + ([0, -1, 0, -1] select (["INTERNAL", "EXTERNAL", "GUNNER", "GROUP"] find cameraView)); // to get camshake read kickback -private ["_config", "_recoil"]; +private _recoil = missionNamespace getVariable format [QGVAR(%1-%2), _weapon, _muzzle]; -_config = configFile >> "CfgWeapons" >> _weapon; -_recoil = if (_muzzle == _weapon) then { - getText (_config >> "recoil") -} else { - getText (_config >> _muzzle >> "recoil") -}; +if (isNil "_recoil") then { + private _config = configFile >> "CfgWeapons" >> _weapon; -if (isClass (configFile >> "CfgRecoils" >> _recoil)) then { - _recoil = getArray (configFile >> "CfgRecoils" >> _recoil >> "kickBack"); - if (count _recoil < 2) then { + if (_muzzle == _weapon) then { + _recoil = getText (_config >> "recoil") + } else { + _recoil = getText (_config >> _muzzle >> "recoil") + }; + + if (isClass (configFile >> "CfgRecoils" >> _recoil)) then { + _recoil = getArray (configFile >> "CfgRecoils" >> _recoil >> "kickBack"); + if (count _recoil < 2) then { + _recoil = [0, 0]; + }; + } else { _recoil = [0, 0]; }; -} else { - _recoil = [0, 0]; + + TRACE_3("Caching Recoil config",_weapon,_muzzle,_recoil); + + // parse numbers + _recoil set [0, call compile format ["%1", _recoil select 0]]; + _recoil set [1, call compile format ["%1", _recoil select 1]]; + + missionNamespace setVariable [format [QGVAR(%1-%2), _weapon, _muzzle], _recoil]; }; -// parse numbers -_recoil set [0, call compile format ["%1", _recoil select 0]]; -_recoil set [1, call compile format ["%1", _recoil select 1]]; - -private "_powerCoef"; -_powerCoef = RECOIL_COEF * linearConversion [0, 1, random 1, _recoil select 0, _recoil select 1, false]; +private _powerCoef = RECOIL_COEF * linearConversion [0, 1, random 1, _recoil select 0, _recoil select 1, false]; if (isWeaponRested _unit) then {_powerMod = _powerMod - 0.07}; if (isWeaponDeployed _unit) then {_powerMod = _powerMod - 0.11}; -private "_camshake"; -_camshake = [ +private _camshake = [ _powerCoef * (BASE_POWER + _powerMod) max 0, - BASE_TIME + _timeMod max 0, - BASE_FREQ + _freqMod max 0 + BASE_TIME, + BASE_FREQ ]; -/* - systemChat str _camshake; - copyToClipboard format ["addCamShake %1;", _camshake]; -*/ +TRACE_4("addCamShake",_recoil,_powerCoef,_powerMod,_camshake);\ addCamShake _camshake; diff --git a/addons/refuel/CfgVehicles.hpp b/addons/refuel/CfgVehicles.hpp index 33ddddb8b0..ff91205434 100644 --- a/addons/refuel/CfgVehicles.hpp +++ b/addons/refuel/CfgVehicles.hpp @@ -138,8 +138,8 @@ class CfgVehicles { XEH_ENABLED; MACRO_NOZZLE_ACTIONS displayName = QGVAR(fuelNozzle); - scope = 2; - scopeCurator = 2; + scope = 1; + scopeCurator = 1; model = "\A3\Structures_F_Heli\VR\Helpers\Sign_sphere10cm_F.p3d"; }; @@ -615,7 +615,7 @@ class CfgVehicles { // Src: http://helicopters.axlegeeks.com/l/61/Boeing-AH-64-Apache 375 gal = 1420L // Src: https://en.wikipedia.org/wiki/Mil_Mi-8 3700l // Src: Google Ka-52 1870L - // Src: http://www.airforce-technology.com/projects/hind/ 1500kg / 0.81 L/kg = 1851L + // Src: http://www.airforce-technology.com/projects/hind/ 1500kg / 0.81 kg/L = 1851L // Src: https://en.wikipedia.org/wiki/MD_Helicopters_MH-6_Little_Bird 242L // Src: http://www.globalsecurity.org/military/world/europe/aw159-specs.htm 1004L // Src: https://en.wikipedia.org/wiki/AgustaWestland_AW101 3 * 1074L = 3222L diff --git a/addons/refuel/functions/fnc_makeJerryCan.sqf b/addons/refuel/functions/fnc_makeJerryCan.sqf index 3df209196d..96bb058265 100644 --- a/addons/refuel/functions/fnc_makeJerryCan.sqf +++ b/addons/refuel/functions/fnc_makeJerryCan.sqf @@ -20,60 +20,13 @@ private ["_actions", "_action"]; params ["_target", ["_fuelAmount", 20]]; if (isNull _target || - {_target isKindOf "AllVehicles"}) exitWith {}; + {_target isKindOf "AllVehicles"} || + {_target getVariable [QGVAR(jerryCan), false]}) exitWith {}; [_target, _fuelAmount] call FUNC(setFuel); +_target setVariable [QGVAR(jerryCan), true, true]; _target setVariable [QGVAR(source), _target, true]; -_actions = []; -// Add pickup -_action = [QGVAR(PickUpNozzle), - localize LSTRING(TakeNozzle), - QUOTE(PATHTOF(ui\icon_refuel_interact.paa)), - {[_player, objNull, _target] call FUNC(TakeNozzle)}, - {[_player, _target] call FUNC(canTakeNozzle)}, - {}, - [], - [0, 0, 0], - REFUEL_ACTION_DISTANCE] call EFUNC(interact_menu,createAction); -_actions pushBack [_action, [], _target]; - -// Add turnOn -_action = [QGVAR(TurnOn), - localize LSTRING(TurnOn), - QUOTE(PATHTOF(ui\icon_refuel_interact.paa)), - {[_player, _target] call FUNC(turnOn)}, - {[_player, _target] call FUNC(canTurnOn)}, - {}, - [], - [0, 0, 0], - REFUEL_ACTION_DISTANCE] call EFUNC(interact_menu,createAction); -_actions pushBack [_action, [], _target]; - -// Add turnOff -_action = [QGVAR(TurnOff), - localize LSTRING(TurnOff), - QUOTE(PATHTOF(ui\icon_refuel_interact.paa)), - {[_player, _target] call FUNC(turnOff)}, - {[_player, _target] call FUNC(canTurnOff)}, - {}, - [], - [0, 0, 0], - REFUEL_ACTION_DISTANCE] call EFUNC(interact_menu,createAction); -_actions pushBack [_action, [], _target]; - -// Add disconnect -_action = [QGVAR(Disconnect), - localize LSTRING(Disconnect), - QUOTE(PATHTOF(ui\icon_refuel_interact.paa)), - {[_player, _target] call FUNC(disconnect)}, - {[_player, _target] call FUNC(canDisconnect)}, - {}, - [], - [0, 0, 0], - REFUEL_ACTION_DISTANCE] call EFUNC(interact_menu,createAction); -_actions pushBack [_action, [], _target]; - // Main Action _action = [QGVAR(Refuel), localize LSTRING(Refuel), @@ -84,6 +37,52 @@ _action = [QGVAR(Refuel), [], [0, 0, 0], REFUEL_ACTION_DISTANCE] call EFUNC(interact_menu,createAction); +[_target, 0, [], _action] call EFUNC(interact_menu,addActionToObject); -[_target, 0] call EFUNC(interact_menu,addMainAction); -[_target, 0, ["ACE_MainActions"], [_action, _actions, _target]] call EFUNC(interact_menu,addActionToObject); +// Add pickup +_action = [QGVAR(PickUpNozzle), + localize LSTRING(TakeNozzle), + QUOTE(PATHTOF(ui\icon_refuel_interact.paa)), + {[_player, objNull, _target] call FUNC(TakeNozzle)}, + {[_player, _target] call FUNC(canTakeNozzle)}, + {}, + [], + [0, 0, 0], + REFUEL_ACTION_DISTANCE] call EFUNC(interact_menu,createAction); +[_target, 0, [QGVAR(Refuel)], _action] call EFUNC(interact_menu,addActionToObject); + +// Add turnOn +_action = [QGVAR(TurnOn), + localize LSTRING(TurnOn), + QUOTE(PATHTOF(ui\icon_refuel_interact.paa)), + {[_player, _target] call FUNC(turnOn)}, + {[_player, _target] call FUNC(canTurnOn)}, + {}, + [], + [0, 0, 0], + REFUEL_ACTION_DISTANCE] call EFUNC(interact_menu,createAction); +[_target, 0, [QGVAR(Refuel)], _action] call EFUNC(interact_menu,addActionToObject); + +// Add turnOff +_action = [QGVAR(TurnOff), + localize LSTRING(TurnOff), + QUOTE(PATHTOF(ui\icon_refuel_interact.paa)), + {[_player, _target] call FUNC(turnOff)}, + {[_player, _target] call FUNC(canTurnOff)}, + {}, + [], + [0, 0, 0], + REFUEL_ACTION_DISTANCE] call EFUNC(interact_menu,createAction); +[_target, 0, [QGVAR(Refuel)], _action] call EFUNC(interact_menu,addActionToObject); + +// Add disconnect +_action = [QGVAR(Disconnect), + localize LSTRING(Disconnect), + QUOTE(PATHTOF(ui\icon_refuel_interact.paa)), + {[_player, _target] call FUNC(disconnect)}, + {[_player, _target] call FUNC(canDisconnect)}, + {}, + [], + [0, 0, 0], + REFUEL_ACTION_DISTANCE] call EFUNC(interact_menu,createAction); +[_target, 0, [QGVAR(Refuel)], _action] call EFUNC(interact_menu,addActionToObject); diff --git a/addons/refuel/functions/fnc_refuel.sqf b/addons/refuel/functions/fnc_refuel.sqf index ed6eb257cf..74697212b1 100644 --- a/addons/refuel/functions/fnc_refuel.sqf +++ b/addons/refuel/functions/fnc_refuel.sqf @@ -29,7 +29,6 @@ _maxFuel = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(f params ["_args", "_pfID"]; _args params ["_source", "_sink", "_unit", "_nozzle", "_rate", "_startFuel", "_maxFuel", "_connectFromPoint", "_connectToPoint"]; - _fueling = _nozzle getVariable [QGVAR(isRefueling), false]; if (!alive _source || {!alive _sink}) exitWith { [objNull, _nozzle] call FUNC(dropNozzle); _nozzle setVariable [QGVAR(isConnected), false, true]; @@ -38,7 +37,7 @@ _maxFuel = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(f [_pfID] call cba_fnc_removePerFrameHandler; }; _tooFar = ((_sink modelToWorld _connectToPoint) distance (_source modelToWorld _connectFromPoint)) > (REFUEL_HOSE_LENGTH - 2); - if (_tooFar) exitWith { + if (_tooFar && {!(_nozzle getVariable [QGVAR(jerryCan), false])}) exitWith { [LSTRING(Hint_TooFar), 2, _unit] call EFUNC(common,displayTextStructured); [objNull, _nozzle] call FUNC(dropNozzle); @@ -49,6 +48,7 @@ _maxFuel = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(f }; _finished = false; + _fueling = _nozzle getVariable [QGVAR(isRefueling), false]; if (_fueling) then { _fuelInSource = [_source] call FUNC(getFuel); if (_fuelInSource == 0) exitWith { diff --git a/addons/refuel/functions/fnc_takeNozzle.sqf b/addons/refuel/functions/fnc_takeNozzle.sqf index f6d953cecc..3c52748efc 100644 --- a/addons/refuel/functions/fnc_takeNozzle.sqf +++ b/addons/refuel/functions/fnc_takeNozzle.sqf @@ -93,7 +93,11 @@ if (isNull _nozzle) then { // func is called on fuel truck private ["_actionID"]; params ["_args"]; _args params ["_unit", "_nozzle"]; - _nozzle attachTo [_unit, [-0.02,-0.05,0], "righthandmiddle1"]; // TODO replace with right coordinates for real model + if (_nozzle getVariable [QGVAR(jerryCan), false]) then { + _nozzle attachTo [_unit, [0,1,0], "pelvis"]; + } else { + _nozzle attachTo [_unit, [-0.02,-0.05,0], "righthandmiddle1"]; // TODO replace with right coordinates for real model + }; _unit setVariable [QGVAR(nozzle), _nozzle]; _unit setVariable [QGVAR(isRefueling), true]; @@ -122,20 +126,22 @@ if (isNull _nozzle) then { // func is called on fuel truck _target = _nozzle getVariable QGVAR(source); _endPosOffset = _nozzle getVariable QGVAR(attachPos); }; -[{ - private ["_nozzle"]; - params ["_args", "_pfID"]; - _args params ["_unit", "_source", "_endPosOffset"]; +if !(_nozzle getVariable [QGVAR(jerryCan), false]) then { + [{ + private ["_nozzle"]; + params ["_args", "_pfID"]; + _args params ["_unit", "_source", "_endPosOffset"]; - if (_unit distance (_source modelToWorld _endPosOffset) > (REFUEL_HOSE_LENGTH - 2)) exitWith { - _nozzle = _unit getVariable [QGVAR(nozzle), objNull]; - if !(isNull _nozzle) then { - [_unit, _nozzle] call FUNC(dropNozzle); - REFUEL_UNHOLSTER_WEAPON + if (_unit distance (_source modelToWorld _endPosOffset) > (REFUEL_HOSE_LENGTH - 2)) exitWith { + _nozzle = _unit getVariable [QGVAR(nozzle), objNull]; + if !(isNull _nozzle) then { + [_unit, _nozzle] call FUNC(dropNozzle); + REFUEL_UNHOLSTER_WEAPON - [_unit, QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus); - [LSTRING(Hint_TooFar), 2, _unit] call EFUNC(common,displayTextStructured); + [_unit, QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus); + [LSTRING(Hint_TooFar), 2, _unit] call EFUNC(common,displayTextStructured); + }; + [_pfID] call cba_fnc_removePerFrameHandler; }; - [_pfID] call cba_fnc_removePerFrameHandler; - }; -}, 0, [_unit, _target, _endPosOffset]] call cba_fnc_addPerFrameHandler; + }, 0, [_unit, _target, _endPosOffset]] call cba_fnc_addPerFrameHandler; +}; diff --git a/addons/refuel/script_component.hpp b/addons/refuel/script_component.hpp index 28e6fb7931..e8c7514651 100644 --- a/addons/refuel/script_component.hpp +++ b/addons/refuel/script_component.hpp @@ -12,7 +12,7 @@ #include "\z\ace\addons\main\script_macros.hpp" #define REFUEL_INFINITE_FUEL -1 -#define REFUEL_ACTION_DISTANCE 37 +#define REFUEL_ACTION_DISTANCE 7 #define REFUEL_HOSE_LENGTH 12 #define REFUEL_HOLSTER_WEAPON \ diff --git a/addons/refuel/stringtable.xml b/addons/refuel/stringtable.xml index 908fad6d91..b0fb6ec0c6 100644 --- a/addons/refuel/stringtable.xml +++ b/addons/refuel/stringtable.xml @@ -5,156 +5,218 @@ Refuel Settings Betankungseinst. Ustawienia tankowania + Настройки дозаправки + Ajustes de reabastecimento Flow Rate Fließrate Szybkość przepływu + Скорость заправки + Velocidade da vazão How fast should a vehicle be refueled? Wie schnell soll ein Fahrzeug aufgetankt sein? Jak szybko pojazd powinien zostać zatankowany? + Как быстро техника должна быть заправлена? + Quão rápido deve ser o veículo reabastecido? Refuel Betankung Zatankuj + Дозаправка + Reabastecimento Take fuel nozzle Zapfpistole nehmen Weź nalewak + Взять топливный шланг + Pegar o bocal de combustível Taking fuel nozzle ... Nehme Zapfpistole ... Pobieranie nalewaka ... + Берем топливный шланг ... + Pegando o bocal de combustível... Connect fuel nozzle Zapfpistole anschließen Podłącz nalewak + Присоединить топливный шланг + Conectar o bocal de combustível Connecting fuel nozzle ... Zapfpistole anschließen ... Podłączanie nalewaka ... + Присоединяем топливный шланг ... + Conectando o bocal de combustível... Disconnect fuel nozzle Zapfpistole entfernen Odepnij nalewak + Отсоединить топливный шланг + Desconectar o bocal de combustível Connect Anschließen Podłącz + Присоединить + Conectar Check remaining fuel Verbleibenden Kraftstoff überprüfen Sprawdź ilość paliwa + Проверить остаток топлива + Verificar combustível restante Checking remaining fuel ... Überprüfe verbleibenden Kraftstoff ... Sprawdzanie ilości paliwa ... + Проверяем остаток топлива ... + Verificando combustível restante... There are %1 liters left. Es sind noch %1 Liter übrig. Zostało %1 litrów. + Осталось %1 л. + Há %1 litros restantes. There is no fuel left. Es ist kein Kraftstoff übrig. W zbiorniku nie ma paliwa. + Топлива нет. + Não há combustível Cancel Abbrechen Anuluj + Отменить + Cancelar Failed Gescheitert Porażka + Не удалось + Falhou Stop fueling Betankung stoppen Zatrzymaj tankowanie + Остановить заправку + Parar reabastecimento Stopping fueling ... Stoppe Betankung ... Zatrzymywanie tankowania ... + Останавливаем заправку ... + Parando reabastecimento... Start fueling Betankung beginnen Rozpocznij tankowanie + Начать заправку + Começar reabastecimento Starting fueling ... Beginne Betankung ... Rozpoczynanie tankowania ... + Начинаем заправку ... + Começando reabastecimento... %1 Liters fueled %1 Liters getankt Zatankowano %1 litrów + %1 литров заправлено + %1 litros abastecidos The fuel source is empty. Die Treibstoffquelle ist leer. Źródło paliwa jest puste. + Источник топлива пустой. + A fonte de combustível está vazia. Maximum fuel hose length reached. Maximale Schlauchlänge erreicht. Osiągnięto maksymalną długość przewodu paliwowego. + Достигнута максимальная длина шланга. + Distância máxima da mangueira de combustível alcançada. Fueling completed Betankung abgeschlossen Tankowanie ukończone + Заправка завершена + Reabastecimento completo Fueling stopped Betankung angehalten Tankowanie zatrzymane + Заправка остановлена + Reabastecimento parado Fueling started Betankung begonnen Tankowanie rozpoczęte + Заправка начата + Reabastecimento iniciado Return fuel nozzle Zapfpistole zurückstecken Zwróć nalewak + Вернуть топливный шланг + Retornar bocal de combustível Returning fuel nozzle ... Stecke Zapfpistole zurück ... Zwracanie nalewaka ... + Возвращаем топливный шланг ... + Retornando bocal de combustível... Check fuel counter Tankuhr ansehen Sprawdź wskaźnik paliwa + Проверить счетчик топлива + Verificar contador de combustível Checking fuel counter ... Betrachte Tankuhr ... Sprawdzanie wskaźnika paliwa ... + Проверяем счетчик топлива ... + Verificando contador de combustível... %1 liters have been fueled. %1 Liter wurden getankt. %1 litrów zostało zatankowane. + Было заправлено %1 л. + %1 litros foram abastecidos. \ No newline at end of file diff --git a/addons/reload/XEH_postInit.sqf b/addons/reload/XEH_postInit.sqf index bd26583668..8667d9815e 100644 --- a/addons/reload/XEH_postInit.sqf +++ b/addons/reload/XEH_postInit.sqf @@ -7,9 +7,9 @@ if (!hasInterface) exitWith {}; ["ACE3 Weapons", QGVAR(checkAmmo), localize LSTRING(checkAmmo), { // Conditions: canInteract - if !([ACE_player, (vehicle ACE_player), ["isNotInside", "isNotSitting"]] call EFUNC(common,canInteractWith)) exitWith {false}; + if !([ACE_player, vehicle ACE_player, ["isNotInside", "isNotSitting"]] call EFUNC(common,canInteractWith)) exitWith {false}; // Conditions: specific - if !([ACE_player] call EFUNC(common,canUseWeapon) || {(vehicle ACE_player) isKindOf "StaticWeapon"}) exitWith {false}; + if !(ACE_player call EFUNC(common,canUseWeapon) || {(vehicle ACE_player) isKindOf "StaticWeapon"}) exitWith {false}; // Statement [ACE_player] call FUNC(checkAmmo); @@ -20,26 +20,26 @@ if (!hasInterface) exitWith {}; ["setAmmoSync", { //To propagate the setAmmo change, do it on all clients - PARAMS_3(_unit,_weapon,_ammo); + params ["_unit", "_weapon", "_ammo"]; + TRACE_3("setAmmoSync EH",_unit,_weapon,_ammo); + _unit setAmmo [_weapon, _ammo]; }] call EFUNC(common,addEventhandler); // Listen for attempts to link ammo ["linkedAmmo", { - EXPLODE_3_PVT(_this,_receiver,_giver,_magazine); + params ["_receiver", "_giver", "_magazine"]; - private ["_magazineCfg","_magazineType"]; - _magazineType = currentMagazine _receiver; - _magazineCfg = configFile >> "CfgMagazines" >> _magazineType; + private _magazineType = currentMagazine _receiver; + private _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; + private _ammoCount = _receiver ammo currentWeapon _receiver; + private _ammoMissing = getNumber (_magazineCfg >> "count") - _ammoCount; // Return the magazine if the belt is full or empty if ((_ammoCount == 0) || _ammoMissing == 0) exitWith { @@ -47,19 +47,18 @@ if (!hasInterface) exitWith {}; }; // Add the ammo - _ammoAdded = _ammoMissing min (_magazine select 1); - ["setAmmoSync", [_receiver, (currentWeapon _receiver), (_ammoCount + _ammoAdded)]] call EFUNC(common,globalEvent); + private _ammoAdded = _ammoMissing min (_magazine select 1); + ["setAmmoSync", [_receiver, currentWeapon _receiver, _ammoCount + _ammoAdded]] call EFUNC(common,globalEvent); if ((_magazine select 1) - _ammoAdded > 0) then { - ["returnedAmmo", [_giver], [_giver,_receiver,[_magazineType,(_magazine select 1) - _ammoAdded]]] call EFUNC(common,targetEvent); + ["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); + params ["_receiver", "", "_magazine"]; + TRACE_2("returnedAmmo EH",_receiver,_magazine); _receiver addMagazine _magazine; }] call EFUNC(common,addEventhandler); diff --git a/addons/reload/functions/fnc_canLinkBelt.sqf b/addons/reload/functions/fnc_canLinkBelt.sqf index 4461b4f3e3..b36959e4e1 100644 --- a/addons/reload/functions/fnc_canLinkBelt.sqf +++ b/addons/reload/functions/fnc_canLinkBelt.sqf @@ -11,26 +11,24 @@ */ #include "script_component.hpp" -EXPLODE_2_PVT(_this,_player,_target); +params ["_player", "_target"]; if (vehicle _target != _target) exitWith {false}; -private ["_magazineCfg","_magazineType"]; -_magazineType = currentMagazine _target; -_magazineCfg = configFile >> "CfgMagazines" >> _magazineType; +private _magazineType = currentMagazine _target; +private _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; +private _ammoCount = _target ammo currentWeapon _target; // Exit if the belt is full or empty -if ((_ammoCount == 0) || (getNumber (_magazineCfg >> "count") - _ammoCount) == 0) exitWith {false}; +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; +private _maxAmmo = 0; { _maxAmmo = _maxAmmo max (_x select 1); diff --git a/addons/reload/functions/fnc_checkAmmo.sqf b/addons/reload/functions/fnc_checkAmmo.sqf index 2499a9a893..b0581a143a 100644 --- a/addons/reload/functions/fnc_checkAmmo.sqf +++ b/addons/reload/functions/fnc_checkAmmo.sqf @@ -13,10 +13,9 @@ #define COUNT_BARS 12 -EXPLODE_1_PVT(_this,_unit); +params ["_unit"]; -private ["_target"]; -_target = vehicle _unit; +private _target = vehicle _unit; if (count _this > 1) then { _target = _this select 1; diff --git a/addons/reload/functions/fnc_displayAmmo.sqf b/addons/reload/functions/fnc_displayAmmo.sqf index 993283ca56..7fff5564c0 100644 --- a/addons/reload/functions/fnc_displayAmmo.sqf +++ b/addons/reload/functions/fnc_displayAmmo.sqf @@ -12,13 +12,11 @@ #define COUNT_BARS 12 -EXPLODE_1_PVT(_this,_target); +params ["_target"]; -private ["_weapon","_muzzle","_magazine","_showNumber","_ammo","_maxRounds","_count","_text","_color","_picture","_ammoBarsStructuredText", "_a", "_loadedName", "_string"]; - -_weapon = currentWeapon _target; -_muzzle = currentMuzzle _target; -_magazine = currentMagazine _target; +private _weapon = currentWeapon _target; +private _muzzle = currentMuzzle _target; +private _magazine = currentMagazine _target; // currentWeapon returns "" for static weapons before they are shot once if (_target isKindOf "StaticWeapon") then { @@ -31,8 +29,8 @@ if (_target isKindOf "StaticWeapon") then { if (_magazine == "") then { // Try to get magazine using magazinesAmmoFull - private ["_magazines"]; - _magazines = magazinesAmmoFull _target; + private _magazines = magazinesAmmoFull _target; + { if (_x select 2) exitWith { _magazine = _x select 0; @@ -45,10 +43,10 @@ if (_magazine == "") exitWith {}; if (_weapon == "") exitWith {}; if (!( _muzzle isEqualType "")) then {_muzzle = _weapon}; -_showNumber = false; -_ammo = 0; -_maxRounds = 1; -_count = 0; +private _showNumber = false; +private _ammo = 0; +private _maxRounds = 1; +private _count = 0; // not grenade launcher if (_muzzle == _weapon) then { @@ -75,16 +73,16 @@ if (_muzzle == _weapon) then { }; }; -_ammoBarsStructuredText = if (_showNumber) then { +private _ammoBarsStructuredText = if (_showNumber) then { parseText format ["%1x", _count] } else { - _color = [((2 * (1 - _ammo / _maxRounds)) min 1), ((2 * _ammo / _maxRounds) min 1), 0]; + private _color = [((2 * (1 - _ammo / _maxRounds)) min 1), ((2 * _ammo / _maxRounds) min 1), 0]; - _string = ""; + private _string = ""; for "_a" from 1 to _count do { _string = _string + "|"; }; - _text = [_string, _color] call EFUNC(common,stringToColoredText); + private _text = [_string, _color] call EFUNC(common,stringToColoredText); _string = ""; for "_a" from (_count + 1) to (_maxRounds min COUNT_BARS) do { @@ -97,11 +95,11 @@ _ammoBarsStructuredText = if (_showNumber) then { if (_target isKindOf "StaticWeapon") then { //Vehicle mags (usualy) don't have pictures, so just show the text above ammo count - _loadedName = getText (configFile >> "CfgMagazines" >> _magazine >> "displaynameshort"); + private _loadedName = getText (configFile >> "CfgMagazines" >> _magazine >> "displaynameshort"); _loadedName = parseText format ["%1", _loadedName]; - _text = composeText [_loadedName, linebreak, _ammoBarsStructuredText]; + private _text = composeText [_loadedName, linebreak, _ammoBarsStructuredText]; [_text] call EFUNC(common,displayTextStructured); } else { - _picture = getText (configFile >> "CfgMagazines" >> _magazine >> "picture"); + private _picture = getText (configFile >> "CfgMagazines" >> _magazine >> "picture"); [_ammoBarsStructuredText, _picture] call EFUNC(common,displayTextPicture); }; diff --git a/addons/reload/functions/fnc_startLinkingBelt.sqf b/addons/reload/functions/fnc_startLinkingBelt.sqf index 4bed7f700a..ebee6fd350 100644 --- a/addons/reload/functions/fnc_startLinkingBelt.sqf +++ b/addons/reload/functions/fnc_startLinkingBelt.sqf @@ -11,26 +11,24 @@ */ #include "script_component.hpp" -EXPLODE_2_PVT(_this,_player,_target); +params ["_player", "_target"]; if (vehicle _target != _target) exitWith {false}; -private ["_magazineCfg","_magazineType", "_condition", "_onFailure", "_onFinish"]; -_magazineType = currentMagazine _target; -_magazineCfg = configFile >> "CfgMagazines" >> _magazineType; +private _magazineType = currentMagazine _target; +private _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; +private _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; +private _maxAmmo = 0; { _maxAmmo = _maxAmmo max (_x select 1); @@ -38,21 +36,20 @@ _maxAmmo = 0; if (_maxAmmo == 0) exitWith {}; - // Condition to call each frame -_condition = { - EXPLODE_2_PVT((_this select 0),_player,_target); +private _condition = { + (_this select 0) params ["_player", "_target"]; ([_player, _target, []] call EFUNC(common,canInteractWith)) && ((_player distance _target) < 3) && ((speed _target) < 1) }; -_onFinish = { - EXPLODE_3_PVT((_this select 0),_player,_target,_magazine); +private _onFinish = { + (_this select 0) params ["_player", "_target", "_magazine"]; // Raise event on remote unit ["linkedAmmo", [_target], [_target, _player, _magazine]] call EFUNC(common,targetEvent); }; -_onFailure = { +private _onFailure = { EXPLODE_3_PVT((_this select 0),_player,_target,_magazine); [_player, "AmovPknlMstpSrasWrflDnon", 1] call EFUNC(common,doAnimation); diff --git a/addons/repair/ACE_Repair.hpp b/addons/repair/ACE_Repair.hpp index 251302a93a..d47773cd83 100644 --- a/addons/repair/ACE_Repair.hpp +++ b/addons/repair/ACE_Repair.hpp @@ -34,10 +34,11 @@ class ACE_Repair { displayName = CSTRING(Repairing); // let's make empty string an auto generated string displayNameProgress = CSTRING(RepairingHitPoint); condition = QUOTE(call FUNC(canMiscRepair)); - requiredEngineer = 0; + requiredEngineer = QGVAR(engineerSetting_Repair); repairingTime = 15; callbackSuccess = QUOTE(call FUNC(doRepair)); items[] = {"ToolKit"}; + itemConsumed = QGVAR(consumeItem_ToolKit); claimObjects[] = {}; }; class RepairTrack: MiscRepair { @@ -47,6 +48,7 @@ class ACE_Repair { callbackSuccess = QUOTE(call FUNC(doRepairTrack)); requiredEngineer = QGVAR(engineerSetting_Wheel); claimObjects[] = {{"ACE_Track"}}; + itemConsumed = 0; }; class RemoveTrack: MiscRepair { displayName = CSTRING(RemoveTrack); @@ -54,6 +56,7 @@ class ACE_Repair { condition = QUOTE(call FUNC(canRemove)); callbackSuccess = QUOTE(call FUNC(doRemoveTrack)); requiredEngineer = QGVAR(engineerSetting_Wheel); + itemConsumed = 0; }; class ReplaceTrack: RemoveTrack { displayName = CSTRING(ReplaceTrack); @@ -71,6 +74,7 @@ class ACE_Repair { repairingTime = 30; condition = "damage _target > 0"; callbackSuccess = QUOTE(call FUNC(doFullRepair)); + itemConsumed = QGVAR(consumeItem_ToolKit); }; }; }; diff --git a/addons/repair/ACE_Settings.hpp b/addons/repair/ACE_Settings.hpp index 22e68ce3e9..c3c8daad16 100644 --- a/addons/repair/ACE_Settings.hpp +++ b/addons/repair/ACE_Settings.hpp @@ -41,7 +41,7 @@ class ACE_Settings { displayName = CSTRING(consumeItem_ToolKit_name); description = CSTRING(consumeItem_ToolKit_description); typeName = "SCALAR"; - value = 1; + value = 0; values[] = {ECSTRING(common,No), ECSTRING(common,Yes)}; category = ECSTRING(OptionsMenu,CategoryLogistics); }; diff --git a/addons/repair/CfgVehicles.hpp b/addons/repair/CfgVehicles.hpp index 0b370bd2d3..1968023881 100644 --- a/addons/repair/CfgVehicles.hpp +++ b/addons/repair/CfgVehicles.hpp @@ -302,8 +302,8 @@ class CfgVehicles { MACRO_REPAIRVEHICLE }; - class thingX; - class ACE_RepairItem_Base: thingX { + class ThingX; + class ACE_RepairItem_Base: ThingX { XEH_ENABLED; icon = "iconObject_circle"; mapSize = 0.7; diff --git a/addons/repair/functions/fnc_getPostRepairDamage.sqf b/addons/repair/functions/fnc_getPostRepairDamage.sqf index 36e4bf39ae..9388f4474d 100644 --- a/addons/repair/functions/fnc_getPostRepairDamage.sqf +++ b/addons/repair/functions/fnc_getPostRepairDamage.sqf @@ -17,10 +17,15 @@ params ["_unit"]; TRACE_1("params",_unit); -// TODO when near repair station, full repair? +//If in facility or near vehicle then complete repair of hitpoint: if (([_unit] call FUNC(isInRepairFacility) || {[_unit] call FUNC(isNearRepairVehicle)})) exitWith {0}; -if ([_unit, GVAR(engineerSetting_Repair) + 1] call FUNC(isEngineer)) exitWith {GVAR(repairDamageThreshold_Engineer)}; -if ([_unit, GVAR(engineerSetting_Repair)] call FUNC(isEngineer)) exitWith {GVAR(repairDamageThreshold)}; -0.3; +private _class = _unit getVariable ["ACE_IsEngineer", getNumber (configFile >> "CfgVehicles" >> typeOf _unit >> "engineer")]; +//If specialist or more qualified than min, then use engineer threshold: +if ((_class isEqualTo 2) || {[_unit, GVAR(engineerSetting_Repair) + 1] call FUNC(isEngineer)}) exitWith { + (GVAR(repairDamageThreshold_Engineer) min GVAR(repairDamageThreshold)) +}; + +//Return default threshold: +GVAR(repairDamageThreshold) diff --git a/addons/repair/functions/fnc_isEngineer.sqf b/addons/repair/functions/fnc_isEngineer.sqf index 485a300260..d07c12af64 100644 --- a/addons/repair/functions/fnc_isEngineer.sqf +++ b/addons/repair/functions/fnc_isEngineer.sqf @@ -26,4 +26,4 @@ _class = _unit getVariable ["ACE_IsEngineer", getNumber (configFile >> "CfgVehic // We cannot move this function to common because we require the GVAR(engineerSetting_Repair), which only makes sense to include in the repair module. if (_class isEqualType false) then {_class = [0, 1] select _class}; -_class >= (_engineerN min GVAR(engineerSetting_Repair)); +_class >= _engineerN; diff --git a/addons/repair/functions/fnc_repair.sqf b/addons/repair/functions/fnc_repair.sqf index 304a804814..25e58151c5 100644 --- a/addons/repair/functions/fnc_repair.sqf +++ b/addons/repair/functions/fnc_repair.sqf @@ -128,7 +128,7 @@ _consumeItems = if (isNumber (_config >> "itemConsumed")) then { _usersOfItems = []; if (_consumeItems > 0) then { - _usersOfItems = ([_caller, _target, _items] call FUNC(useItems)) select 1; + _usersOfItems = ([_caller, _items] call FUNC(useItems)) select 1; }; // Parse the config for the progress callback diff --git a/addons/repair/stringtable.xml b/addons/repair/stringtable.xml index 2c0c4300c5..64fecd5de8 100644 --- a/addons/repair/stringtable.xml +++ b/addons/repair/stringtable.xml @@ -682,6 +682,9 @@ Üveg Стекло + + ERA + Repair Settings Reperatureinstellungen diff --git a/addons/respawn/functions/fnc_showFriendlyFireMessage.sqf b/addons/respawn/functions/fnc_showFriendlyFireMessage.sqf index 1c5a7b7cc2..1079ef6e6d 100644 --- a/addons/respawn/functions/fnc_showFriendlyFireMessage.sqf +++ b/addons/respawn/functions/fnc_showFriendlyFireMessage.sqf @@ -19,7 +19,7 @@ params ["_unit", "_killer"]; if (_unit != _killer && {side group _unit in [side group ACE_player, civilian]} && {side group _killer == side group ACE_player}) then { - systemChat format ["%1 was killed by %2", [_unit] call EFUNC(common,getName), [_killer] call EFUNC(common,getName)]; + systemChat format ["%1 was killed by %2", [_unit, false, true] call EFUNC(common,getName), [_killer, false, true] call EFUNC(common,getName)]; // Raise ACE globalEvent ["killedByFriendly", [_unit, _killer]] call EFUNC(common,globalEvent); diff --git a/addons/sandbag/CfgVehicles.hpp b/addons/sandbag/CfgVehicles.hpp index a2b255318e..71276b91d7 100644 --- a/addons/sandbag/CfgVehicles.hpp +++ b/addons/sandbag/CfgVehicles.hpp @@ -42,8 +42,8 @@ class CfgVehicles { }; };*/ - class thingX; - class ACE_SandbagObject: thingX { + class ThingX; + class ACE_SandbagObject: ThingX { author = ECSTRING(common,ACETeam); XEH_ENABLED; scope = 1; diff --git a/addons/sitting/XEH_clientInit.sqf b/addons/sitting/XEH_clientInit.sqf index 23816bd8d7..a167e0fea5 100644 --- a/addons/sitting/XEH_clientInit.sqf +++ b/addons/sitting/XEH_clientInit.sqf @@ -3,9 +3,16 @@ // Exit on Headless if (!hasInterface) exitWith {}; -// Add interaction menu exception -["isNotSitting", {isNil {(_this select 0) getVariable QGVAR(isSitting)}}] call EFUNC(common,addCanInteractWithCondition); +["SettingsInitialized", { + TRACE_1("SettingInit", GVAR(enable)); + + //If not enabled, then do not add CanInteractWith Condition or event handlers: + if (!GVAR(enable)) exitWith {}; -// Handle interruptions -["medical_onUnconscious", {_this call DFUNC(handleInterrupt)}] call EFUNC(common,addEventhandler); -["SetHandcuffed", {_this call DFUNC(handleInterrupt)}] call EFUNC(common,addEventhandler); + // Add interaction menu exception + ["isNotSitting", {isNil {(_this select 0) getVariable QGVAR(isSitting)}}] call EFUNC(common,addCanInteractWithCondition); + + // Handle interruptions + ["medical_onUnconscious", {_this call DFUNC(handleInterrupt)}] call EFUNC(common,addEventhandler); + ["SetHandcuffed", {_this call DFUNC(handleInterrupt)}] call EFUNC(common,addEventhandler); +}] call EFUNC(common,addEventHandler); diff --git a/addons/sitting/functions/fnc_addSitActions.sqf b/addons/sitting/functions/fnc_addSitActions.sqf index 18779d9229..98c9aba99f 100644 --- a/addons/sitting/functions/fnc_addSitActions.sqf +++ b/addons/sitting/functions/fnc_addSitActions.sqf @@ -16,19 +16,28 @@ #include "script_component.hpp" params ["_seat"]; -private ["_type", "_sitAction"]; -_type = typeOf _seat; +private _type = typeOf _seat; // Exit if the object is not specified as a seat if (getNumber (configFile >> "CfgVehicles" >> _type >> QGVAR(canSit)) != 1) exitWith {}; +// only run this after the settings are initialized +if !(EGVAR(common,settingsInitFinished)) exitWith { + EGVAR(common,runAtSettingsInitialized) pushBack [FUNC(addSitActions), _this]; +}; + +//If not enabled, don't add actions: +if (!GVAR(enable)) exitWith {}; + // Exit if class already initialized if (_type in GVAR(initializedClasses)) exitWith {}; GVAR(initializedClasses) pushBack _type; -_sitAction = [ +TRACE_1("Adding Sit Action",_type); + +private _sitAction = [ QGVAR(Sit), localize LSTRING(Sit), QUOTE(PATHTOF(UI\sit_ca.paa)), diff --git a/addons/sitting/functions/fnc_getRandomAnimation.sqf b/addons/sitting/functions/fnc_getRandomAnimation.sqf index ca9a9ccfb1..ed49b11e92 100644 --- a/addons/sitting/functions/fnc_getRandomAnimation.sqf +++ b/addons/sitting/functions/fnc_getRandomAnimation.sqf @@ -15,10 +15,8 @@ */ #include "script_component.hpp" -private "_animations"; - // Animations Pool -_animations = [ +private _animations = [ QGVAR(HubSittingChairA_idle1), QGVAR(HubSittingChairA_idle2), QGVAR(HubSittingChairA_idle3), diff --git a/addons/sitting/functions/fnc_sit.sqf b/addons/sitting/functions/fnc_sit.sqf index 24245699bc..7aa1c4c55b 100644 --- a/addons/sitting/functions/fnc_sit.sqf +++ b/addons/sitting/functions/fnc_sit.sqf @@ -16,15 +16,13 @@ */ #include "script_component.hpp" -private ["_actionID", "_configFile", "_sitDirection", "_sitPosition", "_seatPosOrig"]; - params ["_seat", "_player"]; // Overwrite weird position, because Arma decides to set it differently based on current animation/stance... _player switchMove "amovpknlmstpsraswrfldnon"; // Add scroll-wheel action to release object -_actionID = _player addAction [ +private _actionID = _player addAction [ format ["%1", localize LSTRING(Stand)], QUOTE((_this select 0) call FUNC(stand)), nil, @@ -36,9 +34,9 @@ _actionID = _player addAction [ ]; // Read config -_configFile = configFile >> "CfgVehicles" >> typeOf _seat; -_sitDirection = (getDir _seat) + getNumber (_configFile >> QGVAR(sitDirection)); -_sitPosition = getArray (_configFile >> QGVAR(sitPosition)); +private _configFile = configFile >> "CfgVehicles" >> typeOf _seat; +private _sitDirection = (getDir _seat) + getNumber (_configFile >> QGVAR(sitDirection)); +private _sitPosition = getArray (_configFile >> QGVAR(sitPosition)); // Get random animation and perform it (before moving player to ensure correct placement) [_player, call FUNC(getRandomAnimation), 2] call EFUNC(common,doAnimation); // Correctly places when using non-transitional animations @@ -55,7 +53,7 @@ _seat setVariable [QGVAR(seatOccupied), true, true]; // To prevent multiple peop // Add automatical stand PFH in case of interruptions -_seatPosOrig = getPosASL _seat; +private _seatPosOrig = getPosASL _seat; [{ params ["_args", "_pfhId"]; _args params ["_player", "_seat", "_seatPosOrig"]; diff --git a/addons/sitting/functions/fnc_stand.sqf b/addons/sitting/functions/fnc_stand.sqf index 4c08461746..a51f4203fc 100644 --- a/addons/sitting/functions/fnc_stand.sqf +++ b/addons/sitting/functions/fnc_stand.sqf @@ -16,7 +16,6 @@ #include "script_component.hpp" params ["_player"]; -private ["_animation"]; (_player getVariable QGVAR(isSitting)) params ["_seat", "_actionID"]; @@ -24,7 +23,7 @@ private ["_animation"]; _player removeAction _actionID; // Restore animation -_animation = switch (currentWeapon _player) do { +private _animation = switch (currentWeapon _player) do { case "": {"amovpercmstpsnonwnondnon"}; case (primaryWeapon _player): {"amovpercmstpslowwrfldnon"}; case (handgunWeapon _player): {"amovpercmstpslowwpstdnon"}; diff --git a/addons/spectator/functions/fnc_setSpectator.sqf b/addons/spectator/functions/fnc_setSpectator.sqf index 333dc023c9..d8a0219110 100644 --- a/addons/spectator/functions/fnc_setSpectator.sqf +++ b/addons/spectator/functions/fnc_setSpectator.sqf @@ -127,6 +127,12 @@ if (_set) then { GVAR(unitCamera) = nil; GVAR(targetCamera) = nil; + //Kill these PFEH handlers now because the PFEH can run before the `onunload` event is handled + GVAR(camHandler) = nil; + GVAR(compHandler) = nil; + GVAR(iconHandler) = nil; + GVAR(toolHandler) = nil; + // Cleanup display variables GVAR(ctrlKey) = nil; GVAR(heldKeys) = nil; diff --git a/addons/tripod/CfgVehicles.hpp b/addons/tripod/CfgVehicles.hpp index 60486b8afb..de16d6867a 100644 --- a/addons/tripod/CfgVehicles.hpp +++ b/addons/tripod/CfgVehicles.hpp @@ -32,8 +32,8 @@ class CfgVehicles { }; }; - class thingX; - class ACE_TripodObject: thingX { + class ThingX; + class ACE_TripodObject: ThingX { XEH_ENABLED; EGVAR(dragging,canDrag) = 1; EGVAR(dragging,dragPosition[]) = {0,1,0}; diff --git a/addons/tripod/stringtable.xml b/addons/tripod/stringtable.xml index c6366ba8de..16dd89a1f9 100644 --- a/addons/tripod/stringtable.xml +++ b/addons/tripod/stringtable.xml @@ -3,7 +3,7 @@ SSWT Kit - Scharfschützenzweibein + Scharfschützendreibein Снайперский штатив Trójnóg snajperski SSWT Kit @@ -15,7 +15,7 @@ Place SSWT Kit - Scharfschützenzweibein aufstellen + Scharfschützendreibein aufstellen Установить снайперский штатив Postaw trójnóg snajperski Place SSWT Kit @@ -30,7 +30,7 @@ Podnieś trójnóg snajperski Coger equipo SSWT Zvednout SSWT soupravu - SSWT-Werkzeug aufheben + Scharfschützendreibein einpacken Pegar kit SSWT Prendre le kit SSWT SSWT készlet felvétele @@ -41,7 +41,7 @@ Reguluj trójnóg snajperski Ajustar equipo SSWT Regulovat SSWT soupravu - SSWT-Werkzeug anpassen + Scharfschützendreibein anpassen Ajustar kit SSWT Régler le kit SSWT SSWT készlet állítása diff --git a/addons/vehicles/functions/fnc_speedLimiter.sqf b/addons/vehicles/functions/fnc_speedLimiter.sqf index 5f5d8a2914..2d445be3c8 100644 --- a/addons/vehicles/functions/fnc_speedLimiter.sqf +++ b/addons/vehicles/functions/fnc_speedLimiter.sqf @@ -16,8 +16,6 @@ */ #include "script_component.hpp" -private "_maxSpeed"; - params ["_driver", "_vehicle"]; if (GVAR(isSpeedLimiter)) exitWith { @@ -30,7 +28,7 @@ if (GVAR(isSpeedLimiter)) exitWith { playSound "ACE_Sound_Click"; GVAR(isSpeedLimiter) = true; -_maxSpeed = speed _vehicle max 10; +private _maxSpeed = speed _vehicle max 10; [{ params ["_args", "_idPFH"]; @@ -51,8 +49,7 @@ _maxSpeed = speed _vehicle max 10; [_idPFH] call CBA_fnc_removePerFrameHandler; }; - private "_speed"; - _speed = speed _vehicle; + private _speed = speed _vehicle; if (_speed > _maxSpeed) then { _vehicle setVelocity ((velocity _vehicle) vectorMultiply ((_maxSpeed / _speed) - 0.00001)); // fix 1.42-hotfix PhysX libraries applying force in previous direction when turning diff --git a/addons/viewdistance/stringtable.xml b/addons/viewdistance/stringtable.xml index 9d92c58332..673f09783d 100644 --- a/addons/viewdistance/stringtable.xml +++ b/addons/viewdistance/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -234,6 +234,8 @@ FoV Based + Зависит от зума + Baseado em FoV View Distance: @@ -280,4 +282,4 @@ Видео настройки - + \ No newline at end of file diff --git a/addons/weaponselect/XEH_postInit.sqf b/addons/weaponselect/XEH_postInit.sqf index 491a86f39d..450086aa91 100644 --- a/addons/weaponselect/XEH_postInit.sqf +++ b/addons/weaponselect/XEH_postInit.sqf @@ -105,8 +105,7 @@ if (!hasInterface) exitWith {}; if ((currentWeapon ACE_player) != "") then { [ACE_player] call FUNC(putWeaponAway); } else { - private ["_weapon"]; - _weapon = switch (true) do { + private _weapon = switch (true) do { case ((primaryWeapon ACE_player) != ""): {primaryWeapon ACE_player}; case ((handgunWeapon ACE_player) != ""): {handgunWeapon ACE_player}; case ((secondaryWeapon ACE_player) != ""): {secondaryWeapon ACE_player}; diff --git a/addons/weaponselect/XEH_preInit.sqf b/addons/weaponselect/XEH_preInit.sqf index fe40d33523..26347fc279 100644 --- a/addons/weaponselect/XEH_preInit.sqf +++ b/addons/weaponselect/XEH_preInit.sqf @@ -17,16 +17,14 @@ GVAR(GrenadesAll) = []; GVAR(GrenadesFrag) = []; GVAR(GrenadesNonFrag) = []; -private ["_magazines", "_ammo", "_explosive"]; - { - _magazines = getArray (configFile >> "CfgWeapons" >> "Throw" >> _x >> "magazines"); + private _magazines = getArray (configFile >> "CfgWeapons" >> "Throw" >> _x >> "magazines"); GVAR(GrenadesAll) append _magazines; { - _ammo = getText (configFile >> "CfgMagazines" >> _x >> "ammo"); - _explosive = getNumber (configFile >> "CfgAmmo" >> _ammo >> "explosive"); + private _ammo = getText (configFile >> "CfgMagazines" >> _x >> "ammo"); + private _explosive = getNumber (configFile >> "CfgAmmo" >> _ammo >> "explosive"); ([GVAR(GrenadesFrag), GVAR(GrenadesNonFrag)] select (_explosive == 0)) pushBack _x; false diff --git a/addons/weaponselect/functions/fnc_displayGrenadeTypeAndNumber.sqf b/addons/weaponselect/functions/fnc_displayGrenadeTypeAndNumber.sqf index 4ab09a105f..ef9397ba57 100644 --- a/addons/weaponselect/functions/fnc_displayGrenadeTypeAndNumber.sqf +++ b/addons/weaponselect/functions/fnc_displayGrenadeTypeAndNumber.sqf @@ -20,12 +20,10 @@ if !(GVAR(DisplayText)) exitWith {}; params ["_magazine", "_numberofGrenades"]; -private ["_color", "_name", "_text", "_picture"]; +private _color = [[1, 0, 0], [1, 1, 1]] select (_numberofGrenades > 0); +private _name = getText (configFile >> "CfgMagazines" >> _magazine >> "displayNameShort"); -_color = [[1, 0, 0], [1, 1, 1]] select (_numberofGrenades > 0); -_name = getText (configFile >> "CfgMagazines" >> _magazine >> "displayNameShort"); - -_text = [format ["%1 x%2", _name, _numberofGrenades], _color] call EFUNC(common,stringToColoredText); -_picture = getText (configFile >> "CfgMagazines" >> _magazine >> "picture"); +private _text = [format ["%1 x%2", _name, _numberofGrenades], _color] call EFUNC(common,stringToColoredText); +private _picture = getText (configFile >> "CfgMagazines" >> _magazine >> "picture"); ["displayTextPicture", [_text, _picture]] call EFUNC(common,localEvent); diff --git a/addons/weaponselect/functions/fnc_fireSmokeLauncher.sqf b/addons/weaponselect/functions/fnc_fireSmokeLauncher.sqf index 71ef89ecf6..bb877ea3cd 100644 --- a/addons/weaponselect/functions/fnc_fireSmokeLauncher.sqf +++ b/addons/weaponselect/functions/fnc_fireSmokeLauncher.sqf @@ -17,11 +17,8 @@ params ["_vehicle"]; -private ["_turret", "_weapons"]; - -_turret = [_vehicle] call EFUNC(common,getTurretCommander); - -_weapons = _vehicle weaponsTurret _turret; +private _turret = _vehicle call EFUNC(common,getTurretCommander); +private _weapons = _vehicle weaponsTurret _turret; if ( count _weapons > 1 @@ -32,8 +29,8 @@ if ( // avoid infinite loop if !("SmokeLauncher" in _weapons) exitWith {}; - private "_index"; - _index = 0; + private _index = 0; + while { _vehicle currentWeaponTurret _turret != "SmokeLauncher" } do { @@ -44,8 +41,7 @@ if ( } else { // fire away! - private "_logic"; - _logic = createGroup sideLogic createUnit ["Logic", [0,0,0], [], 0, "NONE"]; + private _logic = createGroup sideLogic createUnit ["Logic", [0,0,0], [], 0, "NONE"]; _logic action ["useWeapon", _vehicle, commander _vehicle, 0]; diff --git a/addons/weaponselect/functions/fnc_playChangeFiremodeSound.sqf b/addons/weaponselect/functions/fnc_playChangeFiremodeSound.sqf index 28ef5d21e5..a7c3f13936 100644 --- a/addons/weaponselect/functions/fnc_playChangeFiremodeSound.sqf +++ b/addons/weaponselect/functions/fnc_playChangeFiremodeSound.sqf @@ -18,14 +18,12 @@ params ["_unit", "_weapon"]; -private ["_sound", "_position"]; - -_sound = getArray (configFile >> "CfgWeapons" >> _weapon >> "changeFiremodeSound"); +private _sound = getArray (configFile >> "CfgWeapons" >> _weapon >> "changeFiremodeSound"); if (_sound isEqualTo []) exitWith {}; // get position where to play the sound (position of the weapon) -_position = AGLToASL (_unit modelToWorldVisual (_unit selectionPosition "RightHand")); +private _position = AGLToASL (_unit modelToWorldVisual (_unit selectionPosition "RightHand")); _sound params ["_filename", ["_volume", 1], ["_soundPitch", 1], ["_distance", 0]]; diff --git a/addons/weaponselect/functions/fnc_putWeaponAway.sqf b/addons/weaponselect/functions/fnc_putWeaponAway.sqf index fd1e463a4d..d2747bf23f 100644 --- a/addons/weaponselect/functions/fnc_putWeaponAway.sqf +++ b/addons/weaponselect/functions/fnc_putWeaponAway.sqf @@ -17,6 +17,6 @@ params ["_unit"]; -[_unit] call EFUNC(common,fixLoweredRifleAnimation); +_unit call EFUNC(common,fixLoweredRifleAnimation); _unit action ["SwitchWeapon", _unit, _unit, 99]; diff --git a/addons/weaponselect/functions/fnc_selectNextGrenade.sqf b/addons/weaponselect/functions/fnc_selectNextGrenade.sqf index d4a00b5718..a4e93814a9 100644 --- a/addons/weaponselect/functions/fnc_selectNextGrenade.sqf +++ b/addons/weaponselect/functions/fnc_selectNextGrenade.sqf @@ -18,10 +18,8 @@ params ["_unit", ["_type", 0]]; -private ["_currentGrenade", "_magazines", "_grenades", "_nextGrenadeIndex", "_nextGrenade", "_uniformGrenades", "_vestGrenades", "_backpackGrenades"]; - // get currently selected grenade -_currentGrenade = currentThrowable _unit; +private _currentGrenade = currentThrowable _unit; // get correct array format if no grenade is selected if (_currentGrenade isEqualTo []) then { @@ -31,9 +29,9 @@ if (_currentGrenade isEqualTo []) then { _currentGrenade = _currentGrenade select 0; // get available magazines for that unit -_magazines = magazines _unit; +private _magazines = magazines _unit; -_grenades = []; +private _grenades = []; { if (_x in _magazines) then { @@ -46,22 +44,22 @@ _grenades = []; if (_grenades isEqualTo []) exitWith {false}; // get next grenade muzzle -_nextGrenadeIndex = (_grenades find _currentGrenade) + 1; +private _nextGrenadeIndex = (_grenades find _currentGrenade) + 1; // roll over if the last grenade was selected if (_nextGrenadeIndex >= count _grenades) then { _nextGrenadeIndex = 0; }; -_nextGrenade = _grenades select _nextGrenadeIndex; +private _nextGrenade = _grenades select _nextGrenadeIndex; // abort if the same grenade would be selected if (_currentGrenade == _nextGrenade) exitWith {false}; // current best method to select a grenade: remove all grenades except the one you want to select, then add them back -_uniformGrenades = [uniformItems _unit, {_x in GVAR(GrenadesAll) && {_x != _nextGrenade}}] call EFUNC(common,filter); -_vestGrenades = [vestItems _unit, {_x in GVAR(GrenadesAll) && {_x != _nextGrenade}}] call EFUNC(common,filter); -_backpackGrenades = [backpackItems _unit, {_x in GVAR(GrenadesAll) && {_x != _nextGrenade}}] call EFUNC(common,filter); +private _uniformGrenades = [uniformItems _unit, {_x in GVAR(GrenadesAll) && {_x != _nextGrenade}}] call EFUNC(common,filter); +private _vestGrenades = [vestItems _unit, {_x in GVAR(GrenadesAll) && {_x != _nextGrenade}}] call EFUNC(common,filter); +private _backpackGrenades = [backpackItems _unit, {_x in GVAR(GrenadesAll) && {_x != _nextGrenade}}] call EFUNC(common,filter); // remove all grenades except those we are switching to --> this breaks the selector {_unit removeItemFromUniform _x; false} count _uniformGrenades; diff --git a/addons/weaponselect/functions/fnc_selectWeaponMode.sqf b/addons/weaponselect/functions/fnc_selectWeaponMode.sqf index 815b8d28cf..80784778de 100644 --- a/addons/weaponselect/functions/fnc_selectWeaponMode.sqf +++ b/addons/weaponselect/functions/fnc_selectWeaponMode.sqf @@ -29,20 +29,18 @@ if (_weapon in (_unit getVariable [QEGVAR(safemode,safedWeapons), []])) exitWith [_unit, _weapon, _weapon] call EFUNC(safemode,unlockSafety); }; -private ["_muzzles", "_modes"]; +private _muzzles = [_weapon] call EFUNC(common,getWeaponMuzzles); +private _modes = [_weapon] call EFUNC(common,getWeaponModes); -_muzzles = [_weapon] call EFUNC(common,getWeaponMuzzles); -_modes = [_weapon] call EFUNC(common,getWeaponModes); +private _index = (_modes find currentWeaponMode _unit) + 1; -private ["_index", "_muzzle", "_mode"]; - -_index = (_modes find currentWeaponMode _unit) + 1; if (_index > count _modes - 1) then {_index = 0}; -_muzzle = _muzzles select 0; -_mode = _modes select _index; +private _muzzle = _muzzles select 0; +private _mode = _modes select _index; _index = 0; + while { _index < 100 && {currentMuzzle _unit != _muzzle || {currentWeaponMode _unit != _mode}} } do { diff --git a/addons/weaponselect/functions/fnc_selectWeaponMuzzle.sqf b/addons/weaponselect/functions/fnc_selectWeaponMuzzle.sqf index 71c9cfc7b4..973d34f7c8 100644 --- a/addons/weaponselect/functions/fnc_selectWeaponMuzzle.sqf +++ b/addons/weaponselect/functions/fnc_selectWeaponMuzzle.sqf @@ -20,8 +20,7 @@ params ["_unit", "_weapon"]; if (_weapon == "") exitWith {}; -private "_muzzles"; -_muzzles = [_weapon] call EFUNC(common,getWeaponMuzzles); +private _muzzles = _weapon call EFUNC(common,getWeaponMuzzles); if (currentWeapon _unit != _weapon) exitWith { if (count _muzzles > 1) then { @@ -35,12 +34,11 @@ if (currentWeapon _unit != _weapon) exitWith { }; }; -private ["_index", "_muzzle"]; +private _index = (_muzzles find currentMuzzle _unit) + 1; -_index = (_muzzles find currentMuzzle _unit) + 1; if (_index > count _muzzles - 1) then {_index = 1}; -_muzzle = _muzzles select _index; +private _muzzle = _muzzles select _index; _index = 0; while { diff --git a/addons/weaponselect/functions/fnc_selectWeaponVehicle.sqf b/addons/weaponselect/functions/fnc_selectWeaponVehicle.sqf index 9695079da5..7435dd30d8 100644 --- a/addons/weaponselect/functions/fnc_selectWeaponVehicle.sqf +++ b/addons/weaponselect/functions/fnc_selectWeaponVehicle.sqf @@ -19,39 +19,36 @@ params ["_unit", "_vehicle", "_index"]; -private "_turret"; -_turret = [_unit] call EFUNC(common,getTurretIndex); +private _turret = _unit call EFUNC(common,getTurretIndex); if (_turret isEqualTo [] && {_unit == driver _vehicle}) then { - private ["_weapons", "_weapon"]; + private _weapons = weapons _vehicle; - _weapons = weapons _vehicle; if (_index > count _weapons - 1) exitWith {}; - _weapon = _weapons select _index; + private _weapon = _weapons select _index; _index = 0; + while { _index < 100 && {currentWeapon _vehicle != _weapon} } do { _unit action ["SwitchWeapon", _vehicle, _unit, _index]; _index = _index + 1; }; - } else { - private ["_weapons", "_weapon"]; + private _weapons = _vehicle weaponsTurret _turret; - _weapons = _vehicle weaponsTurret _turret; if (_index > count _weapons - 1) exitWith {}; - _weapon = _weapons select _index; + private _weapon = _weapons select _index; _index = 0; + while { _index < 100 && {_vehicle currentWeaponTurret _turret != _weapon} } do { _unit action ["SwitchWeapon", _vehicle, _unit, _index]; _index = _index + 1; }; - }; diff --git a/addons/weaponselect/functions/fnc_throwGrenade.sqf b/addons/weaponselect/functions/fnc_throwGrenade.sqf index 2cdc8e63dc..a99b06879b 100644 --- a/addons/weaponselect/functions/fnc_throwGrenade.sqf +++ b/addons/weaponselect/functions/fnc_throwGrenade.sqf @@ -25,8 +25,7 @@ params ["_unit", "_weapon", "", "", "", "_magazine"]; if (_weapon != "Throw") exitWith {}; -private "_count"; -_count = {_x == _magazine} count magazines _unit; +private _count = {_x == _magazine} count magazines _unit; [_magazine, _count] call FUNC(displayGrenadeTypeAndNumber); diff --git a/mod.cpp b/mod.cpp index f20926ece5..b780224df9 100644 --- a/mod.cpp +++ b/mod.cpp @@ -1,8 +1,8 @@ -name = "Advanced Combat Environment 3.4.1"; +name = "Advanced Combat Environment 3.4.2"; picture = "logo_ace3_ca.paa"; actionName = "GitHub"; action = "https://github.com/acemod/ACE3"; -description = "ACE3 - Version 3.4.1"; +description = "ACE3 - Version 3.4.2"; logo = "logo_ace3_ca.paa"; logoOver = "logo_ace3_ca.paa"; tooltip = "ACE3"; diff --git a/optionals/compat_cup/$PBOPREFIX$ b/optionals/compat_cup/$PBOPREFIX$ deleted file mode 100644 index 42044805ba..0000000000 --- a/optionals/compat_cup/$PBOPREFIX$ +++ /dev/null @@ -1 +0,0 @@ -z\ace\addons\compat_cup \ No newline at end of file diff --git a/optionals/compat_cup/CfgMagazines.hpp b/optionals/compat_cup/CfgMagazines.hpp deleted file mode 100644 index b05b0c3efd..0000000000 --- a/optionals/compat_cup/CfgMagazines.hpp +++ /dev/null @@ -1,48 +0,0 @@ -class CfgMagazines { - class CUP_M136_M; - class CUP_RPG18_M; - class CUP_NLAW_M; - class ACE_PreloadedMissileDummy_CUP: CUP_M136_M { // The dummy magazine - author = "$STR_ACE_Common_ACETeam"; - scope = 1; - scopeArsenal = 1; - displayName = "Preloaded Missle"; - //displayName = "$STR_ACE_Disposable_PreloadedMissileDummy"; - picture = PATHTOEF(common,UI\blank_CO.paa); - weaponPoolAvailable = 0; - mass = 0; - }; - class ACE_FiredMissileDummy_CUP: ACE_PreloadedMissileDummy_CUP { - count = 0; - }; - class ACE_UsedTube_M136_F: CUP_M136_M { - author = "$STR_ACE_Common_ACETeam"; - displayName = "$STR_ACE_Disposable_UsedTube"; - descriptionShort = "$STR_ACE_Disposable_UsedTubeDescription"; - displayNameShort = "-"; - count = 0; - weaponPoolAvailable = 0; - modelSpecial = ""; - mass = 0; - }; - class ACE_UsedTube_RPG18_F: CUP_RPG18_M { - author = "$STR_ACE_Common_ACETeam"; - displayName = "$STR_ACE_Disposable_UsedTube"; - descriptionShort = "$STR_ACE_Disposable_UsedTubeDescription"; - displayNameShort = "-"; - count = 0; - weaponPoolAvailable = 0; - modelSpecial = ""; - mass = 0; - }; - class ACE_UsedTube_NLAW_F: CUP_NLAW_M { - author = "$STR_ACE_Common_ACETeam"; - displayName = "$STR_ACE_Disposable_UsedTube"; - descriptionShort = "$STR_ACE_Disposable_UsedTubeDescription"; - displayNameShort = "-"; - count = 0; - weaponPoolAvailable = 0; - modelSpecial = ""; - mass = 0; - }; -}; \ No newline at end of file diff --git a/optionals/compat_cup/CfgWeapons.hpp b/optionals/compat_cup/CfgWeapons.hpp deleted file mode 100644 index bbd49548da..0000000000 --- a/optionals/compat_cup/CfgWeapons.hpp +++ /dev/null @@ -1,271 +0,0 @@ -class CfgWeapons -{ - class Launcher_Base_F; - class ItemCore; - class InventoryOpticsItem_Base_F; - - class CUP_optic_SB_3_12x50_PMII : ItemCore { - ACE_ScopeAdjust_Vertical[] = { -4, 30 }; - ACE_ScopeAdjust_Horizontal[] = { -6, 6 }; - ACE_ScopeAdjust_VerticalIncrement = 0.1; - ACE_ScopeAdjust_HorizontalIncrement = 0.1; - class ItemInfo : InventoryOpticsItem_Base_F { - class OpticsModes { - class LRR { - discreteDistance[] = { 100 }; - discreteDistanceInitIndex = 0; - }; - }; - }; - }; - class CUP_optic_LeupoldMk4 : ItemCore { - ACE_ScopeAdjust_Vertical[] = { -4, 30 }; - ACE_ScopeAdjust_Horizontal[] = { -6, 6 }; - ACE_ScopeAdjust_VerticalIncrement = 0.1; - ACE_ScopeAdjust_HorizontalIncrement = 0.1; - class ItemInfo : InventoryOpticsItem_Base_F { - class OpticsModes { - class LRR { - discreteDistance[] = { 100 }; - discreteDistanceInitIndex = 0; - }; - }; - }; - }; - class CUP_optic_Leupold_VX3 : ItemCore { - ACE_ScopeAdjust_Vertical[] = { -4, 30 }; - ACE_ScopeAdjust_Horizontal[] = { -6, 6 }; - ACE_ScopeAdjust_VerticalIncrement = 0.1; - ACE_ScopeAdjust_HorizontalIncrement = 0.1; - class ItemInfo : InventoryOpticsItem_Base_F { - class OpticsModes { - class StepScope { - discreteDistance[] = { 100 }; - discreteDistanceInitIndex = 0; - }; - }; - }; - }; - class CUP_optic_AN_PVS_10 : ItemCore { - ACE_ScopeAdjust_Vertical[] = { -4, 30 }; - ACE_ScopeAdjust_Horizontal[] = { -6, 6 }; - ACE_ScopeAdjust_VerticalIncrement = 0.1; - ACE_ScopeAdjust_HorizontalIncrement = 0.1; - class ItemInfo : InventoryOpticsItem_Base_F { - class OpticsModes { - class NVScope { - discreteDistance[] = { 100 }; - discreteDistanceInitIndex = 0; - }; - }; - }; - }; - class CUP_optic_LeupoldM3LR : ItemCore { - ACE_ScopeAdjust_Vertical[] = { -4, 30 }; - ACE_ScopeAdjust_Horizontal[] = { -6, 6 }; - ACE_ScopeAdjust_VerticalIncrement = 0.1; - ACE_ScopeAdjust_HorizontalIncrement = 0.1; - class ItemInfo : InventoryOpticsItem_Base_F { - class OpticsModes { - class LRR { - discreteDistance[] = { 100 }; - discreteDistanceInitIndex = 0; - }; - }; - }; - }; - class CUP_optic_LeupoldMk4_10x40_LRT_Desert : ItemCore { - ACE_ScopeAdjust_Vertical[] = { -4, 30 }; - ACE_ScopeAdjust_Horizontal[] = { -6, 6 }; - ACE_ScopeAdjust_VerticalIncrement = 0.1; - ACE_ScopeAdjust_HorizontalIncrement = 0.1; - class ItemInfo : InventoryOpticsItem_Base_F { - class OpticsModes { - class LRR { - discreteDistance[] = { 100 }; - discreteDistanceInitIndex = 0; - }; - }; - }; - }; - class CUP_optic_LeupoldMk4_MRT_tan : ItemCore { - ACE_ScopeAdjust_Vertical[] = { -4, 30 }; - ACE_ScopeAdjust_Horizontal[] = { -6, 6 }; - ACE_ScopeAdjust_VerticalIncrement = 0.1; - ACE_ScopeAdjust_HorizontalIncrement = 0.1; - class ItemInfo : InventoryOpticsItem_Base_F { - class OpticsModes { - class MRT { - discreteDistance[] = { 100 }; - discreteDistanceInitIndex = 0; - }; - }; - }; - }; - class CUP_optic_SB_11_4x20_PM : ItemCore { - ACE_ScopeAdjust_Vertical[] = { -0.1, 10.1 }; - ACE_ScopeAdjust_Horizontal[] = { -5.1, 5.1 }; - ACE_ScopeAdjust_VerticalIncrement = 0.1; - ACE_ScopeAdjust_HorizontalIncrement = 0.1; - class ItemInfo : InventoryOpticsItem_Base_F { - class OpticsModes { - class ShortDot { - discreteDistance[] = { 100 }; - discreteDistanceInitIndex = 0; - }; - }; - }; - }; - - /* - // This would require MOA turrets - class CUP_optic_AN_PVS_4 : ItemCore { - ACE_ScopeAdjust_Vertical[] = { -12, 50 }; - ACE_ScopeAdjust_Horizontal[] = { -20, 20 }; - ACE_ScopeAdjust_VerticalIncrement = 0.25; - ACE_ScopeAdjust_HorizontalIncrement = 0.25; - ACE_ScopeAdjust_Unit = "MOA"; - class ItemInfo : InventoryOpticsItem_Base_F { - class OpticsModes { - class ANPVS4 { - discreteDistance[] = { 100 }; - discreteDistanceInitIndex = 0; - }; - }; - }; - }; - */ - - class CUP_optic_PSO_1 : ItemCore { - ACE_ScopeAdjust_Vertical[] = { 0, 0 }; - ACE_ScopeAdjust_Horizontal[] = { -10, 10 }; - ACE_ScopeAdjust_VerticalIncrement = 0.0; - ACE_ScopeAdjust_HorizontalIncrement = 0.5; - class ItemInfo : InventoryOpticsItem_Base_F { - class OpticsModes { - class PSO { - discreteDistance[]={100, 200, 300, 400, 450, 500, 550, 600, 650, 700, 750, 800, 850, 900, 950, 1000}; - discreteDistanceInitIndex=3; - }; - }; - }; - }; - class CUP_optic_PSO_3 : ItemCore { - ACE_ScopeAdjust_Vertical[] = { 0, 0 }; - ACE_ScopeAdjust_Horizontal[] = { -10, 10 }; - ACE_ScopeAdjust_VerticalIncrement = 0.0; - ACE_ScopeAdjust_HorizontalIncrement = 0.5; - class ItemInfo : InventoryOpticsItem_Base_F { - class OpticsModes { - class PSO { - discreteDistance[]={100, 200, 300, 400, 450, 500, 550, 600, 650, 700, 750, 800, 850, 900, 950, 1000}; - discreteDistanceInitIndex=3; - }; - }; - }; - }; - // Non Disposable launchers - class CUP_launch_Igla: Launcher_Base_F { - EGVAR(overpressure,angle) = 30; - EGVAR(overpressure,range) = 2; - EGVAR(overpressure,damage) = 0.5; - }; - class CUP_launch_M47: Launcher_Base_F { - EGVAR(overpressure,angle) = 45; - EGVAR(overpressure,range) = 30; - EGVAR(overpressure,damage) = 0.7; - }; - class CUP_launch_MAAWS: Launcher_Base_F { - EGVAR(overpressure,angle) = 60; - EGVAR(overpressure,range) = 28; - EGVAR(overpressure,damage) = 0.7; - }; - class CUP_launch_MAAWS_Scope: CUP_launch_MAAWS {}; - class CUP_launch_Metis: Launcher_Base_F { - EGVAR(overpressure,angle) = 45; - EGVAR(overpressure,range) = 30; - EGVAR(overpressure,damage) = 0.5; - }; - class CUP_launch_RPG7V: Launcher_Base_F { - EGVAR(overpressure,angle) = 45; - EGVAR(overpressure,range) = 20; - EGVAR(overpressure,damage) = 1; - }; - class CUP_launch_Mk153Mod0: Launcher_Base_F { - EGVAR(overpressure,angle) = 30; - EGVAR(overpressure,range) = 30; - EGVAR(overpressure,damage) = 1; - }; - class CUP_launch_Mk153Mod0_SMAWOptics: CUP_launch_Mk153Mod0 {}; - class CUP_launch_FIM92Stinger: Launcher_Base_F { - EGVAR(overpressure,angle) = 45; - EGVAR(overpressure,range) = 15; - EGVAR(overpressure,damage) = 0.3; // Main damage arises from debris rather than the actual backblast - }; - class CUP_launch_9K32Strela: Launcher_Base_F { - EGVAR(overpressure,angle) = 30; - EGVAR(overpressure,range) = 2; - EGVAR(overpressure,damage) = 0.5; - }; - // Disposable launchers under this line - class CUP_launch_M136: Launcher_Base_F { - EGVAR(overpressure,angle) = 45; - EGVAR(overpressure,range) = 100; - EGVAR(overpressure,damage) = 0.7; - ACE_UsedTube = "ACE_launch_M136_Used_F"; // The class name of the used tube. - magazines[] = {"ACE_PreloadedMissileDummy_CUP"}; // The dummy magazine - }; - class ACE_launch_M136_Used_F: CUP_launch_M136 { - scope = 1; - ACE_isUsedLauncher = 1; - author = "$STR_ACE_Common_ACETeam"; - //displayName = "$STR_ACE_Disposable_UsedTube"; - //descriptionShort = "$STR_ACE_Disposable_UsedTubeDescription"; - displayName = "M136 (Used)"; - descriptionShort = "Used M136 Tube"; - magazines[] = {"ACE_FiredMissileDummy_CUP"}; - //picture = ""; @todo - //model = ""; @todo - weaponPoolAvailable = 0; - }; - class CUP_launch_NLAW: Launcher_Base_F { - EGVAR(overpressure,angle) = 30; - EGVAR(overpressure,range) = 2; - EGVAR(overpressure,damage) = 0.5; - ACE_UsedTube = "ACE_launch_NLAW_Used_F"; // The class name of the used tube. - magazines[] = {"ACE_PreloadedMissileDummy_CUP"}; // The dummy magazine - }; - class ACE_launch_NLAW_Used_F: CUP_launch_NLAW { - scope = 1; - ACE_isUsedLauncher = 1; - author = "$STR_ACE_Common_ACETeam"; - //displayName = "$STR_ACE_Disposable_UsedTube"; - //descriptionShort = "$STR_ACE_Disposable_UsedTubeDescription"; - displayName = "NLAW (Used)"; - descriptionShort = "Used NLAW Tube"; - magazines[] = {"ACE_FiredMissileDummy_CUP"}; - //picture = ""; @todo - //model = ""; @todo - weaponPoolAvailable = 0; - }; - class CUP_launch_RPG18: Launcher_Base_F { - EGVAR(overpressure,angle) = 40; - EGVAR(overpressure,range) = 15; - EGVAR(overpressure,damage) = 1; - ACE_UsedTube = "ACE_launch_RPG18_Used_F"; // The class name of the used tube. - magazines[] = {"ACE_PreloadedMissileDummy_CUP"}; // The dummy magazine - }; - class ACE_launch_RPG18_Used_F: CUP_launch_RPG18 { - scope = 1; - ACE_isUsedLauncher = 1; - author = "$STR_ACE_Common_ACETeam"; - //displayName = "$STR_ACE_Disposable_UsedTube"; - //descriptionShort = "$STR_ACE_Disposable_UsedTubeDescription"; - displayName = "RPG18 (Used)"; - descriptionShort = "Used RPG18 Tube"; - magazines[] = {"ACE_FiredMissileDummy_CUP"}; - //picture = ""; @todo - //model = ""; @todo - weaponPoolAvailable = 0; - }; -}; \ No newline at end of file diff --git a/optionals/compat_cup/config.cpp b/optionals/compat_cup/config.cpp deleted file mode 100644 index 20ae5d6911..0000000000 --- a/optionals/compat_cup/config.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#include "script_component.hpp" - -class CfgPatches { - class ADDON { - units[] = {}; - weapons[] = {}; - requiredVersion = REQUIRED_VERSION; - requiredAddons[] = {"CUP_Weapons_Ammunition"}; - author[]={"Ruthberg"}; - VERSION_CONFIG; - }; -}; - -#include "CfgWeapons.hpp" -#include "CfgMagazines.hpp" \ No newline at end of file diff --git a/optionals/compat_cup/script_component.hpp b/optionals/compat_cup/script_component.hpp deleted file mode 100644 index 3d77fcb370..0000000000 --- a/optionals/compat_cup/script_component.hpp +++ /dev/null @@ -1,5 +0,0 @@ -#define COMPONENT CUP_Weapons_Ammunition_comp - -#include "\z\ace\addons\main\script_mod.hpp" - -#include "\z\ace\addons\main\script_macros.hpp" diff --git a/optionals/compat_rhs_afrf3/CfgAmmo.hpp b/optionals/compat_rhs_afrf3/CfgAmmo.hpp index 41c0f333ce..2444da41cf 100644 --- a/optionals/compat_rhs_afrf3/CfgAmmo.hpp +++ b/optionals/compat_rhs_afrf3/CfgAmmo.hpp @@ -1,10 +1,8 @@ -class CfgAmmo -{ +class CfgAmmo { class BulletBase; class B_556x45_Ball; - class rhs_B_545x39_Ball: B_556x45_Ball - { + class rhs_B_545x39_Ball: B_556x45_Ball { ACE_caliber=5.588; ACE_bulletLength=21.59; ACE_bulletMass=3.42792; @@ -16,8 +14,7 @@ class CfgAmmo ACE_muzzleVelocities[]={780, 880, 920}; ACE_barrelLengths[]={254.0, 414.02, 508.0}; }; - class rhs_B_545x39_Ball_Tracer_Green: rhs_B_545x39_Ball - { + class rhs_B_545x39_Ball_Tracer_Green: rhs_B_545x39_Ball { ACE_caliber=5.588; ACE_bulletLength=21.59; ACE_bulletMass=3.22704; @@ -30,8 +27,7 @@ class CfgAmmo ACE_barrelLengths[]={254.0, 414.02, 508.0}; }; class B_762x51_Ball; - class rhs_B_762x54_Ball: B_762x51_Ball - { + class rhs_B_762x54_Ball: B_762x51_Ball { ACE_caliber=7.925; ACE_bulletLength=28.956; ACE_bulletMass=9.8496; @@ -43,8 +39,7 @@ class CfgAmmo ACE_muzzleVelocities[]={700, 800, 820, 833}; ACE_barrelLengths[]={406.4, 508.0, 609.6, 660.4}; }; - class rhs_B_762x54_Ball_Tracer_Green: B_762x51_Ball - { + class rhs_B_762x54_Ball_Tracer_Green: B_762x51_Ball { ACE_caliber=7.925; ACE_bulletLength=28.956; ACE_bulletMass=9.6552; @@ -56,8 +51,7 @@ class CfgAmmo ACE_muzzleVelocities[]={680, 750, 798, 800}; ACE_barrelLengths[]={406.4, 508.0, 609.6, 660.4}; }; - class rhs_B_762x54_7N1_Ball: rhs_B_762x54_Ball - { + class rhs_B_762x54_7N1_Ball: rhs_B_762x54_Ball { ACE_caliber=7.925; ACE_bulletLength=28.956; ACE_bulletMass=9.8496; @@ -69,8 +63,7 @@ class CfgAmmo ACE_muzzleVelocities[]={700, 800, 820, 833}; ACE_barrelLengths[]={406.4, 508.0, 609.6, 660.4}; }; - class rhs_B_762x39_Ball: B_762x51_Ball - { + class rhs_B_762x39_Ball: B_762x51_Ball { ACE_caliber=7.823; ACE_bulletLength=28.956; ACE_bulletMass=7.9704; @@ -82,8 +75,7 @@ class CfgAmmo ACE_muzzleVelocities[]={650, 716, 750}; ACE_barrelLengths[]={254.0, 414.02, 508.0}; }; - class rhs_B_762x39_Tracer: rhs_B_762x39_Ball - { + class rhs_B_762x39_Tracer: rhs_B_762x39_Ball { ACE_caliber=7.823; ACE_bulletLength=28.956; ACE_bulletMass=7.5816; @@ -96,8 +88,7 @@ class CfgAmmo ACE_barrelLengths[]={254.0, 414.02, 508.0}; }; class B_9x21_Ball; - class rhs_B_9x19_7N21: B_9x21_Ball - { + class rhs_B_9x19_7N21: B_9x21_Ball { ACE_caliber=9.017; ACE_bulletLength=15.494; ACE_bulletMass=5.19696; @@ -109,8 +100,7 @@ class CfgAmmo ACE_muzzleVelocities[]={445, 460, 480}; ACE_barrelLengths[]={101.6, 127.0, 228.6}; }; - class rhs_B_9x18_57N181S: B_9x21_Ball - { + class rhs_B_9x18_57N181S: B_9x21_Ball { ACE_caliber=9.271; ACE_bulletLength=15.494; ACE_bulletMass=6.00048; @@ -126,4 +116,66 @@ class CfgAmmo class rhs_ammo_127x108mm_x5: SubmunitionBase { ACE_rearm_caliber=13; }; + + class GrenadeHand; + class rhs_ammo_rgd5: GrenadeHand { + ace_frag_enabled = 1; + ace_frag_metal = 200; + ace_frag_charge = 110; + ace_frag_gurney_c = 2440; + ace_frag_gurney_k = "3/5"; + ace_frag_classes[] = {"ACE_frag_small_HD"}; + ace_frag_skip = 0; + ace_frag_force = 1; + }; + class rhs_ammo_rgn_base: rhs_ammo_rgd5 { + ace_frag_enabled = 1; + ace_frag_metal = 193; + ace_frag_charge = 97; + ace_frag_gurney_c = 2800; + ace_frag_gurney_k = "3/5"; + ace_frag_classes[] = {"ACE_frag_tiny_HD"}; + ace_frag_skip = 0; + ace_frag_force = 1; + }; + class rhs_ammo_rgn: rhs_ammo_rgn_base { + ace_frag_enabled = 0; + ace_frag_skip = 1; + ace_frag_force = 0; + }; + class rhs_ammo_rgn_sub: rhs_ammo_rgn_base {}; + class rhs_ammo_rgn_exp: rhs_ammo_rgn_base {}; + class rhs_ammo_fakel: GrenadeHand { + ace_frag_enabled = 0; + ace_frag_skip = 1; + ace_frag_force = 0; + }; + class rhs_ammo_fakels: rhs_ammo_fakel {}; + class rhs_ammo_zarya2: rhs_ammo_fakels {}; + class rhs_ammo_plamyam: rhs_ammo_fakels {}; + + class RocketBase; + class R_PG32V_F: RocketBase {}; + class rhs_rpg26_rocket: R_PG32V_F {}; + class rhs_rpg7v2_pg7vl: rhs_rpg26_rocket {}; + class rhs_rpg7v2_og7v: rhs_rpg7v2_pg7vl { + ace_frag_enabled = 1; + ace_frag_metal = 400; + ace_frag_charge = 210; + ace_frag_gurney_c = 2800; + ace_frag_gurney_k = "3/5"; + ace_frag_classes[] = {"ACE_frag_medium_HD"}; + ace_frag_skip = 0; + ace_frag_force = 1; + }; + class rhs_rpg7v2_tbg7v: rhs_rpg7v2_pg7vl { + ace_frag_enabled = 0; + ace_frag_skip = 1; + ace_frag_force = 0; + }; + class rhs_rshg2_rocket: rhs_rpg7v2_tbg7v { + ace_frag_enabled = 0; + ace_frag_skip = 1; + ace_frag_force = 0; + }; }; diff --git a/optionals/compat_rhs_afrf3/CfgMagazines.hpp b/optionals/compat_rhs_afrf3/CfgMagazines.hpp index 92444a380b..fcf9841019 100644 --- a/optionals/compat_rhs_afrf3/CfgMagazines.hpp +++ b/optionals/compat_rhs_afrf3/CfgMagazines.hpp @@ -14,4 +14,4 @@ class cfgMagazines { class rhs_mag_127x108mm_1470 : rhs_mag_127x108mm_50 { ace_isbelt = 0; }; -}; \ No newline at end of file +}; diff --git a/optionals/compat_rhs_afrf3/CfgVehicles.hpp b/optionals/compat_rhs_afrf3/CfgVehicles.hpp index 963913d74d..d0486ecd0e 100644 --- a/optionals/compat_rhs_afrf3/CfgVehicles.hpp +++ b/optionals/compat_rhs_afrf3/CfgVehicles.hpp @@ -104,11 +104,33 @@ class cfgVehicles { }; }; }; + }; + }; + class rhs_bmd4_vdv: rhs_a3spruttank_base { + class Turrets: Turrets { + class MainTurret: MainTurret { + class Turrets: Turrets { + class CommanderOptics: CommanderOptics {}; + }; + }; class GPMGTurret1: NewTurret { ace_fcs_Enabled = 0; }; }; }; + class rhs_bmd4m_vdv: rhs_bmd4_vdv { + class Turrets: Turrets { + class MainTurret: MainTurret { + class Turrets: Turrets { + class CommanderOptics: CommanderOptics {}; + }; + }; + class GPMGTurret1: GPMGTurret1 {}; + class GPMGTurret2: GPMGTurret1 { + ace_fcs_Enabled = 0; + }; + }; + }; class rhs_a3t72tank_base: Tank_F { EGVAR(refuel,fuelCapacity) = 1200; class Turrets: Turrets { @@ -125,7 +147,20 @@ class cfgVehicles { }; }; }; - class rhs_t72bd_tv: rhs_a3t72tank_base {}; + class rhs_t72bb_tv: rhs_a3t72tank_base { + ace_repair_hitpointPositions[] = {{"era_1_hitpoint", {0,0,0}}}; + ace_repair_hitpointGroups[] = {{"era_1_hitpoint", {"era_2_hitpoint", "era_3_hitpoint", "era_4_hitpoint", "era_5_hitpoint", "era_6_hitpoint", "era_7_hitpoint", "era_8_hitpoint", "era_9_hitpoint", "era_10_hitpoint", "era_11_hitpoint", "era_12_hitpoint", "era_13_hitpoint", "era_14_hitpoint", "era_15_hitpoint", "era_16_hitpoint", "era_17_hitpoint", "era_18_hitpoint", "era_19_hitpoint", "era_20_hitpoint", "era_21_hitpoint", "era_22_hitpoint", "era_23_hitpoint", "era_24_hitpoint", "era_25_hitpoint", "era_26_hitpoint", "era_27_hitpoint", "era_28_hitpoint", "era_29_hitpoint", "era_30_hitpoint", "era_31_hitpoint"}}}; + }; + class rhs_t72bc_tv: rhs_a3t72tank_base { + ace_repair_hitpointPositions[] = {{"era_1_hitpoint", {0,0,0}}}; + ace_repair_hitpointGroups[] = {{"era_1_hitpoint", {"era_2_hitpoint", "era_3_hitpoint", "era_4_hitpoint", "era_5_hitpoint", "era_6_hitpoint", "era_7_hitpoint", "era_8_hitpoint", "era_9_hitpoint", "era_10_hitpoint", "era_11_hitpoint", "era_12_hitpoint", "era_13_hitpoint", "era_14_hitpoint", "era_15_hitpoint", "era_16_hitpoint", "era_17_hitpoint", "era_18_hitpoint", "era_19_hitpoint", "era_20_hitpoint", "era_21_hitpoint", "era_22_hitpoint", "era_23_hitpoint", "era_24_hitpoint", "era_25_hitpoint", "era_26_hitpoint", "era_27_hitpoint", "era_28_hitpoint", "era_29_hitpoint", "era_30_hitpoint", "era_31_hitpoint", "era_32_hitpoint"}}}; + }; + class rhs_t72bd_tv: rhs_a3t72tank_base { + class rhs_t72bd_tv: rhs_a3t72tank_base { + ace_repair_hitpointPositions[] = {{"era_1_hitpoint", {0,0,0}}}; + ace_repair_hitpointGroups[] = {{"era_1_hitpoint", {"era_2_hitpoint", "era_3_hitpoint", "era_4_hitpoint", "era_5_hitpoint", "era_6_hitpoint", "era_7_hitpoint", "era_8_hitpoint", "era_9_hitpoint", "era_10_hitpoint", "era_11_hitpoint", "era_12_hitpoint", "era_13_hitpoint", "era_14_hitpoint", "era_15_hitpoint", "era_16_hitpoint", "era_17_hitpoint", "era_18_hitpoint", "era_19_hitpoint", "era_20_hitpoint", "era_21_hitpoint", "era_22_hitpoint", "era_23_hitpoint", "era_24_hitpoint", "era_25_hitpoint", "era_26_hitpoint", "era_27_hitpoint", "era_28_hitpoint", "era_29_hitpoint", "era_30_hitpoint", "era_31_hitpoint", "era_32_hitpoint"}}}; + }; + }; class rhs_t90_tv: rhs_t72bd_tv { class Turrets: Turrets { class MainTurret: MainTurret { @@ -183,6 +218,10 @@ class cfgVehicles { class rhs_t80b : rhs_tank_base { EGVAR(refuel,fuelCapacity) = 1100; }; + class rhs_t80bv: rhs_t80b { + ace_repair_hitpointPositions[] = {{"era_1_hitpoint", {0,0,0}}}; + ace_repair_hitpointGroups[] = {{"era_1_hitpoint", {"era_2_hitpoint", "era_3_hitpoint", "era_4_hitpoint", "era_5_hitpoint", "era_6_hitpoint", "era_7_hitpoint", "era_8_hitpoint", "era_9_hitpoint", "era_10_hitpoint", "era_11_hitpoint", "era_12_hitpoint", "era_13_hitpoint", "era_14_hitpoint", "era_15_hitpoint", "era_16_hitpoint", "era_17_hitpoint", "era_18_hitpoint", "era_19_hitpoint", "era_20_hitpoint", "era_21_hitpoint", "era_22_hitpoint", "era_23_hitpoint", "era_24_hitpoint", "era_25_hitpoint", "era_26_hitpoint", "era_27_hitpoint", "era_28_hitpoint"}}}; + }; class Truck_F; class RHS_Ural_BaseTurret : Truck_F { diff --git a/optionals/compat_rhs_afrf3/CfgWeapons.hpp b/optionals/compat_rhs_afrf3/CfgWeapons.hpp index 0c3d3dfac4..32c1f590c5 100644 --- a/optionals/compat_rhs_afrf3/CfgWeapons.hpp +++ b/optionals/compat_rhs_afrf3/CfgWeapons.hpp @@ -1,61 +1,50 @@ -class CfgWeapons -{ +class CfgWeapons { class hgun_Rook40_F; - class rhs_weap_pya: hgun_Rook40_F - { - ACE_barrelTwist=254.0; - ACE_barrelLength=111.76; + class rhs_weap_pya: hgun_Rook40_F { + ACE_barrelTwist = 254.0; + ACE_barrelLength = 111.76; }; class Pistol_Base_F; - class rhs_weap_makarov_pmm: rhs_weap_pya - { - ACE_barrelTwist=240.03; - ACE_barrelLength=93.472; + class rhs_weap_makarov_pmm: rhs_weap_pya { + ACE_barrelTwist = 240.03; + ACE_barrelLength = 93.472; }; class rhs_weap_ak74m_Base_F; - class rhs_weap_ak74m: rhs_weap_ak74m_Base_F - { - ACE_barrelTwist=199.898; - ACE_barrelLength=414.02; + class rhs_weap_ak74m: rhs_weap_ak74m_Base_F { + ACE_barrelTwist = 199.898; + ACE_barrelLength = 414.02; }; - class rhs_weap_akm: rhs_weap_ak74m - { - ACE_barrelTwist=199.898; - ACE_barrelLength=414.02; + class rhs_weap_akm: rhs_weap_ak74m { + ACE_barrelTwist = 199.898; + ACE_barrelLength = 414.02; }; class rhs_weap_aks74; - class rhs_weap_aks74u: rhs_weap_aks74 - { - ACE_barrelTwist=160.02; - ACE_barrelLength=210.82; + class rhs_weap_aks74u: rhs_weap_aks74 { + ACE_barrelTwist = 160.02; + ACE_barrelLength = 210.82; }; - class rhs_weap_svd: rhs_weap_ak74m - { - ACE_barrelTwist=238.76; - ACE_barrelLength=619.76; + class rhs_weap_svd: rhs_weap_ak74m { + ACE_barrelTwist = 238.76; + ACE_barrelLength = 619.76; }; class rhs_weap_svdp; - class rhs_weap_svds: rhs_weap_svdp - { - ACE_barrelTwist=238.76; - ACE_barrelLength=563.88; + class rhs_weap_svds: rhs_weap_svdp { + ACE_barrelTwist = 238.76; + ACE_barrelLength = 563.88; }; class rhs_pkp_base; - class rhs_weap_pkp: rhs_pkp_base - { - ACE_barrelTwist=240.03; - ACE_barrelLength=657.86; + class rhs_weap_pkp: rhs_pkp_base { + ACE_barrelTwist = 240.03; + ACE_barrelLength = 657.86; }; - class rhs_weap_pkm: rhs_weap_pkp - { - ACE_barrelTwist=240.03; - ACE_barrelLength=645.16; + class rhs_weap_pkm: rhs_weap_pkp { + ACE_barrelTwist = 240.03; + ACE_barrelLength = 645.16; }; - class rhs_weap_rpk74m: rhs_weap_pkp - { - ACE_barrelTwist=195.072; - ACE_barrelLength=589.28; + class rhs_weap_rpk74m: rhs_weap_pkp { + ACE_barrelTwist = 195.072; + ACE_barrelLength = 589.28; }; class rhs_acc_sniper_base; diff --git a/optionals/compat_rhs_afrf3/config.cpp b/optionals/compat_rhs_afrf3/config.cpp index aa9d6bed95..4840f8da82 100644 --- a/optionals/compat_rhs_afrf3/config.cpp +++ b/optionals/compat_rhs_afrf3/config.cpp @@ -5,7 +5,7 @@ class CfgPatches { units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; - requiredAddons[] = {"rhs_c_weapons", "rhs_c_troops"}; + requiredAddons[] = {"rhs_c_weapons", "rhs_c_troops", "rhs_c_bmd", "rhs_c_bmp", "rhs_c_bmp3", "rhs_c_a2port_armor", "rhs_c_btr", "rhs_c_sprut", "rhs_c_t72", "rhs_c_tanks", "rhs_c_a2port_air", "rhs_c_a2port_car", "rhs_c_cars", "rhs_c_2s3", "rhs_c_rva"}; author[]={"Ruthberg", "GitHawk"}; VERSION_CONFIG; }; diff --git a/optionals/compat_rhs_usf3/CfgAmmo.hpp b/optionals/compat_rhs_usf3/CfgAmmo.hpp index 0dde3eaf62..44c0285e40 100644 --- a/optionals/compat_rhs_usf3/CfgAmmo.hpp +++ b/optionals/compat_rhs_usf3/CfgAmmo.hpp @@ -122,4 +122,48 @@ class CfgAmmo attackProfiles[] = { "JAV_TOP", "JAV_DIR" }; }; }; + + class GrenadeHand; + class rhs_ammo_mk3a2: GrenadeHand { + ace_frag_enabled = 0; + ace_frag_skip = 1; + ace_frag_force = 0; + }; + class rhs_ammo_m84: GrenadeHand { + ace_frag_enabled = 0; + ace_frag_skip = 1; + ace_frag_force = 0; + }; + class rhs_ammo_m7a3_cs: GrenadeHand { + ace_frag_enabled = 0; + ace_frag_skip = 1; + ace_frag_force = 0; + }; + class rhs_ammo_m69: GrenadeHand { + ace_frag_enabled = 0; + ace_frag_skip = 1; + ace_frag_force = 0; + }; + class rhs_ammo_m67: GrenadeHand { + ace_frag_enabled = 1; + ace_frag_metal = 213; + ace_frag_charge = 185; + ace_frag_gurney_c = 2700; + ace_frag_gurney_k = "3/5"; + ace_frag_classes[] = {"ACE_frag_medium_HD"}; + ace_frag_skip = 0; + ace_frag_force = 1; + }; + class RocketBase; + class rhs_ammo_M136_rocket: RocketBase {}; + class rhs_ammo_M136_hedp_rocket: rhs_ammo_M136_rocket { + ace_frag_enabled = 1; + ace_frag_metal = 330; + ace_frag_charge = 280; + ace_frag_gurney_c = 2800; + ace_frag_gurney_k = "3/5"; + ace_frag_classes[] = {"ACE_frag_medium_HD"}; + ace_frag_skip = 0; + ace_frag_force = 1; + }; }; diff --git a/optionals/compat_rhs_usf3/CfgMagazines.hpp b/optionals/compat_rhs_usf3/CfgMagazines.hpp index e067d1f293..2818478d83 100644 --- a/optionals/compat_rhs_usf3/CfgMagazines.hpp +++ b/optionals/compat_rhs_usf3/CfgMagazines.hpp @@ -19,4 +19,12 @@ class cfgMagazines { class RHS_48Rnd_40mm_MK19: VehicleMagazine { ace_isbelt = 1; }; -}; \ No newline at end of file + + class CA_LauncherMagazine; + class rhs_mag_smaw_SR: CA_LauncherMagazine { + EGVAR(overpressure,priority) = 99; + EGVAR(overpressure,angle) = 0; + EGVAR(overpressure,range) = 0; + EGVAR(overpressure,damage) = 0; + }; +}; diff --git a/optionals/compat_rhs_usf3/CfgVehicles.hpp b/optionals/compat_rhs_usf3/CfgVehicles.hpp index 3c56b91aa9..87c66f7212 100644 --- a/optionals/compat_rhs_usf3/CfgVehicles.hpp +++ b/optionals/compat_rhs_usf3/CfgVehicles.hpp @@ -30,67 +30,95 @@ class cfgVehicles { }; }; }; + class rhsusf_m1a1aim_tuski_wd: rhsusf_m1a1tank_base { + ace_repair_hitpointPositions[] = {{"era_1_hitpoint", {0,0,0}}}; + ace_repair_hitpointGroups[] = {{"era_1_hitpoint", {"era_2_hitpoint", "era_3_hitpoint", "era_4_hitpoint", "era_5_hitpoint", "era_6_hitpoint", "era_7_hitpoint", "era_8_hitpoint", "era_9_hitpoint", "era_10_hitpoint", "era_11_hitpoint", "era_12_hitpoint", "era_13_hitpoint", "era_14_hitpoint", "era_15_hitpoint", "era_16_hitpoint", "era_17_hitpoint", "era_18_hitpoint", "era_19_hitpoint", "era_20_hitpoint", "era_21_hitpoint", "era_22_hitpoint", "era_23_hitpoint", "era_24_hitpoint", "era_25_hitpoint", "era_26_hitpoint", "era_27_hitpoint", "era_28_hitpoint", "era_29_hitpoint", "era_30_hitpoint", "era_31_hitpoint", "era_32_hitpoint", "era_33_hitpoint", "era_34_hitpoint"}}}; + }; + class rhsusf_m1a2tank_base; + class rhsusf_m1a2sep1tuskid_usarmy: rhsusf_m1a2tank_base { + ace_repair_hitpointPositions[] = {{"era_1_hitpoint", {0,0,0}}}; + ace_repair_hitpointGroups[] = {{"era_1_hitpoint", {"era_2_hitpoint", "era_3_hitpoint", "era_4_hitpoint", "era_5_hitpoint", "era_6_hitpoint", "era_7_hitpoint", "era_8_hitpoint", "era_9_hitpoint", "era_10_hitpoint", "era_11_hitpoint", "era_12_hitpoint", "era_13_hitpoint", "era_14_hitpoint", "era_15_hitpoint", "era_16_hitpoint", "era_17_hitpoint", "era_18_hitpoint", "era_19_hitpoint", "era_20_hitpoint", "era_21_hitpoint", "era_22_hitpoint", "era_23_hitpoint", "era_24_hitpoint", "era_25_hitpoint", "era_26_hitpoint", "era_27_hitpoint", "era_28_hitpoint", "era_29_hitpoint", "era_30_hitpoint", "era_31_hitpoint", "era_32_hitpoint", "era_33_hitpoint", "era_34_hitpoint"}}}; + }; + class rhsusf_m1a2sep1tuskiiwd_usarmy: rhsusf_m1a2sep1tuskid_usarmy { + ace_repair_hitpointPositions[] = {{"era_1_hitpoint", {0,0,0}}}; + ace_repair_hitpointGroups[] = {{"era_1_hitpoint", {"era_2_hitpoint", "era_3_hitpoint", "era_4_hitpoint", "era_5_hitpoint", "era_6_hitpoint", "era_7_hitpoint", "era_8_hitpoint", "era_9_hitpoint", "era_10_hitpoint", "era_11_hitpoint", "era_12_hitpoint", "era_13_hitpoint", "era_14_hitpoint", "era_15_hitpoint", "era_16_hitpoint", "era_17_hitpoint", "era_18_hitpoint", "era_19_hitpoint", "era_20_hitpoint", "era_21_hitpoint", "era_22_hitpoint", "era_23_hitpoint", "era_24_hitpoint", "era_25_hitpoint", "era_26_hitpoint", "era_27_hitpoint", "era_28_hitpoint", "era_29_hitpoint", "era_30_hitpoint", "era_31_hitpoint", "era_32_hitpoint", "era_33_hitpoint", "era_34_hitpoint", "era_35_hitpoint", "era_36_hitpoint", "era_37_hitpoint", "era_38_hitpoint", "era_39_hitpoint", "era_40_hitpoint", "era_41_hitpoint", "era_42_hitpoint", "era_43_hitpoint", "era_44_hitpoint", "era_45_hitpoint", "era_46_hitpoint"}}}; + }; class Heli_light_03_base_F; - class RHS_UH1_Base : Heli_light_03_base_F { + class RHS_UH1_Base: Heli_light_03_base_F { EGVAR(refuel,fuelCapacity) = 1447; }; class Heli_Transport_01_base_F; - class RHS_UH60_Base : Heli_Transport_01_base_F { + class RHS_UH60_Base: Heli_Transport_01_base_F { EGVAR(refuel,fuelCapacity) = 1360; }; class Heli_Transport_02_base_F; - class RHS_CH_47F_base : Heli_Transport_02_base_F { + class RHS_CH_47F_base: Heli_Transport_02_base_F { EGVAR(refuel,fuelCapacity) = 3914; }; class Heli_Attack_01_base_F; - class RHS_AH1Z_base : Heli_Attack_01_base_F { + class RHS_AH1Z_base: Heli_Attack_01_base_F { EGVAR(refuel,fuelCapacity) = 1600; }; - class RHS_AH64_base : Heli_Attack_01_base_F { + class RHS_AH64_base: Heli_Attack_01_base_F { EGVAR(refuel,fuelCapacity) = 1420; }; class MBT_01_arty_base_F; - class rhsusf_m109tank_base : MBT_01_arty_base_F { + class rhsusf_m109tank_base: MBT_01_arty_base_F { EGVAR(refuel,fuelCapacity) = 511; }; class MRAP_01_base_F; - class rhsusf_hmmwe_base : MRAP_01_base_F { + class rhsusf_hmmwe_base: MRAP_01_base_F { EGVAR(refuel,fuelCapacity) = 95; }; - class rhsusf_rg33_base : MRAP_01_base_F { + class rhsusf_rg33_base: MRAP_01_base_F { EGVAR(refuel,fuelCapacity) = 302; }; class Truck_01_base_F; - class rhsusf_fmtv_base : Truck_01_base_F { + class rhsusf_fmtv_base: Truck_01_base_F { EGVAR(refuel,fuelCapacity) = 219; }; - class APC_Tracked_02_base_F; - class rhsusf_m113_tank_base : APC_Tracked_02_base_F { + class APC_Tracked_02_base_F: Tank_F {}; + class rhsusf_m113_tank_base: APC_Tracked_02_base_F { EGVAR(refuel,fuelCapacity) = 360; + class Turrets: Turrets { + class MainTurret: MainTurret { + ace_fcs_Enabled = 0; + }; + }; }; class APC_Tracked_03_base_F; - class RHS_M2A2_Base : APC_Tracked_03_base_F { + class RHS_M2A2_Base: APC_Tracked_03_base_F { EGVAR(refuel,fuelCapacity) = 746; }; + class RHS_M2A2: RHS_M2A2_Base {}; + class RHS_M2A2_BUSKI: RHS_M2A2 { + ace_repair_hitpointPositions[] = {{"era_1_hitpoint", {0,0,0}}}; + ace_repair_hitpointGroups[] = {{"era_1_hitpoint", {"era_2_hitpoint", "era_3_hitpoint", "era_4_hitpoint", "era_5_hitpoint", "era_6_hitpoint", "era_7_hitpoint", "era_8_hitpoint", "era_9_hitpoint", "era_10_hitpoint", "era_11_hitpoint", "era_12_hitpoint", "era_13_hitpoint", "era_14_hitpoint", "era_15_hitpoint", "era_16_hitpoint", "era_17_hitpoint", "era_18_hitpoint", "era_19_hitpoint"}}}; + }; + class RHS_M2A3: RHS_M2A2 {}; + class RHS_M2A3_BUSKI: RHS_M2A3 { + ace_repair_hitpointPositions[] = {{"era_1_hitpoint", {0,0,0}}}; + ace_repair_hitpointGroups[] = {{"era_1_hitpoint", {"era_2_hitpoint", "era_3_hitpoint", "era_4_hitpoint", "era_5_hitpoint", "era_6_hitpoint", "era_7_hitpoint", "era_8_hitpoint", "era_9_hitpoint", "era_10_hitpoint", "era_11_hitpoint", "era_12_hitpoint", "era_13_hitpoint", "era_14_hitpoint", "era_15_hitpoint", "era_16_hitpoint", "era_17_hitpoint", "era_18_hitpoint", "era_19_hitpoint"}}}; + }; class Plane_CAS_01_base_F; - class RHS_A10 : Plane_CAS_01_base_F { + class RHS_A10: Plane_CAS_01_base_F { EGVAR(refuel,fuelCapacity) = 6223; }; class Plane_Base_F; - class RHS_C130J_Base : Plane_Base_F { + class RHS_C130J_Base: Plane_Base_F { EGVAR(refuel,fuelCapacity) = 25704; }; }; diff --git a/optionals/compat_rhs_usf3/CfgWeapons.hpp b/optionals/compat_rhs_usf3/CfgWeapons.hpp index e059a4f71c..becb91ada1 100644 --- a/optionals/compat_rhs_usf3/CfgWeapons.hpp +++ b/optionals/compat_rhs_usf3/CfgWeapons.hpp @@ -8,13 +8,16 @@ class CfgWeapons class UGL_F; class rhs_weap_XM2010_Base_F: Rifle_Base_F { - ACE_barrelTwist=254.0; - ACE_barrelLength=609.6; + ACE_barrelTwist = 254.0; + ACE_barrelLength = 609.6; }; class arifle_MX_Base_F; class rhs_weap_m4_Base: arifle_MX_Base_F { - ACE_barrelTwist=177.8; - ACE_barrelLength=368.3; + ACE_barrelTwist = 177.8; + ACE_barrelLength = 368.3; + ACE_Overheating_Dispersion[] = {0, 0.001, 0.002, 0.004}; + ACE_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; + ACE_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; class M203_GL : UGL_F { magazines[] = { "rhs_mag_M441_HE", @@ -110,45 +113,61 @@ class CfgWeapons }; class rhs_weap_m4a1; class rhs_weap_mk18: rhs_weap_m4a1 { - ACE_barrelTwist=177.8; - ACE_barrelLength=261.62; + ACE_barrelTwist = 177.8; + ACE_barrelLength = 261.62; + ACE_Overheating_Dispersion[] = {0, 0.001, 0.002, 0.004}; + ACE_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; + ACE_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; }; class rhs_weap_m16a4: rhs_weap_m4_Base { - ACE_barrelTwist=177.8; - ACE_barrelLength=508.0; + ACE_barrelTwist = 177.8; + ACE_barrelLength = 508.0; }; + class rhs_weap_lmg_minimipara; + class rhs_weap_lmg_minimi_railed : rhs_weap_lmg_minimipara { + ACE_barrelLength = 465.0; + ACE_barrelTwist = 177.8; + ACE_Overheating_allowSwapBarrel = 1; + ACE_Overheating_Dispersion[] = {0, -0.001, 0.001, 0.003}; + ACE_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; + ACE_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; + }; class rhs_weap_m240_base; class rhs_weap_m240B: rhs_weap_m240_base { - ACE_barrelTwist=304.8; - ACE_barrelLength=629.92; + ACE_barrelTwist = 304.8; + ACE_barrelLength = 629.92; + ACE_Overheating_allowSwapBarrel = 1; + ACE_Overheating_Dispersion[] = {0, -0.001, 0.001, 0.004}; + ACE_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; + ACE_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; }; class rhs_weap_m14ebrri: srifle_EBR_F { - ACE_barrelTwist=304.8; - ACE_barrelLength=558.8; + ACE_barrelTwist = 304.8; + ACE_barrelLength = 558.8; }; class rhs_weap_sr25: rhs_weap_m14ebrri { - ACE_barrelTwist=285.75; - ACE_barrelLength=609.6; + ACE_barrelTwist = 285.75; + ACE_barrelLength = 609.6; }; class rhs_weap_sr25_ec: rhs_weap_sr25 { - ACE_barrelTwist=285.75; - ACE_barrelLength=508.0; + ACE_barrelTwist = 285.75; + ACE_barrelLength = 508.0; }; class rhs_weap_M590_5RD: Rifle_Base_F { - ACE_barrelTwist=0.0; - ACE_twistDirection=0; - ACE_barrelLength=469.9; + ACE_barrelTwist = 0.0; + ACE_twistDirection = 0; + ACE_barrelLength = 469.9; }; class rhs_weap_M590_8RD: rhs_weap_M590_5RD { - ACE_barrelTwist=0.0; - ACE_twistDirection=0; - ACE_barrelLength=508.0; + ACE_barrelTwist = 0.0; + ACE_twistDirection = 0; + ACE_barrelLength = 508.0; }; class hgun_ACPC2_F; class rhsusf_weap_m1911a1: hgun_ACPC2_F { - ACE_barrelTwist=406.4; - ACE_barrelLength=127.0; + ACE_barrelTwist = 406.4; + ACE_barrelLength = 127.0; }; class rhsusf_acc_sniper_base; diff --git a/optionals/compat_rhs_usf3/config.cpp b/optionals/compat_rhs_usf3/config.cpp index 59517ed64f..ce847e969e 100644 --- a/optionals/compat_rhs_usf3/config.cpp +++ b/optionals/compat_rhs_usf3/config.cpp @@ -5,7 +5,7 @@ class CfgPatches { units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; - requiredAddons[] = {"rhsusf_c_weapons", "rhsusf_c_troops"}; + requiredAddons[] = {"rhsusf_c_weapons", "rhsusf_c_troops", "rhsusf_c_m1a1", "rhsusf_c_m1a2", "RHS_US_A2_AirImport", "rhsusf_c_m109", "rhsusf_c_hmmwv", "rhsusf_c_rg33", "rhsusf_c_fmtv", "rhsusf_c_m113", "RHS_US_A2Port_Armor"}; author[]={"Ruthberg", "GitHawk"}; VERSION_CONFIG; };