@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/game.d.ts
ADDED
|
@@ -0,0 +1,501 @@
|
|
|
1
|
+
import type { CellLayerDef } from './cellLayers';
|
|
2
|
+
import type { GameFileDef } from './gameFiles';
|
|
3
|
+
import { type ReplicatedEvent, type SnapshotPart } from './replication';
|
|
4
|
+
import type { PrefabDef } from './prefabs';
|
|
5
|
+
import type { MapGenerator } from './generate';
|
|
6
|
+
import type { ErrorPolicy } from './errors';
|
|
7
|
+
import type { Logger, LogLevel } from './log';
|
|
8
|
+
import type { Component } from './components';
|
|
9
|
+
import type { EventKey } from './events';
|
|
10
|
+
import type { EffectKind } from './abilities/effects';
|
|
11
|
+
import { type FormationDef } from './formation';
|
|
12
|
+
import { type CommandDef } from './commands';
|
|
13
|
+
import { type TunableDef } from './tunables';
|
|
14
|
+
import type { EditableData } from './gameData';
|
|
15
|
+
import type { HookDef } from './hooks';
|
|
16
|
+
import { type RaceDef } from './races';
|
|
17
|
+
import { type StartDef } from './start';
|
|
18
|
+
import { type AbilityDef, type BuffDef, type DayCycle, type ItemDef, type ResourceDef, type ResourceKind, type StatDef, type UnitTypeDef, type UpgradeDef, type UpkeepTier } from './defs';
|
|
19
|
+
import { type RecastNavigationOptions } from './navigation/recast';
|
|
20
|
+
import type { PlayerId } from './entity';
|
|
21
|
+
import type { BrainDef } from './ai/brain';
|
|
22
|
+
import type { GameAi } from './ai/profiles';
|
|
23
|
+
import type { GamePack } from './packs/pack';
|
|
24
|
+
import type { StatPart } from './stats';
|
|
25
|
+
import type { MapProblem } from './mapFields';
|
|
26
|
+
import { type MapEditorDef } from './mapFields';
|
|
27
|
+
import { type TileDef } from './tiles';
|
|
28
|
+
import { type GameMap } from './map';
|
|
29
|
+
import type { PlayerInit } from './player';
|
|
30
|
+
import { type OrderBehavior, Registry, type System, type SystemDef } from './registry';
|
|
31
|
+
import { type RulesInit } from './rules';
|
|
32
|
+
import type { Terrain } from './terrain';
|
|
33
|
+
import { type SaveRules, type WorldSave } from './save';
|
|
34
|
+
import { World, type WorldChecks } from './world';
|
|
35
|
+
import { type AreaDef } from './areas';
|
|
36
|
+
import { type SequenceDef } from './sequences';
|
|
37
|
+
import { type TimerDef } from './timers';
|
|
38
|
+
import type { ListenerDef } from './events';
|
|
39
|
+
/**
|
|
40
|
+
* The systems the engine brings along, by phase: decisions first, then movement, then everything that reacts to where
|
|
41
|
+
* units ended up. Within a phase, in this order. A module can do without any of them by name (`GameModule.withoutSystems`),
|
|
42
|
+
* or put its own in place of one by giving a system the same name
|
|
43
|
+
*
|
|
44
|
+
* @beta
|
|
45
|
+
*/
|
|
46
|
+
export declare const coreSystems: readonly System[];
|
|
47
|
+
/**
|
|
48
|
+
* A game module is the data and rules of one kind of game. The engine knows nothing
|
|
49
|
+
* about peasants or town halls, it gets all of that from here.
|
|
50
|
+
*
|
|
51
|
+
* @beta
|
|
52
|
+
*/
|
|
53
|
+
export interface GameModule {
|
|
54
|
+
id: string;
|
|
55
|
+
name: string;
|
|
56
|
+
/** `major.minor.patch`, for mods to say which versions of the game they work with. 1.0.0 when left out */
|
|
57
|
+
version?: string;
|
|
58
|
+
/** The mods on it, with their versions, when it was made with `composeGame` */
|
|
59
|
+
mods?: {
|
|
60
|
+
id: string;
|
|
61
|
+
version: string;
|
|
62
|
+
hash?: string;
|
|
63
|
+
}[];
|
|
64
|
+
/**
|
|
65
|
+
* Players a map of the game may have, besides the neutral and the creeps: 8 when left out, 32 at most
|
|
66
|
+
* (`MAX_MAP_PLAYERS`). A map with more is refused, saying so, not cut
|
|
67
|
+
*/
|
|
68
|
+
maxPlayers?: number;
|
|
69
|
+
units: UnitTypeDef[];
|
|
70
|
+
/**
|
|
71
|
+
* The sides players can play, each with its own roster (`UnitTypeDef.race`): none when left out, and with that no
|
|
72
|
+
* race anywhere. The first is what a player plays when nobody chose
|
|
73
|
+
*/
|
|
74
|
+
races?: RaceDef[];
|
|
75
|
+
upgrades?: UpgradeDef[];
|
|
76
|
+
abilities?: AbilityDef[];
|
|
77
|
+
buffs?: BuffDef[];
|
|
78
|
+
items?: ItemDef[];
|
|
79
|
+
/** What players have amounts of and pay with, in the order they are shown. None when left out */
|
|
80
|
+
resources?: ResourceDef[];
|
|
81
|
+
/** The resource prices, bounties, revives and sales are in. The first resource when left out */
|
|
82
|
+
currency?: ResourceKind;
|
|
83
|
+
upkeep?: UpkeepTier[];
|
|
84
|
+
/** Stats of the game's own, next to the engine's (`CoreStats`). Units, buffs, items and upgrades change them, and abilities scale with them, like any other */
|
|
85
|
+
stats?: StatDef[];
|
|
86
|
+
/** Day and night. Always day when left out */
|
|
87
|
+
day?: DayCycle;
|
|
88
|
+
/** The numbers of the game that are not about any one unit, like the supply cap. The engine's for those left out */
|
|
89
|
+
rules?: RulesInit;
|
|
90
|
+
/**
|
|
91
|
+
* Kinds of effects abilities can have, next to the ones the engine knows (`defineEffect`): one of a type the engine has
|
|
92
|
+
* takes its place
|
|
93
|
+
*/
|
|
94
|
+
effects?: EffectKind[];
|
|
95
|
+
/** Extra order types, or replacements for the core ones */
|
|
96
|
+
orders?: OrderBehavior[];
|
|
97
|
+
/**
|
|
98
|
+
* Formations of its own for units ordered to a point together (`FormationDef`), next to the engine's `rows`,
|
|
99
|
+
* `circle`, `square` and `none`, or in place of one of the same id. Which an order takes is the order's to say
|
|
100
|
+
* (`OrderInit.formation`), and the rules' where it does not (`GameRules.movement.formation`)
|
|
101
|
+
*/
|
|
102
|
+
formations?: FormationDef[];
|
|
103
|
+
/** Commands of the game's own, made with `defineCommand`, or replacements for the core ones */
|
|
104
|
+
commands?: CommandDef[];
|
|
105
|
+
/** Types of the engine's own commands, or a pack's, the module does without (`coreCommands`, `heroCommands`) @beta */
|
|
106
|
+
withoutCommands?: string[];
|
|
107
|
+
/** Types of the engine's own orders, or a pack's, the module does without: a unit is then never given one @beta */
|
|
108
|
+
withoutOrders?: string[];
|
|
109
|
+
/**
|
|
110
|
+
* The parts of the rules the game opts into, with what they bring (`GamePack`): `[withHeroes()]` for heroes, camps
|
|
111
|
+
* and shops. None when left out. The game's own commands, orders, systems and hooks come after a pack's, and one of
|
|
112
|
+
* the same id takes its place
|
|
113
|
+
*
|
|
114
|
+
* @beta
|
|
115
|
+
*/
|
|
116
|
+
packs?: GamePack[];
|
|
117
|
+
/**
|
|
118
|
+
* Systems of the game's own. They run after the core ones unless they give a phase (see `System`); one with the name
|
|
119
|
+
* of a core system takes its place, and its phase too unless it gives its own. A function makes a system for each
|
|
120
|
+
* world: what keeps state between ticks has to be made that way, or every game made from the module shares it
|
|
121
|
+
*/
|
|
122
|
+
systems?: SystemDef[];
|
|
123
|
+
/** Names of the engine's own systems the module does without (see `coreSystems`) */
|
|
124
|
+
withoutSystems?: string[];
|
|
125
|
+
/** Handlers of hooks: how the module takes part in damage, deaths, orders. One with the id of a core one takes its place */
|
|
126
|
+
hooks?: HookDef[];
|
|
127
|
+
/** Ids of the engine's own hook handlers the module does without, like `bounty` (see `coreHooks`) */
|
|
128
|
+
withoutHooks?: string[];
|
|
129
|
+
/** How the game reacts to events, the engine's and its own (see `defineListener`) */
|
|
130
|
+
listeners?: ListenerDef[];
|
|
131
|
+
/**
|
|
132
|
+
* The state of its own the game keeps (see `defineComponent`): on entities, players and the world. Given here as
|
|
133
|
+
* timers and listeners are, so that a world knows who is told which (`replicate`) from its own game, and not from
|
|
134
|
+
* whatever else the process has loaded. One used without being listed is an error (`UnlistedError`): no world
|
|
135
|
+
* finds it, so a save or a snapshot would lose it
|
|
136
|
+
*/
|
|
137
|
+
components?: Component<any>[];
|
|
138
|
+
/** The events of its own the game emits (see `defineEvent`): given here for the same reason */
|
|
139
|
+
events?: EventKey<any>[];
|
|
140
|
+
/** Parts of the map the rules watch: who walks in and out (see `AreaDef`) */
|
|
141
|
+
areas?: AreaDef[];
|
|
142
|
+
/** Groups of things the game spawns as one (see `definePrefab`, `world.spawnPrefab`); a designer's from the editor through `prefabsFrom` */
|
|
143
|
+
prefabs?: PrefabDef[];
|
|
144
|
+
/** What the game sets to go off later (see `defineTimer`): given here, so that a save finds them by id */
|
|
145
|
+
timers?: TimerDef[];
|
|
146
|
+
/** Scripts of steps the game starts, like a mission's (see `defineSequence`): given here, so that a save finds them */
|
|
147
|
+
sequences?: SequenceDef[];
|
|
148
|
+
/** Files of the game's own data its rules read as they run, and a panel edits (see `defineGameFile`, `registry.file`) */
|
|
149
|
+
files?: GameFileDef<unknown>[];
|
|
150
|
+
/** Decides who is out and who won. The last team with a building, when left out. Null for a game nobody can lose */
|
|
151
|
+
victory?: SystemDef | null;
|
|
152
|
+
/**
|
|
153
|
+
* How its saves outlive its patches (`SaveRules`): the version of what it keeps in a save, the steps that bring an
|
|
154
|
+
* older save up to it, and what becomes of a save made with other rules. A game that declares it, even empty, loads
|
|
155
|
+
* the saves made before a patch; one that does not refuses every save not made with its very rules, as a test wants
|
|
156
|
+
*/
|
|
157
|
+
saves?: SaveRules;
|
|
158
|
+
/**
|
|
159
|
+
* Runs once a world is loaded from a save, everything put back: for what a game keeps outside the world, to make
|
|
160
|
+
* again from what is in it
|
|
161
|
+
*/
|
|
162
|
+
afterLoad?: (world: World) => void;
|
|
163
|
+
/**
|
|
164
|
+
* Runs as a world takes a new version of the game while it runs (hot reload, `reloadGame`), the new version's: for
|
|
165
|
+
* what the game made of the old one (a cache of its definitions, a state worked out of them), to make again. What
|
|
166
|
+
* else hears it: `world.events.on(gameReloaded, …)`, and a screen's `GameView.on`
|
|
167
|
+
*/
|
|
168
|
+
onReload?: (world: World) => void;
|
|
169
|
+
/** What the game does on a server, around its games: who joins and leaves, the start and the end (see `ServerHooks`) */
|
|
170
|
+
server?: ServerHooks;
|
|
171
|
+
/** What a player starts a map with, for players the map places nothing for: a hall and workers as data, or a function (`StartDef`) */
|
|
172
|
+
start?: StartDef;
|
|
173
|
+
/**
|
|
174
|
+
* The brains of its computer players (`defineBrain`), given here as components and timers are, so that a save that
|
|
175
|
+
* remembers a seat by its brain's id (`world.computers.seat`) finds the brain again when loaded. The first is what a
|
|
176
|
+
* seat that names no brain gets: `meleeBrain` of `@v12-engine/engine/ai` for a game played as melee, or a computer
|
|
177
|
+
* player of the game's own (`defineComputer`). None listed: the game has no computer player, and seating one throws
|
|
178
|
+
*/
|
|
179
|
+
brains?: BrainDef[];
|
|
180
|
+
/**
|
|
181
|
+
* What it says of its computer players' profiles (`GameAi`, AI plan D1): difficulties and personalities of its own
|
|
182
|
+
* beside the engine's, defaults over the engine's, and whether a lobby offers each seat a difficulty and a
|
|
183
|
+
* personality (`seatSettingsOf`)
|
|
184
|
+
*/
|
|
185
|
+
ai?: GameAi;
|
|
186
|
+
/**
|
|
187
|
+
* What the ground of its maps can be painted with, in order: the first is index 1 of `Terrain.tiles`, 0 being no
|
|
188
|
+
* paint (see `TileDef`). What each looks like is the view's (`GameView.ground.tiles`)
|
|
189
|
+
*/
|
|
190
|
+
tiles?: TileDef[];
|
|
191
|
+
/**
|
|
192
|
+
* Its own layers of cells, for its rules to read and the editor to paint: where the bushes are (see `CellLayerDef`).
|
|
193
|
+
* Any layer can be read and set by id whether it is listed or not; listed, the editor offers it
|
|
194
|
+
*/
|
|
195
|
+
cellLayers?: CellLayerDef[];
|
|
196
|
+
/** Numbers of its rules to be tuned while it plays (`defineTunable`), read with `world.tunable(id)` */
|
|
197
|
+
tunables?: TunableDef[];
|
|
198
|
+
/**
|
|
199
|
+
* The maps the game ships (S36): a world made from one of them keeps, in its save and in the welcome a server sends,
|
|
200
|
+
* only what changed of its ground, and whoever reads it finds the rest here (by its name and the ground it makes).
|
|
201
|
+
* Not in the game's hash. A map not among them, or changed since, is kept whole, as before
|
|
202
|
+
*/
|
|
203
|
+
maps?: readonly GameMap[];
|
|
204
|
+
/**
|
|
205
|
+
* Its generator of maps (`MapGenerator`, `generateMap`): what the editor's New map from a generator and the page's
|
|
206
|
+
* Random map make a map with, its parameters as their sliders. None when left out: the engine's `presetGenerator`
|
|
207
|
+
* is there to take, with the game's trees and rocks
|
|
208
|
+
*/
|
|
209
|
+
generator?: MapGenerator;
|
|
210
|
+
/**
|
|
211
|
+
* Which fields of its definitions the editor's Data panel may change (S61): `all`, or by kind (`units`,
|
|
212
|
+
* `abilities`, `buffs`, `items`, `upgrades`) all of them, some (their paths, `stats.health`, or fields said in full,
|
|
213
|
+
* with bounds and a kind), or each definition's own in code. None when left out. What is changed there is kept in
|
|
214
|
+
* the game's `data.json`, which the game reads over its code with `withData`
|
|
215
|
+
*/
|
|
216
|
+
editable?: EditableData;
|
|
217
|
+
/**
|
|
218
|
+
* How its worlds find their way: the radius the walkable ground is cut for, how steep it may be, how many units the
|
|
219
|
+
* crowd makes room for at first (`maxAgents`). What a world is made with (`CreateWorldOptions.navigation`) goes over it
|
|
220
|
+
*/
|
|
221
|
+
navigation?: RecastNavigationOptions;
|
|
222
|
+
/**
|
|
223
|
+
* What a route of a ground unit knows of the buildings in its way (determinism plan F2): `all` of them (the default),
|
|
224
|
+
* as the ground is; or only those its side has `seen`, so the way it goes in the dark says nothing of what is there.
|
|
225
|
+
* With `seen`, each side has a navigation of its own to plan on, of what it knows: a few megabytes a side on a big
|
|
226
|
+
* map. Units still walk around every building: they see one before they reach it, and plan again
|
|
227
|
+
*
|
|
228
|
+
* @beta
|
|
229
|
+
*/
|
|
230
|
+
paths?: 'all' | 'seen';
|
|
231
|
+
/**
|
|
232
|
+
* How much its worlds say (`world.log`): the least an entry must matter to be said, everything when left out.
|
|
233
|
+
* Where the entries go is whoever runs the game's to say (`world.log.to`, the logger a world is made under)
|
|
234
|
+
*/
|
|
235
|
+
log?: {
|
|
236
|
+
level?: LogLevel;
|
|
237
|
+
};
|
|
238
|
+
/**
|
|
239
|
+
* What becomes of a part of the game that throws (a hook's handler, a listener, a system, a timer, an order, a
|
|
240
|
+
* command): `throw` (the error goes on: tests), `end` (the game ends there, the players told), `disable` (the part
|
|
241
|
+
* is switched off and the game goes on), or a function that says which for each. When left out: a world throws, and
|
|
242
|
+
* a server and a launched game end the game (`world.errorPolicy`)
|
|
243
|
+
*/
|
|
244
|
+
onError?: ErrorPolicy;
|
|
245
|
+
/** What the game brings to the map editor (see `MapEditorDef`) */
|
|
246
|
+
editor?: MapEditorDef;
|
|
247
|
+
/**
|
|
248
|
+
* What the game tells each player about itself, beyond what the engine knows: the wave a tower defense is at,
|
|
249
|
+
* a score, a countdown. Plain data that survives being sent; it goes into every snapshot as `report`, where the
|
|
250
|
+
* game's view (`GameView.hud.status`) puts it on the screen. Only what that player may know
|
|
251
|
+
*/
|
|
252
|
+
report?: (world: World, player: PlayerId) => Record<string, unknown>;
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* A seat at a game on a server: a player who joined, or a computer player
|
|
256
|
+
*
|
|
257
|
+
* @beta
|
|
258
|
+
*/
|
|
259
|
+
export interface ServerSeat {
|
|
260
|
+
player: PlayerId;
|
|
261
|
+
name: string;
|
|
262
|
+
ai: boolean;
|
|
263
|
+
/** Whether someone is connected to it right now */
|
|
264
|
+
connected: boolean;
|
|
265
|
+
/** The team it plays for, where the mode says: who it is with and against */
|
|
266
|
+
team?: number;
|
|
267
|
+
/** Whether who sits there said they are ready, in the lobby: once every player seated is, the game starts */
|
|
268
|
+
ready?: boolean;
|
|
269
|
+
/** What is chosen for this seat (`ServerHooks.seatSettings`), by name: none where the game has no such settings */
|
|
270
|
+
settings?: Record<string, string>;
|
|
271
|
+
/** Settings of the seat the mode fixes (`ModeSeat.fixed`: a race the map gives its player), by name: not the lobby's to change */
|
|
272
|
+
fixed?: string[];
|
|
273
|
+
/** Who sits there, as they are rated (`ratedId`: a hash of their key, safe to show), and their rating in the mode where the server keeps ratings */
|
|
274
|
+
rated?: string;
|
|
275
|
+
rating?: number;
|
|
276
|
+
/** A vote to let who sits there go (`kick`), in the lobby: how many voted, and how many it takes */
|
|
277
|
+
kick?: {
|
|
278
|
+
votes: number;
|
|
279
|
+
needed: number;
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* How a game on a server ended: who won, and each seat's outcome
|
|
284
|
+
*
|
|
285
|
+
* @beta
|
|
286
|
+
*/
|
|
287
|
+
export interface GameResult {
|
|
288
|
+
game: string;
|
|
289
|
+
mode: string;
|
|
290
|
+
/** The winning team, or null for a game that was stopped */
|
|
291
|
+
winner: number | null;
|
|
292
|
+
/** Seconds of game time */
|
|
293
|
+
duration: number;
|
|
294
|
+
/** What the players were told, for a game that ended on an error and not by its rules (`World.failure`) */
|
|
295
|
+
failed?: string;
|
|
296
|
+
seats: (ServerSeat & {
|
|
297
|
+
outcome: 'victory' | 'defeat' | 'none';
|
|
298
|
+
})[];
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* What a game does on a server (`GameModule.server`). Only ever run there: a player's screen has none of it. The
|
|
302
|
+
* lobby's settings come to `onGameStart` as the lobby left them
|
|
303
|
+
*
|
|
304
|
+
* @beta
|
|
305
|
+
*/
|
|
306
|
+
export interface ServerHooks {
|
|
307
|
+
/** Settings of the lobby, by name: what can be chosen, and what is chosen until someone does */
|
|
308
|
+
settings?: Record<string, LobbySetting>;
|
|
309
|
+
/**
|
|
310
|
+
* Settings of each seat, by name: a race, a difficulty, a colour. Chosen in the lobby by who sits there, and for a
|
|
311
|
+
* seat the computer plays or nobody holds, by any player seated; each seat's (`ServerSeat.settings`) are handed to
|
|
312
|
+
* its computer player (`GameMode.ai`) and to the start (`onGameStart`)
|
|
313
|
+
*/
|
|
314
|
+
seatSettings?: Record<string, LobbySetting>;
|
|
315
|
+
/** Someone took a seat in the lobby, or came back to theirs in a game (`world` then) */
|
|
316
|
+
onPlayerJoin?(seat: ServerSeat, world?: World): void;
|
|
317
|
+
/** Someone left their seat: in the lobby, or in a game (`world` then), where they may come back */
|
|
318
|
+
onPlayerLeave?(seat: ServerSeat, world?: World): void;
|
|
319
|
+
/** The game starts, with the world made and the lobby's settings */
|
|
320
|
+
onGameStart?(world: World, seats: readonly ServerSeat[], settings: Record<string, string>): void;
|
|
321
|
+
/** The game ended: who won, as plain data, before it is kept (`saveResult`) */
|
|
322
|
+
onGameEnd?(world: World, result: GameResult): void;
|
|
323
|
+
/** Keeps a game's result: in a file, a database, a ranking. A server writes it to a file of its own without */
|
|
324
|
+
saveResult?(result: GameResult): void | Promise<void>;
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* A setting of a lobby or of a seat (`ServerHooks.settings`, `seatSettings`)
|
|
328
|
+
*
|
|
329
|
+
* @beta
|
|
330
|
+
*/
|
|
331
|
+
export interface LobbySetting {
|
|
332
|
+
label: string;
|
|
333
|
+
/** What can be chosen, as it is kept */
|
|
334
|
+
options: string[];
|
|
335
|
+
/** What each option is shown as, where it is not the option itself */
|
|
336
|
+
labels?: Record<string, string>;
|
|
337
|
+
/** What is chosen until someone does */
|
|
338
|
+
default: string;
|
|
339
|
+
/** Of a seat: no two seats may hold the same (a colour). One held by another seat is not chosen */
|
|
340
|
+
unique?: boolean;
|
|
341
|
+
}
|
|
342
|
+
/** @beta */
|
|
343
|
+
export interface CreateWorldOptions extends WorldChecks {
|
|
344
|
+
terrain: Terrain;
|
|
345
|
+
game: GameModule;
|
|
346
|
+
players: PlayerInit[];
|
|
347
|
+
/** The races one is drawn from for a player given `random` (`PlayerInit.race`): all of the game's when left out */
|
|
348
|
+
randomRaces?: readonly string[];
|
|
349
|
+
seed?: number;
|
|
350
|
+
/**
|
|
351
|
+
* Simulation steps per second: 30 when left out. A save made at another rate is refused (`loadWorld`), so a game
|
|
352
|
+
* that changes it starts new games
|
|
353
|
+
*
|
|
354
|
+
* @beta
|
|
355
|
+
*/
|
|
356
|
+
tickRate?: number;
|
|
357
|
+
navigation?: RecastNavigationOptions;
|
|
358
|
+
/**
|
|
359
|
+
* Components the app keeps in the world beside the game's own (`GameModule.components`): what is the app's, not
|
|
360
|
+
* the game's rules (where the screen is played from, a tool's own; `Component.portable` false). Its game's and the
|
|
361
|
+
* engine's when left out: one neither lists is an error (`UnlistedError`)
|
|
362
|
+
*/
|
|
363
|
+
components?: readonly Component<unknown, unknown>[];
|
|
364
|
+
/** The logger the world's own is made under (`world.log`): a server's, a page's. The root one when left out */
|
|
365
|
+
log?: Logger;
|
|
366
|
+
/** What becomes of a part of the game that throws, where the game does not say (`GameModule.onError`) */
|
|
367
|
+
onError?: ErrorPolicy;
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* A game put together with its packs (`assembleGame`): every list the engine runs, the packs' in it, in one place. A
|
|
371
|
+
* pack's parts come before the game's own, so that one of the game's of the same id or name takes its place; what the
|
|
372
|
+
* game leaves out of the engine's (`withoutCommands`, `withoutOrders`, `withoutHooks`, `withoutSystems`) it leaves out
|
|
373
|
+
* of its packs' too
|
|
374
|
+
*
|
|
375
|
+
* @beta
|
|
376
|
+
*/
|
|
377
|
+
export interface AssembledGame {
|
|
378
|
+
readonly game: GameModule;
|
|
379
|
+
/** The packs' commands and the game's */
|
|
380
|
+
readonly commands: readonly CommandDef[];
|
|
381
|
+
/** The packs' orders and the game's */
|
|
382
|
+
readonly orders: readonly OrderBehavior[];
|
|
383
|
+
/** The packs' systems, as given (made for each world, and left out by name then: `withoutSystems`) */
|
|
384
|
+
readonly packSystems: readonly SystemDef[];
|
|
385
|
+
readonly hooks: readonly HookDef[];
|
|
386
|
+
readonly listeners: readonly ListenerDef[];
|
|
387
|
+
/** The packs' kinds of effects (`GamePack.effects`), before the game's own */
|
|
388
|
+
readonly effects: readonly EffectKind[];
|
|
389
|
+
readonly timers: readonly TimerDef[];
|
|
390
|
+
readonly components: readonly Component<unknown, unknown>[];
|
|
391
|
+
readonly events: readonly EventKey<unknown>[];
|
|
392
|
+
readonly statParts: readonly StatPart[];
|
|
393
|
+
/** The stats of the game: its packs' (`GamePack.stats`), then its own (`GameModule.stats`) */
|
|
394
|
+
readonly stats: readonly StatDef[];
|
|
395
|
+
/** The packs' ways of telling the players of the world's events (`GamePack.replications`) */
|
|
396
|
+
readonly replications: readonly ReplicatedEvent[];
|
|
397
|
+
/** The packs' parts of the players' snapshots (`GamePack.snapshotParts`) */
|
|
398
|
+
readonly snapshotParts: readonly SnapshotPart[];
|
|
399
|
+
/** The game's rules with what each pack lays over them, in order */
|
|
400
|
+
readonly rules: RulesInit;
|
|
401
|
+
/** The game's report of a player at the end, with each pack's beside it: none where none says */
|
|
402
|
+
readonly report: ((world: World, player: PlayerId) => Record<string, unknown>) | null;
|
|
403
|
+
/** How it is won: the game's own where it says, else the last pack's that says, else the engine's (`lastTeamStanding`) */
|
|
404
|
+
readonly victory: SystemDef | null | undefined;
|
|
405
|
+
/** What the game and its packs find wrong with a map, in the editor */
|
|
406
|
+
readonly check: ((map: GameMap, registry: Registry) => MapProblem[]) | undefined;
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* A game with its packs put together (`AssembledGame`): what the registry, the systems, the hooks, the listeners and the
|
|
410
|
+
* timers of a world of it are made of. Refuses a pack without one it says it goes with (`GamePack.requires`)
|
|
411
|
+
*
|
|
412
|
+
* @beta
|
|
413
|
+
*/
|
|
414
|
+
export declare function assembleGame(game: GameModule): AssembledGame;
|
|
415
|
+
/**
|
|
416
|
+
* Everything a game module defines, looked up by id: with the engine's own components, and those an app keeps in its
|
|
417
|
+
* worlds (`own`: `CreateWorldOptions.components`)
|
|
418
|
+
*
|
|
419
|
+
* @beta
|
|
420
|
+
*/
|
|
421
|
+
export declare function createRegistry(game: GameModule, own?: readonly Component<unknown, unknown>[]): Registry;
|
|
422
|
+
/** @beta */
|
|
423
|
+
export declare function createWorld(options: CreateWorldOptions): Promise<World>;
|
|
424
|
+
/**
|
|
425
|
+
* The engine's hook handlers without the ones the module does without, then the module's own
|
|
426
|
+
*
|
|
427
|
+
* @beta
|
|
428
|
+
*/
|
|
429
|
+
export interface LoadWorldOptions extends WorldChecks {
|
|
430
|
+
/** The game module the save was made with, by id. A save holds no code: rules come from here */
|
|
431
|
+
game: GameModule;
|
|
432
|
+
/**
|
|
433
|
+
* The map it is loaded on (a scene that opens its map again): its definitions are laid over the game's in place
|
|
434
|
+
* of those the save kept (`GameMap.definitions`). The save's own when left out
|
|
435
|
+
*/
|
|
436
|
+
map?: Pick<GameMap, 'definitions'>;
|
|
437
|
+
navigation?: RecastNavigationOptions;
|
|
438
|
+
/** Components the app keeps in the world beside the game's own, as `CreateWorldOptions.components`: those of the world saved */
|
|
439
|
+
components?: readonly Component<unknown, unknown>[];
|
|
440
|
+
/**
|
|
441
|
+
* Loads a save made with other rules of the game (its code or its mods changed since) whatever the game says of
|
|
442
|
+
* those (`GameModule.saves.onMismatch`). An older version of its saves is brought up to date all the same
|
|
443
|
+
*/
|
|
444
|
+
anyVersion?: boolean;
|
|
445
|
+
/** The logger the world's own is made under, as `CreateWorldOptions.log` */
|
|
446
|
+
log?: Logger;
|
|
447
|
+
/** What becomes of a part of the game that throws, as `CreateWorldOptions.onError` */
|
|
448
|
+
onError?: ErrorPolicy;
|
|
449
|
+
/** The maps a save's ground may be one of (S36): the game's own (`GameModule.maps`) when left out */
|
|
450
|
+
maps?: readonly GameMap[];
|
|
451
|
+
}
|
|
452
|
+
/**
|
|
453
|
+
* A world from a save (see `saveWorld`), carrying on where it was. A save made before, by an older engine or by the
|
|
454
|
+
* game before a patch, is brought up to date first (`updateSave`), or refused with a `SaveError` that says why.
|
|
455
|
+
* Navigation is built again; units come back with the speed and destination they had, but the way they find around
|
|
456
|
+
* each other is worked out anew, so the game from there on is close to, and not quite, the one that was saved
|
|
457
|
+
*
|
|
458
|
+
* @beta
|
|
459
|
+
*/
|
|
460
|
+
export declare function loadWorld(saved: WorldSave, options: LoadWorldOptions): Promise<World>;
|
|
461
|
+
/** @beta */
|
|
462
|
+
export interface MapWorldOptions {
|
|
463
|
+
map: GameMap;
|
|
464
|
+
game: GameModule;
|
|
465
|
+
/**
|
|
466
|
+
* The race each player plays, by player (`GameModule.races`): one of the game's, or `random`. Chosen in a lobby, a
|
|
467
|
+
* page's own menu. Those left out play what the map fixes for them (`MapPlayer.race`), or the game's first
|
|
468
|
+
*/
|
|
469
|
+
races?: Readonly<Record<PlayerId, string>>;
|
|
470
|
+
/** The team each player plays for, by player, over the map's (`MapPlayer.team`): chosen in a lobby */
|
|
471
|
+
teams?: Readonly<Record<PlayerId, number>>;
|
|
472
|
+
/** The colour of each player, by player, over the map's (`MapPlayer.color`): chosen in a lobby */
|
|
473
|
+
colors?: Readonly<Record<PlayerId, [number, number, number]>>;
|
|
474
|
+
/**
|
|
475
|
+
* Whether the world has the creeps player. When the map has something for it when left out: a camp, or something
|
|
476
|
+
* placed for the creeps. A world without camps that had one anyway would never be won: a team would always be left
|
|
477
|
+
*/
|
|
478
|
+
creeps?: boolean;
|
|
479
|
+
seed?: number;
|
|
480
|
+
navigation?: RecastNavigationOptions;
|
|
481
|
+
/** Components the app keeps in the world beside the game's own, as `CreateWorldOptions.components` */
|
|
482
|
+
components?: readonly Component<unknown, unknown>[];
|
|
483
|
+
/** The logger the world's own is made under, as `CreateWorldOptions.log` */
|
|
484
|
+
log?: Logger;
|
|
485
|
+
/** What becomes of a part of the game that throws, as `CreateWorldOptions.onError` */
|
|
486
|
+
onError?: ErrorPolicy;
|
|
487
|
+
}
|
|
488
|
+
/**
|
|
489
|
+
* A world as a map lays it out: its ground, the players it has room for, and everything placed on it.
|
|
490
|
+
* Players with a start location that the map places nothing for get what the game starts everyone with.
|
|
491
|
+
* Throws for a map made for another game (`GameMap.game`).
|
|
492
|
+
*
|
|
493
|
+
* @beta
|
|
494
|
+
*/
|
|
495
|
+
export declare function createWorldFromMap(options: MapWorldOptions): Promise<World>;
|
|
496
|
+
/**
|
|
497
|
+
* Players a map of the game may have (`GameModule.maxPlayers`): 8 when it says nothing, never more than the fog keeps apart
|
|
498
|
+
*
|
|
499
|
+
* @beta
|
|
500
|
+
*/
|
|
501
|
+
export declare const maxPlayersOf: (game: GameModule) => number;
|