@v12-engine/engine 0.0.0-stage → 0.1.1
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
package/dist/world.d.ts
ADDED
|
@@ -0,0 +1,1118 @@
|
|
|
1
|
+
import { Life } from './life';
|
|
2
|
+
import { Sight } from './sight';
|
|
3
|
+
import { Sides } from './sides';
|
|
4
|
+
import { Clock } from './clock';
|
|
5
|
+
import { Spawning } from './spawning';
|
|
6
|
+
import { type IssuedCommand } from './commands';
|
|
7
|
+
import type { Camp } from './camps';
|
|
8
|
+
import type { ChatAudience, PingKind } from './talk';
|
|
9
|
+
import { type DebugChecks } from './debug';
|
|
10
|
+
import { type AbilityDef, type AttackDef, type Cost, type DamageType, type EffectDef, type EffectOf, type ResourceKind } from './defs';
|
|
11
|
+
import { Entity, type EntityId, type ItemInstance, type PlayerId } from './entity';
|
|
12
|
+
import { EntityIndex } from './entityIndex';
|
|
13
|
+
import { type ErrorPolicy, type ErrorSite, type RejectedKind, type WorldFailure } from './errors';
|
|
14
|
+
import { Emitter } from './events';
|
|
15
|
+
import { Logger, type LogLevel } from './log';
|
|
16
|
+
import { type HookDef, Hooks } from './hooks';
|
|
17
|
+
import { FogOfWar } from './fog';
|
|
18
|
+
import { BuildGrid } from './grid';
|
|
19
|
+
import type { Vec2 } from './math';
|
|
20
|
+
import type { SidePaths } from './navigation/sidePaths';
|
|
21
|
+
import type { Navigation } from './navigation/navigation';
|
|
22
|
+
import { Player, type PlayerInit, type SpentOn } from './player';
|
|
23
|
+
import type { Registry, System } from './registry';
|
|
24
|
+
import type { GameRules } from './rules';
|
|
25
|
+
import { Scheduler } from './scheduler';
|
|
26
|
+
import { Score } from './score';
|
|
27
|
+
import { Computers } from './computers';
|
|
28
|
+
import { type Component, StateStore } from './components';
|
|
29
|
+
import { type Message, type MessageRef } from './messages';
|
|
30
|
+
import { Rng } from './rng';
|
|
31
|
+
import { type DataKind, type DataValues } from './gameData';
|
|
32
|
+
import { SpatialIndex } from './spatial';
|
|
33
|
+
import { type GroundItem } from './items';
|
|
34
|
+
import type { Terrain } from './terrain';
|
|
35
|
+
import { type GroundBase, type TerrainPatch } from './ground';
|
|
36
|
+
import { type AreaDef, type AreaShape, Areas } from './areas';
|
|
37
|
+
import { Dialog, type SaidLine } from './dialog';
|
|
38
|
+
import { Objectives, type ObjectiveState, type ObjectiveStatus } from './objectives';
|
|
39
|
+
import { type SequenceDef, Sequences } from './sequences';
|
|
40
|
+
import { type TimerDef, Timers } from './timers';
|
|
41
|
+
import type { ListenerDef } from './events';
|
|
42
|
+
import type { Trace } from './inspect';
|
|
43
|
+
import type { CinematicChoice, CinematicCue, CinematicCueSent, CinematicEnded } from './cinematics';
|
|
44
|
+
import { type EffectCue, type EffectOptions } from './effects';
|
|
45
|
+
import { WorldMap } from './names';
|
|
46
|
+
import type { MapEnvironment } from './map';
|
|
47
|
+
import { type PrefabDef, type SpawnedPrefab, type SpawnPrefabOptions } from './prefabs';
|
|
48
|
+
/**
|
|
49
|
+
* What two players are to each other, when set apart from their teams (`World.setRelation`)
|
|
50
|
+
*
|
|
51
|
+
* @beta
|
|
52
|
+
*/
|
|
53
|
+
export type PlayerRelation = 'ally' | 'enemy' | 'neutral';
|
|
54
|
+
/** @beta */
|
|
55
|
+
export interface Projectile {
|
|
56
|
+
id: number;
|
|
57
|
+
source: EntityId;
|
|
58
|
+
owner: PlayerId;
|
|
59
|
+
target: EntityId;
|
|
60
|
+
x: number;
|
|
61
|
+
z: number;
|
|
62
|
+
prevX: number;
|
|
63
|
+
prevZ: number;
|
|
64
|
+
/** Where it is heading. Follows the target while it lives */
|
|
65
|
+
tx: number;
|
|
66
|
+
tz: number;
|
|
67
|
+
speed: number;
|
|
68
|
+
damage: number;
|
|
69
|
+
type: DamageType;
|
|
70
|
+
crit: boolean;
|
|
71
|
+
/** Fired uphill and going to miss: it flies all the way and does nothing when it comes down */
|
|
72
|
+
miss: boolean;
|
|
73
|
+
/** Where it was fired from */
|
|
74
|
+
sx: number;
|
|
75
|
+
sz: number;
|
|
76
|
+
/** Set for shots that hit an area instead of a target */
|
|
77
|
+
splash?: {
|
|
78
|
+
radius: number;
|
|
79
|
+
fells: boolean;
|
|
80
|
+
targets?: AttackDef['targets'];
|
|
81
|
+
};
|
|
82
|
+
/** What it looks like, when the rules say: a look of the shooter's visual, for the screen (a flaming arrow) */
|
|
83
|
+
look?: string;
|
|
84
|
+
/** The type of what shot it: the screen draws it so, even once the shooter is gone or out of sight */
|
|
85
|
+
kind: string;
|
|
86
|
+
/** Words of the game's own about it, which its damage carries (see `BeforeAttack.tags`) */
|
|
87
|
+
tags?: string[];
|
|
88
|
+
/** How what it kills dies, for the screen (see `AttackDef.how`) */
|
|
89
|
+
how?: string;
|
|
90
|
+
/** Which of its shooter's attacks it is of, by place (`UnitTypeDef.attacks`): the first when left out */
|
|
91
|
+
weapon?: number;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* What an ability sent on its way: it travels in a line and does something to everything it passes through
|
|
95
|
+
*
|
|
96
|
+
* @beta
|
|
97
|
+
*/
|
|
98
|
+
export interface Missile {
|
|
99
|
+
id: number;
|
|
100
|
+
owner: PlayerId;
|
|
101
|
+
source: EntityId;
|
|
102
|
+
ability: string;
|
|
103
|
+
level: number;
|
|
104
|
+
x: number;
|
|
105
|
+
z: number;
|
|
106
|
+
prevX: number;
|
|
107
|
+
prevZ: number;
|
|
108
|
+
/** Direction, of length 1 */
|
|
109
|
+
dx: number;
|
|
110
|
+
dz: number;
|
|
111
|
+
speed: number;
|
|
112
|
+
/** How far it still goes */
|
|
113
|
+
left: number;
|
|
114
|
+
/** Seconds until it sets off, and how long that took in all */
|
|
115
|
+
delay: number;
|
|
116
|
+
forms: number;
|
|
117
|
+
radius: number;
|
|
118
|
+
effect: EffectOf<'missile'>;
|
|
119
|
+
/** Whom it has passed through already. Missiles sent together share it: what one of them hit the others pass by */
|
|
120
|
+
hit: Set<EntityId>;
|
|
121
|
+
/** The unit it flies after, for the ones that do */
|
|
122
|
+
target: EntityId;
|
|
123
|
+
/** How far it has come */
|
|
124
|
+
travelled: number;
|
|
125
|
+
/** How far it has come since it set off, or sprang on last (`EffectFields.bounce`): how far along its arc it is */
|
|
126
|
+
leg: number;
|
|
127
|
+
/** How high above the ground its arc carries it now, for whoever draws it: 0 for what is not thrown in an arc */
|
|
128
|
+
height: number;
|
|
129
|
+
/** How many times it has sprung on to another */
|
|
130
|
+
bounces: number;
|
|
131
|
+
/** Something got in its way: what happens where it ends does not */
|
|
132
|
+
stopped: boolean;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Something an ability does a while after it was cast
|
|
136
|
+
*
|
|
137
|
+
* @beta
|
|
138
|
+
*/
|
|
139
|
+
export interface Delayed {
|
|
140
|
+
left: number;
|
|
141
|
+
caster: Entity;
|
|
142
|
+
ability: AbilityDef;
|
|
143
|
+
level: number;
|
|
144
|
+
point: Vec2;
|
|
145
|
+
effects: EffectDef[];
|
|
146
|
+
/** What its arrival goes by, when not the ability */
|
|
147
|
+
impact?: string;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Ground an ability goes on working on for a while
|
|
151
|
+
*
|
|
152
|
+
* @beta
|
|
153
|
+
*/
|
|
154
|
+
export interface Zone {
|
|
155
|
+
id: number;
|
|
156
|
+
caster: Entity;
|
|
157
|
+
ability: AbilityDef;
|
|
158
|
+
level: number;
|
|
159
|
+
x: number;
|
|
160
|
+
z: number;
|
|
161
|
+
left: number;
|
|
162
|
+
/** Seconds until what is inside is next seen to */
|
|
163
|
+
next: number;
|
|
164
|
+
effect: EffectOf<'zone'>;
|
|
165
|
+
}
|
|
166
|
+
/** @beta */
|
|
167
|
+
export type MessageKind = 'error' | 'info' | 'hint';
|
|
168
|
+
/** @beta */
|
|
169
|
+
export interface WorldEvents {
|
|
170
|
+
entitySpawned: Entity;
|
|
171
|
+
entityRemoved: Entity;
|
|
172
|
+
/**
|
|
173
|
+
* `cause`: the blow, for what died of damage. `how`: what the rules made of the death in the `death` hook, for the
|
|
174
|
+
* screen to show (`'exploded'`, `'burned'`)
|
|
175
|
+
*/
|
|
176
|
+
entityDied: {
|
|
177
|
+
entity: Entity;
|
|
178
|
+
killer?: Entity;
|
|
179
|
+
attack: boolean;
|
|
180
|
+
cause?: DeathCause;
|
|
181
|
+
how?: string;
|
|
182
|
+
reason: DeathReason;
|
|
183
|
+
};
|
|
184
|
+
/** A buff was put on, or put on again (`renewed`, with the level it had before: `previousLevel`) */
|
|
185
|
+
buffApplied: {
|
|
186
|
+
target: Entity;
|
|
187
|
+
buff: string;
|
|
188
|
+
level: number;
|
|
189
|
+
source?: Entity;
|
|
190
|
+
renewed: boolean;
|
|
191
|
+
previousLevel?: number;
|
|
192
|
+
};
|
|
193
|
+
/** A buff came off: it ran out (`expired`), or was taken off. Not for the buffs of something that dies */
|
|
194
|
+
buffRemoved: {
|
|
195
|
+
entity: Entity;
|
|
196
|
+
buff: string;
|
|
197
|
+
expired: boolean;
|
|
198
|
+
};
|
|
199
|
+
damaged: {
|
|
200
|
+
target: Entity;
|
|
201
|
+
source?: Entity;
|
|
202
|
+
amount: number;
|
|
203
|
+
type: DamageType;
|
|
204
|
+
crit: boolean;
|
|
205
|
+
attack: boolean;
|
|
206
|
+
ability?: string;
|
|
207
|
+
tags?: string[];
|
|
208
|
+
};
|
|
209
|
+
/** An attack went wide. Where it would have landed, and whom it was for */
|
|
210
|
+
missed: {
|
|
211
|
+
x: number;
|
|
212
|
+
z: number;
|
|
213
|
+
source?: Entity;
|
|
214
|
+
target?: Entity;
|
|
215
|
+
};
|
|
216
|
+
healed: {
|
|
217
|
+
target: Entity;
|
|
218
|
+
source?: Entity;
|
|
219
|
+
amount: number;
|
|
220
|
+
};
|
|
221
|
+
/** `weapon`: which of its attacks swings, by place (`UnitTypeDef.attacks`) */
|
|
222
|
+
attackStarted: {
|
|
223
|
+
attacker: Entity;
|
|
224
|
+
target?: Entity;
|
|
225
|
+
weapon: number;
|
|
226
|
+
};
|
|
227
|
+
projectileSpawned: Projectile;
|
|
228
|
+
projectileRemoved: Projectile;
|
|
229
|
+
/** An attack that hits an area came down */
|
|
230
|
+
impact: {
|
|
231
|
+
x: number;
|
|
232
|
+
z: number;
|
|
233
|
+
radius: number;
|
|
234
|
+
owner: PlayerId;
|
|
235
|
+
};
|
|
236
|
+
constructionStarted: Entity;
|
|
237
|
+
constructionFinished: Entity;
|
|
238
|
+
/** A construction was called off by its owner: it dies next, with the reason `cancelled` */
|
|
239
|
+
constructionCancelled: Entity;
|
|
240
|
+
/** A building started to turn into another type (`UnitTypeDef.upgradesTo`), over `time` seconds */
|
|
241
|
+
morphStarted: {
|
|
242
|
+
entity: Entity;
|
|
243
|
+
into: string;
|
|
244
|
+
time: number;
|
|
245
|
+
};
|
|
246
|
+
/** That was called off, or the building died before it was done */
|
|
247
|
+
morphCancelled: {
|
|
248
|
+
entity: Entity;
|
|
249
|
+
into: string;
|
|
250
|
+
};
|
|
251
|
+
unitTrained: {
|
|
252
|
+
building: Entity;
|
|
253
|
+
unit: Entity;
|
|
254
|
+
};
|
|
255
|
+
/** An entity became another type: `from`, what it was */
|
|
256
|
+
entityMorphed: {
|
|
257
|
+
entity: Entity;
|
|
258
|
+
from: string;
|
|
259
|
+
};
|
|
260
|
+
playerDefeated: Player;
|
|
261
|
+
/** A player gave up (see `surrender`): `playerDefeated` follows */
|
|
262
|
+
playerSurrendered: {
|
|
263
|
+
player: PlayerId;
|
|
264
|
+
};
|
|
265
|
+
/** A player asked for a pause, and the rules let them (see `askPause`): whoever runs the world pauses it, for `seconds` at most */
|
|
266
|
+
pauseAsked: {
|
|
267
|
+
player: PlayerId;
|
|
268
|
+
seconds: number;
|
|
269
|
+
left: number;
|
|
270
|
+
};
|
|
271
|
+
gameOver: {
|
|
272
|
+
winner: number;
|
|
273
|
+
};
|
|
274
|
+
/** The game ended on an error in its rules (`world.failure`): it is not stepped again */
|
|
275
|
+
worldFailed: WorldFailure;
|
|
276
|
+
/** A unit got into a transport (`UnitTypeDef.transport`), or out of one */
|
|
277
|
+
boarded: {
|
|
278
|
+
passenger: Entity;
|
|
279
|
+
transport: Entity;
|
|
280
|
+
};
|
|
281
|
+
/** A unit was hired at a place that hires (`UnitTypeDef.hires`) */
|
|
282
|
+
unitHired: {
|
|
283
|
+
shop: Entity;
|
|
284
|
+
unit: Entity;
|
|
285
|
+
player: PlayerId;
|
|
286
|
+
};
|
|
287
|
+
unloaded: {
|
|
288
|
+
passenger: Entity;
|
|
289
|
+
transport: Entity;
|
|
290
|
+
};
|
|
291
|
+
heroLevelUp: {
|
|
292
|
+
hero: Entity;
|
|
293
|
+
level: number;
|
|
294
|
+
};
|
|
295
|
+
/** A hero earned experience (`grantXp`): how much, after `beforeXp`, and the level it is at after it */
|
|
296
|
+
xpGained: {
|
|
297
|
+
hero: Entity;
|
|
298
|
+
amount: number;
|
|
299
|
+
level: number;
|
|
300
|
+
from?: Entity;
|
|
301
|
+
};
|
|
302
|
+
/**
|
|
303
|
+
* A unit's mana changed by something it did or was given: spent on a cast (`amount` below 0, `ability` the one cast)
|
|
304
|
+
* or given by an effect (above 0). Not its regeneration, which would be every tick
|
|
305
|
+
*/
|
|
306
|
+
manaChanged: {
|
|
307
|
+
entity: Entity;
|
|
308
|
+
amount: number;
|
|
309
|
+
ability?: string;
|
|
310
|
+
source?: Entity;
|
|
311
|
+
};
|
|
312
|
+
/**
|
|
313
|
+
* A pool of a game's own on a unit (rage, energy, charges) changed: emitted by the game's rules
|
|
314
|
+
* (`world.events.emit(resourceChanged, …)`), heard by the screens of the unit's owner and allies (`resource`)
|
|
315
|
+
*/
|
|
316
|
+
resourceChanged: {
|
|
317
|
+
entity: Entity;
|
|
318
|
+
kind: string;
|
|
319
|
+
amount: number;
|
|
320
|
+
reason?: string;
|
|
321
|
+
};
|
|
322
|
+
heroRevived: Entity;
|
|
323
|
+
/** `duration`: seconds of the wind-up */
|
|
324
|
+
castStarted: {
|
|
325
|
+
caster: Entity;
|
|
326
|
+
ability: AbilityDef;
|
|
327
|
+
point?: Vec2;
|
|
328
|
+
duration: number;
|
|
329
|
+
};
|
|
330
|
+
/** A channelled ability started to be kept up, or ended: done, or `interrupted` */
|
|
331
|
+
channelStarted: {
|
|
332
|
+
caster: Entity;
|
|
333
|
+
ability: AbilityDef;
|
|
334
|
+
duration: number;
|
|
335
|
+
};
|
|
336
|
+
channelEnded: {
|
|
337
|
+
caster: Entity;
|
|
338
|
+
ability: AbilityDef;
|
|
339
|
+
interrupted: boolean;
|
|
340
|
+
};
|
|
341
|
+
missileSpawned: Missile;
|
|
342
|
+
missileHit: {
|
|
343
|
+
missile: Missile;
|
|
344
|
+
target: Entity;
|
|
345
|
+
};
|
|
346
|
+
missileRemoved: Missile;
|
|
347
|
+
abilityCast: {
|
|
348
|
+
caster: Entity;
|
|
349
|
+
ability: AbilityDef;
|
|
350
|
+
level: number;
|
|
351
|
+
target?: Entity;
|
|
352
|
+
point: Vec2;
|
|
353
|
+
charged?: boolean;
|
|
354
|
+
};
|
|
355
|
+
/** What an ability set off arrived: a missile hit, a rush ended, the time was up */
|
|
356
|
+
abilityImpact: {
|
|
357
|
+
caster: Entity;
|
|
358
|
+
ability: AbilityDef;
|
|
359
|
+
level: number;
|
|
360
|
+
target?: Entity;
|
|
361
|
+
point: Vec2;
|
|
362
|
+
radius: number;
|
|
363
|
+
impact?: string;
|
|
364
|
+
};
|
|
365
|
+
researchFinished: {
|
|
366
|
+
building: Entity;
|
|
367
|
+
upgrade: string;
|
|
368
|
+
level: number;
|
|
369
|
+
};
|
|
370
|
+
itemDropped: GroundItem;
|
|
371
|
+
itemPicked: {
|
|
372
|
+
entity: Entity;
|
|
373
|
+
item: ItemInstance;
|
|
374
|
+
};
|
|
375
|
+
/** Every creep of a camp is gone. It comes back after a while, when it says so (see `Camp.respawn`) */
|
|
376
|
+
campCleared: {
|
|
377
|
+
camp: Camp;
|
|
378
|
+
};
|
|
379
|
+
/** A camp cleared came back, its creeps where they stood (see `respawnCamp`) */
|
|
380
|
+
campReturned: {
|
|
381
|
+
camp: Camp;
|
|
382
|
+
};
|
|
383
|
+
/** A player marked a spot for their allies, or for everyone (see `ping`) */
|
|
384
|
+
pinged: {
|
|
385
|
+
player: PlayerId;
|
|
386
|
+
point: Vec2;
|
|
387
|
+
kind: PingKind;
|
|
388
|
+
to: ChatAudience;
|
|
389
|
+
by?: string;
|
|
390
|
+
};
|
|
391
|
+
/** A player gave an ally resources (see `give`): how much went, and how much came after the tax */
|
|
392
|
+
traded: {
|
|
393
|
+
from: PlayerId;
|
|
394
|
+
to: PlayerId;
|
|
395
|
+
resource: string;
|
|
396
|
+
sent: number;
|
|
397
|
+
received: number;
|
|
398
|
+
};
|
|
399
|
+
/** A player traded one resource for another at a rate (see `exchange`): how much of what went, and how much of what came */
|
|
400
|
+
exchanged: {
|
|
401
|
+
player: PlayerId;
|
|
402
|
+
sold: string;
|
|
403
|
+
sent: number;
|
|
404
|
+
bought: string;
|
|
405
|
+
received: number;
|
|
406
|
+
};
|
|
407
|
+
/** A player said a line (see `chat`): to their side, or to everyone */
|
|
408
|
+
chatted: {
|
|
409
|
+
player: PlayerId;
|
|
410
|
+
text: string;
|
|
411
|
+
to: ChatAudience;
|
|
412
|
+
by?: string;
|
|
413
|
+
};
|
|
414
|
+
/** What a unit carries changed: an item given, taken, bought, sold, used up, or a hero carried in with theirs */
|
|
415
|
+
inventoryChanged: {
|
|
416
|
+
entity: Entity;
|
|
417
|
+
};
|
|
418
|
+
bounty: {
|
|
419
|
+
entity: Entity;
|
|
420
|
+
player: PlayerId;
|
|
421
|
+
amount: number;
|
|
422
|
+
};
|
|
423
|
+
/** A worker struck what it is mending */
|
|
424
|
+
worked: {
|
|
425
|
+
worker: Entity;
|
|
426
|
+
target: Entity;
|
|
427
|
+
};
|
|
428
|
+
/** A worker struck the tree it is working on */
|
|
429
|
+
chopped: {
|
|
430
|
+
worker: Entity;
|
|
431
|
+
source: Entity;
|
|
432
|
+
};
|
|
433
|
+
/** A worker handed in what it carried: `amount` as it went into the purse, `upkeep` what upkeep took of it at the door */
|
|
434
|
+
resourcesDeposited: {
|
|
435
|
+
entity: Entity;
|
|
436
|
+
player: PlayerId;
|
|
437
|
+
kind: ResourceKind;
|
|
438
|
+
amount: number;
|
|
439
|
+
upkeep?: number;
|
|
440
|
+
};
|
|
441
|
+
/**
|
|
442
|
+
* A player paid for something (`spend`), or was given back what they paid (`refund`, `giveBack`): `on` what (`unit`,
|
|
443
|
+
* `upgrade`, `structure`, `item`, `hire`, `repair`... or a game's own word), and its id
|
|
444
|
+
*/
|
|
445
|
+
resourcesSpent: {
|
|
446
|
+
player: PlayerId;
|
|
447
|
+
cost: Cost;
|
|
448
|
+
on: SpentOn;
|
|
449
|
+
id?: string;
|
|
450
|
+
refund: boolean;
|
|
451
|
+
};
|
|
452
|
+
/**
|
|
453
|
+
* A command, or a part of one, that a player's own client never sends: not what it says it is (an unknown type, a
|
|
454
|
+
* field missing or of the wrong kind), or naming another player's unit, or a unit there never was. What a race makes
|
|
455
|
+
* (an order to a unit that has just died) is not one. A server counts these against whoever sent them (`onCheat`);
|
|
456
|
+
* a game's own commands may emit it too
|
|
457
|
+
*/
|
|
458
|
+
/**
|
|
459
|
+
* A command turned away (`RejectedKind`: why, for what counts them, as a server's cheat counter does), with the
|
|
460
|
+
* reason in words for the log
|
|
461
|
+
*/
|
|
462
|
+
commandRejected: {
|
|
463
|
+
player?: PlayerId;
|
|
464
|
+
type?: string;
|
|
465
|
+
kind: RejectedKind;
|
|
466
|
+
reason: string;
|
|
467
|
+
};
|
|
468
|
+
/** A command that came with a number of its sender's (`seq`) was carried out: refused with the first error the player was told, or not */
|
|
469
|
+
commandHandled: {
|
|
470
|
+
player: PlayerId;
|
|
471
|
+
seq: number;
|
|
472
|
+
refusal?: Message;
|
|
473
|
+
};
|
|
474
|
+
/** Feedback for a player, like "Not enough gold": what the client finds the words for */
|
|
475
|
+
messageSent: {
|
|
476
|
+
player: PlayerId;
|
|
477
|
+
message: Message;
|
|
478
|
+
kind: MessageKind;
|
|
479
|
+
seconds?: number;
|
|
480
|
+
};
|
|
481
|
+
/** A unit walked into an area of the game (`GameModule.areas`) */
|
|
482
|
+
enteredArea: {
|
|
483
|
+
area: string;
|
|
484
|
+
entity: Entity;
|
|
485
|
+
};
|
|
486
|
+
/** A unit walked out of one. What dies in an area is not said to leave it */
|
|
487
|
+
leftArea: {
|
|
488
|
+
area: string;
|
|
489
|
+
entity: Entity;
|
|
490
|
+
};
|
|
491
|
+
/** An objective of a player was given (`was` undefined), got further along, was done or failed */
|
|
492
|
+
objectiveChanged: {
|
|
493
|
+
player: PlayerId;
|
|
494
|
+
objective: ObjectiveState;
|
|
495
|
+
was?: ObjectiveStatus;
|
|
496
|
+
};
|
|
497
|
+
/** Someone said a line, to some players or everyone (see `world.dialog`) */
|
|
498
|
+
lineSaid: SaidLine;
|
|
499
|
+
/** A line was skipped by whom it was said to: it ends early for them */
|
|
500
|
+
lineEnded: {
|
|
501
|
+
id: number;
|
|
502
|
+
to: PlayerId[];
|
|
503
|
+
};
|
|
504
|
+
/** A player went over to another team (`setTeam`) */
|
|
505
|
+
teamChanged: {
|
|
506
|
+
player: PlayerId;
|
|
507
|
+
from: number;
|
|
508
|
+
to: number;
|
|
509
|
+
};
|
|
510
|
+
/** The rules marked a moment to start again from, like the start of a wave: a session keeps a save of it */
|
|
511
|
+
checkpoint: {
|
|
512
|
+
label: Message;
|
|
513
|
+
};
|
|
514
|
+
/** The rules play one of the view's cinematics on the screens of some players, or everyone's (see `playCinematic`) */
|
|
515
|
+
cinematicCue: CinematicCue;
|
|
516
|
+
/** The rules cue the cinematic playing on some screens, or everyone's (see `cueCinematic`) */
|
|
517
|
+
cinematicCued: CinematicCueSent;
|
|
518
|
+
/** A cinematic the rules played is over on a player's screen, as their screen said (see `cinematic`'s `wait`) */
|
|
519
|
+
cinematicEnded: CinematicEnded;
|
|
520
|
+
/** A player picked an answer of a cinematic's choice, as their screen said (see `cinematicChose`) */
|
|
521
|
+
cinematicChoice: CinematicChoice;
|
|
522
|
+
/** The rules play one of the view's effects at a place or on an entity, for everyone who sees it (see `world.effect`) */
|
|
523
|
+
effectStarted: EffectCue;
|
|
524
|
+
/** The rules stop an effect they played (see `world.stopEffect`) */
|
|
525
|
+
effectStopped: {
|
|
526
|
+
id: number;
|
|
527
|
+
fade?: number;
|
|
528
|
+
};
|
|
529
|
+
/**
|
|
530
|
+
* One hidden in a layer of cells moved in it, or stepped into it (`ConcealmentOptions.rustle`): told to the teams
|
|
531
|
+
* it names that do not see it (all of them, where none are named), where they see the ground, as a shake of what the
|
|
532
|
+
* layer draws there
|
|
533
|
+
*/
|
|
534
|
+
rustled: {
|
|
535
|
+
layer: string;
|
|
536
|
+
entity: Entity;
|
|
537
|
+
x: number;
|
|
538
|
+
z: number;
|
|
539
|
+
entered: boolean;
|
|
540
|
+
teams?: number[];
|
|
541
|
+
};
|
|
542
|
+
/**
|
|
543
|
+
* Cells of a layer (`Terrain.cells`) were set to a value (`setCells`): told to the players who see them, the others
|
|
544
|
+
* as they come into sight (`cellsSeen`)
|
|
545
|
+
*/
|
|
546
|
+
cellsChanged: {
|
|
547
|
+
layer: string;
|
|
548
|
+
cells: number[];
|
|
549
|
+
value: number;
|
|
550
|
+
};
|
|
551
|
+
/**
|
|
552
|
+
* Cells of a layer that changed out of a team's sight came into it (`TeamMemory.cells`): told to that team's players,
|
|
553
|
+
* the cells at `value` now
|
|
554
|
+
*/
|
|
555
|
+
cellsSeen: {
|
|
556
|
+
team: number;
|
|
557
|
+
layer: string;
|
|
558
|
+
cells: number[];
|
|
559
|
+
value: number;
|
|
560
|
+
};
|
|
561
|
+
/** A part of the ground was reshaped (`reshapeGround`): as it is now, told to every player */
|
|
562
|
+
groundReshaped: {
|
|
563
|
+
patch: TerrainPatch;
|
|
564
|
+
};
|
|
565
|
+
/** What the map looks like beyond its ground changed (`setEnvironment`): as it is now, told to every player */
|
|
566
|
+
/** `over`: the seconds the screens ease into it over, where the rules said */
|
|
567
|
+
environmentChanged: {
|
|
568
|
+
environment: MapEnvironment;
|
|
569
|
+
over?: number;
|
|
570
|
+
};
|
|
571
|
+
}
|
|
572
|
+
/**
|
|
573
|
+
* What a world checks of itself and of its game as it runs, over the process's: for tests, development, a server that
|
|
574
|
+
* runs games of its own
|
|
575
|
+
*
|
|
576
|
+
* @beta
|
|
577
|
+
*/
|
|
578
|
+
export interface WorldChecks {
|
|
579
|
+
/** The engine's checks on itself (`DebugChecks`): all on or off, some of them; the process's (`setDebugChecks`) when left out */
|
|
580
|
+
checks?: boolean | Partial<DebugChecks>;
|
|
581
|
+
}
|
|
582
|
+
/**
|
|
583
|
+
* What a world is made of (`new World`): its ground and ways, its game, its players, its systems and hooks, and what it
|
|
584
|
+
* checks of itself
|
|
585
|
+
*
|
|
586
|
+
* @beta
|
|
587
|
+
*/
|
|
588
|
+
export interface WorldOptions extends WorldChecks {
|
|
589
|
+
terrain: Terrain;
|
|
590
|
+
navigation: Navigation;
|
|
591
|
+
/** Where boats go (`UnitTypeDef.naval`): the deep water. None for a map without, and boats go on the ground */
|
|
592
|
+
waterNavigation?: Navigation;
|
|
593
|
+
/** The navigations the sides plan their routes on, of what each knows (`GameModule.paths: 'seen'`). None when left out */
|
|
594
|
+
sidePaths?: SidePaths;
|
|
595
|
+
registry: Registry;
|
|
596
|
+
players: PlayerInit[];
|
|
597
|
+
/** The races one is drawn from for a player given `random`: all of the game's when left out */
|
|
598
|
+
randomRaces?: readonly string[];
|
|
599
|
+
/** Makes the systems of the world, once it is made: what keeps state of its own keeps it for this world */
|
|
600
|
+
systems: (world: World) => System[];
|
|
601
|
+
/** Hook handlers. The engine's own (`coreHooks`) when left out */
|
|
602
|
+
hooks?: HookDef[];
|
|
603
|
+
/** How the game reacts to events, subscribed in this order once the world is made */
|
|
604
|
+
listeners?: ListenerDef[];
|
|
605
|
+
/** Parts of the map the rules watch */
|
|
606
|
+
areas?: AreaDef[];
|
|
607
|
+
/** What the game can set to go off later, by id */
|
|
608
|
+
timers?: TimerDef[];
|
|
609
|
+
/** Scripts of steps the game can start, by id */
|
|
610
|
+
sequences?: SequenceDef[];
|
|
611
|
+
seed?: number;
|
|
612
|
+
/** Simulation steps per second */
|
|
613
|
+
tickRate?: number;
|
|
614
|
+
/** The logger the world's own is made under (`world.log`): the root one when left out */
|
|
615
|
+
log?: Logger;
|
|
616
|
+
/** The least an entry of the world's log must matter to be said (`GameModule.log`) */
|
|
617
|
+
logLevel?: LogLevel;
|
|
618
|
+
/** What becomes of a part of the game that throws (`GameModule.onError`): it throws on, when left out */
|
|
619
|
+
onError?: ErrorPolicy;
|
|
620
|
+
}
|
|
621
|
+
/** @beta */
|
|
622
|
+
export interface DamageOptions {
|
|
623
|
+
/** Physical when left out */
|
|
624
|
+
damageType?: DamageType;
|
|
625
|
+
/** A basic attack: life steal works on it */
|
|
626
|
+
attack?: boolean;
|
|
627
|
+
/** It struck critically. The amount is what it is, this is for whoever is watching */
|
|
628
|
+
crit?: boolean;
|
|
629
|
+
/** The ability that dealt it, by id: for "immune to Ice Storm", or a kill feed. Left out for a basic attack */
|
|
630
|
+
ability?: string;
|
|
631
|
+
/** Words of the game's own about it (`'fire'`, `'explosive'`), for hooks and the screen to decide on */
|
|
632
|
+
tags?: string[];
|
|
633
|
+
/** How what this blow kills dies, for the screen (`'burnt'`): the death's `how` (`AttackDef.how`, `AbilityDef.how`) */
|
|
634
|
+
how?: string;
|
|
635
|
+
/** The attack's type by the game's damage table (`GameRules.combat.damageTable`): an ability's say, where a basic attack has its `AttackDef.attackType` */
|
|
636
|
+
attackType?: string;
|
|
637
|
+
}
|
|
638
|
+
/**
|
|
639
|
+
* What killed something that died of damage: the blow that did it
|
|
640
|
+
*
|
|
641
|
+
* @beta
|
|
642
|
+
*/
|
|
643
|
+
export interface DeathCause {
|
|
644
|
+
type: DamageType;
|
|
645
|
+
/** What the blow took off */
|
|
646
|
+
amount: number;
|
|
647
|
+
/** How much more it was than there was health left */
|
|
648
|
+
overkill: number;
|
|
649
|
+
crit: boolean;
|
|
650
|
+
ability?: string;
|
|
651
|
+
tags?: string[];
|
|
652
|
+
/** How the blow says what it kills dies (`DamageOptions.how`) */
|
|
653
|
+
how?: string;
|
|
654
|
+
}
|
|
655
|
+
/**
|
|
656
|
+
* Why something died, when it was not of damage: killed by the rules (`killed`, `world.kill`), its building called
|
|
657
|
+
* off (`cancelled`), its time out (`expired`), a resource used up (`depleted`), brought down by a blast (`felled`), taken
|
|
658
|
+
* away with what it stood on or by the debug tools (`removed`), or the game's own word (`sold`, `sacrificed`). `damage`
|
|
659
|
+
* for one that ran out of health
|
|
660
|
+
*
|
|
661
|
+
* @beta
|
|
662
|
+
*/
|
|
663
|
+
export type DeathReason = 'damage' | 'killed' | 'cancelled' | 'expired' | 'depleted' | 'felled' | 'removed' | (string & {});
|
|
664
|
+
/**
|
|
665
|
+
* A spot a team sees for a while, with nothing standing there
|
|
666
|
+
*
|
|
667
|
+
* @beta
|
|
668
|
+
*/
|
|
669
|
+
export interface Reveal {
|
|
670
|
+
id: number;
|
|
671
|
+
team: number;
|
|
672
|
+
x: number;
|
|
673
|
+
z: number;
|
|
674
|
+
radius: number;
|
|
675
|
+
/** Seconds it goes on */
|
|
676
|
+
left: number;
|
|
677
|
+
/** Shown, and nothing drawn for it: what the rules show a player, as a cinematic looks at it. A spell's, when left out */
|
|
678
|
+
quiet?: boolean;
|
|
679
|
+
}
|
|
680
|
+
/** @beta */
|
|
681
|
+
export interface SpawnOptions {
|
|
682
|
+
facing?: number;
|
|
683
|
+
/** How big it is drawn */
|
|
684
|
+
scale?: number;
|
|
685
|
+
/** Which of the models of its type it is drawn with, for things that come in kinds like trees */
|
|
686
|
+
look?: string;
|
|
687
|
+
/** A name of its own, for the rules to find it by: `world.named('gate')` */
|
|
688
|
+
name?: string;
|
|
689
|
+
/** Seconds it lasts, when that is not what its type says */
|
|
690
|
+
lifetime?: number;
|
|
691
|
+
/** Structures only: start as a construction site, with its build time and what was paid when they are not its type's */
|
|
692
|
+
underConstruction?: boolean | {
|
|
693
|
+
buildTime?: number;
|
|
694
|
+
paid?: Cost;
|
|
695
|
+
};
|
|
696
|
+
}
|
|
697
|
+
/** See `World.internals` */
|
|
698
|
+
export interface WorldInternals {
|
|
699
|
+
nextEntityId: number;
|
|
700
|
+
nextId: number;
|
|
701
|
+
clockShift: number;
|
|
702
|
+
/** The hour the clock stands at, when it does not move */
|
|
703
|
+
stillHour?: number;
|
|
704
|
+
commands: IssuedCommand[];
|
|
705
|
+
/** Who died and has not been taken out of the world yet: at the end of the tick that comes */
|
|
706
|
+
dead?: EntityId[];
|
|
707
|
+
}
|
|
708
|
+
/**
|
|
709
|
+
* What watches a world from outside (`World.watch`): told of each command a player gives it, each save taken of it,
|
|
710
|
+
* and each tick it ran
|
|
711
|
+
*
|
|
712
|
+
* @beta
|
|
713
|
+
*/
|
|
714
|
+
export interface WorldWatcher {
|
|
715
|
+
/** A command given from outside a tick, before the tick it is applied at runs */
|
|
716
|
+
command?(command: IssuedCommand): void;
|
|
717
|
+
/** A save was taken, which put the world's crowd back as a load puts it */
|
|
718
|
+
saved?(): void;
|
|
719
|
+
/** A tick ran */
|
|
720
|
+
stepped?(): void;
|
|
721
|
+
}
|
|
722
|
+
/** @beta */
|
|
723
|
+
export declare class World {
|
|
724
|
+
/** Obstacles the navigation had no room for (`RecastNavigationOptions.maxObstacles`): what is put down past it does not block the way */
|
|
725
|
+
obstaclesRefused: number;
|
|
726
|
+
readonly terrain: Terrain;
|
|
727
|
+
/** The ground it started on, where it was made from a map (S36): what a save keeps only the changes of */
|
|
728
|
+
ground?: GroundBase;
|
|
729
|
+
/** The ground and the air. Agents find their own layer, everything else is about the ground */
|
|
730
|
+
readonly nav: Navigation;
|
|
731
|
+
/**
|
|
732
|
+
* The navigations the sides plan their routes on, of the buildings each knows (`GameModule.paths: 'seen'`): routes
|
|
733
|
+
* of ground units are planned on their side's, and walked on `nav`. None where routes know everything
|
|
734
|
+
*
|
|
735
|
+
* @beta
|
|
736
|
+
*/
|
|
737
|
+
readonly sidePaths?: SidePaths;
|
|
738
|
+
/** The ground, the air and the water, to find where a kind of unit can be */
|
|
739
|
+
private readonly layers;
|
|
740
|
+
navFor(entity: Entity): Navigation;
|
|
741
|
+
/** The air alone */
|
|
742
|
+
readonly air: Navigation;
|
|
743
|
+
readonly registry: Registry;
|
|
744
|
+
readonly grid: BuildGrid;
|
|
745
|
+
readonly fog: FogOfWar;
|
|
746
|
+
readonly spatial: SpatialIndex;
|
|
747
|
+
/** What happened, for whoever watches: sessions, tests. Sent out at the end of each tick. Rules use `hooks` */
|
|
748
|
+
readonly events: Emitter;
|
|
749
|
+
/**
|
|
750
|
+
* What this world says about what it does: `world.log.warn('waves', 'nothing to send', { wave })`. Each entry says
|
|
751
|
+
* the game and the tick it is from, and goes to whoever asked (`world.log.to(sink)`) and to the logger the world
|
|
752
|
+
* was made under. It changes nothing in the world, and is not in a save
|
|
753
|
+
*/
|
|
754
|
+
readonly log: Logger;
|
|
755
|
+
/**
|
|
756
|
+
* The engine's checks on itself this world runs (`DebugChecks`): what it was made with (`CreateWorldOptions.checks`),
|
|
757
|
+
* the process's (`setDebugChecks`) when it says nothing. Slow: tests and development
|
|
758
|
+
*/
|
|
759
|
+
checks: DebugChecks;
|
|
760
|
+
/** Moved on by `invalidateStats` without an entity: every entity's stats are added up again when next asked for */
|
|
761
|
+
statsVersion: number;
|
|
762
|
+
/** What the debug tools follow of the rules as they run: hooks and listeners. Null when nobody asks, see `EventLog` */
|
|
763
|
+
trace: Trace | null;
|
|
764
|
+
/** Where game modules and mods take part in damage, deaths, orders and the like, see `HookEvents` */
|
|
765
|
+
readonly hooks: Hooks;
|
|
766
|
+
/** The areas of the game, and who is in them */
|
|
767
|
+
readonly areas: Areas;
|
|
768
|
+
/** What is set to go off later: `world.timers.after(30, waveComes)` */
|
|
769
|
+
readonly timers: Timers;
|
|
770
|
+
/** Scripts of steps that run over time: `world.sequences.start(briefing)` */
|
|
771
|
+
readonly sequences: Sequences;
|
|
772
|
+
/** What each player is set to do, in a mission */
|
|
773
|
+
readonly objectives: Objectives;
|
|
774
|
+
/**
|
|
775
|
+
* What the game counts of its players (`GameRules.score`): `world.score.add(player, 'towersLost')`, `get`, `team`.
|
|
776
|
+
* Counts nothing in a game that does not ask
|
|
777
|
+
*
|
|
778
|
+
* @beta
|
|
779
|
+
*/
|
|
780
|
+
readonly score: Score;
|
|
781
|
+
/** What is said, by whom, to whom: `world.dialog.say(player, line)`, or `talk` in a sequence */
|
|
782
|
+
readonly dialog: Dialog;
|
|
783
|
+
readonly rng: Rng;
|
|
784
|
+
readonly players: Map<number, Player>;
|
|
785
|
+
/** Everything in the world, by id. Fallen heroes stay in here while they wait to be brought back */
|
|
786
|
+
readonly entities: Map<number, Entity>;
|
|
787
|
+
/**
|
|
788
|
+
* The entities that are not scenery: the ones that move, act or change by themselves. Systems that run
|
|
789
|
+
* every tick go through these instead of `entities`, which on a big map is mostly trees.
|
|
790
|
+
*/
|
|
791
|
+
readonly actors: Map<number, Entity>;
|
|
792
|
+
/**
|
|
793
|
+
* The scenery each team sees right now, by team. Kept by the fog system whenever it works out what everyone sees:
|
|
794
|
+
* scenery never moves, so this only changes then. Lets a session describe what is in sight without testing every tree
|
|
795
|
+
*/
|
|
796
|
+
readonly sceneryInSight: Map<number, Set<Entity>>;
|
|
797
|
+
/** Entities by owner, heroes by owner, shops. For questions that would otherwise go through every entity */
|
|
798
|
+
readonly index: EntityIndex;
|
|
799
|
+
readonly projectiles: Projectile[];
|
|
800
|
+
readonly missiles: Missile[];
|
|
801
|
+
readonly delayed: Delayed[];
|
|
802
|
+
readonly zones: Zone[];
|
|
803
|
+
/** Switches for trying things out. A game that is played for real leaves them off */
|
|
804
|
+
readonly cheats: {
|
|
805
|
+
/** Abilities and what is carried can be used again at once */
|
|
806
|
+
noCooldowns: boolean;
|
|
807
|
+
/** Abilities cost no mana, and are cast with none left */
|
|
808
|
+
noManaCosts: boolean;
|
|
809
|
+
/** What the players allowed the debug tools own (`debugPlayers`) takes no harm, and so does not die of it */
|
|
810
|
+
invulnerable: boolean;
|
|
811
|
+
/** How fast the game goes, 1 as it should, 0 paused: whoever runs it (a session in the page, a server) goes by it */
|
|
812
|
+
speed: number;
|
|
813
|
+
};
|
|
814
|
+
/**
|
|
815
|
+
* Players who may use the debug commands (`debug.*`, see `debugCommands.ts`): who a session lets, a seat in the page
|
|
816
|
+
* that asked, a server started to. Not in a save: whoever loads it says again
|
|
817
|
+
*/
|
|
818
|
+
readonly debugPlayers: Set<number>;
|
|
819
|
+
/**
|
|
820
|
+
* The entity each object of the map became, by the object's id (`MapObject.id`): what the map put down as the world
|
|
821
|
+
* was made of it (`createWorldFromMap`), and what the editor's Play here put down since (`debug.mapObject`), for the
|
|
822
|
+
* editor to find again what it moves and takes away (EQ10). Kept in a save
|
|
823
|
+
*/
|
|
824
|
+
readonly mapEntities: Map<number, number>;
|
|
825
|
+
/** Spots a team sees for a while without anything there to see them */
|
|
826
|
+
readonly reveals: Reveal[];
|
|
827
|
+
/** State of game modules and mods for the whole game, see `state` */
|
|
828
|
+
readonly states: StateStore;
|
|
829
|
+
/** Items lying on the ground */
|
|
830
|
+
readonly items: GroundItem[];
|
|
831
|
+
/** Runs the systems, in order, each as often as it asks */
|
|
832
|
+
readonly scheduler: Scheduler;
|
|
833
|
+
/** The computer players: who is seated, kept in a save and seated again by a load (`world.computers.seat`) */
|
|
834
|
+
readonly computers: Computers;
|
|
835
|
+
/** What the world's numbers started from (`rng`): 1 when none was given. A computer player's own numbers start from it and its player */
|
|
836
|
+
readonly seed: number;
|
|
837
|
+
readonly tickRate: number;
|
|
838
|
+
/** Seconds per tick */
|
|
839
|
+
readonly dt: number;
|
|
840
|
+
tick: number;
|
|
841
|
+
/** How things are hurt, healed and die (`Life`) */
|
|
842
|
+
readonly life: Life;
|
|
843
|
+
/** What each team sees of the entities (`Sight`): the fog, what is invisible, the game's say */
|
|
844
|
+
readonly sight: Sight;
|
|
845
|
+
/** Who is on whose side (`Sides`): teams, relations, shared vision and control */
|
|
846
|
+
readonly sides: Sides;
|
|
847
|
+
/** How entities come into the world and are moved about in it (`Spawning`) */
|
|
848
|
+
readonly spawning: Spawning;
|
|
849
|
+
/** The time of day (`Clock`): the hour, night, turned forward or stopped */
|
|
850
|
+
readonly clock: Clock;
|
|
851
|
+
/** Team that won, once the game is decided */
|
|
852
|
+
winner: number | null;
|
|
853
|
+
/**
|
|
854
|
+
* What becomes of a part of the game that throws: a hook's handler, a listener, a system, a timer, an order, a
|
|
855
|
+
* command (`ErrorPolicy`). The game's own (`GameModule.onError`), or whoever runs the world's; with neither it
|
|
856
|
+
* throws, as it always did. A server and a launched game end the game where nothing is said (`??= 'end'`)
|
|
857
|
+
*/
|
|
858
|
+
errorPolicy?: ErrorPolicy;
|
|
859
|
+
/** Why the game ended on an error, once it has (`end`): the world is not stepped again */
|
|
860
|
+
failure: WorldFailure | null;
|
|
861
|
+
/** The parts switched off for having thrown (`disable`), by name (`siteKey`): kept in a save, and off again when it is loaded */
|
|
862
|
+
readonly disabled: Map<string, ErrorSite>;
|
|
863
|
+
/** True through a tick: an error then can end the game; outside one it is whoever called's */
|
|
864
|
+
private stepping;
|
|
865
|
+
private toldFailure;
|
|
866
|
+
/** Errors already answered `throw` further in: not asked about again on their way out */
|
|
867
|
+
private readonly thrown;
|
|
868
|
+
private nextEntityId;
|
|
869
|
+
private nextId;
|
|
870
|
+
private commands;
|
|
871
|
+
/** Commands each player gave since the last tick, from outside one: what `commandLimit` counts */
|
|
872
|
+
private readonly given;
|
|
873
|
+
/** Commands let go since the last tick, by player: told of at the next (`commandRejected`) */
|
|
874
|
+
private readonly overLimit;
|
|
875
|
+
/** Those of them the sender numbered: each answered at the next tick, refused (`commandHandled`), for a screen that waits on it */
|
|
876
|
+
private readonly overLimitSeqs;
|
|
877
|
+
/**
|
|
878
|
+
* Commands a player may give between two ticks, at most (`issue`, from outside a tick): those past it are let go,
|
|
879
|
+
* and the tick says so once (`commandRejected`, reason `tooManyCommands`), and answers each the sender numbered,
|
|
880
|
+
* refused (`commandHandled`). A server's rate limit keeps far under it; this bounds what has none (a worker, a
|
|
881
|
+
* page's own host, a script gone wrong). The computer and scripts, which give theirs in a tick, are not counted.
|
|
882
|
+
* 100 when left out; `Infinity` for none
|
|
883
|
+
*
|
|
884
|
+
* @beta
|
|
885
|
+
*/
|
|
886
|
+
commandLimit: number;
|
|
887
|
+
constructor(options: WorldOptions);
|
|
888
|
+
/** The systems, in the order they run */
|
|
889
|
+
get systems(): readonly System[];
|
|
890
|
+
/** Adds a system to the running world, like a computer player. It takes its place by its phase, `before` and `after` */
|
|
891
|
+
addSystem(system: System): void;
|
|
892
|
+
/** What systems kept in themselves when the game was saved, for those not added yet */
|
|
893
|
+
private readonly savedSystems;
|
|
894
|
+
/** Gives the systems what they kept in a save (see `System.save`): those there now, and those added later */
|
|
895
|
+
restoreSystems(saved: Record<string, unknown>): void;
|
|
896
|
+
/** Takes a system out by name. False when there is none of that name */
|
|
897
|
+
removeSystem(name: string): boolean;
|
|
898
|
+
get time(): number;
|
|
899
|
+
/** A number of the rules as it is tuned now (`TunableDef`): what it was set to while playing, or its default */
|
|
900
|
+
tunable(id: string): number;
|
|
901
|
+
/** Tunes a number of the rules, within its bounds, and says so (`tunableChanged`) */
|
|
902
|
+
setTunable(id: string, value: number): void;
|
|
903
|
+
/**
|
|
904
|
+
* Changes a definition while the game runs (S61): a unit type's health, an ability's cooldown, as the editor's Data
|
|
905
|
+
* panel tries them. What is made of it from then on is made of the new one; a unit type's units already in the world
|
|
906
|
+
* take it at once, with as much of their health lost as before. Kept with the world and in its save, and said
|
|
907
|
+
* (`definitionChanged`). False for a definition the game does not have
|
|
908
|
+
*/
|
|
909
|
+
redefine(kind: DataKind, id: string, values: DataValues): boolean;
|
|
910
|
+
/** State of a game module or a mod for the whole game: made from the component's default when first asked for */
|
|
911
|
+
state<T>(key: Component<T, unknown>): T;
|
|
912
|
+
setState<T>(key: Component<T, unknown>, value: T): void;
|
|
913
|
+
/** The game's numbers that are not about any one unit, like the supply cap (`GameModule.rules`) */
|
|
914
|
+
get rules(): Readonly<GameRules>;
|
|
915
|
+
/** Hour of the day, 0..24. Noon in a game without days (`clock.hour`) */
|
|
916
|
+
get hour(): number;
|
|
917
|
+
/** Whether the sun is down (`clock.night`): asked for every unit's sight and stats, many times a tick */
|
|
918
|
+
get night(): boolean;
|
|
919
|
+
/** Unique id for orders, order groups and projectiles */
|
|
920
|
+
newId(): number;
|
|
921
|
+
player(id: PlayerId): Player;
|
|
922
|
+
/** Whether an entity of this id was ever made here: one that died was, one of a number not yet given out never was */
|
|
923
|
+
made(id: EntityId): boolean;
|
|
924
|
+
/** Living entity with this id */
|
|
925
|
+
get(id: EntityId | undefined): Entity | undefined;
|
|
926
|
+
/**
|
|
927
|
+
* The entity of this name, while it lives: one named on the map in the editor, or in code. Nothing once it is
|
|
928
|
+
* dead, or when there never was one. A game can say which names there are: `world.named<RoadNames>('gate')`
|
|
929
|
+
*/
|
|
930
|
+
named<Name extends string = string>(name: Name): Entity | undefined;
|
|
931
|
+
/** The name an entity was given, if any */
|
|
932
|
+
nameOf(entity: Entity): string | undefined;
|
|
933
|
+
/**
|
|
934
|
+
* Names an entity, for the rules to find it by (`named`), or takes its name away with none. It has one name, and a
|
|
935
|
+
* name is one entity's: taking that of another that still lives throws. The name of the dead is free
|
|
936
|
+
*/
|
|
937
|
+
setName(entity: Entity, name: string | undefined): void;
|
|
938
|
+
/**
|
|
939
|
+
* What the map this world was made from says that is not an entity: its name, and what the game kept with it
|
|
940
|
+
* (`GameMap.data`). Kept in the world, so a save has it. Empty for a world made without a map
|
|
941
|
+
*/
|
|
942
|
+
get map(): WorldMap;
|
|
943
|
+
/** Whether two players fight each other (`sides.enemies`): asked of every target, every tick */
|
|
944
|
+
areEnemies(a: PlayerId, b: PlayerId): boolean;
|
|
945
|
+
/** Whether two players are on one side (`sides.allies`) */
|
|
946
|
+
areAllies(a: PlayerId, b: PlayerId): boolean;
|
|
947
|
+
/** Whether a player may command an entity (`sides.mayCommand`): what every command is checked against */
|
|
948
|
+
mayCommand(player: PlayerId, entity: Entity): boolean;
|
|
949
|
+
/** Whether a team currently sees the entity (`sight.sees`): asked of every entity, team and snapshot */
|
|
950
|
+
isVisibleTo(entity: Entity, team: number): boolean;
|
|
951
|
+
/**
|
|
952
|
+
* Creates an entity. Structures are centered on the grid cells closest to `position`;
|
|
953
|
+
* the caller is responsible for checking `grid.canPlace` when that matters.
|
|
954
|
+
*/
|
|
955
|
+
/**
|
|
956
|
+
* A prefab put down as one: its objects spawned for the owner given, its camps and areas with them, turned and sized
|
|
957
|
+
* around its middle (`spawnPrefab`)
|
|
958
|
+
*
|
|
959
|
+
* @beta
|
|
960
|
+
*/
|
|
961
|
+
spawnPrefab(prefab: PrefabDef | string, options: SpawnPrefabOptions): SpawnedPrefab;
|
|
962
|
+
spawn(typeId: string, owner: PlayerId, position: Vec2, options?: SpawnOptions): Entity;
|
|
963
|
+
/**
|
|
964
|
+
* Turns scenery into an actor, for good: something gave it a reason to be looked at every tick, like a buff
|
|
965
|
+
* that has to run out. Whatever does that to an entity calls this; the debug checks catch what forgets to.
|
|
966
|
+
*/
|
|
967
|
+
wake(entity: Entity): void;
|
|
968
|
+
/**
|
|
969
|
+
* Sets cells of one of the game's layers (`Terrain.cells`, `CellLayerDef`) to a value: by their indices, or those in
|
|
970
|
+
* a shape. A bush burnt, grass grown. The players who see a cell are told at once (a `cells` event), the others as it
|
|
971
|
+
* comes into their sight (`TeamMemory.cells`), and saves keep it. Returns the cells that changed
|
|
972
|
+
*/
|
|
973
|
+
/**
|
|
974
|
+
* Changes what the map looks like beyond its ground, as the game goes: a storm rolling in (`weather`), night mist
|
|
975
|
+
* (`fog`), the sky going red. Over what it was, field by field; a field given as undefined goes back to none. Every
|
|
976
|
+
* player sees it (an `environment` event), a save keeps it, and a player who joins later is told it as it is.
|
|
977
|
+
*
|
|
978
|
+
* `over` (seconds) has the screens ease into it, from what they show: the rain comes on, the wind gets up, the mist
|
|
979
|
+
* thickens. The world has the new look at once: a save or a player who joins sees it as it ends
|
|
980
|
+
*/
|
|
981
|
+
setEnvironment(change: Partial<MapEnvironment>, options?: {
|
|
982
|
+
over?: number;
|
|
983
|
+
}): void;
|
|
984
|
+
/**
|
|
985
|
+
* Plays one of the view's effects (`GameView.fx.defs`) on the screens of the players who see where it is, or those it is
|
|
986
|
+
* for (`to`): at a place (`at`), or on an entity (`on`, at a `point` of its model), with knobs (`params`). Its random
|
|
987
|
+
* parts go by a seed, the same on every screen. Nothing it does decides anything: it is not in the world's state, a
|
|
988
|
+
* save, or what a player who joins later is told. What it gives back stops it (`stopEffect`)
|
|
989
|
+
*
|
|
990
|
+
* @beta
|
|
991
|
+
*/
|
|
992
|
+
effect(effect: string, options?: EffectOptions): number;
|
|
993
|
+
/**
|
|
994
|
+
* Stops an effect the rules played (`effect`) on every screen, as its own `stop` says, over `fade` seconds
|
|
995
|
+
*
|
|
996
|
+
* @beta
|
|
997
|
+
*/
|
|
998
|
+
stopEffect(id: number, options?: {
|
|
999
|
+
fade?: number;
|
|
1000
|
+
}): void;
|
|
1001
|
+
setCells(layer: string, cells: readonly number[] | AreaShape, value: number): number[];
|
|
1002
|
+
/**
|
|
1003
|
+
* Reshapes a part of the ground as the game goes (`TerrainPatch`): its heights, cliffs, water, paint, what is kept
|
|
1004
|
+
* off it and the game's layers of cells, all at once, as the editor's Play here pushes the map's ground into the game
|
|
1005
|
+
* played (`debug.ground`, EQ10). What the rules go by follows: who sees whom from the levels, where can be built, and
|
|
1006
|
+
* the ways, cut again of the ground as it is now (`Navigation.reshape`: on this thread, every machine the same, and
|
|
1007
|
+
* not for nothing on a big map). What stands on it stays where it is. Every player is told (a `ground` event), and
|
|
1008
|
+
* saves keep it. Throws where the patch does not fit the ground (`terrainPatchProblem`)
|
|
1009
|
+
*
|
|
1010
|
+
* @beta
|
|
1011
|
+
*/
|
|
1012
|
+
reshapeGround(patch: TerrainPatch): void;
|
|
1013
|
+
/** Lets a team see a spot for a while, with nothing standing there */
|
|
1014
|
+
reveal(team: number, point: Vec2, radius: number, seconds: number, options?: {
|
|
1015
|
+
quiet?: boolean;
|
|
1016
|
+
}): Reveal;
|
|
1017
|
+
/** Puts a unit somewhere else, where it stands: the way through is not its concern. Structures stay where they were built */
|
|
1018
|
+
place(entity: Entity, point: Vec2): void;
|
|
1019
|
+
/**
|
|
1020
|
+
* Gives an entity to another player, from now on in everything: whose it is, whom it fights, what it counts for.
|
|
1021
|
+
* What it was doing is called off, and what it was making is given back to the one it belonged to
|
|
1022
|
+
*/
|
|
1023
|
+
setOwner(entity: Entity, owner: PlayerId): void;
|
|
1024
|
+
/**
|
|
1025
|
+
* Takes a unit out of the world for a while, or puts it back: a worker inside a gold mine, a unit carried in
|
|
1026
|
+
* something. While hidden it is not found, not seen and in nobody's way, and its orders wait. It comes back at
|
|
1027
|
+
* `at`, or where it went in, on the nearest ground it can stand on. Structures cannot hide
|
|
1028
|
+
*/
|
|
1029
|
+
setHidden(entity: Entity, hidden: boolean, at?: Vec2): void;
|
|
1030
|
+
/** Gives an entity a time after which it is gone by itself, like a ward, or takes it away with `null` */
|
|
1031
|
+
setLifetime(entity: Entity, seconds: number | null): void;
|
|
1032
|
+
/** Deals damage (`life.damage`): the hooks, armor and shields, health, death */
|
|
1033
|
+
damage(target: Entity, amount: number, source?: Entity, options?: DamageOptions): void;
|
|
1034
|
+
/** Heals (`life.heal`): how much it healed */
|
|
1035
|
+
heal(target: Entity, amount: number, source?: Entity): number;
|
|
1036
|
+
/** Kills (`life.kill`) */
|
|
1037
|
+
kill(entity: Entity, killer?: Entity, attack?: boolean, reason?: DeathReason): void;
|
|
1038
|
+
/**
|
|
1039
|
+
* Tells a player something, like why what they asked for cannot be done. The world says which message,
|
|
1040
|
+
* and the player's screen finds the words for it (see `Message`). A bare string is a key without params
|
|
1041
|
+
*/
|
|
1042
|
+
message(player: PlayerId, message: MessageRef, kind?: MessageKind): void;
|
|
1043
|
+
/**
|
|
1044
|
+
* Gives a player a hint (campaign plan CP5): a message of the kind `hint`, shown for `seconds` (the screen's own
|
|
1045
|
+
* time when left out), which a player who turned hints off in the settings does not see
|
|
1046
|
+
*/
|
|
1047
|
+
hint(player: PlayerId, message: MessageRef, options?: {
|
|
1048
|
+
seconds?: number;
|
|
1049
|
+
}): void;
|
|
1050
|
+
/** The command being carried out, to find out whether it was refused: see `executeCommand` */
|
|
1051
|
+
handling?: {
|
|
1052
|
+
player: PlayerId;
|
|
1053
|
+
refusal: Message | undefined;
|
|
1054
|
+
};
|
|
1055
|
+
/**
|
|
1056
|
+
* What a save needs that is the world's own business: id counters, the clock and the commands waiting for
|
|
1057
|
+
* the next tick. For `saveWorld` and `loadWorld` only
|
|
1058
|
+
*/
|
|
1059
|
+
internals(): WorldInternals;
|
|
1060
|
+
/** Puts back what `internals` gave, for `loadWorld` only */
|
|
1061
|
+
restoreInternals(internals: WorldInternals): void;
|
|
1062
|
+
/** Puts back who died and waits to be taken out (`WorldInternals.dead`), once the entities are back. For `loadWorld` only */
|
|
1063
|
+
restoreDead(ids: readonly EntityId[]): void;
|
|
1064
|
+
/**
|
|
1065
|
+
* Queues a player command. It is applied at the start of the next tick; talk (a command whose def says
|
|
1066
|
+
* `outsideTick`: chat, a ping) given between ticks is carried out at once, a paused game's too (RV14)
|
|
1067
|
+
*/
|
|
1068
|
+
issue(command: IssuedCommand): void;
|
|
1069
|
+
/** What watches the world from outside (`watch`) */
|
|
1070
|
+
private readonly watchers;
|
|
1071
|
+
/**
|
|
1072
|
+
* Watches the world from outside, for what records it (a replay of commands, `recordGame`): each command a player
|
|
1073
|
+
* gives it, each save taken of it, each tick. Changes nothing. Gives what stops watching
|
|
1074
|
+
*
|
|
1075
|
+
* @beta
|
|
1076
|
+
*/
|
|
1077
|
+
watch(watcher: WorldWatcher): () => void;
|
|
1078
|
+
/** A save of the world was taken, which put its crowd back (`saveWorld`): told to what watches it. The engine's */
|
|
1079
|
+
saved(): void;
|
|
1080
|
+
/** Advances the simulation by one fixed tick */
|
|
1081
|
+
/**
|
|
1082
|
+
* The entities that are all of what is asked, for scripts: whose they are, of which type, in which area. Only the
|
|
1083
|
+
* living, unless asked. A new list: for what runs every tick, go through `index` or `areas` instead
|
|
1084
|
+
*/
|
|
1085
|
+
find(filter?: {
|
|
1086
|
+
owner?: PlayerId;
|
|
1087
|
+
type?: string;
|
|
1088
|
+
area?: string;
|
|
1089
|
+
dead?: boolean;
|
|
1090
|
+
}): Entity[];
|
|
1091
|
+
/**
|
|
1092
|
+
* Marks a moment to start again from, like the start of a wave, with what the player is told it is ("Wave 6").
|
|
1093
|
+
* A session keeps a save of the world as it is at the end of this tick, for "Retry from wave 6"
|
|
1094
|
+
*/
|
|
1095
|
+
checkpoint(label: MessageRef): void;
|
|
1096
|
+
step(): void;
|
|
1097
|
+
/**
|
|
1098
|
+
* What a part of the game that threw comes to, by what the world says of errors (`errorPolicy`). It returns when
|
|
1099
|
+
* the part is to be switched off or let go (`disable`): the caller does that, and goes on. It throws otherwise: the
|
|
1100
|
+
* error itself (`throw`), or what leaves the tick of a game that ends there (`end`)
|
|
1101
|
+
*/
|
|
1102
|
+
caught(error: unknown, where: ErrorSite): void;
|
|
1103
|
+
/** Switches off the parts a save says were (`world.disabled`): the same game goes on as the one that was saved */
|
|
1104
|
+
disable(sites: Iterable<ErrorSite>): void;
|
|
1105
|
+
private advance;
|
|
1106
|
+
/** Throws when scenery has something that only actors get looked after for. See `debugChecks` */
|
|
1107
|
+
private checkScenery;
|
|
1108
|
+
/** Whether it was disposed: its navigation is freed, and it is not to be stepped again */
|
|
1109
|
+
get disposed(): boolean;
|
|
1110
|
+
private wasDisposed;
|
|
1111
|
+
/**
|
|
1112
|
+
* Frees what the world holds outside of JavaScript's memory: its navigation (a navmesh, its tiles and its crowd, in
|
|
1113
|
+
* WebAssembly, which is never collected by itself). Whoever made the world disposes it once done with it: the
|
|
1114
|
+
* session that owns it (`LocalSession`'s `ownsWorld`), the host (`SessionHost`'s), a test. Once is enough: again does
|
|
1115
|
+
* nothing
|
|
1116
|
+
*/
|
|
1117
|
+
dispose(): void;
|
|
1118
|
+
}
|