Slower cleanup method

This commit is contained in:
[VB]AWOL
2013-11-14 15:20:54 -06:00
parent b258f94195
commit 57cf759b3f
2 changed files with 307 additions and 213 deletions

View File

@@ -201,6 +201,7 @@ if(isnil "DynamicVehicleArea") then {
MarkerPosition = getMarkerPos "center"; MarkerPosition = getMarkerPos "center";
RoadList = MarkerPosition nearRoads DynamicVehicleArea; RoadList = MarkerPosition nearRoads DynamicVehicleArea;
// Very taxing !!! but only on first startup
BuildingList = []; BuildingList = [];
{ {
if (isClass (configFile >> "CfgBuildingLoot" >> (typeOf _x))) then if (isClass (configFile >> "CfgBuildingLoot" >> (typeOf _x))) then
@@ -485,6 +486,24 @@ if(isnil "DynamicVehicleFuelHigh") then {
DynamicVehicleFuelHigh = 100; DynamicVehicleFuelHigh = 100;
}; };
if(isnil "DZE_DiagFpsSlow") then {
DZE_DiagFpsSlow = false;
};
if(isnil "DZE_DiagFpsFast") then {
DZE_DiagFpsFast = false;
};
if(isnil "DZE_DiagVerbose") then {
DZE_DiagVerbose = false;
};
dze_diag_fps = {
if(DZE_DiagVerbose) then {
diag_log format["DEBUG FPS : %1 OBJECTS: %2 : PLAYERS: %3", diag_fps,(count (allMissionObjects "")),(playersNumber west)];
} else {
diag_log format["DEBUG FPS : %1", diag_fps];
};
};
// Damage generator function // Damage generator function
generate_new_damage = { generate_new_damage = {
private ["_damage"]; private ["_damage"];
@@ -592,52 +611,130 @@ dayz_perform_purge = {
_this = nil; _this = nil;
}; };
server_cleanDead = { server_timeSync = {
//Send request
_key = "CHILD:307:";
_result = _key call server_hiveReadWrite;
_outcome = _result select 0;
if(_outcome == "PASS") then {
_date = _result select 1;
if(dayz_fullMoonNights) then {
//date setup
_year = _date select 0;
_month = _date select 1;
_day = _date select 2;
_hour = _date select 3;
_minute = _date select 4;
//Force full moon nights
_date = [2013,8,3,_hour,_minute];
};
setDate _date;
PVDZE_plr_SetDate = _date;
publicVariable "PVDZE_plr_SetDate";
diag_log ("TIME SYNC: Local Time set to " + str(_date));
};
};
// must spawn these
server_spawncleanDead = {
private ["_deathTime"]; private ["_deathTime"];
{ {
if (local _x) then { if (local _x) then {
if (_x isKindOf "zZombie_Base") then if (_x isKindOf "zZombie_Base") then
{ {
_x call dayz_perform_purge; _x call dayz_perform_purge;
sleep 0.1;
}; };
if (_x isKindOf "CAManBase") then { if (_x isKindOf "CAManBase") then {
_deathTime = _x getVariable ["processedDeath", diag_tickTime]; _deathTime = _x getVariable ["processedDeath", diag_tickTime];
if (diag_tickTime - _deathTime > 3600) then { if (diag_tickTime - _deathTime > 3600) then {
_x call dayz_perform_purge; _x call dayz_perform_purge;
sleep 0.1;
}; };
}; };
}; };
sleep 0.001;
} forEach allDead; } forEach allDead;
}; };
server_cleanLoot = server_spawnCleanNull = {
{ _delQtyNull = 0;
private ["_deletedLoot","_startTime","_looted","_objectPos","_noPlayerNear","_nearObj","_endTime"];
_deletedLoot = 0;
_startTime = diag_tickTime;
{ {
_looted = (_x getVariable ["looted",-0.1]); if (isNull _x) then {
if (_looted != -0.1) then _x call dayz_perform_purge;
{ sleep 0.1;
_objectPos = getPosATL _x; _delQtyNull = _delQtyNull + 1;
_noPlayerNear = {isPlayer _x} count (_objectPos nearEntities ["CAManBase",35]) == 0; };
sleep 0.001;
} forEach (allMissionObjects "");
if (_noPlayerNear) then if (_delQtyNull > 0) then {
{ diag_log (format["CLEANUP: Deleted %1 null objects",_delQtyNull]);
_nearObj = nearestObjects [_objectPos,["ReammoBox"],((sizeOf (typeOf _x)) + 5)]; };
{ };
server_spawnCleanFire = {
_delQtyFP = 0;
{
if (local _x) then {
deleteVehicle _x;
sleep 0.1;
_delQtyFP = _delQtyFP + 1;
};
sleep 0.001;
} forEach (allMissionObjects "Land_Fire_DZ");
if (_delQtyFP > 0) then {
diag_log (format["CLEANUP: Deleted %1 fireplaces",_delQtyNull]);
};
};
server_spawnCleanLoot = {
_delQty = 0;
_timeNow = diag_tickTime;
_delQty = 0;
{
if (local _x) then {
_keep = _x getVariable ["permaLoot",false];
if (!_keep) then {
_created = _x getVariable ["created",-0.1];
if (_created == -0.1) then {
_x setVariable ["created",_timeNow,false];
_created = _timeNow;
};
_nearby = {(isPlayer _x) and (alive _x)} count (_x nearEntities [["CAManBase","AllVehicles"], 130]);
if ((_nearby==0) && (_timeNow - _created > 1200)) then {
deleteVehicle _x; deleteVehicle _x;
_deletedLoot = _deletedLoot + 1; sleep 0.1;
} forEach _nearObj; _delQty = _delQty + 1;
_x setVariable ["looted",-0.1,true]; };
}; };
}; };
} forEach BuildingList; sleep 0.001;
} forEach (allMissionObjects "ReammoBox");
_endTime = diag_tickTime;
diag_log (format["CLEANUP: DELETED %1 ITEMS, RUNTIME: %2",_deletedLoot,(_endTime - _startTime)]);
}; };
server_spawnCleanAnimals = {
_delQtyAnimal = 0;
{
if (local _x) then {
_x call dayz_perform_purge;
sleep 0.1;
_delQtyAnimal = _delQtyAnimal + 1;
};
sleep 0.001;
} forEach (allMissionObjects "CAAnimalBase");
if (_delQtyAnimal > 0) then {
diag_log (format["CLEANUP: Deleted %1 Animals",_delQtyAnimal]);
};
};
server_spawnUpdateObjects = {
//diag_log format["DEBUG: needUpdate_objects=%1",needUpdate_objects];
{
needUpdate_objects = needUpdate_objects - [_x];
[_x,"damage",true] call server_updateObject;
} forEach needUpdate_objects;
};

View File

@@ -1,27 +1,31 @@
/*%FSM<COMPILE "F:\Program Files (x86)\Bohemia Interactive\Tools\FSM Editor Personal Edition\scriptedFSM.cfg, DayZ Server Cleanup">*/ /*%FSM<COMPILE "F:\Program Files (x86)\Bohemia Interactive\Tools\FSM Editor Personal Edition\scriptedFSM.cfg, DayZ Server Cleanup">*/
/*%FSM<HEAD>*/ /*%FSM<HEAD>*/
/* /*
item0[] = {"init",0,250,-75.000000,-400.000000,25.000000,-350.000000,0.000000,"init"}; item0[] = {"init",0,250,-75.000000,-500.000000,25.000000,-450.000000,0.000000,"init"};
item1[] = {"true",8,218,-75.000000,-175.000000,25.000000,-125.000000,0.000000,"true"}; item1[] = {"true",8,218,-75.000000,-275.000000,25.000000,-225.000000,0.000000,"true"};
item2[] = {"waiting",2,250,-75.000000,-100.000000,25.000000,-50.000000,0.000000,"waiting"}; item2[] = {"waiting",2,250,-75.000000,-200.000000,25.000000,-150.000000,0.000000,"waiting"};
item3[] = {"time_sync",4,218,-325.000000,-25.000000,-225.000000,25.000000,1.000000,"time" \n "sync"}; item3[] = {"___min_loop",4,218,-75.000000,-75.000000,25.000000,-25.000000,4.000000,"5 min" \n "loop"};
item4[] = {"sync_the_time",2,250,-325.000000,50.000000,-225.000000,100.000000,0.000000,"sync" \n "the time"}; item4[] = {"sync_time__and_w",2,250,-75.000000,25.000000,25.000000,75.000000,0.000000,"sync time" \n " and weather"};
item5[] = {"true",8,218,-75.000000,125.000000,25.000000,175.000000,0.000000,"true"}; item5[] = {"true",8,218,-75.000000,125.000000,25.000000,175.000000,0.000000,"true"};
item6[] = {"general_cleanup",2,250,-75.000000,200.000000,25.000000,250.000000,0.000000,"general" \n "cleanup" \n "loop"}; item6[] = {"general_cleanup",2,250,-75.000000,200.000000,25.000000,250.000000,0.000000,"general" \n "cleanup" \n "loop"};
item7[] = {"",7,210,-304.000000,220.999985,-296.000000,229.000015,0.000000,""}; item7[] = {"",7,210,-491.500000,220.999985,-483.500000,229.000015,0.000000,""};
item8[] = {"",7,210,-304.000000,-154.000000,-296.000000,-146.000000,0.000000,""}; item8[] = {"",7,210,-491.500000,-253.999969,-483.500000,-246.000031,0.000000,""};
item9[] = {"",7,210,221.000000,-79.000000,229.000000,-71.000000,0.000000,""}; item9[] = {"",7,210,421.000000,-178.999985,428.999969,-171.000015,0.000000,""};
item10[] = {"",7,210,221.000000,146.000000,229.000000,154.000000,0.000000,""}; item10[] = {"",7,210,421.000000,146.000000,428.999969,154.000000,0.000000,""};
item11[] = {"initialized",4,218,-75.000000,-325.000000,25.000000,-275.000000,0.000000,"initialized"}; item11[] = {"initialized",4,218,-75.000000,-425.000000,25.000000,-375.000000,0.000000,"initialized"};
item12[] = {"prepare",2,250,-75.000000,-250.000000,25.000000,-200.000000,0.000000,"prepare"}; item12[] = {"prepare",2,250,-75.000000,-350.000000,25.000000,-300.000000,0.000000,"prepare"};
item13[] = {"update_objects",2,250,175.000000,50.000000,275.000000,100.000000,0.000000,"update objects"}; item13[] = {"update_objects",2,250,-325.000000,25.000000,-225.000000,75.000000,0.000000,"update objects"};
item14[] = {"need_update",4,218,175.000000,-25.000000,275.000000,25.000000,1.000000,"need update"}; item14[] = {"__s_update__obje",4,218,-325.000000,-75.000000,-225.000000,-25.000000,2.000000,"5s" \n "update " \n "objects"};
item15[] = {"cleanup_groups",4,218,-200.000000,-25.000000,-100.000000,25.000000,1.000000,"cleanup" \n "groups"}; item15[] = {"___second_loop",4,218,-450.000000,-75.000000,-350.000000,-25.000000,1.000000,"1 second" \n "loop"};
item16[] = {"group_cleanup",2,250,-200.000000,50.000000,-100.000000,100.000000,0.000000,"group" \n "cleanup"}; item16[] = {"group_cleanup",2,250,-450.000000,25.000000,-350.000000,75.000000,0.000000,"group" \n "cleanup"};
item17[] = {"cleanup_null",4,218,50.000000,-25.000000,150.000000,25.000000,1.000000,"cleanup" \n "null"}; item17[] = {"__0_min__loop_1",4,218,50.000000,-75.000000,150.000000,-25.000000,5.000000,"10 min" \n " loop"};
item18[] = {"cleanup_null",2,250,50.000000,50.000000,150.000000,100.000000,0.000000,"cleanup" \n "null"}; item18[] = {"cleanup_dead",2,4346,50.000000,25.000000,150.000000,75.000000,0.000000,"cleanup" \n "dead"};
item19[] = {"cleanup",4,218,-75.000000,-25.000000,25.000000,25.000000,1.000000,"cleanup"}; item19[] = {"___min__loop",4,218,-200.000000,-75.000000,-100.000000,-25.000000,3.000000,"1 min" \n " loop"};
item20[] = {"cleanup_objects",2,4346,-75.000000,50.000000,25.000000,100.000000,0.000000,"cleanup" \n "objects"}; item20[] = {"cleanup_loot",2,250,-200.000000,25.000000,-100.000000,75.000000,0.000000,"cleanup" \n "loot"};
item21[] = {"__5_min__loop",4,218,175.000000,-75.000000,275.000000,-25.000000,6.000000,"15 min" \n " loop"};
item22[] = {"cleanup_fire",2,250,175.000000,25.000000,275.000000,75.000000,0.000000,"cleanup" \n "fire"};
item23[] = {"__0_min__loop",4,218,300.000000,-75.000000,400.000000,-25.000000,7.000000,"30 min" \n " loop"};
item24[] = {"cleanup_null",2,250,300.000000,25.000000,400.000000,75.000000,0.000000,"cleanup" \n "null"};
link0[] = {0,11}; link0[] = {0,11};
link1[] = {1,2}; link1[] = {1,2};
link2[] = {2,3}; link2[] = {2,3};
@@ -30,26 +34,32 @@ link4[] = {2,14};
link5[] = {2,15}; link5[] = {2,15};
link6[] = {2,17}; link6[] = {2,17};
link7[] = {2,19}; link7[] = {2,19};
link8[] = {3,4}; link8[] = {2,21};
link9[] = {4,5}; link9[] = {2,23};
link10[] = {5,6}; link10[] = {3,4};
link11[] = {6,7}; link11[] = {4,5};
link12[] = {7,8}; link12[] = {5,6};
link13[] = {8,1}; link13[] = {6,7};
link14[] = {9,10}; link14[] = {7,8};
link15[] = {10,5}; link15[] = {8,1};
link16[] = {11,12}; link16[] = {9,10};
link17[] = {12,1}; link17[] = {10,5};
link18[] = {13,5}; link18[] = {11,12};
link19[] = {14,13}; link19[] = {12,1};
link20[] = {15,16}; link20[] = {13,5};
link21[] = {16,5}; link21[] = {14,13};
link22[] = {17,18}; link22[] = {15,16};
link23[] = {18,5}; link23[] = {16,5};
link24[] = {19,20}; link24[] = {17,18};
link25[] = {20,5}; link25[] = {18,5};
globals[] = {25.000000,1,0,0,0,640,480,1,33,6316128,1,-352.091705,309.781433,349.997772,-250.100601,675,612,1}; link26[] = {19,20};
window[] = {0,-1,-1,-1,-1,888,1810,3088,130,1,693}; link27[] = {20,5};
link28[] = {21,22};
link29[] = {22,5};
link30[] = {23,24};
link31[] = {24,5};
globals[] = {25.000000,1,0,0,0,640,480,1,42,6316128,1,-508.946564,440.498199,435.888916,-341.331024,705,612,1};
window[] = {0,-1,-1,-1,-1,759,1,1279,1,1,723};
*//*%FSM</HEAD>*/ *//*%FSM</HEAD>*/
class FSM class FSM
{ {
@@ -86,18 +96,68 @@ class FSM
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/; precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links class Links
{ {
/*%FSM<LINK "need_update">*/ /*%FSM<LINK "__0_min__loop">*/
class need_update class __0_min__loop
{ {
priority = 1.000000; priority = 7.000000;
to="cleanup_null";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"((diag_tickTime - _lastCleanup1800) > 1800)"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_lastCleanup1800 = diag_tickTime;"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "__5_min__loop">*/
class __5_min__loop
{
priority = 6.000000;
to="cleanup_fire";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"((diag_tickTime - _lastCleanup900) > 900)"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_lastCleanup900 = diag_tickTime;"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "__0_min__loop_1">*/
class __0_min__loop_1
{
priority = 5.000000;
to="cleanup_dead";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"((diag_tickTime - _lastCleanupNull) > 600)"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_lastCleanupNull = diag_tickTime;"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "___min_loop">*/
class ___min_loop
{
priority = 4.000000;
to="sync_time__and_w";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"((diag_tickTime - _lastUpdate) > 300)"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_lastUpdate = diag_tickTime;"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "___min__loop">*/
class ___min__loop
{
priority = 3.000000;
to="cleanup_loot";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"((diag_tickTime - _lastCleanupVehicles) > 60)"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_lastCleanupVehicles = diag_tickTime;"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "__s_update__obje">*/
class __s_update__obje
{
priority = 2.000000;
to="update_objects"; to="update_objects";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/; precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"(( (count needUpdate_objects) > 0) && (diag_tickTime -_lastNeedUpdate> 5))"/*%FSM</CONDITION""">*/; condition=/*%FSM<CONDITION""">*/"(( (count needUpdate_objects) > 0) && (diag_tickTime -_lastNeedUpdate> 5))"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_lastNeedUpdate = diag_tickTime;"/*%FSM</ACTION""">*/; action=/*%FSM<ACTION""">*/"_lastNeedUpdate = diag_tickTime;"/*%FSM</ACTION""">*/;
}; };
/*%FSM</LINK>*/ /*%FSM</LINK>*/
/*%FSM<LINK "cleanup_groups">*/ /*%FSM<LINK "___second_loop">*/
class cleanup_groups class ___second_loop
{ {
priority = 1.000000; priority = 1.000000;
to="group_cleanup"; to="group_cleanup";
@@ -106,36 +166,6 @@ class FSM
action=/*%FSM<ACTION""">*/"_lastCleanupGroups = diag_tickTime;"/*%FSM</ACTION""">*/; action=/*%FSM<ACTION""">*/"_lastCleanupGroups = diag_tickTime;"/*%FSM</ACTION""">*/;
}; };
/*%FSM</LINK>*/ /*%FSM</LINK>*/
/*%FSM<LINK "cleanup_null">*/
class cleanup_null
{
priority = 1.000000;
to="cleanup_null";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"((diag_tickTime - _lastCleanupNull) > 300)"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_lastCleanupNull = diag_tickTime;"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "cleanup">*/
class cleanup
{
priority = 1.000000;
to="cleanup_objects";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"((diag_tickTime - _lastCleanupVehicles) > 60)"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_lastCleanupVehicles = diag_tickTime;"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "time_sync">*/
class time_sync
{
priority = 1.000000;
to="sync_the_time";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"((diag_tickTime - _lastUpdate) > 300)"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_lastUpdate = diag_tickTime;"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "true">*/ /*%FSM<LINK "true">*/
class true class true
{ {
@@ -149,34 +179,15 @@ class FSM
}; };
}; };
/*%FSM</STATE>*/ /*%FSM</STATE>*/
/*%FSM<STATE "sync_the_time">*/ /*%FSM<STATE "sync_time__and_w">*/
class sync_the_time class sync_time__and_w
{ {
name = "sync_the_time"; name = "sync_time__and_w";
init = /*%FSM<STATEINIT""">*/"//Send request" \n init = /*%FSM<STATEINIT""">*/"if (DZE_DiagFpsSlow) then {" \n
"_key = ""CHILD:307:"";" \n " [] call dze_diag_fps;" \n
"_result = _key call server_hiveReadWrite;" \n
"_outcome = _result select 0;" \n
"if(_outcome == ""PASS"") then {" \n
" _date = _result select 1; " \n
" " \n
" if(dayz_fullMoonNights) then {" \n
" //date setup" \n
" _year = _date select 0;" \n
" _month = _date select 1;" \n
" _day = _date select 2;" \n
" _hour = _date select 3;" \n
" _minute = _date select 4;" \n
" " \n
" //Force full moon nights" \n
" _date = [2013,8,3,_hour,_minute];" \n
" };" \n
"" \n
" setDate _date;" \n
" PVDZE_plr_SetDate = _date;" \n
" publicVariable ""PVDZE_plr_SetDate"";" \n
" diag_log (""TIME SYNC: Local Time set to "" + str(_date)); " \n
"};" \n "};" \n
"[] call server_timeSync;" \n
"[] call server_weather;" \n
""/*%FSM</STATEINIT""">*/; ""/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/; precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links class Links
@@ -220,15 +231,15 @@ class FSM
{ {
name = "prepare"; name = "prepare";
init = /*%FSM<STATEINIT""">*/"diag_log (""CLEANUP: INITIALIZING CLEANUP SCRIPT"");" \n init = /*%FSM<STATEINIT""">*/"diag_log (""CLEANUP: INITIALIZING CLEANUP SCRIPT"");" \n
"" \n
"_safety = PVDZE_serverObjectMonitor;" \n
"//_dateNow = (DateToNumber date);" \n
"" \n "" \n
"_lastUpdate = diag_tickTime;" \n "_lastUpdate = diag_tickTime;" \n
"_lastNeedUpdate = diag_tickTime;" \n "_lastNeedUpdate = diag_tickTime;" \n
"_lastCleanupVehicles = diag_tickTime;" \n "_lastCleanupVehicles = diag_tickTime;" \n
"_lastCleanupGroups = diag_tickTime;" \n "_lastCleanupGroups = diag_tickTime;" \n
"_lastCleanupNull = diag_tickTime;" \n "_lastCleanupNull = diag_tickTime;" \n
"" \n
"_lastCleanup900 = diag_tickTime;" \n
"_lastCleanup1800 = diag_tickTime;" \n
""/*%FSM</STATEINIT""">*/; ""/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/; precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links class Links
@@ -250,11 +261,9 @@ class FSM
class update_objects class update_objects
{ {
name = "update_objects"; name = "update_objects";
init = /*%FSM<STATEINIT""">*/"diag_log format[""DEBUG: needUpdate_objects=%1"",needUpdate_objects];" \n init = /*%FSM<STATEINIT""">*/"{" \n
"{" \n
" needUpdate_objects = needUpdate_objects - [_x];" \n " needUpdate_objects = needUpdate_objects - [_x];" \n
" [_x,""damage"",true] call server_updateObject;" \n " [_x,""damage"",true] call server_updateObject;" \n
"" \n
"} forEach needUpdate_objects;"/*%FSM</STATEINIT""">*/; "} forEach needUpdate_objects;"/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/; precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links class Links
@@ -285,18 +294,80 @@ class FSM
" };" \n " };" \n
"} forEach allGroups;" \n "} forEach allGroups;" \n
"" \n "" \n
"_safety = PVDZE_serverObjectMonitor;" \n
"" \n
"//Check for hackers" \n "//Check for hackers" \n
" {" \n " {" \n
" if(vehicle _x != _x && !(vehicle _x in _safety) && (isPlayer _x) && !((typeOf vehicle _x) in DZE_safeVehicle)) then {" \n " if(vehicle _x != _x && !(vehicle _x in PVDZE_serverObjectMonitor) && (isPlayer _x) && !((typeOf vehicle _x) in DZE_safeVehicle)) then {" \n
" diag_log (""CLEANUP: KILLING A HACKER "" + (name _x) + "" "" + str(_x) + "" IN "" + (typeOf vehicle _x));" \n " diag_log (""CLEANUP: KILLING A HACKER "" + (name _x) + "" "" + str(_x) + "" IN "" + (typeOf vehicle _x));" \n
" (vehicle _x) setDamage 1;" \n " (vehicle _x) setDamage 1;" \n
" _x setDamage 1;" \n " _x setDamage 1;" \n
" };" \n " };" \n
" } forEach allUnits;" \n " } forEach allUnits;"/*%FSM</STATEINIT""">*/;
"" \n precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
"PVDZE_serverObjectMonitor = _safety;"/*%FSM</STATEINIT""">*/; class Links
{
/*%FSM<LINK "true">*/
class true
{
priority = 0.000000;
to="general_cleanup";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "cleanup_dead">*/
class cleanup_dead
{
name = "cleanup_dead";
init = /*%FSM<STATEINIT""">*/"[] spawn server_spawncleanDead;"/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "true">*/
class true
{
priority = 0.000000;
to="general_cleanup";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "cleanup_loot">*/
class cleanup_loot
{
name = "cleanup_loot";
init = /*%FSM<STATEINIT""">*/"if (DZE_DiagFpsFast) then {" \n
" [] call dze_diag_fps;" \n
"};" \n
"[] spawn server_spawnCleanLoot;"/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "true">*/
class true
{
priority = 0.000000;
to="general_cleanup";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "cleanup_fire">*/
class cleanup_fire
{
name = "cleanup_fire";
init = /*%FSM<STATEINIT""">*/"[] spawn server_spawnCleanFire;"/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/; precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links class Links
{ {
@@ -317,81 +388,7 @@ class FSM
class cleanup_null class cleanup_null
{ {
name = "cleanup_null"; name = "cleanup_null";
init = /*%FSM<STATEINIT""">*/"_delQtyNull = 0;" \n init = /*%FSM<STATEINIT""">*/"[] spawn server_spawnCleanNull;"/*%FSM</STATEINIT""">*/;
"{" \n
" if (isNull _x) then {" \n
" _x call dayz_perform_purge;" \n
" _delQtyNull = _delQtyNull + 1;" \n
" };" \n
"} forEach (allMissionObjects """");" \n
"" \n
"if (_delQtyNull > 0) then {" \n
" diag_log (format[""CLEANUP: Deleted %1 null objects"",_delQtyNull]);" \n
"};"/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "true">*/
class true
{
priority = 0.000000;
to="general_cleanup";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "cleanup_objects">*/
class cleanup_objects
{
name = "cleanup_objects";
init = /*%FSM<STATEINIT""">*/"_weaponholders = allMissionObjects ""ReammoBox"";" \n
"_fireplaces = allMissionObjects ""Land_Fire_DZ"";" \n
"_animals = allMissionObjects ""CAAnimalBase""; " \n
"" \n
"_delQtyFP = 0;" \n
"_delQty = 0;" \n
"_delQtyAnimal = 0;" \n
"" \n
"_dateNow = (DateToNumber date);" \n
"_delQty = 0;" \n
"{" \n
" if (local _x) then {" \n
" _created = (_x getVariable [""created"",-0.1]);" \n
" if (_created == -0.1) then {" \n
" _x setVariable [""created"",_dateNow,false];" \n
" _created = _dateNow;" \n
" };" \n
" _keep = _x getVariable [""permaLoot"",false];" \n
" _age = (_dateNow - _created) * 525948;" \n
" _nearby = {(isPlayer _x) and (alive _x)} count (_x nearEntities [[""CAManBase"",""AllVehicles""], 130]);" \n
" if ( (!_keep) && (_nearby==0) && (_age > 20)) then {" \n
" deleteVehicle _x;" \n
" _delQty = _delQty + 1;" \n
" };" \n
" };" \n
"} forEach _weaponholders;" \n
"" \n
"{" \n
" if (local _x) then {" \n
" deleteVehicle _x;" \n
" _delQtyFP = _delQtyFP + 1;" \n
" };" \n
"} forEach _fireplaces;" \n
"" \n
"{" \n
" if (local _x) then {" \n
" _x call dayz_perform_purge;" \n
" _delQtyAnimal = _delQtyAnimal + 1;" \n
" };" \n
"} forEach _animals;" \n
"" \n
"if (_delQty > 0 or _delQtyFP > 0 or _delQtyAnimal > 0) then {" \n
" diag_log (format[""CLEANUP: Deleted %1 loot bags, %2 fireplaces, %3 animals"",_delQty,_delQtyFP,_delQtyAnimal]);" \n
"};"/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/; precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links class Links
{ {