Replace forEach with Count

Use count where you do not need _forEachIndex variable, it's quicker
than forEach.
This commit is contained in:
icomrade
2014-05-27 15:37:57 -04:00
parent 91d246e64e
commit e54b9983dd
210 changed files with 890 additions and 890 deletions

View File

@@ -24,18 +24,18 @@ actionMonitor = {
if (alive _holder) then {
_distance = player distance _holder;
// Add action to player
if ((_distance < 1.75) and (_action == -1)) then {
if ((_distance < 1.75) && (_action == -1)) then {
_action = player addAction [format[(localize "STR_DAYZ_CODE_1"),_name], "\z\addons\dayz_code\actions\object_pickup.sqf",[_type,_classname,_holder], 20, true, true];
player reveal _holder;
_timeout = 0.3;
};
// Remove action from player
if ((_distance >= 1.75) and (_action != -1)) then {
if ((_distance >= 1.75) && (_action != -1)) then {
player removeAction _action;
_action = -1;
_timeout = 2;
};
// Stop the loop and fall back to old code
// Stop the loop && fall back to old code
if (_distance > 100) then {
_null = _holder addAction [format[(localize "STR_DAYZ_CODE_1"),_name], "\z\addons\dayz_code\actions\object_pickup.sqf",[_type,_classname,_holder], 20, true, true];
player reveal _holder;