base.fsm 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926
  1. /*%FSM<COMPILE "C:\Program Files (x86)\Bohemia Interactive\Tools\FSM Editor Personal Edition\scriptedFSM.cfg, Bases">*/
  2. /*%FSM<HEAD>*/
  3. /*
  4. item0[] = {"Initialise_Base",0,4346,275.000000,275.000000,375.000000,325.000000,0.000000,"Initialise" \n "Base"};
  5. item1[] = {"Is_friendly",4,218,150.000000,275.000000,250.000000,325.000000,1.000000,"Is" \n "friendly"};
  6. item2[] = {"Is_enemy",4,218,400.000000,275.000000,500.000000,325.000000,0.000000,"Is" \n "enemy"};
  7. item3[] = {"Add_Respawn_Location",2,250,25.000000,275.000000,125.000000,325.000000,0.000000,"Add Respawn" \n "Location &" \n "Vehicles"};
  8. item4[] = {"Spawn_defenders",2,250,525.000000,275.000000,625.000000,325.000000,0.000000,"Spawn" \n "defenders & set" \n "marker"};
  9. item5[] = {"Stop_vehicles_respawning",2,250,400.000000,425.000000,500.000000,475.000000,0.000000,"Stop vehicles" \n "respawning &" \n "remove spawn"};
  10. item6[] = {"Base_being_captu",2,250,650.000000,575.000000,750.000000,625.000000,0.000000,"Base being" \n "captured"};
  11. item7[] = {"Calculate___Spawn",2,250,775.000000,350.000000,875.000000,400.000000,0.000000,"Calculate &" \n "Spawn" \n "Reinforcements"};
  12. item8[] = {"Do_the_checks",8,218,525.000000,350.000000,625.000000,400.000000,0.000000,"Do the checks"};
  13. item9[] = {"Player_within_base",4,218,650.000000,500.000000,750.000000,550.000000,1.000000,"Player" \n "within base" \n "radius"};
  14. item10[] = {"No_enemies_left",4,218,1025.000000,575.000000,1125.000000,625.000000,1.000000,"No" \n "enemies" \n "left"};
  15. item11[] = {"Base_Taken_",2,250,1025.000000,200.000000,1125.000000,250.000000,0.000000,"Base" \n "Taken!"};
  16. item12[] = {"Base_taken",8,218,25.000000,200.000000,125.000000,250.000000,0.000000,"Base" \n "taken"};
  17. item13[] = {"Reinforcements_time",4,218,775.000000,275.000000,875.000000,325.000000,1.000000,"Reinforcements" \n "time?"};
  18. item14[] = {"Players_no_longer",4,218,900.000000,500.000000,1000.000000,550.000000,0.000000,"Players" \n "no longer" \n "within radius"};
  19. item15[] = {"Base_taken",8,218,400.000000,350.000000,500.000000,400.000000,0.000000,"Base" \n "taken"};
  20. item16[] = {"Wait_for_grace_p",4,218,25.000000,350.000000,125.000000,400.000000,0.000000,"Wait for" \n "grace period"};
  21. item17[] = {"Set_time_before",2,250,25.000000,425.000000,125.000000,475.000000,0.000000,"Set time" \n "before next" \n "attack"};
  22. item18[] = {"Wait_for_the_att",4,218,25.000000,500.000000,125.000000,550.000000,1.000000,"Wait" \n "for the" \n "attack"};
  23. item19[] = {"Attack_the_base",2,250,25.000000,575.000000,125.000000,625.000000,0.000000,"Attack the" \n "base!"};
  24. item20[] = {"Enemies_defeated",4,218,150.000000,425.000000,250.000000,475.000000,2.000000,"Enemies" \n "defeated"};
  25. item21[] = {"No_players_remai",4,218,400.000000,500.000000,500.000000,550.000000,1.000000,"No players" \n "remaining"};
  26. item22[] = {"Only_1_base_left",4,218,400.000000,575.000000,500.000000,625.000000,2.000000,"Only 1" \n "base left"};
  27. item23[] = {"Organise_tactical",2,250,25.000000,725.000000,125.000000,775.000000,0.000000,"Organise" \n "tactical" \n "retreat"};
  28. item24[] = {"Ready_to_delete",4,218,-100.000000,575.000000,0.000000,625.000000,1.000000,"Ready" \n "to delete"};
  29. item25[] = {"Clean_up_attacke",2,250,-225.000000,575.000000,-125.000000,625.000000,0.000000,"Clean up" \n "attackers"};
  30. item26[] = {"Wait_for_more_than",4,218,-100.000000,425.000000,0.000000,475.000000,1.000000,"Wait for" \n "more than 1" \n "base"};
  31. item27[] = {"Do_the_checks",4,218,150.000000,575.000000,250.000000,625.000000,0.000000,"Do the checks"};
  32. item28[] = {"Check",2,250,275.000000,500.000000,375.000000,550.000000,0.000000,"Check"};
  33. item29[] = {"Nothing_yet",8,218,150.000000,650.000000,250.000000,700.000000,0.000000,"Nothing yet"};
  34. item30[] = {"Wait___",2,250,275.000000,650.000000,375.000000,700.000000,0.000000,"Wait..."};
  35. item31[] = {"Do_the_checks",4,218,775.000000,425.000000,875.000000,475.000000,0.000000,"Do the checks"};
  36. item32[] = {"Check_1",2,250,775.000000,500.000000,875.000000,550.000000,0.000000,"Check"};
  37. item33[] = {"Ready_to_check",4,218,275.000000,575.000000,375.000000,625.000000,0.000000,"Ready to check"};
  38. item34[] = {"Nothing_yet",8,218,650.000000,425.000000,750.000000,475.000000,0.000000,"Nothing yet"};
  39. item35[] = {"Let_s_go_",8,218,650.000000,650.000000,750.000000,700.000000,0.000000,"Let's go!"};
  40. item36[] = {"Set_timeout___",2,250,775.000000,650.000000,875.000000,700.000000,0.000000,"Set timeout..."};
  41. item37[] = {"Do_the_checks",4,218,900.000000,650.000000,1000.000000,700.000000,0.000000,"Do the checks"};
  42. item38[] = {"Check_2",2,250,900.000000,575.000000,1000.000000,625.000000,0.000000,"Check"};
  43. item39[] = {"Get_ready",8,218,25.000000,800.000000,125.000000,850.000000,0.000000,"Get ready"};
  44. item40[] = {"Set_timeout____1",2,250,-100.000000,800.000000,0.000000,850.000000,0.000000,"Set timeout..."};
  45. item41[] = {"Do_the_checks",4,218,-100.000000,725.000000,0.000000,775.000000,0.000000,"Do the checks"};
  46. item42[] = {"Check_3",2,250,-100.000000,650.000000,0.000000,700.000000,0.000000,"Check"};
  47. item43[] = {"Not_ready_to_del",8,218,-225.000000,725.000000,-125.000000,775.000000,0.000000,"Not ready" \n "to delete"};
  48. item44[] = {"Get_ready",8,218,-350.000000,575.000000,-250.000000,625.000000,0.000000,"Get ready"};
  49. item45[] = {"Set_timeout",2,250,-350.000000,500.000000,-250.000000,550.000000,0.000000,"Set timeout"};
  50. item46[] = {"Do_the_checks",4,218,-350.000000,425.000000,-250.000000,475.000000,0.000000,"Do the checks"};
  51. item47[] = {"Check_4",2,250,-225.000000,425.000000,-125.000000,475.000000,0.000000,"Check"};
  52. item48[] = {"Not_more_than_1",8,218,-225.000000,500.000000,-125.000000,550.000000,0.000000,"Not more" \n "than 1 base"};
  53. item49[] = {"",7,210,446.000000,746.000000,454.000000,754.000000,0.000000,""};
  54. item50[] = {"",7,210,946.000000,371.000000,954.000000,379.000000,0.000000,""};
  55. item51[] = {"Time_up_and_back",4,218,-225.000000,350.000000,-125.000000,400.000000,0.000000,"Time up" \n "and back to one" \n "base?"};
  56. item52[] = {"Set_grace_period",2,250,-225.000000,275.000000,-125.000000,325.000000,0.000000,"Set grace period" \n "timer again!"};
  57. item53[] = {"Wait_for_grace_p",4,218,-100.000000,350.000000,0.000000,400.000000,0.000000,"Wait for" \n "grace period"};
  58. link0[] = {0,1};
  59. link1[] = {0,2};
  60. link2[] = {1,3};
  61. link3[] = {2,4};
  62. link4[] = {3,16};
  63. link5[] = {4,8};
  64. link6[] = {5,15};
  65. link7[] = {6,35};
  66. link8[] = {7,13};
  67. link9[] = {7,31};
  68. link10[] = {8,7};
  69. link11[] = {9,6};
  70. link12[] = {10,11};
  71. link13[] = {11,12};
  72. link14[] = {12,3};
  73. link15[] = {13,7};
  74. link16[] = {14,50};
  75. link17[] = {15,4};
  76. link18[] = {16,17};
  77. link19[] = {17,18};
  78. link20[] = {17,51};
  79. link21[] = {18,19};
  80. link22[] = {19,27};
  81. link23[] = {20,17};
  82. link24[] = {21,5};
  83. link25[] = {22,49};
  84. link26[] = {23,39};
  85. link27[] = {24,25};
  86. link28[] = {25,44};
  87. link29[] = {26,17};
  88. link30[] = {27,28};
  89. link31[] = {28,20};
  90. link32[] = {28,21};
  91. link33[] = {28,22};
  92. link34[] = {28,29};
  93. link35[] = {29,30};
  94. link36[] = {30,33};
  95. link37[] = {31,32};
  96. link38[] = {32,9};
  97. link39[] = {32,34};
  98. link40[] = {33,28};
  99. link41[] = {34,7};
  100. link42[] = {35,36};
  101. link43[] = {36,37};
  102. link44[] = {37,38};
  103. link45[] = {38,10};
  104. link46[] = {38,14};
  105. link47[] = {39,40};
  106. link48[] = {40,41};
  107. link49[] = {41,42};
  108. link50[] = {42,24};
  109. link51[] = {42,43};
  110. link52[] = {43,40};
  111. link53[] = {44,45};
  112. link54[] = {45,46};
  113. link55[] = {46,47};
  114. link56[] = {47,26};
  115. link57[] = {47,48};
  116. link58[] = {48,45};
  117. link59[] = {49,23};
  118. link60[] = {50,7};
  119. link61[] = {51,52};
  120. link62[] = {52,53};
  121. link63[] = {53,17};
  122. globals[] = {25.000000,1,0,0,0,640,480,1,73,6316128,1,-486.994934,819.723877,1115.528809,21.610889,1529,1280,1};
  123. window[] = {2,-1,-1,-1,-1,968,208,1648,208,3,1547};
  124. *//*%FSM</HEAD>*/
  125. class FSM
  126. {
  127. fsmName = "Bases";
  128. class States
  129. {
  130. /*%FSM<STATE "Initialise_Base">*/
  131. class Initialise_Base
  132. {
  133. name = "Initialise_Base";
  134. init = /*%FSM<STATEINIT""">*/"_name = """";" \n
  135. "_isOwned = false;" \n
  136. "_pos = [];" \n
  137. "_marker = """";" \n
  138. "_markerText = """";" \n
  139. "_iconMarker = """";" \n
  140. "_radius = 100;" \n
  141. "_area = [];" \n
  142. "_groups = 5;" \n
  143. "_respawnGroups = 0;" \n
  144. "_respawnTime = 300;" \n
  145. "_tempVehs = [];" \n
  146. "_vehicles = [];" \n
  147. "_spawns = [];" \n
  148. "" \n
  149. "{" \n
  150. " switch (_x select 0) do" \n
  151. " {" \n
  152. " case ""name"": { _name = _x select 1; };" \n
  153. " case ""isOwned"": { _isOwned = if ((_x select 1) == 1) then { true } else { false }; };" \n
  154. " case ""marker"":" \n
  155. " {" \n
  156. " _pos = getMarkerPos (_x select 1);" \n
  157. " _marker = _x select 1;" \n
  158. " _markerText = markerText _marker;" \n
  159. " _iconMarker = format[""%1_icon"", _marker];" \n
  160. " _radius = (getMarkerSize _marker) call BIS_fnc_greatestNum;" \n
  161. " " \n
  162. " _area = getMarkerSize _marker;" \n
  163. " _area = _area + [markerDir _marker];" \n
  164. " " \n
  165. " _is_rectangle = if (markerShape _marker == ""RECTANGLE"") then { true } else { false };" \n
  166. "" \n
  167. " _area = _area + [_is_rectangle];" \n
  168. "" \n
  169. " _area = [markerPos _marker, _area];" \n
  170. "" \n
  171. " diag_log _area;" \n
  172. " " \n
  173. " };" \n
  174. " case ""groups"": { _groups = _x select 1; };" \n
  175. " case ""respawnGroups"": { _respawnGroups = _x select 1; };" \n
  176. " case ""respawnTime"": { _respawnTime = _x select 1; };" \n
  177. " case ""vehicles"":" \n
  178. " {" \n
  179. " _tempVehs = _x select 1;" \n
  180. " {" \n
  181. " _vehicles = _vehicles + [_x];" \n
  182. " } forEach _tempVehs;" \n
  183. " };" \n
  184. " };" \n
  185. "} forEach _this;" \n
  186. "" \n
  187. "//Get special spawn markers" \n
  188. "_code = format[""%1_spawn_"", _marker];" \n
  189. "{" \n
  190. " if ([_code, _x] call BIS_fnc_inString) then { _spawns = _spawns + [_x]; };" \n
  191. "} forEach allMapMarkers;"/*%FSM</STATEINIT""">*/;
  192. precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  193. class Links
  194. {
  195. /*%FSM<LINK "Is_friendly">*/
  196. class Is_friendly
  197. {
  198. priority = 1.000000;
  199. to="Add_Respawn_Location";
  200. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  201. condition=/*%FSM<CONDITION""">*/"_isOwned"/*%FSM</CONDITION""">*/;
  202. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  203. };
  204. /*%FSM</LINK>*/
  205. /*%FSM<LINK "Is_enemy">*/
  206. class Is_enemy
  207. {
  208. priority = 0.000000;
  209. to="Spawn_defenders";
  210. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  211. condition=/*%FSM<CONDITION""">*/"!_isOwned"/*%FSM</CONDITION""">*/;
  212. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  213. };
  214. /*%FSM</LINK>*/
  215. };
  216. };
  217. /*%FSM</STATE>*/
  218. /*%FSM<STATE "Add_Respawn_Location">*/
  219. class Add_Respawn_Location
  220. {
  221. name = "Add_Respawn_Location";
  222. init = /*%FSM<STATEINIT""">*/"basesOwned = basesOwned + [_marker];" \n
  223. "" \n
  224. "[[""base"", ""friendly""], _marker, _pos, _markerText] call AW_fnc_createJIPstateMarker;" \n
  225. "" \n
  226. "_respawnID = [west, _marker] call BIS_fnc_addRespawnPosition;" \n
  227. "" \n
  228. "_respawningHandles = [];" \n
  229. "_counter = 1;" \n
  230. "" \n
  231. "{" \n
  232. " _unit_class = _x select 0;" \n
  233. " _unit_marker = _x select 1;" \n
  234. "" \n
  235. " call compile format" \n
  236. " [" \n
  237. " """ \n
  238. " _%1_veh_%2 = [_unit_class, _unit_marker, _marker] execVM """"functions\units\fn_respawnVehicle.sqf"""";" \n
  239. " _respawningHandles = _respawningHandles + [_%1_veh_%2];" \n
  240. " ""," \n
  241. " _marker," \n
  242. " _counter" \n
  243. " ];" \n
  244. "" \n
  245. " _counter = _counter + 1;" \n
  246. "} forEach _vehicles;" \n
  247. "" \n
  248. "//Add in spawn markers" \n
  249. "baseSpawns = baseSpawns + _spawns;" \n
  250. "" \n
  251. "_timeout = time + PARAMS_base_gracePeriod;"/*%FSM</STATEINIT""">*/;
  252. precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  253. class Links
  254. {
  255. /*%FSM<LINK "Wait_for_grace_p">*/
  256. class Wait_for_grace_p
  257. {
  258. priority = 0.000000;
  259. to="Set_time_before";
  260. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  261. condition=/*%FSM<CONDITION""">*/"(count basesOwned) >= PARAMS_base_basesOwnedBeforeAttacks && time >= _timeout"/*%FSM</CONDITION""">*/;
  262. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  263. };
  264. /*%FSM</LINK>*/
  265. };
  266. };
  267. /*%FSM</STATE>*/
  268. /*%FSM<STATE "Spawn_defenders">*/
  269. class Spawn_defenders
  270. {
  271. name = "Spawn_defenders";
  272. init = /*%FSM<STATEINIT""">*/"[[""base"", ""enemy""], _marker, _pos, _name] call AW_fnc_createJIPstateMarker;" \n
  273. "" \n
  274. "_spawnedUnits = [EAST, _groups, _marker] call AW_fnc_spawnEnemy;" \n
  275. "[_spawnedUnits, [[""patrol"", true, 100]]] call AW_fnc_setBehaviour;" \n
  276. "" \n
  277. "_unitGroups = [];" \n
  278. "" \n
  279. "{" \n
  280. " _type = typeName _x;" \n
  281. " switch (_type) do" \n
  282. " {" \n
  283. " case ""GROUP"": { if (!(_x in _unitGroups)) then { _unitGroups = _unitGroups + [_x]; }; };" \n
  284. " case ""OBJECT"": { if (!(group _x in _unitGroups)) then { _unitGroups = _unitGroups + [group _x]; }; };" \n
  285. " };" \n
  286. "} forEach _spawnedUnits;" \n
  287. "" \n
  288. "_unitCount = count _unitGroups;" \n
  289. "" \n
  290. "_respawnTimeout = (time + _respawnTime);"/*%FSM</STATEINIT""">*/;
  291. precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  292. class Links
  293. {
  294. /*%FSM<LINK "Do_the_checks">*/
  295. class Do_the_checks
  296. {
  297. priority = 0.000000;
  298. to="Calculate___Spawn";
  299. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  300. condition=/*%FSM<CONDITION""">*/""/*%FSM</CONDITION""">*/;
  301. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  302. };
  303. /*%FSM</LINK>*/
  304. };
  305. };
  306. /*%FSM</STATE>*/
  307. /*%FSM<STATE "Stop_vehicles_respawning">*/
  308. class Stop_vehicles_respawning
  309. {
  310. name = "Stop_vehicles_respawning";
  311. init = /*%FSM<STATEINIT""">*/"basesOwned = basesOwned - [_marker];" \n
  312. "" \n
  313. "//Respawn handles will kill themselves..." \n
  314. "" \n
  315. "{" \n
  316. " if ((_x distance _pos) <= _radius && ({alive _x} count (crew _x)) < 1) then" \n
  317. " {" \n
  318. " _x setDamage 1;" \n
  319. " };" \n
  320. "} forEach vehicles;" \n
  321. "" \n
  322. "_respawnID call BIS_fnc_removeRespawnPosition;" \n
  323. "" \n
  324. "//Remove base spawn points" \n
  325. "baseSpawns = baseSpawns - _spawns;" \n
  326. "" \n
  327. "[_attackers] spawn" \n
  328. "{" \n
  329. " sleep 15;" \n
  330. " (_this select 0) call AW_fnc_collectGarbage;" \n
  331. " [] call AW_fnc_collectGarbage;" \n
  332. "};"/*%FSM</STATEINIT""">*/;
  333. precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  334. class Links
  335. {
  336. /*%FSM<LINK "Base_taken">*/
  337. class Base_taken
  338. {
  339. priority = 0.000000;
  340. to="Spawn_defenders";
  341. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  342. condition=/*%FSM<CONDITION""">*/""/*%FSM</CONDITION""">*/;
  343. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  344. };
  345. /*%FSM</LINK>*/
  346. };
  347. };
  348. /*%FSM</STATE>*/
  349. /*%FSM<STATE "Base_being_captu">*/
  350. class Base_being_captu
  351. {
  352. name = "Base_being_captu";
  353. init = /*%FSM<STATEINIT""">*/"[[""base"", ""attacking""], _marker, _pos, _markerText] call AW_fnc_createJIPstateMarker;" \n
  354. "[[""type"", ""base_attacking""], [""message"", _markerText], [""global"", true]] call AW_fnc_showNotification;" \n
  355. "" \n
  356. "[_spawnedUnits, [[""active_defend"", _marker]]] call AW_fnc_setBehaviour;"/*%FSM</STATEINIT""">*/;
  357. precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  358. class Links
  359. {
  360. /*%FSM<LINK "Let_s_go_">*/
  361. class Let_s_go_
  362. {
  363. priority = 0.000000;
  364. to="Set_timeout___";
  365. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  366. condition=/*%FSM<CONDITION""">*/""/*%FSM</CONDITION""">*/;
  367. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  368. };
  369. /*%FSM</LINK>*/
  370. };
  371. };
  372. /*%FSM</STATE>*/
  373. /*%FSM<STATE "Calculate___Spawn">*/
  374. class Calculate___Spawn
  375. {
  376. name = "Calculate___Spawn";
  377. init = /*%FSM<STATEINIT""">*/"_timeout = (time + (5 + random(15)));"/*%FSM</STATEINIT""">*/;
  378. precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  379. class Links
  380. {
  381. /*%FSM<LINK "Reinforcements_time">*/
  382. class Reinforcements_time
  383. {
  384. priority = 1.000000;
  385. to="Calculate___Spawn";
  386. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  387. condition=/*%FSM<CONDITION""">*/"time >= _respawnTimeout"/*%FSM</CONDITION""">*/;
  388. action=/*%FSM<ACTION""">*/"_unitGroups = [];" \n
  389. "_unitsDefending = [];" \n
  390. "" \n
  391. "{" \n
  392. " if (!isPlayer _x && alive _x && (_x distance _pos) <= _radius) then" \n
  393. " {" \n
  394. " _unitsDefending = _unitsDefending + [_x];" \n
  395. " };" \n
  396. "} forEach allUnits;" \n
  397. "" \n
  398. "{" \n
  399. " _type = typeName _x;" \n
  400. " switch (_type) do" \n
  401. " {" \n
  402. " case ""GROUP"": { if (!(_x in _unitGroups)) then { _unitGroups = _unitGroups + [_x]; }; };" \n
  403. " case ""OBJECT"": { if (!(group _x in _unitGroups)) then { _unitGroups = _unitGroups + [group _x]; }; };" \n
  404. " };" \n
  405. "} forEach _unitsDefending;" \n
  406. "" \n
  407. "if ((count _unitGroups) < _unitCount) then" \n
  408. "{" \n
  409. " _lacking = (_unitCount - count _unitGroups);" \n
  410. " _toSpawn = if (_respawnGroups < _lacking) then { _respawnGroups } else { _lacking };" \n
  411. "" \n
  412. " _respawnedUnits = [EAST, _toSpawn, _marker] call AW_fnc_spawnEnemy;" \n
  413. " [_respawnedUnits, [[""patrol"", true, 100]]] call AW_fnc_setBehaviour;" \n
  414. "" \n
  415. " _spawnedUnits = _spawnedUnits + _respawnedUnits;" \n
  416. "};" \n
  417. "" \n
  418. "_respawnTimeout = (time + _respawnTime);"/*%FSM</ACTION""">*/;
  419. };
  420. /*%FSM</LINK>*/
  421. /*%FSM<LINK "Do_the_checks">*/
  422. class Do_the_checks
  423. {
  424. priority = 0.000000;
  425. to="Check_1";
  426. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  427. condition=/*%FSM<CONDITION""">*/"time >= _timeout"/*%FSM</CONDITION""">*/;
  428. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  429. };
  430. /*%FSM</LINK>*/
  431. };
  432. };
  433. /*%FSM</STATE>*/
  434. /*%FSM<STATE "Base_Taken_">*/
  435. class Base_Taken_
  436. {
  437. name = "Base_Taken_";
  438. init = /*%FSM<STATEINIT""">*/"_isOwned = true;" \n
  439. "[[""type"", ""base_captured""], [""message"", _markerText], [""global"", true], [""hint"", [""Base"", _marker]]] call AW_fnc_showNotification;" \n
  440. "" \n
  441. "[_spawnedUnits, [[""retreat"", _pos, 1000]]] call AW_fnc_setBehaviour;"/*%FSM</STATEINIT""">*/;
  442. precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  443. class Links
  444. {
  445. /*%FSM<LINK "Base_taken">*/
  446. class Base_taken
  447. {
  448. priority = 0.000000;
  449. to="Add_Respawn_Location";
  450. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  451. condition=/*%FSM<CONDITION""">*/""/*%FSM</CONDITION""">*/;
  452. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  453. };
  454. /*%FSM</LINK>*/
  455. };
  456. };
  457. /*%FSM</STATE>*/
  458. /*%FSM<STATE "Set_time_before">*/
  459. class Set_time_before
  460. {
  461. name = "Set_time_before";
  462. init = /*%FSM<STATEINIT""">*/"_timeout = if (PARAMS_base_minTimeBeforeAttack > PARAMS_base_maxTimeBeforeAttack) then" \n
  463. "{" \n
  464. " (time + PARAMS_base_maxTimeBeforeAttack + (random (PARAMS_base_minTimeBeforeAttack - PARAMS_base_maxTimeBeforeAttack)))" \n
  465. "} else {" \n
  466. " (time + PARAMS_base_minTimeBeforeAttack + (random (PARAMS_base_maxTimeBeforeAttack - PARAMS_base_minTimeBeforeAttack)))" \n
  467. "};"/*%FSM</STATEINIT""">*/;
  468. precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  469. class Links
  470. {
  471. /*%FSM<LINK "Wait_for_the_att">*/
  472. class Wait_for_the_att
  473. {
  474. priority = 1.000000;
  475. to="Attack_the_base";
  476. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  477. condition=/*%FSM<CONDITION""">*/"time >= _timeout && (count basesOwned) >= PARAMS_base_basesOwnedBeforeAttacks"/*%FSM</CONDITION""">*/;
  478. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  479. };
  480. /*%FSM</LINK>*/
  481. /*%FSM<LINK "Time_up_and_back">*/
  482. class Time_up_and_back
  483. {
  484. priority = 0.000000;
  485. to="Set_grace_period";
  486. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  487. condition=/*%FSM<CONDITION""">*/"time >= _timeout && (count basesOwned) < 2"/*%FSM</CONDITION""">*/;
  488. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  489. };
  490. /*%FSM</LINK>*/
  491. };
  492. };
  493. /*%FSM</STATE>*/
  494. /*%FSM<STATE "Attack_the_base">*/
  495. class Attack_the_base
  496. {
  497. name = "Attack_the_base";
  498. init = /*%FSM<STATEINIT""">*/"_attackers = [EAST, round ((_groups / 2) + random _groups), _pos, [500, 1000]] call AW_fnc_spawnEnemy;" \n
  499. "[_attackers, [[""attack"", _pos]]] call AW_fnc_setBehaviour;" \n
  500. "" \n
  501. "[[""base"", ""under_attack""], _marker, _pos, _markerText] call AW_fnc_createJIPstateMarker;" \n
  502. "[[""type"", ""base_underattack""], [""message"", _markerText], [""global"", true]] call AW_fnc_showNotification;" \n
  503. "" \n
  504. "_timeout = time + (5 + random(15));"/*%FSM</STATEINIT""">*/;
  505. precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  506. class Links
  507. {
  508. /*%FSM<LINK "Do_the_checks">*/
  509. class Do_the_checks
  510. {
  511. priority = 0.000000;
  512. to="Check";
  513. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  514. condition=/*%FSM<CONDITION""">*/"time >= _timeout"/*%FSM</CONDITION""">*/;
  515. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  516. };
  517. /*%FSM</LINK>*/
  518. };
  519. };
  520. /*%FSM</STATE>*/
  521. /*%FSM<STATE "Organise_tactical">*/
  522. class Organise_tactical
  523. {
  524. name = "Organise_tactical";
  525. init = /*%FSM<STATEINIT""">*/"[_attackers, [[""retreat"", _pos, 1000]]] call AW_fnc_setBehaviour;"/*%FSM</STATEINIT""">*/;
  526. precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  527. class Links
  528. {
  529. /*%FSM<LINK "Get_ready">*/
  530. class Get_ready
  531. {
  532. priority = 0.000000;
  533. to="Set_timeout____1";
  534. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  535. condition=/*%FSM<CONDITION""">*/""/*%FSM</CONDITION""">*/;
  536. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  537. };
  538. /*%FSM</LINK>*/
  539. };
  540. };
  541. /*%FSM</STATE>*/
  542. /*%FSM<STATE "Clean_up_attacke">*/
  543. class Clean_up_attacke
  544. {
  545. name = "Clean_up_attacke";
  546. init = /*%FSM<STATEINIT""">*/"_attackers call AW_fnc_collectGarbage;"/*%FSM</STATEINIT""">*/;
  547. precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  548. class Links
  549. {
  550. /*%FSM<LINK "Get_ready">*/
  551. class Get_ready
  552. {
  553. priority = 0.000000;
  554. to="Set_timeout";
  555. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  556. condition=/*%FSM<CONDITION""">*/""/*%FSM</CONDITION""">*/;
  557. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  558. };
  559. /*%FSM</LINK>*/
  560. };
  561. };
  562. /*%FSM</STATE>*/
  563. /*%FSM<STATE "Check">*/
  564. class Check
  565. {
  566. name = "Check";
  567. init = /*%FSM<STATEINIT""">*/""/*%FSM</STATEINIT""">*/;
  568. precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  569. class Links
  570. {
  571. /*%FSM<LINK "Only_1_base_left">*/
  572. class Only_1_base_left
  573. {
  574. priority = 2.000000;
  575. to="Organise_tactical";
  576. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  577. condition=/*%FSM<CONDITION""">*/"(count basesOwned) < 2"/*%FSM</CONDITION""">*/;
  578. action=/*%FSM<ACTION""">*/"[[""type"", ""base_defended""], [""message"", _markerText], [""global"", true]] call AW_fnc_showNotification;" \n
  579. "[[""base"", ""friendly""], _marker, _pos, _markerText] call AW_fnc_createJIPstateMarker;"/*%FSM</ACTION""">*/;
  580. };
  581. /*%FSM</LINK>*/
  582. /*%FSM<LINK "Enemies_defeated">*/
  583. class Enemies_defeated
  584. {
  585. priority = 2.000000;
  586. to="Set_time_before";
  587. precondition = /*%FSM<CONDPRECONDITION""">*/"private[""_enemiesDead""];" \n
  588. "" \n
  589. "_enemiesDead = true;" \n
  590. "{" \n
  591. " if (typeName _x == ""GROUP"") then" \n
  592. " {" \n
  593. " {" \n
  594. " if (alive _x) exitWith { _enemiesDead = false; };" \n
  595. " } forEach (units _x);" \n
  596. " };" \n
  597. "" \n
  598. " if (!_enemiesDead) exitWith {};" \n
  599. "} forEach _attackers;"/*%FSM</CONDPRECONDITION""">*/;
  600. condition=/*%FSM<CONDITION""">*/"_enemiesDead"/*%FSM</CONDITION""">*/;
  601. action=/*%FSM<ACTION""">*/"[[""base"", ""friendly""], _marker, _pos, _markerText] call AW_fnc_createJIPstateMarker;" \n
  602. "[[""type"", ""base_defended""], [""message"", _markerText], [""global"", true]] call AW_fnc_showNotification;" \n
  603. "_attackers call AW_fnc_collectGarbage;"/*%FSM</ACTION""">*/;
  604. };
  605. /*%FSM</LINK>*/
  606. /*%FSM<LINK "No_players_remai">*/
  607. class No_players_remai
  608. {
  609. priority = 1.000000;
  610. to="Stop_vehicles_respawning";
  611. precondition = /*%FSM<CONDPRECONDITION""">*/"_friendliesAbsent = true;" \n
  612. "_baseTaken = false;" \n
  613. "{" \n
  614. " if (alive _x && [_area, _x, false] call BIS_fnc_inTrigger) exitWith { _friendliesAbsent = false; };" \n
  615. "} forEach playableUnits;" \n
  616. "" \n
  617. "if (_friendliesAbsent) then" \n
  618. "{" \n
  619. " _tighterRad = (_radius / 2);" \n
  620. " {" \n
  621. " if (typeName _x == ""GROUP"") then" \n
  622. " {" \n
  623. " {" \n
  624. " if (alive _x && [_area, _x, false] call BIS_fnc_inTrigger) exitWith { _baseTaken = true; };" \n
  625. " } forEach (units _x);" \n
  626. " };" \n
  627. "" \n
  628. " if (_baseTaken) exitWith {};" \n
  629. " } forEach _attackers;" \n
  630. "};"/*%FSM</CONDPRECONDITION""">*/;
  631. condition=/*%FSM<CONDITION""">*/"_baseTaken && (count basesOwned) > 1"/*%FSM</CONDITION""">*/;
  632. action=/*%FSM<ACTION""">*/"[[""type"", ""base_lost""], [""message"", _markerText], [""global"", true]] call AW_fnc_showNotification;"/*%FSM</ACTION""">*/;
  633. };
  634. /*%FSM</LINK>*/
  635. /*%FSM<LINK "Nothing_yet">*/
  636. class Nothing_yet
  637. {
  638. priority = 0.000000;
  639. to="Wait___";
  640. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  641. condition=/*%FSM<CONDITION""">*/""/*%FSM</CONDITION""">*/;
  642. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  643. };
  644. /*%FSM</LINK>*/
  645. };
  646. };
  647. /*%FSM</STATE>*/
  648. /*%FSM<STATE "Wait___">*/
  649. class Wait___
  650. {
  651. name = "Wait___";
  652. init = /*%FSM<STATEINIT""">*/"_timeout = (time + (5 + random(15)));"/*%FSM</STATEINIT""">*/;
  653. precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  654. class Links
  655. {
  656. /*%FSM<LINK "Ready_to_check">*/
  657. class Ready_to_check
  658. {
  659. priority = 0.000000;
  660. to="Check";
  661. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  662. condition=/*%FSM<CONDITION""">*/"time >= _timeout"/*%FSM</CONDITION""">*/;
  663. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  664. };
  665. /*%FSM</LINK>*/
  666. };
  667. };
  668. /*%FSM</STATE>*/
  669. /*%FSM<STATE "Check_1">*/
  670. class Check_1
  671. {
  672. name = "Check_1";
  673. init = /*%FSM<STATEINIT""">*/""/*%FSM</STATEINIT""">*/;
  674. precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  675. class Links
  676. {
  677. /*%FSM<LINK "Player_within_base">*/
  678. class Player_within_base
  679. {
  680. priority = 1.000000;
  681. to="Base_being_captu";
  682. precondition = /*%FSM<CONDPRECONDITION""">*/"_beingTaken = false;" \n
  683. "" \n
  684. "{" \n
  685. " if ([_area, _x, false] call BIS_fnc_inTrigger) exitWith { _beingTaken = true; };" \n
  686. "} forEach playableUnits;"/*%FSM</CONDPRECONDITION""">*/;
  687. condition=/*%FSM<CONDITION""">*/"_beingTaken"/*%FSM</CONDITION""">*/;
  688. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  689. };
  690. /*%FSM</LINK>*/
  691. /*%FSM<LINK "Nothing_yet">*/
  692. class Nothing_yet
  693. {
  694. priority = 0.000000;
  695. to="Calculate___Spawn";
  696. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  697. condition=/*%FSM<CONDITION""">*/""/*%FSM</CONDITION""">*/;
  698. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  699. };
  700. /*%FSM</LINK>*/
  701. };
  702. };
  703. /*%FSM</STATE>*/
  704. /*%FSM<STATE "Set_timeout___">*/
  705. class Set_timeout___
  706. {
  707. name = "Set_timeout___";
  708. init = /*%FSM<STATEINIT""">*/"_timeout = (time + (5 + random(15)));"/*%FSM</STATEINIT""">*/;
  709. precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  710. class Links
  711. {
  712. /*%FSM<LINK "Do_the_checks">*/
  713. class Do_the_checks
  714. {
  715. priority = 0.000000;
  716. to="Check_2";
  717. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  718. condition=/*%FSM<CONDITION""">*/"time >= _timeout"/*%FSM</CONDITION""">*/;
  719. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  720. };
  721. /*%FSM</LINK>*/
  722. };
  723. };
  724. /*%FSM</STATE>*/
  725. /*%FSM<STATE "Check_2">*/
  726. class Check_2
  727. {
  728. name = "Check_2";
  729. init = /*%FSM<STATEINIT""">*/""/*%FSM</STATEINIT""">*/;
  730. precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  731. class Links
  732. {
  733. /*%FSM<LINK "No_enemies_left">*/
  734. class No_enemies_left
  735. {
  736. priority = 1.000000;
  737. to="Base_Taken_";
  738. precondition = /*%FSM<CONDPRECONDITION""">*/"_unitGroups = [];" \n
  739. "_unitsDefending = [];" \n
  740. "" \n
  741. "{" \n
  742. " if (!isPlayer _x && alive _x && (_x distance _pos) <= _radius) then" \n
  743. " {" \n
  744. " _unitsDefending = _unitsDefending + [_x];" \n
  745. " };" \n
  746. "} forEach allUnits;" \n
  747. "" \n
  748. "{" \n
  749. " _type = typeName _x;" \n
  750. " switch (_type) do" \n
  751. " {" \n
  752. " case ""GROUP"": { if (!(_x in _unitGroups)) then { _unitGroups = _unitGroups + [_x]; }; };" \n
  753. " case ""OBJECT"": { if (!(group _x in _unitGroups)) then { _unitGroups = _unitGroups + [group _x]; }; };" \n
  754. " };" \n
  755. "} forEach _unitsDefending;"/*%FSM</CONDPRECONDITION""">*/;
  756. condition=/*%FSM<CONDITION""">*/"(count _unitGroups) < 1"/*%FSM</CONDITION""">*/;
  757. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  758. };
  759. /*%FSM</LINK>*/
  760. /*%FSM<LINK "Players_no_longer">*/
  761. class Players_no_longer
  762. {
  763. priority = 0.000000;
  764. to="Calculate___Spawn";
  765. precondition = /*%FSM<CONDPRECONDITION""">*/"_beingTaken = false;" \n
  766. "" \n
  767. "{" \n
  768. " if ([_area, _x, false] call BIS_fnc_inTrigger) exitWith { _beingTaken = true; };" \n
  769. "} forEach playableUnits;"/*%FSM</CONDPRECONDITION""">*/;
  770. condition=/*%FSM<CONDITION""">*/"!_beingTaken"/*%FSM</CONDITION""">*/;
  771. action=/*%FSM<ACTION""">*/"[[""base"", ""enemy""], _marker, _pos, _markerText] call AW_fnc_createJIPstateMarker;" \n
  772. "" \n
  773. "[_spawnedUnits, [[""patrol"", _marker, 100]]] call AW_fnc_setBehaviour;"/*%FSM</ACTION""">*/;
  774. };
  775. /*%FSM</LINK>*/
  776. };
  777. };
  778. /*%FSM</STATE>*/
  779. /*%FSM<STATE "Set_timeout____1">*/
  780. class Set_timeout____1
  781. {
  782. name = "Set_timeout____1";
  783. init = /*%FSM<STATEINIT""">*/"_timeout = (time + (5 + random(15)));"/*%FSM</STATEINIT""">*/;
  784. precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  785. class Links
  786. {
  787. /*%FSM<LINK "Do_the_checks">*/
  788. class Do_the_checks
  789. {
  790. priority = 0.000000;
  791. to="Check_3";
  792. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  793. condition=/*%FSM<CONDITION""">*/"time >= _timeout"/*%FSM</CONDITION""">*/;
  794. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  795. };
  796. /*%FSM</LINK>*/
  797. };
  798. };
  799. /*%FSM</STATE>*/
  800. /*%FSM<STATE "Check_3">*/
  801. class Check_3
  802. {
  803. name = "Check_3";
  804. init = /*%FSM<STATEINIT""">*/""/*%FSM</STATEINIT""">*/;
  805. precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  806. class Links
  807. {
  808. /*%FSM<LINK "Ready_to_delete">*/
  809. class Ready_to_delete
  810. {
  811. priority = 1.000000;
  812. to="Clean_up_attacke";
  813. precondition = /*%FSM<CONDPRECONDITION""">*/"//Define distance needed before deletion" \n
  814. "_distance = 500;" \n
  815. "_farAway = true;" \n
  816. "" \n
  817. "{" \n
  818. " if (!_farAway) exitWith {};" \n
  819. " if (typeName _x == ""GROUP"") then" \n
  820. " {" \n
  821. " _leader = leader _x;" \n
  822. " {" \n
  823. " if ((_x distance _leader) < _distance) exitWith { _farAway = false; };" \n
  824. " } forEach playableUnits;" \n
  825. " };" \n
  826. "} forEach _attackers;"/*%FSM</CONDPRECONDITION""">*/;
  827. condition=/*%FSM<CONDITION""">*/"_farAway"/*%FSM</CONDITION""">*/;
  828. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  829. };
  830. /*%FSM</LINK>*/
  831. /*%FSM<LINK "Not_ready_to_del">*/
  832. class Not_ready_to_del
  833. {
  834. priority = 0.000000;
  835. to="Set_timeout____1";
  836. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  837. condition=/*%FSM<CONDITION""">*/""/*%FSM</CONDITION""">*/;
  838. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  839. };
  840. /*%FSM</LINK>*/
  841. };
  842. };
  843. /*%FSM</STATE>*/
  844. /*%FSM<STATE "Set_timeout">*/
  845. class Set_timeout
  846. {
  847. name = "Set_timeout";
  848. init = /*%FSM<STATEINIT""">*/"_timeout = (time + (5 + random(15)));"/*%FSM</STATEINIT""">*/;
  849. precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  850. class Links
  851. {
  852. /*%FSM<LINK "Do_the_checks">*/
  853. class Do_the_checks
  854. {
  855. priority = 0.000000;
  856. to="Check_4";
  857. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  858. condition=/*%FSM<CONDITION""">*/"time >= _timeout"/*%FSM</CONDITION""">*/;
  859. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  860. };
  861. /*%FSM</LINK>*/
  862. };
  863. };
  864. /*%FSM</STATE>*/
  865. /*%FSM<STATE "Check_4">*/
  866. class Check_4
  867. {
  868. name = "Check_4";
  869. init = /*%FSM<STATEINIT""">*/""/*%FSM</STATEINIT""">*/;
  870. precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  871. class Links
  872. {
  873. /*%FSM<LINK "Wait_for_more_than">*/
  874. class Wait_for_more_than
  875. {
  876. priority = 1.000000;
  877. to="Set_time_before";
  878. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  879. condition=/*%FSM<CONDITION""">*/"(count basesOwned) >= PARAMS_base_basesOwnedBeforeAttacks"/*%FSM</CONDITION""">*/;
  880. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  881. };
  882. /*%FSM</LINK>*/
  883. /*%FSM<LINK "Not_more_than_1">*/
  884. class Not_more_than_1
  885. {
  886. priority = 0.000000;
  887. to="Set_timeout";
  888. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  889. condition=/*%FSM<CONDITION""">*/""/*%FSM</CONDITION""">*/;
  890. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  891. };
  892. /*%FSM</LINK>*/
  893. };
  894. };
  895. /*%FSM</STATE>*/
  896. /*%FSM<STATE "Set_grace_period">*/
  897. class Set_grace_period
  898. {
  899. name = "Set_grace_period";
  900. init = /*%FSM<STATEINIT""">*/"//Set timeout again and wait for >1 base to be present before planning another attack" \n
  901. "" \n
  902. "_timeout = time;" \n
  903. "//DEBUG - add grace period parameter to time"/*%FSM</STATEINIT""">*/;
  904. precondition = /*%FSM<STATEPRECONDITION""">*/""/*%FSM</STATEPRECONDITION""">*/;
  905. class Links
  906. {
  907. /*%FSM<LINK "Wait_for_grace_p">*/
  908. class Wait_for_grace_p
  909. {
  910. priority = 0.000000;
  911. to="Set_time_before";
  912. precondition = /*%FSM<CONDPRECONDITION""">*/""/*%FSM</CONDPRECONDITION""">*/;
  913. condition=/*%FSM<CONDITION""">*/"(count basesOwned) > 1 && time >= _timeout"/*%FSM</CONDITION""">*/;
  914. action=/*%FSM<ACTION""">*/""/*%FSM</ACTION""">*/;
  915. };
  916. /*%FSM</LINK>*/
  917. };
  918. };
  919. /*%FSM</STATE>*/
  920. };
  921. initState="Initialise_Base";
  922. finalStates[] =
  923. {
  924. };
  925. };
  926. /*%FSM</COMPILE>*/