@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,176 @@
1
+ import { type EntityId, type PlayerId } from './entity';
2
+ import type { AiReport } from './ai/report';
3
+ import type { Vec2 } from './math';
4
+ import type { World } from './world';
5
+ /**
6
+ * A part of what is inspected, as the inspector shows it
7
+ *
8
+ * @beta
9
+ */
10
+ export interface InspectedSection {
11
+ title: string;
12
+ /** What it holds, plain data. Entities in it are written `footman#12`, for the inspector to link to */
13
+ value: unknown;
14
+ /** Where it is kept, for `setInspected`. Left out for what is worked out, or not to be changed by hand, like stats */
15
+ path?: (string | number)[];
16
+ /** State of the game's own (a component), rather than the engine's */
17
+ own?: boolean;
18
+ }
19
+ /**
20
+ * What the inspector can look at: an entity, a player, or the world itself
21
+ *
22
+ * @beta
23
+ */
24
+ export type InspectTarget = {
25
+ entity: EntityId;
26
+ } | {
27
+ player: PlayerId;
28
+ } | {
29
+ world: true;
30
+ };
31
+ /**
32
+ * Something as the simulation has it, for the inspector
33
+ *
34
+ * @beta
35
+ */
36
+ export interface Inspection {
37
+ target: InspectTarget;
38
+ /** What it is called: `Footman #14`, a player's name, `World` */
39
+ title: string;
40
+ /** What else says what it is: type and owner, team */
41
+ about: string;
42
+ tick: number;
43
+ alive: boolean;
44
+ /** Where it is, for an entity */
45
+ at?: Vec2;
46
+ /** What is so of it that is not a number: hidden, asleep, scenery */
47
+ flags: string[];
48
+ sections: InspectedSection[];
49
+ /**
50
+ * What the computer that plays a player is thinking, where a brain does (`Brain.report`, with the seat's timing):
51
+ * what the debug panel's AI tab draws. A computer player of another kind is a section (`Computer player`)
52
+ */
53
+ ai?: AiReport;
54
+ }
55
+ /**
56
+ * Something as the simulation has it right now, or null when there is no such entity or player
57
+ *
58
+ * @beta
59
+ */
60
+ export declare function inspect(world: World, target: InspectTarget): Inspection | null;
61
+ /**
62
+ * An entity as the list of all of them shows it
63
+ *
64
+ * @beta
65
+ */
66
+ export interface EntityRow {
67
+ id: EntityId;
68
+ type: string;
69
+ name: string;
70
+ owner: PlayerId;
71
+ kind: string;
72
+ hp: number;
73
+ maxHp: number;
74
+ /** Type of what it is doing, null for nothing */
75
+ order: string | null;
76
+ scenery: boolean;
77
+ hidden: boolean;
78
+ }
79
+ /**
80
+ * A player as the list shows it
81
+ *
82
+ * @beta
83
+ */
84
+ export interface PlayerRow {
85
+ id: PlayerId;
86
+ name: string;
87
+ team: number;
88
+ neutral: boolean;
89
+ defeated: boolean;
90
+ }
91
+ /**
92
+ * Everything in the world, for the list of the debug tools: what is out of sight, hidden or scenery too
93
+ *
94
+ * @beta
95
+ */
96
+ export interface WorldListing {
97
+ tick: number;
98
+ players: PlayerRow[];
99
+ entities: EntityRow[];
100
+ }
101
+ /**
102
+ * Something that happened in the rules, as the event log keeps it
103
+ *
104
+ * @beta
105
+ */
106
+ export interface LoggedEvent {
107
+ /** In the order they were logged, for asking for what came after */
108
+ seq: number;
109
+ /** The tick it happened in */
110
+ tick: number;
111
+ kind: 'event' | 'hook';
112
+ /** The engine's name for it, or a game's id */
113
+ name: string;
114
+ /** One of the game's own, rather than the engine's */
115
+ own: boolean;
116
+ /** What it said, plain data. For a hook, what the first run of it in the tick was given */
117
+ detail?: unknown;
118
+ /** The listeners that ran on an event, or the handlers of a hook */
119
+ ran: string[];
120
+ /** How many times a hook ran in the tick */
121
+ count?: number;
122
+ }
123
+ /**
124
+ * What a world tells whoever follows it of the rules as they run, see `World.trace`
125
+ *
126
+ * @beta
127
+ */
128
+ export interface Trace {
129
+ /** A hook with handlers ran. `own`: a hook of the game's */
130
+ hook(name: string, handlers: readonly {
131
+ id: string;
132
+ }[], own: boolean, event: unknown): void;
133
+ /** A listener of the game is about to run, on the event going out */
134
+ listener(id: string): void;
135
+ }
136
+ /**
137
+ * The events and hooks of the last seconds of a world, the game's own among them, with the listeners and handlers
138
+ * that ran on them. Hooks run often (every target search asks one), so a hook is one line a tick, with how many times.
139
+ * Following costs a little: it is only on while `attach`ed
140
+ *
141
+ * @beta
142
+ */
143
+ export declare class EventLog implements Trace {
144
+ /** Seconds of it that are kept */
145
+ readonly seconds: number;
146
+ /** Lines kept at most, however short a time they took */
147
+ readonly max: number;
148
+ private readonly list;
149
+ private seq;
150
+ /** The hooks of the tick going on, by name */
151
+ private hooks;
152
+ private hooksAt;
153
+ /** The event going out, which listeners that run belong to */
154
+ private current;
155
+ private world;
156
+ private untap;
157
+ constructor(
158
+ /** Seconds of it that are kept */
159
+ seconds?: number,
160
+ /** Lines kept at most, however short a time they took */
161
+ max?: number);
162
+ /** Starts following a world */
163
+ attach(world: World): void;
164
+ /** Stops following it. What was logged stays */
165
+ detach(): void;
166
+ get attached(): boolean;
167
+ /** What was logged, oldest first. The same list, kept up to date: to read, not to keep */
168
+ get entries(): readonly LoggedEvent[];
169
+ clear(): void;
170
+ private event;
171
+ listener(id: string): void;
172
+ hook(name: string, handlers: readonly {
173
+ id: string;
174
+ }[], own: boolean, event: unknown): void;
175
+ private add;
176
+ }
@@ -0,0 +1,18 @@
1
+ import type { Entity, ItemInstance } from './entity';
2
+ import type { InventoryInfo } from './session/protocol';
3
+ /**
4
+ * The slots of what a unit carries (`UnitTypeDef.inventory`), null for an empty one: set as it is spawned (and as its
5
+ * type changes), for a type with slots. Sent to everyone who sees it as `InventoryInfo`: the items it carries, and to
6
+ * its owner and their allies the slots, for commands
7
+ *
8
+ * @beta
9
+ */
10
+ export declare const inventorySlots: import("./components").Component<(ItemInstance | null)[], InventoryInfo>;
11
+ /**
12
+ * The slots of what a unit carries, null for an empty one: none for a type that carries nothing (`inventorySlots`)
13
+ *
14
+ * @beta
15
+ */
16
+ export declare const slotsOf: (entity: Entity) => (ItemInstance | null)[] | undefined;
17
+ /** @beta */
18
+ export declare const freeSlot: (entity: Entity) => number;
@@ -0,0 +1,91 @@
1
+ import type { Entity, ItemInstance, Placed, StockState } from './entity';
2
+ import type { StockInfo } from './session/protocol';
3
+ import { type Vec2 } from './math';
4
+ import type { World } from './world';
5
+ /**
6
+ * An item lying on the ground
7
+ *
8
+ * @beta
9
+ */
10
+ export interface GroundItem {
11
+ id: number;
12
+ item: string;
13
+ charges: number;
14
+ x: number;
15
+ z: number;
16
+ }
17
+ /** @beta */
18
+ export declare function createItem(world: World, item: string, charges?: number): ItemInstance;
19
+ /**
20
+ * Puts an item into the first free slot. False when there is none
21
+ *
22
+ * @beta
23
+ */
24
+ export declare function giveItem(world: World, entity: Entity, instance: ItemInstance): boolean;
25
+ /** @beta */
26
+ export declare function takeItem(world: World, entity: Entity, instanceId: number): ItemInstance | undefined;
27
+ /** @beta */
28
+ export declare function findItem(entity: Entity, instanceId: number | undefined): ItemInstance | undefined;
29
+ /** @beta */
30
+ export declare function dropOnGround(world: World, instance: ItemInstance, at: Vec2): GroundItem;
31
+ /** @beta */
32
+ export declare function pickUp(world: World, entity: Entity, groundId: number): boolean;
33
+ /**
34
+ * One use of an item that has charges. The last one takes the item with it
35
+ *
36
+ * @beta
37
+ */
38
+ export declare function spendCharge(world: World, entity: Entity, instance: ItemInstance): void;
39
+ /** Part of its price an item is bought back for */
40
+ /**
41
+ * Whether someone stands close enough to a shop to trade with it. Anything with a place will do: an entity, or what a screen knows of one
42
+ *
43
+ * @beta
44
+ */
45
+ export declare const atShop: (entity: Placed, shop: Placed) => boolean;
46
+ /**
47
+ * What buying an item comes to for someone who carries these things: the items it is made of that are there are
48
+ * used up and taken off the price, and so are the parts of the ones that are not
49
+ *
50
+ * @beta
51
+ */
52
+ export declare function priceOf(registry: World['registry'], item: string, carried: readonly string[]): {
53
+ price: number;
54
+ uses: string[];
55
+ };
56
+ /**
57
+ * What a shop has of each of its wares (`UnitTypeDef.sells`): how many are left and the seconds until the next one.
58
+ * Set as the shop is spawned, counted down by the abilities system while the shop stands; filed in the index
59
+ * (`world.index.with(shopStock)`); sent to everyone who sees the shop as `StockInfo` (how far the next one is, 0..1, not
60
+ * the seconds), the delta comparing ware by ware
61
+ *
62
+ * @beta
63
+ */
64
+ export declare const shopStock: import("./components").Component<StockState[], StockInfo[]>;
65
+ /** The player's hero that is closest to a shop and has room for the item, or for anything when none is named, if one is close enough */
66
+ export declare function shopper(world: World, shop: Entity, player: number, item?: string): Entity | undefined;
67
+ /**
68
+ * Sells an item to a hero standing at the shop: the one that is named, or the closest one with room.
69
+ * Tells the player why when it cannot
70
+ *
71
+ * @beta
72
+ */
73
+ export declare function buy(world: World, shop: Entity, item: string, player: number, buyer?: Entity): boolean;
74
+ /**
75
+ * Whether a shop the player can trade with is close enough to the entity
76
+ *
77
+ * @beta
78
+ */
79
+ export declare function shopNear(world: World, entity: Entity): Entity | undefined;
80
+ /**
81
+ * Gives an item back at a shop nearby, for a part of its price. What has charges is worth as much as is left of it
82
+ *
83
+ * @beta
84
+ */
85
+ export declare function sell(world: World, entity: Entity, instanceId: number): boolean;
86
+ /** What a dead unit leaves behind: by its table of chances, or as its code decides */
87
+ export declare function dropLoot(world: World, entity: Entity, killer?: Entity): void;
88
+ /** An item picked up, to those who see who picked it */
89
+ export declare const toldPicked: import("./replication").ReplicatedEvent;
90
+ /** The items on the ground where the player sees (`Snapshot.items`) */
91
+ export declare const itemsPart: import("./replication").SnapshotPart<keyof import(".").Snapshot>;
@@ -0,0 +1,213 @@
1
+ import type { GamePack } from './packs/pack';
2
+ import type { Entity } from './entity';
3
+ import type { GameMap, MapPath } from './map';
4
+ import { type MapFieldDef, type MapProblem, type MapThing } from './mapFields';
5
+ import type { Vec2 } from './math';
6
+ import type { PlayerId } from './entity';
7
+ import type { System } from './registry';
8
+ import type { World } from './world';
9
+ /**
10
+ * The kind of thing a spawner is: where it is kept in the map's data, by this id
11
+ *
12
+ * @beta
13
+ */
14
+ export declare const LANE_SPAWNERS = "lanes.spawners";
15
+ /**
16
+ * A spawner as the editor offers it (a `MapKindDef` of `@v12-engine/client`): its tool, its fields, a ring at each, in
17
+ * the scene's `kinds`
18
+ *
19
+ * @beta
20
+ */
21
+ export declare const LANE_SPAWNER_KIND: {
22
+ id: string;
23
+ name: string;
24
+ plural: string;
25
+ hint: string;
26
+ icon: string;
27
+ color: [number, number, number];
28
+ fields: Omit<MapFieldDef, "for">[];
29
+ reach: number;
30
+ };
31
+ /**
32
+ * A lane, as the rules read it: the path, and its two ends, each with the spawner of the side whose waves start there
33
+ *
34
+ * @beta
35
+ */
36
+ export interface Lane {
37
+ /** The name of its path (`world.map.path(name)`), what orders that follow it are given */
38
+ path: string;
39
+ points: readonly Vec2[];
40
+ /** Its spawners, by the end of the lane they are at: the first point's, then the last's. Either is missing on a map not finished */
41
+ ends: [LaneEnd | undefined, LaneEnd | undefined];
42
+ }
43
+ /**
44
+ * One end of a lane: the spawner there, and whose
45
+ *
46
+ * @beta
47
+ */
48
+ export interface LaneEnd {
49
+ spawner: MapThing;
50
+ player: PlayerId;
51
+ at: Vec2;
52
+ }
53
+ /**
54
+ * The lanes of a map: every path a spawner is on, with what stands at each end
55
+ *
56
+ * @beta
57
+ */
58
+ export declare function mapLanes(map: {
59
+ paths: readonly MapPath[];
60
+ data: Record<string, unknown>;
61
+ }): Lane[];
62
+ /**
63
+ * The lanes of a world's map (`mapLanes`): what waves walk
64
+ *
65
+ * @beta
66
+ */
67
+ export declare const lanesOf: (world: World) => Lane[];
68
+ /**
69
+ * What is wrong with the lanes of a map, for the editor's checks (`MapEditorDef.check`): a spawner on no lane or away
70
+ * from its ends, a lane without a spawner at each end, or with the same side at both
71
+ *
72
+ * @beta
73
+ */
74
+ export declare function checkLanes(map: GameMap): MapProblem[];
75
+ /**
76
+ * A wave about to come out of a spawner: which of that spawner's it is (1 and up), the lane and the end it walks from,
77
+ * and whose. What `LanesOptions.wave` makes the units of
78
+ *
79
+ * @beta
80
+ */
81
+ export interface LaneWave {
82
+ number: number;
83
+ lane: Lane;
84
+ from: 0 | 1;
85
+ player: PlayerId;
86
+ }
87
+ /**
88
+ * What a game's lanes do (`withLanes`). Every part has the engine's own when left out
89
+ *
90
+ * @beta
91
+ */
92
+ export interface LanesOptions {
93
+ /**
94
+ * The unit types of the engine's waves, by role: three to five close, two or three that shoot, a siege now and then
95
+ * (`melee` and `ranged` are needed, `siege` is left out of the waves when it is). The engine names none: a game that
96
+ * gives no `wave` of its own says these
97
+ */
98
+ minions?: {
99
+ melee: string;
100
+ ranged: string;
101
+ siege?: string;
102
+ };
103
+ /** The unit types of a wave, in the order they come out: the engine's grow with time, from `minions` */
104
+ wave?: (world: World, wave: LaneWave) => string[];
105
+ /** Seconds from the start to the first wave, and between waves: 20 and 30 when left out */
106
+ firstWave?: number;
107
+ every?: number;
108
+ /**
109
+ * Where a minion goes once it is at the far end of its lane, fighting on the way: the nearest structure of another
110
+ * team to that end when left out (their core), the end itself when there is none
111
+ */
112
+ goal?: (world: World, minion: Entity, lane: Lane, from: 0 | 1) => Vec2 | undefined;
113
+ /**
114
+ * What the lane towers are: they hit minions before anything else, and a hero who hits a hero of their side within
115
+ * their reach before minions (as in a MOBA). Structures that attack, other than cores, when left out
116
+ */
117
+ towers?: (world: World, entity: Entity) => boolean;
118
+ /**
119
+ * What the cores are: the unit type's id, or a test of a unit. A side whose cores have all fallen has lost, and the
120
+ * last side with one wins. Said by the game (the engine names none); `false` keeps the game's own way of winning
121
+ * (`GameModule.victory`)
122
+ */
123
+ cores: string | ((world: World, entity: Entity) => boolean) | false;
124
+ /** Seconds a hero who hit a hero is the towers' first target for: 3 when left out */
125
+ towerAggro?: number;
126
+ /**
127
+ * Minions turn on a hero who hits a hero of their side near them (within `radius` cells of it), chase it for `chase`
128
+ * seconds at most and no further than `leash` cells from their lane, then go back to it the way they were going:
129
+ * 7, 2.5 and 10 when left out. `false` for minions that keep to their lane
130
+ */
131
+ minionAggro?: {
132
+ radius?: number;
133
+ chase?: number;
134
+ leash?: number;
135
+ } | false;
136
+ }
137
+ /**
138
+ * A minion of a lane: the lane it walks (its path's name), from which end. On every unit a wave brings
139
+ *
140
+ * @beta
141
+ */
142
+ export declare const laneMinion: import("./components").Component<{
143
+ lane: string;
144
+ from: 0 | 1;
145
+ chase?: {
146
+ target: number;
147
+ until: number;
148
+ };
149
+ }, {
150
+ lane: string;
151
+ from: 0 | 1;
152
+ chase?: {
153
+ target: number;
154
+ until: number;
155
+ };
156
+ }>;
157
+ /** How many waves each spawner has sent, by its id, and whether the waves were set going */
158
+ export declare const lanesState: import("./components").Component<{
159
+ started: boolean;
160
+ waves: Record<string, number>;
161
+ chasing?: number[];
162
+ }, {
163
+ started: boolean;
164
+ waves: Record<string, number>;
165
+ chasing?: number[];
166
+ }>;
167
+ /**
168
+ * The engine's waves: three close and two that shoot, one more close every fourth wave and one more that shoots every
169
+ * sixth, a siege every third wave (two from the twelfth). Of the types a game has
170
+ *
171
+ * @beta
172
+ */
173
+ export declare function defaultWave(world: World, wave: LaneWave, minions: NonNullable<LanesOptions['minions']>): string[];
174
+ /**
175
+ * Sends a spawner's next wave now, whatever its timer, as the game's lanes say (`LanesOptions`): for scripts, tests and debug tools. Its units come out by the
176
+ * spawner, walk the lane fighting what they meet (`attackPath`), then go for the goal at its far end. Gives back the
177
+ * units, none for a spawner on no lane
178
+ *
179
+ * @beta
180
+ */
181
+ export declare function sendWave(world: World, spawner: number, options: Partial<LanesOptions>): Entity[];
182
+ /**
183
+ * How many waves a spawner has sent
184
+ *
185
+ * @beta
186
+ */
187
+ export declare const wavesSent: (world: World, spawner: number) => number;
188
+ /**
189
+ * A game with lanes: its maps' lanes checked in the editor, and waves of minions sent along them from every spawner,
190
+ * the first `firstWave` seconds in and one every `every` seconds after, each from the `wave` of its number (see
191
+ * `LanesOptions`). What it adds goes with what the game has: its timers and components saved, its check after its own
192
+ *
193
+ * @beta
194
+ */
195
+ export declare function withLanes(options: LanesOptions): GamePack;
196
+ /**
197
+ * When a hero last hit a hero of another side, in seconds of the game's time: what the lane towers of the side it hit
198
+ * go for first, for a while (`LanesOptions.towerAggro`)
199
+ *
200
+ * @beta
201
+ */
202
+ export declare const heroStrike: import("./components").Component<{
203
+ at: number;
204
+ }, {
205
+ at: number;
206
+ }>;
207
+ /**
208
+ * The rule of a lanes game: a side whose cores have all fallen is out, and the last side with a core wins. A side
209
+ * takes part once it has had a core
210
+ *
211
+ * @beta
212
+ */
213
+ export declare function coreVictory(cores: (world: World, entity: Entity) => boolean): System;
package/dist/life.d.ts ADDED
@@ -0,0 +1,53 @@
1
+ import { type Entity } from './entity';
2
+ import type { DamageOptions, DeathReason, World } from './world';
3
+ /**
4
+ * How a world's entities are hurt, healed and die
5
+ *
6
+ * @beta
7
+ */
8
+ export declare class Life {
9
+ private readonly world;
10
+ /** Who died and is to be taken out of the world at the end of the tick (`World.step`) */
11
+ readonly dead: Entity[];
12
+ constructor(world: World);
13
+ /**
14
+ * Deals damage. In order:
15
+ * 1. the `beforeDamage` hook, which can change the amount or call it off;
16
+ * 2. armor or magic resist, then shields, take their part;
17
+ * 3. the rest comes off the target's health, and it dies when nothing is left (see `kill`);
18
+ * 4. the `afterDamage` hook, for what follows from a hit: life steal, effects on hit.
19
+ */
20
+ damage(target: Entity, amount: number, source?: Entity, options?: DamageOptions): void;
21
+ /** Gives health back, after the `beforeHeal` hook had its say. Returns how much of it was needed */
22
+ heal(target: Entity, amount: number, source?: Entity): number;
23
+ /**
24
+ * Kills an entity by the rules, not by damage: felled, cancelled, run out of time. `attack` says that an attack of
25
+ * the killer did it; `reason` why (`DeathReason`: `killed` when left out, or the game's own word, `sold`), for the
26
+ * hooks and the screen
27
+ */
28
+ kill(entity: Entity, killer?: Entity, attack?: boolean, reason?: DeathReason): void;
29
+ /**
30
+ * How anything dies. In order:
31
+ * 1. the `beforeDeath` hook, which can keep it alive;
32
+ * 2. its orders and production are called off;
33
+ * 3. the `death` hook, while it still stands where it was: experience, loot, bounty;
34
+ * 4. it leaves the world (a fallen hero waits out of it to be brought back);
35
+ * 5. the `afterDeath` hook, for what follows: effects of the killer on a kill.
36
+ */
37
+ private die;
38
+ /** Who is being killed right now: their `death` hooks are running. They take no damage, no healing, and die once */
39
+ private readonly dying;
40
+ /** Whether an entity is being killed right now: alive still, while its `death` hooks run, and past saving */
41
+ isDying(entity: Entity): boolean;
42
+ /** What follows the `death` hooks: the entity is gone from the world, and it is told */
43
+ private fall;
44
+ private detach;
45
+ }
46
+ /** A death, to those who see the dead: who killed it where they see the killer too (`SessionEvent` `death`) */
47
+ export declare const toldDeath: import("./replication").ReplicatedEvent;
48
+ /** A hit, to those who see who took it: who dealt it where they see them too */
49
+ export declare const toldDamage: import("./replication").ReplicatedEvent;
50
+ /** Healing, to those who see who was healed */
51
+ export declare const toldHeal: import("./replication").ReplicatedEvent;
52
+ /** A critical strike's number over who took it */
53
+ export declare const toldCrit: import("./replication").ReplicatedEvent;