@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.
- package/LICENSE +21 -0
- package/dist/abilities/buffs.d.ts +83 -0
- package/dist/abilities/castTold.d.ts +12 -0
- package/dist/abilities/charges.d.ts +28 -0
- package/dist/abilities/dispel.d.ts +9 -0
- package/dist/abilities/effectFields.d.ts +10 -0
- package/dist/abilities/effects/buff.d.ts +8 -0
- package/dist/abilities/effects/core.d.ts +1 -0
- package/dist/abilities/effects/damage.d.ts +1 -0
- package/dist/abilities/effects/heal.d.ts +2 -0
- package/dist/abilities/effects/missile.d.ts +1 -0
- package/dist/abilities/effects/moves.d.ts +11 -0
- package/dist/abilities/effects/passives.d.ts +15 -0
- package/dist/abilities/effects/sight.d.ts +4 -0
- package/dist/abilities/effects/spawn.d.ts +2 -0
- package/dist/abilities/effects/timed.d.ts +4 -0
- package/dist/abilities/effects/trade.d.ts +1 -0
- package/dist/abilities/effects.d.ts +122 -0
- package/dist/abilities/land.d.ts +21 -0
- package/dist/abilities/scaled.d.ts +21 -0
- package/dist/abilities/text.d.ts +113 -0
- package/dist/ai/area.d.ts +53 -0
- package/dist/ai/brain.d.ts +528 -0
- package/dist/ai/budget.d.ts +67 -0
- package/dist/ai/checks.d.ts +115 -0
- package/dist/ai/computer.d.ts +166 -0
- package/dist/ai/defence.d.ts +108 -0
- package/dist/ai/define.d.ts +21 -0
- package/dist/ai/economy.d.ts +129 -0
- package/dist/ai/geometry.d.ts +35 -0
- package/dist/ai/goals.d.ts +360 -0
- package/dist/ai/index.d.ts +38 -0
- package/dist/ai/knowledge.d.ts +418 -0
- package/dist/ai/lanes.d.ts +232 -0
- package/dist/ai/melee/build.d.ts +61 -0
- package/dist/ai/melee/goals.d.ts +299 -0
- package/dist/ai/melee/heroes.d.ts +27 -0
- package/dist/ai/melee/index.d.ts +14 -0
- package/dist/ai/melee/production.d.ts +8 -0
- package/dist/ai/melee/surrender.d.ts +24 -0
- package/dist/ai/micro.d.ts +278 -0
- package/dist/ai/mission.d.ts +195 -0
- package/dist/ai/missionRules.d.ts +18 -0
- package/dist/ai/module.d.ts +116 -0
- package/dist/ai/options.d.ts +61 -0
- package/dist/ai/plans/build.d.ts +280 -0
- package/dist/ai/plans/placement.d.ts +82 -0
- package/dist/ai/plans/plans.d.ts +105 -0
- package/dist/ai/plans/production.d.ts +210 -0
- package/dist/ai/plans/purse.d.ts +73 -0
- package/dist/ai/plans/tech.d.ts +37 -0
- package/dist/ai/profiles.d.ts +204 -0
- package/dist/ai/reach.d.ts +4 -0
- package/dist/ai/report.d.ts +203 -0
- package/dist/ai/roles.d.ts +133 -0
- package/dist/ai/rules.d.ts +288 -0
- package/dist/ai/scouting.d.ts +98 -0
- package/dist/ai/settings.d.ts +73 -0
- package/dist/ai/squads.d.ts +429 -0
- package/dist/ai/strength.d.ts +167 -0
- package/dist/ai/task.d.ts +118 -0
- package/dist/ai/tasks/attack.d.ts +7 -0
- package/dist/ai/tasks/capture.d.ts +21 -0
- package/dist/ai/tasks/creep.d.ts +16 -0
- package/dist/ai/tasks/defend.d.ts +29 -0
- package/dist/ai/tasks/drop.d.ts +34 -0
- package/dist/ai/tasks/escort.d.ts +16 -0
- package/dist/ai/tasks/gather.d.ts +23 -0
- package/dist/ai/tasks/harass.d.ts +7 -0
- package/dist/ai/tasks/hold.d.ts +20 -0
- package/dist/ai/tasks/index.d.ts +32 -0
- package/dist/ai/tasks/move.d.ts +19 -0
- package/dist/ai/tasks/patrol.d.ts +8 -0
- package/dist/ai/tasks/retreat.d.ts +20 -0
- package/dist/ai/tasks/scout.d.ts +29 -0
- package/dist/ai/tasks/shared.d.ts +74 -0
- package/dist/ai/team.d.ts +155 -0
- package/dist/ai/threat.d.ts +91 -0
- package/dist/ai/view.d.ts +366 -0
- package/dist/ai/waves.d.ts +126 -0
- package/dist/ai.js +6239 -0
- package/dist/ai.js.map +1 -0
- package/dist/aiTesting.d.ts +179 -0
- package/dist/areas.d.ts +149 -0
- package/dist/attacks.d.ts +66 -0
- package/dist/attributes.d.ts +66 -0
- package/dist/brain-BvVdUhX8.js +7659 -0
- package/dist/brain-BvVdUhX8.js.map +1 -0
- package/dist/builds-C6LfgvEU.js +460 -0
- package/dist/builds-C6LfgvEU.js.map +1 -0
- package/dist/bytes.d.ts +6 -0
- package/dist/camps.d.ts +95 -0
- package/dist/capture.d.ts +131 -0
- package/dist/cellLayers.d.ts +75 -0
- package/dist/cinematics.d.ts +194 -0
- package/dist/clock.d.ts +32 -0
- package/dist/commands.d.ts +235 -0
- package/dist/components.d.ts +184 -0
- package/dist/computers.d.ts +108 -0
- package/dist/concealment.d.ts +61 -0
- package/dist/coreComponents-syuh2fPG.js +5149 -0
- package/dist/coreComponents-syuh2fPG.js.map +1 -0
- package/dist/coreComponents.d.ts +1 -0
- package/dist/dashing.d.ts +8 -0
- package/dist/debug.d.ts +36 -0
- package/dist/debug.js +3 -0
- package/dist/debugCommands-CzjrSm66.js +14739 -0
- package/dist/debugCommands-CzjrSm66.js.map +1 -0
- package/dist/debugCommands.d.ts +213 -0
- package/dist/debugging.d.ts +10 -0
- package/dist/definitions.d.ts +43 -0
- package/dist/defs.d.ts +1162 -0
- package/dist/denying.d.ts +81 -0
- package/dist/destructibles.d.ts +27 -0
- package/dist/determinism-BCymQwiE.js +518 -0
- package/dist/determinism-BCymQwiE.js.map +1 -0
- package/dist/determinism.d.ts +121 -0
- package/dist/dialog.d.ts +94 -0
- package/dist/effectRefs.d.ts +16 -0
- package/dist/effects.d.ts +80 -0
- package/dist/endings.d.ts +22 -0
- package/dist/engagement.d.ts +108 -0
- package/dist/engineEvents.d.ts +710 -0
- package/dist/entity.d.ts +409 -0
- package/dist/entityIndex.d.ts +50 -0
- package/dist/errors.d.ts +85 -0
- package/dist/events.d.ts +97 -0
- package/dist/exactMath.d.ts +63 -0
- package/dist/features.d.ts +10 -0
- package/dist/fields.d.ts +114 -0
- package/dist/fixture.d.ts +17 -0
- package/dist/fog.d.ts +110 -0
- package/dist/formation.d.ts +111 -0
- package/dist/friendlyFire.d.ts +26 -0
- package/dist/game-DiJEN-Ks.js +5800 -0
- package/dist/game-DiJEN-Ks.js.map +1 -0
- package/dist/game.d.ts +501 -0
- package/dist/gameData.d.ts +325 -0
- package/dist/gameFiles.d.ts +26 -0
- package/dist/gates.d.ts +28 -0
- package/dist/generate.d.ts +403 -0
- package/dist/generateWorker.d.ts +39 -0
- package/dist/grid.d.ts +53 -0
- package/dist/ground.d.ts +127 -0
- package/dist/groundSpeed.d.ts +22 -0
- package/dist/hero.d.ts +177 -0
- package/dist/home.d.ts +14 -0
- package/dist/hooks.d.ts +780 -0
- package/dist/hotReload.d.ts +76 -0
- package/dist/ids.d.ts +26 -0
- package/dist/index.d.ts +227 -0
- package/dist/index.js +4701 -0
- package/dist/index.js.map +1 -0
- package/dist/inspect-D9dWHmZ0.js +491 -0
- package/dist/inspect-D9dWHmZ0.js.map +1 -0
- package/dist/inspect.d.ts +176 -0
- package/dist/inventory.d.ts +18 -0
- package/dist/items.d.ts +91 -0
- package/dist/lanes.d.ts +213 -0
- package/dist/life.d.ts +53 -0
- package/dist/local-Dkovq42k.js +1379 -0
- package/dist/local-Dkovq42k.js.map +1 -0
- package/dist/log.d.ts +140 -0
- package/dist/manaBurn.d.ts +39 -0
- package/dist/map/file.d.ts +114 -0
- package/dist/map/images.d.ts +18 -0
- package/dist/map/look.d.ts +47 -0
- package/dist/map/pathProfile.d.ts +13 -0
- package/dist/map/resize.d.ts +54 -0
- package/dist/map/schema.d.ts +10 -0
- package/dist/map/terrain.d.ts +32 -0
- package/dist/map/types.d.ts +613 -0
- package/dist/map.d.ts +7 -0
- package/dist/mapCheck/cells.d.ts +19 -0
- package/dist/mapCheck/rule.d.ts +30 -0
- package/dist/mapCheck/rules/names.d.ts +3 -0
- package/dist/mapCheck/rules/objects.d.ts +3 -0
- package/dist/mapCheck/rules/paths.d.ts +3 -0
- package/dist/mapCheck/rules/players.d.ts +3 -0
- package/dist/mapCheck/rules/races.d.ts +3 -0
- package/dist/mapCheck/rules/random.d.ts +3 -0
- package/dist/mapCheck/rules/regions.d.ts +3 -0
- package/dist/mapCheck/rules/targets.d.ts +3 -0
- package/dist/mapCheck/rules/walking.d.ts +3 -0
- package/dist/mapCheck.d.ts +23 -0
- package/dist/mapFields.d.ts +364 -0
- package/dist/mapFile.d.ts +23 -0
- package/dist/mapMeasure.d.ts +95 -0
- package/dist/mapMerge.d.ts +19 -0
- package/dist/mapObjectives.d.ts +82 -0
- package/dist/mapObjects.d.ts +1 -0
- package/dist/math.d.ts +44 -0
- package/dist/messages.d.ts +150 -0
- package/dist/missionRules-C-bGxm0Q.js +523 -0
- package/dist/missionRules-C-bGxm0Q.js.map +1 -0
- package/dist/missionRules.d.ts +179 -0
- package/dist/mods.d.ts +146 -0
- package/dist/names.d.ts +93 -0
- package/dist/navigation/agentParams.d.ts +4 -0
- package/dist/navigation/air.d.ts +89 -0
- package/dist/navigation/builds.d.ts +140 -0
- package/dist/navigation/groundAreas.d.ts +23 -0
- package/dist/navigation/navigation.d.ts +127 -0
- package/dist/navigation/recast.d.ts +214 -0
- package/dist/navigation/sidePaths.d.ts +69 -0
- package/dist/navigation/sized.d.ts +1 -0
- package/dist/navigation-worker.js +11 -0
- package/dist/navigation-worker.js.map +1 -0
- package/dist/nearest.d.ts +8 -0
- package/dist/noise.d.ts +12 -0
- package/dist/objectives.d.ts +93 -0
- package/dist/orders/basic.d.ts +96 -0
- package/dist/orders/build.d.ts +91 -0
- package/dist/orders/cast.d.ts +105 -0
- package/dist/orders/facts.d.ts +14 -0
- package/dist/orders/harvest.d.ts +94 -0
- package/dist/orders/idle.d.ts +7 -0
- package/dist/orders/items.d.ts +14 -0
- package/dist/orders/queue.d.ts +24 -0
- package/dist/pack.schema.json +6621 -0
- package/dist/packs/director/index.d.ts +81 -0
- package/dist/packs/heroes/campaign.d.ts +137 -0
- package/dist/packs/heroes/carry.d.ts +59 -0
- package/dist/packs/heroes/commands.d.ts +6 -0
- package/dist/packs/heroes/hire.d.ts +9 -0
- package/dist/packs/heroes/index.d.ts +12 -0
- package/dist/packs/heroes/making.d.ts +16 -0
- package/dist/packs/heroes/respawn.d.ts +42 -0
- package/dist/packs/moba/index.d.ts +34 -0
- package/dist/packs/pack.d.ts +84 -0
- package/dist/packs-g5thvmGn.js +3199 -0
- package/dist/packs-g5thvmGn.js.map +1 -0
- package/dist/packs.d.ts +84 -0
- package/dist/paths.d.ts +51 -0
- package/dist/plain.d.ts +17 -0
- package/dist/player.d.ts +117 -0
- package/dist/portals.d.ts +66 -0
- package/dist/prefabs.d.ts +139 -0
- package/dist/presetBuildings.d.ts +52 -0
- package/dist/presetGround.d.ts +22 -0
- package/dist/profiles-B3NS9jwk.js +335 -0
- package/dist/profiles-B3NS9jwk.js.map +1 -0
- package/dist/races.d.ts +136 -0
- package/dist/randomGroups.d.ts +2 -0
- package/dist/registry.d.ts +464 -0
- package/dist/remains.d.ts +119 -0
- package/dist/replication.d.ts +103 -0
- package/dist/rng.d.ts +17 -0
- package/dist/rules.d.ts +395 -0
- package/dist/rulesCheck.d.ts +37 -0
- package/dist/runes.d.ts +41 -0
- package/dist/save.d.ts +277 -0
- package/dist/scenario.d.ts +56 -0
- package/dist/scheduler.d.ts +67 -0
- package/dist/score.d.ts +306 -0
- package/dist/sequences.d.ts +132 -0
- package/dist/server/doorman.d.ts +21 -0
- package/dist/server/gameServer.d.ts +346 -0
- package/dist/server/index.d.ts +24 -0
- package/dist/server/lobby.d.ts +1 -0
- package/dist/server/log.d.ts +13 -0
- package/dist/server/match.d.ts +24 -0
- package/dist/server/mode.d.ts +168 -0
- package/dist/server/navigation-worker.d.ts +1 -0
- package/dist/server/navigation.d.ts +11 -0
- package/dist/server/ops.d.ts +78 -0
- package/dist/server/packs.d.ts +15 -0
- package/dist/server/ratings.d.ts +62 -0
- package/dist/server/relay.d.ts +34 -0
- package/dist/server/rooms.d.ts +162 -0
- package/dist/server/seat.d.ts +2 -0
- package/dist/server/seatSettings.d.ts +15 -0
- package/dist/server/secret.d.ts +5 -0
- package/dist/server/start.d.ts +54 -0
- package/dist/server/websocket.d.ts +74 -0
- package/dist/server.js +2861 -0
- package/dist/server.js.map +1 -0
- package/dist/session/can.d.ts +20 -0
- package/dist/session/commandReplay.d.ts +92 -0
- package/dist/session/debug.d.ts +65 -0
- package/dist/session/delay.d.ts +15 -0
- package/dist/session/delta.d.ts +98 -0
- package/dist/session/entityState.d.ts +1 -0
- package/dist/session/local.d.ts +214 -0
- package/dist/session/memory.d.ts +27 -0
- package/dist/session/protocol.d.ts +1155 -0
- package/dist/session/remote.d.ts +530 -0
- package/dist/session/replay.d.ts +114 -0
- package/dist/session/seed.d.ts +7 -0
- package/dist/session/share.d.ts +78 -0
- package/dist/session/socket.d.ts +8 -0
- package/dist/session/wire.d.ts +153 -0
- package/dist/session/worker.d.ts +227 -0
- package/dist/shared.d.ts +171 -0
- package/dist/sides.d.ts +75 -0
- package/dist/sight.d.ts +27 -0
- package/dist/simulate-oXBiw1Ff.js +167 -0
- package/dist/simulate-oXBiw1Ff.js.map +1 -0
- package/dist/simulate-worker.d.ts +1 -0
- package/dist/simulate-worker.js +28 -0
- package/dist/simulate-worker.js.map +1 -0
- package/dist/simulate.d.ts +154 -0
- package/dist/smart.d.ts +9 -0
- package/dist/spatial.d.ts +62 -0
- package/dist/spawning.d.ts +33 -0
- package/dist/stances.d.ts +76 -0
- package/dist/start.d.ts +71 -0
- package/dist/stats.d.ts +122 -0
- package/dist/summons.d.ts +63 -0
- package/dist/systems/abilities.d.ts +3 -0
- package/dist/systems/combat.d.ts +71 -0
- package/dist/systems/combatTold.d.ts +14 -0
- package/dist/systems/construction.d.ts +34 -0
- package/dist/systems/economy.d.ts +21 -0
- package/dist/systems/fog.d.ts +19 -0
- package/dist/systems/life.d.ts +3 -0
- package/dist/systems/movement.d.ts +105 -0
- package/dist/systems/orders.d.ts +7 -0
- package/dist/systems/production.d.ts +49 -0
- package/dist/systems/productionQueue.d.ts +40 -0
- package/dist/systems/victory.d.ts +14 -0
- package/dist/talk.d.ts +65 -0
- package/dist/tech.d.ts +62 -0
- package/dist/techTree.d.ts +38 -0
- package/dist/terrain.d.ts +173 -0
- package/dist/terrainSave.d.ts +29 -0
- package/dist/testing.d.ts +58 -0
- package/dist/testing.js +822 -0
- package/dist/testing.js.map +1 -0
- package/dist/tiles.d.ts +34 -0
- package/dist/timers.d.ts +146 -0
- package/dist/tomes.d.ts +48 -0
- package/dist/trade.d.ts +28 -0
- package/dist/transport.d.ts +76 -0
- package/dist/tunables.d.ts +45 -0
- package/dist/upkeep.d.ts +16 -0
- package/dist/veterancy.d.ts +80 -0
- package/dist/walls.d.ts +86 -0
- package/dist/world.d.ts +1118 -0
- package/package.json +80 -5
- package/README.md +0 -3
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import type { GamePack } from './packs/pack';
|
|
2
|
+
import type { PlayerId } from './entity';
|
|
3
|
+
import type { MapFieldDef } from './mapFields';
|
|
4
|
+
import type { Vec2 } from './math';
|
|
5
|
+
import type { World } from './world';
|
|
6
|
+
/**
|
|
7
|
+
* What a point does while two sides stand in it: nothing moves (`pause`), what was gained is lost (`reset`), or the
|
|
8
|
+
* larger side takes it as if alone (`majority`; a tie pauses)
|
|
9
|
+
*
|
|
10
|
+
* @beta
|
|
11
|
+
*/
|
|
12
|
+
export type Contested = 'pause' | 'reset' | 'majority';
|
|
13
|
+
/**
|
|
14
|
+
* A capture point given in code (`withCapture`'s `points`); one placed on the map says the same with its fields
|
|
15
|
+
*
|
|
16
|
+
* @beta
|
|
17
|
+
*/
|
|
18
|
+
export interface CapturePoint {
|
|
19
|
+
/** Unique among the game's points: what the events name it by, and `capturePoint` */
|
|
20
|
+
id: string;
|
|
21
|
+
name?: string;
|
|
22
|
+
at: Vec2;
|
|
23
|
+
/** How far around its middle counts, in cells: 4 when left out */
|
|
24
|
+
radius?: number;
|
|
25
|
+
/** Seconds a side alone in it takes to make it its own: 10 when left out */
|
|
26
|
+
time?: number;
|
|
27
|
+
/** What it does while two sides stand in it: `pause` when left out */
|
|
28
|
+
contested?: Contested;
|
|
29
|
+
/** Whose it is as the game starts: nobody's when left out */
|
|
30
|
+
owner?: PlayerId;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* A capture point as the world keeps it: where it is, how it is taken, whose it is, and who is taking it now (a team)
|
|
34
|
+
* and how far they have got (0 to 1)
|
|
35
|
+
*
|
|
36
|
+
* @beta
|
|
37
|
+
*/
|
|
38
|
+
export interface CaptureState {
|
|
39
|
+
id: string;
|
|
40
|
+
name?: string;
|
|
41
|
+
x: number;
|
|
42
|
+
z: number;
|
|
43
|
+
radius: number;
|
|
44
|
+
time: number;
|
|
45
|
+
contested: Contested;
|
|
46
|
+
owner: PlayerId | null;
|
|
47
|
+
by: number | null;
|
|
48
|
+
progress: number;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* The kind of thing on the map a capture point is placed as (the editor's `captureKind`)
|
|
52
|
+
*
|
|
53
|
+
* @beta
|
|
54
|
+
*/
|
|
55
|
+
export declare const CAPTURE_KIND = "capture";
|
|
56
|
+
/**
|
|
57
|
+
* The fields of a capture point on the map, as the editor's kind offers them and the rules read them: its reach, its
|
|
58
|
+
* time, what it does contested, and whose it is at the start
|
|
59
|
+
*
|
|
60
|
+
* @beta
|
|
61
|
+
*/
|
|
62
|
+
export declare const CAPTURE_FIELDS: readonly Omit<MapFieldDef, 'for'>[];
|
|
63
|
+
/**
|
|
64
|
+
* The capture points of the world, by id: whose each is and who is taking it. Kept in a save; in the game's report
|
|
65
|
+
* as `captures` (a list), for the HUD and the computer
|
|
66
|
+
*
|
|
67
|
+
* @beta
|
|
68
|
+
*/
|
|
69
|
+
export declare const captures: import("./components").Component<Record<string, CaptureState>, Record<string, CaptureState>>;
|
|
70
|
+
/** Whether the points were set up from the code's list and the map: once a world, kept in a save */
|
|
71
|
+
export declare const ready: import("./components").Component<boolean, boolean>;
|
|
72
|
+
/**
|
|
73
|
+
* A point changed hands: whose it is now (nobody's for one let go by code), and whose it was
|
|
74
|
+
*
|
|
75
|
+
* @beta
|
|
76
|
+
*/
|
|
77
|
+
export declare const captured: import("./events").EventKey<{
|
|
78
|
+
id: string;
|
|
79
|
+
owner: PlayerId | null;
|
|
80
|
+
from: PlayerId | null;
|
|
81
|
+
}>;
|
|
82
|
+
/**
|
|
83
|
+
* A side (a team) began taking a point, or none is any more
|
|
84
|
+
*
|
|
85
|
+
* @beta
|
|
86
|
+
*/
|
|
87
|
+
export declare const capturing: import("./events").EventKey<{
|
|
88
|
+
id: string;
|
|
89
|
+
by: number | null;
|
|
90
|
+
}>;
|
|
91
|
+
/**
|
|
92
|
+
* The capture points of a world, as they stand
|
|
93
|
+
*
|
|
94
|
+
* @beta
|
|
95
|
+
*/
|
|
96
|
+
export declare const capturesOf: (world: World) => CaptureState[];
|
|
97
|
+
/**
|
|
98
|
+
* A point by id, or nothing for an id the world has not got
|
|
99
|
+
*
|
|
100
|
+
* @beta
|
|
101
|
+
*/
|
|
102
|
+
export declare const captureOf: (world: World, id: string) => CaptureState | undefined;
|
|
103
|
+
/**
|
|
104
|
+
* Gives a point to a player, or to nobody, from the rules: its progress forgotten, and `captured` said
|
|
105
|
+
*
|
|
106
|
+
* @beta
|
|
107
|
+
*/
|
|
108
|
+
export declare function capturePoint(world: World, id: string, owner: PlayerId | null): boolean;
|
|
109
|
+
/**
|
|
110
|
+
* What a game turns capture points on with (`withCapture`)
|
|
111
|
+
*
|
|
112
|
+
* @beta
|
|
113
|
+
*/
|
|
114
|
+
export interface CaptureOptions {
|
|
115
|
+
/** Points given in code, beside what the map places */
|
|
116
|
+
points?: readonly CapturePoint[];
|
|
117
|
+
/** Ticks between two counts of who stands where: 3 when left out */
|
|
118
|
+
every?: number;
|
|
119
|
+
/** The kind of thing on the map a point is placed as: `capture` when left out */
|
|
120
|
+
kind?: string;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* A game with capture points: the points of `options.points` and of the map (things of the `capture` kind, which the
|
|
124
|
+
* editor places with the client's `captureKind`), each an area, counted every few ticks; whose each is and who is
|
|
125
|
+
* taking it in the world (`captures`, `capturesOf`) and in the game's report (`captures`); `captured` and
|
|
126
|
+
* `capturing` as they change; `capturePoint` for the rules' own say. Units count, alive and in sight of nobody in
|
|
127
|
+
* particular; buildings, scenery and the neutral player's do not
|
|
128
|
+
*
|
|
129
|
+
* @beta
|
|
130
|
+
*/
|
|
131
|
+
export declare function withCapture(options?: CaptureOptions): GamePack;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { type AreaShape } from './areas';
|
|
2
|
+
import type { Terrain } from './terrain';
|
|
3
|
+
import type { World } from './world';
|
|
4
|
+
/**
|
|
5
|
+
* A layer of cells a game paints its maps with, for its rules to read: where the bushes are, what burns, where a
|
|
6
|
+
* lane runs. A value per cell (0 to 255, 0 being none), kept with the map (`GameMap.cells`), in the world's ground
|
|
7
|
+
* (`Terrain.cells`, read with `terrain.cellAt`), its saves and what each player is sent. The rules change it while
|
|
8
|
+
* the game runs with `world.setCells`: the players who see a cell are told at once, the others as it comes into their
|
|
9
|
+
* sight (`TeamMemory.cells`), so a change in the dark is not given away. The editor paints the layers a game lists
|
|
10
|
+
* (`GameModule.cellLayers`), with the values it names
|
|
11
|
+
*
|
|
12
|
+
* @beta
|
|
13
|
+
*/
|
|
14
|
+
export interface CellLayerDef {
|
|
15
|
+
/** Its key in `Terrain.cells` and in the map's file */
|
|
16
|
+
id: string;
|
|
17
|
+
/** What the editor calls it */
|
|
18
|
+
name: string;
|
|
19
|
+
/** What it is for, for the editor's tooltip */
|
|
20
|
+
description?: string;
|
|
21
|
+
/** The colour the editor shows it in, 0 to 1 each */
|
|
22
|
+
color?: [number, number, number];
|
|
23
|
+
/**
|
|
24
|
+
* The values the editor paints with, named: `[{ value: 1, name: 'Bush' }]`. One value, 1, named after the layer when
|
|
25
|
+
* left out: a layer of cells that are or are not
|
|
26
|
+
*/
|
|
27
|
+
values?: {
|
|
28
|
+
value: number;
|
|
29
|
+
name: string;
|
|
30
|
+
color?: [number, number, number];
|
|
31
|
+
}[];
|
|
32
|
+
/**
|
|
33
|
+
* How fast one on foot goes over a cell of the layer that is not 0, as a multiplier of its speed: a swamp at 0.5. 1
|
|
34
|
+
* when left out; a cell of several such layers is slowed by each (`groundSpeedOfCell`)
|
|
35
|
+
*/
|
|
36
|
+
speed?: number;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Typed help for writing a layer of cells
|
|
40
|
+
*
|
|
41
|
+
* @beta
|
|
42
|
+
*/
|
|
43
|
+
export declare const defineCellLayer: (def: CellLayerDef) => CellLayerDef;
|
|
44
|
+
/**
|
|
45
|
+
* The values a layer is painted with, as the editor offers them: its own, or 1, named after the layer
|
|
46
|
+
*
|
|
47
|
+
* @beta
|
|
48
|
+
*/
|
|
49
|
+
export declare const cellLayerValues: (def: CellLayerDef) => NonNullable<CellLayerDef['values']>;
|
|
50
|
+
/**
|
|
51
|
+
* The cells of a terrain in a shape, as indices into its layers: the cells whose middle is in it
|
|
52
|
+
*
|
|
53
|
+
* @beta
|
|
54
|
+
*/
|
|
55
|
+
export declare function cellsIn(terrain: Pick<Terrain, 'width' | 'depth'>, shape: AreaShape): number[];
|
|
56
|
+
/**
|
|
57
|
+
* Cells of a layer the rules set (`world.setCells`), each with what it was: what each team that does not see a cell
|
|
58
|
+
* keeps of it as it last knew it (`TeamMemory.cells`), to be told when it comes into sight. A cell set back to what the
|
|
59
|
+
* team knows is nothing to tell; one the team sees is told now
|
|
60
|
+
*/
|
|
61
|
+
export declare function rememberUnseenCells(world: World, layer: string, cells: readonly number[], was: readonly number[], value: number): void;
|
|
62
|
+
/**
|
|
63
|
+
* The cells changed out of a team's sight that are in it now (`TeamMemory.cells`), told to the team as they are now
|
|
64
|
+
* (`cellsSeen`) and forgotten: after the fog is worked out again (`fogSystem`)
|
|
65
|
+
*/
|
|
66
|
+
export declare function tellCellsInSight(world: World): void;
|
|
67
|
+
/**
|
|
68
|
+
* The world's ground as a team knows it: its layers' cells as the team last saw those changed out of its sight
|
|
69
|
+
* (`TeamMemory.cells`). The ground itself where the team knows all of it, or for an observer (no team)
|
|
70
|
+
*/
|
|
71
|
+
export declare function groundKnownTo(world: World, team: number | undefined): Terrain;
|
|
72
|
+
/** A layer's cells changed (`world.setCells`): to those who see them. The others are told as they come into sight (`toldCellsSeen`) */
|
|
73
|
+
export declare const toldCells: import("./replication").ReplicatedEvent;
|
|
74
|
+
/** Cells changed out of a team's sight came into it (`tellCellsInSight`): to the team, as they are now. An observer was told already */
|
|
75
|
+
export declare const toldCellsSeen: import("./replication").ReplicatedEvent;
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import type { Audience } from './dialog';
|
|
2
|
+
import type { PlayerId } from './entity';
|
|
3
|
+
import { type Step } from './sequences';
|
|
4
|
+
import type { World } from './world';
|
|
5
|
+
/**
|
|
6
|
+
* Cinematics are the screen's: the camera, the HUD making way, the player's hands off. What they are is in a game's
|
|
7
|
+
* view, by id (`GameView.cinematics.defs`). The rules say when one plays, so that it comes at the moment of the game it is
|
|
8
|
+
* about (the start of the mission, a boss coming, the last wave beaten), the same moment for everyone, and a save
|
|
9
|
+
* knows it was played: `playCinematic` now, or `cinematic` as a step of a sequence.
|
|
10
|
+
*
|
|
11
|
+
* The rules and the screen talk both ways. The rules cue a cinematic playing (`cueCinematic`: the gate is open, go on)
|
|
12
|
+
* and a script or the data waits for the cue (`cut.untilCue`, a hook `cue:<name>`). The screen tells the rules when one
|
|
13
|
+
* they played is over, and how (the `cinematic` command, as the player who saw it): the engine says so as
|
|
14
|
+
* `cinematicEnded`, which a sequence waits for (`waitFor(cinematicEndedEvent)`, or `cinematic(id, { wait: 'ended' })`).
|
|
15
|
+
* Being a command, it is in a replay, so what a story does after a cinematic is the same on every screen and every
|
|
16
|
+
* time; the screen's cinematic is not in a replay, as screens are not
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* A cinematic the rules play, as the engine's `cinematic` event carries it to the screens
|
|
20
|
+
*
|
|
21
|
+
* @beta
|
|
22
|
+
*/
|
|
23
|
+
export interface CinematicCue {
|
|
24
|
+
/** Which of the view's cinematics */
|
|
25
|
+
id: string;
|
|
26
|
+
/** Who sees it. Everyone when left out */
|
|
27
|
+
to?: PlayerId[];
|
|
28
|
+
/**
|
|
29
|
+
* The game waits while it plays. Only where the simulation runs on the player's machine (single player): a screen
|
|
30
|
+
* whose game runs elsewhere plays it with the game going on, as a server does not stop for one player
|
|
31
|
+
*/
|
|
32
|
+
hold: boolean;
|
|
33
|
+
/** The player may skip it */
|
|
34
|
+
skippable: boolean;
|
|
35
|
+
/** What the rules hand the cinematic: the road of this map to fly down. Plain data, as it goes to every screen */
|
|
36
|
+
params?: Record<string, unknown>;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* How a cinematic the rules played ended on a player's screen: played to its end, skipped, stopped (the game left, code
|
|
40
|
+
* stopped it), made way for another, or never played (one already playing would not make way)
|
|
41
|
+
*
|
|
42
|
+
* @beta
|
|
43
|
+
*/
|
|
44
|
+
export type CinematicOutcome = 'ended' | 'skipped' | 'stopped' | 'replaced' | 'ignored';
|
|
45
|
+
/** The outcomes a screen may report, for the command's check */
|
|
46
|
+
export declare const CINEMATIC_OUTCOMES: readonly ['ended', 'skipped', 'stopped', 'replaced', 'ignored'];
|
|
47
|
+
/**
|
|
48
|
+
* A cue the rules send to the cinematic playing on some screens (`cueCinematic`), as the engine's `cinematicCued` event
|
|
49
|
+
* carries it
|
|
50
|
+
*
|
|
51
|
+
* @beta
|
|
52
|
+
*/
|
|
53
|
+
export interface CinematicCueSent {
|
|
54
|
+
/** Its name, as the cinematic waits for it (`cut.untilCue('gate')`, a hook `cue:gate`) */
|
|
55
|
+
cue: string;
|
|
56
|
+
/** Who it goes to. Everyone when left out */
|
|
57
|
+
to?: PlayerId[];
|
|
58
|
+
/** What it carries to the cinematic. Plain data */
|
|
59
|
+
params?: Record<string, unknown>;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* A cinematic the rules played is over on a player's screen (the engine's `cinematicEnded` event), as that player's
|
|
63
|
+
* screen said with the `cinematic` command
|
|
64
|
+
*
|
|
65
|
+
* @beta
|
|
66
|
+
*/
|
|
67
|
+
export interface CinematicEnded {
|
|
68
|
+
/** Whose screen it ended on */
|
|
69
|
+
player: PlayerId;
|
|
70
|
+
/** Which of the view's cinematics */
|
|
71
|
+
cinematic: string;
|
|
72
|
+
/** How it ended there */
|
|
73
|
+
outcome: CinematicOutcome;
|
|
74
|
+
}
|
|
75
|
+
/** @beta */
|
|
76
|
+
export interface CinematicOptions {
|
|
77
|
+
/** Who sees it: a player, some, or everyone. Everyone when left out */
|
|
78
|
+
to?: Audience;
|
|
79
|
+
/** The game waits while it plays, in single player. False when left out */
|
|
80
|
+
hold?: boolean;
|
|
81
|
+
/** The player may skip it. True when left out */
|
|
82
|
+
skippable?: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* What the cinematic is handed (`Cinematic` is given it): what the rules know and the screen does not, like the
|
|
85
|
+
* road of the map being played. Plain data
|
|
86
|
+
*/
|
|
87
|
+
params?: Record<string, unknown>;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Plays one of the view's cinematics on the screens of the players it is for, now
|
|
91
|
+
*
|
|
92
|
+
* @beta
|
|
93
|
+
*/
|
|
94
|
+
export declare function playCinematic(world: World, id: string, options?: CinematicOptions): void;
|
|
95
|
+
/**
|
|
96
|
+
* Cues the cinematic playing on the screens of the players it is for (everyone when left out): one waiting for it
|
|
97
|
+
* (`cut.untilCue(name)`) goes on, and the view's hooks of it (`cue:<name>`) run. Nothing happens where none plays, or
|
|
98
|
+
* the one playing does not listen for it. `params` is plain data the cue carries
|
|
99
|
+
*
|
|
100
|
+
* @beta
|
|
101
|
+
*/
|
|
102
|
+
export declare function cueCinematic(world: World, cue: string, options?: {
|
|
103
|
+
to?: Audience;
|
|
104
|
+
params?: Record<string, unknown>;
|
|
105
|
+
}): void;
|
|
106
|
+
/**
|
|
107
|
+
* A step of a sequence that cues the cinematic playing (see `cueCinematic`): `[wait(4), cinematicCue('gateOpen')]`
|
|
108
|
+
*
|
|
109
|
+
* @beta
|
|
110
|
+
*/
|
|
111
|
+
export declare const cinematicCue: <D = undefined>(cue: string, options?: {
|
|
112
|
+
to?: Audience;
|
|
113
|
+
params?: Record<string, unknown>;
|
|
114
|
+
}) => Step<D>;
|
|
115
|
+
/**
|
|
116
|
+
* What a sequence waits for after a cinematic it played: its end for the player it was for (`ended`), the first of the
|
|
117
|
+
* players' ends (`any`), or every player's (`all`). `ended` for a cinematic of several players is `all`
|
|
118
|
+
*
|
|
119
|
+
* @beta
|
|
120
|
+
*/
|
|
121
|
+
export type CinematicWait = 'ended' | 'any' | 'all';
|
|
122
|
+
/** The sequences waiting for a cinematic to end on players' screens: in the world, so that a save keeps the count */
|
|
123
|
+
export declare const waits: import("./components").Component<{
|
|
124
|
+
list: {
|
|
125
|
+
run: number;
|
|
126
|
+
cinematic: string;
|
|
127
|
+
waiting: PlayerId[];
|
|
128
|
+
any: boolean;
|
|
129
|
+
}[];
|
|
130
|
+
}, {
|
|
131
|
+
list: {
|
|
132
|
+
run: number;
|
|
133
|
+
cinematic: string;
|
|
134
|
+
waiting: PlayerId[];
|
|
135
|
+
any: boolean;
|
|
136
|
+
}[];
|
|
137
|
+
}>;
|
|
138
|
+
/**
|
|
139
|
+
* A player's screen says a cinematic the rules played is over (the `cinematic` command): the engine says so to the rules
|
|
140
|
+
* (`cinematicEnded`), and a sequence that waits for it counts it
|
|
141
|
+
*/
|
|
142
|
+
export declare function cinematicEnded(world: World, player: PlayerId, cinematic: string, outcome: CinematicOutcome): void;
|
|
143
|
+
/**
|
|
144
|
+
* A player picked an answer of a choice of a cinematic on their screen (the engine's `cinematicChoice` event), as their
|
|
145
|
+
* screen said with the `cinematicChoice` command: the rules branch on it (`waitFor(cinematicChoiceEvent, ...)`), so that
|
|
146
|
+
* the story's branch is the same on every screen and in a replay
|
|
147
|
+
*
|
|
148
|
+
* @beta
|
|
149
|
+
*/
|
|
150
|
+
export interface CinematicChoice {
|
|
151
|
+
/** Whose screen it was picked on */
|
|
152
|
+
player: PlayerId;
|
|
153
|
+
/** Which of the view's cinematics */
|
|
154
|
+
cinematic: string;
|
|
155
|
+
/** The choice's name in the cinematic (`choice` when it gave none), and the answer's id */
|
|
156
|
+
question: string;
|
|
157
|
+
choice: string;
|
|
158
|
+
/** Whether nobody picked and the time ran out on its default */
|
|
159
|
+
timedOut: boolean;
|
|
160
|
+
}
|
|
161
|
+
/** A player's pick of a choice of a cinematic, as their screen said: heard by the rules as `cinematicChoice` */
|
|
162
|
+
export declare function cinematicChose(world: World, choice: CinematicChoice): void;
|
|
163
|
+
/**
|
|
164
|
+
* A step of a sequence that plays one of the view's cinematics: `defineSequence('td.start', [cinematic('td.intro', {
|
|
165
|
+
* hold: true }), ...talk(...)])`. It does not wait for it (with `hold`, the game, and the sequence with it, waits),
|
|
166
|
+
* unless told to: `wait: 'ended'` goes on once the player it was for has seen it end (or skipped it), `any` once one
|
|
167
|
+
* of the players it went to has, `all` once every one of them has. Only players with a screen are waited for (not the
|
|
168
|
+
* computer's); one who left a game of several never says, so a sequence for many waits for `any` where that matters.
|
|
169
|
+
* With a wait it is two steps, which `defineSequence` takes as they are
|
|
170
|
+
*
|
|
171
|
+
* @beta
|
|
172
|
+
*/
|
|
173
|
+
export declare function cinematic<D = undefined>(id: string, options?: CinematicOptions & {
|
|
174
|
+
wait?: undefined;
|
|
175
|
+
}): Step<D>;
|
|
176
|
+
/**
|
|
177
|
+
* With `wait`: the cinematic played, then a wait for its end (see the other form), as two steps
|
|
178
|
+
*
|
|
179
|
+
* @beta
|
|
180
|
+
*/
|
|
181
|
+
export declare function cinematic<D = undefined>(id: string, options: CinematicOptions & {
|
|
182
|
+
wait: CinematicWait;
|
|
183
|
+
}): Step<D>[];
|
|
184
|
+
/** A cinematic played, to whom it is for: everyone when it names nobody */
|
|
185
|
+
export declare const toldCinematic: import("./replication").ReplicatedEvent;
|
|
186
|
+
/** A cue of the rules to a cinematic playing, to whom it is for */
|
|
187
|
+
export declare const toldCinematicCue: import("./replication").ReplicatedEvent;
|
|
188
|
+
/**
|
|
189
|
+
* A region of the map with a cinematic (`MapRegion.cinematic`, ED4) plays it for everyone, once, the first time a unit
|
|
190
|
+
* of a player (not the neutral, nor a building) walks in, unless the game plays it its own way (`play: 'code'`)
|
|
191
|
+
*
|
|
192
|
+
* @beta
|
|
193
|
+
*/
|
|
194
|
+
export declare const regionCinematic: import("./events").ListenerDef;
|
package/dist/clock.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { World } from './world';
|
|
2
|
+
/**
|
|
3
|
+
* The time of day of a world: what its day (`GameModule.day`) and the time played make of it, turned forward or stopped
|
|
4
|
+
* by a map or a script. Kept in a save (`WorldInternals.clockShift`, `stillHour`)
|
|
5
|
+
*
|
|
6
|
+
* @beta
|
|
7
|
+
*/
|
|
8
|
+
export declare class Clock {
|
|
9
|
+
private readonly world;
|
|
10
|
+
/** Seconds the time of day is ahead of the time played */
|
|
11
|
+
shift: number;
|
|
12
|
+
/** The hour, when the clock does not move (`stop`) */
|
|
13
|
+
still: number | undefined;
|
|
14
|
+
/** Whether it was night, and when that was worked out: asked many times a tick, worked out once */
|
|
15
|
+
private readonly seen;
|
|
16
|
+
constructor(world: World);
|
|
17
|
+
/** Hour of the day, 0..24. Noon in a game without days */
|
|
18
|
+
get hour(): number;
|
|
19
|
+
/** Turns the clock forward to an hour, for a map that wants to start at night or a debug tool */
|
|
20
|
+
setHour(hour: number): void;
|
|
21
|
+
/** Stops the clock at the hour it is, for a map that is always night; `false` lets it go on from there */
|
|
22
|
+
stop(still?: boolean): void;
|
|
23
|
+
/** Whether the clock stands still (`stop`) */
|
|
24
|
+
get stopped(): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Whether the sun is down. Asked for every unit's sight and stats, many times a tick: kept for the moment it was
|
|
27
|
+
* worked out at (the day, the time, the clock's shift, an hour that stands still), so it is worked out once a tick
|
|
28
|
+
*/
|
|
29
|
+
get night(): boolean;
|
|
30
|
+
}
|
|
31
|
+
/** The hour of the day, in a game with one (`Snapshot.hour`) */
|
|
32
|
+
export declare const hourPart: import("./replication").SnapshotPart<keyof import(".").Snapshot>;
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import type { PlayerId } from './entity';
|
|
2
|
+
import { type Checked, type Fields } from './fields';
|
|
3
|
+
import { type Vec2 } from './math';
|
|
4
|
+
import type { World } from './world';
|
|
5
|
+
/**
|
|
6
|
+
* Commands are everything a player can ask for: plain data, and the only way input reaches the simulation,
|
|
7
|
+
* which keeps the door open for replays, the AI and multiplayer.
|
|
8
|
+
*
|
|
9
|
+
* A command type is a `CommandDef`: the fields it carries, and what it does. What arrives is checked against the
|
|
10
|
+
* fields before anything happens, because on a server it is whatever anyone sends. The engine's own commands are
|
|
11
|
+
* defined the same way as a game module's (`GameModule.commands`).
|
|
12
|
+
*
|
|
13
|
+
* @beta
|
|
14
|
+
*/
|
|
15
|
+
export interface CommandDef<F extends Fields = Fields> {
|
|
16
|
+
type: string;
|
|
17
|
+
/** What it carries, besides its type and the player who sent it. See `fields.ts` for the checkers */
|
|
18
|
+
fields: F;
|
|
19
|
+
/** Carries it out, for `player`. Whether the player owns or can see what it names is for this to check */
|
|
20
|
+
execute(world: World, player: PlayerId, command: Checked<F>): void;
|
|
21
|
+
/**
|
|
22
|
+
* Carried out at once when given between two ticks, a paused game's too, not at the start of the next (`World.issue`):
|
|
23
|
+
* talk, a line of chat or a ping, which a game that waits is still to hear. Counted by the talk's own rate, not the
|
|
24
|
+
* commands a tick may have; a replay keeps it where it was given (RV14)
|
|
25
|
+
*/
|
|
26
|
+
outsideTick?: boolean;
|
|
27
|
+
}
|
|
28
|
+
declare const modCommandBrand: unique symbol;
|
|
29
|
+
/**
|
|
30
|
+
* A command of a game module, as its definition's `make` puts it together. Sessions send it like the engine's own
|
|
31
|
+
*
|
|
32
|
+
* @beta
|
|
33
|
+
*/
|
|
34
|
+
export type ModCommand = {
|
|
35
|
+
readonly type: string;
|
|
36
|
+
readonly [modCommandBrand]: true;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* A command type, with `make` to put one together for a session to send
|
|
40
|
+
*
|
|
41
|
+
* @beta
|
|
42
|
+
*/
|
|
43
|
+
export type DefinedCommand<T extends string, F extends Fields> = CommandDef<F> & {
|
|
44
|
+
type: T;
|
|
45
|
+
make(fields: Checked<F>): ModCommand;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Defines a command type, for a game module's `commands`: its type, its fields (see `fields.ts`), and what it does.
|
|
49
|
+
* `command` is typed by the fields.
|
|
50
|
+
*
|
|
51
|
+
* ```ts
|
|
52
|
+
* const sellTower = defineCommand('sellTower', { tower: id }, (world, player, command) => { ... })
|
|
53
|
+
* session.send(sellTower.make({ tower: 12 }))
|
|
54
|
+
* ```
|
|
55
|
+
*
|
|
56
|
+
* @beta
|
|
57
|
+
*/
|
|
58
|
+
export declare function defineCommand<const T extends string, F extends Fields>(type: T, fields: F, execute: (world: World, player: PlayerId, command: Checked<F>) => void, options?: {
|
|
59
|
+
outsideTick?: boolean;
|
|
60
|
+
}): DefinedCommand<T, F>;
|
|
61
|
+
/** What a command looks like on its way in: its type, who sent it, and its fields */
|
|
62
|
+
type CommandOf<D> = D extends DefinedCommand<infer T, infer F> ? {
|
|
63
|
+
type: T;
|
|
64
|
+
player: PlayerId;
|
|
65
|
+
} & Checked<F> : never;
|
|
66
|
+
/**
|
|
67
|
+
* Stops what units are doing, as the classic Stop does: a plain interrupt. They fight what comes near again at once; a
|
|
68
|
+
* unit that is to stand down and take no fights is put in a stance (`stanceCommand`, `withStances`)
|
|
69
|
+
*
|
|
70
|
+
* @beta
|
|
71
|
+
*/
|
|
72
|
+
export declare const stopCommand: DefinedCommand<"stop", {
|
|
73
|
+
entities: import("./fields").Check<number[]>;
|
|
74
|
+
}>;
|
|
75
|
+
/** The player skips the line of dialog they hear: a conversation goes on to its next line. See `world.dialog` */
|
|
76
|
+
export declare const skipLineCommand: DefinedCommand<"skipLine", {}>;
|
|
77
|
+
/** A player marks a spot of the map for their allies: `look`, `danger`, `assist` or `onMyWay` (see `ping`) */
|
|
78
|
+
export declare const pingCommand: DefinedCommand<"ping", {
|
|
79
|
+
point: import("./fields").Check<Vec2>;
|
|
80
|
+
kind: import("./fields").Check<string | undefined>;
|
|
81
|
+
to: import("./fields").Check<string | undefined>;
|
|
82
|
+
by: import("./fields").Check<string | undefined>;
|
|
83
|
+
}>;
|
|
84
|
+
/** A player says a line of chat: to `allies` (when left out), or to `all` (see `chat`) */
|
|
85
|
+
export declare const chatCommand: DefinedCommand<"chat", {
|
|
86
|
+
text: import("./fields").Check<string>;
|
|
87
|
+
to: import("./fields").Check<string | undefined>;
|
|
88
|
+
by: import("./fields").Check<string | undefined>;
|
|
89
|
+
}>;
|
|
90
|
+
/** A player gives an ally some of a resource they have (see `give`) */
|
|
91
|
+
export declare const giveCommand: DefinedCommand<"give", {
|
|
92
|
+
to: import("./fields").Check<number>;
|
|
93
|
+
resource: import("./fields").Check<string>;
|
|
94
|
+
amount: import("./fields").Check<number>;
|
|
95
|
+
}>;
|
|
96
|
+
/** A player shares control of their units, or their team's sight, with an ally, or no longer (see `shareWith`) */
|
|
97
|
+
export declare const shareCommand: DefinedCommand<"share", {
|
|
98
|
+
with: import("./fields").Check<number>;
|
|
99
|
+
vision: import("./fields").Check<boolean | undefined>;
|
|
100
|
+
control: import("./fields").Check<boolean | undefined>;
|
|
101
|
+
}>;
|
|
102
|
+
/**
|
|
103
|
+
* The commands the engine knows, which every game has
|
|
104
|
+
*
|
|
105
|
+
* @beta
|
|
106
|
+
*/
|
|
107
|
+
export declare const coreCommands: readonly [DefinedCommand<"order", {
|
|
108
|
+
entities: import("./fields").Check<number[]>;
|
|
109
|
+
order: import("./fields").Check<Checked<{
|
|
110
|
+
type: import("./fields").Check<string>;
|
|
111
|
+
target: import("./fields").Check<number | undefined>;
|
|
112
|
+
point: import("./fields").Check<Vec2 | undefined>;
|
|
113
|
+
unitType: import("./fields").Check<string | undefined>;
|
|
114
|
+
ability: import("./fields").Check<string | undefined>;
|
|
115
|
+
item: import("./fields").Check<number | undefined>;
|
|
116
|
+
facing: import("./fields").Check<number | undefined>;
|
|
117
|
+
path: import("./fields").Check<string | undefined>;
|
|
118
|
+
towards: import("./fields").Check<"first" | "last" | undefined>;
|
|
119
|
+
formation: import("./fields").Check<string | undefined>;
|
|
120
|
+
together: import("./fields").Check<boolean | undefined>;
|
|
121
|
+
}>>;
|
|
122
|
+
queue: import("./fields").Check<boolean | undefined>;
|
|
123
|
+
}>, DefinedCommand<"smart", {
|
|
124
|
+
entities: import("./fields").Check<number[]>;
|
|
125
|
+
point: import("./fields").Check<Vec2>;
|
|
126
|
+
target: import("./fields").Check<number | undefined>;
|
|
127
|
+
queue: import("./fields").Check<boolean | undefined>;
|
|
128
|
+
formation: import("./fields").Check<string | undefined>;
|
|
129
|
+
}>, DefinedCommand<"attack", {
|
|
130
|
+
entities: import("./fields").Check<number[]>;
|
|
131
|
+
point: import("./fields").Check<Vec2>;
|
|
132
|
+
target: import("./fields").Check<number | undefined>;
|
|
133
|
+
queue: import("./fields").Check<boolean | undefined>;
|
|
134
|
+
formation: import("./fields").Check<string | undefined>;
|
|
135
|
+
}>, DefinedCommand<"cast", {
|
|
136
|
+
entities: import("./fields").Check<number[]>;
|
|
137
|
+
ability: import("./fields").Check<string>;
|
|
138
|
+
point: import("./fields").Check<Vec2 | undefined>;
|
|
139
|
+
target: import("./fields").Check<number | undefined>;
|
|
140
|
+
queue: import("./fields").Check<boolean | undefined>;
|
|
141
|
+
}>, DefinedCommand<"autocast", {
|
|
142
|
+
entities: import("./fields").Check<number[]>;
|
|
143
|
+
ability: import("./fields").Check<string>;
|
|
144
|
+
enabled: import("./fields").Check<boolean>;
|
|
145
|
+
}>, DefinedCommand<"stop", {
|
|
146
|
+
entities: import("./fields").Check<number[]>;
|
|
147
|
+
}>, DefinedCommand<"train", {
|
|
148
|
+
building: import("./fields").Check<number | undefined>;
|
|
149
|
+
buildings: import("./fields").Check<number[] | undefined>;
|
|
150
|
+
unitType: import("./fields").Check<string>;
|
|
151
|
+
}>, DefinedCommand<"research", {
|
|
152
|
+
building: import("./fields").Check<number | undefined>;
|
|
153
|
+
buildings: import("./fields").Check<number[] | undefined>;
|
|
154
|
+
upgrade: import("./fields").Check<string>;
|
|
155
|
+
}>, DefinedCommand<"upgradeBuilding", {
|
|
156
|
+
building: import("./fields").Check<number>;
|
|
157
|
+
into: import("./fields").Check<string | undefined>;
|
|
158
|
+
}>, DefinedCommand<"cancelTrain", {
|
|
159
|
+
building: import("./fields").Check<number>;
|
|
160
|
+
index: import("./fields").Check<number>;
|
|
161
|
+
}>, DefinedCommand<"rally", {
|
|
162
|
+
buildings: import("./fields").Check<number[]>;
|
|
163
|
+
point: import("./fields").Check<Vec2>;
|
|
164
|
+
target: import("./fields").Check<number | undefined>;
|
|
165
|
+
}>, DefinedCommand<"cancelConstruction", {
|
|
166
|
+
building: import("./fields").Check<number>;
|
|
167
|
+
}>, DefinedCommand<"skipLine", {}>, DefinedCommand<"ping", {
|
|
168
|
+
point: import("./fields").Check<Vec2>;
|
|
169
|
+
kind: import("./fields").Check<string | undefined>;
|
|
170
|
+
to: import("./fields").Check<string | undefined>;
|
|
171
|
+
by: import("./fields").Check<string | undefined>;
|
|
172
|
+
}>, DefinedCommand<"chat", {
|
|
173
|
+
text: import("./fields").Check<string>;
|
|
174
|
+
to: import("./fields").Check<string | undefined>;
|
|
175
|
+
by: import("./fields").Check<string | undefined>;
|
|
176
|
+
}>, DefinedCommand<"give", {
|
|
177
|
+
to: import("./fields").Check<number>;
|
|
178
|
+
resource: import("./fields").Check<string>;
|
|
179
|
+
amount: import("./fields").Check<number>;
|
|
180
|
+
}>, DefinedCommand<"share", {
|
|
181
|
+
with: import("./fields").Check<number>;
|
|
182
|
+
vision: import("./fields").Check<boolean | undefined>;
|
|
183
|
+
control: import("./fields").Check<boolean | undefined>;
|
|
184
|
+
}>, DefinedCommand<"surrender", {}>, DefinedCommand<"pause", {}>, DefinedCommand<"cinematic", {
|
|
185
|
+
cinematic: import("./fields").Check<string>;
|
|
186
|
+
outcome: import("./fields").Check<"ended" | "ignored" | "replaced" | "skipped" | "stopped">;
|
|
187
|
+
}>, DefinedCommand<"cinematicChoice", {
|
|
188
|
+
cinematic: import("./fields").Check<string>;
|
|
189
|
+
question: import("./fields").Check<string>;
|
|
190
|
+
choice: import("./fields").Check<string>;
|
|
191
|
+
timedOut: import("./fields").Check<boolean | undefined>;
|
|
192
|
+
}>];
|
|
193
|
+
/**
|
|
194
|
+
* The commands a world takes, by who defines them: the engine's (`core`), and each pack's, which adds its own by
|
|
195
|
+
* declaration merging, as the heroes pack does:
|
|
196
|
+
*
|
|
197
|
+
* ```ts
|
|
198
|
+
* declare module '@v12-engine/engine' {
|
|
199
|
+
* interface Commands {
|
|
200
|
+
* mypack: (typeof myPackCommands)[number]
|
|
201
|
+
* }
|
|
202
|
+
* }
|
|
203
|
+
* ```
|
|
204
|
+
*
|
|
205
|
+
* @beta
|
|
206
|
+
*/
|
|
207
|
+
export interface Commands {
|
|
208
|
+
core: (typeof coreCommands)[number];
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* A command a world takes, as it comes in: its type, who sent it, and its fields. The engine's, and its packs'
|
|
212
|
+
* (`Commands`)
|
|
213
|
+
*
|
|
214
|
+
* @beta
|
|
215
|
+
*/
|
|
216
|
+
export type Command = CommandOf<Commands[keyof Commands]>;
|
|
217
|
+
/**
|
|
218
|
+
* Any command on its way in: the engine's own, or a game module's
|
|
219
|
+
*
|
|
220
|
+
* @beta
|
|
221
|
+
*/
|
|
222
|
+
export type IssuedCommand = (Command | (ModCommand & {
|
|
223
|
+
player: PlayerId;
|
|
224
|
+
})) & {
|
|
225
|
+
/** The sender's own number for it, told back with how it went (`commandHandled`): what a screen waits on */
|
|
226
|
+
seq?: number;
|
|
227
|
+
};
|
|
228
|
+
/**
|
|
229
|
+
* Checks a command and carries it out. A command that is not what it says it is (an unknown type, a field missing
|
|
230
|
+
* or of the wrong kind, a player that is not in the game) is turned away with `commandRejected`, and changes nothing
|
|
231
|
+
*/
|
|
232
|
+
export declare function executeCommand(world: World, raw: unknown): void;
|
|
233
|
+
/** What became of a command: to whoever sent it */
|
|
234
|
+
export declare const toldCommand: import("./replication").ReplicatedEvent;
|
|
235
|
+
export {};
|