Advertisement
Guest User

server_cleanup.fsm

a guest
May 24th, 2015
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 24.81 KB | None | 0 0
  1. /*%FSM<COMPILE "C:\Program Files (x86)\Bohemia Interactive\Tools\FSM Editor Personal Edition\scriptedFSM.cfg, DayZ Server Cleanup">*/
  2. /*%FSM<HEAD>*/
  3. /*
  4. item0[] = {"init",0,250,-75.000000,-425.000000,25.000000,-375.000000,0.000000,"init"};
  5. item1[] = {"true",8,218,-75.000000,-200.000000,25.000000,-150.000000,0.000000,"true"};
  6. item2[] = {"waiting",2,250,-75.000000,-125.000000,25.000000,-75.000000,0.000000,"waiting"};
  7. item3[] = {"too_many_dead",4,218,-125.000000,0.000000,-25.000000,50.000000,2.000000,"too many" \n "dead"};
  8. item4[] = {"cleanup_dead",2,250,-125.000000,75.000000,-25.000000,125.000000,0.000000,"cleanup" \n "dead"};
  9. item5[] = {"too_many_objects",4,218,175.000000,0.000000,275.000000,50.000000,2.000000,"too many" \n "objects"};
  10. item6[] = {"cleanup_objects",2,250,175.000000,75.000000,275.000000,125.000000,0.000000,"cleanup" \n "objects"};
  11. item7[] = {"time_sync",4,218,-225.000000,0.000000,-125.000000,50.000000,1.000000,"time" \n "sync"};
  12. item8[] = {"sync_the_time",2,4346,-225.000000,175.000000,-125.000000,225.000000,0.000000,"sync" \n "the time"};
  13. item9[] = {"true",8,218,-75.000000,250.000000,25.000000,300.000000,0.000000,"true"};
  14. item10[] = {"general_cleanup",2,250,-75.000000,350.000000,25.000000,400.000000,0.000000,"general" \n "cleanup"};
  15. item11[] = {"",7,210,-254.000015,371.000000,-246.000000,379.000031,0.000000,""};
  16. item12[] = {"",7,210,-254.000015,-179.000000,-246.000000,-171.000000,0.000000,""};
  17. item13[] = {"initialized",4,218,-75.000000,-350.000000,25.000000,-300.000000,0.000000,"initialized"};
  18. item14[] = {"prepare",2,250,-75.000000,-275.000000,25.000000,-225.000000,0.000000,"prepare"};
  19. item15[] = {"update_objects",2,250,-25.000000,75.000000,75.000000,125.000000,0.000000,"update objects"};
  20. item16[] = {"Objects_need_upd",4,218,-25.000000,0.000000,75.000000,50.000000,1.000000,"Objects" \n "need update"};
  21. item17[] = {"LootSpawn",4,218,500.000000,-50.000000,600.000000,0.000000,2.000000,"LootSpawn"};
  22. item18[] = {"",7,210,-29.000000,-41.500000,-21.000000,-33.499996,0.000000,""};
  23. item19[] = {"",7,210,20.999998,-41.500000,29.000000,-33.500000,0.000000,""};
  24. item20[] = {"",7,210,121.000000,-41.500000,129.000000,-33.500000,0.000000,""};
  25. item21[] = {"",7,210,-79.000000,-41.500000,-71.000000,-33.500000,0.000000,""};
  26. item22[] = {"",7,210,-179.000000,-41.499996,-171.000000,-33.500000,0.000000,""};
  27. item23[] = {"",7,210,-79.000000,146.000000,-71.000000,154.000000,0.000000,""};
  28. item24[] = {"",7,210,21.000000,146.000000,28.999998,154.000000,0.000000,""};
  29. item25[] = {"",7,210,-29.000000,146.000000,-20.999998,154.000000,0.000000,""};
  30. item26[] = {"",7,210,308.500000,-104.000000,316.500000,-96.000000,0.000000,""};
  31. item27[] = {"",7,210,308.500031,271.000000,316.499969,279.000000,0.000000,""};
  32. item28[] = {"",7,210,-179.000000,271.000000,-171.000000,279.000000,0.000000,""};
  33. item29[] = {"",7,210,221.000000,-41.500000,229.000000,-33.500000,0.000000,""};
  34. item30[] = {"Start_Loot_Spawn",2,250,500.000000,350.000000,600.000000,400.000000,0.000000,"Start Loot" \n "Spawner"};
  35. item31[] = {"true",8,218,75.000000,350.000000,175.000000,400.000000,0.000000,"true"};
  36. item32[] = {"New_Cleanup_Obje",2,250,375.000000,75.000000,475.000000,125.000000,0.000000,"New Cleanup" \n "Objects"};
  37. item33[] = {"",7,210,221.000031,271.000000,228.999969,279.000000,0.000000,""};
  38. item34[] = {"_",2,250,-425.000000,0.000000,-325.000000,50.000000,0.000000,""};
  39. item35[] = {"_",4,218,-425.000000,175.000000,-325.000000,225.000000,0.000000,""};
  40. item36[] = {"____FAKE____",9,1440,0.000000,0.000000,0.000000,0.000000,0.000000,"____FAKE____"};
  41. link0[] = {0,13};
  42. link1[] = {1,2};
  43. link2[] = {2,18};
  44. link3[] = {2,26};
  45. link4[] = {3,4};
  46. link5[] = {4,23};
  47. link6[] = {5,6};
  48. link7[] = {6,33};
  49. link8[] = {7,8};
  50. link9[] = {8,28};
  51. link10[] = {9,10};
  52. link11[] = {10,11};
  53. link12[] = {11,12};
  54. link13[] = {12,1};
  55. link14[] = {13,14};
  56. link15[] = {14,1};
  57. link16[] = {15,24};
  58. link17[] = {16,15};
  59. link18[] = {17,30};
  60. link19[] = {18,19};
  61. link20[] = {18,21};
  62. link21[] = {19,16};
  63. link22[] = {19,20};
  64. link23[] = {20,29};
  65. link24[] = {21,3};
  66. link25[] = {21,22};
  67. link26[] = {22,7};
  68. link27[] = {23,25};
  69. link28[] = {24,25};
  70. link29[] = {25,9};
  71. link30[] = {26,27};
  72. link31[] = {27,33};
  73. link32[] = {28,9};
  74. link33[] = {29,5};
  75. link34[] = {30,31};
  76. link35[] = {31,10};
  77. link36[] = {33,9};
  78. link37[] = {34,35};
  79. link38[] = {36,17};
  80. link39[] = {35,36};
  81. globals[] = {25.000000,1,0,0,0,640,480,1,13,6316128,1,-576.163574,585.050720,444.212921,-448.684845,779,599,1};
  82. window[] = {2,-1,-1,-1,-1,903,175,1504,175,3,797};
  83. *//*%FSM</HEAD>*/
  84. class FSM
  85. {
  86.   fsmName = "DayZ Server Cleanup";
  87.   class States
  88.   {
  89.     /*%FSM<STATE "init">*/
  90.     class init
  91.     {
  92.       name = "init";
  93.       init = /*%FSM<STATEINIT""">*/""/*%FSM</STATEINIT""">*/;
  94.       precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  95.       class Links
  96.       {
  97.         /*%FSM<LINK "initialized">*/
  98.         class initialized
  99.         {
  100.           priority = 0.000000;
  101.           to="prepare";
  102.           precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  103.           condition=/*%FSM<CONDITION""">*/"!isnil ""bis_fnc_init"""/*%FSM</CONDITION""">*/;
  104.           action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  105.         };
  106.         /*%FSM</LINK>*/
  107.       };
  108.     };
  109.     /*%FSM</STATE>*/
  110.     /*%FSM<STATE "waiting">*/
  111.     class waiting
  112.     {
  113.       name = "waiting";
  114.       init = /*%FSM<STATEINIT""">*/"//diag_log ""CLEANUP: Waiting for next task"";" \n
  115.        "" \n
  116.        "_numDead = {local _x} count allDead;" \n
  117.        ""/*%FSM</STATEINIT""">*/;
  118.       precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  119.       class Links
  120.       {
  121.         /*%FSM<LINK "too_many_dead">*/
  122.         class too_many_dead
  123.         {
  124.           priority = 2.000000;
  125.           to="cleanup_dead";
  126.           precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  127.           condition=/*%FSM<CONDITION""">*/"(_numDead > 100)"/*%FSM</CONDITION""">*/;
  128.           action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  129.         };
  130.         /*%FSM</LINK>*/
  131.         /*%FSM<LINK "too_many_objects">*/
  132.         class too_many_objects
  133.         {
  134.           priority = 2.000000;
  135.           to="cleanup_objects";
  136.           precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  137.           condition=/*%FSM<CONDITION""">*/"((diag_tickTime - _timeNem) > 150)" \n
  138.            "//(((count dayz_deseedloot) > 0) && (!isNil ""sm_done""))"/*%FSM</CONDITION""">*/;
  139.           action=/*%FSM<ACTION""">*/"_timeNem = diag_tickTime;"/*%FSM</ACTION""">*/;
  140.         };
  141.         /*%FSM</LINK>*/
  142.         /*%FSM<LINK "time_sync">*/
  143.         class time_sync
  144.         {
  145.           priority = 1.000000;
  146.           to="sync_the_time";
  147.           precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  148.           condition=/*%FSM<CONDITION""">*/"((diag_tickTime - _lastUpdate) > 300)"/*%FSM</CONDITION""">*/;
  149.           action=/*%FSM<ACTION""">*/"_lastUpdate = diag_tickTime;"/*%FSM</ACTION""">*/;
  150.         };
  151.         /*%FSM</LINK>*/
  152.         /*%FSM<LINK "Objects_need_upd">*/
  153.         class Objects_need_upd
  154.         {
  155.           priority = 1.000000;
  156.           to="update_objects";
  157.           precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  158.           condition=/*%FSM<CONDITION""">*/"(( (count needUpdate_objects) > 0) && (diag_tickTime -_lastNeedUpdate> 5) && (!isNil ""sm_done""))"/*%FSM</CONDITION""">*/;
  159.           action=/*%FSM<ACTION""">*/"_lastNeedUpdate = diag_tickTime;"/*%FSM</ACTION""">*/;
  160.         };
  161.         /*%FSM</LINK>*/
  162.         /*%FSM<LINK "true">*/
  163.         class true
  164.         {
  165.           priority = 0.000000;
  166.           to="general_cleanup";
  167.           precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  168.           condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
  169.           action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  170.         };
  171.         /*%FSM</LINK>*/
  172.       };
  173.     };
  174.     /*%FSM</STATE>*/
  175.     /*%FSM<STATE "cleanup_dead">*/
  176.     class cleanup_dead
  177.     {
  178.       name = "cleanup_dead";
  179.       init = /*%FSM<STATEINIT""">*/"diag_log (""CLEANUP: PERFORMING BODY CLEANUP"");" \n
  180.        "" \n
  181.        "diag_log (""CLEANUP:TOTAL BODYS: "" + str(_numDead));" \n
  182.        "" \n
  183.        "_delQtyP = 0;" \n
  184.        "_delQtyZ = 0;" \n
  185.        "_delQtyFL = 0;" \n
  186.        "_delQtyFL1 = 0;" \n
  187.        "_delQtyFP = 0;" \n
  188.        "" \n
  189.        "{" \n
  190.        "    if (local _x) then {" \n
  191.        "        if (_x isKindOf ""zZombie_Base"") then {" \n
  192.        "                deleteVehicle _x;" \n
  193.        "                _delQtyZ = _delQtyZ + 1;" \n
  194.        "        };" \n
  195.        "" \n
  196.        "        if (_x isKindOf ""CAManBase"") then {" \n
  197.        "            _deathTime = _x getVariable [""processedDeath"", diag_tickTime];" \n
  198.        "            if (diag_tickTime - _deathTime > 1200) then {" \n
  199.        "            /*" \n
  200.        "                _flies = nearestObject [_x, ""Sound_Flies""];" \n
  201.        "                if (!isNull _flies) then {" \n
  202.        "                    deleteVehicle _flies;" \n
  203.        "                    _delQtyFL = _delQtyFL + 1;" \n
  204.        "                }; " \n
  205.        "            */" \n
  206.        "                deleteVehicle _x;" \n
  207.        "                _delQtyP = _delQtyP + 1;" \n
  208.        "            };" \n
  209.        "        };" \n
  210.        "        if (_x isKindOf ""Seagull"") then {" \n
  211.        "                _myGroupX = group _x;" \n
  212.        "                _x removeAllMPEventHandlers ""mpkilled"";" \n
  213.        "                _x removeAllMPEventHandlers ""mphit"";" \n
  214.        "                _x removeAllMPEventHandlers ""mprespawn"";" \n
  215.        "                _x removeAllEventHandlers ""FiredNear"";" \n
  216.        "                _x removeAllEventHandlers ""HandleDamage"";" \n
  217.        "                _x removeAllEventHandlers ""Killed"";" \n
  218.        "                _x removeAllEventHandlers ""Fired"";" \n
  219.        "                _x removeAllEventHandlers ""GetOut"";" \n
  220.        "                _x removeAllEventHandlers ""Local"";" \n
  221.        "                clearVehicleInit _x;" \n
  222.        "                deleteVehicle _x;" \n
  223.        "                deleteGroup _myGroupX;" \n
  224.        "                _x = nil;" \n
  225.        "        };" \n
  226.        "                _myGroupX = group _x;" \n
  227.        "                _x removeAllMPEventHandlers ""mpkilled"";" \n
  228.        "                _x removeAllMPEventHandlers ""mphit"";" \n
  229.        "                _x removeAllMPEventHandlers ""mprespawn"";" \n
  230.        "                _x removeAllEventHandlers ""FiredNear"";" \n
  231.        "                _x removeAllEventHandlers ""HandleDamage"";" \n
  232.        "                _x removeAllEventHandlers ""Killed"";" \n
  233.        "                _x removeAllEventHandlers ""Fired"";" \n
  234.        "                _x removeAllEventHandlers ""GetOut"";" \n
  235.        "                _x removeAllEventHandlers ""Local"";" \n
  236.        "                clearVehicleInit _x;" \n
  237.        "                deleteVehicle _x;" \n
  238.        "                deleteGroup _myGroupX;" \n
  239.        "                _x = nil;   " \n
  240.        "    };" \n
  241.        "} forEach allDead;" \n
  242.        "" \n
  243.        "{" \n
  244.        "    if ({!alive _x} count (nearestObjects [_x, [""CAManBase""], 10]) >= 0) then {" \n
  245.        "        deleteVehicle _x;" \n
  246.        "        _delQtyFL1 = _delQtyFL1 + 1;" \n
  247.        "    };" \n
  248.        "} forEach allMissionObjects ""Sound_Flies"";" \n
  249.        "" \n
  250.        "{" \n
  251.        "    if (local _x) then {" \n
  252.        "        deleteVehicle _x;" \n
  253.        "        _delQtyFP = _delQtyFP + 1;" \n
  254.        "    };" \n
  255.        "} forEach allMissionObjects ""Land_Fire_DZ"";" \n
  256.        "" \n
  257.        "diag_log (format[""CLEANUP: Deleted %1 players, %2 zombies, %3/%5 flies and %4 fireplaces."",_delQtyP,_delQtyZ,_delQtyFL,_delQtyFP,_delQtyFL1]);" \n
  258.        "" \n
  259.        "//diag_log (""CLEANUP: Deleted "" + str(_delQtyP) + "" players, "" + str(_delQtyZ) + "" zombies, "" + str(_delQtyFL) + "" flies, and "" + str(_delQtyFP) +  "" fireplaces"");"/*%FSM</STATEINIT""">*/;
  260.       precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  261.       class Links
  262.       {
  263.         /*%FSM<LINK "true">*/
  264.         class true
  265.         {
  266.           priority = 0.000000;
  267.           to="general_cleanup";
  268.           precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  269.           condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
  270.           action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  271.         };
  272.         /*%FSM</LINK>*/
  273.       };
  274.     };
  275.     /*%FSM</STATE>*/
  276.     /*%FSM<STATE "cleanup_objects">*/
  277.     class cleanup_objects
  278.     {
  279.       name = "cleanup_objects";
  280.       init = /*%FSM<STATEINIT""">*/"_missionObjs =  allMissionObjects ""ReammoBox"";" \n
  281.        "_qty = count _missionObjs;" \n
  282.        "" \n
  283.        "diag_log (""CLEANUP:TOTAL "" + str(_qty) + "" LOOT BAGS"");" \n
  284.        "_dateNow = diag_ticktime;" \n
  285.        "_delQty = 0;" \n
  286.        "" \n
  287.        "{" \n
  288.        "    _created = (_x getVariable [""created"",-0.1]);" \n
  289.        "    if (_created == -0.1) then {" \n
  290.        "        _x setVariable [""created"",diag_ticktime,false];" \n
  291.        "        _created = diag_ticktime;" \n
  292.        "    };" \n
  293.        "" \n
  294.        "    _keep = _x getVariable [""permaLoot"",false];" \n
  295.        "    _age = (_dateNow - _created);" \n
  296.        "    _nearby = {(isPlayer _x) and (alive _x)} count (_x nearEntities [[""CAManBase"",""AllVehicles""], 130]);" \n
  297.        "    if ( (!_keep) && (_nearby==0) && (_age > 20)) then {" \n
  298.        "        deleteVehicle _x;" \n
  299.        "        _delQty = _delQty + 1;" \n
  300.        "    };" \n
  301.        "" \n
  302.        "} forEach _missionObjs;" \n
  303.        "" \n
  304.        "if (_delQty > 0) then {" \n
  305.        "    diag_log (""CLEANUP: DELETED "" + str(_delQty) + "" LOOT BAGS"");" \n
  306.        "};"/*%FSM</STATEINIT""">*/;
  307.       precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  308.       class Links
  309.       {
  310.         /*%FSM<LINK "true">*/
  311.         class true
  312.         {
  313.           priority = 0.000000;
  314.           to="general_cleanup";
  315.           precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  316.           condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
  317.           action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  318.         };
  319.         /*%FSM</LINK>*/
  320.       };
  321.     };
  322.     /*%FSM</STATE>*/
  323.     /*%FSM<STATE "sync_the_time">*/
  324.     class sync_the_time
  325.     {
  326.       name = "sync_the_time";
  327.       init = /*%FSM<STATEINIT""">*/"//Send request" \n
  328.        "_key = ""CHILD:307:"";" \n
  329.        "_result = _key call server_hiveReadWrite;" \n
  330.        "_outcome = _result select 0;" \n
  331.        "" \n
  332.        "if(_outcome == ""PASS"") then {" \n
  333.        "    _date = _result select 1;" \n
  334.        "" \n
  335.        "    //date setup" \n
  336.        "    _year = _date select 0;" \n
  337.        "    _month = _date select 1;" \n
  338.        "    _day = _date select 2;" \n
  339.        "    _hour = _date select 3;" \n
  340.        "    _minute = _date select 4;" \n
  341.        "" \n
  342.        "    if (dayz_ForcefullmoonNights) then {" \n
  343.        "        _date = [2012,6,6,_hour,_minute];" \n
  344.        "    };" \n
  345.        "" \n
  346.        "    setDate _date;" \n
  347.        "    dayzSetDate = _date;" \n
  348.        "    publicVariable ""dayzSetDate"";" \n
  349.        "    diag_log (""TIME SYNC: Local Time set to "" + str(_date));" \n
  350.        "}"/*%FSM</STATEINIT""">*/;
  351.       precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  352.       class Links
  353.       {
  354.         /*%FSM<LINK "true">*/
  355.         class true
  356.         {
  357.           priority = 0.000000;
  358.           to="general_cleanup";
  359.           precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  360.           condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
  361.           action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  362.         };
  363.         /*%FSM</LINK>*/
  364.       };
  365.     };
  366.     /*%FSM</STATE>*/
  367.     /*%FSM<STATE "general_cleanup">*/
  368.     class general_cleanup
  369.     {
  370.       name = "general_cleanup";
  371.       init = /*%FSM<STATEINIT""">*/"//Clean groups" \n
  372.        "{" \n
  373.        "    //diag_log (""CLEANUP: CHECKING GROUP WITH "" + str(count units _x) + "" UNITS"");" \n
  374.        "    if (count units _x==0) then {" \n
  375.        "        deleteGroup _x;" \n
  376.        "        //diag_log (""CLEANUP: DELETING A GROUP"");" \n
  377.        "    };" \n
  378.        "} forEach allGroups;" \n
  379.        "" \n
  380.        "//Check for hackers" \n
  381.        " {" \n
  382.        "     if(vehicle _x != _x && !(vehicle _x in _safety) && (typeOf vehicle _x) != ""ParachuteWest""  && (vehicle _x getVariable [""SafeVehicle"",0] != 1)) then {" \n
  383.        "        diag_log (""CLEANUP: KILLING A HACKER "" + (name _x) + "" "" + str(_x) + "" IN "" + (typeOf vehicle _x));" \n
  384.        "        (vehicle _x) setDamage 1;" \n
  385.        "        _x setDamage 1;" \n
  386.        "     };" \n
  387.        " } forEach allUnits;" \n
  388.        "" \n
  389.        "dayz_serverObjectMonitor = _safety;"/*%FSM</STATEINIT""">*/;
  390.       precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  391.       class Links
  392.       {
  393.         /*%FSM<LINK "true">*/
  394.         class true
  395.         {
  396.           priority = 0.000000;
  397.           to="waiting";
  398.           precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  399.           condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
  400.           action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  401.         };
  402.         /*%FSM</LINK>*/
  403.       };
  404.     };
  405.     /*%FSM</STATE>*/
  406.     /*%FSM<STATE "prepare">*/
  407.     class prepare
  408.     {
  409.       name = "prepare";
  410.       init = /*%FSM<STATEINIT""">*/"diag_log (""CLEANUP: INITIALIZING CLEANUP SCRIPT"");" \n
  411.        "" \n
  412.        "_safety = dayz_serverObjectMonitor;" \n
  413.        "_dateNow = (DateToNumber date);" \n
  414.        "" \n
  415.        "_lastUpdate = diag_tickTime;" \n
  416.        "_timeNem =diag_tickTime;" \n
  417.        "_deadBodies = [];" \n
  418.        "_lastNeedUpdate = diag_tickTime;" \n
  419.        "_timeout = diag_tickTime;" \n
  420.        "_maxBodies = 15;" \n
  421.        "" \n
  422.        "_lootspawnerfdbykr = diag_tickTime; " \n
  423.        "_reseedloot = false;" \n
  424.        "" \n
  425.        "_amount = 0;" \n
  426.        "_hour = 0;" \n
  427.        "_minute = 0;"/*%FSM</STATEINIT""">*/;
  428.       precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  429.       class Links
  430.       {
  431.         /*%FSM<LINK "true">*/
  432.         class true
  433.         {
  434.           priority = 0.000000;
  435.           to="waiting";
  436.           precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  437.           condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
  438.           action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  439.         };
  440.         /*%FSM</LINK>*/
  441.       };
  442.     };
  443.     /*%FSM</STATE>*/
  444.     /*%FSM<STATE "update_objects">*/
  445.     class update_objects
  446.     {
  447.       name = "update_objects";
  448.       init = /*%FSM<STATEINIT""">*/"diag_log format[""DEBUG: needUpdate_objects=%1"",needUpdate_objects];" \n
  449.        "" \n
  450.        "{" \n
  451.        "//  _x setVariable [""needUpdate"",false,true];" \n
  452.        "    needUpdate_objects = needUpdate_objects - [_x];" \n
  453.        "    [_x,""damage"",true] call server_updateObject;" \n
  454.        "} forEach needUpdate_objects;" \n
  455.        ""/*%FSM</STATEINIT""">*/;
  456.       precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  457.       class Links
  458.       {
  459.         /*%FSM<LINK "true">*/
  460.         class true
  461.         {
  462.           priority = 0.000000;
  463.           to="general_cleanup";
  464.           precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  465.           condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
  466.           action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  467.         };
  468.         /*%FSM</LINK>*/
  469.       };
  470.     };
  471.     /*%FSM</STATE>*/
  472.     /*%FSM<STATE "Start_Loot_Spawn">*/
  473.     class Start_Loot_Spawn
  474.     {
  475.       name = "Start_Loot_Spawn";
  476.       init = /*%FSM<STATEINIT""">*/"" \n
  477.        "{" \n
  478.        "    diag_log (""Starting reseed Loot"");" \n
  479.        "" \n
  480.        "    _x spawn dayz_reseed;" \n
  481.        "" \n
  482.        "    dayz_seedloot set [0,-1];" \n
  483.        "    dayz_seedloot = dayz_seedloot - [-1];" \n
  484.        "" \n
  485.        "" \n
  486.        "} forEach dayz_seedloot;" \n
  487.        "" \n
  488.        ""/*%FSM</STATEINIT""">*/;
  489.       precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  490.       class Links
  491.       {
  492.         /*%FSM<LINK "true">*/
  493.         class true
  494.         {
  495.           priority = 0.000000;
  496.           to="general_cleanup";
  497.           precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  498.           condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
  499.           action=/*%FSM<ACTION""">*/"diag_log (""Started reseeding Loot"");" \n
  500.            "" \n
  501.            "_reseedloot = false;"/*%FSM</ACTION""">*/;
  502.         };
  503.         /*%FSM</LINK>*/
  504.       };
  505.     };
  506.     /*%FSM</STATE>*/
  507.     /*%FSM<STATE "New_Cleanup_Obje">*/
  508.     class New_Cleanup_Obje
  509.     {
  510.       name = "New_Cleanup_Obje";
  511.       init = /*%FSM<STATEINIT""">*/"" \n
  512.        "_lootingrids = [];" \n
  513.        "" \n
  514.        "{" \n
  515.        "    _loc = _x select 0;" \n
  516.        "    _ref = _x select 1;" \n
  517.        "" \n
  518.        "    _nearBy = nearestObjects [_loc, [""ReammoBox""], 1500];" \n
  519.        "    {" \n
  520.        "        _lootingrids set [count _lootingrids,[_x,_ref]];" \n
  521.        "    } foreach _nearBy;" \n
  522.        "" \n
  523.        "    dayz_deseedloot set [0,-1];" \n
  524.        "    dayz_deseedloot = dayz_deseedloot - [-1];" \n
  525.        "" \n
  526.        "}foreach dayz_deseedloot;" \n
  527.        "" \n
  528.        "_qty = count _lootingrids;" \n
  529.        "diag_log (""CLEANUP:TOTAL "" + str(_qty) + "" LOOT BAGS"");" \n
  530.        "" \n
  531.        "_delQty = 0;" \n
  532.        "_delQtyDroped = 0;" \n
  533.        "_delQtySpawned = 0;" \n
  534.        "_delQtyPerma = 0;" \n
  535.        "" \n
  536.        "{" \n
  537.        "    " \n
  538.        "    _obj = _x select 0;" \n
  539.        "    _ref = _x select 1;" \n
  540.        "" \n
  541.        "    diag_log format [""%1,%2"", _obj, _ref];" \n
  542.        "" \n
  543.        "    _Dropped = (_obj getVariable [""Dropped"",false]);" \n
  544.        "    _Spawned = (_obj getVariable [""spawnedLoot"",false]);" \n
  545.        "    _Perma = (_obj getVariable [""permaLoot"",false]);" \n
  546.        "" \n
  547.        "    if (!_Spawned and !_Perma) then {" \n
  548.        "        _obj setVariable [""Dropped"",true];" \n
  549.        "    };" \n
  550.        "" \n
  551.        "    //Dropped loot" \n
  552.        "    if (_Dropped) then {" \n
  553.        "    " \n
  554.        "        [""Dropped_Loot"",_obj,_ref] call server_systemCleanup;" \n
  555.        "        _delQtyDroped = _delQtyDroped + 1;" \n
  556.        "" \n
  557.        "    };" \n
  558.        "" \n
  559.        "    //Spawned Loot" \n
  560.        "    if (_Spawned) then {" \n
  561.        "" \n
  562.        "        [""Spawned_Loot"",_obj,_ref] call server_systemCleanup;" \n
  563.        "        _delQtySpawned = _delQtySpawned + 1;    " \n
  564.        "    " \n
  565.        "    };" \n
  566.        "" \n
  567.        "    //Permaloot" \n
  568.        "    if (_Perma) then {" \n
  569.        "" \n
  570.        "        _delQtyPerma = _delQtyPerma + 1;" \n
  571.        "" \n
  572.        "    };" \n
  573.        "" \n
  574.        "} foreach _lootingrids;" \n
  575.        "" \n
  576.        "if ((_delQtySpawned > 0) or (_delQtyDroped > 0) or (_delQtyPerma > 0)) then {" \n
  577.        "    //diag_log (""CLEANUP: DELETED "" + str(_delQty) + "" LOOT BAGS"");" \n
  578.        "    diag_log format [""CLEANUP: (DELETED, DroppedLoot: %1, SpawnedLoot: %2), (KEPT, PermaLoot: %3)"", _delQtyDroped, _delQtySpawned, _delQtyPerma];" \n
  579.        "};" \n
  580.        ""/*%FSM</STATEINIT""">*/;
  581.       precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  582.       class Links
  583.       {
  584.       };
  585.     };
  586.     /*%FSM</STATE>*/
  587.     /*%FSM<STATE "_">*/
  588.     class _
  589.     {
  590.       name = "_";
  591.       init = /*%FSM<STATEINIT""">*/"_key = ""CHILD:307:"";" \n
  592.        "_result = _key call server_hiveReadWrite;" \n
  593.        "_outcome = _result select 0;" \n
  594.        "" \n
  595.        "" \n
  596.        ""/*%FSM</STATEINIT""">*/;
  597.       precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  598.       class Links
  599.       {
  600.         /*%FSM<LINK "_">*/
  601.         class _
  602.         {
  603.           priority = 0.000000;
  604.           to="____FAKE____";
  605.           precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  606.           condition=/*%FSM<CONDITION""">*/"(_outcome == ""PASS"")"/*%FSM</CONDITION""">*/;
  607.           action=/*%FSM<ACTION""">*/"_date = _result select 1;" \n
  608.            "" \n
  609.            "_y = _date select 0;" \n
  610.            "_mn = _date select 1;" \n
  611.            "_d =_date select 2;" \n
  612.            "_h = _date select 3;" \n
  613.            "_m = _date select 4;" \n
  614.            "" \n
  615.            "if ((_h > 20) or (_h < 4)) then {" \n
  616.            "    _h = 5;" \n
  617.            "};" \n
  618.            "" \n
  619.            "_date = [_y,_mn,_d,_h,_m];"/*%FSM</ACTION""">*/;
  620.         };
  621.         /*%FSM</LINK>*/
  622.       };
  623.     };
  624.     /*%FSM</STATE>*/
  625.     /*%FSM<STATE "____FAKE____">*/
  626.     class ____FAKE____
  627.     {
  628.       name = "____FAKE____";
  629.       init = /*%FSM<STATEINIT""">*/""/*%FSM</STATEINIT""">*/;
  630.       precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  631.       class Links
  632.       {
  633.         /*%FSM<LINK "LootSpawn">*/
  634.         class LootSpawn
  635.         {
  636.           priority = 2.000000;
  637.           to="Start_Loot_Spawn";
  638.           precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  639.           condition=/*%FSM<CONDITION""">*/"(((count dayz_seedloot) > 0) && (!isNil ""sm_done""))"/*%FSM</CONDITION""">*/;
  640.           action=/*%FSM<ACTION""">*/"_lootspawnerfdbykr = diag_tickTime;"/*%FSM</ACTION""">*/;
  641.         };
  642.         /*%FSM</LINK>*/
  643.       };
  644.     };
  645.     /*%FSM</STATE>*/
  646.   };
  647.   initState="init";
  648.   finalStates[] =
  649.   {
  650.   };
  651. };
  652. /*%FSM</COMPILE>*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement