Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*%FSM<COMPILE "scriptedFSM.cfg, DayZ Server Cleanup">*/
- /*%FSM<HEAD>*/
- /*
- item0[] = {"init",0,250,-75.000000,-400.000000,25.000000,-350.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,-150.000000,-25.000000,-50.000000,25.000000,2.000000,"too many" \n "dead"};
- item4[] = {"cleanup_dead",2,250,-150.000000,50.000000,-50.000000,100.000000,0.000000,"cleanup" \n "dead"};
- item5[] = {"too_many_objects",4,218,-25.000000,-25.000000,75.000000,25.000000,0.000000,"too many" \n "objects"};
- item6[] = {"cleanup_objects",2,250,-25.000000,50.000000,75.000000,100.000000,0.000000,"cleanup" \n "objects"};
- item7[] = {"time_sync",4,218,-275.000000,-25.000000,-175.000000,25.000000,1.000000,"time" \n "sync"};
- item8[] = {"sync_the_time",2,250,-275.000000,50.000000,-175.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,-304.000000,220.999985,-296.000000,229.000015,0.000000,""};
- item12[] = {"",7,210,-304.000000,-154.000000,-296.000000,-146.000000,0.000000,""};
- item13[] = {"",7,210,221.000000,-79.000000,229.000000,-71.000000,0.000000,""};
- item14[] = {"",7,210,221.000000,146.000000,229.000000,154.000000,0.000000,""};
- item15[] = {"initialized",4,218,-75.000000,-325.000000,25.000000,-275.000000,0.000000,"initialized"};
- item16[] = {"prepare",2,250,-75.000000,-250.000000,25.000000,-200.000000,0.000000,"prepare"};
- item17[] = {"update_objects",2,4346,100.000000,50.000000,200.000000,100.000000,0.000000,"update objects"};
- item18[] = {"need_update",4,218,100.000000,-25.000000,200.000000,25.000000,1.000000,"need update"};
- item19[] = {"",7,210,221.000000,-79.000000,229.000000,-71.000000,0.000000,""};
- link0[] = {0,15};
- link1[] = {1,2};
- link2[] = {2,3};
- link3[] = {2,5};
- link4[] = {2,7};
- link5[] = {2,13};
- link6[] = {2,18};
- link7[] = {3,4};
- link8[] = {4,9};
- link9[] = {5,6};
- link10[] = {6,9};
- link11[] = {7,8};
- link12[] = {8,9};
- link13[] = {9,10};
- link14[] = {10,11};
- link15[] = {11,12};
- link16[] = {12,1};
- link17[] = {13,14};
- link18[] = {13,19};
- link19[] = {14,9};
- link20[] = {15,16};
- link21[] = {16,1};
- link22[] = {17,9};
- link23[] = {18,17};
- globals[] = {25.000000,1,0,0,0,640,480,1,24,6316128,1,-396.580658,354.272186,463.204498,-386.553192,911,1031,1};
- window[] = {2,-1,-1,-1,-1,1020,322,1651,78,3,929};
- *//*%FSM</HEAD>*/
- class FSM
- {
- fsmName = "DayZ Server Cleanup";
- class States
- {
- /*%FSM<STATE "init">*/
- class init
- {
- name = "init";
- init = /*%FSM<STATEINIT""">*/""/*%FSM</STATEINIT""">*/;
- precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
- class Links
- {
- /*%FSM<LINK "initialized">*/
- class initialized
- {
- priority = 0.000000;
- to="prepare";
- precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
- condition=/*%FSM<CONDITION""">*/"!isnil ""bis_fnc_init"""/*%FSM</CONDITION""">*/;
- action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
- };
- /*%FSM</LINK>*/
- };
- };
- /*%FSM</STATE>*/
- /*%FSM<STATE "waiting">*/
- class waiting
- {
- name = "waiting";
- init = /*%FSM<STATEINIT""">*/"//diag_log ""CLEANUP: Waiting for next task"";" \n
- ""/*%FSM</STATEINIT""">*/;
- precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
- class Links
- {
- /*%FSM<LINK "too_many_dead">*/
- class too_many_dead
- {
- priority = 2.000000;
- to="cleanup_dead";
- precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
- condition=/*%FSM<CONDITION""">*/"((time - _lastCleanDead) > 1200)"/*%FSM</CONDITION""">*/;
- action=/*%FSM<ACTION""">*/"_lastCleanDead = time;"/*%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 - _lastSyncTime) > 3600)"/*%FSM</CONDITION""">*/;
- action=/*%FSM<ACTION""">*/"_lastSyncTime = time;"/*%FSM</ACTION""">*/;
- };
- /*%FSM</LINK>*/
- /*%FSM<LINK "need_update">*/
- class need_update
- {
- priority = 1.000000;
- to="update_objects";
- precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
- condition=/*%FSM<CONDITION""">*/"((count needUpdate_objects) > 0 && (time - _lastUpdateVeh > 10))"/*%FSM</CONDITION""">*/;
- action=/*%FSM<ACTION""">*/"_lastUpdateVeh = time;"/*%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<LINK "too_many_objects">*/
- class too_many_objects
- {
- priority = 0.000000;
- to="cleanup_objects";
- precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
- condition=/*%FSM<CONDITION""">*/"(time - _lastCleanObjs) > 600"/*%FSM</CONDITION""">*/;
- action=/*%FSM<ACTION""">*/"_lastCleanObjs = time;"/*%FSM</ACTION""">*/;
- };
- /*%FSM</LINK>*/
- };
- };
- /*%FSM</STATE>*/
- /*%FSM<STATE "cleanup_dead">*/
- class cleanup_dead
- {
- name = "cleanup_dead";
- init = /*%FSM<STATEINIT""">*/"diag_log (""CLEANUP: PERFORMING BODY CLEANUP"");" \n
- "" \n
- "_delQtyP = 0;" \n
- "_delQtyZ = 0;" \n
- "_delQtyFL = 0;" \n
- "_delQtyFP = 0;" \n
- "" \n
- "{" \n
- " if (local _x) then {" \n
- " if (_x isKindOf ""zZombie_Base"") then {" \n
- " deleteVehicle _x;" \n
- " _delQtyZ = _delQtyZ + 1;" \n
- " } else {" \n
- " if (_x isKindOf ""CAManBase"") then {" \n
- " _deathTime = _x getVariable [""processedDeath"", time];" \n
- " if (time - _deathTime > 1200) then {" \n
- " _flies = nearestObject [_x, ""Sound_Flies""];" \n
- " if (!isNull _flies) then {" \n
- " deleteVehicle _flies;" \n
- " _delQtyFL = _delQtyFL + 1;" \n
- " };" \n
- " deleteVehicle _x;" \n
- " _delQtyP = _delQtyP + 1;" \n
- " };" \n
- " };" \n
- " };" \n
- " };" \n
- "} forEach allDead;" \n
- "" \n
- "{" \n
- " if ({!alive _x} count (nearestObjects [_x, [""CAManBase""], 10]) >= 0) then {" \n
- " deleteVehicle _x;" \n
- " _delQtyFL = _delQtyFL + 1;" \n
- " };" \n
- "} forEach allMissionObjects ""Sound_Flies"";" \n
- "" \n
- "{" \n
- " if (local _x) then {" \n
- " deleteVehicle _x;" \n
- " _delQtyFP = _delQtyFP + 1;" \n
- " };" \n
- "} forEach allMissionObjects ""Land_Fire_DZ"";" \n
- "" \n
- "diag_log (""CLEANUP: Deleted "" + str(_delQtyP) + "" players, "" + str(_delQtyZ) + "" zombies, "" + str(_delQtyFL) + "" flies, and "" + str(_delQtyFP) + "" fireplaces"");" \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""">*/"_delQty = 0;" \n
- "//{" \n
- "// if (local _x) then {" \n
- "// _keep = _x getVariable [""permaLoot"",false];" \n
- "// _keep = (_keep || (({isPlayer _x} count (_x nearEntities [[""CAManBase""], 100])) > 0));" \n
- "// if (!_keep) then {" \n
- "// deleteVehicle _x;" \n
- "// _delQty = _delQty + 1;" \n
- "// };" \n
- "// };" \n
- "//} forEach allMissionObjects ""WeaponHolder"";" \n
- "//diag_log (""CLEANUP: Deleted "" + str(_delQty) + "" loot drops"");" \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
- " _dateDiff = (dateToNumber(_date) - dateToNumber(date)) * 365 * 24 * 60;" \n
- " if (abs(_dateDiff) > 5) then {" \n
- " setDate _date;" \n
- " dayzSetDate = _date;" \n
- " publicVariable ""dayzSetDate"";" \n
- " diag_log (""TIME SYNC: Local Time set to "" + str(_date));" \n
- " };" \n
- "};" \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 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 hackers" \n
- " {" \n
- " if(vehicle _x != _x && !(vehicle _x in _safety) && (typeOf vehicle _x) != ""ParachuteWest"") then {" \n
- " diag_log (""CLEANUP: KILLING A HACKER "" + (name _x) + "" "" + str(_x) + "" IN "" + (typeOf vehicle _x));" \n
- " (vehicle _x) setDamage 1;" \n
- " _x setDamage 1;" \n
- " };" \n
- " } forEach allUnits;" \n
- "" \n
- "dayz_serverObjectMonitor = _safety;"/*%FSM</STATEINIT""">*/;
- precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
- class Links
- {
- /*%FSM<STATE "check_for_hacker">*/
- class check_for_hacker
- {
- name = "check_for_hacker";
- init = /*%FSM<STATEINIT""">*/"//Check for hackers" \n
- " {" \n
- " if(vehicle _x != _x) then {" \n
- " if (!(vehicle _x in _safety) && ((typeOf vehicle _x) != ""ParachuteWest"")) then {" \n
- " diag_log (""CLEANUP: KILLING A HACKER "" + (name _x) + "" "" + str(_x) + "" IN "" + (typeOf vehicle _x));" \n
- " (vehicle _x) setDamage 1;" \n
- " _x setDamage 1;" \n
- " };" \n
- " } else {" \n
- " if (isPlayer _x) then {" \n
- " _boxes = nearestObjects [_x, [""MedBox0"", ""AmmoBoxBig"", ""USBasicWeapons_EP1"", ""USBasicAmmunitionBox_EP1"", ""UNBasicWeapons_EP1"", ""UNBasicAmmunitionBox_EP1"", ""USLaunchers_EP1"", ""USVehicleBox_EP1"", ""USSpecialWeapons_EP1"", ""LocalBasicAmmunitionBox"", ""Gunrack2"", ""Gunrack1"", ""RULaunchersBox"", ""RUBasicWeaponsBox"", ""RUBasicAmmunitionBox"", ""LocalBasicWeaponsBox"", ""RUSpecialWeaponsBox"", ""USBasicWeaponsBox"", ""USVehicleBox"", ""RUVehicleBox"", ""USSpecialWeaponsBox"", ""SpecialWeaponsBox"", ""USLaunchersBox"", ""TKVehicleBox_EP1"", ""TKSpecialWeapons_EP1"", ""TKOrdnanceBox_EP1"", ""TKLaunchers_EP1"", ""TKBasicWeapons_EP1"", ""TKBasicAmmunitionBox_EP1"", ""GunrackUS_EP1"", ""GunrackTK_EP1"", ""GuerillaCacheBox_EP1"", ""GERBasicWeapons_EP1"", ""CZBasicWeapons_EP1"", ""AmmoCrates_NoInteractive_Small"", ""AmmoCrates_NoInteractive_Medium"", ""AmmoCrate_NoInteractive_"", ""GuerillaCacheBox"", ""USBasicAmmunitionBox"", ""USOrdnanceBox_EP1"", ""RUOrdnanceBox"", ""AmmoBoxSmall_556"", ""AmmoBoxSmall_762"", ""ItemMatchbox"", ""ItemToolbox"", ""CardBoardBox"", ""FoodBox1"", ""FoodBox2"",""FoodBox3""], 50];" \n
- " {" \n
- " _box = _x;" \n
- " _weap = getWeaponCargo _box;" \n
- " _players_nearby = _box nearEntities [AllPlayers, 50];" \n
- " if (str(_weap) != '[[],[]]') then {" \n
- " diag_log(""pyBEscanner - Hack Box - "" + str(_players_nearby));" \n
- " {" \n
- " diag_log(""pyBEscanner - Hack Box - "" + str(_box distance _x) + "" - "" + str(_x));" \n
- " } forEach _players_nearby;" \n
- " deleteVehicle _box;" \n
- " diag_log (""pyBEscanner - Hack Box - Weapons list is "" + str(_box) + "" "" + str(_weap));" \n
- " diag_log(""pyBEscanner - Hack Box - Deleting cheat box"");" \n
- " diag_log(""pyBEscanner - Hack Box - End"");" \n
- " };" \n
- " } forEach _boxes;" \n
- " };" \n
- " };" \n
- " } forEach allUnits;"/*%FSM</STATEINIT""">*/;
- /*%FSM<LINK "true">*/
- class true
- {
- priority = 0.000000;
- to="waiting";
- precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
- condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
- action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
- };
- /*%FSM</LINK>*/
- };
- };
- /*%FSM</STATE>*/
- /*%FSM<STATE "prepare">*/
- class prepare
- {
- name = "prepare";
- init = /*%FSM<STATEINIT""">*/"private [""_safety"", ""_lastSyncTime"", ""_lastCleanDead"", ""_lastCleanObjs"", ""_lastUpdateVeh""];" \n
- "diag_log (""CLEANUP: INITIALIZING CLEANUP SCRIPT"");" \n
- "" \n
- "_safety = dayz_serverObjectMonitor;" \n
- "" \n
- "_lastSyncTime = time;" \n
- "_lastCleanDead = time;" \n
- "_lastCleanObjs = time;" \n
- "_lastUpdateVeh = time;"/*%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""">*/""/*%FSM</ACTION""">*/;
- };
- /*%FSM</LINK>*/
- };
- };
- /*%FSM</STATE>*/
- /*%FSM<STATE "update_objects">*/
- class update_objects
- {
- name = "update_objects";
- init = /*%FSM<STATEINIT""">*/"diag_log format[""DEBUG: needUpdate_objects=%1"",needUpdate_objects];" \n
- "{" \n
- "// _x setVariable [""needUpdate"",false,true];" \n
- " needUpdate_objects = needUpdate_objects - [_x];" \n
- " [_x,""all""] spawn server_updateObject;" \n
- "" \n
- "} forEach needUpdate_objects;" \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>*/
- };
- initState="init";
- finalStates[] =
- {
- };
- };
- /*%FSM</COMPILE>*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement