@v12-engine/engine 0.0.0-stage → 0.1.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 (341) hide show
  1. package/LICENSE +21 -0
  2. package/dist/abilities/buffs.d.ts +83 -0
  3. package/dist/abilities/castTold.d.ts +12 -0
  4. package/dist/abilities/charges.d.ts +28 -0
  5. package/dist/abilities/dispel.d.ts +9 -0
  6. package/dist/abilities/effectFields.d.ts +10 -0
  7. package/dist/abilities/effects/buff.d.ts +8 -0
  8. package/dist/abilities/effects/core.d.ts +1 -0
  9. package/dist/abilities/effects/damage.d.ts +1 -0
  10. package/dist/abilities/effects/heal.d.ts +2 -0
  11. package/dist/abilities/effects/missile.d.ts +1 -0
  12. package/dist/abilities/effects/moves.d.ts +11 -0
  13. package/dist/abilities/effects/passives.d.ts +15 -0
  14. package/dist/abilities/effects/sight.d.ts +4 -0
  15. package/dist/abilities/effects/spawn.d.ts +2 -0
  16. package/dist/abilities/effects/timed.d.ts +4 -0
  17. package/dist/abilities/effects/trade.d.ts +1 -0
  18. package/dist/abilities/effects.d.ts +122 -0
  19. package/dist/abilities/land.d.ts +21 -0
  20. package/dist/abilities/scaled.d.ts +21 -0
  21. package/dist/abilities/text.d.ts +113 -0
  22. package/dist/ai/area.d.ts +53 -0
  23. package/dist/ai/brain.d.ts +528 -0
  24. package/dist/ai/budget.d.ts +67 -0
  25. package/dist/ai/checks.d.ts +115 -0
  26. package/dist/ai/computer.d.ts +166 -0
  27. package/dist/ai/defence.d.ts +108 -0
  28. package/dist/ai/define.d.ts +21 -0
  29. package/dist/ai/economy.d.ts +129 -0
  30. package/dist/ai/geometry.d.ts +35 -0
  31. package/dist/ai/goals.d.ts +360 -0
  32. package/dist/ai/index.d.ts +38 -0
  33. package/dist/ai/knowledge.d.ts +418 -0
  34. package/dist/ai/lanes.d.ts +232 -0
  35. package/dist/ai/melee/build.d.ts +61 -0
  36. package/dist/ai/melee/goals.d.ts +299 -0
  37. package/dist/ai/melee/heroes.d.ts +27 -0
  38. package/dist/ai/melee/index.d.ts +14 -0
  39. package/dist/ai/melee/production.d.ts +8 -0
  40. package/dist/ai/melee/surrender.d.ts +24 -0
  41. package/dist/ai/micro.d.ts +278 -0
  42. package/dist/ai/mission.d.ts +195 -0
  43. package/dist/ai/missionRules.d.ts +18 -0
  44. package/dist/ai/module.d.ts +116 -0
  45. package/dist/ai/options.d.ts +61 -0
  46. package/dist/ai/plans/build.d.ts +280 -0
  47. package/dist/ai/plans/placement.d.ts +82 -0
  48. package/dist/ai/plans/plans.d.ts +105 -0
  49. package/dist/ai/plans/production.d.ts +210 -0
  50. package/dist/ai/plans/purse.d.ts +73 -0
  51. package/dist/ai/plans/tech.d.ts +37 -0
  52. package/dist/ai/profiles.d.ts +204 -0
  53. package/dist/ai/reach.d.ts +4 -0
  54. package/dist/ai/report.d.ts +203 -0
  55. package/dist/ai/roles.d.ts +133 -0
  56. package/dist/ai/rules.d.ts +288 -0
  57. package/dist/ai/scouting.d.ts +98 -0
  58. package/dist/ai/settings.d.ts +73 -0
  59. package/dist/ai/squads.d.ts +429 -0
  60. package/dist/ai/strength.d.ts +167 -0
  61. package/dist/ai/task.d.ts +118 -0
  62. package/dist/ai/tasks/attack.d.ts +7 -0
  63. package/dist/ai/tasks/capture.d.ts +21 -0
  64. package/dist/ai/tasks/creep.d.ts +16 -0
  65. package/dist/ai/tasks/defend.d.ts +29 -0
  66. package/dist/ai/tasks/drop.d.ts +34 -0
  67. package/dist/ai/tasks/escort.d.ts +16 -0
  68. package/dist/ai/tasks/gather.d.ts +23 -0
  69. package/dist/ai/tasks/harass.d.ts +7 -0
  70. package/dist/ai/tasks/hold.d.ts +20 -0
  71. package/dist/ai/tasks/index.d.ts +32 -0
  72. package/dist/ai/tasks/move.d.ts +19 -0
  73. package/dist/ai/tasks/patrol.d.ts +8 -0
  74. package/dist/ai/tasks/retreat.d.ts +20 -0
  75. package/dist/ai/tasks/scout.d.ts +29 -0
  76. package/dist/ai/tasks/shared.d.ts +74 -0
  77. package/dist/ai/team.d.ts +155 -0
  78. package/dist/ai/threat.d.ts +91 -0
  79. package/dist/ai/view.d.ts +366 -0
  80. package/dist/ai/waves.d.ts +126 -0
  81. package/dist/ai.js +6239 -0
  82. package/dist/ai.js.map +1 -0
  83. package/dist/aiTesting.d.ts +179 -0
  84. package/dist/areas.d.ts +149 -0
  85. package/dist/attacks.d.ts +66 -0
  86. package/dist/attributes.d.ts +66 -0
  87. package/dist/brain-BvVdUhX8.js +7659 -0
  88. package/dist/brain-BvVdUhX8.js.map +1 -0
  89. package/dist/builds-C6LfgvEU.js +460 -0
  90. package/dist/builds-C6LfgvEU.js.map +1 -0
  91. package/dist/bytes.d.ts +6 -0
  92. package/dist/camps.d.ts +95 -0
  93. package/dist/capture.d.ts +131 -0
  94. package/dist/cellLayers.d.ts +75 -0
  95. package/dist/cinematics.d.ts +194 -0
  96. package/dist/clock.d.ts +32 -0
  97. package/dist/commands.d.ts +235 -0
  98. package/dist/components.d.ts +184 -0
  99. package/dist/computers.d.ts +108 -0
  100. package/dist/concealment.d.ts +61 -0
  101. package/dist/coreComponents-syuh2fPG.js +5149 -0
  102. package/dist/coreComponents-syuh2fPG.js.map +1 -0
  103. package/dist/coreComponents.d.ts +1 -0
  104. package/dist/dashing.d.ts +8 -0
  105. package/dist/debug.d.ts +36 -0
  106. package/dist/debug.js +3 -0
  107. package/dist/debugCommands-CzjrSm66.js +14739 -0
  108. package/dist/debugCommands-CzjrSm66.js.map +1 -0
  109. package/dist/debugCommands.d.ts +213 -0
  110. package/dist/debugging.d.ts +10 -0
  111. package/dist/definitions.d.ts +43 -0
  112. package/dist/defs.d.ts +1162 -0
  113. package/dist/denying.d.ts +81 -0
  114. package/dist/destructibles.d.ts +27 -0
  115. package/dist/determinism-BCymQwiE.js +518 -0
  116. package/dist/determinism-BCymQwiE.js.map +1 -0
  117. package/dist/determinism.d.ts +121 -0
  118. package/dist/dialog.d.ts +94 -0
  119. package/dist/effectRefs.d.ts +16 -0
  120. package/dist/effects.d.ts +80 -0
  121. package/dist/endings.d.ts +22 -0
  122. package/dist/engagement.d.ts +108 -0
  123. package/dist/engineEvents.d.ts +710 -0
  124. package/dist/entity.d.ts +409 -0
  125. package/dist/entityIndex.d.ts +50 -0
  126. package/dist/errors.d.ts +85 -0
  127. package/dist/events.d.ts +97 -0
  128. package/dist/exactMath.d.ts +63 -0
  129. package/dist/features.d.ts +10 -0
  130. package/dist/fields.d.ts +114 -0
  131. package/dist/fixture.d.ts +17 -0
  132. package/dist/fog.d.ts +110 -0
  133. package/dist/formation.d.ts +111 -0
  134. package/dist/friendlyFire.d.ts +26 -0
  135. package/dist/game-DiJEN-Ks.js +5800 -0
  136. package/dist/game-DiJEN-Ks.js.map +1 -0
  137. package/dist/game.d.ts +501 -0
  138. package/dist/gameData.d.ts +325 -0
  139. package/dist/gameFiles.d.ts +26 -0
  140. package/dist/gates.d.ts +28 -0
  141. package/dist/generate.d.ts +403 -0
  142. package/dist/generateWorker.d.ts +39 -0
  143. package/dist/grid.d.ts +53 -0
  144. package/dist/ground.d.ts +127 -0
  145. package/dist/groundSpeed.d.ts +22 -0
  146. package/dist/hero.d.ts +177 -0
  147. package/dist/home.d.ts +14 -0
  148. package/dist/hooks.d.ts +780 -0
  149. package/dist/hotReload.d.ts +76 -0
  150. package/dist/ids.d.ts +26 -0
  151. package/dist/index.d.ts +227 -0
  152. package/dist/index.js +4701 -0
  153. package/dist/index.js.map +1 -0
  154. package/dist/inspect-D9dWHmZ0.js +491 -0
  155. package/dist/inspect-D9dWHmZ0.js.map +1 -0
  156. package/dist/inspect.d.ts +176 -0
  157. package/dist/inventory.d.ts +18 -0
  158. package/dist/items.d.ts +91 -0
  159. package/dist/lanes.d.ts +213 -0
  160. package/dist/life.d.ts +53 -0
  161. package/dist/local-Dkovq42k.js +1379 -0
  162. package/dist/local-Dkovq42k.js.map +1 -0
  163. package/dist/log.d.ts +140 -0
  164. package/dist/manaBurn.d.ts +39 -0
  165. package/dist/map/file.d.ts +114 -0
  166. package/dist/map/images.d.ts +18 -0
  167. package/dist/map/look.d.ts +47 -0
  168. package/dist/map/pathProfile.d.ts +13 -0
  169. package/dist/map/resize.d.ts +54 -0
  170. package/dist/map/schema.d.ts +10 -0
  171. package/dist/map/terrain.d.ts +32 -0
  172. package/dist/map/types.d.ts +613 -0
  173. package/dist/map.d.ts +7 -0
  174. package/dist/mapCheck/cells.d.ts +19 -0
  175. package/dist/mapCheck/rule.d.ts +30 -0
  176. package/dist/mapCheck/rules/names.d.ts +3 -0
  177. package/dist/mapCheck/rules/objects.d.ts +3 -0
  178. package/dist/mapCheck/rules/paths.d.ts +3 -0
  179. package/dist/mapCheck/rules/players.d.ts +3 -0
  180. package/dist/mapCheck/rules/races.d.ts +3 -0
  181. package/dist/mapCheck/rules/random.d.ts +3 -0
  182. package/dist/mapCheck/rules/regions.d.ts +3 -0
  183. package/dist/mapCheck/rules/targets.d.ts +3 -0
  184. package/dist/mapCheck/rules/walking.d.ts +3 -0
  185. package/dist/mapCheck.d.ts +23 -0
  186. package/dist/mapFields.d.ts +364 -0
  187. package/dist/mapFile.d.ts +23 -0
  188. package/dist/mapMeasure.d.ts +95 -0
  189. package/dist/mapMerge.d.ts +19 -0
  190. package/dist/mapObjectives.d.ts +82 -0
  191. package/dist/mapObjects.d.ts +1 -0
  192. package/dist/math.d.ts +44 -0
  193. package/dist/messages.d.ts +150 -0
  194. package/dist/missionRules-C-bGxm0Q.js +523 -0
  195. package/dist/missionRules-C-bGxm0Q.js.map +1 -0
  196. package/dist/missionRules.d.ts +179 -0
  197. package/dist/mods.d.ts +146 -0
  198. package/dist/names.d.ts +93 -0
  199. package/dist/navigation/agentParams.d.ts +4 -0
  200. package/dist/navigation/air.d.ts +89 -0
  201. package/dist/navigation/builds.d.ts +140 -0
  202. package/dist/navigation/groundAreas.d.ts +23 -0
  203. package/dist/navigation/navigation.d.ts +127 -0
  204. package/dist/navigation/recast.d.ts +214 -0
  205. package/dist/navigation/sidePaths.d.ts +69 -0
  206. package/dist/navigation/sized.d.ts +1 -0
  207. package/dist/navigation-worker.js +11 -0
  208. package/dist/navigation-worker.js.map +1 -0
  209. package/dist/nearest.d.ts +8 -0
  210. package/dist/noise.d.ts +12 -0
  211. package/dist/objectives.d.ts +93 -0
  212. package/dist/orders/basic.d.ts +96 -0
  213. package/dist/orders/build.d.ts +91 -0
  214. package/dist/orders/cast.d.ts +105 -0
  215. package/dist/orders/facts.d.ts +14 -0
  216. package/dist/orders/harvest.d.ts +94 -0
  217. package/dist/orders/idle.d.ts +7 -0
  218. package/dist/orders/items.d.ts +14 -0
  219. package/dist/orders/queue.d.ts +24 -0
  220. package/dist/pack.schema.json +6621 -0
  221. package/dist/packs/director/index.d.ts +81 -0
  222. package/dist/packs/heroes/campaign.d.ts +137 -0
  223. package/dist/packs/heroes/carry.d.ts +59 -0
  224. package/dist/packs/heroes/commands.d.ts +6 -0
  225. package/dist/packs/heroes/hire.d.ts +9 -0
  226. package/dist/packs/heroes/index.d.ts +12 -0
  227. package/dist/packs/heroes/making.d.ts +16 -0
  228. package/dist/packs/heroes/respawn.d.ts +42 -0
  229. package/dist/packs/moba/index.d.ts +34 -0
  230. package/dist/packs/pack.d.ts +84 -0
  231. package/dist/packs-g5thvmGn.js +3199 -0
  232. package/dist/packs-g5thvmGn.js.map +1 -0
  233. package/dist/packs.d.ts +84 -0
  234. package/dist/paths.d.ts +51 -0
  235. package/dist/plain.d.ts +17 -0
  236. package/dist/player.d.ts +117 -0
  237. package/dist/portals.d.ts +66 -0
  238. package/dist/prefabs.d.ts +139 -0
  239. package/dist/presetBuildings.d.ts +52 -0
  240. package/dist/presetGround.d.ts +22 -0
  241. package/dist/profiles-B3NS9jwk.js +335 -0
  242. package/dist/profiles-B3NS9jwk.js.map +1 -0
  243. package/dist/races.d.ts +136 -0
  244. package/dist/randomGroups.d.ts +2 -0
  245. package/dist/registry.d.ts +464 -0
  246. package/dist/remains.d.ts +119 -0
  247. package/dist/replication.d.ts +103 -0
  248. package/dist/rng.d.ts +17 -0
  249. package/dist/rules.d.ts +395 -0
  250. package/dist/rulesCheck.d.ts +37 -0
  251. package/dist/runes.d.ts +41 -0
  252. package/dist/save.d.ts +277 -0
  253. package/dist/scenario.d.ts +56 -0
  254. package/dist/scheduler.d.ts +67 -0
  255. package/dist/score.d.ts +306 -0
  256. package/dist/sequences.d.ts +132 -0
  257. package/dist/server/doorman.d.ts +21 -0
  258. package/dist/server/gameServer.d.ts +346 -0
  259. package/dist/server/index.d.ts +24 -0
  260. package/dist/server/lobby.d.ts +1 -0
  261. package/dist/server/log.d.ts +13 -0
  262. package/dist/server/match.d.ts +24 -0
  263. package/dist/server/mode.d.ts +168 -0
  264. package/dist/server/navigation-worker.d.ts +1 -0
  265. package/dist/server/navigation.d.ts +11 -0
  266. package/dist/server/ops.d.ts +78 -0
  267. package/dist/server/packs.d.ts +15 -0
  268. package/dist/server/ratings.d.ts +62 -0
  269. package/dist/server/relay.d.ts +34 -0
  270. package/dist/server/rooms.d.ts +162 -0
  271. package/dist/server/seat.d.ts +2 -0
  272. package/dist/server/seatSettings.d.ts +15 -0
  273. package/dist/server/secret.d.ts +5 -0
  274. package/dist/server/start.d.ts +54 -0
  275. package/dist/server/websocket.d.ts +74 -0
  276. package/dist/server.js +2861 -0
  277. package/dist/server.js.map +1 -0
  278. package/dist/session/can.d.ts +20 -0
  279. package/dist/session/commandReplay.d.ts +92 -0
  280. package/dist/session/debug.d.ts +65 -0
  281. package/dist/session/delay.d.ts +15 -0
  282. package/dist/session/delta.d.ts +98 -0
  283. package/dist/session/entityState.d.ts +1 -0
  284. package/dist/session/local.d.ts +214 -0
  285. package/dist/session/memory.d.ts +27 -0
  286. package/dist/session/protocol.d.ts +1155 -0
  287. package/dist/session/remote.d.ts +530 -0
  288. package/dist/session/replay.d.ts +114 -0
  289. package/dist/session/seed.d.ts +7 -0
  290. package/dist/session/share.d.ts +78 -0
  291. package/dist/session/socket.d.ts +8 -0
  292. package/dist/session/wire.d.ts +153 -0
  293. package/dist/session/worker.d.ts +227 -0
  294. package/dist/shared.d.ts +171 -0
  295. package/dist/sides.d.ts +75 -0
  296. package/dist/sight.d.ts +27 -0
  297. package/dist/simulate-oXBiw1Ff.js +167 -0
  298. package/dist/simulate-oXBiw1Ff.js.map +1 -0
  299. package/dist/simulate-worker.d.ts +1 -0
  300. package/dist/simulate-worker.js +28 -0
  301. package/dist/simulate-worker.js.map +1 -0
  302. package/dist/simulate.d.ts +154 -0
  303. package/dist/smart.d.ts +9 -0
  304. package/dist/spatial.d.ts +62 -0
  305. package/dist/spawning.d.ts +33 -0
  306. package/dist/stances.d.ts +76 -0
  307. package/dist/start.d.ts +71 -0
  308. package/dist/stats.d.ts +122 -0
  309. package/dist/summons.d.ts +63 -0
  310. package/dist/systems/abilities.d.ts +3 -0
  311. package/dist/systems/combat.d.ts +71 -0
  312. package/dist/systems/combatTold.d.ts +14 -0
  313. package/dist/systems/construction.d.ts +34 -0
  314. package/dist/systems/economy.d.ts +21 -0
  315. package/dist/systems/fog.d.ts +19 -0
  316. package/dist/systems/life.d.ts +3 -0
  317. package/dist/systems/movement.d.ts +105 -0
  318. package/dist/systems/orders.d.ts +7 -0
  319. package/dist/systems/production.d.ts +49 -0
  320. package/dist/systems/productionQueue.d.ts +40 -0
  321. package/dist/systems/victory.d.ts +14 -0
  322. package/dist/talk.d.ts +65 -0
  323. package/dist/tech.d.ts +62 -0
  324. package/dist/techTree.d.ts +38 -0
  325. package/dist/terrain.d.ts +173 -0
  326. package/dist/terrainSave.d.ts +29 -0
  327. package/dist/testing.d.ts +58 -0
  328. package/dist/testing.js +822 -0
  329. package/dist/testing.js.map +1 -0
  330. package/dist/tiles.d.ts +34 -0
  331. package/dist/timers.d.ts +146 -0
  332. package/dist/tomes.d.ts +48 -0
  333. package/dist/trade.d.ts +28 -0
  334. package/dist/transport.d.ts +76 -0
  335. package/dist/tunables.d.ts +45 -0
  336. package/dist/upkeep.d.ts +16 -0
  337. package/dist/veterancy.d.ts +80 -0
  338. package/dist/walls.d.ts +86 -0
  339. package/dist/world.d.ts +1118 -0
  340. package/package.json +80 -5
  341. package/README.md +0 -3
