Guest User

server_cleanup.fsm

a guest
Sep 24th, 2013
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.65 KB | None | 0 0
  1. /*%FSM<COMPILE "F:\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,-400.000000,25.000000,-350.000000,0.000000,"init"};
  5. item1[] = {"true",8,218,-75.000000,-175.000000,25.000000,-125.000000,0.000000,"true"};
  6. item2[] = {"waiting",2,250,-75.000000,-100.000000,25.000000,-50.000000,0.000000,"waiting"};
  7. item3[] = {"time_sync",4,218,-275.000000,-25.000000,-175.000000,25.000000,1.000000,"time" \n "sync"};
  8. item4[] = {"sync_the_time",2,250,-275.000000,50.000000,-175.000000,100.000000,0.000000,"sync" \n "the time"};
  9. item5[] = {"true",8,218,-75.000000,125.000000,25.000000,175.000000,0.000000,"true"};
  10. item6[] = {"general_cleanup",2,250,-75.000000,200.000000,25.000000,250.000000,0.000000,"general" \n "cleanup" \n "loop"};
  11. item7[] = {"",7,210,-304.000000,220.999985,-296.000000,229.000015,0.000000,""};
  12. item8[] = {"",7,210,-304.000000,-154.000000,-296.000000,-146.000000,0.000000,""};
  13. item9[] = {"",7,210,221.000000,-79.000000,229.000000,-71.000000,0.000000,""};
  14. item10[] = {"",7,210,221.000000,146.000000,229.000000,154.000000,0.000000,""};
  15. item11[] = {"initialized",4,218,-75.000000,-325.000000,25.000000,-275.000000,0.000000,"initialized"};
  16. item12[] = {"prepare",2,250,-75.000000,-250.000000,25.000000,-200.000000,0.000000,"prepare"};
  17. item13[] = {"update_objects",2,250,100.000000,50.000000,200.000000,100.000000,0.000000,"update objects"};
  18. item14[] = {"need_update",4,218,100.000000,-25.000000,200.000000,25.000000,1.000000,"need update"};
  19. item15[] = {"",7,210,221.000000,-79.000000,229.000000,-71.000000,0.000000,""};
  20. item16[] = {"cleanup_groups",4,218,-150.000000,-25.000000,-50.000000,25.000000,1.000000,"cleanup" \n "groups"};
  21. item17[] = {"group_cleanup",2,250,-150.000000,50.000000,-50.000000,100.000000,0.000000,"group" \n "cleanup"};
  22. item18[] = {"cleanup_vehicles",4,218,-25.000000,-25.000000,75.000000,25.000000,1.000000,"cleanup" \n "vehicles"};
  23. item19[] = {"vehicle_cleanup",2,4346,-25.000000,50.000000,75.000000,100.000000,0.000000,"vehicle" \n "cleanup"};
  24. link0[] = {0,11};
  25. link1[] = {1,2};
  26. link2[] = {2,3};
  27. link3[] = {2,9};
  28. link4[] = {2,14};
  29. link5[] = {2,16};
  30. link6[] = {2,18};
  31. link7[] = {3,4};
  32. link8[] = {4,5};
  33. link9[] = {5,6};
  34. link10[] = {6,7};
  35. link11[] = {7,8};
  36. link12[] = {8,1};
  37. link13[] = {9,10};
  38. link14[] = {9,15};
  39. link15[] = {10,5};
  40. link16[] = {11,12};
  41. link17[] = {12,1};
  42. link18[] = {13,5};
  43. link19[] = {14,13};
  44. link20[] = {16,17};
  45. link21[] = {17,5};
  46. link22[] = {18,19};
  47. link23[] = {19,5};
  48. globals[] = {25.000000,1,0,0,0,640,480,1,30,6316128,1,-419.782135,377.473389,510.243530,-212.601486,675,612,1};
  49. window[] = {0,-1,-1,-1,-1,810,52,1330,52,1,693};
  50. *//*%FSM</HEAD>*/
  51. class FSM
  52. {
  53. fsmName = "DayZ Server Cleanup";
  54. class States
  55. {
  56. /*%FSM<STATE "init">*/
  57. class init
  58. {
  59. name = "init";
  60. init = /*%FSM<STATEINIT""">*/""/*%FSM</STATEINIT""">*/;
  61. precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  62. class Links
  63. {
  64. /*%FSM<LINK "initialized">*/
  65. class initialized
  66. {
  67. priority = 0.000000;
  68. to="prepare";
  69. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  70. condition=/*%FSM<CONDITION""">*/"!isnil ""bis_fnc_init"""/*%FSM</CONDITION""">*/;
  71. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  72. };
  73. /*%FSM</LINK>*/
  74. };
  75. };
  76. /*%FSM</STATE>*/
  77. /*%FSM<STATE "waiting">*/
  78. class waiting
  79. {
  80. name = "waiting";
  81. init = /*%FSM<STATEINIT""">*/"//diag_log ""CLEANUP: Waiting for next task"";" \n
  82. ""/*%FSM</STATEINIT""">*/;
  83. precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  84. class Links
  85. {
  86. /*%FSM<LINK "need_update">*/
  87. class need_update
  88. {
  89. priority = 1.000000;
  90. to="update_objects";
  91. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  92. condition=/*%FSM<CONDITION""">*/"( (count needUpdate_objects) > 0 && (diag_tickTime -_lastNeedUpdate>40) )"/*%FSM</CONDITION""">*/;
  93. action=/*%FSM<ACTION""">*/"_lastNeedUpdate = diag_tickTime;"/*%FSM</ACTION""">*/;
  94. };
  95. /*%FSM</LINK>*/
  96. /*%FSM<LINK "cleanup_groups">*/
  97. class cleanup_groups
  98. {
  99. priority = 1.000000;
  100. to="group_cleanup";
  101. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  102. condition=/*%FSM<CONDITION""">*/"((diag_tickTime - _lastCleanupGroups) > 10)"/*%FSM</CONDITION""">*/;
  103. action=/*%FSM<ACTION""">*/"_lastCleanupGroups = diag_tickTime;"/*%FSM</ACTION""">*/;
  104. };
  105. /*%FSM</LINK>*/
  106. /*%FSM<LINK "cleanup_vehicles">*/
  107. class cleanup_vehicles
  108. {
  109. priority = 1.000000;
  110. to="vehicle_cleanup";
  111. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  112. condition=/*%FSM<CONDITION""">*/"((diag_tickTime - _lastCleanupVehicles) > 5)"/*%FSM</CONDITION""">*/;
  113. action=/*%FSM<ACTION""">*/"_lastCleanupVehicles = diag_tickTime;"/*%FSM</ACTION""">*/;
  114. };
  115. /*%FSM</LINK>*/
  116. /*%FSM<LINK "time_sync">*/
  117. class time_sync
  118. {
  119. priority = 1.000000;
  120. to="sync_the_time";
  121. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  122. condition=/*%FSM<CONDITION""">*/"((diag_tickTime - _lastUpdate) > 300)"/*%FSM</CONDITION""">*/;
  123. action=/*%FSM<ACTION""">*/"_lastUpdate = diag_tickTime;"/*%FSM</ACTION""">*/;
  124. };
  125. /*%FSM</LINK>*/
  126. /*%FSM<LINK "true">*/
  127. class true
  128. {
  129. priority = 0.000000;
  130. to="general_cleanup";
  131. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  132. condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
  133. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  134. };
  135. /*%FSM</LINK>*/
  136. };
  137. };
  138. /*%FSM</STATE>*/
  139. /*%FSM<STATE "sync_the_time">*/
  140. class sync_the_time
  141. {
  142. name = "sync_the_time";
  143. init = /*%FSM<STATEINIT""">*/"//Send request" \n
  144. "_key = ""CHILD:307:"";" \n
  145. "_result = _key call server_hiveReadWrite;" \n
  146. "_outcome = _result select 0;" \n
  147. "if(_outcome == ""PASS"") then {" \n
  148. " _date = _result select 1; " \n
  149. " " \n
  150. " if(dayz_fullMoonNights) then {" \n
  151. " //date setup" \n
  152. " _year = _date select 0;" \n
  153. " _month = _date select 1;" \n
  154. " _day = _date select 2;" \n
  155. " _hour = _date select 3;" \n
  156. " _minute = _date select 4;" \n
  157. " " \n
  158. " //Force full moon nights" \n
  159. " _date = [2012,6,6,_hour,_minute];" \n
  160. " };" \n
  161. "" \n
  162. " setDate _date;" \n
  163. " dayzSetDate = _date;" \n
  164. " publicVariable ""dayzSetDate"";" \n
  165. " diag_log (""TIME SYNC: Local Time set to "" + str(_date)); " \n
  166. "};" \n
  167. ""/*%FSM</STATEINIT""">*/;
  168. precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  169. class Links
  170. {
  171. /*%FSM<LINK "true">*/
  172. class true
  173. {
  174. priority = 0.000000;
  175. to="general_cleanup";
  176. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  177. condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
  178. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  179. };
  180. /*%FSM</LINK>*/
  181. };
  182. };
  183. /*%FSM</STATE>*/
  184. /*%FSM<STATE "general_cleanup">*/
  185. class general_cleanup
  186. {
  187. name = "general_cleanup";
  188. init = /*%FSM<STATEINIT""">*/"//diag_log ""CLEANUP: Starting loop for next task"";"/*%FSM</STATEINIT""">*/;
  189. precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  190. class Links
  191. {
  192. /*%FSM<LINK "true">*/
  193. class true
  194. {
  195. priority = 0.000000;
  196. to="waiting";
  197. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  198. condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
  199. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  200. };
  201. /*%FSM</LINK>*/
  202. };
  203. };
  204. /*%FSM</STATE>*/
  205. /*%FSM<STATE "prepare">*/
  206. class prepare
  207. {
  208. name = "prepare";
  209. init = /*%FSM<STATEINIT""">*/"diag_log (""CLEANUP: INITIALIZING CLEANUP SCRIPT"");" \n
  210. "" \n
  211. "_safety = dayz_serverObjectMonitor;" \n
  212. "//_dateNow = (DateToNumber date);" \n
  213. "" \n
  214. "_lastUpdate = diag_tickTime;" \n
  215. "_lastNeedUpdate = diag_tickTime;" \n
  216. "_lastCleanupVehicles = diag_tickTime;" \n
  217. "_lastCleanupGroups = diag_tickTime;" \n
  218. ""/*%FSM</STATEINIT""">*/;
  219. precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  220. class Links
  221. {
  222. /*%FSM<LINK "true">*/
  223. class true
  224. {
  225. priority = 0.000000;
  226. to="waiting";
  227. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  228. condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
  229. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  230. };
  231. /*%FSM</LINK>*/
  232. };
  233. };
  234. /*%FSM</STATE>*/
  235. /*%FSM<STATE "update_objects">*/
  236. class update_objects
  237. {
  238. name = "update_objects";
  239. init = /*%FSM<STATEINIT""">*/"//diag_log format[""DEBUG: needUpdate_objects=%1"",needUpdate_objects];" \n
  240. "{" \n
  241. " needUpdate_objects = needUpdate_objects - [_x];" \n
  242. " [_x,""all""] call server_updateObject;" \n
  243. "" \n
  244. "} forEach needUpdate_objects;"/*%FSM</STATEINIT""">*/;
  245. precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  246. class Links
  247. {
  248. /*%FSM<LINK "true">*/
  249. class true
  250. {
  251. priority = 0.000000;
  252. to="general_cleanup";
  253. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  254. condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
  255. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  256. };
  257. /*%FSM</LINK>*/
  258. };
  259. };
  260. /*%FSM</STATE>*/
  261. /*%FSM<STATE "group_cleanup">*/
  262. class group_cleanup
  263. {
  264. name = "group_cleanup";
  265. init = /*%FSM<STATEINIT""">*/"//Clean groups" \n
  266. "{" \n
  267. " // diag_log (""CLEANUP: CHECKING GROUP WITH "" + str(count units _x) + "" UNITS"");" \n
  268. " if (count units _x==0) then {" \n
  269. " deleteGroup _x;" \n
  270. " // diag_log (""CLEANUP: DELETING A GROUP"");" \n
  271. " };" \n
  272. "} forEach allGroups;" \n
  273. ""/*%FSM</STATEINIT""">*/;
  274. precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  275. class Links
  276. {
  277. /*%FSM<LINK "true">*/
  278. class true
  279. {
  280. priority = 0.000000;
  281. to="general_cleanup";
  282. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  283. condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
  284. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  285. };
  286. /*%FSM</LINK>*/
  287. };
  288. };
  289. /*%FSM</STATE>*/
  290. /*%FSM<STATE "vehicle_cleanup">*/
  291. class vehicle_cleanup
  292. {
  293. name = "vehicle_cleanup";
  294. init = /*%FSM<STATEINIT""">*/"_safety = dayz_serverObjectMonitor;" \n
  295. "" \n
  296. "//Check for hackers" \n
  297. " {" \n
  298. " if(vehicle _x != _x && (vehicle _x getVariable [""Mission"",0] != 1) && !(vehicle _x in _safety) && (typeOf vehicle _x) != ""ParachuteWest"") then {" \n
  299. " diag_log (""CLEANUP: KILLING A HACKER "" + (name _x) + "" "" + str(_x) + "" IN "" + (typeOf vehicle _x));" \n
  300. " (vehicle _x) setDamage 1;" \n
  301. " _x setDamage 1;" \n
  302. " };" \n
  303. " } forEach allUnits;" \n
  304. "" \n
  305. "dayz_serverObjectMonitor = _safety;"/*%FSM</STATEINIT""">*/;
  306. precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  307. class Links
  308. {
  309. /*%FSM<LINK "true">*/
  310. class true
  311. {
  312. priority = 0.000000;
  313. to="general_cleanup";
  314. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  315. condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
  316. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  317. };
  318. /*%FSM</LINK>*/
  319. };
  320. };
  321. /*%FSM</STATE>*/
  322. };
  323. initState="init";
  324. finalStates[] =
  325. {
  326. };
  327. };
  328. /*%FSM</COMPILE>*/
Advertisement
Add Comment
Please, Sign In to add comment