/*%FSM<COMPILE "E:\Bohemia Interactive\Tools\FSM Editor Personal Edition\scriptedFSM.cfg, DayZ Server Cleanup">*/
/*%FSM<HEAD>*/
/*
item0[] = {"init",0,250,-75.000000,-250.000000,25.000000,-200.000000,0.000000,"init"};
item1[] = {"true",8,218,-75.000000,-175.000000,25.000000,-125.000000,0.000000,"true"};
item2[] = {"waiting",2,250,-75.000000,-100.000000,25.000000,-50.000000,0.000000,"waiting"};
item3[] = {"too_many_dead",4,218,-75.000000,-25.000000,25.000000,25.000000,2.000000,"too many" \n "dead"};
item4[] = {"cleanup_dead",2,250,-75.000000,50.000000,25.000000,100.000000,0.000000,"cleanup" \n "dead"};
item5[] = {"too_many_objects",4,218,50.000000,-25.000000,150.000000,25.000000,3.000000,"too many" \n "objects"};
item6[] = {"cleanup_objects",2,4346,50.000000,50.000000,150.000000,100.000000,0.000000,"cleanup" \n "objects"};
item7[] = {"time_sync",4,218,-200.000000,-25.000000,-100.000000,25.000000,1.000000,"time" \n "sync"};
item8[] = {"sync_the_time",2,250,-200.000000,50.000000,-100.000000,100.000000,0.000000,"sync" \n "the time"};
item9[] = {"true",8,218,-75.000000,125.000000,25.000000,175.000000,0.000000,"true"};
item10[] = {"general_cleanup",2,250,-75.000000,200.000000,25.000000,250.000000,0.000000,"general" \n "cleanup"};
item11[] = {"",7,210,-229.000000,220.999985,-220.999985,229.000015,0.000000,""};
item12[] = {"",7,210,-229.000000,-154.000000,-221.000000,-146.000000,0.000000,""};
item13[] = {"",7,210,171.000000,-79.000000,179.000000,-71.000000,0.000000,""};
item14[] = {"",7,210,171.000000,146.000000,179.000000,154.000000,0.000000,""};
link0[] = {0,1};
link1[] = {1,2};
link2[] = {2,3};
link3[] = {2,5};
link4[] = {2,7};
link5[] = {2,13};
link6[] = {3,4};
link7[] = {4,9};
link8[] = {5,6};
link9[] = {6,9};
link10[] = {7,8};
link11[] = {8,9};
link12[] = {9,10};
link13[] = {10,11};
link14[] = {11,12};
link15[] = {12,1};
link16[] = {13,14};
link17[] = {14,9};
globals[] = {25.000000,1,0,0,0,640,480,1,18,6316128,1,-315.227539,337.731781,340.528870,-244.373749,1017,911,1};
window[] = {2,-1,-1,-32000,-32000,1001,11,982,59,3,1035};
*//*%FSM</HEAD>*/
class FSM
{
fsmName = "DayZ Server Cleanup";
class States
{
/*%FSM<STATE "init">*/
class init
{
name = "init";
init = /*%FSM<STATEINIT""">*/"diag_log (""CLEANUP: INITIALIZING CLEANUP SCRIPT"");" \n
"" \n
"_safety = dayz_serverObjectMonitor;" \n
"" \n
"_deadBodies = [];" \n
"_maxBodies = 15;"/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "true">*/
class true
{
priority = 0.000000;
to="waiting";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_lastUpdate = time;"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
/*%FSM<STATE "waiting">*/
class waiting
{
name = "waiting";
init = /*%FSM<STATEINIT""">*/"//diag_log ""CLEANUP: Waiting for next task"";" \n
"_missionObjs = allMissionObjects ""WeaponHolder"";" \n
"_numDead = {local _x} count allDead;" \n
""/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "too_many_objects">*/
class too_many_objects
{
priority = 3.000000;
to="cleanup_objects";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"(count _missionObjs > 1200)"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%FSM<LINK "too_many_dead">*/
class too_many_dead
{
priority = 2.000000;
to="cleanup_dead";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"(_numDead > 50)"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%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""">*/"((time - _lastUpdate) > 300)"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
/*%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""">*/"diag_log (""CLEANUP: TOO MANY DEAD BODIES"");" \n
"" \n
"diag_log (""CLEANUP: PERFORMING BODY CLEANUP ON "" + str(_numDead) + "" BODIES"");" \n
"" \n
"_delQtyZ = 0;" \n
"_numZombie = {_x isKindOf ""zZombie_Base""} count allDead;" \n
"{" \n
" if (local _x) then {" \n
" if (_x isKindOf ""zZombie_Base"") then {" \n
" deleteVehicle _x;" \n
" _delQtyZ = _delQtyZ + 1;" \n
" } else {" \n
" _exists = _x in _deadBodies;" \n
" if(!_exists) then {" \n
" _deadBodies set [count _deadBodies,_x];" \n
" };" \n
" };" \n
" };" \n
"} forEach allDead;" \n
"" \n
"//Cleanup players" \n
"_delQtyP = 0;" \n
"_delDo = _numDead - _numZombie;" \n
"_delDo = _delDo max (count _deadBodies);" \n
"for ""_i"" from 0 to _delDo do {" \n
" _body = _deadBodies select _i;" \n
" deleteVehicle _body;" \n
" _deadBodies set [_i,""DEL""];" \n
" _delQtyP = _delQtyP + 1;" \n
"};" \n
"_deadBodies = _deadBodies - [""DEL""];" \n
"" \n
"diag_log (""CLEANUP: DELETED "" + str(_delQtyP) + "" PLAYER BODIES AND "" + str(_delQtyZ) + "" BODIES"");" \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""">*/"_qty = count _missionObjs;" \n
"" \n
"diag_log (""CLEANUP: PERFORMING ITEM CLEANUP ON "" + str(_qty) + "" LOOT BAGS"");" \n
"_delQty = 0;" \n
"" \n
"{" \n
" if (local _x) then {" \n
" _keep = _x getVariable [""permaLoot"",false];" \n
" if ((!_keep) && !(typeOf _x == ""BoltSteelF"")) then {" \n
" deleteVehicle _x;" \n
" _delQty = _delQty + 1;" \n
" };" \n
" };" \n
"} forEach _missionObjs;" \n
"" \n
"diag_log (""CLEANUP: DELETED "" + str(_delQty) + "" LOOT BAGS"");" \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 "sync_the_time">*/
class sync_the_time
{
name = "sync_the_time";
init = /*%FSM<STATEINIT""">*/"//Send request" \n
"_key = ""CHILD:307:"";" \n
"_result = [_key] call server_hiveReadWrite;" \n
"_outcome = _result select 0;" \n
"if(_outcome == ""PASS"") then {" \n
" _date = _result select 1; " \n
" if(isDedicated) then {" \n
" setDate _date;" \n
" dayzSetDate = _date;" \n
" publicVariable ""dayzSetDate"";" \n
" };" \n
"" \n
" diag_log (""TIME SYNC: Local Time set to "" + str(_date));" \n
"};" \n
"_lastUpdate = time;" \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 "general_cleanup">*/
class general_cleanup
{
name = "general_cleanup";
init = /*%FSM<STATEINIT""">*/"//clean zombies" \n
"{" \n
" //Is a created agent" \n
" if (local _x) then {" \n
" diag_log (""CLEANUP: DELETING A UNCONTROLLED ZOMBIE"");" \n
" deleteVehicle _x;" \n
" };" \n
"} forEach allMissionObjects ""zZombie_Base"";" \n
"" \n
"//clean fireplaces" \n
"{" \n
" if (local _x) then {" \n
" diag_log (""CLEANUP: DELETING A UNCONTROLLED FIREPLACE"");" \n
" deleteVehicle _x;" \n
" };" \n
"} forEach allMissionObjects ""Land_Fire_DZ"";" \n
"" \n
"//Clean groups" \n
"{" \n
" //diag_log (""CLEANUP: CHECKING GROUP WITH "" + str(count units _x) + "" UNITS"");" \n
" if (count units _x==0) then {" \n
" deleteGroup _x;" \n
" diag_log (""CLEANUP: DELETING A GROUP"");" \n
" };" \n
"} forEach allGroups;" \n
"" \n
"//Check for Ammobox (REMOVED BECAUSE ITS JUST DELETING ALL USEFUL STUFF)." \n
"// { " \n
"// if(!(_x isKindOf ""WeaponHolder"") && !(_x isKindOf ""Bag_Base_EP1"") && !(typeOf _x == ""BoltSteelF"")) then { " \n
"// diag_log (""CLEANUP: DELETING AN AMMOBOX "" + (typeOf _x)); " \n
"// deleteVehicle _x; " \n
"// }; " \n
"//} forEach allMissionObjects ""ReammoBox"";" \n
"" \n
"//Check for mod-appers" \n
" {" \n
" if(vehicle _x != _x && !(vehicle _x in dayz_serverObjectMonitor)) then {" \n
" diag_log (""CLEANUP: KILLING A mod-appER "" + (name _x) + "" "" + str(_x) + "" IN "" + (typeOf vehicle _x));" \n
" (vehicle _x) setDamage 1;" \n
" _x setDamage 1;" \n
" };" \n
" } forEach allUnits;" \n
"" \n
"dayz_safety = _safety;"/*%FSM</STATEINIT""">*/;
precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
class Links
{
/*%FSM<LINK "true">*/
class true
{
priority = 0.000000;
to="waiting";
precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
action=/*%FSM<ACTION""">*/"_lastUpdate = time;"/*%FSM</ACTION""">*/;
};
/*%FSM</LINK>*/
};
};
/*%FSM</STATE>*/
};
initState="init";
finalStates[] =
{
};
};
/*%FSM</COMPILE>*/