Advertisement
Guest User

Untitled

a guest
Jan 28th, 2013
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.17 KB | None | 0 0
  1. /*%FSM<COMPILE "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[] = {"too_many_dead",4,218,-150.000000,-25.000000,-50.000000,25.000000,2.000000,"too many" \n "dead"};
  8. item4[] = {"cleanup_dead",2,250,-150.000000,50.000000,-50.000000,100.000000,0.000000,"cleanup" \n "dead"};
  9. item5[] = {"too_many_objects",4,218,-25.000000,-25.000000,75.000000,25.000000,0.000000,"too many" \n "objects"};
  10. item6[] = {"cleanup_objects",2,250,-25.000000,50.000000,75.000000,100.000000,0.000000,"cleanup" \n "objects"};
  11. item7[] = {"time_sync",4,218,-275.000000,-25.000000,-175.000000,25.000000,1.000000,"time" \n "sync"};
  12. item8[] = {"sync_the_time",2,250,-275.000000,50.000000,-175.000000,100.000000,0.000000,"sync" \n "the time"};
  13. item9[] = {"true",8,218,-75.000000,125.000000,25.000000,175.000000,0.000000,"true"};
  14. item10[] = {"general_cleanup",2,250,-75.000000,200.000000,25.000000,250.000000,0.000000,"general" \n "cleanup"};
  15. item11[] = {"",7,210,-304.000000,220.999985,-296.000000,229.000015,0.000000,""};
  16. item12[] = {"",7,210,-304.000000,-154.000000,-296.000000,-146.000000,0.000000,""};
  17. item13[] = {"",7,210,221.000000,-79.000000,229.000000,-71.000000,0.000000,""};
  18. item14[] = {"",7,210,221.000000,146.000000,229.000000,154.000000,0.000000,""};
  19. item15[] = {"initialized",4,218,-75.000000,-325.000000,25.000000,-275.000000,0.000000,"initialized"};
  20. item16[] = {"prepare",2,250,-75.000000,-250.000000,25.000000,-200.000000,0.000000,"prepare"};
  21. item17[] = {"update_objects",2,4346,100.000000,50.000000,200.000000,100.000000,0.000000,"update objects"};
  22. item18[] = {"need_update",4,218,100.000000,-25.000000,200.000000,25.000000,1.000000,"need update"};
  23. item19[] = {"",7,210,221.000000,-79.000000,229.000000,-71.000000,0.000000,""};
  24. link0[] = {0,15};
  25. link1[] = {1,2};
  26. link2[] = {2,3};
  27. link3[] = {2,5};
  28. link4[] = {2,7};
  29. link5[] = {2,13};
  30. link6[] = {2,18};
  31. link7[] = {3,4};
  32. link8[] = {4,9};
  33. link9[] = {5,6};
  34. link10[] = {6,9};
  35. link11[] = {7,8};
  36. link12[] = {8,9};
  37. link13[] = {9,10};
  38. link14[] = {10,11};
  39. link15[] = {11,12};
  40. link16[] = {12,1};
  41. link17[] = {13,14};
  42. link18[] = {13,19};
  43. link19[] = {14,9};
  44. link20[] = {15,16};
  45. link21[] = {16,1};
  46. link22[] = {17,9};
  47. link23[] = {18,17};
  48. globals[] = {25.000000,1,0,0,0,640,480,1,24,6316128,1,-396.580658,354.272186,463.204498,-386.553192,911,1031,1};
  49. window[] = {2,-1,-1,-1,-1,1020,322,1651,78,3,929};
  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 "too_many_dead">*/
  87. class too_many_dead
  88. {
  89. priority = 2.000000;
  90. to="cleanup_dead";
  91. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  92. condition=/*%FSM<CONDITION""">*/"((time - _lastCleanDead) > 1200)"/*%FSM</CONDITION""">*/;
  93. action=/*%FSM<ACTION""">*/"_lastCleanDead = time;"/*%FSM</ACTION""">*/;
  94. };
  95. /*%FSM</LINK>*/
  96. /*%FSM<LINK "time_sync">*/
  97. class time_sync
  98. {
  99. priority = 1.000000;
  100. to="sync_the_time";
  101. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  102. condition=/*%FSM<CONDITION""">*/"((time - _lastSyncTime) > 3600)"/*%FSM</CONDITION""">*/;
  103. action=/*%FSM<ACTION""">*/"_lastSyncTime = time;"/*%FSM</ACTION""">*/;
  104. };
  105. /*%FSM</LINK>*/
  106. /*%FSM<LINK "need_update">*/
  107. class need_update
  108. {
  109. priority = 1.000000;
  110. to="update_objects";
  111. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  112. condition=/*%FSM<CONDITION""">*/"((count needUpdate_objects) > 0 && (time - _lastUpdateVeh > 10))"/*%FSM</CONDITION""">*/;
  113. action=/*%FSM<ACTION""">*/"_lastUpdateVeh = time;"/*%FSM</ACTION""">*/;
  114. };
  115. /*%FSM</LINK>*/
  116. /*%FSM<LINK "true">*/
  117. class true
  118. {
  119. priority = 0.000000;
  120. to="general_cleanup";
  121. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  122. condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
  123. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  124. };
  125. /*%FSM</LINK>*/
  126. /*%FSM<LINK "too_many_objects">*/
  127. class too_many_objects
  128. {
  129. priority = 0.000000;
  130. to="cleanup_objects";
  131. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  132. condition=/*%FSM<CONDITION""">*/"(time - _lastCleanObjs) > 600"/*%FSM</CONDITION""">*/;
  133. action=/*%FSM<ACTION""">*/"_lastCleanObjs = time;"/*%FSM</ACTION""">*/;
  134. };
  135. /*%FSM</LINK>*/
  136. };
  137. };
  138. /*%FSM</STATE>*/
  139. /*%FSM<STATE "cleanup_dead">*/
  140. class cleanup_dead
  141. {
  142. name = "cleanup_dead";
  143. init = /*%FSM<STATEINIT""">*/"diag_log (""CLEANUP: PERFORMING BODY CLEANUP"");" \n
  144. "" \n
  145. "_delQtyP = 0;" \n
  146. "_delQtyZ = 0;" \n
  147. "_delQtyFL = 0;" \n
  148. "_delQtyFP = 0;" \n
  149. "" \n
  150. "{" \n
  151. " if (local _x) then {" \n
  152. " if (_x isKindOf ""zZombie_Base"") then {" \n
  153. " deleteVehicle _x;" \n
  154. " _delQtyZ = _delQtyZ + 1;" \n
  155. " } else {" \n
  156. " if (_x isKindOf ""CAManBase"") then {" \n
  157. " _deathTime = _x getVariable [""processedDeath"", time];" \n
  158. " if (time - _deathTime > 1200) then {" \n
  159. " _flies = nearestObject [_x, ""Sound_Flies""];" \n
  160. " if (!isNull _flies) then {" \n
  161. " deleteVehicle _flies;" \n
  162. " _delQtyFL = _delQtyFL + 1;" \n
  163. " };" \n
  164. " deleteVehicle _x;" \n
  165. " _delQtyP = _delQtyP + 1;" \n
  166. " };" \n
  167. " };" \n
  168. " };" \n
  169. " };" \n
  170. "} forEach allDead;" \n
  171. "" \n
  172. "{" \n
  173. " if ({!alive _x} count (nearestObjects [_x, [""CAManBase""], 10]) >= 0) then {" \n
  174. " deleteVehicle _x;" \n
  175. " _delQtyFL = _delQtyFL + 1;" \n
  176. " };" \n
  177. "} forEach allMissionObjects ""Sound_Flies"";" \n
  178. "" \n
  179. "{" \n
  180. " if (local _x) then {" \n
  181. " deleteVehicle _x;" \n
  182. " _delQtyFP = _delQtyFP + 1;" \n
  183. " };" \n
  184. "} forEach allMissionObjects ""Land_Fire_DZ"";" \n
  185. "" \n
  186. "diag_log (""CLEANUP: Deleted "" + str(_delQtyP) + "" players, "" + str(_delQtyZ) + "" zombies, "" + str(_delQtyFL) + "" flies, and "" + str(_delQtyFP) + "" fireplaces"");" \n
  187. ""/*%FSM</STATEINIT""">*/;
  188. precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  189. class Links
  190. {
  191. /*%FSM<LINK "true">*/
  192. class true
  193. {
  194. priority = 0.000000;
  195. to="general_cleanup";
  196. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  197. condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
  198. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  199. };
  200. /*%FSM</LINK>*/
  201. };
  202. };
  203. /*%FSM</STATE>*/
  204. /*%FSM<STATE "cleanup_objects">*/
  205. class cleanup_objects
  206. {
  207. name = "cleanup_objects";
  208. init = /*%FSM<STATEINIT""">*/"_delQty = 0;" \n
  209. "//{" \n
  210. "// if (local _x) then {" \n
  211. "// _keep = _x getVariable [""permaLoot"",false];" \n
  212. "// _keep = (_keep || (({isPlayer _x} count (_x nearEntities [[""CAManBase""], 100])) > 0));" \n
  213. "// if (!_keep) then {" \n
  214. "// deleteVehicle _x;" \n
  215. "// _delQty = _delQty + 1;" \n
  216. "// };" \n
  217. "// };" \n
  218. "//} forEach allMissionObjects ""WeaponHolder"";" \n
  219. "//diag_log (""CLEANUP: Deleted "" + str(_delQty) + "" loot drops"");" \n
  220. ""/*%FSM</STATEINIT""">*/;
  221. precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  222. class Links
  223. {
  224. /*%FSM<LINK "true">*/
  225. class true
  226. {
  227. priority = 0.000000;
  228. to="general_cleanup";
  229. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  230. condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
  231. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  232. };
  233. /*%FSM</LINK>*/
  234. };
  235. };
  236. /*%FSM</STATE>*/
  237. /*%FSM<STATE "sync_the_time">*/
  238. class sync_the_time
  239. {
  240. name = "sync_the_time";
  241. init = /*%FSM<STATEINIT""">*/"//Send request" \n
  242. "_key = ""CHILD:307:"";" \n
  243. "_result = [_key] call server_hiveReadWrite;" \n
  244. "_outcome = _result select 0;" \n
  245. "if(_outcome == ""PASS"") then {" \n
  246. " _date = _result select 1; " \n
  247. " _dateDiff = (dateToNumber(_date) - dateToNumber(date)) * 365 * 24 * 60;" \n
  248. " if (abs(_dateDiff) > 5) then {" \n
  249. " setDate _date;" \n
  250. " dayzSetDate = _date;" \n
  251. " publicVariable ""dayzSetDate"";" \n
  252. " diag_log (""TIME SYNC: Local Time set to "" + str(_date));" \n
  253. " };" \n
  254. "};" \n
  255. ""/*%FSM</STATEINIT""">*/;
  256. precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  257. class Links
  258. {
  259. /*%FSM<LINK "true">*/
  260. class true
  261. {
  262. priority = 0.000000;
  263. to="general_cleanup";
  264. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  265. condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
  266. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  267. };
  268. /*%FSM</LINK>*/
  269. };
  270. };
  271. /*%FSM</STATE>*/
  272. /*%FSM<STATE "general_cleanup">*/
  273. class general_cleanup
  274. {
  275. name = "general_cleanup";
  276. init = /*%FSM<STATEINIT""">*/"//Clean groups" \n
  277. "{" \n
  278. " //diag_log (""CLEANUP: CHECKING GROUP WITH "" + str(count units _x) + "" UNITS"");" \n
  279. " if (count units _x==0) then {" \n
  280. " deleteGroup _x;" \n
  281. " //diag_log (""CLEANUP: DELETING A GROUP"");" \n
  282. " };" \n
  283. "} forEach allGroups;" \n
  284. "" \n
  285. "//Check for hackers" \n
  286. " {" \n
  287. " if(vehicle _x != _x && !(vehicle _x in _safety) && (typeOf vehicle _x) != ""ParachuteWest"") then {" \n
  288. " diag_log (""CLEANUP: KILLING A HACKER "" + (name _x) + "" "" + str(_x) + "" IN "" + (typeOf vehicle _x));" \n
  289. " (vehicle _x) setDamage 1;" \n
  290. " _x setDamage 1;" \n
  291. " };" \n
  292. " } forEach allUnits;" \n
  293. "" \n
  294. "dayz_serverObjectMonitor = _safety;"/*%FSM</STATEINIT""">*/;
  295. precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  296. class Links
  297. {
  298. /*%FSM<STATE "check_for_hacker">*/
  299. class check_for_hacker
  300. {
  301. name = "check_for_hacker";
  302. init = /*%FSM<STATEINIT""">*/"//Check for hackers" \n
  303. " {" \n
  304. " if(vehicle _x != _x) then {" \n
  305. " if (!(vehicle _x in _safety) && ((typeOf vehicle _x) != ""ParachuteWest"")) then {" \n
  306. " diag_log (""CLEANUP: KILLING A HACKER "" + (name _x) + "" "" + str(_x) + "" IN "" + (typeOf vehicle _x));" \n
  307. " (vehicle _x) setDamage 1;" \n
  308. " _x setDamage 1;" \n
  309. " };" \n
  310. " } else {" \n
  311. " if (isPlayer _x) then {" \n
  312. " _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
  313. " {" \n
  314. " _box = _x;" \n
  315. " _weap = getWeaponCargo _box;" \n
  316. " _players_nearby = _box nearEntities [AllPlayers, 50];" \n
  317. " if (str(_weap) != '[[],[]]') then {" \n
  318. " diag_log(""pyBEscanner - Hack Box - "" + str(_players_nearby));" \n
  319. " {" \n
  320. " diag_log(""pyBEscanner - Hack Box - "" + str(_box distance _x) + "" - "" + str(_x));" \n
  321. " } forEach _players_nearby;" \n
  322. " deleteVehicle _box;" \n
  323. " diag_log (""pyBEscanner - Hack Box - Weapons list is "" + str(_box) + "" "" + str(_weap));" \n
  324. " diag_log(""pyBEscanner - Hack Box - Deleting cheat box"");" \n
  325. " diag_log(""pyBEscanner - Hack Box - End"");" \n
  326. " };" \n
  327. " } forEach _boxes;" \n
  328. " };" \n
  329. " };" \n
  330. " } forEach allUnits;"/*%FSM</STATEINIT""">*/;
  331. /*%FSM<LINK "true">*/
  332. class true
  333. {
  334. priority = 0.000000;
  335. to="waiting";
  336. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  337. condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
  338. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  339. };
  340. /*%FSM</LINK>*/
  341. };
  342. };
  343. /*%FSM</STATE>*/
  344. /*%FSM<STATE "prepare">*/
  345. class prepare
  346. {
  347. name = "prepare";
  348. init = /*%FSM<STATEINIT""">*/"private [""_safety"", ""_lastSyncTime"", ""_lastCleanDead"", ""_lastCleanObjs"", ""_lastUpdateVeh""];" \n
  349. "diag_log (""CLEANUP: INITIALIZING CLEANUP SCRIPT"");" \n
  350. "" \n
  351. "_safety = dayz_serverObjectMonitor;" \n
  352. "" \n
  353. "_lastSyncTime = time;" \n
  354. "_lastCleanDead = time;" \n
  355. "_lastCleanObjs = time;" \n
  356. "_lastUpdateVeh = time;"/*%FSM</STATEINIT""">*/;
  357. precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  358. class Links
  359. {
  360. /*%FSM<LINK "true">*/
  361. class true
  362. {
  363. priority = 0.000000;
  364. to="waiting";
  365. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  366. condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
  367. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  368. };
  369. /*%FSM</LINK>*/
  370. };
  371. };
  372. /*%FSM</STATE>*/
  373. /*%FSM<STATE "update_objects">*/
  374. class update_objects
  375. {
  376. name = "update_objects";
  377. init = /*%FSM<STATEINIT""">*/"diag_log format[""DEBUG: needUpdate_objects=%1"",needUpdate_objects];" \n
  378. "{" \n
  379. "// _x setVariable [""needUpdate"",false,true];" \n
  380. " needUpdate_objects = needUpdate_objects - [_x];" \n
  381. " [_x,""all""] spawn server_updateObject;" \n
  382. "" \n
  383. "} forEach needUpdate_objects;" \n
  384. ""/*%FSM</STATEINIT""">*/;
  385. precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  386. class Links
  387. {
  388. /*%FSM<LINK "true">*/
  389. class true
  390. {
  391. priority = 0.000000;
  392. to="general_cleanup";
  393. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  394. condition=/*%FSM<CONDITION""">*/"true"/*%FSM</CONDITION""">*/;
  395. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  396. };
  397. /*%FSM</LINK>*/
  398. };
  399. };
  400. /*%FSM</STATE>*/
  401. };
  402. initState="init";
  403. finalStates[] =
  404. {
  405. };
  406. };
  407. /*%FSM</COMPILE>*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement