mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2026-02-27 10:11:51 +03:00
Replace forEach with Count
Use count where you do not need _forEachIndex variable, it's quicker than forEach.
This commit is contained in:
@@ -17,7 +17,7 @@ if (_option == 1) then {
|
||||
_objectUID = _x getVariable ["ObjectUID","0"];
|
||||
if (_objectUID != "0") then {
|
||||
_x setDamage 0;
|
||||
_key = format["CHILD:397:%1:", _objectUID]; // use UID if not "0" and ID is "0"
|
||||
_key = format["CHILD:397:%1:", _objectUID]; // use UID if not "0" && ID is "0"
|
||||
_data = "HiveExt" callExtension _key;
|
||||
};
|
||||
} else {
|
||||
@@ -26,7 +26,7 @@ if (_option == 1) then {
|
||||
_data = "HiveExt" callExtension _key;
|
||||
};
|
||||
};
|
||||
} forEach _objects;
|
||||
} count _objects;
|
||||
_name = if (alive _player) then { name _player; } else { "Dead Player"; };
|
||||
diag_log format ["MAINTAIN AREA BY %1 - %2 Objects at %3", _name, count _objects, (getPosATL _player)];
|
||||
};
|
||||
@@ -37,7 +37,7 @@ if (_option == 2) then {
|
||||
_objectUID = _targetObj getVariable ["ObjectUID","0"];
|
||||
if (_objectUID != "0") then {
|
||||
_targetObj setDamage 0;
|
||||
_key = format["CHILD:397:%1:", _objectUID]; // use UID if not "0" and ID is "0"
|
||||
_key = format["CHILD:397:%1:", _objectUID]; // use UID if not "0" && ID is "0"
|
||||
_data = "HiveExt" callExtension _key;
|
||||
};
|
||||
} else {
|
||||
|
||||
@@ -5,7 +5,7 @@ _playerObj = nil;
|
||||
_playerPos = [];
|
||||
{
|
||||
if ((getPlayerUID _x) == _playerUID) exitWith {_playerObj = _x;};
|
||||
} forEach playableUnits;
|
||||
} count playableUnits;
|
||||
|
||||
if (isNil "_playerObj") then {
|
||||
diag_log format["nil player object attempting PV, :%1", _this];
|
||||
@@ -53,7 +53,7 @@ if (!isNull _playerObj) then {
|
||||
|
||||
if (alive _playerObj) then {
|
||||
|
||||
_isplayernearby = (DZE_BackpackGuard and !_invehicle and ({(isPlayer _x) and (alive _x)} count (_playerPos nearEntities ["AllVehicles", 5]) > 1));
|
||||
_isplayernearby = (DZE_BackpackGuard && !_invehicle && ({(isPlayer _x) && (alive _x)} count (_playerPos nearEntities ["AllVehicles", 5]) > 1));
|
||||
|
||||
// prevent saving more than 20 magazine items
|
||||
_magazines = [(magazines _playerObj),20] call array_reduceSize;
|
||||
@@ -66,6 +66,6 @@ if (!isNull _playerObj) then {
|
||||
//Update Vehicle
|
||||
{
|
||||
[_x,"gear"] call server_updateObject;
|
||||
} foreach (nearestObjects [_playerPos, dayz_updateObjects, 10]);
|
||||
} count (nearestObjects [_playerPos, dayz_updateObjects, 10]);
|
||||
};
|
||||
};
|
||||
|
||||
@@ -13,8 +13,8 @@ _newObject setVariable ["bodyName", _victimName, true];
|
||||
_killer = _victim getVariable["AttackedBy", "nil"];
|
||||
_killerName = _victim getVariable["AttackedByName", "nil"];
|
||||
|
||||
// when a zombie kills a player _killer, _killerName and _weapon will be "nil"
|
||||
// we can use this to determine a zombie kill and send a customized message for that. right now no killmsg means it was a zombie.
|
||||
// when a zombie kills a player _killer, _killerName && _weapon will be "nil"
|
||||
// we can use this to determine a zombie kill && send a customized message for that. right now no killmsg means it was a zombie.
|
||||
if (_killerName != "nil") then
|
||||
{
|
||||
_weapon = _victim getVariable["AttackedByWeapon", "nil"];
|
||||
|
||||
@@ -31,7 +31,7 @@ if (_playerID == "") then {
|
||||
_playerID = getPlayerUID _playerObj;
|
||||
};
|
||||
|
||||
if ((_playerID == "") or (isNil "_playerID")) exitWith {
|
||||
if ((_playerID == "") || (isNil "_playerID")) exitWith {
|
||||
#ifdef DZE_SERVER_DEBUG
|
||||
diag_log ("LOGIN FAILED: Player [" + _playerName + "] has no login ID");
|
||||
#endif
|
||||
@@ -54,7 +54,7 @@ while {_doLoop < 5} do {
|
||||
_doLoop = _doLoop + 1;
|
||||
};
|
||||
|
||||
if (isNull _playerObj or !isPlayer _playerObj) exitWith {
|
||||
if (isNull _playerObj || !isPlayer _playerObj) exitWith {
|
||||
#ifdef DZE_SERVER_DEBUG
|
||||
diag_log ("LOGIN RESULT: Exiting, player object null: " + str(_playerObj));
|
||||
#endif
|
||||
|
||||
@@ -47,7 +47,7 @@ while {_doLoop < 5} do {
|
||||
_doLoop = _doLoop + 1;
|
||||
};
|
||||
|
||||
if (isNull _playerObj or !isPlayer _playerObj) exitWith {
|
||||
if (isNull _playerObj || !isPlayer _playerObj) exitWith {
|
||||
diag_log ("SETUP RESULT: Exiting, player object null: " + str(_playerObj));
|
||||
};
|
||||
|
||||
@@ -112,7 +112,7 @@ if (count _medical > 0) then {
|
||||
//["usecBleed",[_playerObj,_x,_hit]] call broadcastRpcCallAll;
|
||||
usecBleed = [_playerObj,_x,_hit];
|
||||
publicVariable "usecBleed";
|
||||
} forEach (_medical select 8);
|
||||
} count (_medical select 8);
|
||||
|
||||
//Add fractures
|
||||
_fractures = (_medical select 9);
|
||||
@@ -194,12 +194,12 @@ if (_randomSpot) then {
|
||||
_mkr = "";
|
||||
while {_findSpot} do {
|
||||
_counter = 0;
|
||||
while {_counter < 20 and _findSpot} do {
|
||||
while {_counter < 20 && _findSpot} do {
|
||||
// switched to floor
|
||||
_mkr = "spawn" + str(floor(random _spawnMC));
|
||||
_position = ([(getMarkerPos _mkr),0,spawnArea,10,0,2000,spawnShoremode] call BIS_fnc_findSafePos);
|
||||
_isNear = count (_position nearEntities ["Man",100]) == 0;
|
||||
_isZero = ((_position select 0) == 0) and ((_position select 1) == 0);
|
||||
_isZero = ((_position select 0) == 0) && ((_position select 1) == 0);
|
||||
//Island Check //TeeChange
|
||||
_pos = _position;
|
||||
_isIsland = false; //Can be set to true during the Check
|
||||
@@ -210,11 +210,11 @@ if (_randomSpot) then {
|
||||
};
|
||||
};
|
||||
|
||||
if ((_isNear and !_isZero) || _isIsland) then {_findSpot = false};
|
||||
if ((_isNear && !_isZero) || _isIsland) then {_findSpot = false};
|
||||
_counter = _counter + 1;
|
||||
};
|
||||
};
|
||||
_isZero = ((_position select 0) == 0) and ((_position select 1) == 0);
|
||||
_isZero = ((_position select 0) == 0) && ((_position select 1) == 0);
|
||||
_position = [_position select 0,_position select 1,0];
|
||||
if (!_isZero) then {
|
||||
//_playerObj setPosATL _position;
|
||||
|
||||
@@ -59,15 +59,15 @@ if (_characterID != "0") then {
|
||||
//diag_log ("Found Character...");
|
||||
|
||||
//Check if update is requested
|
||||
if (_isNewPos or _force) then {
|
||||
if (_isNewPos || _force) then {
|
||||
//diag_log ("position..." + str(_isNewPos) + " / " + str(_force)); sleep 0.05;
|
||||
if (((_charPos select 0) == 0) and ((_charPos select 1) == 0)) then {
|
||||
if (((_charPos select 0) == 0) && ((_charPos select 1) == 0)) then {
|
||||
//Zero Position
|
||||
} else {
|
||||
//diag_log ("getting position..."); sleep 0.05;
|
||||
_playerPos = [round(direction _character),_charPos];
|
||||
_lastPos = _character getVariable["lastPos",_charPos];
|
||||
if (count _lastPos > 2 and count _charPos > 2) then {
|
||||
if (count _lastPos > 2 && count _charPos > 2) then {
|
||||
if (!_isInVehicle) then {
|
||||
_distanceFoot = round(_charPos distance _lastPos);
|
||||
};
|
||||
@@ -80,7 +80,7 @@ if (_characterID != "0") then {
|
||||
};
|
||||
_character setVariable ["posForceUpdate",false,true];
|
||||
};
|
||||
if (_isNewGear or _forceGear) then {
|
||||
if (_isNewGear || _forceGear) then {
|
||||
//diag_log ("gear..."); sleep 0.05;
|
||||
_playerGear = [weapons _character,_magazines];
|
||||
//diag_log ("playerGear: " +str(_playerGear));
|
||||
@@ -92,7 +92,7 @@ if (_characterID != "0") then {
|
||||
_playerBackp = [typeOf _backpack,getWeaponCargo _backpack,getMagazineCargo _backpack];
|
||||
};
|
||||
};
|
||||
if (_isNewMed or _force) then {
|
||||
if (_isNewMed || _force) then {
|
||||
//diag_log ("medical..."); sleep 0.05;
|
||||
if (!(_character getVariable["USEC_isDead",false])) then {
|
||||
//diag_log ("medical check..."); sleep 0.05;
|
||||
@@ -143,10 +143,10 @@ if (_characterID != "0") then {
|
||||
_character setVariable ["model_CHK",typeOf _character];
|
||||
};
|
||||
|
||||
if (_onLadder or _isInVehicle or _isTerminal) then {
|
||||
if (_onLadder || _isInVehicle || _isTerminal) then {
|
||||
_currentAnim = "";
|
||||
//If position to be updated, make sure it is at ground level!
|
||||
if ((count _playerPos > 0) and !_isTerminal) then {
|
||||
if ((count _playerPos > 0) && !_isTerminal) then {
|
||||
_charPos set [2,0];
|
||||
_playerPos set[1,_charPos];
|
||||
};
|
||||
@@ -167,7 +167,7 @@ if (_characterID != "0") then {
|
||||
_temp = round(_character getVariable ["temperature",100]);
|
||||
_currentState = [_currentWpn,_currentAnim,_temp];
|
||||
if(DZE_FriendlySaving) then {
|
||||
// save only last/most recent 5 entrys as we only have 200 chars in db field and weapon + animation names are sometimes really long 60-70 chars.
|
||||
// save only last/most recent 5 entrys as we only have 200 chars in db field && weapon + animation names are sometimes really long 60-70 chars.
|
||||
_friendlies = [(_character getVariable ["friendlies",[]]),5] call array_reduceSizeReverse;
|
||||
_currentState set [(count _currentState),_friendlies];
|
||||
};
|
||||
@@ -177,10 +177,10 @@ if (_characterID != "0") then {
|
||||
if (count _playerPos > 0) then {
|
||||
_array = [];
|
||||
{
|
||||
if (_x > dayz_minpos and _x < dayz_maxpos) then {
|
||||
if (_x > dayz_minpos && _x < dayz_maxpos) then {
|
||||
_array set [count _array,_x];
|
||||
};
|
||||
} forEach (_playerPos select 1);
|
||||
} count (_playerPos select 1);
|
||||
_playerPos set [1,_array];
|
||||
};
|
||||
if (!isNull _character) then {
|
||||
@@ -206,7 +206,7 @@ if (_characterID != "0") then {
|
||||
_pos = _this select 0;
|
||||
{
|
||||
[_x, "gear"] call server_updateObject;
|
||||
} forEach nearestObjects [_pos, dayz_updateObjects, 10];
|
||||
} count nearestObjects [_pos, dayz_updateObjects, 10];
|
||||
//[_charPos] call server_updateNearbyObjects;
|
||||
|
||||
//Reset timer
|
||||
|
||||
@@ -37,7 +37,7 @@ if (_spawnDMG) then {
|
||||
_array set [count _array,[_selection,_dam]];
|
||||
_totaldam = _totaldam + _dam;
|
||||
};
|
||||
} forEach _hitpoints;
|
||||
} count _hitpoints;
|
||||
|
||||
|
||||
// just set low base dmg - may change later
|
||||
@@ -49,7 +49,7 @@ if (_spawnDMG) then {
|
||||
};
|
||||
};
|
||||
|
||||
// TODO: check if uid already exists and if so increment by 1 and check again as soon as we find nothing continue.
|
||||
// TODO: check if uid already exists && if so increment by 1 && check again as soon as we find nothing continue.
|
||||
|
||||
//Send request
|
||||
_key = format["CHILD:308:%1:%2:%3:%4:%5:%6:%7:%8:%9:",dayZ_instance, _class, _damage , _characterID, _worldspace, [], _array, _fuel,_uid];
|
||||
@@ -104,9 +104,9 @@ PVDZE_serverObjectMonitor set [count PVDZE_serverObjectMonitor,_object];
|
||||
{
|
||||
_selection = _x select 0;
|
||||
_dam = _x select 1;
|
||||
if (_selection in dayZ_explosiveParts and _dam > 0.8) then {_dam = 0.8};
|
||||
if (_selection in dayZ_explosiveParts && _dam > 0.8) then {_dam = 0.8};
|
||||
[_object,_selection,_dam] call object_setFixServer;
|
||||
} forEach _array;
|
||||
} count _array;
|
||||
|
||||
_object setFuel _fuel;
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ _location = _worldspace select 1;
|
||||
//Generate UID test using time
|
||||
_uid = _worldspace call dayz_objectUID3;
|
||||
|
||||
// TODO: check if uid already exists and if so increment by 1 and check again as soon as we find nothing continue.
|
||||
// TODO: check if uid already exists && if so increment by 1 && check again as soon as we find nothing continue.
|
||||
|
||||
//Send request
|
||||
_key = format["CHILD:308:%1:%2:%3:%4:%5:%6:%7:%8:%9:",dayZ_instance, _class, 0 , _characterID, _worldspace, [], [], 1,_uid];
|
||||
|
||||
@@ -9,7 +9,7 @@ _activatingPlayer = _this select 5;
|
||||
_characterID = _keySelected;
|
||||
|
||||
_isOK = isClass(configFile >> "CfgVehicles" >> _class);
|
||||
if(!_isOK or isNull _object) exitWith { diag_log ("HIVE-pv3: Vehicle does not exist: "+ str(_class)); };
|
||||
if(!_isOK || isNull _object) exitWith { diag_log ("HIVE-pv3: Vehicle does not exist: "+ str(_class)); };
|
||||
|
||||
diag_log ("PUBLISH: Attempt " + str(_object));
|
||||
_dir = _worldspace select 0;
|
||||
@@ -96,7 +96,7 @@ _key call server_hiveWrite;
|
||||
{
|
||||
_object addWeaponCargoGlobal [_x,(_objWpnQty select _countr)];
|
||||
_countr = _countr + 1;
|
||||
} forEach _objWpnTypes;
|
||||
} count _objWpnTypes;
|
||||
|
||||
//Add Magazines
|
||||
_objWpnTypes = _magazines select 0;
|
||||
@@ -105,7 +105,7 @@ _key call server_hiveWrite;
|
||||
{
|
||||
_object addMagazineCargoGlobal [_x,(_objWpnQty select _countr)];
|
||||
_countr = _countr + 1;
|
||||
} forEach _objWpnTypes;
|
||||
} count _objWpnTypes;
|
||||
|
||||
//Add Backpacks
|
||||
_objWpnTypes = _backpacks select 0;
|
||||
@@ -114,7 +114,7 @@ _key call server_hiveWrite;
|
||||
{
|
||||
_object addBackpackCargoGlobal [_x,(_objWpnQty select _countr)];
|
||||
_countr = _countr + 1;
|
||||
} forEach _objWpnTypes;
|
||||
} count _objWpnTypes;
|
||||
|
||||
_object setVariable ["ObjectID", _oid, true];
|
||||
|
||||
|
||||
@@ -115,11 +115,11 @@ while {1 == 1} do {
|
||||
|
||||
diag_log(format["CRASHSPAWNER: Loot spawn at '%1' with loot table '%2'", _crashName, _lootTable]);
|
||||
|
||||
// ReammoBox is preferred parent class here, as WeaponHolder wouldn't match MedBox0 and other such items.
|
||||
// ReammoBox is preferred parent class here, as WeaponHolder wouldn't match MedBox0 && other such items.
|
||||
_nearby = _position nearObjects ["ReammoBox", sizeOf(_crashModel)];
|
||||
{
|
||||
_x setVariable ["permaLoot",true];
|
||||
} forEach _nearBy;
|
||||
} count _nearBy;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
@@ -26,7 +26,7 @@ epoch_eventIsAny = {
|
||||
};
|
||||
if (!_boolReturn) exitWith {};
|
||||
_index = _index + 1;
|
||||
} forEach _event;
|
||||
} count _event;
|
||||
|
||||
_boolReturn
|
||||
};
|
||||
@@ -54,7 +54,7 @@ while {1 == 1} do {
|
||||
diag_log ("RUNNING EVENT: " + (_x select 5) + " on " + _datestr);
|
||||
_handle = [] execVM "\z\addons\dayz_server\modules\" + (_x select 5) + ".sqf";
|
||||
};
|
||||
} forEach EpochEvents;
|
||||
} count EpochEvents;
|
||||
};
|
||||
};
|
||||
sleep 10;
|
||||
|
||||
@@ -38,7 +38,7 @@ if(_objectID == "0" && _objectUID == "0") then {
|
||||
};
|
||||
|
||||
_allowed = [_object, "Server"] call check_publishobject;
|
||||
if (!_allowed or !_proceed) exitWith {
|
||||
if (!_allowed || !_proceed) exitWith {
|
||||
if(!isNull(_object)) then {
|
||||
deleteVehicle _object;
|
||||
};
|
||||
|
||||
@@ -10,7 +10,7 @@ if(isNull(_object)) exitWith {
|
||||
};
|
||||
|
||||
_type = _this select 1;
|
||||
_parachuteWest = ((typeOf _object == "ParachuteWest") or (typeOf _object == "ParachuteC"));
|
||||
_parachuteWest = ((typeOf _object == "ParachuteWest") || (typeOf _object == "ParachuteC"));
|
||||
_isbuildable = (typeOf _object) in dayz_allowedObjects;
|
||||
_isNotOk = false;
|
||||
_firstTime = false;
|
||||
@@ -25,7 +25,7 @@ if ((typeName _objectID != "string") || (typeName _uid != "string")) then
|
||||
_objectID = "0";
|
||||
_uid = "0";
|
||||
};
|
||||
if (!_parachuteWest and !(locked _object)) then {
|
||||
if (!_parachuteWest && !(locked _object)) then {
|
||||
if (_objectID == "0" && _uid == "0") then
|
||||
{
|
||||
_object_position = getPosATL _object;
|
||||
@@ -33,8 +33,8 @@ if (!_parachuteWest and !(locked _object)) then {
|
||||
};
|
||||
};
|
||||
|
||||
// do not update if buildable and not ok
|
||||
if (_isNotOk and _isbuildable) exitWith { };
|
||||
// do not update if buildable && not ok
|
||||
if (_isNotOk && _isbuildable) exitWith { };
|
||||
|
||||
// delete if still not ok
|
||||
if (_isNotOk) exitWith { deleteVehicle _object; diag_log(format["Deleting object %1 with invalid ID at pos [%2,%3,%4]",typeOf _object,_object_position select 0,_object_position select 1, _object_position select 2]); };
|
||||
@@ -90,7 +90,7 @@ _object_damage = {
|
||||
_selection = getText (configFile >> "CfgVehicles" >> (typeOf _object) >> "HitPoints" >> _x >> "name");
|
||||
if (_hit > 0) then {_array set [count _array,[_selection,_hit]]};
|
||||
_object setHit ["_selection", _hit];
|
||||
} forEach _hitpoints;
|
||||
} count _hitpoints;
|
||||
|
||||
_key = format["CHILD:306:%1:%2:%3:",_objectID,_array,_damage];
|
||||
//diag_log ("HIVE: WRITE: "+ str(_key));
|
||||
@@ -110,7 +110,7 @@ _object_killed = {
|
||||
if (_hit > 0) then {_array set [count _array,[_selection,_hit]]};
|
||||
_hit = 1;
|
||||
_object setHit ["_selection", _hit];
|
||||
} forEach _hitpoints;
|
||||
} count _hitpoints;
|
||||
|
||||
if (_objectID == "0") then {
|
||||
_key = format["CHILD:306:%1:%2:%3:",_uid,_array,_damage];
|
||||
@@ -145,7 +145,7 @@ _object_repair = {
|
||||
_selection = getText (configFile >> "CfgVehicles" >> (typeOf _object) >> "HitPoints" >> _x >> "name");
|
||||
if (_hit > 0) then {_array set [count _array,[_selection,_hit]]};
|
||||
_object setHit ["_selection", _hit];
|
||||
} forEach _hitpoints;
|
||||
} count _hitpoints;
|
||||
|
||||
_key = format["CHILD:306:%1:%2:%3:",_objectID,_array,_damage];
|
||||
//diag_log ("HIVE: WRITE: "+ str(_key));
|
||||
|
||||
@@ -20,7 +20,7 @@ _numWeatherOptions = count _weatherOptions;
|
||||
|
||||
// get inital weather forcast for the next 5 minutes
|
||||
_forcastTime = 300;
|
||||
if (isNil "WeatherForcast" and isNil "WeatherForcastTime") then {
|
||||
if (isNil "WeatherForcast" && isNil "WeatherForcastTime") then {
|
||||
WeatherForcast = floor(random(_numWeatherOptions));
|
||||
WeatherForcastTime = diag_tickTime;
|
||||
} else {
|
||||
@@ -40,7 +40,7 @@ if (isNil "CurrentWeatherOption") then {
|
||||
CurrentWeatherOption = ((CurrentWeatherOption + 1) min _numWeatherOptions);
|
||||
} else {
|
||||
// start transition down if forcast is lower in the array than current weather
|
||||
if (CurrentWeatherOption != WeatherForcast and WeatherForcastTime >= _forcastTime) then {
|
||||
if (CurrentWeatherOption != WeatherForcast && WeatherForcastTime >= _forcastTime) then {
|
||||
CurrentWeatherOption = ((CurrentWeatherOption - 1) max 0) ;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -39,7 +39,7 @@ server_updateNearbyObjects = {
|
||||
_pos = _this select 0;
|
||||
{
|
||||
[_x, "gear"] call server_updateObject;
|
||||
} forEach nearestObjects [_pos, dayz_updateObjects, 10];
|
||||
} count nearestObjects [_pos, dayz_updateObjects, 10];
|
||||
};
|
||||
|
||||
server_handleZedSpawn = {
|
||||
@@ -210,7 +210,7 @@ if(isnil "DynamicVehicleArea") then {
|
||||
DynamicVehicleArea = dayz_MapArea / 2;
|
||||
};
|
||||
|
||||
// Get all buildings and roads only once TODO: set variables to nil after done if nessicary
|
||||
// Get all buildings && roads only once TODO: set variables to nil after done if nessicary
|
||||
MarkerPosition = getMarkerPos "center";
|
||||
RoadList = MarkerPosition nearRoads DynamicVehicleArea;
|
||||
|
||||
@@ -230,7 +230,7 @@ BuildingList = [];
|
||||
};
|
||||
|
||||
|
||||
} forEach (MarkerPosition nearObjects ["building",DynamicVehicleArea]);
|
||||
} count (MarkerPosition nearObjects ["building",DynamicVehicleArea]);
|
||||
|
||||
spawn_vehicles = {
|
||||
private ["_random","_lastIndex","_weights","_index","_vehicle","_velimit","_qty","_isAir","_isShip","_position","_dir","_istoomany","_veh","_objPosition","_marker","_iClass","_itemTypes","_cntWeights","_itemType","_num","_allCfgLoots"];
|
||||
@@ -251,7 +251,7 @@ spawn_vehicles = {
|
||||
if (_qty <= _velimit) exitWith {};
|
||||
|
||||
// vehicle limit reached, remove vehicle from list
|
||||
// since elements cannot be removed from an array, overwrite it with the last element and cut the last element of (as long as order is not important)
|
||||
// since elements cannot be removed from an array, overwrite it with the last element && cut the last element of (as long as order is not important)
|
||||
_lastIndex = (count AllowedVehiclesList) - 1;
|
||||
if (_lastIndex != _index) then {
|
||||
AllowedVehiclesList set [_index, AllowedVehiclesList select _lastIndex];
|
||||
@@ -285,7 +285,7 @@ spawn_vehicles = {
|
||||
|
||||
|
||||
} else {
|
||||
// Spawn around buildings and 50% near roads
|
||||
// Spawn around buildings && 50% near roads
|
||||
if((random 1) > 0.5) then {
|
||||
|
||||
waitUntil{!isNil "BIS_fnc_selectRandom"};
|
||||
@@ -312,7 +312,7 @@ spawn_vehicles = {
|
||||
|
||||
};
|
||||
};
|
||||
// only proceed if two params otherwise BIS_fnc_findSafePos failed and may spawn in air
|
||||
// only proceed if two params otherwise BIS_fnc_findSafePos failed && may spawn in air
|
||||
if ((count _position) == 2) then {
|
||||
|
||||
_dir = round(random 180);
|
||||
@@ -350,12 +350,12 @@ spawn_vehicles = {
|
||||
if (DZE_MissionLootTable) then{
|
||||
{
|
||||
_itemTypes set[count _itemTypes, _x select 0]
|
||||
} foreach getArray(missionConfigFile >> "cfgLoot" >> _iClass);
|
||||
} count getArray(missionConfigFile >> "cfgLoot" >> _iClass);
|
||||
}
|
||||
else {
|
||||
{
|
||||
_itemTypes set[count _itemTypes, _x select 0]
|
||||
} foreach getArray(configFile >> "cfgLoot" >> _iClass);
|
||||
} count getArray(configFile >> "cfgLoot" >> _iClass);
|
||||
};
|
||||
|
||||
_index = dayz_CLBase find _iClass;
|
||||
@@ -595,7 +595,7 @@ dayz_objectUID2 = {
|
||||
_x = _x * 10;
|
||||
if ( _x < 0 ) then { _x = _x * -10 };
|
||||
_key = _key + str(round(_x));
|
||||
} forEach _position;
|
||||
} count _position;
|
||||
_key = _key + str(round(_dir));
|
||||
_key
|
||||
};
|
||||
@@ -609,7 +609,7 @@ dayz_objectUID3 = {
|
||||
_x = _x * 10;
|
||||
if ( _x < 0 ) then { _x = _x * -10 };
|
||||
_key = _key + str(round(_x));
|
||||
} forEach _position;
|
||||
} count _position;
|
||||
_key = _key + str(round(_dir + time));
|
||||
_key
|
||||
};
|
||||
@@ -673,7 +673,7 @@ dayz_perform_purge_player = {
|
||||
{
|
||||
_holder addWeaponCargoGlobal [_x,(_objWpnQty select _countr)];
|
||||
_countr = _countr + 1;
|
||||
} forEach _objWpnTypes;
|
||||
} count _objWpnTypes;
|
||||
|
||||
// add backpack magazine items
|
||||
_objWpnTypes = _backpackMag select 0;
|
||||
@@ -682,19 +682,19 @@ dayz_perform_purge_player = {
|
||||
{
|
||||
_holder addMagazineCargoGlobal [_x,(_objWpnQty select _countr)];
|
||||
_countr = _countr + 1;
|
||||
} forEach _objWpnTypes;
|
||||
} count _objWpnTypes;
|
||||
};
|
||||
};
|
||||
|
||||
// add weapons
|
||||
{
|
||||
_holder addWeaponCargoGlobal [_x, 1];
|
||||
} forEach _weapons;
|
||||
} count _weapons;
|
||||
|
||||
// add mags
|
||||
{
|
||||
_holder addMagazineCargoGlobal [_x, 1];
|
||||
} forEach _magazines;
|
||||
} count _magazines;
|
||||
|
||||
_this removeAllMPEventHandlers "mpkilled";
|
||||
_this removeAllMPEventHandlers "mphit";
|
||||
@@ -769,10 +769,10 @@ server_spawncleanDead = {
|
||||
};
|
||||
};
|
||||
sleep 0.025;
|
||||
} forEach _allDead;
|
||||
if (_delQtyZ > 0 or _delQtyP > 0) then {
|
||||
} count _allDead;
|
||||
if (_delQtyZ > 0 || _delQtyP > 0) then {
|
||||
_qty = count _allDead;
|
||||
diag_log (format["CLEANUP: Deleted %1 players and %2 zombies out of %3 dead",_delQtyP,_delQtyZ,_qty]);
|
||||
diag_log (format["CLEANUP: Deleted %1 players && %2 zombies out of %3 dead",_delQtyP,_delQtyZ,_qty]);
|
||||
};
|
||||
};
|
||||
server_cleanupGroups = {
|
||||
@@ -784,7 +784,7 @@ server_cleanupGroups = {
|
||||
deleteGroup _x;
|
||||
};
|
||||
sleep 0.001;
|
||||
} forEach allGroups;
|
||||
} count allGroups;
|
||||
DZE_DYN_GroupCleanup = nil;
|
||||
};
|
||||
|
||||
@@ -793,7 +793,7 @@ server_checkHackers = {
|
||||
if(!isNil "DZE_DYN_HackerCheck") exitWith { DZE_DYN_AntiStuck2nd = DZE_DYN_AntiStuck2nd + 1;};
|
||||
DZE_DYN_HackerCheck = true;
|
||||
{
|
||||
if (!((isNil "_x") OR {(isNull _x)})) then {
|
||||
if (!((isNil "_x") || {(isNull _x)})) then {
|
||||
if(vehicle _x != _x && !(vehicle _x in PVDZE_serverObjectMonitor) && (isPlayer _x) && !((typeOf vehicle _x) in DZE_safeVehicle)) then {
|
||||
diag_log ("CLEANUP: KILLING A HACKER " + (name _x) + " " + str(_x) + " IN " + (typeOf vehicle _x));
|
||||
(vehicle _x) setDamage 1;
|
||||
@@ -802,7 +802,7 @@ server_checkHackers = {
|
||||
};
|
||||
};
|
||||
sleep 0.001;
|
||||
} forEach allUnits;
|
||||
} count allUnits;
|
||||
DZE_DYN_HackerCheck = nil;
|
||||
};
|
||||
|
||||
@@ -817,7 +817,7 @@ server_spawnCleanFire = {
|
||||
_delQtyFP = _delQtyFP + 1;
|
||||
};
|
||||
sleep 0.001;
|
||||
} forEach _missionFires;
|
||||
} count _missionFires;
|
||||
if (_delQtyFP > 0) then {
|
||||
_qty = count _missionFires;
|
||||
diag_log (format["CLEANUP: Deleted %1 fireplaces out of %2",_delQtyNull,_qty]);
|
||||
@@ -842,7 +842,7 @@ server_spawnCleanLoot = {
|
||||
} else {
|
||||
_age = (_dateNow - _created) * 525948;
|
||||
if (_age > 20) then {
|
||||
_nearby = {(isPlayer _x) and (alive _x)} count (_x nearEntities [["CAManBase","AllVehicles"], 130]);
|
||||
_nearby = {(isPlayer _x) && (alive _x)} count (_x nearEntities [["CAManBase","AllVehicles"], 130]);
|
||||
if (_nearby==0) then {
|
||||
deleteVehicle _x;
|
||||
sleep 0.025;
|
||||
@@ -852,7 +852,7 @@ server_spawnCleanLoot = {
|
||||
};
|
||||
};
|
||||
sleep 0.001;
|
||||
} forEach _missionObjs;
|
||||
} count _missionObjs;
|
||||
if (_delQty > 0) then {
|
||||
_qty = count _missionObjs;
|
||||
diag_log (format["CLEANUP: Deleted %1 Loot Piles out of %2",_delQty,_qty]);
|
||||
@@ -873,7 +873,7 @@ server_spawnCleanAnimals = {
|
||||
if (!alive _x) then {
|
||||
_pos = getPosATL _x;
|
||||
if (count _pos > 0) then {
|
||||
_nearby = {(isPlayer _x) and (alive _x)} count (_pos nearEntities [["CAManBase","AllVehicles"], 130]);
|
||||
_nearby = {(isPlayer _x) && (alive _x)} count (_pos nearEntities [["CAManBase","AllVehicles"], 130]);
|
||||
if (_nearby==0) then {
|
||||
_x call dayz_perform_purge;
|
||||
sleep 0.05;
|
||||
@@ -883,7 +883,7 @@ server_spawnCleanAnimals = {
|
||||
};
|
||||
};
|
||||
sleep 0.001;
|
||||
} forEach _missonAnimals;
|
||||
} count _missonAnimals;
|
||||
if (_delQtyAnimal > 0) then {
|
||||
_qty = count _missonAnimals;
|
||||
diag_log (format["CLEANUP: Deleted %1 Animals out of %2",_delQtyAnimal,_qty]);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Bandit Vendor Seven
|
||||
Author: AVendettaForYou
|
||||
Date: 12/11/13
|
||||
If modified and released give credits where due thank you
|
||||
If modified && released give credits where due thank you
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
if (isServer) then {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Bilgrad Trader City
|
||||
Author: AVendettaForYou
|
||||
Date: 12/11/13
|
||||
If modified and released give credits where due thank you
|
||||
If modified && released give credits where due thank you
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
if (isServer) then {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Branibor Trader City
|
||||
Author: AVendettaForYou
|
||||
Date: 12/11/13
|
||||
If modified and released give credits where due thank you
|
||||
If modified && released give credits where due thank you
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
if (isServer) then {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Hero Vendor Sevastopol
|
||||
Author: AVendettaForYou
|
||||
Date: 12/11/13
|
||||
If modified and released give credits where due thank you
|
||||
If modified && released give credits where due thank you
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
if (isServer) then {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Lyepenstok Trader City
|
||||
Author: AVendettaForYou
|
||||
Date: 12/11/13
|
||||
If modified and released give credits where due thank you
|
||||
If modified && released give credits where due thank you
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
if (isServer) then {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Misc. Vendors
|
||||
Author: AVendettaForYou
|
||||
Date: 12/11/13
|
||||
If modified and released give credits where due thank you
|
||||
If modified && released give credits where due thank you
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
if (isServer) then {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Sabina Trader City
|
||||
Author: AVendettaForYou
|
||||
Date: 12/11/13
|
||||
If modified and released give credits where due thank you
|
||||
If modified && released give credits where due thank you
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
if (isServer) then {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Wholesale Vendors
|
||||
Author: AVendettaForYou
|
||||
Date: 12/11/13
|
||||
If modified and released give credits where due thank you
|
||||
If modified && released give credits where due thank you
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
if (isServer) then {
|
||||
|
||||
@@ -90,9 +90,9 @@ if (_spawnRoll <= _spawnChance) then {
|
||||
_itemType = _itemTypes select _index2;
|
||||
[_itemType select 0, _itemType select 1, _position, 5] call spawn_loot;
|
||||
};
|
||||
// ReammoBox is preferred parent class here, as WeaponHolder wouldn't match MedBox0 and other such items.
|
||||
// ReammoBox is preferred parent class here, as WeaponHolder wouldn't match MedBox0 && other such items.
|
||||
_nearby = _position nearObjects ["ReammoBox", sizeOf(_crashModel)];
|
||||
{
|
||||
_x setVariable ["permaLoot",true];
|
||||
} forEach _nearBy;
|
||||
} count _nearBy;
|
||||
};
|
||||
@@ -57,9 +57,9 @@ if (_spawnRoll <= _spawnChance) then {
|
||||
[_itemType select 0, _itemType select 1, _position, 5] call spawn_loot;
|
||||
};
|
||||
|
||||
// ReammoBox is preferred parent class here, as WeaponHolder wouldn't match MedBox0 and other such items.
|
||||
// ReammoBox is preferred parent class here, as WeaponHolder wouldn't match MedBox0 && other such items.
|
||||
_nearby = _position nearObjects ["ReammoBox", sizeOf(_crashModel)];
|
||||
{
|
||||
_x setVariable ["permaLoot",true];
|
||||
} forEach _nearBy;
|
||||
} count _nearBy;
|
||||
};
|
||||
@@ -18,7 +18,7 @@ item13[] = {"___min__loop",4,218,300.000000,-125.000000,400.000000,-75.000000,3.
|
||||
item14[] = {"___min_loop",4,218,450.000000,-125.000000,550.000000,-75.000000,4.000000,"5 min" \n "loop"};
|
||||
item15[] = {"__0_min__loop",4,218,575.000000,-100.000000,675.000000,-50.000000,5.000000,"10 min" \n " loop"};
|
||||
item16[] = {"__5_min__loop",4,218,700.000000,-75.000000,800.000000,-25.000000,6.000000,"15 min" \n " loop"};
|
||||
item17[] = {"cleanup_animals",2,250,700.000000,25.000000,800.000000,75.000000,0.000000,"cleanup" \n "animals and fire"};
|
||||
item17[] = {"cleanup_animals",2,250,700.000000,25.000000,800.000000,75.000000,0.000000,"cleanup" \n "animals && fire"};
|
||||
item18[] = {"cleanup_dead",2,250,575.000000,0.000000,675.000000,50.000000,0.000000,"cleanup" \n "dead"};
|
||||
item19[] = {"sync_time",2,250,450.000000,-25.000000,550.000000,25.000000,0.000000,"sync time"};
|
||||
item20[] = {"cleanup_loot",2,250,300.000000,-25.000000,400.000000,25.000000,0.000000,"cleanup" \n "loot"};
|
||||
@@ -342,7 +342,7 @@ class FSM
|
||||
init = /*%FSM<STATEINIT""">*/"{" \n
|
||||
" needUpdate_objects = needUpdate_objects - [_x];" \n
|
||||
" [_x,""damage"",true] call server_updateObject;" \n
|
||||
"} forEach needUpdate_objects;"/*%FSM</STATEINIT""">*/;
|
||||
"} count needUpdate_objects;"/*%FSM</STATEINIT""">*/;
|
||||
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
|
||||
class Links
|
||||
{
|
||||
|
||||
@@ -27,7 +27,7 @@ if(isnil "MaxMineVeins") then {
|
||||
};
|
||||
// Custon Configs End
|
||||
|
||||
if (isServer and isNil "sm_done") then {
|
||||
if (isServer && isNil "sm_done") then {
|
||||
|
||||
serverVehicleCounter = [];
|
||||
_hiveResponse = [];
|
||||
@@ -80,7 +80,7 @@ if (isServer and isNil "sm_done") then {
|
||||
_vQty = _vQty + 1;
|
||||
};
|
||||
};
|
||||
diag_log ("HIVE: got " + str(_bQty) + " Epoch Objects and " + str(_vQty) + " Vehicles");
|
||||
diag_log ("HIVE: got " + str(_bQty) + " Epoch Objects && " + str(_vQty) + " Vehicles");
|
||||
};
|
||||
|
||||
// # NOW SPAWN OBJECTS #
|
||||
@@ -171,7 +171,7 @@ if (isServer and isNil "sm_done") then {
|
||||
};
|
||||
// Test disabling simulation server side on buildables only.
|
||||
_object enableSimulation false;
|
||||
// used for inplace upgrades and lock/unlock of safe
|
||||
// used for inplace upgrades && lock/unlock of safe
|
||||
_object setVariable ["OEMPos", _pos, true];
|
||||
|
||||
};
|
||||
@@ -197,7 +197,7 @@ if (isServer and isNil "sm_done") then {
|
||||
_object addWeaponCargoGlobal [_x,(_objWpnQty select _countr)];
|
||||
};
|
||||
_countr = _countr + 1;
|
||||
} forEach _objWpnTypes;
|
||||
} count _objWpnTypes;
|
||||
|
||||
//Add Magazines
|
||||
_objWpnTypes = (_intentory select 1) select 0;
|
||||
@@ -211,7 +211,7 @@ if (isServer and isNil "sm_done") then {
|
||||
_object addMagazineCargoGlobal [_x,(_objWpnQty select _countr)];
|
||||
};
|
||||
_countr = _countr + 1;
|
||||
} forEach _objWpnTypes;
|
||||
} count _objWpnTypes;
|
||||
|
||||
//Add Backpacks
|
||||
_objWpnTypes = (_intentory select 2) select 0;
|
||||
@@ -223,7 +223,7 @@ if (isServer and isNil "sm_done") then {
|
||||
_object addBackpackCargoGlobal [_x,(_objWpnQty select _countr)];
|
||||
};
|
||||
_countr = _countr + 1;
|
||||
} forEach _objWpnTypes;
|
||||
} count _objWpnTypes;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -231,9 +231,9 @@ if (isServer and isNil "sm_done") then {
|
||||
{
|
||||
_selection = _x select 0;
|
||||
_dam = _x select 1;
|
||||
if (_selection in dayZ_explosiveParts and _dam > 0.8) then {_dam = 0.8};
|
||||
if (_selection in dayZ_explosiveParts && _dam > 0.8) then {_dam = 0.8};
|
||||
[_object,_selection,_dam] call object_setFixServer;
|
||||
} forEach _hitpoints;
|
||||
} count _hitpoints;
|
||||
|
||||
_object setFuel _fuel;
|
||||
|
||||
@@ -242,7 +242,7 @@ if (isServer and isNil "sm_done") then {
|
||||
//_object setvelocity [0,0,1];
|
||||
_object call fnc_veh_ResetEH;
|
||||
|
||||
if(_ownerID != "0" and !(_object isKindOf "Bicycle")) then {
|
||||
if(_ownerID != "0" && !(_object isKindOf "Bicycle")) then {
|
||||
_object setvehiclelock "locked";
|
||||
};
|
||||
|
||||
@@ -256,7 +256,7 @@ if (isServer and isNil "sm_done") then {
|
||||
//Monitor the object
|
||||
PVDZE_serverObjectMonitor set [count PVDZE_serverObjectMonitor,_object];
|
||||
};
|
||||
} forEach (_BuildingQueue + _objectQueue);
|
||||
} count (_BuildingQueue + _objectQueue);
|
||||
// # END SPAWN OBJECTS #
|
||||
|
||||
// preload server traders menu data into cache
|
||||
@@ -293,9 +293,9 @@ if (isServer and isNil "sm_done") then {
|
||||
//diag_log ("HIVE: Streamed " + str(_val) + " objects");
|
||||
};
|
||||
|
||||
} forEach (_traderData select 0);
|
||||
} count (_traderData select 0);
|
||||
};
|
||||
} forEach serverTraders;
|
||||
} count serverTraders;
|
||||
};
|
||||
|
||||
if (_hiveLoaded) then {
|
||||
|
||||
Reference in New Issue
Block a user