@v12-engine/engine 0.1.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (951) hide show
  1. package/dist/abilities/amounts.d.ts +28 -0
  2. package/dist/abilities/amounts.js +74 -0
  3. package/dist/abilities/amounts.js.map +1 -0
  4. package/dist/abilities/buffs.d.ts +106 -6
  5. package/dist/abilities/buffs.js +443 -0
  6. package/dist/abilities/buffs.js.map +1 -0
  7. package/dist/abilities/castTold.d.ts +2 -0
  8. package/dist/abilities/castTold.js +66 -0
  9. package/dist/abilities/castTold.js.map +1 -0
  10. package/dist/abilities/chance.d.ts +38 -0
  11. package/dist/abilities/chance.js +77 -0
  12. package/dist/abilities/chance.js.map +1 -0
  13. package/dist/abilities/charges.d.ts +18 -0
  14. package/dist/abilities/charges.js +101 -0
  15. package/dist/abilities/charges.js.map +1 -0
  16. package/dist/abilities/control.d.ts +28 -0
  17. package/dist/abilities/control.js +113 -0
  18. package/dist/abilities/control.js.map +1 -0
  19. package/dist/abilities/dispel.js +51 -0
  20. package/dist/abilities/dispel.js.map +1 -0
  21. package/dist/abilities/effectFields.d.ts +1 -1
  22. package/dist/abilities/effectFields.js +676 -0
  23. package/dist/abilities/effectFields.js.map +1 -0
  24. package/dist/abilities/effectIndex.d.ts +27 -0
  25. package/dist/abilities/effectIndex.js +64 -0
  26. package/dist/abilities/effectIndex.js.map +1 -0
  27. package/dist/abilities/effects/buff.d.ts +9 -3
  28. package/dist/abilities/effects/buff.js +84 -0
  29. package/dist/abilities/effects/buff.js.map +1 -0
  30. package/dist/abilities/effects/conditions.d.ts +2 -0
  31. package/dist/abilities/effects/conditions.js +41 -0
  32. package/dist/abilities/effects/conditions.js.map +1 -0
  33. package/dist/abilities/effects/core.js +54 -0
  34. package/dist/abilities/effects/core.js.map +1 -0
  35. package/dist/abilities/effects/damage.d.ts +1 -1
  36. package/dist/abilities/effects/damage.js +43 -0
  37. package/dist/abilities/effects/damage.js.map +1 -0
  38. package/dist/abilities/effects/heal.d.ts +2 -2
  39. package/dist/abilities/effects/heal.js +51 -0
  40. package/dist/abilities/effects/heal.js.map +1 -0
  41. package/dist/abilities/effects/missile.d.ts +13 -1
  42. package/dist/abilities/effects/missile.js +104 -0
  43. package/dist/abilities/effects/missile.js.map +1 -0
  44. package/dist/abilities/effects/morph.d.ts +5 -0
  45. package/dist/abilities/effects/morph.js +43 -0
  46. package/dist/abilities/effects/morph.js.map +1 -0
  47. package/dist/abilities/effects/moves.d.ts +16 -4
  48. package/dist/abilities/effects/moves.js +212 -0
  49. package/dist/abilities/effects/moves.js.map +1 -0
  50. package/dist/abilities/effects/passives.d.ts +19 -9
  51. package/dist/abilities/effects/passives.js +131 -0
  52. package/dist/abilities/effects/passives.js.map +1 -0
  53. package/dist/abilities/effects/proxy.d.ts +5 -0
  54. package/dist/abilities/effects/proxy.js +60 -0
  55. package/dist/abilities/effects/proxy.js.map +1 -0
  56. package/dist/abilities/effects/sight.d.ts +2 -2
  57. package/dist/abilities/effects/sight.js +39 -0
  58. package/dist/abilities/effects/sight.js.map +1 -0
  59. package/dist/abilities/effects/spawn.d.ts +5 -2
  60. package/dist/abilities/effects/spawn.js +40 -0
  61. package/dist/abilities/effects/spawn.js.map +1 -0
  62. package/dist/abilities/effects/timed.d.ts +2 -2
  63. package/dist/abilities/effects/timed.js +96 -0
  64. package/dist/abilities/effects/timed.js.map +1 -0
  65. package/dist/abilities/effects/trade.d.ts +1 -1
  66. package/dist/abilities/effects/trade.js +25 -0
  67. package/dist/abilities/effects/trade.js.map +1 -0
  68. package/dist/abilities/effects.d.ts +97 -23
  69. package/dist/abilities/effects.js +860 -0
  70. package/dist/abilities/effects.js.map +1 -0
  71. package/dist/abilities/land.d.ts +38 -4
  72. package/dist/abilities/land.js +189 -0
  73. package/dist/abilities/land.js.map +1 -0
  74. package/dist/abilities/recast.d.ts +45 -0
  75. package/dist/abilities/recast.js +118 -0
  76. package/dist/abilities/recast.js.map +1 -0
  77. package/dist/abilities/scaled.js +40 -0
  78. package/dist/abilities/scaled.js.map +1 -0
  79. package/dist/abilities/screen.d.ts +6 -0
  80. package/dist/abilities/screen.js +83 -0
  81. package/dist/abilities/screen.js.map +1 -0
  82. package/dist/abilities/shapes.d.ts +66 -0
  83. package/dist/abilities/shapes.js +122 -0
  84. package/dist/abilities/shapes.js.map +1 -0
  85. package/dist/abilities/text.d.ts +14 -2
  86. package/dist/abilities/text.js +204 -0
  87. package/dist/abilities/text.js.map +1 -0
  88. package/dist/abilities/triggers.d.ts +98 -0
  89. package/dist/abilities/triggers.js +351 -0
  90. package/dist/abilities/triggers.js.map +1 -0
  91. package/dist/abilityChanges.d.ts +131 -0
  92. package/dist/abilityChanges.js +345 -0
  93. package/dist/abilityChanges.js.map +1 -0
  94. package/dist/ai/area.d.ts +4 -1
  95. package/dist/ai/brain.d.ts +4 -1
  96. package/dist/ai/brain.js +844 -0
  97. package/dist/ai/brain.js.map +1 -0
  98. package/dist/ai/budget.js +74 -0
  99. package/dist/ai/budget.js.map +1 -0
  100. package/dist/ai/checks.d.ts +9 -1
  101. package/dist/ai/checks.js +242 -0
  102. package/dist/ai/checks.js.map +1 -0
  103. package/dist/ai/computer.d.ts +11 -4
  104. package/dist/ai/computer.js +251 -0
  105. package/dist/ai/computer.js.map +1 -0
  106. package/dist/ai/defence.d.ts +4 -0
  107. package/dist/ai/defence.js +430 -0
  108. package/dist/ai/defence.js.map +1 -0
  109. package/dist/ai/define.d.ts +3 -2
  110. package/dist/ai/define.js +31 -0
  111. package/dist/ai/define.js.map +1 -0
  112. package/dist/ai/economy.d.ts +10 -7
  113. package/dist/ai/economy.js +780 -0
  114. package/dist/ai/economy.js.map +1 -0
  115. package/dist/ai/geometry.js +38 -0
  116. package/dist/ai/geometry.js.map +1 -0
  117. package/dist/ai/goals.d.ts +1 -0
  118. package/dist/ai/goals.js +560 -0
  119. package/dist/ai/goals.js.map +1 -0
  120. package/dist/ai/knowledge.d.ts +72 -7
  121. package/dist/ai/knowledge.js +804 -0
  122. package/dist/ai/knowledge.js.map +1 -0
  123. package/dist/ai/lanes.d.ts +10 -2
  124. package/dist/ai/lanes.js +715 -0
  125. package/dist/ai/lanes.js.map +1 -0
  126. package/dist/ai/melee/build.js +264 -0
  127. package/dist/ai/melee/build.js.map +1 -0
  128. package/dist/ai/melee/goals.d.ts +7 -0
  129. package/dist/ai/melee/goals.js +720 -0
  130. package/dist/ai/melee/goals.js.map +1 -0
  131. package/dist/ai/melee/heroes.js +68 -0
  132. package/dist/ai/melee/heroes.js.map +1 -0
  133. package/dist/ai/melee/index.d.ts +1 -1
  134. package/dist/ai/melee/index.js +51 -0
  135. package/dist/ai/melee/index.js.map +1 -0
  136. package/dist/ai/melee/production.js +29 -0
  137. package/dist/ai/melee/production.js.map +1 -0
  138. package/dist/ai/melee/surrender.js +64 -0
  139. package/dist/ai/melee/surrender.js.map +1 -0
  140. package/dist/ai/micro.d.ts +9 -0
  141. package/dist/ai/micro.js +1316 -0
  142. package/dist/ai/micro.js.map +1 -0
  143. package/dist/ai/mission.d.ts +9 -2
  144. package/dist/ai/mission.js +538 -0
  145. package/dist/ai/mission.js.map +1 -0
  146. package/dist/ai/missionRules.d.ts +1 -1
  147. package/dist/ai/missionRules.js +26 -0
  148. package/dist/ai/missionRules.js.map +1 -0
  149. package/dist/ai/module.d.ts +6 -2
  150. package/dist/ai/module.js +37 -0
  151. package/dist/ai/module.js.map +1 -0
  152. package/dist/ai/options.d.ts +3 -3
  153. package/dist/ai/plans/build.d.ts +20 -1
  154. package/dist/ai/plans/build.js +608 -0
  155. package/dist/ai/plans/build.js.map +1 -0
  156. package/dist/ai/plans/placement.d.ts +4 -1
  157. package/dist/ai/plans/placement.js +295 -0
  158. package/dist/ai/plans/placement.js.map +1 -0
  159. package/dist/ai/plans/plans.d.ts +9 -0
  160. package/dist/ai/plans/plans.js +110 -0
  161. package/dist/ai/plans/plans.js.map +1 -0
  162. package/dist/ai/plans/production.d.ts +14 -2
  163. package/dist/ai/plans/production.js +434 -0
  164. package/dist/ai/plans/production.js.map +1 -0
  165. package/dist/ai/plans/purse.d.ts +6 -3
  166. package/dist/ai/plans/purse.js +139 -0
  167. package/dist/ai/plans/purse.js.map +1 -0
  168. package/dist/ai/plans/tech.d.ts +6 -0
  169. package/dist/ai/plans/tech.js +122 -0
  170. package/dist/ai/plans/tech.js.map +1 -0
  171. package/dist/ai/profiles.d.ts +4 -4
  172. package/dist/{profiles-B3NS9jwk.js → ai/profiles.js} +3 -98
  173. package/dist/ai/profiles.js.map +1 -0
  174. package/dist/ai/reach.js +54 -0
  175. package/dist/ai/reach.js.map +1 -0
  176. package/dist/ai/report.d.ts +8 -0
  177. package/dist/ai/report.js +87 -0
  178. package/dist/ai/report.js.map +1 -0
  179. package/dist/ai/roles.d.ts +4 -0
  180. package/dist/ai/roles.js +207 -0
  181. package/dist/ai/roles.js.map +1 -0
  182. package/dist/ai/rules.d.ts +8 -2
  183. package/dist/ai/rules.js +416 -0
  184. package/dist/ai/rules.js.map +1 -0
  185. package/dist/ai/scouting.d.ts +6 -0
  186. package/dist/ai/scouting.js +324 -0
  187. package/dist/ai/scouting.js.map +1 -0
  188. package/dist/ai/settings.js +99 -0
  189. package/dist/ai/settings.js.map +1 -0
  190. package/dist/ai/squads.d.ts +21 -2
  191. package/dist/ai/squads.js +916 -0
  192. package/dist/ai/squads.js.map +1 -0
  193. package/dist/ai/strength.js +320 -0
  194. package/dist/ai/strength.js.map +1 -0
  195. package/dist/ai/task.d.ts +3 -1
  196. package/dist/ai/task.js +17 -0
  197. package/dist/ai/task.js.map +1 -0
  198. package/dist/ai/tasks/attack.js +24 -0
  199. package/dist/ai/tasks/attack.js.map +1 -0
  200. package/dist/ai/tasks/capture.d.ts +3 -3
  201. package/dist/ai/tasks/capture.js +37 -0
  202. package/dist/ai/tasks/capture.js.map +1 -0
  203. package/dist/ai/tasks/creep.js +29 -0
  204. package/dist/ai/tasks/creep.js.map +1 -0
  205. package/dist/ai/tasks/defend.js +61 -0
  206. package/dist/ai/tasks/defend.js.map +1 -0
  207. package/dist/ai/tasks/drop.js +81 -0
  208. package/dist/ai/tasks/drop.js.map +1 -0
  209. package/dist/ai/tasks/escort.js +59 -0
  210. package/dist/ai/tasks/escort.js.map +1 -0
  211. package/dist/ai/tasks/gather.js +48 -0
  212. package/dist/ai/tasks/gather.js.map +1 -0
  213. package/dist/ai/tasks/harass.js +39 -0
  214. package/dist/ai/tasks/harass.js.map +1 -0
  215. package/dist/ai/tasks/hold.js +32 -0
  216. package/dist/ai/tasks/hold.js.map +1 -0
  217. package/dist/ai/tasks/index.js +34 -0
  218. package/dist/ai/tasks/index.js.map +1 -0
  219. package/dist/ai/tasks/move.js +26 -0
  220. package/dist/ai/tasks/move.js.map +1 -0
  221. package/dist/ai/tasks/patrol.js +59 -0
  222. package/dist/ai/tasks/patrol.js.map +1 -0
  223. package/dist/ai/tasks/retreat.js +28 -0
  224. package/dist/ai/tasks/retreat.js.map +1 -0
  225. package/dist/ai/tasks/scout.js +73 -0
  226. package/dist/ai/tasks/scout.js.map +1 -0
  227. package/dist/ai/tasks/shared.d.ts +1 -1
  228. package/dist/ai/tasks/shared.js +137 -0
  229. package/dist/ai/tasks/shared.js.map +1 -0
  230. package/dist/ai/team.d.ts +18 -1
  231. package/dist/ai/team.js +492 -0
  232. package/dist/ai/team.js.map +1 -0
  233. package/dist/ai/threat.d.ts +6 -0
  234. package/dist/ai/threat.js +206 -0
  235. package/dist/ai/threat.js.map +1 -0
  236. package/dist/ai/view.d.ts +21 -7
  237. package/dist/ai/view.js +677 -0
  238. package/dist/ai/view.js.map +1 -0
  239. package/dist/ai/waves.d.ts +6 -0
  240. package/dist/ai/waves.js +410 -0
  241. package/dist/ai/waves.js.map +1 -0
  242. package/dist/ai.js +54 -6239
  243. package/dist/aiTesting.d.ts +6 -3
  244. package/dist/aiTesting.js +229 -0
  245. package/dist/aiTesting.js.map +1 -0
  246. package/dist/areas.d.ts +4 -1
  247. package/dist/areas.js +295 -0
  248. package/dist/areas.js.map +1 -0
  249. package/dist/attacks.d.ts +3 -3
  250. package/dist/attacks.js +127 -0
  251. package/dist/attacks.js.map +1 -0
  252. package/dist/burning.d.ts +267 -0
  253. package/dist/burning.js +795 -0
  254. package/dist/burning.js.map +1 -0
  255. package/dist/bytes.js +21 -0
  256. package/dist/bytes.js.map +1 -0
  257. package/dist/callings.d.ts +71 -0
  258. package/dist/callings.js +157 -0
  259. package/dist/callings.js.map +1 -0
  260. package/dist/cameraOrders.d.ts +78 -0
  261. package/dist/cameraOrders.js +114 -0
  262. package/dist/cameraOrders.js.map +1 -0
  263. package/dist/camps.d.ts +70 -4
  264. package/dist/camps.js +501 -0
  265. package/dist/camps.js.map +1 -0
  266. package/dist/capture.d.ts +15 -3
  267. package/dist/capture.js +304 -0
  268. package/dist/capture.js.map +1 -0
  269. package/dist/cellLayers.d.ts +78 -13
  270. package/dist/cellLayers.js +275 -0
  271. package/dist/cellLayers.js.map +1 -0
  272. package/dist/cellPatches.d.ts +24 -0
  273. package/dist/cellPatches.js +73 -0
  274. package/dist/cellPatches.js.map +1 -0
  275. package/dist/cinematics.d.ts +10 -5
  276. package/dist/cinematics.js +161 -0
  277. package/dist/cinematics.js.map +1 -0
  278. package/dist/clock.d.ts +2 -2
  279. package/dist/clock.js +78 -0
  280. package/dist/clock.js.map +1 -0
  281. package/dist/commands.d.ts +36 -4
  282. package/dist/commands.js +636 -0
  283. package/dist/commands.js.map +1 -0
  284. package/dist/components.d.ts +31 -10
  285. package/dist/components.js +74 -0
  286. package/dist/components.js.map +1 -0
  287. package/dist/computers.d.ts +4 -4
  288. package/dist/computers.js +194 -0
  289. package/dist/computers.js.map +1 -0
  290. package/dist/concealment.d.ts +25 -2
  291. package/dist/concealment.js +409 -0
  292. package/dist/concealment.js.map +1 -0
  293. package/dist/coreComponents.js +130 -0
  294. package/dist/coreComponents.js.map +1 -0
  295. package/dist/createGame.d.ts +306 -0
  296. package/dist/createGame.js +405 -0
  297. package/dist/createGame.js.map +1 -0
  298. package/dist/dashing.d.ts +18 -2
  299. package/dist/dashing.js +41 -0
  300. package/dist/dashing.js.map +1 -0
  301. package/dist/debug.d.ts +8 -0
  302. package/dist/debug.js +5 -3
  303. package/dist/debug2.js +76 -0
  304. package/dist/debug2.js.map +1 -0
  305. package/dist/debugCommands.d.ts +6 -6
  306. package/dist/debugCommands.js +537 -0
  307. package/dist/debugCommands.js.map +1 -0
  308. package/dist/debugging.d.ts +1 -0
  309. package/dist/defaultSets.d.ts +183 -0
  310. package/dist/defaultSets.js +216 -0
  311. package/dist/defaultSets.js.map +1 -0
  312. package/dist/definitions.d.ts +6 -0
  313. package/dist/definitions.js +78 -0
  314. package/dist/definitions.js.map +1 -0
  315. package/dist/defs.d.ts +1895 -165
  316. package/dist/defs.js +380 -0
  317. package/dist/defs.js.map +1 -0
  318. package/dist/denying.d.ts +4 -4
  319. package/dist/denying.js +106 -0
  320. package/dist/denying.js.map +1 -0
  321. package/dist/destructibles.d.ts +2 -2
  322. package/dist/destructibles.js +36 -0
  323. package/dist/destructibles.js.map +1 -0
  324. package/dist/determinism.d.ts +4 -4
  325. package/dist/determinism.js +247 -0
  326. package/dist/determinism.js.map +1 -0
  327. package/dist/dialog.d.ts +17 -2
  328. package/dist/dialog.js +108 -0
  329. package/dist/dialog.js.map +1 -0
  330. package/dist/effectRefs.js +28 -0
  331. package/dist/effectRefs.js.map +1 -0
  332. package/dist/effects.d.ts +27 -11
  333. package/dist/effects.js +110 -0
  334. package/dist/effects.js.map +1 -0
  335. package/dist/endings.d.ts +1 -1
  336. package/dist/endings.js +78 -0
  337. package/dist/endings.js.map +1 -0
  338. package/dist/engagement.d.ts +40 -6
  339. package/dist/engagement.js +530 -0
  340. package/dist/engagement.js.map +1 -0
  341. package/dist/engineEvents.d.ts +72 -9
  342. package/dist/engineEvents.js +520 -0
  343. package/dist/engineEvents.js.map +1 -0
  344. package/dist/entity.d.ts +275 -26
  345. package/dist/entity.js +441 -0
  346. package/dist/entity.js.map +1 -0
  347. package/dist/entityIndex.d.ts +10 -3
  348. package/dist/entityIndex.js +149 -0
  349. package/dist/entityIndex.js.map +1 -0
  350. package/dist/errors.d.ts +6 -2
  351. package/dist/errors.js +59 -0
  352. package/dist/errors.js.map +1 -0
  353. package/dist/events.d.ts +11 -5
  354. package/dist/events.js +158 -0
  355. package/dist/events.js.map +1 -0
  356. package/dist/exactMath.js +273 -0
  357. package/dist/exactMath.js.map +1 -0
  358. package/dist/features.d.ts +1 -1
  359. package/dist/features.js +127 -0
  360. package/dist/features.js.map +1 -0
  361. package/dist/fields.d.ts +25 -5
  362. package/dist/fields.js +140 -0
  363. package/dist/fields.js.map +1 -0
  364. package/dist/fixture.d.ts +3 -3
  365. package/dist/fixture.js +512 -0
  366. package/dist/fixture.js.map +1 -0
  367. package/dist/fog.d.ts +26 -3
  368. package/dist/fog.js +333 -0
  369. package/dist/fog.js.map +1 -0
  370. package/dist/foliage.d.ts +476 -0
  371. package/dist/foliage.js +1478 -0
  372. package/dist/foliage.js.map +1 -0
  373. package/dist/foliageDebug.d.ts +57 -0
  374. package/dist/foliageDebug.js +172 -0
  375. package/dist/foliageDebug.js.map +1 -0
  376. package/dist/foliageRegrowth.d.ts +20 -0
  377. package/dist/foliageRegrowth.js +332 -0
  378. package/dist/foliageRegrowth.js.map +1 -0
  379. package/dist/formState.d.ts +67 -0
  380. package/dist/formState.js +65 -0
  381. package/dist/formState.js.map +1 -0
  382. package/dist/formation.d.ts +46 -8
  383. package/dist/formation.js +297 -0
  384. package/dist/formation.js.map +1 -0
  385. package/dist/forms.d.ts +58 -0
  386. package/dist/forms.js +146 -0
  387. package/dist/forms.js.map +1 -0
  388. package/dist/friendlyFire.d.ts +2 -2
  389. package/dist/friendlyFire.js +37 -0
  390. package/dist/friendlyFire.js.map +1 -0
  391. package/dist/game.d.ts +141 -48
  392. package/dist/game.js +834 -0
  393. package/dist/game.js.map +1 -0
  394. package/dist/gameData.d.ts +96 -22
  395. package/dist/gameData.js +1690 -0
  396. package/dist/gameData.js.map +1 -0
  397. package/dist/gameFiles.d.ts +3 -3
  398. package/dist/gameFiles.js +14 -0
  399. package/dist/gameFiles.js.map +1 -0
  400. package/dist/gates.js +92 -0
  401. package/dist/gates.js.map +1 -0
  402. package/dist/generate.d.ts +28 -1
  403. package/dist/generate.js +1062 -0
  404. package/dist/generate.js.map +1 -0
  405. package/dist/generateWorker.d.ts +7 -3
  406. package/dist/generateWorker.js +86 -0
  407. package/dist/generateWorker.js.map +1 -0
  408. package/dist/grid.d.ts +9 -0
  409. package/dist/grid.js +102 -0
  410. package/dist/grid.js.map +1 -0
  411. package/dist/ground.d.ts +17 -1
  412. package/dist/ground.js +375 -0
  413. package/dist/ground.js.map +1 -0
  414. package/dist/groundObjects.d.ts +70 -0
  415. package/dist/groundObjects.js +371 -0
  416. package/dist/groundObjects.js.map +1 -0
  417. package/dist/groundSpeed.d.ts +20 -3
  418. package/dist/groundSpeed.js +117 -0
  419. package/dist/groundSpeed.js.map +1 -0
  420. package/dist/hero.d.ts +126 -10
  421. package/dist/hero.js +432 -0
  422. package/dist/hero.js.map +1 -0
  423. package/dist/holds.d.ts +94 -0
  424. package/dist/holds.js +305 -0
  425. package/dist/holds.js.map +1 -0
  426. package/dist/home.d.ts +1 -1
  427. package/dist/home.js +30 -0
  428. package/dist/home.js.map +1 -0
  429. package/dist/hooks.d.ts +339 -57
  430. package/dist/hooks.js +105 -0
  431. package/dist/hooks.js.map +1 -0
  432. package/dist/hotReload.d.ts +6 -5
  433. package/dist/hotReload.js +145 -0
  434. package/dist/hotReload.js.map +1 -0
  435. package/dist/ids.d.ts +3 -3
  436. package/dist/ids.js +30 -0
  437. package/dist/ids.js.map +1 -0
  438. package/dist/idsFile.d.ts +36 -0
  439. package/dist/idsFile.js +134 -0
  440. package/dist/idsFile.js.map +1 -0
  441. package/dist/index.d.ts +105 -68
  442. package/dist/index.js +194 -4701
  443. package/dist/inspect.d.ts +29 -2
  444. package/dist/{inspect-D9dWHmZ0.js → inspect.js} +21 -12
  445. package/dist/inspect.js.map +1 -0
  446. package/dist/inventory.d.ts +14 -1
  447. package/dist/inventory.js +84 -0
  448. package/dist/inventory.js.map +1 -0
  449. package/dist/items.d.ts +136 -8
  450. package/dist/items.js +585 -0
  451. package/dist/items.js.map +1 -0
  452. package/dist/lanes.d.ts +12 -3
  453. package/dist/lanes.js +496 -0
  454. package/dist/lanes.js.map +1 -0
  455. package/dist/life.d.ts +6 -2
  456. package/dist/life.js +287 -0
  457. package/dist/life.js.map +1 -0
  458. package/dist/log.d.ts +26 -3
  459. package/dist/log.js +192 -0
  460. package/dist/log.js.map +1 -0
  461. package/dist/manaBurn.d.ts +2 -2
  462. package/dist/manaBurn.js +75 -0
  463. package/dist/manaBurn.js.map +1 -0
  464. package/dist/map/file.d.ts +56 -3
  465. package/dist/map/file.js +264 -0
  466. package/dist/map/file.js.map +1 -0
  467. package/dist/map/images.js +61 -0
  468. package/dist/map/images.js.map +1 -0
  469. package/dist/map/look.d.ts +1 -1
  470. package/dist/map/look.js +30 -0
  471. package/dist/map/look.js.map +1 -0
  472. package/dist/map/pathProfile.js +183 -0
  473. package/dist/map/pathProfile.js.map +1 -0
  474. package/dist/map/resize.d.ts +4 -0
  475. package/dist/map/resize.js +136 -0
  476. package/dist/map/resize.js.map +1 -0
  477. package/dist/map/schema.js +257 -0
  478. package/dist/map/schema.js.map +1 -0
  479. package/dist/map/terrain.js +214 -0
  480. package/dist/map/terrain.js.map +1 -0
  481. package/dist/map/types.d.ts +92 -13
  482. package/dist/map/types.js +251 -0
  483. package/dist/map/types.js.map +1 -0
  484. package/dist/mapCheck/cells.js +94 -0
  485. package/dist/mapCheck/cells.js.map +1 -0
  486. package/dist/mapCheck/rules/foliage.d.ts +9 -0
  487. package/dist/mapCheck/rules/foliage.js +83 -0
  488. package/dist/mapCheck/rules/foliage.js.map +1 -0
  489. package/dist/mapCheck/rules/names.js +39 -0
  490. package/dist/mapCheck/rules/names.js.map +1 -0
  491. package/dist/mapCheck/rules/objects.d.ts +1 -1
  492. package/dist/mapCheck/rules/objects.js +56 -0
  493. package/dist/mapCheck/rules/objects.js.map +1 -0
  494. package/dist/mapCheck/rules/paths.js +32 -0
  495. package/dist/mapCheck/rules/paths.js.map +1 -0
  496. package/dist/mapCheck/rules/players.js +20 -0
  497. package/dist/mapCheck/rules/players.js.map +1 -0
  498. package/dist/mapCheck/rules/races.js +56 -0
  499. package/dist/mapCheck/rules/races.js.map +1 -0
  500. package/dist/mapCheck/rules/random.js +47 -0
  501. package/dist/mapCheck/rules/random.js.map +1 -0
  502. package/dist/mapCheck/rules/regions.js +30 -0
  503. package/dist/mapCheck/rules/regions.js.map +1 -0
  504. package/dist/mapCheck/rules/targets.js +31 -0
  505. package/dist/mapCheck/rules/targets.js.map +1 -0
  506. package/dist/mapCheck/rules/walking.js +45 -0
  507. package/dist/mapCheck/rules/walking.js.map +1 -0
  508. package/dist/mapCheck.d.ts +2 -2
  509. package/dist/mapCheck.js +63 -0
  510. package/dist/mapCheck.js.map +1 -0
  511. package/dist/mapFields.d.ts +25 -2
  512. package/dist/mapFields.js +134 -0
  513. package/dist/mapFields.js.map +1 -0
  514. package/dist/mapFile.js +176 -0
  515. package/dist/mapFile.js.map +1 -0
  516. package/dist/mapMeasure.d.ts +8 -0
  517. package/dist/mapMeasure.js +283 -0
  518. package/dist/mapMeasure.js.map +1 -0
  519. package/dist/mapMerge.d.ts +1 -0
  520. package/dist/mapMerge.js +172 -0
  521. package/dist/mapMerge.js.map +1 -0
  522. package/dist/mapObjectives.js +138 -0
  523. package/dist/mapObjectives.js.map +1 -0
  524. package/dist/mapObjects.js +80 -0
  525. package/dist/mapObjects.js.map +1 -0
  526. package/dist/math.d.ts +37 -7
  527. package/dist/math.js +155 -0
  528. package/dist/math.js.map +1 -0
  529. package/dist/messages.d.ts +71 -4
  530. package/dist/messages.js +29 -0
  531. package/dist/messages.js.map +1 -0
  532. package/dist/missionRules.d.ts +10 -2
  533. package/dist/{missionRules-C-bGxm0Q.js → missionRules.js} +30 -150
  534. package/dist/missionRules.js.map +1 -0
  535. package/dist/mods.d.ts +39 -20
  536. package/dist/mods.js +271 -0
  537. package/dist/mods.js.map +1 -0
  538. package/dist/moves.d.ts +87 -0
  539. package/dist/moves.js +539 -0
  540. package/dist/moves.js.map +1 -0
  541. package/dist/names.d.ts +7 -0
  542. package/dist/names.js +122 -0
  543. package/dist/names.js.map +1 -0
  544. package/dist/navigation/agentParams.js +14 -0
  545. package/dist/navigation/agentParams.js.map +1 -0
  546. package/dist/navigation/air.d.ts +7 -3
  547. package/dist/navigation/air.js +401 -0
  548. package/dist/navigation/air.js.map +1 -0
  549. package/dist/navigation/builds.d.ts +34 -2
  550. package/dist/navigation/builds.js +287 -0
  551. package/dist/navigation/builds.js.map +1 -0
  552. package/dist/navigation/groundAreas.d.ts +59 -1
  553. package/dist/navigation/groundAreas.js +407 -0
  554. package/dist/navigation/groundAreas.js.map +1 -0
  555. package/dist/navigation/navigation.d.ts +98 -9
  556. package/dist/navigation/recast.d.ts +194 -18
  557. package/dist/navigation/recast.js +1379 -0
  558. package/dist/navigation/recast.js.map +1 -0
  559. package/dist/navigation/sidePaths.d.ts +8 -3
  560. package/dist/navigation/sidePaths.js +241 -0
  561. package/dist/navigation/sidePaths.js.map +1 -0
  562. package/dist/navigation/sized.js +243 -0
  563. package/dist/navigation/sized.js.map +1 -0
  564. package/dist/nearest.js +32 -0
  565. package/dist/nearest.js.map +1 -0
  566. package/dist/noise.js +59 -0
  567. package/dist/noise.js.map +1 -0
  568. package/dist/objectives.d.ts +12 -3
  569. package/dist/objectives.js +144 -0
  570. package/dist/objectives.js.map +1 -0
  571. package/dist/orders/basic.d.ts +5 -5
  572. package/dist/orders/basic.js +417 -0
  573. package/dist/orders/basic.js.map +1 -0
  574. package/dist/orders/build.js +278 -0
  575. package/dist/orders/build.js.map +1 -0
  576. package/dist/orders/cast.d.ts +13 -3
  577. package/dist/orders/cast.js +558 -0
  578. package/dist/orders/cast.js.map +1 -0
  579. package/dist/orders/facts.js +16 -0
  580. package/dist/orders/facts.js.map +1 -0
  581. package/dist/orders/harvest.d.ts +21 -5
  582. package/dist/orders/harvest.js +540 -0
  583. package/dist/orders/harvest.js.map +1 -0
  584. package/dist/orders/idle.d.ts +3 -1
  585. package/dist/orders/idle.js +234 -0
  586. package/dist/orders/idle.js.map +1 -0
  587. package/dist/orders/items.js +92 -0
  588. package/dist/orders/items.js.map +1 -0
  589. package/dist/orders/queue.js +108 -0
  590. package/dist/orders/queue.js.map +1 -0
  591. package/dist/orders/waiting.d.ts +39 -0
  592. package/dist/orders/waiting.js +149 -0
  593. package/dist/orders/waiting.js.map +1 -0
  594. package/dist/pack.schema.js +13 -0
  595. package/dist/pack.schema.js.map +1 -0
  596. package/dist/pack.schema.json +7622 -841
  597. package/dist/packs/director/index.d.ts +13 -5
  598. package/dist/packs/director/index.js +204 -0
  599. package/dist/packs/director/index.js.map +1 -0
  600. package/dist/packs/heroes/campaign.d.ts +3 -2
  601. package/dist/packs/heroes/campaign.js +241 -0
  602. package/dist/packs/heroes/campaign.js.map +1 -0
  603. package/dist/packs/heroes/carry.d.ts +6 -0
  604. package/dist/packs/heroes/carry.js +112 -0
  605. package/dist/packs/heroes/carry.js.map +1 -0
  606. package/dist/packs/heroes/commands.js +115 -0
  607. package/dist/packs/heroes/commands.js.map +1 -0
  608. package/dist/packs/heroes/fallen.d.ts +43 -0
  609. package/dist/packs/heroes/fallen.js +61 -0
  610. package/dist/packs/heroes/fallen.js.map +1 -0
  611. package/dist/packs/heroes/hire.js +60 -0
  612. package/dist/packs/heroes/hire.js.map +1 -0
  613. package/dist/packs/heroes/index.d.ts +7 -6
  614. package/dist/packs/heroes/index.js +130 -0
  615. package/dist/packs/heroes/index.js.map +1 -0
  616. package/dist/packs/heroes/loop.d.ts +95 -0
  617. package/dist/packs/heroes/loop.js +250 -0
  618. package/dist/packs/heroes/loop.js.map +1 -0
  619. package/dist/packs/heroes/making.d.ts +6 -3
  620. package/dist/packs/heroes/making.js +55 -0
  621. package/dist/packs/heroes/making.js.map +1 -0
  622. package/dist/packs/heroes/respawn.d.ts +3 -3
  623. package/dist/packs/heroes/respawn.js +87 -0
  624. package/dist/packs/heroes/respawn.js.map +1 -0
  625. package/dist/packs/heroes/sets.d.ts +32 -0
  626. package/dist/packs/heroes/sets.js +51 -0
  627. package/dist/packs/heroes/sets.js.map +1 -0
  628. package/dist/packs/heroes/spells.d.ts +16 -0
  629. package/dist/packs/heroes/spells.js +269 -0
  630. package/dist/packs/heroes/spells.js.map +1 -0
  631. package/dist/packs/items/defaults.d.ts +43 -0
  632. package/dist/packs/items/defaults.js +1504 -0
  633. package/dist/packs/items/defaults.js.map +1 -0
  634. package/dist/packs/items/index.d.ts +27 -0
  635. package/dist/packs/items/index.js +214 -0
  636. package/dist/packs/items/index.js.map +1 -0
  637. package/dist/packs/moba/index.d.ts +3 -3
  638. package/dist/packs/moba/index.js +174 -0
  639. package/dist/packs/moba/index.js.map +1 -0
  640. package/dist/packs/pack.d.ts +15 -15
  641. package/dist/packs/pack.js +14 -0
  642. package/dist/packs/pack.js.map +1 -0
  643. package/dist/packs.d.ts +15 -7
  644. package/dist/packs.js +222 -0
  645. package/dist/packs.js.map +1 -0
  646. package/dist/paths.d.ts +2 -0
  647. package/dist/paths.js +109 -0
  648. package/dist/paths.js.map +1 -0
  649. package/dist/plain.js +57 -0
  650. package/dist/plain.js.map +1 -0
  651. package/dist/player.d.ts +33 -10
  652. package/dist/player.js +159 -0
  653. package/dist/player.js.map +1 -0
  654. package/dist/portals.d.ts +1 -1
  655. package/dist/portals.js +194 -0
  656. package/dist/portals.js.map +1 -0
  657. package/dist/prefabs.d.ts +25 -2
  658. package/dist/prefabs.js +239 -0
  659. package/dist/prefabs.js.map +1 -0
  660. package/dist/presetBuildings.js +58 -0
  661. package/dist/presetBuildings.js.map +1 -0
  662. package/dist/presetFoliage.d.ts +27 -0
  663. package/dist/presetFoliage.js +98 -0
  664. package/dist/presetFoliage.js.map +1 -0
  665. package/dist/presetGround.js +65 -0
  666. package/dist/presetGround.js.map +1 -0
  667. package/dist/proxies.d.ts +12 -0
  668. package/dist/proxies.js +79 -0
  669. package/dist/proxies.js.map +1 -0
  670. package/dist/query.d.ts +56 -0
  671. package/dist/query.js +88 -0
  672. package/dist/query.js.map +1 -0
  673. package/dist/races.d.ts +15 -14
  674. package/dist/races.js +172 -0
  675. package/dist/races.js.map +1 -0
  676. package/dist/randomGroups.js +91 -0
  677. package/dist/randomGroups.js.map +1 -0
  678. package/dist/registry.d.ts +117 -53
  679. package/dist/registry.js +323 -0
  680. package/dist/registry.js.map +1 -0
  681. package/dist/remains.d.ts +11 -9
  682. package/dist/remains.js +188 -0
  683. package/dist/remains.js.map +1 -0
  684. package/dist/replication.d.ts +12 -7
  685. package/dist/replication.js +100 -0
  686. package/dist/replication.js.map +1 -0
  687. package/dist/rng.d.ts +2 -0
  688. package/dist/rng.js +40 -0
  689. package/dist/rng.js.map +1 -0
  690. package/dist/rules.d.ts +186 -99
  691. package/dist/rules.js +179 -0
  692. package/dist/rules.js.map +1 -0
  693. package/dist/rulesCheck.d.ts +5 -4
  694. package/dist/rulesCheck.js +693 -0
  695. package/dist/rulesCheck.js.map +1 -0
  696. package/dist/runes.d.ts +2 -2
  697. package/dist/runes.js +80 -0
  698. package/dist/runes.js.map +1 -0
  699. package/dist/save.d.ts +37 -12
  700. package/dist/save.js +532 -0
  701. package/dist/save.js.map +1 -0
  702. package/dist/scenario.d.ts +2 -2
  703. package/dist/scenario.js +99 -0
  704. package/dist/scenario.js.map +1 -0
  705. package/dist/scheduler.d.ts +3 -0
  706. package/dist/scheduler.js +156 -0
  707. package/dist/scheduler.js.map +1 -0
  708. package/dist/score.d.ts +19 -19
  709. package/dist/score.js +709 -0
  710. package/dist/score.js.map +1 -0
  711. package/dist/sequences.d.ts +10 -6
  712. package/dist/sequences.js +206 -0
  713. package/dist/sequences.js.map +1 -0
  714. package/dist/server/doorman.js +154 -0
  715. package/dist/server/doorman.js.map +1 -0
  716. package/dist/server/gameServer.d.ts +16 -1
  717. package/dist/server/gameServer.js +643 -0
  718. package/dist/server/gameServer.js.map +1 -0
  719. package/dist/server/index.d.ts +1 -1
  720. package/dist/server/lobby.js +199 -0
  721. package/dist/server/lobby.js.map +1 -0
  722. package/dist/server/log.js +18 -0
  723. package/dist/server/log.js.map +1 -0
  724. package/dist/server/match.js +267 -0
  725. package/dist/server/match.js.map +1 -0
  726. package/dist/server/mode.d.ts +18 -9
  727. package/dist/server/mode.js +220 -0
  728. package/dist/server/mode.js.map +1 -0
  729. package/dist/{navigation-worker.js → server/navigation-worker.js} +1 -1
  730. package/dist/server/navigation-worker.js.map +1 -0
  731. package/dist/server/navigation.js +39 -0
  732. package/dist/server/navigation.js.map +1 -0
  733. package/dist/server/ops.d.ts +4 -0
  734. package/dist/server/ops.js +137 -0
  735. package/dist/server/ops.js.map +1 -0
  736. package/dist/server/packs.d.ts +3 -3
  737. package/dist/server/packs.js +32 -0
  738. package/dist/server/packs.js.map +1 -0
  739. package/dist/server/ratings.d.ts +5 -0
  740. package/dist/server/ratings.js +104 -0
  741. package/dist/server/ratings.js.map +1 -0
  742. package/dist/server/relay.d.ts +12 -2
  743. package/dist/server/relay.js +144 -0
  744. package/dist/server/relay.js.map +1 -0
  745. package/dist/server/rooms.d.ts +9 -2
  746. package/dist/server/rooms.js +442 -0
  747. package/dist/server/rooms.js.map +1 -0
  748. package/dist/server/seat.js +116 -0
  749. package/dist/server/seat.js.map +1 -0
  750. package/dist/server/seatSettings.d.ts +3 -3
  751. package/dist/server/seatSettings.js +63 -0
  752. package/dist/server/seatSettings.js.map +1 -0
  753. package/dist/server/secret.js +13 -0
  754. package/dist/server/secret.js.map +1 -0
  755. package/dist/server/start.d.ts +13 -6
  756. package/dist/server/start.js +76 -0
  757. package/dist/server/start.js.map +1 -0
  758. package/dist/server/websocket.d.ts +9 -1
  759. package/dist/server/websocket.js +306 -0
  760. package/dist/server/websocket.js.map +1 -0
  761. package/dist/server.js +15 -2861
  762. package/dist/session/can.js +26 -0
  763. package/dist/session/can.js.map +1 -0
  764. package/dist/session/commandReplay.d.ts +8 -2
  765. package/dist/session/commandReplay.js +293 -0
  766. package/dist/session/commandReplay.js.map +1 -0
  767. package/dist/session/debug.js +151 -0
  768. package/dist/session/debug.js.map +1 -0
  769. package/dist/session/delay.js +62 -0
  770. package/dist/session/delay.js.map +1 -0
  771. package/dist/session/delta.d.ts +14 -1
  772. package/dist/session/delta.js +407 -0
  773. package/dist/session/delta.js.map +1 -0
  774. package/dist/session/entityState.js +415 -0
  775. package/dist/session/entityState.js.map +1 -0
  776. package/dist/session/local.d.ts +47 -5
  777. package/dist/session/local.js +670 -0
  778. package/dist/session/local.js.map +1 -0
  779. package/dist/session/memory.d.ts +20 -2
  780. package/dist/session/memory.js +131 -0
  781. package/dist/session/memory.js.map +1 -0
  782. package/dist/session/protocol.d.ts +325 -31
  783. package/dist/session/protocol.js +55 -0
  784. package/dist/session/protocol.js.map +1 -0
  785. package/dist/session/remote.d.ts +74 -12
  786. package/dist/session/remote.js +1394 -0
  787. package/dist/session/remote.js.map +1 -0
  788. package/dist/session/replay.d.ts +11 -2
  789. package/dist/session/replay.js +160 -0
  790. package/dist/session/replay.js.map +1 -0
  791. package/dist/session/seed.js +12 -0
  792. package/dist/session/seed.js.map +1 -0
  793. package/dist/session/share.d.ts +5 -1
  794. package/dist/session/share.js +94 -0
  795. package/dist/session/share.js.map +1 -0
  796. package/dist/session/socket.d.ts +1 -1
  797. package/dist/session/socket.js +29 -0
  798. package/dist/session/socket.js.map +1 -0
  799. package/dist/session/wire.d.ts +5 -0
  800. package/dist/session/wire.js +84 -0
  801. package/dist/session/wire.js.map +1 -0
  802. package/dist/session/worker.d.ts +77 -12
  803. package/dist/session/worker.js +499 -0
  804. package/dist/session/worker.js.map +1 -0
  805. package/dist/shared.d.ts +31 -5
  806. package/dist/shared.js +166 -0
  807. package/dist/shared.js.map +1 -0
  808. package/dist/sides.d.ts +9 -3
  809. package/dist/sides.js +149 -0
  810. package/dist/sides.js.map +1 -0
  811. package/dist/sight.js +85 -0
  812. package/dist/sight.js.map +1 -0
  813. package/dist/simulate-worker.js +1 -1
  814. package/dist/simulate.d.ts +12 -8
  815. package/dist/{simulate-oXBiw1Ff.js → simulate.js} +10 -11
  816. package/dist/simulate.js.map +1 -0
  817. package/dist/smart.js +77 -0
  818. package/dist/smart.js.map +1 -0
  819. package/dist/spatial.d.ts +32 -16
  820. package/dist/spatial.js +234 -0
  821. package/dist/spatial.js.map +1 -0
  822. package/dist/spawning.d.ts +1 -0
  823. package/dist/spawning.js +224 -0
  824. package/dist/spawning.js.map +1 -0
  825. package/dist/stances.d.ts +6 -3
  826. package/dist/stances.js +169 -0
  827. package/dist/stances.js.map +1 -0
  828. package/dist/start.d.ts +10 -10
  829. package/dist/start.js +75 -0
  830. package/dist/start.js.map +1 -0
  831. package/dist/stats.d.ts +42 -16
  832. package/dist/stats.js +290 -0
  833. package/dist/stats.js.map +1 -0
  834. package/dist/summoned.d.ts +52 -0
  835. package/dist/summoned.js +38 -0
  836. package/dist/summoned.js.map +1 -0
  837. package/dist/summons.d.ts +10 -13
  838. package/dist/summons.js +271 -0
  839. package/dist/summons.js.map +1 -0
  840. package/dist/systems/abilities.js +224 -0
  841. package/dist/systems/abilities.js.map +1 -0
  842. package/dist/systems/combat.d.ts +35 -1
  843. package/dist/systems/combat.js +677 -0
  844. package/dist/systems/combat.js.map +1 -0
  845. package/dist/systems/combatTold.d.ts +3 -1
  846. package/dist/systems/combatTold.js +85 -0
  847. package/dist/systems/combatTold.js.map +1 -0
  848. package/dist/systems/construction.js +80 -0
  849. package/dist/systems/construction.js.map +1 -0
  850. package/dist/systems/economy.d.ts +0 -6
  851. package/dist/systems/economy.js +128 -0
  852. package/dist/systems/economy.js.map +1 -0
  853. package/dist/systems/fog.d.ts +1 -1
  854. package/dist/systems/fog.js +120 -0
  855. package/dist/systems/fog.js.map +1 -0
  856. package/dist/systems/life.js +32 -0
  857. package/dist/systems/life.js.map +1 -0
  858. package/dist/systems/movement.d.ts +24 -12
  859. package/dist/systems/movement.js +1247 -0
  860. package/dist/systems/movement.js.map +1 -0
  861. package/dist/systems/orders.js +64 -0
  862. package/dist/systems/orders.js.map +1 -0
  863. package/dist/systems/production.js +322 -0
  864. package/dist/systems/production.js.map +1 -0
  865. package/dist/systems/productionQueue.js +120 -0
  866. package/dist/systems/productionQueue.js.map +1 -0
  867. package/dist/systems/victory.d.ts +1 -1
  868. package/dist/systems/victory.js +56 -0
  869. package/dist/systems/victory.js.map +1 -0
  870. package/dist/talk.d.ts +6 -6
  871. package/dist/talk.js +153 -0
  872. package/dist/talk.js.map +1 -0
  873. package/dist/targeting.d.ts +142 -0
  874. package/dist/targeting.js +49 -0
  875. package/dist/targeting.js.map +1 -0
  876. package/dist/tech.d.ts +20 -3
  877. package/dist/tech.js +239 -0
  878. package/dist/tech.js.map +1 -0
  879. package/dist/techTree.d.ts +7 -0
  880. package/dist/techTree.js +90 -0
  881. package/dist/techTree.js.map +1 -0
  882. package/dist/terrain.d.ts +59 -7
  883. package/dist/terrain.js +389 -0
  884. package/dist/terrain.js.map +1 -0
  885. package/dist/terrainSave.d.ts +6 -0
  886. package/dist/terrainSave.js +74 -0
  887. package/dist/terrainSave.js.map +1 -0
  888. package/dist/testing.d.ts +8 -7
  889. package/dist/testing.js +13 -739
  890. package/dist/testing.js.map +1 -1
  891. package/dist/tiles.d.ts +1 -1
  892. package/dist/tiles.js +43 -0
  893. package/dist/tiles.js.map +1 -0
  894. package/dist/timers.d.ts +29 -4
  895. package/dist/timers.js +242 -0
  896. package/dist/timers.js.map +1 -0
  897. package/dist/tomes.d.ts +4 -4
  898. package/dist/tomes.js +94 -0
  899. package/dist/tomes.js.map +1 -0
  900. package/dist/trade.js +103 -0
  901. package/dist/trade.js.map +1 -0
  902. package/dist/transport.d.ts +6 -1
  903. package/dist/transport.js +281 -0
  904. package/dist/transport.js.map +1 -0
  905. package/dist/tunables.d.ts +10 -3
  906. package/dist/tunables.js +56 -0
  907. package/dist/tunables.js.map +1 -0
  908. package/dist/unitResources.d.ts +67 -0
  909. package/dist/unitResources.js +266 -0
  910. package/dist/unitResources.js.map +1 -0
  911. package/dist/upkeep.d.ts +6 -1
  912. package/dist/upkeep.js +26 -0
  913. package/dist/upkeep.js.map +1 -0
  914. package/dist/veterancy.d.ts +8 -3
  915. package/dist/veterancy.js +131 -0
  916. package/dist/veterancy.js.map +1 -0
  917. package/dist/vision.d.ts +36 -0
  918. package/dist/vision.js +133 -0
  919. package/dist/vision.js.map +1 -0
  920. package/dist/walls.d.ts +1 -1
  921. package/dist/walls.js +278 -0
  922. package/dist/walls.js.map +1 -0
  923. package/dist/world.d.ts +606 -88
  924. package/dist/world.js +1263 -0
  925. package/dist/world.js.map +1 -0
  926. package/package.json +2 -2
  927. package/dist/ai.js.map +0 -1
  928. package/dist/attributes.d.ts +0 -66
  929. package/dist/brain-BvVdUhX8.js +0 -7659
  930. package/dist/brain-BvVdUhX8.js.map +0 -1
  931. package/dist/builds-C6LfgvEU.js +0 -460
  932. package/dist/builds-C6LfgvEU.js.map +0 -1
  933. package/dist/coreComponents-syuh2fPG.js +0 -5149
  934. package/dist/coreComponents-syuh2fPG.js.map +0 -1
  935. package/dist/debugCommands-CzjrSm66.js +0 -14739
  936. package/dist/debugCommands-CzjrSm66.js.map +0 -1
  937. package/dist/determinism-BCymQwiE.js +0 -518
  938. package/dist/determinism-BCymQwiE.js.map +0 -1
  939. package/dist/game-DiJEN-Ks.js +0 -5800
  940. package/dist/game-DiJEN-Ks.js.map +0 -1
  941. package/dist/index.js.map +0 -1
  942. package/dist/inspect-D9dWHmZ0.js.map +0 -1
  943. package/dist/local-Dkovq42k.js +0 -1379
  944. package/dist/local-Dkovq42k.js.map +0 -1
  945. package/dist/missionRules-C-bGxm0Q.js.map +0 -1
  946. package/dist/navigation-worker.js.map +0 -1
  947. package/dist/packs-g5thvmGn.js +0 -3199
  948. package/dist/packs-g5thvmGn.js.map +0 -1
  949. package/dist/profiles-B3NS9jwk.js.map +0 -1
  950. package/dist/server.js.map +0 -1
  951. package/dist/simulate-oXBiw1Ff.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"foliage.js","names":[],"sources":["../src/foliage.ts"],"sourcesContent":["import { gusted } from '#engine/engineEvents'\nimport { defineEffect } from './abilities/effects'\nimport { areaReach, type EffectArea, effectArea, inArea } from './abilities/shapes'\nimport { type AreaRef, type AreaShape, areaShapeOf, inShape, shapeBounds } from './areas'\nimport type { CellLayerDef } from './cellLayers'\nimport { defineComponent } from './components'\nimport { concealmentPack, type ConcealmentOptions } from './concealment'\nimport type { DamageType } from './defs'\nimport { type Entity, type EntityId, moving } from './entity'\nimport { defineEvent } from './events'\nimport { cos, exp, sin } from './exactMath'\nimport { FoliageRegrowth, REGROWTH, regrowState } from './foliageRegrowth'\nimport { type Cancellable, defineHookType, type HookDef } from './hooks'\nimport type { MapEnvironment } from './map/look'\nimport { BLOCKS_WALK } from './map/types'\nimport type { Vec2 } from './math'\nimport { mapInfo } from './names'\nimport type { GamePack } from './packs/pack'\nimport type { System, SystemDef } from './registry'\nimport { replicateEvent } from './replication'\nimport type { World } from './world'\n\n/*\n * Grass and bushes to the rules: a layer of cells whose values are styles (`CellLayerValue.foliage`), what has\n * happened to each cell in a second layer beside it (`foliageStateLayer`, `FOLIAGE_STATE`), and the pack that hides\n * units in it, lets it be trampled, ruined and burnt (`foliagePack`). How it is drawn is the client's (`foliage`,\n * `FoliageLook`): the rules see cells, never a picture.\n *\n * The names, the shapes and where each thing is kept: the rules' half of the feature, the client's look the other.\n */\n\n/**\n * The id of the foliage pack (`foliagePack`), for `hasPack`\n *\n * @beta\n */\nexport const FOLIAGE = 'foliage'\n\n/**\n * What has happened to a cell of grass or bushes, as the values of the layer's state layer (`foliageStateLayer`):\n * `whole` (0: as it grew, and what a cell never touched is), `flattened` (crushed under what walked over it, or by\n * `ruin`), `cut` (down to stubble: fire does not cross it), `burning`, `burnt` (charred: by a fire, or scorched by\n * `ruin`), `growing` (coming back to whole). The style stays in the layer itself, so that what grows back is what\n * stood there. Values past these are kept for states to come\n *\n * @beta\n */\nexport const FOLIAGE_STATE = { whole: 0, flattened: 1, cut: 2, burning: 3, burnt: 4, growing: 5 } as const\n\n/**\n * What has happened to a cell of grass or bushes, by name (`FOLIAGE_STATE`)\n *\n * @beta\n */\nexport type FoliageState = keyof typeof FOLIAGE_STATE\n\nconst STATE_NAMES = Object.keys(FOLIAGE_STATE) as FoliageState[]\n\n/**\n * The state a value of a state layer says (`FOLIAGE_STATE`): `whole` for a value that is none of them\n *\n * @beta\n */\nexport const foliageStateOf = (value: number): FoliageState => STATE_NAMES.find((name) => FOLIAGE_STATE[name] === value) ?? 'whole'\n\n/** What a state layer's id ends with, after the id of the layer it is the state of */\nconst STATE = '.state'\n\n/**\n * The id of the layer of cells that keeps what happened to each cell of a layer of grass or bushes (`FOLIAGE_STATE`):\n * `grass.state` for `grass`. A layer like any other (`Terrain.cells`, `world.setCells`): saved, told to the players who\n * see a cell and to the others as it comes into their sight, kept with a map that starts with a field already burnt.\n * No game lists it (`Rules.cellLayers`), so the editor does not offer it to paint\n *\n * @beta\n */\nexport const foliageStateLayer = (layer: string): string => `${layer}${STATE}`\n\n/**\n * The layer a state layer is the state of (`foliageStateLayer`): none for a layer that is not one\n *\n * @beta\n */\nexport const foliageLayerOfState = (layer: string): string | undefined =>\n\tlayer.endsWith(STATE) && layer.length > STATE.length ? layer.slice(0, -STATE.length) : undefined\n\n/**\n * What a style of grass or bushes is to the rules: a value of a layer's cells (`CellLayerValue.foliage`), said in the\n * game's code, in its `data.json` (`GameData.cellLayers`, every map) or in a map (`GameMap.definitions`, that map\n * alone), each over the one before field by field. Plain data, every field: the editor writes it. What a value does\n * not say is the layer's (`FoliageLayerOptions.style`), then what each field says it is when left out\n *\n * @beta\n */\nexport interface FoliageStyleDef {\n\t/** Whether it hides who stands in it from the teams that have nobody in the same patch (`ConcealmentOptions`): no when left out */\n\tconceals?: boolean\n\t/**\n\t * Whether it hides what is taller than it stands (`height`): yes when left out. With `false`, a unit taller than the\n\t * grass is seen over it (`FoliageConceal.heightOf`)\n\t */\n\tconcealsTaller?: boolean\n\t/** How tall it stands to the rules, in cells: what `concealsTaller` is measured against, 1 when left out. How it is drawn is the look's own height */\n\theight?: number\n\t/**\n\t * How fast one on foot goes through it, as a multiplier of its speed (as `CellLayerDef.speed`, for this value alone):\n\t * the layer's `speed` when left out, and 1 where the layer says none either\n\t */\n\tspeed?: number\n\t/**\n\t * Whether one on foot may walk through it: yes when left out. A hedge nothing goes through with `false`: the ways go\n\t * round it as round a wall, whatever its state (a burnt hedge still stops, until its style is changed). Painted or\n\t * cleared in play, the navigation's tiles it reaches are cut again: a few milliseconds a call on a big map, so not a\n\t * call a tick\n\t */\n\twalkable?: boolean\n\t/** How easily it catches fire from a burning cell beside it, 0 (never: a firebreak) to 1 (as dry grass): 0 when left out, and nothing burns */\n\tflammable?: number\n\t/** How many seconds a cell of it burns before it is burnt: 6 when left out */\n\tburns?: number\n\t/** How hot it burns: how much likelier than 1 a burning cell of it is to light those beside it. 1 when left out */\n\tfuel?: number\n\t/** Seconds after it was burnt, cut or flattened that it starts to grow back by itself; `false` for never (until `regrow`). Never when left out */\n\tregrows?: number | false\n\t/** Seconds it takes to grow back once it starts by itself (`regrows`): hiding as it grows, whole at the end. 10 when left out */\n\tgrows?: number\n\t/**\n\t * What walking over it does to it, to the rules: `crush` lays it flat for good (`flattened`, which hides nobody)\n\t * under those the layer says (`FoliageLayerOptions.tramples`); `none` when left out. How it bends on the screen\n\t * and stands up again is the look's (`FoliageLook.walked`)\n\t */\n\ttrample?: 'none' | 'crush'\n}\n\n/**\n * How a layer of grass hides who stands in it (`FoliageLayerOptions.conceal`): what `ConcealmentOptions` says of it,\n * the layer aside, and how tall a unit stands\n *\n * @beta\n */\nexport interface FoliageConceal extends Pick<ConcealmentOptions, 'reach' | 'hides' | 'seenBy' | 'rustle' | 'rustleEvery'> {\n\t/**\n\t * How tall a unit stands, in cells, for the styles that do not hide what is taller than they are\n\t * (`FoliageStyleDef.concealsTaller`): twice its type's `radius` when left out\n\t */\n\theightOf?: (world: World, entity: Entity) => number\n}\n\n/**\n * One layer of grass or bushes of the pack (`foliagePack`): its id, what its styles are where they say nothing, how\n * it hides and who tramples it\n *\n * @beta\n */\nexport interface FoliageLayerOptions {\n\t/** The layer of cells (`Rules.cellLayers`): its values are the styles (`CellLayerValue.foliage`) */\n\tlayer: string\n\t/** What every style of the layer is where it says nothing of its own: a layer of one kind of grass says it all here */\n\tstyle?: FoliageStyleDef\n\t/** How it hides who stands in the styles that conceal (`FoliageConceal`): `reach`, what it hides, the rustle */\n\tconceal?: FoliageConceal\n\t/**\n\t * Who crushes the styles that are crushed (`FoliageStyleDef.trample`), asked of a unit as it moves over one: every\n\t * unit that walks when left out (not structures, nor what flies or sails), since a style is crushed only where it\n\t * says so. A game's own for the heavy ones alone: `(world, unit) => unit.def.radius >= 1`\n\t */\n\ttramples?: (world: World, entity: Entity) => boolean\n}\n\n/**\n * How fire goes in a game's grass and bushes (`FoliageOptions.fire`): how often it spreads, what the wind and the\n * slope do to it, how much may burn at once, what it does to who stands in it\n *\n * @beta\n */\nexport interface FoliageFire {\n\t/** Whether a burning cell lights those beside it: yes when left out. With `false`, only what is set alight burns */\n\tspread?: boolean\n\t/** How often a burning cell tries to light those beside it, in seconds: 0.25 when left out */\n\tevery?: number\n\t/** How much the wind decides which way it goes (`MapEnvironment.wind`), 0 (not at all) and up: 1 when left out */\n\twind?: number\n\t/** How much faster it goes uphill than down, 0 (the same) and up: 1 when left out */\n\tslope?: number\n\t/** How strong a wind (0 to 1) has it jump a gap of one cell: never when left out */\n\tjump?: number\n\t/** How wet everything is, 0 (dry) to 1 (nothing catches): 0 when left out */\n\twet?: number\n\t/** Whether rain and snow damp it and put it out (`MapEnvironment.weather`): yes when left out */\n\tweather?: boolean\n\t/** The most cells that burn at once, over all the pack's layers: those past it wait their turn. 4000 when left out */\n\tmaxBurning?: number\n\t/** Seconds after which a fire dies, whatever is left to burn: never when left out */\n\tlasts?: number\n\t/** Damage a second to units that stand in a burning cell, by whoever lit it: none when left out */\n\tdamage?: number\n\t/** The type that damage is dealt as: magic when left out */\n\tdamageType?: DamageType\n\t/**\n\t * Whether a burning cell may set alight what burns and stands on it or on a cell next to it (trees, a wooden wall:\n\t * grass does not burn under what stands), in a game with the burning pack too (`burningPack`): no when left out. It\n\t * passes as fire does, not at once: at each of the cell's tries (`every`), by a chance of its own (0.05 for grass\n\t * of `fuel` 1 in still, dry air, likelier downwind), asked of the game (`burnStart`, `cause: 'foliage'`), under the\n\t * most that may burn there (`BurningOptions.maxBurning`). What caught is set alight at the end of the burning pack's\n\t * turn, and tries nothing before its own next turn. The other way is that pack's to say (`BurningOptions.lightsFoliage`)\n\t */\n\tlights?: boolean\n}\n\n/**\n * What the foliage pack is made with (`foliagePack`): a layer of grass or bushes with its settings, more layers beside\n * it, and how fire goes in them all\n *\n * @beta\n */\nexport interface FoliageOptions extends FoliageLayerOptions {\n\t/** More layers of the same pack, each with settings of its own: fire passes from one to the next where both grow */\n\talso?: FoliageLayerOptions[]\n\t/** How fire goes (`FoliageFire`); `false` for a game whose grass never burns */\n\tfire?: FoliageFire | false\n}\n\n/**\n * The layers a foliage pack was made with, each with its settings: the first, then those beside it (`FoliageOptions.also`)\n *\n * @beta\n */\nexport function foliageLayers(options: FoliageOptions): FoliageLayerOptions[] {\n\tconst { also, fire: _, ...first } = options\n\treturn [first, ...(also ?? [])]\n}\n\n/**\n * What a style of a layer is to the rules, by its value: what the value says (`CellLayerValue.foliage`, the game's\n * code with its data and the map's over it) over the layer's own (`FoliageLayerOptions.style`). None for 0, which is\n * no grass. A value the layer does not list is the layer's own style\n *\n * @beta\n */\nexport function foliageStyle(\n\tgame: { cellLayers?: readonly CellLayerDef[]; packs?: readonly GamePack[] },\n\tlayer: string,\n\tvalue: number\n): FoliageStyleDef | undefined {\n\tif (!value) return undefined\n\tconst pack = game.packs?.find((each) => each.id === FOLIAGE)\n\tconst base = pack ? foliageLayers(pack.options as FoliageOptions).find((each) => each.layer === layer)?.style : undefined\n\tconst own = game.cellLayers?.find((def) => def.id === layer)?.values?.find((each) => each.value === value)?.foliage\n\treturn { ...base, ...own }\n}\n\n/** The fields of a style, and what each holds */\nconst STYLE_FIELDS: Readonly<Record<keyof FoliageStyleDef, 'boolean' | 'number' | 'share' | 'regrows' | 'trample'>> = {\n\tconceals: 'boolean',\n\tconcealsTaller: 'boolean',\n\theight: 'number',\n\tspeed: 'number',\n\twalkable: 'boolean',\n\tflammable: 'share',\n\tburns: 'number',\n\tfuel: 'number',\n\tregrows: 'regrows',\n\tgrows: 'number',\n\ttrample: 'trample'\n}\n\n/**\n * Why a style said as data is not one (`FoliageStyleDef`), where it is first wrong: nothing for one that is. `what`\n * names it in what is said\n *\n * @beta\n */\nexport function foliageStyleProblem(said: unknown, what: string): string | undefined {\n\tif (typeof said !== 'object' || said === null || Array.isArray(said)) return `${what} is no style of grass: { conceals, flammable, burns… }`\n\tfor (const [field, value] of Object.entries(said)) {\n\t\tconst kind = (STYLE_FIELDS as Record<string, string | undefined>)[field]\n\t\tif (!kind) return `${what}.${field} is nothing a style of grass says (${Object.keys(STYLE_FIELDS).join(', ')})`\n\t\tconst number = typeof value === 'number' && Number.isFinite(value) && value >= 0\n\t\tif (kind === 'boolean' && typeof value !== 'boolean') return `${what}.${field} is no yes or no`\n\t\tif (kind === 'number' && !number) return `${what}.${field} is no number from 0`\n\t\tif (kind === 'share' && !(number && value <= 1)) return `${what}.${field} is no number from 0 to 1`\n\t\tif (kind === 'regrows' && value !== false && !number) return `${what}.${field} is seconds, or false for never`\n\t\tif (kind === 'trample' && value !== 'none' && value !== 'crush') return `${what}.${field} is none or crush`\n\t}\n\treturn undefined\n}\n\n/**\n * Where something is done to grass: a shape on the ground, or cells by their indices (as `world.setCells` takes them)\n *\n * @beta\n */\nexport type FoliageWhere = AreaShape | readonly number[]\n\n/**\n * A cell of grass or bushes as the rules know it now (`foliageAt`)\n *\n * @beta\n */\nexport interface FoliageCell {\n\t/** The cell's index in the layer, row by row */\n\tcell: number\n\t/** The style painted there: the layer's value, 1 to 255 */\n\tvalue: number\n\t/** What that style is to the rules (`foliageStyle`) */\n\tstyle: FoliageStyleDef\n\t/** What has happened to it (`FOLIAGE_STATE`) */\n\tstate: FoliageState\n\t/** Whether it burns now */\n\tburning: boolean\n\t/** Seconds it still burns, 0 where it does not */\n\tleft: number\n\t/** Who set alight the fire it burns of, where someone did */\n\tby?: EntityId\n}\n\n/**\n * How grass is ruined (`ruin`): `cut` to stubble (a firebreak), `crush` flat, `scorch` black with nothing left to burn\n *\n * @beta\n */\nexport type FoliageRuin = 'cut' | 'crush' | 'scorch'\n\n/**\n * A cell of grass about to catch fire (the `foliageIgnite` hook): set alight (`ignite`, an ability) or lit by a cell\n * burning beside it. `cancel()` keeps it from catching; `chance` is a handler's to change (a wet valley, a blessed\n * grove)\n *\n * @beta\n */\nexport interface FoliageIgnite extends Cancellable {\n\t/** The layer the cell is of */\n\treadonly layer: string\n\t/** The cell's index in the layer */\n\treadonly cell: number\n\t/** The cell's middle along the map's x axis */\n\treadonly x: number\n\t/** The cell's middle along the map's z axis */\n\treadonly z: number\n\t/**\n\t * Whether it was set alight (`ignite`), caught from a neighbour (`spread`), or caught from a burning thing beside it\n\t * (`burning`: a tree of the burning pack, `BurningOptions.lightsFoliage`)\n\t */\n\treadonly cause: FoliageCause\n\t/** The burning cell it catches from, for a spread */\n\treadonly from?: number\n\t/** The burning thing it catches from, for one caught from a burning thing (`burning`) */\n\treadonly thing?: Entity\n\t/** Who set alight the fire it is of, where someone did */\n\treadonly by?: Entity\n\t/**\n\t * How likely it is to catch, 0 to 1, as the style, the wind, the slope and the wet make it: 1 for one set alight.\n\t * What a handler leaves it at is held to 0 to 1 (more than 1 is sure, less than 0 never)\n\t */\n\tchance: number\n}\n\n/**\n * How a cell of grass caught fire (`FoliageIgnite.cause`, `foliageIgnited`): set alight (`ignite`, an ability), caught\n * from a burning cell beside it (`spread`), or from a burning thing beside it (`burning`: `BurningOptions.lightsFoliage`)\n *\n * @beta\n */\nexport type FoliageCause = 'ignite' | 'spread' | 'burning'\n\n/**\n * Asked before a cell of grass catches fire (`FoliageIgnite`): a handler refuses it or changes its chance. For every\n * cell a fire tries, so a handler does little\n *\n * @beta\n */\nexport const foliageIgnite = /* @__PURE__ */ defineHookType<FoliageIgnite>({ id: 'foliage.ignite' })\n\n/**\n * Cells of grass caught fire this tick, by layer and cause: what a game's rules and its computer players hear. The\n * screens are told by the state layer's cells, each as far as it sees\n *\n * @beta\n */\nexport const foliageIgnited = defineEvent<{ layer: string; cells: number[]; cause: FoliageCause; by?: EntityId }>({ id: 'foliage.ignited' })\n\n/**\n * Cells of grass burnt out this tick: charred now, to grow back where their style says\n *\n * @beta\n */\nexport const foliageBurnt = defineEvent<{ layer: string; cells: number[] }>({ id: 'foliage.burnt' })\n\n/**\n * Cells of grass were ruined (`ruin`, `firebreak`, an ability, what tramples): how, and by whom where someone did\n *\n * @beta\n */\nexport const foliageRuined = defineEvent<{ layer: string; cells: number[]; how: FoliageRuin; by?: EntityId }>({ id: 'foliage.ruined' })\n\n/**\n * Cells of grass are whole again: grown back by themselves, or by `regrow` (by whom, where it said)\n *\n * @beta\n */\nexport const foliageRegrown = defineEvent<{ layer: string; cells: number[]; by?: EntityId }>({ id: 'foliage.regrown' })\n\n/**\n * The last burning cell of a layer went out: burnt out, put out or stopped\n *\n * @beta\n */\nexport const foliageFireOut = defineEvent<{ layer: string }>({ id: 'foliage.fireOut' })\n\n/**\n * Grass and bushes in the rules, on a layer of cells whose values are styles (`CellLayerValue.foliage`,\n * `FoliageStyleDef`): the styles that conceal hide who stands in them (as `concealmentPack`, patch by patch, while\n * they stand whole), a style may slow or stop one on foot, be crushed under who walks over it, be ruined and grow\n * back, catch fire and pass it on (`FoliageFire`). What happened to each cell is kept in the layer's state layer\n * (`foliageStateLayer`). One a game:\n *\n * export const rules = { ...myGame, packs: [foliagePack({ layer: 'grass', fire: { damage: 8 } })] }\n *\n * A layer of the pack is not given to `concealmentPack` too: the pack hides in it by itself. Its styles are read from\n * the game's layers as laid (`foliageStyle`: the code, the game's `data.json`, the map's definitions), so a style the\n * editor made hides and slows as one of the code's. What it does today: hiding by style and state, a style's\n * `speed` and `walkable`, trampling (`trample: 'crush'`, by who `tramples` says), fire (`ignite`, `FoliageFire`) with\n * `firebreak`, `extinguish` and `stopFire`, ruin (`ruin`) and growing back (`regrow`, by itself where a style\n * `regrows`), and the `foliage` ability effect\n *\n * @beta\n */\nexport function foliagePack(options: FoliageOptions): GamePack {\n\tconst layers = foliageLayers(options)\n\tconst hooks: HookDef[] = []\n\tconst systems: SystemDef[] = []\n\tconst seen = new Set<string>()\n\tfor (const each of layers) {\n\t\tconst { layer } = each\n\t\tif (!layer) throw new Error('foliagePack: a layer is named by its id (Rules.cellLayers)')\n\t\tif (foliageLayerOfState(layer) !== undefined) throw new Error(`foliagePack: \"${layer}\" is the state of a layer, not a layer of grass`)\n\t\tif (seen.has(layer)) throw new Error(`foliagePack: the layer \"${layer}\" is given twice`)\n\t\tseen.add(layer)\n\t\t// hidden in by concealment's own patches: of the cells whose style conceals and whose state still does\n\t\tconst hiding = concealmentPack({ ...foliageConcealment(each), eachUnit: trampling(each) })\n\t\thooks.push(...(hiding.hooks ?? []))\n\t\tsystems.push(...(hiding.systems ?? []))\n\t}\n\tconst fire = new FoliageFireRules(options)\n\tif (fire.on) systems.push(fire.system)\n\tsystems.push(fire.regrowth.system)\n\tconst pack: FoliagePackWithFire = {\n\t\tid: FOLIAGE,\n\t\toptions,\n\t\thooks,\n\t\tsystems,\n\t\tcomponents: [fireState, regrowState],\n\t\tevents: [foliageIgnited, foliageBurnt, foliageRuined, foliageRegrown, foliageFireOut],\n\t\teffects: [foliageEffect],\n\t\t[FIRE]: fire,\n\t\t[REGROWTH]: fire.regrowth\n\t}\n\treturn pack\n}\n\n/** What each value of a layer is to hiding, worked out of a game's layers of cells (`foliageStyle`) */\ninterface HidingStyles {\n\t/** The layers of cells it was worked out of: others (a game's values changed while it plays) work it out again */\n\tof: readonly CellLayerDef[]\n\t/** Whether a style hides, by value */\n\tconceals: Uint8Array\n\t/** How tall a style stands, by value, for those that do not hide what is taller (`concealsTaller: false`); Infinity for the others */\n\tover: Float32Array\n\t/** Whether any style sees over it what is taller: else who stands in it is not measured */\n\ttaller: boolean\n}\n\n/**\n * How a layer of the pack hides (`ConcealmentOptions`): in the cells whose style conceals and whose state is whole or\n * growing back (`conceals`), the patches worked out again as either layer changes (`follows`); a unit taller than a\n * style that says so seen over it (`seenBy`, asked only of who would be hidden)\n */\nfunction foliageConcealment({ layer, conceal = {} }: FoliageLayerOptions): ConcealmentOptions {\n\tconst state = foliageStateLayer(layer)\n\t// the last worked out first: one game asks again and again\n\tlet last: HidingStyles | undefined\n\tconst known = new WeakMap<readonly CellLayerDef[], HidingStyles>()\n\t/** What each value is to hiding in the world's game, worked out once for its layers of cells */\n\tconst stylesOf = (world: World): HidingStyles => {\n\t\tconst { cellLayers } = world.registry\n\t\tif (last?.of === cellLayers) return last\n\t\tlet styles = known.get(cellLayers)\n\t\tif (!styles) {\n\t\t\tstyles = { of: cellLayers, conceals: new Uint8Array(256), over: new Float32Array(256).fill(Infinity), taller: false }\n\t\t\tconst game = { cellLayers, packs: world.registry.assembly?.rules.packs }\n\t\t\tfor (let value = 1; value < 256; value++) {\n\t\t\t\tconst style = foliageStyle(game, layer, value)\n\t\t\t\tstyles.conceals[value] = style?.conceals ? 1 : 0\n\t\t\t\tstyles.over[value] = style?.conceals && style.concealsTaller === false ? (style.height ?? 1) : Infinity\n\t\t\t\tif (styles.over[value] !== Infinity) styles.taller = true\n\t\t\t}\n\t\t\tknown.set(cellLayers, styles)\n\t\t}\n\t\treturn (last = styles)\n\t}\n\tconst { heightOf = (_world: World, entity: Entity) => entity.def.radius * 2, seenBy, ...rest } = conceal\n\treturn {\n\t\t...rest,\n\t\tlayer,\n\t\tfollows: [state],\n\t\t// asked for every cell of grass as the patches are worked out: kept to a few lookups\n\t\tconceals(world, cell) {\n\t\t\tconst { cells } = world.terrain\n\t\t\tif (!(last?.of === world.registry.cellLayers ? last : stylesOf(world)).conceals[cells[layer][cell]]) return false\n\t\t\tconst states = cells[state]\n\t\t\tif (!states) return true\n\t\t\tconst now = states[cell]\n\t\t\treturn now === FOLIAGE_STATE.whole || now === FOLIAGE_STATE.growing\n\t\t},\n\t\tseenBy(world, entity, team) {\n\t\t\tconst styles = stylesOf(world)\n\t\t\tif (styles.taller) {\n\t\t\t\tconst { width } = world.terrain\n\t\t\t\tconst over = styles.over[world.terrain.cells[layer]?.[Math.floor(entity.pos.z) * width + Math.floor(entity.pos.x)] ?? 0]\n\t\t\t\tif (over !== Infinity && heightOf(world, entity) > over) return true\n\t\t\t}\n\t\t\treturn seenBy?.(world, entity, team) ?? false\n\t\t}\n\t}\n}\n\n/*\n * Trampling (`FoliageStyleDef.trample: 'crush'`): a unit moving over a style that is crushed, of those the layer says\n * (`FoliageLayerOptions.tramples`), lays the cells under it flat for good (`flattened`, which hides nobody) until they\n * are grown again. Worked out in the hiding count's one pass over the units at the start of a tick\n * (`ConcealmentOptions.eachUnit`), by the cell each stands in: nothing is looked at for a unit that is not on a style\n * that is crushed, nothing at all where no style of the game is. The cells crushed in a tick are set at its end of the\n * pass in one `setCells` of the state layer (told to the players who see them, remembered by those who do not, saved\n * as any cell), the count made again of the patches as they are left. Nothing is kept from tick to tick\n */\n\n/** Who tramples when the layer does not say: units on the ground that walk (not structures, not what flies or sails) */\nconst onFoot = (_world: World, entity: Entity) => !entity.def.footprint && !entity.flying && !entity.def.naval && entity.def.kind === 'unit'\n\n/** What each value of a layer is to trampling, worked out of a game's layers of cells (`foliageStyle`) */\ninterface CrushStyles {\n\t/** The layers of cells it was worked out of: others (a game's values changed while it plays) work it out again */\n\tof: readonly CellLayerDef[]\n\t/** Whether a style is crushed, by value */\n\tcrushes: Uint8Array\n\t/** Whether any is: else nothing is looked at */\n\tany: boolean\n}\n\n/** A world's trampling of a layer this tick: the cells crushed, each once */\ninterface Trampled {\n\tcells: number[]\n\t/** The tick each cell was last put among them: a cell once a tick */\n\tstamp: Int32Array\n\ttick: number\n\t/** Who crushed them, where one alone did this tick; null where more than one did */\n\tby: Entity | null | undefined\n}\n\n/** Who crushed the cells put among a tick's from `had` on: one alone, or nobody named where another did too */\nfunction noteBy(trampled: Trampled, entity: Entity, had: number): void {\n\tif (trampled.cells.length === had) return\n\ttrampled.by = trampled.by === undefined || trampled.by === entity ? entity : null\n}\n\n/** How a layer of the pack is trampled, told of each unit by the hiding count (`ConcealmentOptions.eachUnit`) */\nfunction trampling({ layer, tramples = onFoot }: FoliageLayerOptions): NonNullable<ConcealmentOptions['eachUnit']> {\n\tconst state = foliageStateLayer(layer)\n\tlet last: CrushStyles | undefined\n\tconst known = new WeakMap<readonly CellLayerDef[], CrushStyles>()\n\tconst worlds = new WeakMap<World, Trampled>()\n\tconst stylesOf = (world: World): CrushStyles => {\n\t\tconst { cellLayers } = world.registry\n\t\tif (last?.of === cellLayers) return last\n\t\tlet styles = known.get(cellLayers)\n\t\tif (!styles) {\n\t\t\tstyles = { of: cellLayers, crushes: new Uint8Array(256), any: false }\n\t\t\tconst game = { cellLayers, packs: world.registry.assembly?.rules.packs }\n\t\t\tfor (let value = 1; value < 256; value++)\n\t\t\t\tif (foliageStyle(game, layer, value)?.trample === 'crush') {\n\t\t\t\t\tstyles.crushes[value] = 1\n\t\t\t\t\tstyles.any = true\n\t\t\t\t}\n\t\t\tknown.set(cellLayers, styles)\n\t\t}\n\t\treturn (last = styles)\n\t}\n\t/** A cell crushed this tick, where its style is and it stands whole or growing */\n\tconst crush = (world: World, styles: CrushStyles, trampled: Trampled, cell: number): void => {\n\t\tconst { cells } = world.terrain\n\t\tif (!styles.crushes[cells[layer]?.[cell] ?? 0] || trampled.stamp[cell] === trampled.tick) return\n\t\tconst now = cells[state]?.[cell] ?? FOLIAGE_STATE.whole\n\t\tif (now !== FOLIAGE_STATE.whole && now !== FOLIAGE_STATE.growing) return\n\t\ttrampled.stamp[cell] = trampled.tick\n\t\ttrampled.cells.push(cell)\n\t}\n\treturn {\n\t\tunit(world, entity, cell) {\n\t\t\tconst styles = last?.of === world.registry.cellLayers ? last : stylesOf(world)\n\t\t\tif (!styles.any) return\n\t\t\tconst { terrain } = world\n\t\t\tconst cells = terrain.cells[layer]\n\t\t\tconst radius = entity.def.radius\n\t\t\t// one no wider than a cell is looked at only where it stands on a style that is crushed\n\t\t\tif (!cells || (radius <= 0.5 && !styles.crushes[cells[cell]])) return\n\t\t\tif (entity.get(moving)?.status !== 'moving' || !tramples(world, entity)) return\n\t\t\tlet trampled = worlds.get(world)\n\t\t\tif (!trampled || trampled.stamp.length !== cells.length) worlds.set(world, (trampled = { cells: [], stamp: new Int32Array(cells.length).fill(-1), tick: -1, by: undefined }))\n\t\t\tif (trampled.tick !== world.tick) {\n\t\t\t\ttrampled.tick = world.tick\n\t\t\t\ttrampled.cells.length = 0\n\t\t\t\ttrampled.by = undefined\n\t\t\t}\n\t\t\tconst had = trampled.cells.length\n\t\t\tcrush(world, styles, trampled, cell)\n\t\t\tif (radius <= 0.5) return noteBy(trampled, entity, had)\n\t\t\t// the cells whose middles are under it\n\t\t\tconst { width, depth } = terrain\n\t\t\tconst { x, z } = entity.pos\n\t\t\tfor (let cz = Math.max(0, Math.floor(z - radius)); cz <= Math.min(depth - 1, Math.floor(z + radius)); cz++)\n\t\t\t\tfor (let cx = Math.max(0, Math.floor(x - radius)); cx <= Math.min(width - 1, Math.floor(x + radius)); cx++) {\n\t\t\t\t\tconst dx = cx + 0.5 - x\n\t\t\t\t\tconst dz = cz + 0.5 - z\n\t\t\t\t\tif (dx * dx + dz * dz <= radius * radius) crush(world, styles, trampled, cz * width + cx)\n\t\t\t\t}\n\t\t\tnoteBy(trampled, entity, had)\n\t\t},\n\t\tdone(world) {\n\t\t\tconst trampled = worlds.get(world)\n\t\t\tif (!trampled || trampled.tick !== world.tick || !trampled.cells.length) return false\n\t\t\t// as `ruin` crushes: the same state, the event, the fire put out, the style's growing back waited for\n\t\t\tconst crushed = ruin(world, layer, trampled.cells, { how: 'crush', ...(trampled.by && { by: trampled.by }) })\n\t\t\ttrampled.cells.length = 0\n\t\t\ttrampled.by = undefined\n\t\t\treturn crushed.length > 0\n\t\t}\n\t}\n}\n\n/*\n * Fire. A burning cell is a value of the state layer (`burning`), told to the screens as any cell is; what the rules\n * keep beside it is the world's (`fireState`, saved): each layer's burning cells in order of their indices, with the\n * tick each burns out at, the tick its fire was set alight (`lasts`) and who did. A tick looks at the burning cells\n * alone: those whose time is up burn out, and those whose turn it is (one in `every` seconds a cell, the cells' turns\n * spread over the ticks by a hash of where they are: `turnOf`) try to light the eight cells about them, each by a chance of the\n * world's numbers (`world.rng`), in the order of the cells' indices. What changed is set in one `world.setCells` a\n * layer and state, at the tick's end. Nothing is done while nothing burns\n */\n\n/**\n * How likely a burning cell is to light a cell beside it at a try: of a style that catches as dry grass does\n * (`flammable` 1), lit by one that burns as hot as 1 (`fuel`), on flat ground, in still air and dry. About a cell a\n * second at a try every quarter of a second\n */\nconst CATCH = 0.08\n/** What a cell across a corner catches by, of what one across a side does: it is farther, and a front of the two as round as it is wide */\nconst CORNER = 0.5\n/** How much a gale makes a try downwind likelier (`FoliageFire.wind` 1, the wind's strength 1: e² ≈ 7.4 times) and upwind less (a seventh) */\nconst WIND = 2\n/** How much a slope of 1 (45°) makes a try uphill likelier (`FoliageFire.slope` 1: e ≈ 2.7 times), and downhill less */\nconst SLOPE = 1\n/** What part of a try's chance a jump over a gap of one cell has (`FoliageFire.jump`) */\nconst JUMP = 0.5\n/** How likely a cell burning in rain or snow of amount 1 is to go out at a try */\nconst DOUSE = 0.25\n/** How often who stands in a burning cell is hurt (`FoliageFire.damage`), in seconds */\nconst SCORCH_EVERY = 0.5\n/**\n * How likely a burning thing is to light a cell of grass beside it at a try, once a second (`BurningOptions.lightsFoliage`):\n * of a style that catches as dry grass does (`flammable` 1), in still air and dry. A tree burning in a meadow lights a\n * cell of its eight in about its first second, and seldom all of them at once\n */\nconst FROM_THING = 0.2\n\n/** The eight ways about a cell, row by row: the order the cells beside a burning one are tried in */\nconst WAYS_X = [-1, 0, 1, -1, 1, -1, 0, 1] as const\nconst WAYS_Z = [-1, -1, -1, 0, 0, 1, 1, 1] as const\n\n/** The cells of a layer that burn, in order of their indices, and each one's fire */\ninterface BurningCells {\n\t/** The cells, by index, in order */\n\tcells: number[]\n\t/** The tick each burns out at */\n\tends: number[]\n\t/** The tick the fire it is of was set alight, for `FoliageFire.lasts` */\n\tlit: number[]\n\t/** Who set alight the fire it is of, by id: 0 for nobody */\n\tby: number[]\n}\n\n/** A cell set alight while as much burnt as may (`FoliageFire.maxBurning`): lit as there is room, first come first */\ninterface WaitingCell {\n\tlayer: string\n\tcell: number\n\tlit: number\n\tby: number\n}\n\n/** What burns in a world: each layer's burning cells, by layer, and what waits its turn */\ninterface FireState {\n\tburning: Record<string, BurningCells>\n\twaiting: WaitingCell[]\n}\n\n/** What burns in a world (`FireState`): plain data, kept by a save */\nconst fireState = /* @__PURE__ */ defineComponent<FireState>({ id: 'foliage.fire', default: () => ({ burning: {}, waiting: [] }) })\n\n/** What each style of the pack's layers is to the fire, by value, worked out of a game's layers of cells */\ninterface FireStyles {\n\t/** The layers of cells it was worked out of: others (a game's values changed while it plays) work it out again */\n\tof: readonly CellLayerDef[]\n\t/** By layer of the pack, by value: how easily it catches (`flammable`), 0 for what never does */\n\tflammable: Float64Array[]\n\t/** By layer, by value: how hot it burns (`fuel`) */\n\tfuel: Float64Array[]\n\t/** By layer, by value: how many seconds it burns (`burns`) */\n\tburns: Float64Array[]\n}\n\n/** The air over a fire as the map's environment says (`MapEnvironment`): the wind's way and strength, and what falls */\ninterface FireAir {\n\t/** The environment it was worked out of: another (`world.setEnvironment`) works it out again */\n\tof: MapEnvironment | undefined\n\t/** How strong the wind is, 0 (still) to 1 (a gale) */\n\tstrength: number\n\t/** Downwind on the ground, along x and z: 0 in still air */\n\tx: number\n\tz: number\n\t/** Each way's (`WAYS_X`) part of a try's chance: the corner's and the wind's */\n\tways: Float64Array\n\t/** Whether a fire jumps a gap of one cell each way in this wind (`FoliageFire.jump`) */\n\tjumps: Uint8Array\n\t/** How much rain or snow falls, 0 to 1, where it falls: everywhere, or in `areas` */\n\tfalls: number\n\t/** Where it falls only there, each with its part of `falls` */\n\tareas: { shape: AreaShape; amount: number }[] | undefined\n}\n\n/** The wind and weather the rules read of a map's environment: the client's fields (`MapWind`, `MapWeather`), which the engine does not name */\ninterface AirSaid {\n\twind?: { around?: number; strength?: number }\n\tweather?: { kind?: string; amount?: number; areas?: { shape: AreaRef; amount?: number }[] }\n}\n\n/** Where the pack keeps its fire's rules, on the pack, for the calls made on a world of its game */\nconst FIRE = Symbol('foliage fire')\n\n/** The foliage pack with its fire's rules beside it, and its regrowth (the fire's) */\ntype FoliagePackWithFire = GamePack & { [FIRE]?: FoliageFireRules; [REGROWTH]?: FoliageRegrowth }\n\n/**\n * A fire's rules, the pack's: its settings, what it worked out of the game and the map (styles, the air), and what a\n * tick and the calls do with a world's `fireState`. One a pack, for every world of its game: what it keeps of a world\n * is scratch, emptied as each call ends. The burning pack reaches it for its link to the grass (`foliageFireOf`)\n *\n * @internal\n */\nexport class FoliageFireRules {\n\t/** Whether anything burns in the game (`FoliageOptions.fire` not `false`) */\n\treadonly on: boolean\n\t/** The pack's layers, in order: the order a tick goes through them in */\n\treadonly layers: string[]\n\t/** Each layer's state layer (`foliageStateLayer`) */\n\treadonly states: string[]\n\t/** What `FoliageFire` says, each as it is when left out: whether a burning cell lights those about it */\n\treadonly spread: boolean\n\t/** Seconds between a burning cell's tries */\n\treadonly every: number\n\t/** How much the wind decides */\n\treadonly wind: number\n\t/** How much faster uphill */\n\treadonly slope: number\n\t/** The wind's strength from which a fire jumps a gap of one cell: none for never */\n\treadonly jump: number | undefined\n\t/** How wet everything is, 0 to 1 */\n\treadonly wet: number\n\t/** Whether rain and snow damp it and put it out */\n\treadonly weather: boolean\n\t/** The most cells that burn at once */\n\treadonly maxBurning: number\n\t/** Seconds after which a fire dies: none for never */\n\treadonly lasts: number | undefined\n\t/** Damage a second to who stands in a burning cell */\n\treadonly damage: number\n\t/** The type that damage is dealt as */\n\treadonly damageType: DamageType\n\t/** Whether a burning cell may light what burns beside it (`FoliageFire.lights`), in a game with the burning pack */\n\treadonly lights: boolean\n\t/** The system that runs it */\n\treadonly system: System\n\t/** What grows back of the pack's layers, and when (`FoliageRegrowth`): what is ruined, and what burns out */\n\treadonly regrowth: FoliageRegrowth\n\t/** What each style is to the fire, as last worked out (`stylesOf`) */\n\tprivate styles: FireStyles | undefined\n\t/** The air as last worked out (`airOf`) */\n\tprivate air: FireAir | undefined\n\t/** The road's tile of each game seen, by its tiles: 0 where it has none */\n\tprivate readonly roads = new WeakMap<readonly unknown[], number>()\n\t/** Scratch of a tick: the cells caught in it, by layer, so that one tried twice catches once */\n\tprivate readonly caught: Set<number>[]\n\t/** Scratch of a tick, by layer: what caught (cells, by whom, when its fire was lit) */\n\tprivate readonly fresh: { cells: number[]; by: number[]; lit: number[] }[]\n\t/** Scratch of a tick, by layer: the cells that burnt out in it */\n\tprivate readonly out: number[][]\n\n\tconstructor(options: FoliageOptions) {\n\t\tconst fire = options.fire === false ? undefined : (options.fire ?? {})\n\t\tthis.on = !!fire\n\t\tthis.layers = foliageLayers(options).map((each) => each.layer)\n\t\tthis.states = this.layers.map(foliageStateLayer)\n\t\tthis.spread = fire?.spread !== false\n\t\tthis.every = Math.max(0, fire?.every ?? 0.25)\n\t\tthis.wind = Math.max(0, fire?.wind ?? 1)\n\t\tthis.slope = Math.max(0, fire?.slope ?? 1)\n\t\tthis.jump = fire?.jump\n\t\tthis.wet = Math.min(1, Math.max(0, fire?.wet ?? 0))\n\t\tthis.weather = fire?.weather !== false\n\t\tthis.maxBurning = Math.max(0, Math.floor(fire?.maxBurning ?? 4000))\n\t\tthis.lasts = fire?.lasts\n\t\tthis.damage = Math.max(0, fire?.damage ?? 0)\n\t\tthis.damageType = fire?.damageType ?? 'magic'\n\t\tthis.lights = !!fire?.lights\n\t\tthis.caught = this.layers.map(() => new Set<number>())\n\t\tthis.fresh = this.layers.map(() => ({ cells: [], by: [], lit: [] }))\n\t\tthis.out = this.layers.map(() => [])\n\t\tthis.regrowth = new FoliageRegrowth({\n\t\t\tlayers: this.layers,\n\t\t\tstates: this.states,\n\t\t\tstate: FOLIAGE_STATE,\n\t\t\tstyle: foliageStyle,\n\t\t\tregrown: (world, layer, cells, by) => world.events.emit(foliageRegrown, { layer, cells, ...(by ? { by } : {}) })\n\t\t})\n\t\tthis.system = {\n\t\t\tname: 'foliage.fire',\n\t\t\tphase: 'resolve',\n\t\t\tupdate: (world) => {\n\t\t\t\t// nothing was ever set alight: nothing to look at\n\t\t\t\tif (!world.states.has(fireState)) return\n\t\t\t\tthis.tick(world, world.state(fireState))\n\t\t\t}\n\t\t}\n\t}\n\n\t/** The index of a layer of the pack, for a call (`what`) given it: throws for one the pack has not */\n\tindexOf(what: string, layer: string): number {\n\t\tconst index = this.layers.indexOf(layer)\n\t\tif (index < 0) throw new Error(`${what}: \"${layer}\" is no layer of the foliage pack (${this.layers.join(', ')})`)\n\t\treturn index\n\t}\n\n\t/** How many ticks apart a cell's tries are (`every`): at least one */\n\tstride(world: World): number {\n\t\treturn Math.max(1, Math.round(this.every / world.dt))\n\t}\n\n\t/** What each style is to the fire, by layer and value, worked out once for a game's layers of cells */\n\tstylesOf(world: World): FireStyles {\n\t\tconst { cellLayers } = world.registry\n\t\tif (this.styles?.of === cellLayers) return this.styles\n\t\tconst game = { cellLayers, packs: world.registry.assembly?.rules.packs }\n\t\tconst styles: FireStyles = { of: cellLayers, flammable: [], fuel: [], burns: [] }\n\t\tfor (const layer of this.layers) {\n\t\t\tconst flammable = new Float64Array(256)\n\t\t\tconst fuel = new Float64Array(256)\n\t\t\tconst burns = new Float64Array(256)\n\t\t\tfor (let value = 1; value < 256; value++) {\n\t\t\t\tconst style = foliageStyle(game, layer, value)\n\t\t\t\tflammable[value] = Math.min(1, Math.max(0, style?.flammable ?? 0))\n\t\t\t\tfuel[value] = Math.max(0, style?.fuel ?? 1)\n\t\t\t\tburns[value] = Math.max(0, style?.burns ?? 6)\n\t\t\t}\n\t\t\tstyles.flammable.push(flammable)\n\t\t\tstyles.fuel.push(fuel)\n\t\t\tstyles.burns.push(burns)\n\t\t}\n\t\treturn (this.styles = styles)\n\t}\n\n\t/** The index of the game's `road` tile, which never burns: 0 for a game without one */\n\troadOf(world: World): number {\n\t\tconst { tiles } = world.registry\n\t\tlet road = this.roads.get(tiles)\n\t\tif (road === undefined) {\n\t\t\troad = tiles.findIndex((tile) => tile.id === 'road') + 1\n\t\t\tthis.roads.set(tiles, road)\n\t\t}\n\t\treturn road\n\t}\n\n\t/** The air over the map now (`FireAir`), worked out again as the map's environment changes */\n\tairOf(world: World): FireAir {\n\t\tconst info = world.state(mapInfo)\n\t\tconst environment = info.environment\n\t\tif (this.air && this.air.of === environment) return this.air\n\t\tconst said = (environment ?? {}) as AirSaid\n\t\tconst strength = Math.min(1, Math.max(0, said.wind?.strength ?? 0))\n\t\tconst turn = (((said.wind?.around ?? 0) % 360) * Math.PI) / 180\n\t\t// downwind on the ground, as the screens have it (`windDirection`): 0 north (towards -z), 90 east (+x)\n\t\tconst wx = strength ? sin(turn) : 0\n\t\tconst wz = strength ? -cos(turn) : 0\n\t\tconst ways = new Float64Array(8)\n\t\tconst jumps = new Uint8Array(8)\n\t\tfor (let way = 0; way < 8; way++) {\n\t\t\tconst dx = WAYS_X[way]\n\t\t\tconst dz = WAYS_Z[way]\n\t\t\tconst corner = dx !== 0 && dz !== 0\n\t\t\tconst along = (dx * wx + dz * wz) / (corner ? Math.SQRT2 : 1)\n\t\t\tways[way] = (corner ? CORNER : 1) * (strength && this.wind ? exp(WIND * this.wind * strength * along) : 1)\n\t\t\tjumps[way] = this.jump !== undefined && strength > 0 && strength >= this.jump && along >= 0.5 ? 1 : 0\n\t\t}\n\t\tconst weather = said.weather\n\t\tconst falling = this.weather && (weather?.kind === 'rain' || weather?.kind === 'snow')\n\t\tconst falls = falling ? Math.min(1, Math.max(0, weather?.amount ?? 0)) : 0\n\t\tconst areas =\n\t\t\tfalls && weather?.areas?.length\n\t\t\t\t? weather.areas.flatMap((area) => {\n\t\t\t\t\t\tconst shape = areaShapeOf(area.shape, info.regions ?? [])\n\t\t\t\t\t\treturn shape ? [{ shape, amount: Math.min(1, Math.max(0, area.amount ?? 1)) }] : []\n\t\t\t\t\t})\n\t\t\t\t: undefined\n\t\treturn (this.air = { of: environment, strength, x: wx, z: wz, ways, jumps, falls, areas })\n\t}\n\n\t/** How much rain or snow falls on a cell, 0 to 1 */\n\tfallsOn(air: FireAir, x: number, z: number): number {\n\t\tif (!air.falls || !air.areas) return air.falls\n\t\tlet most = 0\n\t\tfor (const area of air.areas) if (area.amount > most && inShape(area.shape, { x: x + 0.5, z: z + 0.5 })) most = area.amount\n\t\treturn air.falls * most\n\t}\n\n\t/**\n\t * Whether a cell of a layer (`l`) may catch fire: grass of a style that burns, whole or growing back, and not on\n\t * water, a road, what blocks the way or under a building\n\t */\n\tmayCatch(world: World, styles: FireStyles, road: number, l: number, cell: number): boolean {\n\t\tconst { terrain } = world\n\t\tconst value = terrain.cells[this.layers[l]]?.[cell]\n\t\tif (!value || !styles.flammable[l][value]) return false\n\t\tconst state = terrain.cells[this.states[l]]?.[cell] ?? FOLIAGE_STATE.whole\n\t\tif (state !== FOLIAGE_STATE.whole && state !== FOLIAGE_STATE.growing) return false\n\t\tif (terrain.water[cell] || (terrain.blocked[cell] & BLOCKS_WALK) !== 0 || (road && terrain.tiles[cell] === road)) return false\n\t\tconst x = cell % terrain.width\n\t\treturn world.grid.occupantAt(x, (cell - x) / terrain.width) <= 0\n\t}\n\n\t/** How many cells burn now, over the pack's layers */\n\tburningIn(state: FireState): number {\n\t\tlet count = 0\n\t\tfor (const layer of this.layers) count += state.burning[layer]?.cells.length ?? 0\n\t\treturn count\n\t}\n\n\t/**\n\t * Asks the game whether a cell catches (`foliageIgnite`), at a chance: the chance it says, 0 where it refuses. The\n\t * chance as it is where nobody listens\n\t */\n\task(world: World, l: number, cell: number, cause: FoliageCause, from: number | undefined, by: number, chance: number, thing?: Entity): number {\n\t\tif (!world.hooks.has(foliageIgnite)) return chance\n\t\tconst { width } = world.terrain\n\t\tconst x = cell % width\n\t\tconst asked = world.hooks.run(foliageIgnite, {\n\t\t\tlayer: this.layers[l],\n\t\t\tcell,\n\t\t\tx: x + 0.5,\n\t\t\tz: (cell - x) / width + 0.5,\n\t\t\tcause,\n\t\t\t...(from !== undefined ? { from } : {}),\n\t\t\t...(thing ? { thing } : {}),\n\t\t\t...(by ? { by: world.entities.get(by) } : {}),\n\t\t\tchance,\n\t\t\tcancelled: false\n\t\t})\n\t\t// held to 0 to 1, as the hook says: what is past either end is the same to `happens`\n\t\treturn asked.cancelled ? 0 : Math.min(1, Math.max(0, asked.chance || 0))\n\t}\n\n\t/** Whether something with a chance happens: by the world's numbers where it is neither sure nor never */\n\thappens(world: World, chance: number): boolean {\n\t\treturn chance >= 1 || (chance > 0 && world.rng.next() < chance)\n\t}\n\n\t/** Sets grass alight (`ignite`): the cells that caught, in order */\n\tignite(world: World, layer: string, cells: readonly number[], by: Entity | undefined): number[] {\n\t\tconst l = this.indexOf('ignite', layer)\n\t\tif (!this.on) return []\n\t\tconst state = world.state(fireState)\n\t\tconst styles = this.stylesOf(world)\n\t\tconst road = this.roadOf(world)\n\t\tconst id = by?.id ?? 0\n\t\tconst room = this.maxBurning - this.burningIn(state)\n\t\tconst lit: number[] = []\n\t\tconst tried = new Set<number>()\n\t\tfor (const cell of cells) {\n\t\t\tif (tried.has(cell)) continue\n\t\t\ttried.add(cell)\n\t\t\tif (!this.mayCatch(world, styles, road, l, cell)) continue\n\t\t\tif (state.waiting.some((each) => each.cell === cell && each.layer === layer)) continue\n\t\t\tif (!this.happens(world, this.ask(world, l, cell, 'ignite', undefined, id, 1))) continue\n\t\t\tif (lit.length < room) lit.push(cell)\n\t\t\t// past the most that may burn: lit as there is room\n\t\t\telse state.waiting.push({ layer, cell, lit: world.tick, by: id })\n\t\t}\n\t\tlit.sort((a, b) => a - b)\n\t\tthis.light(\n\t\t\tworld,\n\t\t\tstate,\n\t\t\tl,\n\t\t\tlit,\n\t\t\t() => id,\n\t\t\t() => world.tick,\n\t\t\t'ignite'\n\t\t)\n\t\treturn lit\n\t}\n\n\t/**\n\t * Cells of a layer catch fire, in order of their indices, each once, by whom and with the tick its fire was lit:\n\t * into the layer's list in order (a cell listed already, set otherwise since and lit again, is there once, with its\n\t * new fire), then set burning (one `setCells`), and told (`foliageIgnited`, by whom). In the list first: a cell set\n\t * burning is never outside it, whatever throws in what is told of the change (one listed whose state is not burning\n\t * is dropped at the fire's next tick)\n\t */\n\tlight(\n\t\tworld: World,\n\t\tstate: FireState,\n\t\tl: number,\n\t\tcells: readonly number[],\n\t\tbyOf: (i: number) => number,\n\t\tlitOf: (i: number) => number,\n\t\tcause: FoliageCause\n\t): void {\n\t\tif (!cells.length) return\n\t\tconst layer = this.layers[l]\n\t\tconst fire = (state.burning[layer] ??= { cells: [], ends: [], lit: [], by: [] })\n\t\t// a cell still listed (its state set otherwise by other means since, which the next tick would have dropped):\n\t\t// its old entry out first, so that it is there once\n\t\tif (fire.cells.length) {\n\t\t\tlet listed: Set<number> | undefined\n\t\t\tfor (const cell of cells) if (indexIn(fire.cells, cell) >= 0) (listed ??= new Set()).add(cell)\n\t\t\tif (listed) {\n\t\t\t\tlet kept = 0\n\t\t\t\tfor (let i = 0; i < fire.cells.length; i++) {\n\t\t\t\t\tif (listed.has(fire.cells[i])) continue\n\t\t\t\t\tfire.cells[kept] = fire.cells[i]\n\t\t\t\t\tfire.ends[kept] = fire.ends[i]\n\t\t\t\t\tfire.lit[kept] = fire.lit[i]\n\t\t\t\t\tfire.by[kept] = fire.by[i]\n\t\t\t\t\tkept++\n\t\t\t\t}\n\t\t\t\tthis.shorten(fire, kept)\n\t\t\t}\n\t\t}\n\t\tconst values = world.terrain.cells[layer]\n\t\tconst burns = this.stylesOf(world).burns[l]\n\t\tconst { tick, dt } = world\n\t\t// merged in from the end: the list stays in order of the cells, and nothing is made but its room\n\t\tlet i = fire.cells.length - 1\n\t\tlet j = cells.length - 1\n\t\tfor (let k = 0; k < cells.length; k++) {\n\t\t\tfire.cells.push(0)\n\t\t\tfire.ends.push(0)\n\t\t\tfire.lit.push(0)\n\t\t\tfire.by.push(0)\n\t\t}\n\t\tfor (let w = fire.cells.length - 1; j >= 0; w--) {\n\t\t\tif (i >= 0 && fire.cells[i] > cells[j]) {\n\t\t\t\tfire.cells[w] = fire.cells[i]\n\t\t\t\tfire.ends[w] = fire.ends[i]\n\t\t\t\tfire.lit[w] = fire.lit[i]\n\t\t\t\tfire.by[w] = fire.by[i]\n\t\t\t\ti--\n\t\t\t} else {\n\t\t\t\tconst cell = cells[j]\n\t\t\t\tfire.cells[w] = cell\n\t\t\t\tfire.ends[w] = tick + Math.max(1, Math.round(burns[values[cell]] / dt))\n\t\t\t\tfire.lit[w] = litOf(j)\n\t\t\t\tfire.by[w] = byOf(j)\n\t\t\t\tj--\n\t\t\t}\n\t\t}\n\t\tworld.setCells(this.states[l], cells, FOLIAGE_STATE.burning)\n\t\t// told by whom: one event for each who lit, in the order they come first\n\t\tconst first = byOf(0)\n\t\tlet whom: number[] | undefined\n\t\tfor (let k = 1; k < cells.length && !whom; k++) if (byOf(k) !== first) whom = [first]\n\t\tif (!whom) return void world.events.emit(foliageIgnited, { layer, cells: [...cells], cause, ...(first ? { by: first } : {}) })\n\t\tfor (let k = 0; k < cells.length; k++) if (!whom.includes(byOf(k))) whom.push(byOf(k))\n\t\tfor (const by of whom) world.events.emit(foliageIgnited, { layer, cells: cells.filter((_, k) => byOf(k) === by), cause, ...(by ? { by } : {}) })\n\t}\n\n\t/**\n\t * Takes cells out of a layer's fire (those `which` holds, or all of them) and sets them to `to` (burnt, or cut by a\n\t * firebreak; left as they are for none, where the caller sets them): those that burnt, in order. What waits there\n\t * to be lit waits no more. Told: `foliageBurnt` for what was put out, `foliageFireOut` where nothing burns any more\n\t */\n\tquench(world: World, state: FireState, l: number, which: ReadonlySet<number> | undefined, to: number | undefined): number[] {\n\t\tconst layer = this.layers[l]\n\t\tif (state.waiting.length) state.waiting = state.waiting.filter((each) => each.layer !== layer || (which !== undefined && !which.has(each.cell)))\n\t\tconst fire = state.burning[layer]\n\t\tif (!fire) return []\n\t\tconst out: number[] = []\n\t\tlet kept = 0\n\t\tfor (let i = 0; i < fire.cells.length; i++) {\n\t\t\tconst cell = fire.cells[i]\n\t\t\tif (which === undefined || which.has(cell)) {\n\t\t\t\tout.push(cell)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfire.cells[kept] = cell\n\t\t\tfire.ends[kept] = fire.ends[i]\n\t\t\tfire.lit[kept] = fire.lit[i]\n\t\t\tfire.by[kept] = fire.by[i]\n\t\t\tkept++\n\t\t}\n\t\tif (!out.length) return out\n\t\tthis.shorten(fire, kept)\n\t\tif (to !== undefined) world.setCells(this.states[l], out, to)\n\t\tif (to === FOLIAGE_STATE.burnt) world.events.emit(foliageBurnt, { layer, cells: [...out] })\n\t\tthis.over(world, state, l)\n\t\treturn out\n\t}\n\n\t/** A layer's list cut to its first `length` */\n\tshorten(fire: BurningCells, length: number): void {\n\t\tfire.cells.length = length\n\t\tfire.ends.length = length\n\t\tfire.lit.length = length\n\t\tfire.by.length = length\n\t}\n\n\t/** Where nothing of a layer burns any more: its list gone and told (`foliageFireOut`). Nothing where it burns, or had no list */\n\tover(world: World, state: FireState, l: number): void {\n\t\tconst layer = this.layers[l]\n\t\tconst fire = state.burning[layer]\n\t\tif (!fire || fire.cells.length) return\n\t\tdelete state.burning[layer]\n\t\tworld.events.emit(foliageFireOut, { layer })\n\t}\n\n\t/** A tick of the fire: what burns out, what catches, what waits and has room now, who is hurt */\n\ttick(world: World, state: FireState): void {\n\t\tconst { layers } = this\n\t\tlet burning = this.burningIn(state)\n\t\tif (!burning && !state.waiting.length) return\n\t\tconst { tick, terrain } = world\n\t\tconst { width, depth, heights, vertsX } = terrain\n\t\tconst styles = this.stylesOf(world)\n\t\tconst road = this.roadOf(world)\n\t\tconst air = this.airOf(world)\n\t\tconst stride = this.stride(world)\n\t\tconst turn = tick % stride\n\t\tconst lasts = this.lasts === undefined ? Infinity : Math.max(1, Math.round(this.lasts / world.dt))\n\t\tconst hooked = world.hooks.has(foliageIgnite)\n\t\tconst max = this.maxBurning\n\t\tlet fresh = 0\n\t\tfor (let l = 0; l < layers.length; l++) {\n\t\t\tthis.caught[l].clear()\n\t\t\tconst each = this.fresh[l]\n\t\t\teach.cells.length = each.by.length = each.lit.length = 0\n\t\t\tthis.out[l].length = 0\n\t\t}\n\t\tfor (let l = 0; l < layers.length; l++) {\n\t\t\tconst fire = state.burning[layers[l]]\n\t\t\tif (!fire) continue\n\t\t\tconst out = this.out[l]\n\t\t\tconst values = terrain.cells[layers[l]]\n\t\t\tconst states = terrain.cells[this.states[l]]\n\t\t\tconst fuel = styles.fuel[l]\n\t\t\tconst { cells, ends, lit, by } = fire\n\t\t\tlet kept = 0\n\t\t\tfor (let i = 0; i < cells.length; i++) {\n\t\t\t\tconst cell = cells[i]\n\t\t\t\tconst from = lit[i]\n\t\t\t\tconst whose = by[i]\n\t\t\t\t// set otherwise by other means (painted over, cleared, ruined): the fire's no more, as it is\n\t\t\t\tif (states?.[cell] !== FOLIAGE_STATE.burning || !values?.[cell]) {\n\t\t\t\t\tburning--\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif (ends[i] <= tick || from + lasts <= tick) {\n\t\t\t\t\tout.push(cell)\n\t\t\t\t\tburning--\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tconst x = cell % width\n\t\t\t\tconst z = (cell - x) / width\n\t\t\t\tif (turnOf(cell, stride) === turn) {\n\t\t\t\t\t// rain and snow put it out\n\t\t\t\t\tconst wet = this.fallsOn(air, x, z)\n\t\t\t\t\tif (wet && world.rng.next() < wet * DOUSE) {\n\t\t\t\t\t\tout.push(cell)\n\t\t\t\t\t\tburning--\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tif (this.spread && burning + fresh < max) {\n\t\t\t\t\t\tconst dry = (1 - Math.min(1, this.wet + wet)) * fuel[values[cell]]\n\t\t\t\t\t\tif (dry > 0)\n\t\t\t\t\t\t\tfresh += this.tryAround(\n\t\t\t\t\t\t\t\tworld,\n\t\t\t\t\t\t\t\tstyles,\n\t\t\t\t\t\t\t\troad,\n\t\t\t\t\t\t\t\tair,\n\t\t\t\t\t\t\t\tl,\n\t\t\t\t\t\t\t\tcell,\n\t\t\t\t\t\t\t\tx,\n\t\t\t\t\t\t\t\tz,\n\t\t\t\t\t\t\t\tdry,\n\t\t\t\t\t\t\t\tfrom,\n\t\t\t\t\t\t\t\twhose,\n\t\t\t\t\t\t\t\tburning + fresh,\n\t\t\t\t\t\t\t\thooked,\n\t\t\t\t\t\t\t\twidth,\n\t\t\t\t\t\t\t\tdepth,\n\t\t\t\t\t\t\t\theights,\n\t\t\t\t\t\t\t\tvertsX\n\t\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcells[kept] = cell\n\t\t\t\tends[kept] = ends[i]\n\t\t\t\tlit[kept] = from\n\t\t\t\tby[kept] = whose\n\t\t\t\tkept++\n\t\t\t}\n\t\t\tthis.shorten(fire, kept)\n\t\t}\n\t\t// what waits its turn (set alight past the most that may burn), as there is room\n\t\tlet waited: WaitingCell[] | undefined\n\t\twhile (state.waiting.length && burning + fresh < max) {\n\t\t\tconst next = state.waiting.shift()!\n\t\t\tconst l = layers.indexOf(next.layer)\n\t\t\tif (l < 0 || this.caught[l].has(next.cell) || !this.mayCatch(world, styles, road, l, next.cell)) continue\n\t\t\tthis.caught[l].add(next.cell)\n\t\t\t;(waited ??= []).push(next)\n\t\t\tfresh++\n\t\t}\n\t\tfor (let l = 0; l < layers.length; l++) {\n\t\t\tconst out = this.out[l]\n\t\t\tif (out.length) {\n\t\t\t\tworld.setCells(this.states[l], out, FOLIAGE_STATE.burnt)\n\t\t\t\tworld.events.emit(foliageBurnt, { layer: layers[l], cells: [...out] })\n\t\t\t\tthis.regrowth.ruined(world, l, out)\n\t\t\t}\n\t\t\tconst each = this.fresh[l]\n\t\t\tif (each.cells.length) {\n\t\t\t\t// in order of the cells, each with its own fire\n\t\t\t\tconst order = each.cells.map((_, k) => k).sort((a, b) => each.cells[a] - each.cells[b])\n\t\t\t\tconst sorted = order.map((k) => each.cells[k])\n\t\t\t\tthis.light(\n\t\t\t\t\tworld,\n\t\t\t\t\tstate,\n\t\t\t\t\tl,\n\t\t\t\t\tsorted,\n\t\t\t\t\t(k) => each.by[order[k]],\n\t\t\t\t\t(k) => each.lit[order[k]],\n\t\t\t\t\t'spread'\n\t\t\t\t)\n\t\t\t}\n\t\t\tconst lit = waited?.filter((each) => each.layer === layers[l]).sort((a, b) => a.cell - b.cell)\n\t\t\tif (lit?.length)\n\t\t\t\tthis.light(\n\t\t\t\t\tworld,\n\t\t\t\t\tstate,\n\t\t\t\t\tl,\n\t\t\t\t\tlit.map((each) => each.cell),\n\t\t\t\t\t(k) => lit[k].by,\n\t\t\t\t\t(k) => lit[k].lit,\n\t\t\t\t\t'ignite'\n\t\t\t\t)\n\t\t\t// nothing of it burns any more: gone, and told\n\t\t\tthis.over(world, state, l)\n\t\t}\n\t\tif (this.damage && tick % Math.max(1, Math.round(SCORCH_EVERY / world.dt)) === 0) this.scorch(world, state)\n\t}\n\n\t/**\n\t * A burning cell's try at the cells about it (and under it, of the pack's other layers): each that may catch, by a\n\t * chance of its style, the burning one's (`dry`: its fuel, less what is wet), the wind's way, the slope, and what\n\t * the game says (`foliageIgnite`). Across a gap of one cell downwind in a wind strong enough (`jump`). Into the\n\t * tick's caught cells; how many caught\n\t */\n\ttryAround(\n\t\tworld: World,\n\t\tstyles: FireStyles,\n\t\troad: number,\n\t\tair: FireAir,\n\t\tl: number,\n\t\tcell: number,\n\t\tx: number,\n\t\tz: number,\n\t\tdry: number,\n\t\tfrom: number,\n\t\tby: number,\n\t\tburning: number,\n\t\thooked: boolean,\n\t\twidth: number,\n\t\tdepth: number,\n\t\theights: Float32Array,\n\t\tvertsX: number\n\t): number {\n\t\tconst max = this.maxBurning\n\t\tlet caught = 0\n\t\tconst here = this.slope ? cellHeight(heights, vertsX, x, z) : 0\n\t\tfor (let m = 0; m < this.layers.length; m++) {\n\t\t\tconst flammable = styles.flammable[m]\n\t\t\tconst values = world.terrain.cells[this.layers[m]]\n\t\t\tif (!values) continue\n\t\t\t// the cell itself, of another layer: the grass under a thicket\n\t\t\tif (m !== l && this.catchable(world, styles, road, m, cell)) {\n\t\t\t\tconst chance = CATCH * dry * flammable[values[cell]]\n\t\t\t\tif (this.happens(world, hooked ? this.ask(world, m, cell, 'spread', cell, by, chance) : chance)) {\n\t\t\t\t\tthis.caught[m].add(cell)\n\t\t\t\t\tthis.fresh[m].cells.push(cell)\n\t\t\t\t\tthis.fresh[m].by.push(by)\n\t\t\t\t\tthis.fresh[m].lit.push(from)\n\t\t\t\t\tif (burning + ++caught >= max) return caught\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor (let way = 0; way < 8; way++) {\n\t\t\t\tlet nx = x + WAYS_X[way]\n\t\t\t\tlet nz = z + WAYS_Z[way]\n\t\t\t\tif (nx < 0 || nz < 0 || nx >= width || nz >= depth) continue\n\t\t\t\tlet next = nz * width + nx\n\t\t\t\tlet share = air.ways[way]\n\t\t\t\tif (!this.catchable(world, styles, road, m, next)) {\n\t\t\t\t\t// a gap of one cell (nothing there burns, or does now): jumped downwind in a wind strong enough\n\t\t\t\t\tif (!air.jumps[way] || this.caught[m].has(next) || world.terrain.cells[this.states[m]]?.[next] === FOLIAGE_STATE.burning) continue\n\t\t\t\t\tnx += WAYS_X[way]\n\t\t\t\t\tnz += WAYS_Z[way]\n\t\t\t\t\tif (nx < 0 || nz < 0 || nx >= width || nz >= depth) continue\n\t\t\t\t\tnext = nz * width + nx\n\t\t\t\t\tif (!this.catchable(world, styles, road, m, next)) continue\n\t\t\t\t\tshare *= JUMP\n\t\t\t\t}\n\t\t\t\tlet chance = CATCH * dry * share * flammable[values[next]]\n\t\t\t\tif (this.slope) {\n\t\t\t\t\tconst rise = cellHeight(heights, vertsX, nx, nz) - here\n\t\t\t\t\tif (rise) {\n\t\t\t\t\t\tconst dx = nx - x\n\t\t\t\t\t\tconst dz = nz - z\n\t\t\t\t\t\tchance *= exp(SLOPE * this.slope * Math.max(-1, Math.min(1, rise / Math.sqrt(dx * dx + dz * dz))))\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (!this.happens(world, hooked ? this.ask(world, m, next, 'spread', cell, by, chance) : chance)) continue\n\t\t\t\tthis.caught[m].add(next)\n\t\t\t\tthis.fresh[m].cells.push(next)\n\t\t\t\tthis.fresh[m].by.push(by)\n\t\t\t\tthis.fresh[m].lit.push(from)\n\t\t\t\tif (burning + ++caught >= max) return caught\n\t\t\t}\n\t\t}\n\t\treturn caught\n\t}\n\n\t/** Whether a cell of a layer may catch now: as `mayCatch`, and not caught already this tick */\n\tcatchable(world: World, styles: FireStyles, road: number, l: number, cell: number): boolean {\n\t\treturn !this.caught[l].has(cell) && this.mayCatch(world, styles, road, l, cell)\n\t}\n\n\t/*\n\t * The link with the burning pack (`FoliageFire.lights`, `BurningOptions.lightsFoliage`), which runs it at its own\n\t * turn: what it reads of the fire, and the cells it found caught, lit. Nothing here sets a thing alight, and nothing\n\t * the fire does sets the burning pack off: no call lights within another\n\t */\n\n\t/** How many more cells may burn now, over the pack's layers (`maxBurning`) */\n\troom(world: World): number {\n\t\treturn this.maxBurning - (world.states.has(fireState) ? this.burningIn(world.state(fireState)) : 0)\n\t}\n\n\t/** Whether any cell of the pack's layers burns now */\n\tanyBurning(world: World): boolean {\n\t\tif (!world.states.has(fireState)) return false\n\t\tconst { burning } = world.state(fireState)\n\t\tfor (const layer of this.layers) if (burning[layer]?.cells.length) return true\n\t\treturn false\n\t}\n\n\t/**\n\t * The burning cells whose turn to try about them it is this tick (once in `every` a cell, as the fire's own tries:\n\t * `turnOf`), still burning and not out this tick, in order of the layers and their cells: each told with who lit its\n\t * fire and its heat (its style's `fuel`, less what is wet and falls on it), those with any\n\t */\n\teachTrying(world: World, visit: (l: number, cell: number, by: number, heat: number) => void): void {\n\t\tif (!world.states.has(fireState)) return\n\t\tconst state = world.state(fireState)\n\t\tconst { tick, terrain } = world\n\t\tconst { width } = terrain\n\t\tconst stride = this.stride(world)\n\t\tconst turn = tick % stride\n\t\tconst styles = this.stylesOf(world)\n\t\tconst air = this.airOf(world)\n\t\tconst lasts = this.lasts === undefined ? Infinity : Math.max(1, Math.round(this.lasts / world.dt))\n\t\tfor (let l = 0; l < this.layers.length; l++) {\n\t\t\tconst fire = state.burning[this.layers[l]]\n\t\t\tif (!fire) continue\n\t\t\tconst values = terrain.cells[this.layers[l]]\n\t\t\tconst states = terrain.cells[this.states[l]]\n\t\t\tconst fuel = styles.fuel[l]\n\t\t\tconst { cells, ends, lit, by } = fire\n\t\t\tfor (let i = 0; i < cells.length; i++) {\n\t\t\t\tconst cell = cells[i]\n\t\t\t\tif (turnOf(cell, stride) !== turn || states?.[cell] !== FOLIAGE_STATE.burning || !values?.[cell]) continue\n\t\t\t\tif (ends[i] <= tick || lit[i] + lasts <= tick) continue\n\t\t\t\tconst x = cell % width\n\t\t\t\tconst heat = (1 - Math.min(1, this.wet + this.fallsOn(air, x, (cell - x) / width))) * fuel[values[cell]]\n\t\t\t\tif (heat > 0) visit(l, cell, by[i], heat)\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * How likely a cell of a layer is to catch at a try of a burning thing standing at `x`, `z` beside it\n\t * (`BurningOptions.lightsFoliage`): `FROM_THING` by its style's `flammable`, less what is wet and falls on it, weighed\n\t * by the wind (by `weight`: the burning pack's), 1 at the most. 0 where it may not catch now\n\t */\n\tchanceFrom(world: World, l: number, cell: number, x: number, z: number, weight: number): number {\n\t\tconst styles = this.stylesOf(world)\n\t\tif (!this.mayCatch(world, styles, this.roadOf(world), l, cell)) return 0\n\t\tconst { width } = world.terrain\n\t\tconst cx = cell % width\n\t\tconst cz = (cell - cx) / width\n\t\tconst air = this.airOf(world)\n\t\tlet chance = FROM_THING * styles.flammable[l][world.terrain.cells[this.layers[l]][cell]] * (1 - Math.min(1, this.wet + this.fallsOn(air, cx, cz)))\n\t\tif (chance > 0 && air.strength && weight) {\n\t\t\tconst dx = cx + 0.5 - x\n\t\t\tconst dz = cz + 0.5 - z\n\t\t\tconst far = Math.sqrt(dx * dx + dz * dz)\n\t\t\tif (far > 0) chance *= exp((WIND * weight * air.strength * (dx * air.x + dz * air.z)) / far)\n\t\t}\n\t\treturn Math.min(1, chance)\n\t}\n\n\t/**\n\t * Cells found caught from burning things at the burning pack's turn (`BurningOptions.lightsFoliage`; by layer, cell\n\t * and who lit the thing, in any order): lit (`burning`), in order of the layers and the cells, each once, those that\n\t * may still catch, as many as there is room for (`maxBurning`: the rest do not catch, as a spread's past it). How\n\t * many caught\n\t */\n\tlightCaught(world: World, layers: readonly number[], cells: readonly number[], by: readonly number[]): number {\n\t\tif (!cells.length) return 0\n\t\tconst order = cells.map((_, k) => k).sort((a, b) => layers[a] - layers[b] || cells[a] - cells[b] || a - b)\n\t\tconst state = world.state(fireState)\n\t\tconst styles = this.stylesOf(world)\n\t\tconst road = this.roadOf(world)\n\t\tlet room = this.maxBurning - this.burningIn(state)\n\t\tlet caught = 0\n\t\tfor (let l = 0; l < this.layers.length && room > 0; l++) {\n\t\t\tconst lit: number[] = []\n\t\t\tconst whose: number[] = []\n\t\t\tfor (const k of order) {\n\t\t\t\tif (layers[k] !== l || room <= 0) continue\n\t\t\t\tconst cell = cells[k]\n\t\t\t\tif (lit.length && lit[lit.length - 1] === cell) continue\n\t\t\t\tif (!this.mayCatch(world, styles, road, l, cell)) continue\n\t\t\t\tlit.push(cell)\n\t\t\t\twhose.push(by[k])\n\t\t\t\troom--\n\t\t\t}\n\t\t\tthis.light(\n\t\t\t\tworld,\n\t\t\t\tstate,\n\t\t\t\tl,\n\t\t\t\tlit,\n\t\t\t\t(k) => whose[k],\n\t\t\t\t() => world.tick,\n\t\t\t\t'burning'\n\t\t\t)\n\t\t\tcaught += lit.length\n\t\t}\n\t\treturn caught\n\t}\n\n\t/** Who stands in a burning cell is hurt, by whoever lit its fire: units on the ground, once whatever burns there */\n\tscorch(world: World, state: FireState): void {\n\t\tconst { terrain } = world\n\t\tconst { width, depth } = terrain\n\t\tconst amount = this.damage * Math.max(1, Math.round(SCORCH_EVERY / world.dt)) * world.dt\n\t\tconst hurt: { unit: Entity; by: number }[] = []\n\t\tfor (const unit of world.units.values()) {\n\t\t\tif (!unit.alive || unit.hidden || unit.flying || unit.def.footprint || unit.def.kind !== 'unit') continue\n\t\t\tconst { x, z } = unit.pos\n\t\t\tif (x < 0 || z < 0 || x >= width || z >= depth) continue\n\t\t\tconst cell = Math.floor(z) * width + Math.floor(x)\n\t\t\tfor (let l = 0; l < this.layers.length; l++) {\n\t\t\t\tif (terrain.cells[this.states[l]]?.[cell] !== FOLIAGE_STATE.burning) continue\n\t\t\t\tconst fire = state.burning[this.layers[l]]\n\t\t\t\tconst at = fire ? indexIn(fire.cells, cell) : -1\n\t\t\t\tif (at < 0) continue\n\t\t\t\thurt.push({ unit, by: fire!.by[at] })\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tfor (const { unit, by } of hurt) {\n\t\t\tif (!unit.alive) continue\n\t\t\tworld.damage(unit, amount, by ? world.entities.get(by) : undefined, { damageType: this.damageType, tags: ['fire'], how: 'burnt' })\n\t\t}\n\t}\n}\n\n/**\n * Which tick of every `stride` a burning cell tries the cells about it on: of a hash of its index, so that a front's\n * cells take their turns spread over the ticks, and the wait from catching to trying is no shorter one way than another\n */\nconst turnOf = (cell: number, stride: number): number => (Math.imul(cell, 0x9e3779b1) >>> 16) % stride\n\n/** The height of a cell's middle: its corners' */\nconst cellHeight = (heights: Float32Array, vertsX: number, x: number, z: number): number => {\n\tconst i = z * vertsX + x\n\treturn (heights[i] + heights[i + 1] + heights[i + vertsX] + heights[i + vertsX + 1]) / 4\n}\n\n/** Where a cell is in a list of cells in order: -1 where it is not */\nfunction indexIn(cells: readonly number[], cell: number): number {\n\tlet low = 0\n\tlet high = cells.length - 1\n\twhile (low <= high) {\n\t\tconst middle = (low + high) >> 1\n\t\tconst at = cells[middle]\n\t\tif (at === cell) return middle\n\t\tif (at < cell) low = middle + 1\n\t\telse high = middle - 1\n\t}\n\treturn -1\n}\n\n/** The fire's rules of a world's game: none where it has no foliage pack. `what` names the call that asks, which throws then */\nfunction fireOf(world: World, what: string): FoliageFireRules {\n\tconst pack = world.registry.assembly?.rules.packs?.find((each) => each.id === FOLIAGE) as FoliagePackWithFire | undefined\n\tif (!pack) throw new Error(`${what}: the game has no foliage pack (foliagePack)`)\n\treturn (pack[FIRE] ??= new FoliageFireRules(pack.options as FoliageOptions))\n}\n\n/**\n * The grass's fire of a world's game, for the burning pack's link to it (`BurningOptions.lightsFoliage`,\n * `FoliageFire.lights`): none where it has no foliage pack, or one whose grass never burns\n *\n * @internal\n */\nexport function foliageFireOf(world: World): FoliageFireRules | undefined {\n\tconst pack = world.registry.assembly?.rules.packs?.find((each) => each.id === FOLIAGE) as FoliagePackWithFire | undefined\n\tif (!pack) return undefined\n\tconst fire = (pack[FIRE] ??= new FoliageFireRules(pack.options as FoliageOptions))\n\treturn fire.on ? fire : undefined\n}\n\n/** The cells a call is given, as indices: of a shape, the cells whose middle is in it; indices as they are */\nfunction cellsOf(world: World, where: FoliageWhere): readonly number[] {\n\tif (Array.isArray(where)) return where as readonly number[]\n\tconst { width, depth } = world.terrain\n\tconst shape = where as AreaShape\n\tconst { x0, z0, x1, z1 } = shapeBounds(shape)\n\tconst cells: number[] = []\n\tfor (let cz = Math.max(Math.floor(z0), 0); cz < Math.min(Math.ceil(z1), depth); cz++)\n\t\tfor (let cx = Math.max(Math.floor(x0), 0); cx < Math.min(Math.ceil(x1), width); cx++)\n\t\t\tif (inShape(shape, { x: cx + 0.5, z: cz + 0.5 })) cells.push(cz * width + cx)\n\treturn cells\n}\n\n/**\n * Sets grass alight: the cells there that can burn start burning (`foliageIgnite` is asked of each), and the fire\n * goes on from them. `by`: who lit it, whom its damage is dealt by. A cell catches where its style burns\n * (`flammable` over 0), it stands whole or grows back, and it is not on water, a road (the game's `road` tile), what\n * blocks the way or under a building. Past the most that may burn at once (`FoliageFire.maxBurning`), the rest wait\n * their turn. Returns the cells that caught, in order; none in a game whose grass does not burn (`fire: false`)\n *\n * @beta\n */\nexport function ignite(world: World, layer: string, where: FoliageWhere, options: { by?: Entity } = {}): number[] {\n\treturn fireOf(world, 'ignite').ignite(world, layer, cellsOf(world, where), options.by)\n}\n\n/**\n * Puts out what burns there: the cells stop burning as they are, burnt. Returns the cells put out, in order\n *\n * @beta\n */\nexport function extinguish(world: World, layer: string, where: FoliageWhere): number[] {\n\tconst fire = fireOf(world, 'extinguish')\n\tconst l = fire.indexOf('extinguish', layer)\n\tif (!world.states.has(fireState)) return []\n\tconst out = fire.quench(world, world.state(fireState), l, new Set(cellsOf(world, where)), FOLIAGE_STATE.burnt)\n\tfire.regrowth.ruined(world, l, out)\n\treturn out\n}\n\n/**\n * Cuts grass down to stubble, which fire does not cross: `ruin` with `cut`. What burns there stops burning, cut. A\n * cell burnt already, or cut, is left as it is. Returns the cells cut, in order\n *\n * @beta\n */\nexport function firebreak(world: World, layer: string, where: FoliageWhere, options: { by?: Entity } = {}): number[] {\n\treturn ruinAs(world, 'firebreak', layer, where, 'cut', options.by)\n}\n\n/**\n * Puts out every fire of a layer, or of all the pack's layers when none is named: what burns is burnt, what waits its\n * turn is not lit. Returns how many cells were burning\n *\n * @beta\n */\nexport function stopFire(world: World, layer?: string): number {\n\tconst fire = fireOf(world, 'stopFire')\n\tconst which = layer === undefined ? fire.layers.map((_, l) => l) : [fire.indexOf('stopFire', layer)]\n\tif (!world.states.has(fireState)) return 0\n\tconst state = world.state(fireState)\n\tlet count = 0\n\tfor (const l of which) {\n\t\tconst out = fire.quench(world, state, l, undefined, FOLIAGE_STATE.burnt)\n\t\tfire.regrowth.ruined(world, l, out)\n\t\tcount += out.length\n\t}\n\treturn count\n}\n\n/**\n * Ruins grass: cut to stubble (`cut`, state `cut`: a firebreak), crushed flat (`crush`, state `flattened`, as what\n * tramples it does) or scorched black (`scorch`, state `burnt`: nothing left to burn) (`FoliageRuin`). What burns there\n * goes out as it is ruined. It hides nobody and does not burn until it has grown back (`regrow`, or by itself after\n * its style's `regrows` seconds, over its `grows`). A cell is left as it is where it is that already, or burnt (nothing\n * to cut or crush), or cut (nothing to crush). Told (`foliageRuined`), by `by` where it says. Changes the state layer\n * alone: the ways are not weighed again. Returns the cells ruined, in order\n *\n * @beta\n */\nexport function ruin(world: World, layer: string, where: FoliageWhere, options: { how: FoliageRuin; by?: Entity }): number[] {\n\treturn ruinAs(world, 'ruin', layer, where, options.how, options.by)\n}\n\n/** What each way of ruining makes a cell (`FOLIAGE_STATE`) */\nconst RUINED: Readonly<Record<FoliageRuin, number>> = { cut: FOLIAGE_STATE.cut, crush: FOLIAGE_STATE.flattened, scorch: FOLIAGE_STATE.burnt }\n\n/** Whether a cell in a state can be ruined so (`ruin`): not where it is that already, nor where nothing is left to cut or crush */\nfunction ruinable(how: FoliageRuin, state: number): boolean {\n\tif (state === FOLIAGE_STATE.burnt) return false\n\tif (how === 'cut') return state !== FOLIAGE_STATE.cut\n\tif (how === 'crush') return state !== FOLIAGE_STATE.flattened && state !== FOLIAGE_STATE.cut\n\treturn true\n}\n\n/** `ruin`, said as `what` (a call of its own, `firebreak`): the cells ruined, in order */\nfunction ruinAs(world: World, what: string, layer: string, where: FoliageWhere, how: FoliageRuin, by: Entity | undefined): number[] {\n\tconst fire = fireOf(world, what)\n\tconst l = fire.indexOf(what, layer)\n\tconst to = RUINED[how]\n\tif (to === undefined) throw new Error(`${what}: \"${how}\" is no way to ruin grass (cut, crush, scorch)`)\n\tconst { cells } = world.terrain\n\tconst values = cells[layer]\n\tconst states = cells[foliageStateLayer(layer)]\n\tconst ruined = [...new Set(cellsOf(world, where))]\n\t\t.filter((cell) => values?.[cell] && ruinable(how, states?.[cell] ?? FOLIAGE_STATE.whole))\n\t\t.sort((a, b) => a - b)\n\tif (!ruined.length) return ruined\n\t// what burns there goes out as it is ruined: out of the fire's list first, then set with the rest\n\tif (world.states.has(fireState)) fire.quench(world, world.state(fireState), l, new Set(ruined), to)\n\tworld.setCells(foliageStateLayer(layer), ruined, to)\n\tworld.events.emit(foliageRuined, { layer, cells: [...ruined], how, ...(by ? { by: by.id } : {}) })\n\tfire.regrowth.ruined(world, l, ruined)\n\treturn ruined\n}\n\n/**\n * Has ruined or burnt grass (cut, flattened, burnt) grow back to what it was: over `over` seconds (growing, which\n * hides and burns as whole grass does, and whole at its end), or at once when left out or 0, when grass growing back\n * already stands whole at once too. What it waited for by itself (`regrows`) it waits for no more. Told as it is whole\n * (`foliageRegrown`), by `by` where it says. Returns the cells that started to, in order\n *\n * @beta\n */\nexport function regrow(world: World, layer: string, where: FoliageWhere, options: { over?: number; by?: Entity } = {}): number[] {\n\tconst fire = fireOf(world, 'regrow')\n\tconst l = fire.indexOf('regrow', layer)\n\tconst { over = 0, by } = options\n\tif (!(over >= 0) || !Number.isFinite(over)) throw new Error(`regrow: over is seconds, 0 or more (not ${over})`)\n\tconst cells = [...new Set(cellsOf(world, where))].sort((a, b) => a - b)\n\treturn fire.regrowth.regrow(world, l, cells, over > 0 ? Math.max(1, Math.round(over / world.dt)) : 0, by?.id ?? 0)\n}\n\n/**\n * Takes grass away for good: the cells are no style any more (0), and nothing grows back. Returns the cells cleared\n *\n * @beta\n */\nexport function clearFoliage(world: World, layer: string, where: FoliageWhere): number[] {\n\treturn paint(world, 'clearFoliage', layer, where, 0)\n}\n\n/** The game a world is of, as `foliageStyle` reads it: its layers of cells as laid (its data and the map's over the code), its packs */\nconst gameOf = (world: World) => ({ cellLayers: world.registry.cellLayers, packs: world.registry.assembly?.rules.packs })\n\n/** Paints a layer's cells with a value, checked, and its state whole there again: the cells that changed, in order */\nfunction paint(world: World, what: string, layer: string, where: FoliageWhere, value: number): number[] {\n\tconst def = world.registry.cellLayers.find((each) => each.id === layer)\n\tif (!def) throw new Error(`${what}: the game has no layer of cells \"${layer}\" (Rules.cellLayers)`)\n\tconst values = def.values?.map((each) => each.value) ?? [1]\n\tif (value !== 0 && !values.includes(value)) throw new Error(`${what}: ${value} is no style of the layer \"${layer}\" (${values.join(', ')}, or 0 for none)`)\n\t// what burns there is the fire's no more: out of its list (and what waits there to be lit, of its waiting) first,\n\t// so that lit again it is there once, and counts once against the most that may burn\n\tconst fire = world.states.has(fireState) ? foliageFireOf(world) : undefined\n\tconst l = fire ? fire.layers.indexOf(layer) : -1\n\tif (fire && l >= 0) fire.quench(world, world.state(fireState), l, new Set(cellsOf(world, where)), undefined)\n\tconst changed = world.setCells(layer, where, value)\n\t// what happened there before is over; a layer of state no cell ever had is not made\n\tconst state = foliageStateLayer(layer)\n\tconst whole = world.terrain.cells[state] ? world.setCells(state, where, FOLIAGE_STATE.whole) : []\n\tif (!whole.length) return changed.sort((a, b) => a - b)\n\treturn [...new Set([...changed, ...whole])].sort((a, b) => a - b)\n}\n\n/**\n * Paints grass of a style: `world.setCells` on the layer, checked (a value the layer has a style for, or 0), the\n * cells whole again. Returns the cells that changed\n *\n * @beta\n */\nexport function setFoliage(world: World, layer: string, where: FoliageWhere, value: number): number[] {\n\treturn paint(world, 'setFoliage', layer, where, value)\n}\n\n/**\n * The grass at a point as the rules know it (`FoliageCell`): its style, what happened to it, whether it burns. None\n * where no grass is, or off the map\n *\n * @beta\n */\nexport function foliageAt(world: World, layer: string, x: number, z: number): FoliageCell | undefined {\n\tconst { terrain } = world\n\tif (!(x >= 0 && z >= 0 && x < terrain.width && z < terrain.depth)) return undefined\n\tconst cell = Math.floor(z) * terrain.width + Math.floor(x)\n\tconst value = terrain.cells[layer]?.[cell] ?? 0\n\tif (!value) return undefined\n\tconst state = foliageStateOf(terrain.cells[foliageStateLayer(layer)]?.[cell] ?? FOLIAGE_STATE.whole)\n\tconst found: FoliageCell = { cell, value, style: foliageStyle(gameOf(world), layer, value)!, state, burning: state === 'burning', left: 0 }\n\t// how long it still burns and who lit it: the fire's\n\tconst fire = state === 'burning' && world.states.has(fireState) ? world.state(fireState).burning[layer] : undefined\n\tconst at = fire ? indexIn(fire.cells, cell) : -1\n\tif (at < 0) return found\n\tconst rules = fireOf(world, 'foliageAt')\n\tconst lasts = rules.lasts === undefined ? Infinity : fire!.lit[at] + Math.max(1, Math.round(rules.lasts / world.dt))\n\tfound.left = Math.max(0, Math.min(fire!.ends[at], lasts) - world.tick) * world.dt\n\tif (fire!.by[at]) found.by = fire!.by[at]\n\treturn found\n}\n\n/** What `burningCells` gives where nothing burns */\nconst NONE: readonly number[] = Object.freeze([])\n\n/**\n * The cells of a layer that burn now, in order of their indices: for a game's rules and its computer players. Not to\n * be kept or changed: the pack's own list. None in a game whose grass does not burn\n *\n * @beta\n */\nexport function burningCells(world: World, layer: string): readonly number[] {\n\tfireOf(world, 'burningCells').indexOf('burningCells', layer)\n\treturn (world.states.has(fireState) && world.state(fireState).burning[layer]?.cells) || NONE\n}\n\n/** The cells an effect's area takes in (`effectArea`): those whose middle is in it */\nfunction cellsInArea(world: World, area: EffectArea): number[] {\n\tconst { width, depth } = world.terrain\n\tconst reach = areaReach(area)\n\tconst cells: number[] = []\n\tfor (let cz = Math.max(Math.floor(area.z - reach), 0); cz < Math.min(Math.ceil(area.z + reach), depth); cz++)\n\t\tfor (let cx = Math.max(Math.floor(area.x - reach), 0); cx < Math.min(Math.ceil(area.x + reach), width); cx++)\n\t\t\tif (inArea(area, { x: cx + 0.5, z: cz + 0.5 })) cells.push(cz * width + cx)\n\treturn cells\n}\n\n/**\n * The `foliage` effect (`EffectTypes.foliage`): does to the grass where it lands what its `act` says, by the caster.\n * Over its area (`radius`, `shape`), or the cell it landed on; on its `layer`, or every layer of the pack\n */\nconst foliageEffect = /* @__PURE__ */ defineEffect({\n\ttype: 'foliage',\n\trun(context, effect) {\n\t\tconst { world, caster, point } = context\n\t\tconst area = effectArea(context, effect)\n\t\tconst { width, depth } = world.terrain\n\t\tconst cells = area\n\t\t\t? cellsInArea(world, area)\n\t\t\t: point.x >= 0 && point.z >= 0 && point.x < width && point.z < depth\n\t\t\t\t? [Math.floor(point.z) * width + Math.floor(point.x)]\n\t\t\t\t: []\n\t\tif (!cells.length) return\n\t\tfor (const layer of effect.layer !== undefined ? [effect.layer] : fireOf(world, 'foliage effect').layers) {\n\t\t\tif (effect.act === 'ignite') ignite(world, layer, cells, { by: caster })\n\t\t\telse if (effect.act === 'extinguish') extinguish(world, layer, cells)\n\t\t\telse if (effect.act === 'ruin') ruin(world, layer, cells, { how: effect.how ?? 'cut', by: caster })\n\t\t\telse if (effect.act === 'regrow') regrow(world, layer, cells, { ...(effect.over !== undefined ? { over: effect.over } : {}), by: caster })\n\t\t\telse if (effect.act === 'clear') clearFoliage(world, layer, cells)\n\t\t}\n\t},\n\tfields: [\n\t\t{\n\t\t\tpath: 'act',\n\t\t\tkind: 'choice',\n\t\t\toptions: ['ignite', 'extinguish', 'ruin', 'regrow', 'clear'],\n\t\t\thint: 'What it does to the grass where it lands: sets it alight, puts it out, ruins it, has it grow back, or takes it away'\n\t\t},\n\t\t{ path: 'layer', kind: 'text', hint: 'The layer of grass it does it to: every layer of the foliage pack when left out' },\n\t\t{ path: 'how', kind: 'choice', options: ['cut', 'crush', 'scorch'], hint: 'How it ruins: cut when left out' },\n\t\t{ path: 'over', kind: 'number', min: 0, hint: 'Seconds what it has grow back takes to: at once when left out' }\n\t]\n})\n\n/**\n * A gust of wind at a place, for the grass and bushes there to bend to: an explosion's ring, a dragon's wings\n *\n * @beta\n */\nexport interface WindGust {\n\t/** How far around it reaches, in cells */\n\tradius: number\n\t/** How hard it blows, as the wind's strength: 1 a gale */\n\tstrength: number\n\t/** Which way it blows, in degrees as the wind's (`MapWind.around`): outwards from its middle when left out */\n\taround?: number\n\t/** How many seconds it lasts: 0.6 when left out */\n\tlasts?: number\n}\n\n/**\n * A gust of wind at a place, on the screen of every player who sees it (`WindGust`): the grass bends to it there (a\n * ring outwards as it spreads, or a push one way where it says `around`), as `client.gust` bends it on one screen. A\n * player is told where their team sees its middle or any of its edge; an observer always. Nothing it does decides\n * anything: it is not in the world's state or a save, and it changes nothing of the world\n *\n * @beta\n */\nexport function gust(world: World, at: Vec2, gust: WindGust): void {\n\tconst { radius, strength, around, lasts } = gust\n\tif (!(radius > 0) || !Number.isFinite(radius)) throw new Error(`gust: a radius over 0 (not ${radius})`)\n\tif (!(strength >= 0) || !Number.isFinite(strength)) throw new Error(`gust: a strength of 0 or more (not ${strength})`)\n\tif (around !== undefined && !Number.isFinite(around)) throw new Error(`gust: around in degrees (not ${around})`)\n\tif (lasts !== undefined && !(lasts > 0 && Number.isFinite(lasts))) throw new Error(`gust: lasts over 0 seconds (not ${lasts})`)\n\tif (!Number.isFinite(at.x) || !Number.isFinite(at.z)) throw new Error(`gust: a place on the map (not ${at.x}, ${at.z})`)\n\tworld.events.emit(gusted, {\n\t\tx: at.x,\n\t\tz: at.z,\n\t\tgust: { radius, strength, ...(around !== undefined && { around }), ...(lasts !== undefined && { lasts }) }\n\t})\n}\n\n/** The places of a gust a team must see one of to be told of it: its middle and four points of its edge */\nconst GUST_EDGE = [\n\t[0, 0],\n\t[1, 0],\n\t[-1, 0],\n\t[0, 1],\n\t[0, -1]\n] as const\n\n/** A gust of wind (`gust`): to each player whose team sees its middle or its edge, as a `gust` message */\nexport const toldGust = replicateEvent(gusted, 'gust', ({ x, z, gust }, view) => {\n\tconst { radius } = gust\n\tif (!GUST_EDGE.some(([dx, dz]) => view.sees(x + dx * radius, z + dz * radius))) return undefined\n\tconst round = (value: number) => Math.round(value * 100) / 100\n\treturn {\n\t\ttype: 'gust',\n\t\tx: Math.round(x * 10) / 10,\n\t\tz: Math.round(z * 10) / 10,\n\t\tradius: round(radius),\n\t\tstrength: round(gust.strength),\n\t\t...(gust.around !== undefined && { around: round(gust.around) }),\n\t\t...(gust.lasts !== undefined && { lasts: round(gust.lasts) })\n\t}\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAoCA,IAAa,UAAU;;;;;;;;;;AAWvB,IAAa,gBAAgB;CAAE,OAAO;CAAG,WAAW;CAAG,KAAK;CAAG,SAAS;CAAG,OAAO;CAAG,SAAS;AAAE;AAShG,IAAM,cAAc,OAAO,KAAK,aAAa;;;;;;AAO7C,IAAa,kBAAkB,UAAgC,YAAY,MAAM,SAAS,cAAc,UAAU,KAAK,KAAK;;AAG5H,IAAM,QAAQ;;;;;;;;;AAUd,IAAa,qBAAqB,UAA0B,GAAG,QAAQ;;;;;;AAOvE,IAAa,uBAAuB,UACnC,MAAM,SAAS,KAAK,KAAK,MAAM,SAAS,IAAe,MAAM,MAAM,GAAG,EAAa,IAAI,KAAA;;;;;;AA+IxF,SAAgB,cAAc,SAAgD;CAC7E,MAAM,EAAE,MAAM,MAAM,GAAG,GAAG,UAAU;CACpC,OAAO,CAAC,OAAO,GAAI,QAAQ,CAAC,CAAE;AAC/B;;;;;;;;AASA,SAAgB,aACf,MACA,OACA,OAC8B;CAC9B,IAAI,CAAC,OAAO,OAAO,KAAA;CACnB,MAAM,OAAO,KAAK,OAAO,MAAM,SAAS,KAAK,OAAO,OAAO;CAC3D,MAAM,OAAO,OAAO,cAAc,KAAK,OAAyB,CAAC,CAAC,MAAM,SAAS,KAAK,UAAU,KAAK,CAAC,EAAE,QAAQ,KAAA;CAChH,MAAM,MAAM,KAAK,YAAY,MAAM,QAAQ,IAAI,OAAO,KAAK,CAAC,EAAE,QAAQ,MAAM,SAAS,KAAK,UAAU,KAAK,CAAC,EAAE;CAC5G,OAAO;EAAE,GAAG;EAAM,GAAG;CAAI;AAC1B;;AAGA,IAAM,eAAgH;CACrH,UAAU;CACV,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,MAAM;EAAG;CAC1G,CAAC;AACF;;AAGA,IAAM,YAAY;CACjB,CAAC,GAAG,CAAC;CACL,CAAC,GAAG,CAAC;CACL,CAAC,IAAI,CAAC;CACN,CAAC,GAAG,CAAC;CACL,CAAC,GAAG,EAAE;AACP;;AAGA,IAAa,WAAW,eAAe,QAAQ,SAAS,EAAE,GAAG,GAAG,QAAQ,SAAS;CAChF,MAAM,EAAE,WAAW;CACnB,IAAI,CAAC,UAAU,MAAM,CAAC,IAAI,QAAQ,KAAK,KAAK,IAAI,KAAK,QAAQ,IAAI,KAAK,MAAM,CAAC,GAAG,OAAO,KAAA;CACvF,MAAM,SAAS,UAAkB,KAAK,MAAM,QAAQ,GAAG,IAAI;CAC3D,OAAO;EACN,MAAM;EACN,GAAG,KAAK,MAAM,IAAI,EAAE,IAAI;EACxB,GAAG,KAAK,MAAM,IAAI,EAAE,IAAI;EACxB,QAAQ,MAAM,MAAM;EACpB,UAAU,MAAM,KAAK,QAAQ;EAC7B,GAAI,KAAK,WAAW,KAAA,KAAa,EAAE,QAAQ,MAAM,KAAK,MAAM,EAAE;EAC9D,GAAI,KAAK,UAAU,KAAA,KAAa,EAAE,OAAO,MAAM,KAAK,KAAK,EAAE;CAC5D;AACD,CAAC"}