@@ -0,0 +1,3 @@
1
+ import type { MapRule } from '../rule';
2
+ /** How many players the map has, against what the game allows */
3
+ export declare const playerRules: MapRule;
@@ -0,0 +1,3 @@
1
+ import type { MapRule } from '../rule';
2
+ /** The races of the map, its players and what is placed for them */
3
+ export declare const raceRules: MapRule;
@@ -0,0 +1,3 @@
1
+ import type { MapRule } from '../rule';
2
+ /** Random groups and item tables: something to draw from, and by names there are */
3
+ export declare const randomRules: MapRule;
@@ -0,0 +1,3 @@
1
+ import type { MapRule } from '../rule';
2
+ /** Regions on the map */
3
+ export declare const regionRules: MapRule;
@@ -0,0 +1,3 @@
1
+ import type { MapRule } from '../rule';
2
+ /** A field that names a region, a point or a path the map has not (any more) */
3
+ export declare const targetRules: MapRule;
@@ -0,0 +1,3 @@
1
+ import type { MapRule } from '../rule';
2
+ /** Who can walk to whom: starts cut off from each other, mines nobody can walk to */
3
+ export declare const walkingRules: MapRule;
@@ -0,0 +1,23 @@
1
+ import { type GameMap } from './map';
2
+ import type { MapProblem } from './mapFields';
3
+ import type { Registry } from './registry';
4
+ import type { MapRule } from './mapCheck/rule';
5
+ export { mapCells } from './mapCheck/cells';
6
+ export type { MapCheckContext, MapRule } from './mapCheck/rule';
7
+ /**
8
+ * The engine's checks of a map, in the order they run: players, what is placed, random groups, names, regions, paths,
9
+ * walking, races, the fields that name things
10
+ *
11
+ * @beta
12
+ */
13
+ export declare const MAP_RULES: readonly MapRule[];
14
+ /**
15
+ * What is wrong with a map, before it is played: what the game does not have, names used twice or named and not
16
+ * there, what stands off the map or in deep water, starts that cannot reach each other on foot, mines nobody can walk
17
+ * to, regions outside the map (`MAP_RULES`); then the checks given (`more`: the client's of what the map looks like,
18
+ * a game view's own, as the editor runs them); then the game's own (`MapEditorDef.check`). Errors keep it from being
19
+ * played; the rest are warnings. Runs without the editor, for a test that goes over every map of a project
20
+ *
21
+ * @beta
22
+ */
23
+ export declare function checkMap(map: GameMap, registry: Registry, more?: readonly MapRule[]): MapProblem[];
@@ -0,0 +1,364 @@
1
+ import { type UnitTypeDef } from './defs';
2
+ import type { GameMap, MapPlayer } from './map';
3
+ import type { GameMeasure } from './mapMeasure';
4
+ import type { Vec2 } from './math';
5
+ import type { Registry } from './registry';
6
+ /**
7
+ * A thing on a map, by its kind and id: what a problem is about, which the editor selects. `thing` is one of a kind of
8
+ * the game's own (`MapThing`), with the kind's name
9
+ *
10
+ * @beta
11
+ */
12
+ export type MapTarget = {
13
+ object: number;
14
+ } | {
15
+ camp: number;
16
+ } | {
17
+ region: number;
18
+ } | {
19
+ point: number;
20
+ } | {
21
+ path: number;
22
+ } | {
23
+ doodad: number;
24
+ } | {
25
+ light: number;
26
+ } | {
27
+ effect: number;
28
+ } | {
29
+ decal: number;
30
+ } | {
31
+ sound: number;
32
+ } | {
33
+ mistArea: number;
34
+ } | {
35
+ weatherArea: number;
36
+ } | {
37
+ cloudPatch: number;
38
+ } | {
39
+ player: number;
40
+ } | {
41
+ thing: number;
42
+ kind: string;
43
+ };
44
+ /**
45
+ * A thing of a kind of a game's own on a map: something the game's editor puts down for its rules to read (a spawner,
46
+ * a waypoint, ground kept clear), where the engine's own kinds (objects, camps, regions, points, paths, doodads) do
47
+ * not say it. Kept with the map under the kind's name (`GameMap.data[kind]`, a list of them), which the engine never
48
+ * looks inside: the rules read them (`world.map.things(kind)`, `mapThings`)
49
+ *
50
+ * @beta
51
+ */
52
+ export interface MapThing {
53
+ /** Its own among the things of its kind */
54
+ id: number;
55
+ x: number;
56
+ z: number;
57
+ /** The way it faces, in radians. 0 when left out */
58
+ facing?: number;
59
+ /** A name of its own, to find it by: no two things of a map have the same, whatever they are */
60
+ name?: string;
61
+ /** The game's own fields of it, by their ids: what was set, without what is at its default */
62
+ data?: Record<string, unknown>;
63
+ }
64
+ /**
65
+ * The things of a kind of a game's own on a map (`MapThing`), as the map keeps them: none for a kind it has nothing
66
+ * of. What is kept under that name and is no thing (no id, no place) is left out, so that a file changed by hand breaks
67
+ * no rule that reads it
68
+ *
69
+ * @beta
70
+ */
71
+ export declare function mapThings(map: {
72
+ data: Record<string, unknown>;
73
+ }, kind: string): MapThing[];
74
+ /**
75
+ * Something wrong with a map, as a game sees it: said before the map is played
76
+ *
77
+ * @beta
78
+ */
79
+ export interface MapProblem {
80
+ message: string;
81
+ /** It cannot be played like this. A warning when left out: it can, but probably should not */
82
+ error?: boolean;
83
+ /** Where on the map it is, for the editor to show */
84
+ at?: Vec2;
85
+ /**
86
+ * The rule it breaks, by id (`off-map`, `deep-water`…, or a game's own): what silences it, for a map
87
+ * (`GameMap.silence`) or a game (`MapEditorDef.silence`). A game's own check that says none is `game`
88
+ */
89
+ rule?: string;
90
+ /** What it is about: a click on it in the editor selects it */
91
+ about?: MapTarget;
92
+ /**
93
+ * Where it is shown when it is about something of a panel's rather than the map's (a clip of a cinematic): a click on
94
+ * it opens that panel at that entry (`editor.panels.reveal(panel, entry)`, as the search of everything does)
95
+ */
96
+ reveal?: {
97
+ panel: string;
98
+ entry: string;
99
+ };
100
+ }
101
+ /**
102
+ * What a game brings to the map editor, beyond its units: the fields of its own, what can be scattered, its players,
103
+ * and what it takes for a map to be one of its maps. Each that is decided from something can be given as a function
104
+ *
105
+ * @beta
106
+ */
107
+ export interface MapEditorDef {
108
+ /** Fields of the game's own on what is placed on a map, shown in the inspector (see `defineMapField`) */
109
+ fields?: MapFieldDef[];
110
+ /**
111
+ * Unit types the scatter brush puts down many of at once, like a forest. Resources one cell big when left out:
112
+ * trees. What is scattered belongs to nobody
113
+ */
114
+ scatter?: string[] | ((registry: Registry) => string[]);
115
+ /** Whether the game has creep camps to place. It does when it has a unit type with a bounty, when left out */
116
+ camps?: boolean;
117
+ /**
118
+ * The players of every map of the game, when the game decides who they are, as a tower defense does: the editor
119
+ * shows those and only lets their starts be set. Open slots to add and take away when left out
120
+ */
121
+ players?: MapPlayer[] | ((map: GameMap) => MapPlayer[]);
122
+ /** A line under the players, saying what the game makes of them: who is the player, who gets a base */
123
+ playersNote?: string;
124
+ /**
125
+ * What is wrong with a map as a map of this game: no start for anyone, no way through. Errors keep it from being
126
+ * played from the editor; warnings are said
127
+ */
128
+ check?: (map: GameMap, registry: Registry) => MapProblem[];
129
+ /** The editor's checks the game does not want, by their rules' ids (`MapProblem.rule`), for every map of it */
130
+ silence?: string[];
131
+ /** What the game measures of a map of its own, for the editor's report (`measureMap`): the length of the road */
132
+ measure?: (map: GameMap, registry: Registry) => GameMeasure[];
133
+ /**
134
+ * The palette's groups of unit types, each saying whose what is put down from it is and whether it makes camps.
135
+ * Units, heroes, buildings, resources (nobody's) and creeps (the creeps', making camps) when left out
136
+ */
137
+ palette?: (registry: Registry) => MapPaletteGroup[];
138
+ /**
139
+ * What the erase brush can be set to take, besides everything and camps. Units, buildings, resources and trees (a
140
+ * resource one cell big) when left out
141
+ */
142
+ erase?: MapEraseKind[];
143
+ /**
144
+ * What the starts must be able to walk to, which the checks look for (`unreachable`): a resource two cells big or
145
+ * more when left out, a gold mine and not a tree
146
+ */
147
+ reach?: (def: UnitTypeDef) => boolean;
148
+ /** The lowest and the highest the ground is raised to. -4 to 16 when left out */
149
+ heights?: readonly [number, number];
150
+ /**
151
+ * Where else the game names a thing of a map (a unit type in its waves, a region in a mission's goals): what the
152
+ * editor lists under Used by and selects with Find references, beyond what it finds on the map itself (placed
153
+ * objects, camps, random groups, the game's fields, prefabs, cinematics). Given the thing asked about and the map
154
+ *
155
+ * @beta
156
+ */
157
+ references?: (ref: MapRef, map: GameMap, registry: Registry) => MapRefUse[];
158
+ }
159
+ /**
160
+ * Something of a game or a map that others name: a unit type, a doodad's model, a prefab, a region, a point or a path
161
+ * (by name), a thing named on the map, a cinematic, a file of the game's
162
+ *
163
+ * @beta
164
+ */
165
+ export type MapRef = {
166
+ type: string;
167
+ } | {
168
+ model: string;
169
+ } | {
170
+ prefab: string;
171
+ } | {
172
+ region: string;
173
+ } | {
174
+ point: string;
175
+ } | {
176
+ path: string;
177
+ } | {
178
+ name: string;
179
+ } | {
180
+ cinematic: string;
181
+ } | {
182
+ asset: string;
183
+ };
184
+ /**
185
+ * What on the map a use is: what a click on it selects
186
+ *
187
+ * @beta
188
+ */
189
+ export type MapRefTarget = {
190
+ object: number;
191
+ } | {
192
+ camp: number;
193
+ } | {
194
+ region: number;
195
+ } | {
196
+ point: number;
197
+ } | {
198
+ path: number;
199
+ } | {
200
+ doodad: number;
201
+ } | {
202
+ light: number;
203
+ } | {
204
+ effect: number;
205
+ } | {
206
+ decal: number;
207
+ } | {
208
+ sound: number;
209
+ } | {
210
+ mistArea: number;
211
+ } | {
212
+ weatherArea: number;
213
+ } | {
214
+ cloudPatch: number;
215
+ } | {
216
+ thing: number;
217
+ kind: string;
218
+ };
219
+ /**
220
+ * One place a thing is named: what names it, where, and what on the map that is
221
+ *
222
+ * @beta
223
+ */
224
+ export interface MapRefUse {
225
+ /** What names it: `placed`, `camp`, `random group`, `field Spawns`, `prefab`, `cinematic`, or the game's own word */
226
+ what: string;
227
+ /** Where: the map's name, a group's, a prefab's, a cinematic's id, a wave's */
228
+ where: string;
229
+ target?: MapRefTarget;
230
+ }
231
+ /**
232
+ * A group of the palette (`MapEditorDef.palette`)
233
+ *
234
+ * @beta
235
+ */
236
+ export interface MapPaletteGroup {
237
+ name: string;
238
+ types: UnitTypeDef[];
239
+ /**
240
+ * Whose what is put down from it is, by player id (`MAP_CREEPS`, `MAP_NEUTRAL`): the player picked above it when
241
+ * left out, and nobody for a resource
242
+ */
243
+ owner?: number;
244
+ /** Its units are what camps are made of: the camp tool picks from them */
245
+ camps?: boolean;
246
+ }
247
+ /**
248
+ * A kind of thing the erase brush can be set to take (`MapEditorDef.erase`)
249
+ *
250
+ * @beta
251
+ */
252
+ export interface MapEraseKind {
253
+ id: string;
254
+ /** What the brush's choice calls it */
255
+ name: string;
256
+ takes: (def: UnitTypeDef) => boolean;
257
+ }
258
+ /**
259
+ * The heights the ground goes from and to when a game does not say
260
+ *
261
+ * @beta
262
+ */
263
+ export declare const DEFAULT_HEIGHTS: readonly [number, number];
264
+ /** What a field of a game's own holds, and so how the editor lets it be set */
265
+ /**
266
+ * What a field holds: a number, words, yes or no, one of a few, a unit type, a player; a region, a point or a path of
267
+ * the map (kept by id, so that a rename does not lose it; handed to the game by name); a colour (`[r, g, b]`, 0 to 1);
268
+ * a list of words; a vector on the ground (`{ x, z }`)
269
+ *
270
+ * @beta
271
+ */
272
+ export type MapFieldKind = 'number' | 'text' | 'toggle' | 'choice' | 'unit' | 'player' | 'region' | 'point' | 'path' | 'color' | 'list' | 'vector';
273
+ /** The kinds of field that name a thing of the map, by its id */
274
+ export declare const TARGET_FIELDS: readonly ['region', 'point', 'path'];
275
+ /**
276
+ * A field of a game's own on what is placed on a map: the wave a spawner sends, whether a gate starts open, what a
277
+ * guard does. The editor shows it in the inspector for what it is a field of, and keeps what it was set to with the
278
+ * object (`MapObject.data`). The engine does nothing with it: the `mapObject` hook hands it to the game as the world
279
+ * is made, which is where the game says what it means. Given in `GameModule.editor.fields`
280
+ *
281
+ * @beta
282
+ */
283
+ export interface MapFieldDef {
284
+ /** The key it is kept under. Shared by the fields of every mod on the game: give a mod's a prefix */
285
+ id: string;
286
+ /** What the inspector calls it */
287
+ name: string;
288
+ /** A line more, shown when the pointer rests on it */
289
+ hint?: string;
290
+ /**
291
+ * The fields it is laid out beside in the inspector, by a name they share (`'Position'`): the consecutive fields of
292
+ * one group two a line, under its name. Alone when left out
293
+ */
294
+ group?: string;
295
+ kind: MapFieldKind;
296
+ /**
297
+ * What it is a field of: objects of these unit types, or of the types a function says yes to (every hero, every
298
+ * building that trains something); or camps, or regions; or the map itself (kept in `GameMap.data`, read as
299
+ * `world.map.data`), or its players (`MapPlayer.data`, read as `world.map.player(id).data`)
300
+ */
301
+ for: string[] | ((def: UnitTypeDef) => boolean) | 'camp' | 'region' | 'map' | 'player';
302
+ /** What it is when nothing was set. The game is given this then, and the file does not hold it */
303
+ default?: unknown;
304
+ /** For a number: the least and the most it can be, and what the arrows step by */
305
+ min?: number;
306
+ max?: number;
307
+ step?: number;
308
+ /** For a choice: what there is to choose from, as data or worked out from the game */
309
+ options?: readonly MapFieldOption[] | ((registry: Registry) => readonly MapFieldOption[]);
310
+ }
311
+ /**
312
+ * One of the things a choice field can be: the value kept, and what the inspector calls it when that is not the value
313
+ *
314
+ * @beta
315
+ */
316
+ export type MapFieldOption = string | {
317
+ value: string;
318
+ label: string;
319
+ };
320
+ /**
321
+ * Typed help for writing a field
322
+ *
323
+ * @beta
324
+ */
325
+ export declare const defineMapField: (def: MapFieldDef) => MapFieldDef;
326
+ /**
327
+ * The game's fields for a placed object, by the type it is of. None for a type the game does not have
328
+ *
329
+ * @beta
330
+ */
331
+ export declare function objectFields(registry: Registry, type: string): MapFieldDef[];
332
+ /**
333
+ * The game's fields for a camp
334
+ *
335
+ * @beta
336
+ */
337
+ export declare const campFields: (registry: Registry) => MapFieldDef[];
338
+ /**
339
+ * The game's fields for a region
340
+ *
341
+ * @beta
342
+ */
343
+ export declare const regionFields: (registry: Registry) => MapFieldDef[];
344
+ /**
345
+ * The fields of the map itself, and of its players
346
+ *
347
+ * @beta
348
+ */
349
+ export declare const mapFields: (registry: Registry) => MapFieldDef[];
350
+ /** @beta */
351
+ export declare const playerFields: (registry: Registry) => MapFieldDef[];
352
+ /**
353
+ * What a choice field can be set to, as values with what each is called
354
+ *
355
+ * @beta
356
+ */
357
+ export declare function fieldOptions(registry: Registry, field: MapFieldDef): {
358
+ value: string;
359
+ label: string;
360
+ }[];
361
+ /** What the fields of something placed are, with what was not set at its default: what the game is handed */
362
+ export declare function fieldValues(fields: readonly MapFieldDef[], data: Record<string, unknown> | undefined, map?: GameMap): Record<string, unknown>;
363
+ /** The name of a region, a point or a path of a map by its id: undefined for one the map has not (any more) */
364
+ export declare function targetName(map: GameMap, kind: (typeof TARGET_FIELDS)[number], id: number): string | undefined;
@@ -0,0 +1,23 @@
1
+ import { type GameMap } from './map';
2
+ /**
3
+ * A map as the text of its file, written to be read by a person comparing two versions of it: every part on a line
4
+ * of its own in a set order, one object to a line in the order of their ids with what each holds in a set order
5
+ * too, and the layers last. Moving one object changes one line, whatever was done before
6
+ *
7
+ * @beta
8
+ */
9
+ export declare function mapText(map: GameMap): string;
10
+ /**
11
+ * What a map file is called, without what comes after the first dot: the name of the map in small letters, with a
12
+ * dash for whatever is not a letter or a number. `The Pass!` is `the-pass`
13
+ *
14
+ * @beta
15
+ */
16
+ export declare function mapFileStem(name: string): string;
17
+ /**
18
+ * The names of what is on a map as TypeScript, for a game's code to use: `world.named<RoadNames>('gaet')` does not
19
+ * compile. The editor writes it next to the map (`road.names.ts` for `road.vgmap.json`), anew with every save
20
+ *
21
+ * @beta
22
+ */
23
+ export declare function mapNamesSource(stem: string, map: GameMap): string;
@@ -0,0 +1,95 @@
1
+ import type { PlayerId } from './entity';
2
+ import { type GameMap } from './map';
3
+ import type { Vec2 } from './math';
4
+ import type { Registry } from './registry';
5
+ /**
6
+ * A way on foot over a map: its length, and the points it goes through
7
+ *
8
+ * @beta
9
+ */
10
+ export interface Walk {
11
+ length: number;
12
+ points: Vec2[];
13
+ }
14
+ /**
15
+ * The way on foot between two points of a map, with what the checks count as in the way. Nothing when there is none
16
+ *
17
+ * @beta
18
+ */
19
+ export declare function walkBetween(map: GameMap, registry: Registry, from: Vec2, to: Vec2): Walk | undefined;
20
+ /**
21
+ * What one player's start has around it
22
+ *
23
+ * @beta
24
+ */
25
+ export interface StartMeasure {
26
+ player: PlayerId;
27
+ name: string;
28
+ /** The way on foot to the nearest mine, and how much it holds. Nothing without a mine they can walk to */
29
+ mine?: {
30
+ distance: number;
31
+ amount: number;
32
+ at: Vec2;
33
+ };
34
+ /** How many cells within `BUILD_REACH` of the start can be built on */
35
+ buildable: number;
36
+ /** Trees within `BUILD_REACH` of the start */
37
+ trees: number;
38
+ }
39
+ /**
40
+ * A number of a map a game measures of its own (`MapEditorDef.measure`): the length of the road, for a tower defense
41
+ *
42
+ * @beta
43
+ */
44
+ export interface GameMeasure {
45
+ name: string;
46
+ value: number | string;
47
+ }
48
+ /**
49
+ * What a map is like to play on, measured (see `measureMap`)
50
+ *
51
+ * @beta
52
+ */
53
+ export interface MapReport {
54
+ /** The way on foot between every two starts: how far a rush goes. Nothing for starts cut off from each other */
55
+ rushes: {
56
+ from: PlayerId;
57
+ to: PlayerId;
58
+ length?: number;
59
+ points?: Vec2[];
60
+ }[];
61
+ /** The narrowest place on the ways between the starts, and how wide it is */
62
+ narrowest?: {
63
+ width: number;
64
+ at: Vec2;
65
+ };
66
+ starts: StartMeasure[];
67
+ /** What each start has that another has more than `FAIR_MARGIN` more of: what is not fair */
68
+ unfair: string[];
69
+ game: GameMeasure[];
70
+ }
71
+ /**
72
+ * How far around a start counts as its ground, for building and trees
73
+ *
74
+ * @beta
75
+ */
76
+ export declare const BUILD_REACH = 16;
77
+ /**
78
+ * What a map is like to play on: the way on foot between every two starts, the narrowest place on those ways, and for
79
+ * each start the nearest mine and how much it holds, the ground around it that can be built on, and its trees; side
80
+ * by side, with what one start has much more of than another said. Then what the game measures of its own
81
+ *
82
+ * @beta
83
+ */
84
+ export declare function measureMap(map: GameMap, registry: Registry): MapReport;
85
+ /**
86
+ * Seconds a unit type takes over a way on foot, at the speed it starts with
87
+ *
88
+ * @beta
89
+ */
90
+ export declare const walkingTime: (registry: Registry, type: string, length: number) => number | undefined;
91
+ /** The cell of a footprint, for drawing where a mine stands */
92
+ export declare const footprintAt: (registry: Registry, type: string, at: Vec2) => {
93
+ x: number;
94
+ z: number;
95
+ };
@@ -0,0 +1,19 @@
1
+ import { type GameMap } from './map';
2
+ /**
3
+ * A merge of two versions of a map from the one they came from
4
+ *
5
+ * @beta
6
+ */
7
+ export interface MapMerge {
8
+ map: GameMap;
9
+ /** What both sides changed otherwise, in words: ours was kept for each */
10
+ conflicts: string[];
11
+ }
12
+ /**
13
+ * Merges two versions of a map from the one they came from: parts and things by their ids (those of its look too: its
14
+ * lights, effects, decals), the ground cell by cell. Never throws for what both changed: ours is kept there, and said
15
+ * (`conflicts`). Maps of different sizes are not merged (ours, and said)
16
+ *
17
+ * @beta
18
+ */
19
+ export declare function mergeMaps(base: GameMap, ours: GameMap, theirs: GameMap): MapMerge;
@@ -0,0 +1,82 @@
1
+ import type { PlayerId } from './entity';
2
+ import type { GameMap } from './map';
3
+ import type { MapProblem } from './mapFields';
4
+ import type { Message } from './messages';
5
+ import type { ObjectiveDef, ObjectiveState } from './objectives';
6
+ import type { GamePack } from './packs/pack';
7
+ import type { World } from './world';
8
+ /**
9
+ * The map objectives pack's id
10
+ *
11
+ * @beta
12
+ */
13
+ export declare const MAP_OBJECTIVES = "core.mapObjectives";
14
+ /**
15
+ * The key of the map's data its objectives are kept under (`GameMap.data.objectives`)
16
+ *
17
+ * @beta
18
+ */
19
+ export declare const MAP_OBJECTIVES_KEY = "objectives";
20
+ /**
21
+ * An objective a map gives, as it keeps it: an objective (`ObjectiveDef`: its id, its words, whether the mission needs
22
+ * it, more about it) and when it is given
23
+ *
24
+ * @beta
25
+ */
26
+ export interface MapObjective extends ObjectiveDef {
27
+ /**
28
+ * When it is given: as the game starts (`start`), to every player a person plays (`mapObjectivePlayers`), or when
29
+ * the rules say (`rule`: `giveMapObjective(world, id)`). Anything but `rule` is the start
30
+ */
31
+ at: 'start' | 'rule';
32
+ }
33
+ /**
34
+ * The objectives a map gives (`GameMap.data.objectives`), in the order it gives them: none for a map with none. What is
35
+ * kept there and is no objective (no id, no words) is left out, so that a file changed by hand breaks no rule that reads
36
+ * it; the map's checks say so (`mapObjectives`)
37
+ *
38
+ * @beta
39
+ */
40
+ export declare function mapObjectivesOf(map: {
41
+ readonly data: Readonly<Record<string, unknown>>;
42
+ }): MapObjective[];
43
+ /**
44
+ * Who is given a map's objective when the rules do not say (`giveMapObjective`): the map's players a person plays, not
45
+ * those it says the computer plays or nobody does (`MapPlayer.controller`), in the order of their ids
46
+ *
47
+ * @beta
48
+ */
49
+ export declare function mapObjectivePlayers(world: World): PlayerId[];
50
+ /**
51
+ * Gives players an objective of the map's, by its id (`MapObjective`): those given by a rule (`at: 'rule'`), when the
52
+ * rules say. To every player a person plays when `players` is left out (`mapObjectivePlayers`); a player who has it
53
+ * already keeps theirs. Its words' params and its progress go with it, as `world.objectives.add`. Throws for an id the
54
+ * map does not have: an id in the code that is not on the map is a mistake
55
+ *
56
+ * @beta
57
+ */
58
+ export declare function giveMapObjective(world: World, id: string, options?: {
59
+ players?: readonly PlayerId[];
60
+ params?: Message['params'];
61
+ progress?: {
62
+ value: number;
63
+ max: number;
64
+ };
65
+ }): ObjectiveState[];
66
+ /**
67
+ * What is wrong with a map's objectives (`GameMap.data.objectives`): one with no id or with another's, one with no
68
+ * words, a list that is not one. Each a click away in the Objectives panel
69
+ *
70
+ * @beta
71
+ */
72
+ export declare function checkMapObjectives(map: GameMap): MapProblem[];
73
+ /**
74
+ * Objectives as data on the map (campaign plan EQ3): a map's objectives (`MapObjective`, kept in `GameMap.data.objectives`,
75
+ * written by the editor's Objectives panel) given at the start to every player a person plays, as the world is made
76
+ * from the map; those given by a rule wait for the rules (`giveMapObjective(world, id)`). Done and failed as any
77
+ * objective is (`world.objectives.complete`, `fail`); a game that is won by them has `objectiveVictory` as its
78
+ * `victory`. The map's checks say what is wrong with them (`checkMapObjectives`)
79
+ *
80
+ * @beta
81
+ */
82
+ export declare function mapObjectives(): GamePack;
@@ -0,0 +1 @@
1
+ export {};
package/dist/math.d.ts ADDED
@@ -0,0 +1,44 @@
1
+ /**
2
+ * A point on the ground plane. The simulation is 2D; height always comes from the terrain.
3
+ *
4
+ * @beta
5
+ */
6
+ export interface Vec2 {
7
+ x: number;
8
+ z: number;
9
+ }
10
+ /** @beta */
11
+ export declare const vec2: (x?: number, z?: number) => Vec2;
12
+ /** @beta */
13
+ export declare const clamp: (v: number, min: number, max: number) => number;
14
+ /** @beta */
15
+ export declare const lerp: (a: number, b: number, t: number) => number;
16
+ /**
17
+ * 0 at `from` and before, 1 at `to` and after, eased in and out between: a shader's `smoothstep`
18
+ *
19
+ * @beta
20
+ */
21
+ export declare const smoothstep: (from: number, to: number, x: number) => number;
22
+ /**
23
+ * A number in 0..1 for two whole numbers, the same each time and in every engine (it is integer arithmetic)
24
+ *
25
+ * @beta
26
+ */
27
+ export declare function hashInts(a: number, b: number): number;
28
+ /** @beta */
29
+ export declare const distSq: (a: Vec2, b: Vec2) => number;
30
+ /** @beta */
31
+ export declare const dist: (a: Vec2, b: Vec2) => number;
32
+ /** @beta */
33
+ export declare const lerpAngle: (a: number, b: number, t: number) => number;
34
+ /**
35
+ * Axis aligned rectangle on the ground plane, described by its center and half sizes.
36
+ *
37
+ * @beta
38
+ */
39
+ export interface Rect {
40
+ x: number;
41
+ z: number;
42
+ hw: number;
43
+ hd: number;
44
+ }