diff --git a/addons/common/functions/fnc_canInteractWith.sqf b/addons/common/functions/fnc_canInteractWith.sqf index 4b4382a14e..7603452965 100644 --- a/addons/common/functions/fnc_canInteractWith.sqf +++ b/addons/common/functions/fnc_canInteractWith.sqf @@ -16,7 +16,7 @@ params ["_unit", "_target", ["_exceptions", []]]; -_exceptions = [_exceptions, {toLower _this}] call FUNC(map); +_exceptions = _exceptions apply {toLower _x}; private _owner = _target getVariable [QGVAR(owner), objNull]; diff --git a/addons/common/functions/fnc_checkFiles.sqf b/addons/common/functions/fnc_checkFiles.sqf index cdf5cb3d93..19a4c6f72a 100644 --- a/addons/common/functions/fnc_checkFiles.sqf +++ b/addons/common/functions/fnc_checkFiles.sqf @@ -21,8 +21,8 @@ ACE_LOGINFO_1("ACE is version %1.",_version); //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); +_addons = _addons apply {toLower configName _x};// +_addons = _addons select {_x find "ace_" == 0}; { if (getText (configFile >> "CfgPatches" >> _x >> "versionStr") != _version) then { @@ -63,7 +63,7 @@ _addons = [_addons, {_this find "ace_" == 0}] call FUNC(filter); /////////////// if (isMultiplayer) then { // don't check optional addons - _addons = [_addons, {getNumber (configFile >> "CfgPatches" >> _this >> "ACE_isOptional") != 1}] call FUNC(filter); + _addons = _addons select {getNumber (configFile >> "CfgPatches" >> _x >> "ACE_isOptional") != 1}; if (isServer) then { // send servers version of ACE to all clients diff --git a/addons/common/functions/fnc_filter.sqf b/addons/common/functions/fnc_filter.sqf index 36ff328ef0..acee28eaa2 100644 --- a/addons/common/functions/fnc_filter.sqf +++ b/addons/common/functions/fnc_filter.sqf @@ -9,15 +9,16 @@ * Return Value: * Final array * - * Usage: - * [[0,1,2,3,4], {_this > 2}] call FUNC(filter) ==> [3,4] - * * Public: Yes + * + * Deprecated */ #include "script_component.hpp" params [["_array", [], [[]]], ["_code", {}, [{}]]]; +ACE_DEPRECATED("ace_common_fnc_filter","3.7.0","select CODE"); + private _result = []; { diff --git a/addons/common/functions/fnc_getChildren.sqf b/addons/common/functions/fnc_getChildren.sqf index 19fdf287fe..f2930b015d 100644 --- a/addons/common/functions/fnc_getChildren.sqf +++ b/addons/common/functions/fnc_getChildren.sqf @@ -16,4 +16,4 @@ params ["_name", "_cfgClass"]; private _classes = format ["configName inheritsFrom _x == '%1'", _name] configClasses (configFile >> _cfgClass); -[_classes, {configName _this}] call FUNC(map) // return +_classes apply {configName _x} // return diff --git a/addons/common/functions/fnc_getVehicleUAVCrew.sqf b/addons/common/functions/fnc_getVehicleUAVCrew.sqf index fcb48ee216..2b2281ed10 100644 --- a/addons/common/functions/fnc_getVehicleUAVCrew.sqf +++ b/addons/common/functions/fnc_getVehicleUAVCrew.sqf @@ -14,4 +14,4 @@ params [["_vehicle", objNull, [objNull]]]; -[crew _vehicle, {getText (configFile >> "CfgVehicles" >> typeOf _this >> "simulation") == "UAVPilot"}] call FUNC(filter) // return +crew _vehicle select {getText (configFile >> "CfgVehicles" >> typeOf _x >> "simulation") == "UAVPilot"} // return diff --git a/addons/common/functions/fnc_map.sqf b/addons/common/functions/fnc_map.sqf index 5d24e13b38..c92a4eb588 100644 --- a/addons/common/functions/fnc_map.sqf +++ b/addons/common/functions/fnc_map.sqf @@ -1,6 +1,6 @@ /* * Author: KoffeinFlummi, commy2 - * Applies given code to every element in an array, LIKE SOMETHING SQF SHOULD HAVE BY DEFAULT. + * Applies given code to every element in an array, LIKE SOMETHING SQF SHOULD HAVE BY DEFAULT. <- :kappa: * * Arguments: * 0: Array to be thingied. @@ -9,15 +9,16 @@ * Return Value: * Final array * - * Usage: - * [["2", "gobblecock", "25"], {parseNumber _this}] call FUNC(map) ==> [2, 0, 25] - * * Public: Yes + * + * Deprecated */ #include "script_component.hpp" params [["_array", [], [[]]], ["_code", {}, [{}]]]; +ACE_DEPRECATED("ace_common_fnc_map","3.7.0","apply"); + // copy array to not alter the original one _array = + _array; diff --git a/addons/common/functions/fnc_removeSpecificMagazine.sqf b/addons/common/functions/fnc_removeSpecificMagazine.sqf index e703a56296..4ca5eec6d7 100644 --- a/addons/common/functions/fnc_removeSpecificMagazine.sqf +++ b/addons/common/functions/fnc_removeSpecificMagazine.sqf @@ -19,7 +19,7 @@ params [["_unit", objNull, [objNull]], ["_magazineType", "", [""]], ["_ammoCount private _isRemoved = false; // Check uniform -private _magazines = [magazinesAmmoCargo uniformContainer _unit, {_this select 0 == _magazineType}] call FUNC(filter); +private _magazines = magazinesAmmoCargo uniformContainer _unit select {_x select 0 == _magazineType}; private _index = _magazines find [_magazineType, _ammoCount]; if (_index > -1) exitWith { @@ -39,7 +39,7 @@ if (_index > -1) exitWith { }; // Check vest -_magazines = [magazinesAmmoCargo vestContainer _unit, {_this select 0 == _magazineType}] call FUNC(filter); +_magazines = magazinesAmmoCargo vestContainer _unit select {_x select 0 == _magazineType}; _index = _magazines find [_magazineType, _ammoCount]; if (_index > -1) exitWith { @@ -59,7 +59,7 @@ if (_index > -1) exitWith { }; // Check backpack -_magazines = [magazinesAmmoCargo backpackContainer _unit, {_this select 0 == _magazineType}] call FUNC(filter); +_magazines = magazinesAmmoCargo backpackContainer _unit select {_x select 0 == _magazineType}; _index = _magazines find [_magazineType, _ammoCount]; if (_index > -1) exitWith { diff --git a/addons/explosives/functions/fnc_getDetonators.sqf b/addons/explosives/functions/fnc_getDetonators.sqf index 22360c875e..d8c095e6f0 100644 --- a/addons/explosives/functions/fnc_getDetonators.sqf +++ b/addons/explosives/functions/fnc_getDetonators.sqf @@ -19,16 +19,7 @@ params ["_unit"]; TRACE_1("params",_unit); -private ["_items", "_result", "_config"]; - -_items = (items _unit); -_result = []; - -{ - _config = ConfigFile >> "CfgWeapons" >> _x; - if (getNumber (_config >> QGVAR(Detonator)) == 1 && {!(_x in _result)}) then { - _result pushBack _x; - }; -} forEach _items; +private _result = (items _unit) select {getNumber (ConfigFile >> "CfgWeapons" >> _x >> QGVAR(Detonator)) == 1}; +_result = _result arrayIntersect _result; _result diff --git a/addons/fcs/functions/fnc_calculateSolution.sqf b/addons/fcs/functions/fnc_calculateSolution.sqf index f59b4f6fbc..9908832824 100644 --- a/addons/fcs/functions/fnc_calculateSolution.sqf +++ b/addons/fcs/functions/fnc_calculateSolution.sqf @@ -43,10 +43,7 @@ private _turretConfig = [configFile >> "CfgVehicles" >> typeOf _vehicle, _turret } count _muzzles; // Fix the `in` operator being case sensitive and BI fucking up the spelling of their own classnames - private _weaponMagazinesCheck = []; - { - _weaponMagazinesCheck pushBack (toLower _x); - } forEach _weaponMagazines; + private _weaponMagazinesCheck = _weaponMagazines apply {toLower _x}; // Another BIS fix: ShotBullet simulation uses weapon initSpeed, others ignore it if (toLower _magazine in _weaponMagazinesCheck && {_bulletSimulation == "shotBullet"}) exitWith { diff --git a/addons/interaction/functions/fnc_passMagazine.sqf b/addons/interaction/functions/fnc_passMagazine.sqf index 2afe2f3817..7e2f7b9356 100644 --- a/addons/interaction/functions/fnc_passMagazine.sqf +++ b/addons/interaction/functions/fnc_passMagazine.sqf @@ -21,10 +21,7 @@ params ["_player", "_target", "_weapon"]; private ["_compatibleMags", "_filteredMags", "_magToPass", "_magToPassIndex", "_playerName", "_magToPassDisplayName"]; _compatibleMags = getArray (configfile >> "CfgWeapons" >> _weapon >> "magazines"); -_filteredMags = [magazinesAmmoFull _player, { - params ["_className", "", "_loaded"]; - _className in _compatibleMags && !_loaded -}] call EFUNC(common,filter); +_filteredMags = magazinesAmmoFull _player select {(_x select 0) in _compatibleMags && {!(_x select 2)}}; //select magazine with most ammo _magToPass = _filteredMags select 0; diff --git a/addons/inventory/XEH_postInit.sqf b/addons/inventory/XEH_postInit.sqf index d0e3fb042a..586f10fc28 100644 --- a/addons/inventory/XEH_postInit.sqf +++ b/addons/inventory/XEH_postInit.sqf @@ -18,7 +18,7 @@ GVAR(Grenades_ItemList) = []; } count getArray (configFile >> "CfgWeapons" >> "Throw" >> "muzzles"); // make list case insensitive -GVAR(Grenades_ItemList) = [GVAR(Grenades_ItemList), {toLower _this}] call EFUNC(common,map); +GVAR(Grenades_ItemList) = GVAR(Grenades_ItemList) apply {toLower _x}; // filter duplicates GVAR(Grenades_ItemList) = GVAR(Grenades_ItemList) arrayIntersect GVAR(Grenades_ItemList); @@ -41,8 +41,11 @@ GVAR(Medical_ItemList) = []; ("true" configClasses (configFile >> QEGVAR(Medical,Actions) >> "Advanced")) ); +// remove all numbers from list +GVAR(Medical_ItemList) = GVAR(Medical_ItemList) select {_x isEqualType ""}; + // make list case insensitive -GVAR(Medical_ItemList) = [GVAR(Medical_ItemList), {if (_this isEqualType "") then {toLower _this}}] call EFUNC(common,map); +GVAR(Medical_ItemList) = GVAR(Medical_ItemList) apply {toLower _x}; // filter duplicates GVAR(Medical_ItemList) = GVAR(Medical_ItemList) arrayIntersect GVAR(Medical_ItemList); diff --git a/addons/map/functions/fnc_blueForceTrackingUpdate.sqf b/addons/map/functions/fnc_blueForceTrackingUpdate.sqf index e9a619b5a4..3e966ca5f6 100644 --- a/addons/map/functions/fnc_blueForceTrackingUpdate.sqf +++ b/addons/map/functions/fnc_blueForceTrackingUpdate.sqf @@ -16,15 +16,14 @@ if (GVAR(BFT_Enabled) and {(!isNil "ACE_player") and {alive ACE_player}}) then { _groupsToDrawMarkers = []; _playerSide = call EFUNC(common,playerSide); - if !(GVAR(BFT_HideAiGroups)) then { - _groupsToDrawMarkers = [allGroups, {side _this == _playerSide}] call EFUNC(common,filter); - } else { - _groupsToDrawMarkers = [allGroups, { - _anyPlayers = { - [_x] call EFUNC(common,isPlayer); - } count units _this; - (side _this == _playerSide) && _anyPlayers > 0 - }] call EFUNC(common,filter); + _groupsToDrawMarkers = allGroups select {side _x == _playerSide}; + + if (GVAR(BFT_HideAiGroups)) then { + _groupsToDrawMarkers = _groupsToDrawMarkers select { + { + _x call EFUNC(common,isPlayer); + } count units _x > 0; + }; }; { diff --git a/addons/map/functions/fnc_determineMapLight.sqf b/addons/map/functions/fnc_determineMapLight.sqf index 9712b84515..c647e93e0c 100644 --- a/addons/map/functions/fnc_determineMapLight.sqf +++ b/addons/map/functions/fnc_determineMapLight.sqf @@ -90,26 +90,21 @@ TRACE_1("Player is on foot or in an open vehicle",""); _lightLevel = _lightLevel max ([_unit, _x] call EFUNC(common,lightIntensityFromObject)); } forEach nearestObjects [_unit, ["All"], 40]; - // @todo: Illumination flares (timed) - // Using chemlights -_nearObjects = [_unit nearObjects ["SmokeShell", 4], { - alive _this && {(typeOf _this == "Chemlight_red") || { - (typeOf _this == "Chemlight_green") || { - (typeOf _this == "Chemlight_blue") || { - (typeOf _this == "Chemlight_yellow")}}}}}] call EFUNC(common,filter); +_nearObjects = (_unit nearObjects ["SmokeShell", 4]) select {alive _x && {toLower typeOf _x in ["chemlight_red", "chemlight_green", "chemlight_blue", "chemlight_yellow"]}}; + if (count (_nearObjects) > 0) then { _light = _nearObjects select 0; _ll = (1 - ((((_unit distance _light) - 2)/2) max 0)) * 0.4; if (_ll > _lightLevel) then { - _flareTint = switch (typeOf _light) do { - case "Chemlight_red" : {[1,0,0,1]}; - case "Chemlight_green" : {[0,1,0,1]}; - case "Chemlight_blue" : {[0,0,1,1]}; - case "Chemlight_yellow" : {[1,1,0,1]}; + _flareTint = switch (toLower typeOf _light) do { + case "chemlight_red" : {[1,0,0,1]}; + case "chemlight_green" : {[0,1,0,1]}; + case "chemlight_blue" : {[0,0,1,1]}; + case "chemlight_yellow" : {[1,1,0,1]}; }; _lightTint = [_lightTint, _flareTint, (_ll - _lightLevel)/(1 - _lightLevel)] call _fnc_blendColor; _lightLevel = _ll; diff --git a/addons/medical/functions/fnc_setHitPointDamage.sqf b/addons/medical/functions/fnc_setHitPointDamage.sqf index f8698a7fe0..44da08f233 100644 --- a/addons/medical/functions/fnc_setHitPointDamage.sqf +++ b/addons/medical/functions/fnc_setHitPointDamage.sqf @@ -47,8 +47,7 @@ if !(_selection in _selections) exitWith { _unit setHitPointDamage [_selection, _damage]; }; -GVAR(unit) = _unit; -_damages = [_selections, {GVAR(unit) getHitPointDamage _this}] call EFUNC(common,map); +_damages = _selections apply {_unit getHitPointDamage _x}; _damageOld = damage _unit; _damageSumOld = 0; diff --git a/addons/nametags/functions/fnc_doShow.sqf b/addons/nametags/functions/fnc_doShow.sqf index 1b7323921f..615916de7f 100644 --- a/addons/nametags/functions/fnc_doShow.sqf +++ b/addons/nametags/functions/fnc_doShow.sqf @@ -18,23 +18,19 @@ private["_roleImages", "_player", "_vehicle", "_type", "_config", "_text", "_data", "_isAir", "_turretUnits", "_turretRoles", "_index", "_roleType", "_unit", "_toShow"]; - _player = ACE_player; _vehicle = vehicle _player; _type = typeOf _vehicle; _config = configFile >> "CfgVehicles" >> _type; _text = format[" %2
", getText(_config>>"picture"), getText (_config >> "DisplayName")]; - - _data = [_type] call FUNC(getVehicleData); _isAir = _data select 0; _data = _data select 1; -_turretUnits = [_data, { _vehicle turretUnit (_x select 0) } ] call EFUNC(common,map); -_turretRoles = [_data, { _x select 1 } ] call EFUNC(common,map); - +_turretUnits = _data apply {_vehicle turretUnit (_x select 0)}; +_turretRoles = _data apply {_x select 1}; _roleType = CARGO; _toShow = []; @@ -61,7 +57,6 @@ _toShow = []; _toShow pushBack [_x, _roleType]; } forEach crew _vehicle; - _toShow = [ _toShow, [], @@ -75,7 +70,6 @@ _toShow = [ } ] call BIS_fnc_sortBy; - _roleImages = ROLE_IMAGES; { _unit = _x select 0; @@ -83,7 +77,6 @@ _roleImages = ROLE_IMAGES; _text = _text + format["%1
", [_unit] call EFUNC(common,getName), _roleImages select _roleType]; } forEach _toShow; - ("ACE_CrewInfo_CrewInfo" call BIS_fnc_rscLayer) cutRsc ["ACE_CrewInfo_dialog", "PLAIN", 1, false]; terminate (missionNamespace getVariable [QGVAR(hideCrewInfoHandle), scriptNull]); diff --git a/addons/reload/functions/fnc_canLinkBelt.sqf b/addons/reload/functions/fnc_canLinkBelt.sqf index b36959e4e1..13fad4d460 100644 --- a/addons/reload/functions/fnc_canLinkBelt.sqf +++ b/addons/reload/functions/fnc_canLinkBelt.sqf @@ -32,6 +32,6 @@ private _maxAmmo = 0; { _maxAmmo = _maxAmmo max (_x select 1); -} forEach ([magazinesAmmo _player, {_this select 0 == _magazineType}] call EFUNC(common,filter)); +} forEach (magazinesAmmo _player select {_x select 0 == _magazineType}); _maxAmmo > 0 diff --git a/addons/reload/functions/fnc_startLinkingBelt.sqf b/addons/reload/functions/fnc_startLinkingBelt.sqf index ebee6fd350..5924e1b4e1 100644 --- a/addons/reload/functions/fnc_startLinkingBelt.sqf +++ b/addons/reload/functions/fnc_startLinkingBelt.sqf @@ -32,7 +32,7 @@ private _maxAmmo = 0; { _maxAmmo = _maxAmmo max (_x select 1); -} forEach ([magazinesAmmo _player, {_this select 0 == _magazineType}] call EFUNC(common,filter)); +} forEach (magazinesAmmo _player select {_x select 0 == _magazineType}); if (_maxAmmo == 0) exitWith {}; diff --git a/addons/reloadlaunchers/functions/fnc_getLoadableMissiles.sqf b/addons/reloadlaunchers/functions/fnc_getLoadableMissiles.sqf index 9b083a04c6..e75d826513 100644 --- a/addons/reloadlaunchers/functions/fnc_getLoadableMissiles.sqf +++ b/addons/reloadlaunchers/functions/fnc_getLoadableMissiles.sqf @@ -22,7 +22,7 @@ private "_magazines"; _magazines = magazines _unit; // case sensitvity -_magazines = [_magazines, {toLower _this}] call EFUNC(common,map); +_magazines = _magazines apply {toLower _x}; // get reloaders magazine types compatible with targets launcher. No duplicates. -[getArray (configFile >> "CfgWeapons" >> _weapon >> "magazines"), {toLower _this in _magazines}] call EFUNC(common,filter) +getArray (configFile >> "CfgWeapons" >> _weapon >> "magazines") select {toLower _x in _magazines} // return diff --git a/addons/scopes/functions/fnc_applyScopeAdjustment.sqf b/addons/scopes/functions/fnc_applyScopeAdjustment.sqf index afc378873b..af2f018e11 100644 --- a/addons/scopes/functions/fnc_applyScopeAdjustment.sqf +++ b/addons/scopes/functions/fnc_applyScopeAdjustment.sqf @@ -42,7 +42,7 @@ playSound selectRandom ["ACE_Scopes_Click_1", "ACE_Scopes_Click_2", "ACE_Scopes_ // slightly rotate the player if looking through optic if (cameraView == "GUNNER") then { // Convert adjustmentDifference from mils to degrees - _adjustmentDifference = [_adjustmentDifference, {_this * 0.05625}] call EFUNC(common,map); + _adjustmentDifference = _adjustmentDifference apply {_x * 0.05625}; _adjustmentDifference params ["_elevationDifference", "_windageDifference"]; _pitchBankYaw = [_unit] call EFUNC(common,getPitchBankYaw); _pitchBankYaw params ["_pitch", "_bank", "_yaw"]; diff --git a/addons/switchunits/functions/fnc_switchUnit.sqf b/addons/switchunits/functions/fnc_switchUnit.sqf index 903207652c..a26b2d474a 100644 --- a/addons/switchunits/functions/fnc_switchUnit.sqf +++ b/addons/switchunits/functions/fnc_switchUnit.sqf @@ -25,7 +25,7 @@ private _leave = false; if (GVAR(EnableSafeZone)) then { private _allNearestPlayers = [position _unit, GVAR(SafeZoneRadius)] call FUNC(nearestPlayers); - private _nearestEnemyPlayers = [_allNearestPlayers, {((side GVAR(OriginalGroup)) getFriend (side _this) < 0.6) && !(_this getVariable [QGVAR(IsPlayerControlled), false])}] call EFUNC(common,filter); + private _nearestEnemyPlayers = _allNearestPlayers select {((side GVAR(OriginalGroup)) getFriend side _x < 0.6) && !(_x getVariable [QGVAR(IsPlayerControlled), false])}; if (count _nearestEnemyPlayers > 0) exitWith { _leave = true; diff --git a/addons/weaponselect/functions/fnc_selectNextGrenade.sqf b/addons/weaponselect/functions/fnc_selectNextGrenade.sqf index a4e93814a9..f4b48a1b1e 100644 --- a/addons/weaponselect/functions/fnc_selectNextGrenade.sqf +++ b/addons/weaponselect/functions/fnc_selectNextGrenade.sqf @@ -57,9 +57,9 @@ private _nextGrenade = _grenades select _nextGrenadeIndex; 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 -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); +private _uniformGrenades = uniformItems _unit select {_x in GVAR(GrenadesAll) && {_x != _nextGrenade}}; +private _vestGrenades = vestItems _unit select {_x in GVAR(GrenadesAll) && {_x != _nextGrenade}}; +private _backpackGrenades = backpackItems _unit select {_x in GVAR(GrenadesAll) && {_x != _nextGrenade}}; // remove all grenades except those we are switching to --> this breaks the selector {_unit removeItemFromUniform _x; false} count _uniformGrenades;