@@ -0,0 +1,57 @@
1
+ import type { CellLayerValue } from './cellLayers';
2
+ import type { CommandDef } from './commands';
3
+ import { type Check } from './fields';
4
+ /**
5
+ * What the foliage brush of the debug tools does where it is used (`debug.foliage`): `ignite` sets the grass alight,
6
+ * `extinguish` puts it out, `cut` cuts it to stubble (`ruin` with `cut`), `regrow` has it grow back
7
+ *
8
+ * @beta
9
+ */
10
+ export type FoliageBrushAct = 'ignite' | 'extinguish' | 'cut' | 'regrow';
11
+ /**
12
+ * Grass of a layer done something to in a circle, for who may use the debug tools (`FoliageBrushAct`): what the
13
+ * editor's Play here brushes send. A game without the foliage pack, or a layer it has not, is said to the sender and
14
+ * nothing is done
15
+ *
16
+ * @beta
17
+ */
18
+ export declare const foliageCommand: import("#engine/commands").DefinedCommand<"debug.foliage", {
19
+ act: Check<"cut" | "extinguish" | "ignite" | "regrow">;
20
+ layer: Check<string>;
21
+ point: Check<import("./math").Vec2>;
22
+ radius: Check<number>;
23
+ }>;
24
+ /**
25
+ * The world's wind turned and made stronger or weaker (`MapEnvironment.wind`, as the client's `MapWind` says it), eased
26
+ * into on the screens over a second, for who may use the debug tools: the editor's Play here wind dial. What is not
27
+ * given stays as the wind was
28
+ *
29
+ * @beta
30
+ */
31
+ export declare const windCommand: import("#engine/commands").DefinedCommand<"debug.wind", {
32
+ strength: Check<number | undefined>;
33
+ around: Check<number | undefined>;
34
+ }>;
35
+ /**
36
+ * A layer's values (its styles: name, colour and rules, `CellLayerValue`) put in the place of what the world's game
37
+ * has, for who may use the debug tools: what the editor's Play here sends as a style is changed while the map plays,
38
+ * the game's values with its data and the map's definitions laid over them. From then on the styles hide, burn and
39
+ * slow as they say: the hiding patches are worked out again, the fire reads them at its next turn, and the ways are
40
+ * weighed again where a style's speed changed or it stops one on foot now and did not (`walkable`), or the other way;
41
+ * the layer painted later in play weighs them too, a layer that slowed nowhere before among them. The ways weigh the
42
+ * ground only in a game whose ground slowed somewhere as the world was made (`hasGroundSpeeds`): in one that did not,
43
+ * a style given a speed here slows who walks on it and not the ways. A layer the game has not is refused. Not kept in
44
+ * a save as such: a save of the map is made with the map's definitions as they are
45
+ *
46
+ * @beta
47
+ */
48
+ export declare const cellStylesCommand: import("#engine/commands").DefinedCommand<"debug.cellStyles", {
49
+ layer: Check<string>;
50
+ values: Check<CellLayerValue[]>;
51
+ }>;
52
+ /**
53
+ * The debug commands of grass and bushes, which every game has: they go through only for who may use them
54
+ *
55
+ * @beta
56
+ */
57
+ export declare const foliageDebugCommands: CommandDef[];
@@ -0,0 +1,172 @@
1
+ import { markPatchesStale } from "./concealment.js";
2
+ import { mapInfo } from "./names.js";
3
+ import { extinguish, foliageStyle, foliageStyleProblem, ignite, regrow, ruin } from "./foliage.js";
4
+ import { Invalid, isObject, number, oneOf, optional, point, string } from "./fields.js";
5
+ import { defineDebugCommand } from "./debugCommands.js";
6
+ //#region src/foliageDebug.ts
7
+ /**
8
+ * Grass of a layer done something to in a circle, for who may use the debug tools (`FoliageBrushAct`): what the
9
+ * editor's Play here brushes send. A game without the foliage pack, or a layer it has not, is said to the sender and
10
+ * nothing is done
11
+ *
12
+ * @beta
13
+ */
14
+ var foliageCommand = defineDebugCommand("debug.foliage", {
15
+ act: oneOf("ignite", "extinguish", "cut", "regrow"),
16
+ layer: string,
17
+ point,
18
+ radius: number
19
+ }, (world, player, command) => {
20
+ const refuse = (why) => world.message(player, {
21
+ key: "dataRefused",
22
+ params: { why }
23
+ });
24
+ if (!world.registry.assembly?.rules.packs?.some((pack) => pack.id === "foliage")) return refuse("The game has no foliage pack (foliagePack): its grass does not burn or grow");
25
+ if (!world.registry.cellLayers.some((def) => def.id === command.layer)) return refuse(`The game has no layer of cells "${command.layer}"`);
26
+ const shape = {
27
+ kind: "circle",
28
+ x: command.point.x,
29
+ z: command.point.z,
30
+ radius: Math.min(Math.max(command.radius, .5), 32)
31
+ };
32
+ try {
33
+ if (command.act === "ignite") ignite(world, command.layer, shape);
34
+ else if (command.act === "extinguish") extinguish(world, command.layer, shape);
35
+ else if (command.act === "cut") ruin(world, command.layer, shape, { how: "cut" });
36
+ else regrow(world, command.layer, shape);
37
+ } catch (error) {
38
+ refuse(error instanceof Error ? error.message : String(error));
39
+ }
40
+ });
41
+ /**
42
+ * The world's wind turned and made stronger or weaker (`MapEnvironment.wind`, as the client's `MapWind` says it), eased
43
+ * into on the screens over a second, for who may use the debug tools: the editor's Play here wind dial. What is not
44
+ * given stays as the wind was
45
+ *
46
+ * @beta
47
+ */
48
+ var windCommand = defineDebugCommand("debug.wind", {
49
+ strength: optional(number),
50
+ around: optional(number)
51
+ }, (world, _player, command) => {
52
+ const was = world.state(mapInfo).environment?.wind;
53
+ const wind = {
54
+ ...was,
55
+ around: ((command.around ?? was?.around ?? 0) % 360 + 360) % 360,
56
+ strength: Math.min(Math.max(command.strength ?? was?.strength ?? 0, 0), 1)
57
+ };
58
+ world.setEnvironment({ wind }, { over: 1 });
59
+ });
60
+ /** A colour of a value, three numbers of 0 to 1 */
61
+ var colour = (value, path) => {
62
+ if (!Array.isArray(value) || value.length !== 3 || !value.every((part) => typeof part === "number" && part >= 0 && part <= 1)) throw new Invalid(`${path} is no colour, [r, g, b] from 0 to 1`);
63
+ return [
64
+ value[0],
65
+ value[1],
66
+ value[2]
67
+ ];
68
+ };
69
+ /** The values of a layer as the editor has them (`CellLayerValue`), each checked: 255 at most, 1 to 255 each, once */
70
+ var styleValues = (value, path) => {
71
+ if (!Array.isArray(value) || value.length > 255) throw new Invalid(`${path} is a list of at most 255 values`);
72
+ const seen = /* @__PURE__ */ new Set();
73
+ return value.map((each, i) => {
74
+ const at = `${path}[${i}]`;
75
+ if (!isObject(each)) throw new Invalid(`${at} is no value of a layer: { value, name, color?, foliage? }`);
76
+ const n = each.value;
77
+ if (!Number.isInteger(n) || n < 1 || n > 255 || seen.has(n)) throw new Invalid(`${at}.value is a number of 1 to 255, once`);
78
+ seen.add(n);
79
+ const out = {
80
+ value: n,
81
+ name: string(each.name, `${at}.name`)
82
+ };
83
+ if (each.color !== void 0) out.color = colour(each.color, `${at}.color`);
84
+ if (each.foliage !== void 0) {
85
+ const wrong = foliageStyleProblem(each.foliage, `${at}.foliage`);
86
+ if (wrong) throw new Invalid(wrong);
87
+ out.foliage = structuredClone(each.foliage);
88
+ }
89
+ return out;
90
+ });
91
+ };
92
+ /**
93
+ * A layer's values (its styles: name, colour and rules, `CellLayerValue`) put in the place of what the world's game
94
+ * has, for who may use the debug tools: what the editor's Play here sends as a style is changed while the map plays,
95
+ * the game's values with its data and the map's definitions laid over them. From then on the styles hide, burn and
96
+ * slow as they say: the hiding patches are worked out again, the fire reads them at its next turn, and the ways are
97
+ * weighed again where a style's speed changed or it stops one on foot now and did not (`walkable`), or the other way;
98
+ * the layer painted later in play weighs them too, a layer that slowed nowhere before among them. The ways weigh the
99
+ * ground only in a game whose ground slowed somewhere as the world was made (`hasGroundSpeeds`): in one that did not,
100
+ * a style given a speed here slows who walks on it and not the ways. A layer the game has not is refused. Not kept in
101
+ * a save as such: a save of the map is made with the map's definitions as they are
102
+ *
103
+ * @beta
104
+ */
105
+ var cellStylesCommand = defineDebugCommand("debug.cellStyles", {
106
+ layer: string,
107
+ values: styleValues
108
+ }, (world, player, command) => {
109
+ const { registry } = world;
110
+ const at = registry.cellLayers.findIndex((def) => def.id === command.layer);
111
+ if (at < 0) return world.message(player, {
112
+ key: "dataRefused",
113
+ params: { why: `The game has no layer of cells "${command.layer}"` }
114
+ });
115
+ const was = registry.cellLayers[at];
116
+ const before = {
117
+ cellLayers: registry.cellLayers,
118
+ packs: registry.assembly?.rules.packs
119
+ };
120
+ const values = [...command.values].sort((a, b) => a.value - b.value);
121
+ const now = {
122
+ ...was,
123
+ values
124
+ };
125
+ const layers = [...registry.cellLayers];
126
+ layers[at] = now;
127
+ registry.cellLayers = layers;
128
+ const after = {
129
+ cellLayers: layers,
130
+ packs: before.packs
131
+ };
132
+ const ofLayer = was.speed !== void 0 && was.speed >= 0 ? was.speed : 1;
133
+ const weighed = (game, value) => {
134
+ const style = foliageStyle(game, command.layer, value);
135
+ if (style?.walkable === false) return -1;
136
+ return style?.speed !== void 0 && style.speed >= 0 ? style.speed : ofLayer;
137
+ };
138
+ const changed = /* @__PURE__ */ new Uint8Array(256);
139
+ let any = false;
140
+ let walkability = false;
141
+ for (let value = 1; value < 256; value++) {
142
+ const old = weighed(before, value);
143
+ const current = weighed(after, value);
144
+ if (old !== current) changed[value] = 1;
145
+ any ||= old !== current;
146
+ walkability ||= old < 0 !== current < 0;
147
+ }
148
+ const cells = world.terrain.cells[command.layer];
149
+ if (any && cells) {
150
+ const where = [];
151
+ for (let c = 0; c < cells.length; c++) if (changed[cells[c]]) where.push(c);
152
+ if (where.length) {
153
+ world.nav.groundChanged?.(where, walkability);
154
+ world.sidePaths?.groundChanged(where, walkability);
155
+ }
156
+ }
157
+ markPatchesStale(world, command.layer);
158
+ });
159
+ /**
160
+ * The debug commands of grass and bushes, which every game has: they go through only for who may use them
161
+ *
162
+ * @beta
163
+ */
164
+ var foliageDebugCommands = [
165
+ foliageCommand,
166
+ windCommand,
167
+ cellStylesCommand
168
+ ];
169
+ //#endregion
170
+ export { cellStylesCommand, foliageCommand, foliageDebugCommands, windCommand };
171
+
172
+ //# sourceMappingURL=foliageDebug.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"foliageDebug.js","names":[],"sources":["../src/foliageDebug.ts"],"sourcesContent":["import type { AreaShape } from './areas'\nimport type { CellLayerDef, CellLayerValue } from './cellLayers'\nimport type { CommandDef } from './commands'\nimport { markPatchesStale } from './concealment'\nimport { defineDebugCommand } from './debugCommands'\nimport { type Check, Invalid, isObject, number, oneOf, optional, point, string } from './fields'\nimport { extinguish, FOLIAGE, foliageStyle, foliageStyleProblem, ignite, regrow, ruin } from './foliage'\nimport type { MapEnvironment } from './map/look'\nimport { mapInfo } from './names'\n\n/*\n * The debug commands of grass and bushes (the editor's Play here, a game's debug panel): a layer's grass set alight,\n * put out, cut or grown back where it is clicked (`debug.foliage`), the wind turned and made stronger (`debug.wind`),\n * and a layer's styles as the editor has them now put in the place of the game's (`debug.cellStyles`): a style\n * changed while the game plays hides, burns and slows as it says from then on\n */\n\n/**\n * What the foliage brush of the debug tools does where it is used (`debug.foliage`): `ignite` sets the grass alight,\n * `extinguish` puts it out, `cut` cuts it to stubble (`ruin` with `cut`), `regrow` has it grow back\n *\n * @beta\n */\nexport type FoliageBrushAct = 'ignite' | 'extinguish' | 'cut' | 'regrow'\n\n/**\n * Grass of a layer done something to in a circle, for who may use the debug tools (`FoliageBrushAct`): what the\n * editor's Play here brushes send. A game without the foliage pack, or a layer it has not, is said to the sender and\n * nothing is done\n *\n * @beta\n */\nexport const foliageCommand = defineDebugCommand(\n\t'debug.foliage',\n\t{ act: oneOf('ignite', 'extinguish', 'cut', 'regrow'), layer: string, point, radius: number },\n\t(world, player, command) => {\n\t\tconst refuse = (why: string) => world.message(player, { key: 'dataRefused', params: { why } })\n\t\tif (!world.registry.assembly?.rules.packs?.some((pack) => pack.id === FOLIAGE)) return refuse('The game has no foliage pack (foliagePack): its grass does not burn or grow')\n\t\tif (!world.registry.cellLayers.some((def) => def.id === command.layer)) return refuse(`The game has no layer of cells \"${command.layer}\"`)\n\t\tconst shape: AreaShape = { kind: 'circle', x: command.point.x, z: command.point.z, radius: Math.min(Math.max(command.radius, 0.5), 32) }\n\t\ttry {\n\t\t\tif (command.act === 'ignite') ignite(world, command.layer, shape)\n\t\t\telse if (command.act === 'extinguish') extinguish(world, command.layer, shape)\n\t\t\telse if (command.act === 'cut') ruin(world, command.layer, shape, { how: 'cut' })\n\t\t\telse regrow(world, command.layer, shape)\n\t\t} catch (error) {\n\t\t\trefuse(error instanceof Error ? error.message : String(error))\n\t\t}\n\t}\n)\n\n/**\n * The world's wind turned and made stronger or weaker (`MapEnvironment.wind`, as the client's `MapWind` says it), eased\n * into on the screens over a second, for who may use the debug tools: the editor's Play here wind dial. What is not\n * given stays as the wind was\n *\n * @beta\n */\nexport const windCommand = defineDebugCommand('debug.wind', { strength: optional(number), around: optional(number) }, (world, _player, command) => {\n\tconst environment = world.state(mapInfo).environment as (MapEnvironment & { wind?: { around?: number; strength?: number } }) | undefined\n\tconst was = environment?.wind\n\tconst wind = {\n\t\t...was,\n\t\taround: (((command.around ?? was?.around ?? 0) % 360) + 360) % 360,\n\t\tstrength: Math.min(Math.max(command.strength ?? was?.strength ?? 0, 0), 1)\n\t}\n\tworld.setEnvironment({ wind } as Partial<MapEnvironment>, { over: 1 })\n})\n\n/** A colour of a value, three numbers of 0 to 1 */\nconst colour: Check<[number, number, number]> = (value, path) => {\n\tif (!Array.isArray(value) || value.length !== 3 || !value.every((part) => typeof part === 'number' && part >= 0 && part <= 1))\n\t\tthrow new Invalid(`${path} is no colour, [r, g, b] from 0 to 1`)\n\treturn [value[0], value[1], value[2]]\n}\n\n/** The values of a layer as the editor has them (`CellLayerValue`), each checked: 255 at most, 1 to 255 each, once */\nconst styleValues: Check<CellLayerValue[]> = (value, path) => {\n\tif (!Array.isArray(value) || value.length > 255) throw new Invalid(`${path} is a list of at most 255 values`)\n\tconst seen = new Set<number>()\n\treturn value.map((each, i) => {\n\t\tconst at = `${path}[${i}]`\n\t\tif (!isObject(each)) throw new Invalid(`${at} is no value of a layer: { value, name, color?, foliage? }`)\n\t\tconst n = each.value\n\t\tif (!Number.isInteger(n) || (n as number) < 1 || (n as number) > 255 || seen.has(n as number)) throw new Invalid(`${at}.value is a number of 1 to 255, once`)\n\t\tseen.add(n as number)\n\t\tconst out: CellLayerValue = { value: n as number, name: string(each.name, `${at}.name`) }\n\t\tif (each.color !== undefined) out.color = colour(each.color, `${at}.color`)\n\t\tif (each.foliage !== undefined) {\n\t\t\tconst wrong = foliageStyleProblem(each.foliage, `${at}.foliage`)\n\t\t\tif (wrong) throw new Invalid(wrong)\n\t\t\tout.foliage = structuredClone(each.foliage) as CellLayerValue['foliage']\n\t\t}\n\t\treturn out\n\t})\n}\n\n/**\n * A layer's values (its styles: name, colour and rules, `CellLayerValue`) put in the place of what the world's game\n * has, for who may use the debug tools: what the editor's Play here sends as a style is changed while the map plays,\n * the game's values with its data and the map's definitions laid over them. From then on the styles hide, burn and\n * slow as they say: the hiding patches are worked out again, the fire reads them at its next turn, and the ways are\n * weighed again where a style's speed changed or it stops one on foot now and did not (`walkable`), or the other way;\n * the layer painted later in play weighs them too, a layer that slowed nowhere before among them. The ways weigh the\n * ground only in a game whose ground slowed somewhere as the world was made (`hasGroundSpeeds`): in one that did not,\n * a style given a speed here slows who walks on it and not the ways. A layer the game has not is refused. Not kept in\n * a save as such: a save of the map is made with the map's definitions as they are\n *\n * @beta\n */\nexport const cellStylesCommand = defineDebugCommand('debug.cellStyles', { layer: string, values: styleValues }, (world, player, command) => {\n\tconst { registry } = world\n\tconst at = registry.cellLayers.findIndex((def) => def.id === command.layer)\n\tif (at < 0) return world.message(player, { key: 'dataRefused', params: { why: `The game has no layer of cells \"${command.layer}\"` } })\n\tconst was = registry.cellLayers[at]\n\tconst before = { cellLayers: registry.cellLayers, packs: registry.assembly?.rules.packs }\n\tconst values = [...command.values].sort((a, b) => a.value - b.value)\n\tconst now: CellLayerDef = { ...was, values }\n\tconst layers = [...registry.cellLayers]\n\tlayers[at] = now\n\t// what reads the styles works them out again for another list of layers (concealment, the fire, the ground's speeds)\n\tregistry.cellLayers = layers\n\tconst after = { cellLayers: layers, packs: before.packs }\n\t// the values whose speed changed, or that stop one on foot now and did not or the other way: the ways weighed again\n\t// where they are painted, as the ground's speeds read them (`groundSpeed.ts`)\n\tconst ofLayer = was.speed !== undefined && was.speed >= 0 ? was.speed : 1\n\tconst weighed = (game: typeof before, value: number) => {\n\t\tconst style = foliageStyle(game, command.layer, value)\n\t\tif (style?.walkable === false) return -1\n\t\treturn style?.speed !== undefined && style.speed >= 0 ? style.speed : ofLayer\n\t}\n\tconst changed = new Uint8Array(256)\n\tlet any = false\n\t// whether one of them is walked on now and was not, or the other way\n\tlet walkability = false\n\tfor (let value = 1; value < 256; value++) {\n\t\tconst old = weighed(before, value)\n\t\tconst current = weighed(after, value)\n\t\tif (old !== current) changed[value] = 1\n\t\tany ||= old !== current\n\t\twalkability ||= old < 0 !== current < 0\n\t}\n\tconst cells = world.terrain.cells[command.layer]\n\tif (any && cells) {\n\t\tconst where: number[] = []\n\t\tfor (let c = 0; c < cells.length; c++) if (changed[cells[c]]) where.push(c)\n\t\tif (where.length) {\n\t\t\tworld.nav.groundChanged?.(where, walkability)\n\t\t\tworld.sidePaths?.groundChanged(where, walkability)\n\t\t}\n\t}\n\t// the hiding patches worked out again at the next ask; a burning cell of a style that no longer burns goes on as it\n\t// was lit, the fire reading the styles anew as it next tries to spread\n\tmarkPatchesStale(world, command.layer)\n})\n\n/**\n * The debug commands of grass and bushes, which every game has: they go through only for who may use them\n *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MAAM;CAEV,IAAI,cAAc;CAClB,KAAK,IAAI,QAAQ,GAAG,QAAQ,KAAK,SAAS;EACzC,MAAM,MAAM,QAAQ,QAAQ,KAAK;EACjC,MAAM,UAAU,QAAQ,OAAO,KAAK;EACpC,IAAI,QAAQ,SAAS,QAAQ,SAAS;EACtC,QAAQ,QAAQ;EAChB,gBAAgB,MAAM,MAAM,UAAU;CACvC;CACA,MAAM,QAAQ,MAAM,QAAQ,MAAM,QAAQ;CAC1C,IAAI,OAAO,OAAO;EACjB,MAAM,QAAkB,CAAC;EACzB,KAAK,IAAI,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK,IAAI,QAAQ,MAAM,KAAK,MAAM,KAAK,CAAC;EAC1E,IAAI,MAAM,QAAQ;GACjB,MAAM,IAAI,gBAAgB,OAAO,WAAW;GAC5C,MAAM,WAAW,cAAc,OAAO,WAAW;EAClD;CACD;CAGA,iBAAiB,OAAO,QAAQ,KAAK;AACtC,CAAC;;;;;;AAOD,IAAa,uBAAqC;CAAC;CAAgB;CAAa;AAAiB"}
@@ -0,0 +1,20 @@
1
+ import type { CellLayerDef } from './cellLayers';
2
+ import type { FOLIAGE_STATE, FoliageStyleDef } from './foliage';
3
+ import type { GamePack } from './packs/pack';
4
+ import type { World } from './world';
5
+ /** What the pack tells its regrowth of itself: its layers, their state layers, its styles, and how to tell of what grew */
6
+ export interface RegrowthHost {
7
+ /** The pack's layers, in order */
8
+ readonly layers: readonly string[];
9
+ /** Each layer's state layer */
10
+ readonly states: readonly string[];
11
+ /** The values of the state layer (`FOLIAGE_STATE`) */
12
+ readonly state: typeof FOLIAGE_STATE;
13
+ /** What a style is to the rules (`foliageStyle`) */
14
+ style(game: {
15
+ cellLayers: readonly CellLayerDef[];
16
+ packs?: readonly GamePack[];
17
+ }, layer: string, value: number): FoliageStyleDef | undefined;
18
+ /** Cells stood whole again (`foliageRegrown`), by whom where someone had them */
19
+ regrown(world: World, layer: string, cells: number[], by: number): void;
20
+ }