mirror of
https://github.com/Defent/DMS_Exile.git
synced 2024-08-30 16:52:12 +00:00
Replace count w/ forEach
This commit is contained in:
parent
6e627cf355
commit
ea28d73468
@ -123,8 +123,7 @@ if !(_added) exitWith
|
||||
_cleanup = [];
|
||||
{
|
||||
_cleanup pushBack _x;
|
||||
false;
|
||||
} count _missionAIUnits;
|
||||
} forEach _missionAIUnits;
|
||||
|
||||
_cleanup pushBack ((_missionObjs select 0)+(_missionObjs select 1));
|
||||
|
||||
@ -132,7 +131,7 @@ if !(_added) exitWith
|
||||
|
||||
|
||||
// Delete the markers directly
|
||||
{deleteMarker _x;false;} count _markers;
|
||||
{deleteMarker _x;} forEach _markers;
|
||||
|
||||
|
||||
// Reset the mission count
|
||||
|
@ -122,8 +122,7 @@ if !(_added) exitWith
|
||||
_cleanup = [];
|
||||
{
|
||||
_cleanup pushBack _x;
|
||||
false;
|
||||
} count _missionAIUnits;
|
||||
} forEach _missionAIUnits;
|
||||
|
||||
_cleanup pushBack ((_missionObjs select 0)+(_missionObjs select 1));
|
||||
|
||||
@ -131,7 +130,7 @@ if !(_added) exitWith
|
||||
|
||||
|
||||
// Delete the markers directly
|
||||
{deleteMarker _x;false;} count _markers;
|
||||
{deleteMarker _x;} forEach _markers;
|
||||
|
||||
|
||||
// Reset the mission count
|
||||
|
@ -121,8 +121,7 @@ if !(_added) exitWith
|
||||
_cleanup = [];
|
||||
{
|
||||
_cleanup pushBack _x;
|
||||
false;
|
||||
} count _missionAIUnits;
|
||||
} forEach _missionAIUnits;
|
||||
|
||||
_cleanup pushBack ((_missionObjs select 0)+(_missionObjs select 1));
|
||||
|
||||
@ -130,7 +129,7 @@ if !(_added) exitWith
|
||||
|
||||
|
||||
// Delete the markers directly
|
||||
{deleteMarker _x;false;} count _markers;
|
||||
{deleteMarker _x;} forEach _markers;
|
||||
|
||||
|
||||
// Reset the mission count
|
||||
|
@ -118,8 +118,7 @@ if !(_added) exitWith
|
||||
_cleanup = [];
|
||||
{
|
||||
_cleanup pushBack _x;
|
||||
false;
|
||||
} count _missionAIUnits;
|
||||
} forEach _missionAIUnits;
|
||||
|
||||
_cleanup pushBack ((_missionObjs select 0)+(_missionObjs select 1));
|
||||
|
||||
@ -127,7 +126,7 @@ if !(_added) exitWith
|
||||
|
||||
|
||||
// Delete the markers directly
|
||||
{deleteMarker _x;false;} count _markers;
|
||||
{deleteMarker _x;} forEach _markers;
|
||||
|
||||
|
||||
// Reset the mission count
|
||||
|
@ -118,8 +118,7 @@ if !(_added) exitWith
|
||||
_cleanup = [];
|
||||
{
|
||||
_cleanup pushBack _x;
|
||||
false;
|
||||
} count _missionAIUnits;
|
||||
} forEach _missionAIUnits;
|
||||
|
||||
_cleanup pushBack ((_missionObjs select 0)+(_missionObjs select 1));
|
||||
|
||||
@ -127,7 +126,7 @@ if !(_added) exitWith
|
||||
|
||||
|
||||
// Delete the markers directly
|
||||
{deleteMarker _x;false;} count _markers;
|
||||
{deleteMarker _x;} forEach _markers;
|
||||
|
||||
|
||||
// Reset the mission count
|
||||
|
@ -118,8 +118,7 @@ if !(_added) exitWith
|
||||
_cleanup = [];
|
||||
{
|
||||
_cleanup pushBack _x;
|
||||
false;
|
||||
} count _missionAIUnits;
|
||||
} forEach _missionAIUnits;
|
||||
|
||||
_cleanup pushBack ((_missionObjs select 0)+(_missionObjs select 1));
|
||||
|
||||
@ -127,7 +126,7 @@ if !(_added) exitWith
|
||||
|
||||
|
||||
// Delete the markers directly
|
||||
{deleteMarker _x;false;} count _markers;
|
||||
{deleteMarker _x;} forEach _markers;
|
||||
|
||||
|
||||
// Reset the mission count
|
||||
|
@ -27,5 +27,4 @@ DMS_MissionTypesArray = [];
|
||||
for "_i" from 1 to (_x select 1) do {
|
||||
DMS_MissionTypesArray pushBack (_x select 0);
|
||||
};
|
||||
false;
|
||||
} count DMS_MissionTypes;
|
||||
} forEach DMS_MissionTypes;
|
@ -126,8 +126,7 @@ if !(_added) exitWith
|
||||
_cleanup = [];
|
||||
{
|
||||
_cleanup pushBack _x;
|
||||
false;
|
||||
} count _missionAIUnits;
|
||||
} forEach _missionAIUnits;
|
||||
|
||||
_cleanup pushBack ((_missionObjs select 0)+(_missionObjs select 1));
|
||||
|
||||
@ -135,7 +134,7 @@ if !(_added) exitWith
|
||||
|
||||
|
||||
// Delete the markers directly
|
||||
{deleteMarker _x;false;} count _markers;
|
||||
{deleteMarker _x;} forEach _markers;
|
||||
|
||||
|
||||
// Reset the mission count
|
||||
|
@ -30,9 +30,7 @@ if !(DMS_ai_offload_to_client) exitWith {};
|
||||
{
|
||||
_owner = _x;
|
||||
};
|
||||
|
||||
false;
|
||||
} count allPlayers;
|
||||
} forEach allPlayers;
|
||||
|
||||
if ((isNull _owner) || {(_owner distance2D _leader)>3500}) then
|
||||
{
|
||||
@ -49,5 +47,4 @@ if !(DMS_ai_offload_to_client) exitWith {};
|
||||
};
|
||||
};
|
||||
};
|
||||
false;
|
||||
} count allGroups;
|
||||
} forEach allGroups;
|
@ -97,12 +97,10 @@ try
|
||||
{
|
||||
{
|
||||
_units pushBack _x;
|
||||
false;
|
||||
} count (units _x);
|
||||
} forEach (units _x);
|
||||
};
|
||||
};
|
||||
false;
|
||||
} count _inputUnits;
|
||||
} forEach _inputUnits;
|
||||
|
||||
_OK = _missionObjs params
|
||||
[
|
||||
|
@ -31,5 +31,4 @@ if ((typeName _this) != "STRING") then
|
||||
] select (_x == "dynamicTextRequest");
|
||||
|
||||
_args call ExileServer_system_network_send_broadcast;
|
||||
false;
|
||||
} count DMS_PlayerNotificationTypes;
|
||||
} forEach DMS_PlayerNotificationTypes;
|
@ -29,14 +29,6 @@ if !((typeName _this) == "ARRAY") then
|
||||
_this = [_this];
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
if ([_this,20] call DMS_isPlayerNearbyARRAY) exitWith //<-----Not sure if it's more/less efficient
|
||||
{
|
||||
[30, DMS_CleanUp, _this, false] call ExileServer_system_thread_addTask;
|
||||
};
|
||||
*/
|
||||
|
||||
private ["_skippedObjects","_clean"];
|
||||
|
||||
_skippedObjects = [];
|
||||
@ -85,8 +77,7 @@ _clean =
|
||||
// Group cleanup should only be called when it has to be deleted regardless, so no need to check for nearby players
|
||||
{
|
||||
_x call _clean;
|
||||
false;
|
||||
} count (units _x);
|
||||
} forEach (units _x);
|
||||
|
||||
if(local _x)then
|
||||
{
|
||||
@ -108,9 +99,7 @@ _clean =
|
||||
};
|
||||
diag_log format ["DMS ERROR :: Attempted to call DMS_CleanUp on non- group or object %1 from array %2",_x,_this];
|
||||
};
|
||||
|
||||
false;
|
||||
} count _this;
|
||||
} forEach _this;
|
||||
|
||||
|
||||
if !(_skippedObjects isEqualTo []) then
|
||||
|
@ -50,6 +50,4 @@ if (DMS_CleanUpList isEqualTo []) exitWith {}; // Empty array, no objects to cl
|
||||
diag_log format ["DMS_DEBUG CleanUpManager :: %1 is not yet ready to clean!",_x];
|
||||
};
|
||||
};
|
||||
|
||||
false;
|
||||
} count DMS_CleanUpList;
|
||||
} forEach DMS_CleanUpList;
|
@ -58,7 +58,6 @@ _success = true;
|
||||
_success = _completionArgs call ExileServer_util_position_isPlayerNearby;
|
||||
};
|
||||
};
|
||||
false;
|
||||
} count _this;
|
||||
} forEach _this;
|
||||
|
||||
_success;
|
@ -113,5 +113,4 @@ _index = 0;
|
||||
};
|
||||
};
|
||||
_index = _index + 1;
|
||||
false;
|
||||
} count DMS_Mission_Arr;
|
||||
} forEach DMS_Mission_Arr;
|
@ -40,7 +40,7 @@ if (isPlayer _player) then
|
||||
if (((position _x) distance (position _unit)) <= DMS_ai_share_info_distance ) then {
|
||||
_x reveal [_player, 4.0];
|
||||
};
|
||||
} count allUnits;
|
||||
} forEach allUnits;
|
||||
};
|
||||
}
|
||||
else
|
||||
@ -75,8 +75,7 @@ if(DMS_ai_remove_launchers && {_launcher != ""}) then
|
||||
if(_x == _rockets) then {
|
||||
_unit removeMagazine _x;
|
||||
};
|
||||
false;
|
||||
} count magazines _unit;
|
||||
} forEach magazines _unit;
|
||||
};
|
||||
|
||||
if(DMS_RemoveNVG) then
|
||||
|
@ -43,8 +43,7 @@ _client = objNull;
|
||||
{
|
||||
_client = _x;
|
||||
};
|
||||
false;
|
||||
} count allPlayers;
|
||||
} forEach allPlayers;
|
||||
|
||||
if (!isNull _client) then{
|
||||
ExileServerOwnershipSwapQueue pushBack [_AI,_client];
|
||||
|
@ -79,7 +79,7 @@ removeGoggles _unit;
|
||||
// Give default items
|
||||
if !(DMS_ai_default_items isEqualTo []) then
|
||||
{
|
||||
{_unit linkItem _x;false;} count DMS_ai_default_items;
|
||||
{_unit linkItem _x;} forEach DMS_ai_default_items;
|
||||
};
|
||||
|
||||
|
||||
@ -100,10 +100,10 @@ if (!_useCustomGear) then
|
||||
};// No more idiot-proofing for the following configs
|
||||
|
||||
// Equipment (Stuff that goes in the toolbelt slots)
|
||||
{_unit linkItem _x;false;} count (missionNamespace getVariable [format ["DMS_%1_equipment",_type],[]]);
|
||||
{_unit linkItem _x;} forEach (missionNamespace getVariable [format ["DMS_%1_equipment",_type],[]]);
|
||||
|
||||
// Items (Loot stuff that goes in uniform/vest/backpack)
|
||||
{_unit addItem _x;false;} count (missionNamespace getVariable [format ["DMS_%1_items",_type],[]]);
|
||||
{_unit addItem _x;} forEach (missionNamespace getVariable [format ["DMS_%1_items",_type],[]]);
|
||||
|
||||
|
||||
// Clothes
|
||||
@ -228,8 +228,7 @@ else
|
||||
_x = [_x,1];
|
||||
};
|
||||
_unit addMagazines _x;
|
||||
false;
|
||||
} count _magazines;
|
||||
} forEach _magazines;
|
||||
|
||||
|
||||
// Add gun and attachments
|
||||
@ -239,8 +238,7 @@ else
|
||||
|
||||
{
|
||||
_unit addPrimaryWeaponItem _x;
|
||||
false;
|
||||
} count _weaponAttachments;
|
||||
} forEach _weaponAttachments;
|
||||
|
||||
_unit selectWeapon _weapon;
|
||||
};
|
||||
@ -253,25 +251,22 @@ else
|
||||
|
||||
{
|
||||
_unit addPrimaryWeaponItem _x;
|
||||
false;
|
||||
} count _pistolAttachments;
|
||||
} forEach _pistolAttachments;
|
||||
};
|
||||
|
||||
// Add items
|
||||
{
|
||||
_unit addItem _x;
|
||||
false;
|
||||
} count _items;
|
||||
} forEach _items;
|
||||
};
|
||||
|
||||
{
|
||||
_unit setSkill [(_x select 0),(_x select 1)];
|
||||
false;
|
||||
} count (missionNamespace getVariable [format["DMS_ai_skill_%1",_difficulty],[]]);
|
||||
} forEach (missionNamespace getVariable [format["DMS_ai_skill_%1",_difficulty],[]]);
|
||||
|
||||
|
||||
// Soldier killed event handler
|
||||
_unit addMPEventHandler ["MPKilled",'[_this, '+str _side+', "soldier"] call DMS_OnKilled;'];
|
||||
_unit addMPEventHandler ["MPKilled",'if (isServer) then {[_this, '+str _side+', "soldier"] call DMS_OnKilled;};'];
|
||||
|
||||
_unit enableAI "TARGET";
|
||||
_unit enableAI "AUTOTARGET";
|
||||
|
@ -44,12 +44,9 @@ try
|
||||
{
|
||||
throw _x;
|
||||
};
|
||||
false;
|
||||
} count (units _x);
|
||||
} forEach (units _x);
|
||||
};
|
||||
|
||||
false;
|
||||
} count _this;
|
||||
} forEach _this;
|
||||
|
||||
_killed = true;
|
||||
}
|
||||
|
@ -61,8 +61,7 @@ while{!_validspot} do {
|
||||
{
|
||||
throw ("another mission");
|
||||
};
|
||||
false;
|
||||
} count allMapMarkers;
|
||||
} forEach allMapMarkers;
|
||||
|
||||
// No exceptions found
|
||||
_validspot = true;
|
||||
|
@ -38,9 +38,7 @@ _result = false;
|
||||
diag_log format["DMS_DEBUG IsPlayerNearbyARRAY :: %1 is within %2m of %3!",_plyr,_radius,_x];
|
||||
};
|
||||
};
|
||||
false;
|
||||
} count _posArray;
|
||||
} forEach _posArray;
|
||||
};
|
||||
false;
|
||||
} count allPlayers;
|
||||
} forEach allPlayers;
|
||||
_result
|
Loading…
Reference in New Issue
Block a user