mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2026-02-18 14:12:57 +03:00
Replace sleep with uiSleep
see the below links for more info. uiSleep is based off of a more accurate method of tracking time, whereas sleep can fluctuate depending on application performance since it is based on framerate. https://community.bistudio.com/wiki/uiSleep https://community.bistudio.com/wiki/sleep_vs_uiSleep https://community.bistudio.com/wiki/sleep
This commit is contained in:
@@ -60,11 +60,11 @@ if (_characterID != "0") then {
|
||||
|
||||
//Check if update is requested
|
||||
if (_isNewPos || _force) then {
|
||||
//diag_log ("position..." + str(_isNewPos) + " / " + str(_force)); sleep 0.05;
|
||||
//diag_log ("position..." + str(_isNewPos) + " / " + str(_force)); uiSleep 0.05;
|
||||
if (((_charPos select 0) == 0) && ((_charPos select 1) == 0)) then {
|
||||
//Zero Position
|
||||
} else {
|
||||
//diag_log ("getting position..."); sleep 0.05;
|
||||
//diag_log ("getting position..."); uiSleep 0.05;
|
||||
_playerPos = [round(direction _character),_charPos];
|
||||
_lastPos = _character getVariable["lastPos",_charPos];
|
||||
if (count _lastPos > 2 && count _charPos > 2) then {
|
||||
@@ -76,12 +76,12 @@ if (_characterID != "0") then {
|
||||
if (count _charPos < 3) then {
|
||||
_playerPos = [];
|
||||
};
|
||||
//diag_log ("position = " + str(_playerPos)); sleep 0.05;
|
||||
//diag_log ("position = " + str(_playerPos)); uiSleep 0.05;
|
||||
};
|
||||
_character setVariable ["posForceUpdate",false,true];
|
||||
};
|
||||
if (_isNewGear || _forceGear) then {
|
||||
//diag_log ("gear..."); sleep 0.05;
|
||||
//diag_log ("gear..."); uiSleep 0.05;
|
||||
_playerGear = [weapons _character,_magazines];
|
||||
//diag_log ("playerGear: " +str(_playerGear));
|
||||
_backpack = unitBackpack _character;
|
||||
@@ -93,11 +93,11 @@ if (_characterID != "0") then {
|
||||
};
|
||||
};
|
||||
if (_isNewMed || _force) then {
|
||||
//diag_log ("medical..."); sleep 0.05;
|
||||
//diag_log ("medical..."); uiSleep 0.05;
|
||||
if (!(_character getVariable["USEC_isDead",false])) then {
|
||||
//diag_log ("medical check..."); sleep 0.05;
|
||||
//diag_log ("medical check..."); uiSleep 0.05;
|
||||
_medical = _character call player_sumMedical;
|
||||
//diag_log ("medical result..." + str(_medical)); sleep 0.05;
|
||||
//diag_log ("medical result..." + str(_medical)); uiSleep 0.05;
|
||||
};
|
||||
_character setVariable ["medForceUpdate",false,true];
|
||||
};
|
||||
|
||||
@@ -75,7 +75,7 @@ PVDZE_serverObjectMonitor set [count PVDZE_serverObjectMonitor,_object];
|
||||
// TODO: Needs major overhaul
|
||||
while {_retry < 10} do {
|
||||
|
||||
sleep 1;
|
||||
uiSleep 1;
|
||||
// GET DB ID
|
||||
_key = format["CHILD:388:%1:",_uid];
|
||||
diag_log ("HIVE: WRITE: "+ str(_key));
|
||||
|
||||
@@ -53,7 +53,7 @@ _key call server_hiveWrite;
|
||||
// TODO: Needs major overhaul for 1.1
|
||||
while {_retry < 10} do {
|
||||
|
||||
sleep 1;
|
||||
uiSleep 1;
|
||||
// GET DB ID
|
||||
_key = format["CHILD:388:%1:",_uid];
|
||||
diag_log ("HIVE: WRITE: "+ str(_key));
|
||||
@@ -103,7 +103,7 @@ _key call server_hiveWrite;
|
||||
|
||||
if(DZE_TRADER_SPAWNMODE) then {
|
||||
_object attachTo [_object_para, [0,0,-1.6]];
|
||||
sleep 1.0;
|
||||
uiSleep 1;
|
||||
WaitUntil{(([_object] call FNC_GetPos) select 2) < 0.1};
|
||||
detach _object;
|
||||
deleteVehicle _object_para;
|
||||
|
||||
@@ -44,7 +44,7 @@ _key call server_hiveWrite;
|
||||
// TODO: Needs major overhaul for 1.1
|
||||
while {_retry < 10} do {
|
||||
|
||||
sleep 1;
|
||||
uiSleep 1;
|
||||
// GET DB ID
|
||||
_key = format["CHILD:388:%1:",_uid];
|
||||
diag_log ("HIVE: WRITE: "+ str(_key));
|
||||
|
||||
@@ -40,9 +40,7 @@ while {1 == 1} do {
|
||||
diag_log(format["CRASHSPAWNER: %1%2 chance to spawn '%3' with loot table '%4' in %5 seconds", round(_spawnChance * 100), '%', _crashName, _lootTable, _timeToSpawn]);
|
||||
|
||||
// Apprehensive about using one giant long sleep here given server time variances over the life of the server daemon
|
||||
while {time < _timeToSpawn} do {
|
||||
sleep 5;
|
||||
};
|
||||
waituntil {time > _timeToSpawn};
|
||||
|
||||
_spawnRoll = random 1;
|
||||
|
||||
|
||||
@@ -57,5 +57,5 @@ while {1 == 1} do {
|
||||
} count EpochEvents;
|
||||
};
|
||||
};
|
||||
sleep 10;
|
||||
uiSleep 10;
|
||||
};
|
||||
@@ -763,20 +763,20 @@ server_spawncleanDead = {
|
||||
if (_x isKindOf "zZombie_Base") then
|
||||
{
|
||||
_x call dayz_perform_purge;
|
||||
sleep 0.05;
|
||||
uiSleep 0.05;
|
||||
_delQtyZ = _delQtyZ + 1;
|
||||
} else {
|
||||
if (_x isKindOf "CAManBase") then {
|
||||
_deathTime = _x getVariable ["processedDeath", diag_tickTime];
|
||||
if (diag_tickTime - _deathTime > 1800) then {
|
||||
_x call dayz_perform_purge_player;
|
||||
sleep 0.025;
|
||||
uiSleep 0.025;
|
||||
_delQtyP = _delQtyP + 1;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
sleep 0.025;
|
||||
uiSleep 0.025;
|
||||
} count _allDead;
|
||||
if (_delQtyZ > 0 || _delQtyP > 0) then {
|
||||
_qty = count _allDead;
|
||||
@@ -791,7 +791,7 @@ server_cleanupGroups = {
|
||||
if ((count (units _x) == 0) && (_x != grpNull)) then {
|
||||
deleteGroup _x;
|
||||
};
|
||||
sleep 0.001;
|
||||
uiSleep 0.001;
|
||||
} count allGroups;
|
||||
DZE_DYN_GroupCleanup = nil;
|
||||
};
|
||||
@@ -806,10 +806,10 @@ server_checkHackers = {
|
||||
diag_log ("CLEANUP: KILLING A HACKER " + (name _x) + " " + str(_x) + " IN " + (typeOf vehicle _x));
|
||||
(vehicle _x) setDamage 1;
|
||||
_x setDamage 1;
|
||||
sleep 0.25;
|
||||
uiSleep 0.25;
|
||||
};
|
||||
};
|
||||
sleep 0.001;
|
||||
uiSleep 0.001;
|
||||
} count allUnits;
|
||||
DZE_DYN_HackerCheck = nil;
|
||||
};
|
||||
@@ -821,10 +821,10 @@ server_spawnCleanFire = {
|
||||
{
|
||||
if (local _x) then {
|
||||
deleteVehicle _x;
|
||||
sleep 0.025;
|
||||
uiSleep 0.025;
|
||||
_delQtyFP = _delQtyFP + 1;
|
||||
};
|
||||
sleep 0.001;
|
||||
uiSleep 0.001;
|
||||
} count _missionFires;
|
||||
if (_delQtyFP > 0) then {
|
||||
_qty = count _missionFires;
|
||||
@@ -855,14 +855,14 @@ server_spawnCleanLoot = {
|
||||
_nearby = { (isPlayer _x) && (alive _x) } count(_x nearEntities[["CAManBase", "AllVehicles"], 130]);
|
||||
if (_nearby == 0) then{
|
||||
deleteVehicle _x;
|
||||
sleep 0.025;
|
||||
uiSleep 0.025;
|
||||
_delQty = _delQty + 1;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
sleep 0.001;
|
||||
uiSleep 0.001;
|
||||
} forEach _missionObjs;
|
||||
if (_delQty > 0) then {
|
||||
_qty = count _missionObjs;
|
||||
@@ -878,7 +878,7 @@ server_spawnCleanAnimals = {
|
||||
{
|
||||
if (local _x) then {
|
||||
_x call dayz_perform_purge;
|
||||
sleep 0.05;
|
||||
uiSleep 0.05;
|
||||
_delQtyAnimal = _delQtyAnimal + 1;
|
||||
} else {
|
||||
if (!alive _x) then {
|
||||
@@ -887,13 +887,13 @@ server_spawnCleanAnimals = {
|
||||
_nearby = {(isPlayer _x) && (alive _x)} count (_pos nearEntities [["CAManBase","AllVehicles"], 130]);
|
||||
if (_nearby==0) then {
|
||||
_x call dayz_perform_purge;
|
||||
sleep 0.05;
|
||||
uiSleep 0.05;
|
||||
_delQtyAnimal = _delQtyAnimal + 1;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
sleep 0.001;
|
||||
uiSleep 0.001;
|
||||
} forEach _missonAnimals;
|
||||
if (_delQtyAnimal > 0) then {
|
||||
_qty = count _missonAnimals;
|
||||
|
||||
@@ -347,7 +347,7 @@ if (isServer && isNil "sm_done") then {
|
||||
// server cleanup
|
||||
[] spawn {
|
||||
private ["_id"];
|
||||
sleep 200; //Sleep Lootcleanup, don't need directly cleanup on startup + fix some performance issues on serverstart
|
||||
uiSleep 200; //Sleep Lootcleanup, don't need directly cleanup on startup + fix some performance issues on serverstart
|
||||
waitUntil {!isNil "server_spawnCleanAnimals"};
|
||||
_id = [] execFSM "\z\addons\dayz_server\system\server_cleanup.fsm";
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user