@v12-engine/engine 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/abilities/buffs.d.ts +83 -0
- package/dist/abilities/castTold.d.ts +12 -0
- package/dist/abilities/charges.d.ts +28 -0
- package/dist/abilities/dispel.d.ts +9 -0
- package/dist/abilities/effectFields.d.ts +10 -0
- package/dist/abilities/effects/buff.d.ts +8 -0
- package/dist/abilities/effects/core.d.ts +1 -0
- package/dist/abilities/effects/damage.d.ts +1 -0
- package/dist/abilities/effects/heal.d.ts +2 -0
- package/dist/abilities/effects/missile.d.ts +1 -0
- package/dist/abilities/effects/moves.d.ts +11 -0
- package/dist/abilities/effects/passives.d.ts +15 -0
- package/dist/abilities/effects/sight.d.ts +4 -0
- package/dist/abilities/effects/spawn.d.ts +2 -0
- package/dist/abilities/effects/timed.d.ts +4 -0
- package/dist/abilities/effects/trade.d.ts +1 -0
- package/dist/abilities/effects.d.ts +122 -0
- package/dist/abilities/land.d.ts +21 -0
- package/dist/abilities/scaled.d.ts +21 -0
- package/dist/abilities/text.d.ts +113 -0
- package/dist/ai/area.d.ts +53 -0
- package/dist/ai/brain.d.ts +528 -0
- package/dist/ai/budget.d.ts +67 -0
- package/dist/ai/checks.d.ts +115 -0
- package/dist/ai/computer.d.ts +166 -0
- package/dist/ai/defence.d.ts +108 -0
- package/dist/ai/define.d.ts +21 -0
- package/dist/ai/economy.d.ts +129 -0
- package/dist/ai/geometry.d.ts +35 -0
- package/dist/ai/goals.d.ts +360 -0
- package/dist/ai/index.d.ts +38 -0
- package/dist/ai/knowledge.d.ts +418 -0
- package/dist/ai/lanes.d.ts +232 -0
- package/dist/ai/melee/build.d.ts +61 -0
- package/dist/ai/melee/goals.d.ts +299 -0
- package/dist/ai/melee/heroes.d.ts +27 -0
- package/dist/ai/melee/index.d.ts +14 -0
- package/dist/ai/melee/production.d.ts +8 -0
- package/dist/ai/melee/surrender.d.ts +24 -0
- package/dist/ai/micro.d.ts +278 -0
- package/dist/ai/mission.d.ts +195 -0
- package/dist/ai/missionRules.d.ts +18 -0
- package/dist/ai/module.d.ts +116 -0
- package/dist/ai/options.d.ts +61 -0
- package/dist/ai/plans/build.d.ts +280 -0
- package/dist/ai/plans/placement.d.ts +82 -0
- package/dist/ai/plans/plans.d.ts +105 -0
- package/dist/ai/plans/production.d.ts +210 -0
- package/dist/ai/plans/purse.d.ts +73 -0
- package/dist/ai/plans/tech.d.ts +37 -0
- package/dist/ai/profiles.d.ts +204 -0
- package/dist/ai/reach.d.ts +4 -0
- package/dist/ai/report.d.ts +203 -0
- package/dist/ai/roles.d.ts +133 -0
- package/dist/ai/rules.d.ts +288 -0
- package/dist/ai/scouting.d.ts +98 -0
- package/dist/ai/settings.d.ts +73 -0
- package/dist/ai/squads.d.ts +429 -0
- package/dist/ai/strength.d.ts +167 -0
- package/dist/ai/task.d.ts +118 -0
- package/dist/ai/tasks/attack.d.ts +7 -0
- package/dist/ai/tasks/capture.d.ts +21 -0
- package/dist/ai/tasks/creep.d.ts +16 -0
- package/dist/ai/tasks/defend.d.ts +29 -0
- package/dist/ai/tasks/drop.d.ts +34 -0
- package/dist/ai/tasks/escort.d.ts +16 -0
- package/dist/ai/tasks/gather.d.ts +23 -0
- package/dist/ai/tasks/harass.d.ts +7 -0
- package/dist/ai/tasks/hold.d.ts +20 -0
- package/dist/ai/tasks/index.d.ts +32 -0
- package/dist/ai/tasks/move.d.ts +19 -0
- package/dist/ai/tasks/patrol.d.ts +8 -0
- package/dist/ai/tasks/retreat.d.ts +20 -0
- package/dist/ai/tasks/scout.d.ts +29 -0
- package/dist/ai/tasks/shared.d.ts +74 -0
- package/dist/ai/team.d.ts +155 -0
- package/dist/ai/threat.d.ts +91 -0
- package/dist/ai/view.d.ts +366 -0
- package/dist/ai/waves.d.ts +126 -0
- package/dist/ai.js +6239 -0
- package/dist/ai.js.map +1 -0
- package/dist/aiTesting.d.ts +179 -0
- package/dist/areas.d.ts +149 -0
- package/dist/attacks.d.ts +66 -0
- package/dist/attributes.d.ts +66 -0
- package/dist/brain-BvVdUhX8.js +7659 -0
- package/dist/brain-BvVdUhX8.js.map +1 -0
- package/dist/builds-C6LfgvEU.js +460 -0
- package/dist/builds-C6LfgvEU.js.map +1 -0
- package/dist/bytes.d.ts +6 -0
- package/dist/camps.d.ts +95 -0
- package/dist/capture.d.ts +131 -0
- package/dist/cellLayers.d.ts +75 -0
- package/dist/cinematics.d.ts +194 -0
- package/dist/clock.d.ts +32 -0
- package/dist/commands.d.ts +235 -0
- package/dist/components.d.ts +184 -0
- package/dist/computers.d.ts +108 -0
- package/dist/concealment.d.ts +61 -0
- package/dist/coreComponents-syuh2fPG.js +5149 -0
- package/dist/coreComponents-syuh2fPG.js.map +1 -0
- package/dist/coreComponents.d.ts +1 -0
- package/dist/dashing.d.ts +8 -0
- package/dist/debug.d.ts +36 -0
- package/dist/debug.js +3 -0
- package/dist/debugCommands-CzjrSm66.js +14739 -0
- package/dist/debugCommands-CzjrSm66.js.map +1 -0
- package/dist/debugCommands.d.ts +213 -0
- package/dist/debugging.d.ts +10 -0
- package/dist/definitions.d.ts +43 -0
- package/dist/defs.d.ts +1162 -0
- package/dist/denying.d.ts +81 -0
- package/dist/destructibles.d.ts +27 -0
- package/dist/determinism-BCymQwiE.js +518 -0
- package/dist/determinism-BCymQwiE.js.map +1 -0
- package/dist/determinism.d.ts +121 -0
- package/dist/dialog.d.ts +94 -0
- package/dist/effectRefs.d.ts +16 -0
- package/dist/effects.d.ts +80 -0
- package/dist/endings.d.ts +22 -0
- package/dist/engagement.d.ts +108 -0
- package/dist/engineEvents.d.ts +710 -0
- package/dist/entity.d.ts +409 -0
- package/dist/entityIndex.d.ts +50 -0
- package/dist/errors.d.ts +85 -0
- package/dist/events.d.ts +97 -0
- package/dist/exactMath.d.ts +63 -0
- package/dist/features.d.ts +10 -0
- package/dist/fields.d.ts +114 -0
- package/dist/fixture.d.ts +17 -0
- package/dist/fog.d.ts +110 -0
- package/dist/formation.d.ts +111 -0
- package/dist/friendlyFire.d.ts +26 -0
- package/dist/game-DiJEN-Ks.js +5800 -0
- package/dist/game-DiJEN-Ks.js.map +1 -0
- package/dist/game.d.ts +501 -0
- package/dist/gameData.d.ts +325 -0
- package/dist/gameFiles.d.ts +26 -0
- package/dist/gates.d.ts +28 -0
- package/dist/generate.d.ts +403 -0
- package/dist/generateWorker.d.ts +39 -0
- package/dist/grid.d.ts +53 -0
- package/dist/ground.d.ts +127 -0
- package/dist/groundSpeed.d.ts +22 -0
- package/dist/hero.d.ts +177 -0
- package/dist/home.d.ts +14 -0
- package/dist/hooks.d.ts +780 -0
- package/dist/hotReload.d.ts +76 -0
- package/dist/ids.d.ts +26 -0
- package/dist/index.d.ts +227 -0
- package/dist/index.js +4701 -0
- package/dist/index.js.map +1 -0
- package/dist/inspect-D9dWHmZ0.js +491 -0
- package/dist/inspect-D9dWHmZ0.js.map +1 -0
- package/dist/inspect.d.ts +176 -0
- package/dist/inventory.d.ts +18 -0
- package/dist/items.d.ts +91 -0
- package/dist/lanes.d.ts +213 -0
- package/dist/life.d.ts +53 -0
- package/dist/local-Dkovq42k.js +1379 -0
- package/dist/local-Dkovq42k.js.map +1 -0
- package/dist/log.d.ts +140 -0
- package/dist/manaBurn.d.ts +39 -0
- package/dist/map/file.d.ts +114 -0
- package/dist/map/images.d.ts +18 -0
- package/dist/map/look.d.ts +47 -0
- package/dist/map/pathProfile.d.ts +13 -0
- package/dist/map/resize.d.ts +54 -0
- package/dist/map/schema.d.ts +10 -0
- package/dist/map/terrain.d.ts +32 -0
- package/dist/map/types.d.ts +613 -0
- package/dist/map.d.ts +7 -0
- package/dist/mapCheck/cells.d.ts +19 -0
- package/dist/mapCheck/rule.d.ts +30 -0
- package/dist/mapCheck/rules/names.d.ts +3 -0
- package/dist/mapCheck/rules/objects.d.ts +3 -0
- package/dist/mapCheck/rules/paths.d.ts +3 -0
- package/dist/mapCheck/rules/players.d.ts +3 -0
- package/dist/mapCheck/rules/races.d.ts +3 -0
- package/dist/mapCheck/rules/random.d.ts +3 -0
- package/dist/mapCheck/rules/regions.d.ts +3 -0
- package/dist/mapCheck/rules/targets.d.ts +3 -0
- package/dist/mapCheck/rules/walking.d.ts +3 -0
- package/dist/mapCheck.d.ts +23 -0
- package/dist/mapFields.d.ts +364 -0
- package/dist/mapFile.d.ts +23 -0
- package/dist/mapMeasure.d.ts +95 -0
- package/dist/mapMerge.d.ts +19 -0
- package/dist/mapObjectives.d.ts +82 -0
- package/dist/mapObjects.d.ts +1 -0
- package/dist/math.d.ts +44 -0
- package/dist/messages.d.ts +150 -0
- package/dist/missionRules-C-bGxm0Q.js +523 -0
- package/dist/missionRules-C-bGxm0Q.js.map +1 -0
- package/dist/missionRules.d.ts +179 -0
- package/dist/mods.d.ts +146 -0
- package/dist/names.d.ts +93 -0
- package/dist/navigation/agentParams.d.ts +4 -0
- package/dist/navigation/air.d.ts +89 -0
- package/dist/navigation/builds.d.ts +140 -0
- package/dist/navigation/groundAreas.d.ts +23 -0
- package/dist/navigation/navigation.d.ts +127 -0
- package/dist/navigation/recast.d.ts +214 -0
- package/dist/navigation/sidePaths.d.ts +69 -0
- package/dist/navigation/sized.d.ts +1 -0
- package/dist/navigation-worker.js +11 -0
- package/dist/navigation-worker.js.map +1 -0
- package/dist/nearest.d.ts +8 -0
- package/dist/noise.d.ts +12 -0
- package/dist/objectives.d.ts +93 -0
- package/dist/orders/basic.d.ts +96 -0
- package/dist/orders/build.d.ts +91 -0
- package/dist/orders/cast.d.ts +105 -0
- package/dist/orders/facts.d.ts +14 -0
- package/dist/orders/harvest.d.ts +94 -0
- package/dist/orders/idle.d.ts +7 -0
- package/dist/orders/items.d.ts +14 -0
- package/dist/orders/queue.d.ts +24 -0
- package/dist/pack.schema.json +6621 -0
- package/dist/packs/director/index.d.ts +81 -0
- package/dist/packs/heroes/campaign.d.ts +137 -0
- package/dist/packs/heroes/carry.d.ts +59 -0
- package/dist/packs/heroes/commands.d.ts +6 -0
- package/dist/packs/heroes/hire.d.ts +9 -0
- package/dist/packs/heroes/index.d.ts +12 -0
- package/dist/packs/heroes/making.d.ts +16 -0
- package/dist/packs/heroes/respawn.d.ts +42 -0
- package/dist/packs/moba/index.d.ts +34 -0
- package/dist/packs/pack.d.ts +84 -0
- package/dist/packs-g5thvmGn.js +3199 -0
- package/dist/packs-g5thvmGn.js.map +1 -0
- package/dist/packs.d.ts +84 -0
- package/dist/paths.d.ts +51 -0
- package/dist/plain.d.ts +17 -0
- package/dist/player.d.ts +117 -0
- package/dist/portals.d.ts +66 -0
- package/dist/prefabs.d.ts +139 -0
- package/dist/presetBuildings.d.ts +52 -0
- package/dist/presetGround.d.ts +22 -0
- package/dist/profiles-B3NS9jwk.js +335 -0
- package/dist/profiles-B3NS9jwk.js.map +1 -0
- package/dist/races.d.ts +136 -0
- package/dist/randomGroups.d.ts +2 -0
- package/dist/registry.d.ts +464 -0
- package/dist/remains.d.ts +119 -0
- package/dist/replication.d.ts +103 -0
- package/dist/rng.d.ts +17 -0
- package/dist/rules.d.ts +395 -0
- package/dist/rulesCheck.d.ts +37 -0
- package/dist/runes.d.ts +41 -0
- package/dist/save.d.ts +277 -0
- package/dist/scenario.d.ts +56 -0
- package/dist/scheduler.d.ts +67 -0
- package/dist/score.d.ts +306 -0
- package/dist/sequences.d.ts +132 -0
- package/dist/server/doorman.d.ts +21 -0
- package/dist/server/gameServer.d.ts +346 -0
- package/dist/server/index.d.ts +24 -0
- package/dist/server/lobby.d.ts +1 -0
- package/dist/server/log.d.ts +13 -0
- package/dist/server/match.d.ts +24 -0
- package/dist/server/mode.d.ts +168 -0
- package/dist/server/navigation-worker.d.ts +1 -0
- package/dist/server/navigation.d.ts +11 -0
- package/dist/server/ops.d.ts +78 -0
- package/dist/server/packs.d.ts +15 -0
- package/dist/server/ratings.d.ts +62 -0
- package/dist/server/relay.d.ts +34 -0
- package/dist/server/rooms.d.ts +162 -0
- package/dist/server/seat.d.ts +2 -0
- package/dist/server/seatSettings.d.ts +15 -0
- package/dist/server/secret.d.ts +5 -0
- package/dist/server/start.d.ts +54 -0
- package/dist/server/websocket.d.ts +74 -0
- package/dist/server.js +2861 -0
- package/dist/server.js.map +1 -0
- package/dist/session/can.d.ts +20 -0
- package/dist/session/commandReplay.d.ts +92 -0
- package/dist/session/debug.d.ts +65 -0
- package/dist/session/delay.d.ts +15 -0
- package/dist/session/delta.d.ts +98 -0
- package/dist/session/entityState.d.ts +1 -0
- package/dist/session/local.d.ts +214 -0
- package/dist/session/memory.d.ts +27 -0
- package/dist/session/protocol.d.ts +1155 -0
- package/dist/session/remote.d.ts +530 -0
- package/dist/session/replay.d.ts +114 -0
- package/dist/session/seed.d.ts +7 -0
- package/dist/session/share.d.ts +78 -0
- package/dist/session/socket.d.ts +8 -0
- package/dist/session/wire.d.ts +153 -0
- package/dist/session/worker.d.ts +227 -0
- package/dist/shared.d.ts +171 -0
- package/dist/sides.d.ts +75 -0
- package/dist/sight.d.ts +27 -0
- package/dist/simulate-oXBiw1Ff.js +167 -0
- package/dist/simulate-oXBiw1Ff.js.map +1 -0
- package/dist/simulate-worker.d.ts +1 -0
- package/dist/simulate-worker.js +28 -0
- package/dist/simulate-worker.js.map +1 -0
- package/dist/simulate.d.ts +154 -0
- package/dist/smart.d.ts +9 -0
- package/dist/spatial.d.ts +62 -0
- package/dist/spawning.d.ts +33 -0
- package/dist/stances.d.ts +76 -0
- package/dist/start.d.ts +71 -0
- package/dist/stats.d.ts +122 -0
- package/dist/summons.d.ts +63 -0
- package/dist/systems/abilities.d.ts +3 -0
- package/dist/systems/combat.d.ts +71 -0
- package/dist/systems/combatTold.d.ts +14 -0
- package/dist/systems/construction.d.ts +34 -0
- package/dist/systems/economy.d.ts +21 -0
- package/dist/systems/fog.d.ts +19 -0
- package/dist/systems/life.d.ts +3 -0
- package/dist/systems/movement.d.ts +105 -0
- package/dist/systems/orders.d.ts +7 -0
- package/dist/systems/production.d.ts +49 -0
- package/dist/systems/productionQueue.d.ts +40 -0
- package/dist/systems/victory.d.ts +14 -0
- package/dist/talk.d.ts +65 -0
- package/dist/tech.d.ts +62 -0
- package/dist/techTree.d.ts +38 -0
- package/dist/terrain.d.ts +173 -0
- package/dist/terrainSave.d.ts +29 -0
- package/dist/testing.d.ts +58 -0
- package/dist/testing.js +822 -0
- package/dist/testing.js.map +1 -0
- package/dist/tiles.d.ts +34 -0
- package/dist/timers.d.ts +146 -0
- package/dist/tomes.d.ts +48 -0
- package/dist/trade.d.ts +28 -0
- package/dist/transport.d.ts +76 -0
- package/dist/tunables.d.ts +45 -0
- package/dist/upkeep.d.ts +16 -0
- package/dist/veterancy.d.ts +80 -0
- package/dist/walls.d.ts +86 -0
- package/dist/world.d.ts +1118 -0
- package/package.json +80 -5
- package/README.md +0 -3
|
@@ -0,0 +1,613 @@
|
|
|
1
|
+
import type { GameData } from '../gameData';
|
|
2
|
+
import type { AreaShape } from '../areas';
|
|
3
|
+
import type { PlayerId } from '../entity';
|
|
4
|
+
import type { GeneratedWith } from '../generate';
|
|
5
|
+
import type { Vec2 } from '../math';
|
|
6
|
+
import type { MapDoodadLight, MapEnvironment } from './look';
|
|
7
|
+
/**
|
|
8
|
+
* A map: the ground and what stands on it when the game begins, as data. The editor makes them, scenes play them.
|
|
9
|
+
*
|
|
10
|
+
* The ground is kept in layers that are edited apart and put together into a `Terrain`: the height of the land,
|
|
11
|
+
* cliff levels, ramps between levels, water and paint. The layers are what a map file stores, the terrain is
|
|
12
|
+
* derived from them whenever one changes.
|
|
13
|
+
*
|
|
14
|
+
* @beta
|
|
15
|
+
*/
|
|
16
|
+
export interface GameMap {
|
|
17
|
+
name: string;
|
|
18
|
+
description: string;
|
|
19
|
+
/**
|
|
20
|
+
* The game the map was made for, by the id of its module (`GameModule.id`): a world is not made from it for
|
|
21
|
+
* another. For any game when left out, like the maps made before maps said
|
|
22
|
+
*/
|
|
23
|
+
game?: string;
|
|
24
|
+
width: number;
|
|
25
|
+
depth: number;
|
|
26
|
+
/** How much higher a level stands than the one below */
|
|
27
|
+
cliffHeight: number;
|
|
28
|
+
/** Height of the land per vertex, row by row, before cliffs and water */
|
|
29
|
+
ground: Float32Array;
|
|
30
|
+
/** Cliff level per cell */
|
|
31
|
+
levels: Uint8Array;
|
|
32
|
+
/** 1 where a cell is part of a ramp: the levels around it are joined by a slope instead of a cliff */
|
|
33
|
+
ramps: Uint8Array;
|
|
34
|
+
/** `WATER_*` per cell */
|
|
35
|
+
water: Uint8Array;
|
|
36
|
+
/** Paint per cell: 0 for none, otherwise 1 and up into `tileset` */
|
|
37
|
+
tiles: Uint8Array;
|
|
38
|
+
/**
|
|
39
|
+
* The game's own layers of cells (`CellLayerDef`), by id: where the bushes are. A value per cell, row by row. Left
|
|
40
|
+
* out, or a layer left out, for none
|
|
41
|
+
*/
|
|
42
|
+
cells?: Record<string, Uint8Array>;
|
|
43
|
+
/**
|
|
44
|
+
* What is kept off each cell by hand, as the editor's pathing brush paints it: `BLOCKS_BUILD` (no building there),
|
|
45
|
+
* `BLOCKS_WALK` (nothing walks or builds there), 0 for nothing. With what doodads keep off, into `Terrain.blocked`:
|
|
46
|
+
* no-build zones, invisible walls. Left out for none. While the game runs, a game blocks the way with obstacles
|
|
47
|
+
* (`world.nav.addObstacle`) and keeps buildings off with the `canPlace` hook
|
|
48
|
+
*/
|
|
49
|
+
pathing?: Uint8Array;
|
|
50
|
+
/**
|
|
51
|
+
* The tiles the paint of `tiles` is, by name: index 1 is the first. The game's own list, as the map is opened with
|
|
52
|
+
* a game (`adoptTileset`); names the game does not have come after it, kept for the file
|
|
53
|
+
*/
|
|
54
|
+
tileset: string[];
|
|
55
|
+
/** The players who can take part. Neutral and the creeps are always there on top of these */
|
|
56
|
+
players: MapPlayer[];
|
|
57
|
+
objects: MapObject[];
|
|
58
|
+
camps: MapCamp[];
|
|
59
|
+
/** Parts of the map the rules watch by name: who walks in and out (see `MapRegion`) */
|
|
60
|
+
regions: MapRegion[];
|
|
61
|
+
/** Spots the rules know by name: where a wave comes in, where a hero waits (see `MapPoint`) */
|
|
62
|
+
points: MapPoint[];
|
|
63
|
+
/** Lines the rules know by name: a road, a patrol route (see `MapPath`) */
|
|
64
|
+
paths: MapPath[];
|
|
65
|
+
/** Scenery, which the rules do not know of but where it blocks (see `MapDoodad`) */
|
|
66
|
+
doodads: MapDoodad[];
|
|
67
|
+
/** Views of the map saved under names (see `MapCamera`) */
|
|
68
|
+
cameras: MapCamera[];
|
|
69
|
+
/** Groups what is placed can be drawn from when the game starts, and tables of what drops (see `MapRandomGroup`) */
|
|
70
|
+
randomGroups?: MapRandomGroup[];
|
|
71
|
+
itemTables?: MapItemTable[];
|
|
72
|
+
/**
|
|
73
|
+
* The map's own definitions (campaign plan RC8), a `data.json` as the game's has it (`GameData`): laid over the
|
|
74
|
+
* game's data as a world is made from the map, before its rules are checked. A footman of 200 health on this map
|
|
75
|
+
* alone. Its rules hash has them, so a save of it is not one of another map with other definitions
|
|
76
|
+
*/
|
|
77
|
+
definitions?: GameData;
|
|
78
|
+
/** Its teams, named, and what their players share (see `MapForce`). Teams by number only when left out */
|
|
79
|
+
forces?: MapForce[];
|
|
80
|
+
/** The races a lobby offers its players who have none fixed (`MapPlayer.race`), by id. All of the game's when left out */
|
|
81
|
+
races?: string[];
|
|
82
|
+
/** Who made it */
|
|
83
|
+
author?: string;
|
|
84
|
+
/** The map's checks it does not want, by their rules' ids (`MapProblem.rule`): a desert map with no path to its mines */
|
|
85
|
+
silence?: string[];
|
|
86
|
+
/** Who it is for, as lists show it: "2 players", "2 v 2" */
|
|
87
|
+
meantFor?: string;
|
|
88
|
+
/**
|
|
89
|
+
* Whether the whole map starts explored for everyone, the fog over it all the same: its ground, and what stands on it
|
|
90
|
+
* and belongs to no player (trees, mines, neutral buildings), seen from the first moment. Yes or no over the game's
|
|
91
|
+
* (`FogRules.startExplored`); the game's when left out
|
|
92
|
+
*/
|
|
93
|
+
explored?: boolean;
|
|
94
|
+
/** What the loading screen says while it loads */
|
|
95
|
+
loading?: string;
|
|
96
|
+
/** A picture of it, for lists of maps: a small PNG as a data URL, made from its ground in the editor */
|
|
97
|
+
preview?: string;
|
|
98
|
+
/** What the map looks like beyond its ground: its water, light, sky (see `MapEnvironment`) */
|
|
99
|
+
environment?: MapEnvironment;
|
|
100
|
+
/** The hour the game starts at, and whether it moves (see `MapDay`) */
|
|
101
|
+
day?: MapDay;
|
|
102
|
+
/** How it was made, where a generator made it (`generateMap`): the seed and the options, for the same again or another */
|
|
103
|
+
generated?: GeneratedWith;
|
|
104
|
+
/**
|
|
105
|
+
* The part of the map play happens in, in cells, when it is not all of it: nothing on foot goes outside it, nothing
|
|
106
|
+
* is built there, the camera keeps to it, and the screen darkens what is beyond. Scenery around the edge
|
|
107
|
+
*/
|
|
108
|
+
bounds?: CellRect;
|
|
109
|
+
/**
|
|
110
|
+
* What the game keeps with the map, for its rules to read: a difficulty, the waves of this level. Plain data,
|
|
111
|
+
* as in a save. The engine never looks inside
|
|
112
|
+
*/
|
|
113
|
+
data: Record<string, unknown>;
|
|
114
|
+
/**
|
|
115
|
+
* What the map's editor keeps with it of its own (what is hidden or locked, its groups, its views, the instances of
|
|
116
|
+
* prefabs): saved with the map as plain data, read by no game, world or rule, and taken away for play
|
|
117
|
+
* (`withoutEditor`). The engine never looks inside: the editor says what it holds
|
|
118
|
+
*/
|
|
119
|
+
editor?: Record<string, unknown>;
|
|
120
|
+
/**
|
|
121
|
+
* What the file held that this reader does not know, as it was: written back when the map is saved, so that a map
|
|
122
|
+
* from a newer editor loses nothing by passing through an older one
|
|
123
|
+
*/
|
|
124
|
+
extra?: Record<string, unknown>;
|
|
125
|
+
}
|
|
126
|
+
/** @beta */
|
|
127
|
+
export interface MapPlayer {
|
|
128
|
+
id: PlayerId;
|
|
129
|
+
name: string;
|
|
130
|
+
team: number;
|
|
131
|
+
color: [number, number, number];
|
|
132
|
+
/** Where their base goes, for a game that gives everyone a start */
|
|
133
|
+
start?: Vec2;
|
|
134
|
+
/** Where their view starts, by the name of a camera of the map (`MapCamera`). Over their start when it has one */
|
|
135
|
+
camera?: string;
|
|
136
|
+
/**
|
|
137
|
+
* Who plays them: a person, the computer, or nobody (an open slot left empty). The game's to say when left out: the
|
|
138
|
+
* game reads it (`world.map.player(id)`), the engine does nothing with it
|
|
139
|
+
*/
|
|
140
|
+
controller?: 'person' | 'computer' | 'nobody';
|
|
141
|
+
/** What they start with, by resource id, over what the game gives everyone */
|
|
142
|
+
resources?: Record<string, number>;
|
|
143
|
+
/**
|
|
144
|
+
* The race they play, fixed by the map (a campaign's), of the game's races (`GameModule.races`), or `random`: not
|
|
145
|
+
* chosen in a lobby. Left to the lobby, or the game's first, when left out
|
|
146
|
+
*/
|
|
147
|
+
race?: string;
|
|
148
|
+
/** What the game's own fields for players were set to (`defineMapField` with `for: 'player'`) */
|
|
149
|
+
data?: Record<string, unknown>;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* A team of a map, with a name, and what its players share: for the game to read (`world.map.forces`)
|
|
153
|
+
*
|
|
154
|
+
* @beta
|
|
155
|
+
*/
|
|
156
|
+
export interface MapForce {
|
|
157
|
+
/** The team, as its players have it (`MapPlayer.team`) */
|
|
158
|
+
team: number;
|
|
159
|
+
name: string;
|
|
160
|
+
/** Its players see what each other sees. Teams always do in this engine: kept for the game to read */
|
|
161
|
+
sharedVision?: boolean;
|
|
162
|
+
/** Its players can give orders to each other's units: for the game to read */
|
|
163
|
+
sharedControl?: boolean;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* A view of the map saved under a name: what the camera looks at, from how far, which way and how steeply. For
|
|
167
|
+
* cinematics (`cut.camera('gate')`), a player's first view, and code (`client.lookFrom('gate')`). The screen's
|
|
168
|
+
*
|
|
169
|
+
* @beta
|
|
170
|
+
*/
|
|
171
|
+
export interface MapCamera {
|
|
172
|
+
/** The editor's, see `MapRegion.id` */
|
|
173
|
+
id: number;
|
|
174
|
+
name: string;
|
|
175
|
+
x: number;
|
|
176
|
+
z: number;
|
|
177
|
+
distance: number;
|
|
178
|
+
/** Radians around the vertical axis, 0 looking north, and between the view and the ground */
|
|
179
|
+
yaw: number;
|
|
180
|
+
pitch: number;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Something that stands on the map when the game begins: a unit, a building, a tree, a mine
|
|
184
|
+
*
|
|
185
|
+
* @beta
|
|
186
|
+
*/
|
|
187
|
+
export interface MapObject {
|
|
188
|
+
id: number;
|
|
189
|
+
type: string;
|
|
190
|
+
owner: PlayerId;
|
|
191
|
+
x: number;
|
|
192
|
+
z: number;
|
|
193
|
+
facing: number;
|
|
194
|
+
/** How big it is drawn */
|
|
195
|
+
scale: number;
|
|
196
|
+
/** Which of the models of its type it is drawn with, for things that come in kinds like trees. Left out: one picked for it */
|
|
197
|
+
look?: string;
|
|
198
|
+
/**
|
|
199
|
+
* The random group it is drawn from when the game starts (`MapRandomGroup`, by name): `type` is what the editor
|
|
200
|
+
* shows until then
|
|
201
|
+
*/
|
|
202
|
+
random?: string;
|
|
203
|
+
/** The item table it drops from when it dies (`MapItemTable`, by name) */
|
|
204
|
+
drops?: string;
|
|
205
|
+
/**
|
|
206
|
+
* A name of its own, for the rules to find it by (`world.named('gate')`). No two things on a map have the same,
|
|
207
|
+
* whatever they are
|
|
208
|
+
*/
|
|
209
|
+
name?: string;
|
|
210
|
+
/** The health it starts with, as a part of what it can have: 0.5 is half. All of it when left out */
|
|
211
|
+
health?: number;
|
|
212
|
+
/** The mana it starts with, as a part of what it can have. What its type starts with when left out */
|
|
213
|
+
mana?: number;
|
|
214
|
+
/** For a hero: the level it starts at */
|
|
215
|
+
level?: number;
|
|
216
|
+
/** For a hero: what it has learned already, as the level of each ability by id. As far as its level lets it */
|
|
217
|
+
abilities?: Record<string, number>;
|
|
218
|
+
/** The items it carries, by the id of each, as far as it has room */
|
|
219
|
+
items?: string[];
|
|
220
|
+
/** For a resource: how much there is of it. What its type holds when left out */
|
|
221
|
+
amount?: number;
|
|
222
|
+
/** For a building: it starts as a site that is still to be built */
|
|
223
|
+
underConstruction?: boolean;
|
|
224
|
+
/** Seconds until it is gone, for what is not there to stay */
|
|
225
|
+
lifetime?: number;
|
|
226
|
+
/**
|
|
227
|
+
* What it is doing as the game begins, its own orders and no player's, one after the other (campaign plan MS2): a
|
|
228
|
+
* guard walking a patrol route, a caravan on its road. Nothing but what a unit does by itself when left out
|
|
229
|
+
*/
|
|
230
|
+
orders?: MapObjectOrder[];
|
|
231
|
+
/**
|
|
232
|
+
* What the game's own fields were set to, by the id of each (see `defineMapField`). The engine does not look
|
|
233
|
+
* inside: the `mapObject` hook hands it to the game
|
|
234
|
+
*/
|
|
235
|
+
data?: Record<string, unknown>;
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* An order a unit of the map is given as the game begins (`MapObject.orders`): to go somewhere (`move`), to walk to
|
|
239
|
+
* and fro fighting what it meets (`patrol`), to stand somewhere and fight what comes near, coming back after
|
|
240
|
+
* (`guard`), to stand its ground (`hold`); to a point, or along a path of the map by its name, bend after bend (a
|
|
241
|
+
* patrol along one walks it back and forth)
|
|
242
|
+
*
|
|
243
|
+
* @beta
|
|
244
|
+
*/
|
|
245
|
+
export interface MapObjectOrder {
|
|
246
|
+
kind: 'move' | 'patrol' | 'guard' | 'hold';
|
|
247
|
+
path?: string;
|
|
248
|
+
point?: Vec2;
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* A named part of the map, which becomes an area of the world made from it (`AreaDef`): the rules hear who walks in
|
|
252
|
+
* and out (`enteredArea`, `leftArea`) and ask who is in it (`world.areas`), by its name
|
|
253
|
+
*
|
|
254
|
+
* @beta
|
|
255
|
+
*/
|
|
256
|
+
export interface MapRegion {
|
|
257
|
+
/** The editor's, to tell regions apart while one is renamed. The world knows it by its name */
|
|
258
|
+
id: number;
|
|
259
|
+
/** What the rules know it by. No two things on a map have the same, whatever they are */
|
|
260
|
+
name: string;
|
|
261
|
+
shape: AreaShape;
|
|
262
|
+
/** What it is drawn in, in the editor, to tell it from the others. The editor picks one when left out */
|
|
263
|
+
color?: [number, number, number];
|
|
264
|
+
/** What the game's own fields for regions were set to, see `MapObject.data`: the `mapRegion` hook hands it to the game */
|
|
265
|
+
data?: Record<string, unknown>;
|
|
266
|
+
/**
|
|
267
|
+
* A cinematic the region plays (ED4): for everyone, once, the first time a unit of a player walks in, unless the game
|
|
268
|
+
* plays it its own way (`play: 'code'`: the region says which, `world.map.regions`, and the game's rules play it)
|
|
269
|
+
*/
|
|
270
|
+
cinematic?: MapRegionCinematic;
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* The cinematic a region of the map plays (`MapRegion.cinematic`): which, by its id (`GameView.cinematics.defs`), and who
|
|
274
|
+
* plays it: the engine, as a unit of a player first walks in (`'enter'`, when left out), or the game's own code
|
|
275
|
+
* (`'code'`)
|
|
276
|
+
*
|
|
277
|
+
* @beta
|
|
278
|
+
*/
|
|
279
|
+
export interface MapRegionCinematic {
|
|
280
|
+
/** The cinematic, by its id: the game's (`GameView.cinematics.defs`) */
|
|
281
|
+
id: string;
|
|
282
|
+
/** Who plays it: the engine as a unit of a player first walks in (`'enter'`, when left out), or the game's code */
|
|
283
|
+
play?: 'enter' | 'code';
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* A named spot of the map, facing a way: `world.map.point('spawn')`
|
|
287
|
+
*
|
|
288
|
+
* @beta
|
|
289
|
+
*/
|
|
290
|
+
export interface MapPoint {
|
|
291
|
+
/** The editor's, see `MapRegion.id` */
|
|
292
|
+
id: number;
|
|
293
|
+
/** What the rules know it by. No two things on a map have the same, whatever they are */
|
|
294
|
+
name: string;
|
|
295
|
+
x: number;
|
|
296
|
+
z: number;
|
|
297
|
+
/** Radians, the way entities face: 0 is along +z */
|
|
298
|
+
facing: number;
|
|
299
|
+
/** What it is drawn in, in the editor */
|
|
300
|
+
color?: [number, number, number];
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Scenery: a model on the map that is no entity of the rules, with no health, owner or place in a snapshot. A rock, a
|
|
304
|
+
* fence, a ruined arch, free to lean, float and stretch. What it keeps off the cells under it (`blocks`) the terrain
|
|
305
|
+
* has, for the paths of units and for building
|
|
306
|
+
*
|
|
307
|
+
* @beta
|
|
308
|
+
*/
|
|
309
|
+
export interface MapDoodad {
|
|
310
|
+
/** The editor's, see `MapRegion.id` */
|
|
311
|
+
id: number;
|
|
312
|
+
/** The model, by its path in `models/`: the map's own, the game's, or a shared one */
|
|
313
|
+
model: string;
|
|
314
|
+
x: number;
|
|
315
|
+
z: number;
|
|
316
|
+
/** How high above the ground under it */
|
|
317
|
+
y?: number;
|
|
318
|
+
/** Radians: which way it faces, the way entities do (0 is along +z), then how far it leans forward and to the side */
|
|
319
|
+
yaw: number;
|
|
320
|
+
pitch?: number;
|
|
321
|
+
roll?: number;
|
|
322
|
+
/** How much bigger or smaller it is drawn than it was made, across, up and deep */
|
|
323
|
+
scale: [number, number, number];
|
|
324
|
+
/** A colour it is drawn in, over its own */
|
|
325
|
+
tint?: [number, number, number];
|
|
326
|
+
/** What code knows it by (`client.doodads.named`). Doodads are the screen's: the rules never see them */
|
|
327
|
+
name?: string;
|
|
328
|
+
/** What it keeps off the cells within `radius` of its middle: building there, or walking and building. Nothing when left out */
|
|
329
|
+
blocks?: 'build' | 'walk';
|
|
330
|
+
/**
|
|
331
|
+
* A bridge: walked on, over deep water too, at its height (`y`) above the water. Nothing is built on it. Within
|
|
332
|
+
* `radius` of its middle
|
|
333
|
+
*/
|
|
334
|
+
bridge?: boolean;
|
|
335
|
+
/**
|
|
336
|
+
* A gate: it keeps walking off the cells within `radius` while it is shut, and the rules open and shut it by its
|
|
337
|
+
* name while the game runs (`setGate`). Shut when the game starts, unless `open`
|
|
338
|
+
*/
|
|
339
|
+
gate?: boolean;
|
|
340
|
+
open?: boolean;
|
|
341
|
+
/** How far around its middle it blocks, in cells */
|
|
342
|
+
radius?: number;
|
|
343
|
+
/**
|
|
344
|
+
* A clip of its model it plays over and over (a windmill's sails, a flag, a chest held open), by its name: none when
|
|
345
|
+
* left out, or as the game says of its model (`SceneryDef.animation`). It is drawn on its own while it plays
|
|
346
|
+
*/
|
|
347
|
+
animation?: string;
|
|
348
|
+
/**
|
|
349
|
+
* Merged with the scenery near it, to be drawn in one go (`DoodadView`): yes when left out, as far as its model can be.
|
|
350
|
+
* No keeps it a copy of its model's mesh: for a game's code that reaches for it
|
|
351
|
+
*/
|
|
352
|
+
batch?: boolean;
|
|
353
|
+
/**
|
|
354
|
+
* This one's lights otherwise than its model's (`GameView.ground.scenery`): put out (`on: false`), another colour, brighter,
|
|
355
|
+
* further. Laid over every light its model gives
|
|
356
|
+
*/
|
|
357
|
+
light?: MapDoodadLight;
|
|
358
|
+
/**
|
|
359
|
+
* How this one is drawn by distance, over its model's (`MapDetail`): pinned to a level by its index (`level`: 0 always at
|
|
360
|
+
* full), or levels of its own. As its model when left out
|
|
361
|
+
*/
|
|
362
|
+
detail?: MapDoodadDetail;
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* One way a thing is drawn, and when, as a map says it (`MapDetail.models`, `MapDoodad.detail`): the client's
|
|
366
|
+
* `DetailLevel` without what only code can say. A level applies when any of its conditions holds; of a thing's levels the
|
|
367
|
+
* last that applies is drawn, the first being its full self
|
|
368
|
+
*
|
|
369
|
+
* @beta
|
|
370
|
+
*/
|
|
371
|
+
export interface MapDetailLevel {
|
|
372
|
+
/** What is drawn: a picture of the model (`impostor`), or nothing (`none`). The model, or `model`, when left out */
|
|
373
|
+
draw?: 'impostor' | 'none';
|
|
374
|
+
/** Another model, by its path in `models/`, in place of the thing's own */
|
|
375
|
+
model?: string;
|
|
376
|
+
/** Or a lighter version of the full model made from it: this part of its triangles (0.25) */
|
|
377
|
+
ratio?: number;
|
|
378
|
+
/** From this far from the camera, in cells */
|
|
379
|
+
from?: number;
|
|
380
|
+
/** Or: once the thing is at most this tall on the screen, in pixels */
|
|
381
|
+
under?: number;
|
|
382
|
+
/** Or: while the camera is over a region of the map, by its name; or not over it (`!name`) */
|
|
383
|
+
region?: string;
|
|
384
|
+
/**
|
|
385
|
+
* How its file is loaded: with the model (`eager`), once something comes near wanting it (`lazy`, when left out: within
|
|
386
|
+
* half again its distance), by code alone (`never`), or as the camera comes over a region of the map, by its name
|
|
387
|
+
*/
|
|
388
|
+
load?: 'eager' | 'lazy' | 'never' | {
|
|
389
|
+
region: string;
|
|
390
|
+
};
|
|
391
|
+
/**
|
|
392
|
+
* The level its shadow is drawn at, by index: a lighter one is cheaper, and nobody sees a leaf's shadow. One of nothing
|
|
393
|
+
* casts none. As the shadows' bias says when left out (`MapDetail.shadowBias`), else the level it is drawn at
|
|
394
|
+
*/
|
|
395
|
+
shadow?: number;
|
|
396
|
+
}
|
|
397
|
+
/**
|
|
398
|
+
* How one doodad is drawn by distance (`MapDoodad.detail`)
|
|
399
|
+
*
|
|
400
|
+
* @beta
|
|
401
|
+
*/
|
|
402
|
+
export interface MapDoodadDetail {
|
|
403
|
+
/** Always at this level, by its index: 0 at full */
|
|
404
|
+
level?: number;
|
|
405
|
+
/** Its own levels, over its model's */
|
|
406
|
+
levels?: MapDetailLevel[];
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* How much detail things are drawn with by their distance on a map (`MapEnvironment.detail`), over the game's
|
|
410
|
+
* (`GameView.scene.detail`): a forest map drawn lighter. The screen's: the rules never see it
|
|
411
|
+
*
|
|
412
|
+
* @beta
|
|
413
|
+
*/
|
|
414
|
+
export interface MapDetail {
|
|
415
|
+
/** Every distance a level starts from, times this: under 1 lighter sooner, over 1 later. The game's when left out */
|
|
416
|
+
scale?: number;
|
|
417
|
+
/** Past this far from the camera, in cells, no scenery, tree or mine is drawn at all, nor casts a shadow. None when left out */
|
|
418
|
+
cull?: number;
|
|
419
|
+
/**
|
|
420
|
+
* How many levels coarser than it is drawn at a thing casts its shadow, where its level does not say (`shadow`): 1
|
|
421
|
+
* draws a tree's shadow at its next lighter level. The game's when left out
|
|
422
|
+
*/
|
|
423
|
+
shadowBias?: number;
|
|
424
|
+
/** The levels of every model that has none said of it, over the game's (`GameView.scene.detail.levels`) */
|
|
425
|
+
levels?: MapDetailLevel[];
|
|
426
|
+
/** A model's levels, by its path in `models/`, over its own and the game's */
|
|
427
|
+
models?: Record<string, MapDetailLevel[]>;
|
|
428
|
+
}
|
|
429
|
+
/**
|
|
430
|
+
* A group a placed thing is drawn from when the game starts (random groups, as classic map editors have them): one of these types by
|
|
431
|
+
* weight, or any creep of a level ("a level 3 creep")
|
|
432
|
+
*
|
|
433
|
+
* @beta
|
|
434
|
+
*/
|
|
435
|
+
export interface MapRandomGroup {
|
|
436
|
+
name: string;
|
|
437
|
+
/** One of these, more likely by its weight */
|
|
438
|
+
choices?: {
|
|
439
|
+
type: string;
|
|
440
|
+
weight: number;
|
|
441
|
+
}[];
|
|
442
|
+
/** Or any unit type with a bounty, of this level */
|
|
443
|
+
level?: number;
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
* What something drops when it dies (item tables, as classic map editors have them): one item by weight, or none
|
|
447
|
+
*
|
|
448
|
+
* @beta
|
|
449
|
+
*/
|
|
450
|
+
export interface MapItemTable {
|
|
451
|
+
name: string;
|
|
452
|
+
items: MapItemTableEntry[];
|
|
453
|
+
/** How likely it is to drop anything, 0..1. Always when left out */
|
|
454
|
+
chance?: number;
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* A line of an item table (`MapItemTable.items`): an item by id, or any item of a level, a class, or both (campaign
|
|
458
|
+
* plan GP3: `{ level: 3, weight: 2 }`), its weight shared among those of the game that match
|
|
459
|
+
*
|
|
460
|
+
* @beta
|
|
461
|
+
*/
|
|
462
|
+
export interface MapItemTableEntry {
|
|
463
|
+
item?: string;
|
|
464
|
+
level?: number;
|
|
465
|
+
class?: string;
|
|
466
|
+
weight: number;
|
|
467
|
+
}
|
|
468
|
+
/**
|
|
469
|
+
* What a doodad keeps off a cell, in `Terrain.blocked`: building, walking too, or building on a bridge one walks on
|
|
470
|
+
*
|
|
471
|
+
* @beta
|
|
472
|
+
*/
|
|
473
|
+
export declare const BLOCKS_BUILD = 1;
|
|
474
|
+
/** @beta */
|
|
475
|
+
export declare const BLOCKS_WALK = 2;
|
|
476
|
+
/**
|
|
477
|
+
* A named line of the map, through points in order, with a width: `world.map.path('road')` (see `Path`)
|
|
478
|
+
*
|
|
479
|
+
* @beta
|
|
480
|
+
*/
|
|
481
|
+
export interface MapPath {
|
|
482
|
+
/** The editor's, see `MapRegion.id` */
|
|
483
|
+
id: number;
|
|
484
|
+
/** What the rules know it by. No two things on a map have the same, whatever they are */
|
|
485
|
+
name: string;
|
|
486
|
+
points: Vec2[];
|
|
487
|
+
/** How wide it is, in cells: what it paints and keeps clear, and what `Path.contains` says is on it */
|
|
488
|
+
width: number;
|
|
489
|
+
/** A tile of the game's, by id, that the ground under it is painted with, over the map's own paint */
|
|
490
|
+
paint?: string;
|
|
491
|
+
/** Nothing may be built on it: a road the invaders need to get through */
|
|
492
|
+
keepClear?: boolean;
|
|
493
|
+
/** What it is drawn in, in the editor */
|
|
494
|
+
color?: [number, number, number];
|
|
495
|
+
/**
|
|
496
|
+
* A road's or a river's bed under it, carved in the ground and painted each time the terrain is worked out (the
|
|
497
|
+
* map's own heights stay as they are, so the bed follows the path wherever its points go): `PathProfile`
|
|
498
|
+
*/
|
|
499
|
+
profile?: PathProfile;
|
|
500
|
+
}
|
|
501
|
+
/**
|
|
502
|
+
* The bed a path carves, as a road or a river: its middle as smooth along it as a road is (the land along it averaged
|
|
503
|
+
* over four cells each way), lowered by `depth`, level across `width`, eased into the land over `banks` cells each
|
|
504
|
+
* side; painted with `ground`, and with water in it for a river
|
|
505
|
+
*
|
|
506
|
+
* @beta
|
|
507
|
+
*/
|
|
508
|
+
export interface PathProfile {
|
|
509
|
+
/** How wide the bed is, in cells: the path's own width when left out */
|
|
510
|
+
width?: number;
|
|
511
|
+
/** How far below the land along it the bed is (0, a road; a river's bed with its water), in the heights' units */
|
|
512
|
+
depth?: number;
|
|
513
|
+
/** A tile of the game's the bed is painted with, by id (over the path's `paint`) */
|
|
514
|
+
ground?: string;
|
|
515
|
+
/** Over how many cells each side the bed is eased into the land: 2 when left out */
|
|
516
|
+
banks?: number;
|
|
517
|
+
/** Water in the bed: deep where `depth` is 1 or more, else shallow (a river, a ford) */
|
|
518
|
+
water?: boolean;
|
|
519
|
+
}
|
|
520
|
+
/**
|
|
521
|
+
* The time of day of a map, in a game with days (`GameModule.day`). The rules': what is done at night is done by it
|
|
522
|
+
*
|
|
523
|
+
* @beta
|
|
524
|
+
*/
|
|
525
|
+
export interface MapDay {
|
|
526
|
+
/** The hour the game starts at. The game's when left out */
|
|
527
|
+
start?: number;
|
|
528
|
+
/** The hour stays where it starts: always night, always noon */
|
|
529
|
+
still?: boolean;
|
|
530
|
+
}
|
|
531
|
+
/**
|
|
532
|
+
* Creeps that guard a spot
|
|
533
|
+
*
|
|
534
|
+
* @beta
|
|
535
|
+
*/
|
|
536
|
+
export interface MapCamp {
|
|
537
|
+
id: number;
|
|
538
|
+
x: number;
|
|
539
|
+
z: number;
|
|
540
|
+
/** Unit types, the first one stands in the middle */
|
|
541
|
+
units: string[];
|
|
542
|
+
/** A name of its own, for the rules to find it by (`campNamed(world, 'ogres')`), see `MapObject.name` */
|
|
543
|
+
name?: string;
|
|
544
|
+
/** What the game's own fields for camps were set to, see `MapObject.data`: the `mapCamp` hook hands it to the game */
|
|
545
|
+
data?: Record<string, unknown>;
|
|
546
|
+
/** Seconds after it is cleared that it comes back (see `Camp.respawn`). The game's rule when left out */
|
|
547
|
+
respawn?: number;
|
|
548
|
+
}
|
|
549
|
+
/**
|
|
550
|
+
* Owner of trees, mines and whatever belongs to nobody
|
|
551
|
+
*
|
|
552
|
+
* @beta
|
|
553
|
+
*/
|
|
554
|
+
export declare const MAP_NEUTRAL: PlayerId;
|
|
555
|
+
/**
|
|
556
|
+
* Owner of the creeps
|
|
557
|
+
*
|
|
558
|
+
* @beta
|
|
559
|
+
*/
|
|
560
|
+
export declare const MAP_CREEPS: PlayerId;
|
|
561
|
+
/**
|
|
562
|
+
* Players a map may have at most, whatever the game: each could be a team of its own, and the fog of war keeps 32
|
|
563
|
+
* teams apart (`MAX_FOG_TEAMS`). How many a game allows is its own (`GameModule.maxPlayers`, 8 when it says nothing)
|
|
564
|
+
*
|
|
565
|
+
* @beta
|
|
566
|
+
*/
|
|
567
|
+
export declare const MAX_MAP_PLAYERS = 32;
|
|
568
|
+
/**
|
|
569
|
+
* Highest cliff level
|
|
570
|
+
*
|
|
571
|
+
* @beta
|
|
572
|
+
*/
|
|
573
|
+
export declare const MAX_LEVEL = 4;
|
|
574
|
+
/** @beta */
|
|
575
|
+
export declare const PLAYER_COLORS: [number, number, number][];
|
|
576
|
+
/** @beta */
|
|
577
|
+
export declare const playerSlot: (id: number) => MapPlayer;
|
|
578
|
+
/** @beta */
|
|
579
|
+
export interface NewMapOptions {
|
|
580
|
+
name?: string;
|
|
581
|
+
width: number;
|
|
582
|
+
depth: number;
|
|
583
|
+
/** Height of the land everywhere */
|
|
584
|
+
height?: number;
|
|
585
|
+
players?: number;
|
|
586
|
+
/** The game it is for, see `GameMap.game` */
|
|
587
|
+
game?: string;
|
|
588
|
+
/** The tiles it can be painted with, by name: the game's (`registry.tiles`). None when left out */
|
|
589
|
+
tileset?: string[];
|
|
590
|
+
}
|
|
591
|
+
/**
|
|
592
|
+
* Flat grass, two players and nothing on it
|
|
593
|
+
*
|
|
594
|
+
* @beta
|
|
595
|
+
*/
|
|
596
|
+
export declare function createMap(options: NewMapOptions): GameMap;
|
|
597
|
+
/**
|
|
598
|
+
* A rectangle of a map, in cells
|
|
599
|
+
*
|
|
600
|
+
* @beta
|
|
601
|
+
*/
|
|
602
|
+
export interface CellRect {
|
|
603
|
+
x: number;
|
|
604
|
+
z: number;
|
|
605
|
+
width: number;
|
|
606
|
+
depth: number;
|
|
607
|
+
}
|
|
608
|
+
/**
|
|
609
|
+
* The largest, the same for the editor and a map file. 512 until a game needs more (S37 is what makes more cost little)
|
|
610
|
+
*
|
|
611
|
+
* @beta
|
|
612
|
+
*/
|
|
613
|
+
export declare const MAX_MAP_SIZE = 512;
|
package/dist/map.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type GameMap } from '../map';
|
|
2
|
+
import type { Vec2 } from '../math';
|
|
3
|
+
import type { Registry } from '../registry';
|
|
4
|
+
import { type Terrain } from '../terrain';
|
|
5
|
+
/**
|
|
6
|
+
* Which cells of a map something on foot can stand on (1) and which have a building or a mine on them (`built`): for
|
|
7
|
+
* the checks, and for what the editor shows of where one can walk and build. `steep` counts slopes too steep to walk
|
|
8
|
+
*
|
|
9
|
+
* @beta
|
|
10
|
+
*/
|
|
11
|
+
export declare function mapCells(map: GameMap, registry: Registry, terrain?: Terrain, steep?: boolean): {
|
|
12
|
+
open: Uint8Array;
|
|
13
|
+
built: Uint8Array;
|
|
14
|
+
};
|
|
15
|
+
/** Cells something on foot can stand on, and which of them it can get to from which: a number per cell, 0 for none */
|
|
16
|
+
export declare function walkingAreas(map: GameMap, registry: Registry): {
|
|
17
|
+
area: Int32Array;
|
|
18
|
+
at: (point: Vec2) => number;
|
|
19
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { GameMap } from '../map';
|
|
2
|
+
import type { MapProblem } from '../mapFields';
|
|
3
|
+
import type { Vec2 } from '../math';
|
|
4
|
+
import type { Registry } from '../registry';
|
|
5
|
+
import type { Terrain } from '../terrain';
|
|
6
|
+
/**
|
|
7
|
+
* What a check of a map is handed besides the map and the game: the terrain the map makes (made once, as the first
|
|
8
|
+
* check asks), and whether a point is on the map
|
|
9
|
+
*
|
|
10
|
+
* @beta
|
|
11
|
+
*/
|
|
12
|
+
export interface MapCheckContext {
|
|
13
|
+
/** The terrain the map makes */
|
|
14
|
+
readonly terrain: Terrain;
|
|
15
|
+
/** Whether a point is on the map: within its width and depth, edges included */
|
|
16
|
+
onMap(point: Vec2): boolean;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* A check of a map (`checkMap`): what it says is wrong (`say`), each problem with the rule it breaks (`MapProblem.rule`),
|
|
20
|
+
* which a map or a game silences. `id` names the check: the engine's by what they look at (`objects`, `walking`), a
|
|
21
|
+
* game's its own
|
|
22
|
+
*
|
|
23
|
+
* @beta
|
|
24
|
+
*/
|
|
25
|
+
export interface MapRule {
|
|
26
|
+
/** What names the check (`objects`, `walking`, a game's own): each problem it says names the rule it breaks */
|
|
27
|
+
id: string;
|
|
28
|
+
/** Says what is wrong with the map (`say`, a problem at a time), the game's registry and the context to go by */
|
|
29
|
+
check(map: GameMap, registry: Registry, say: (problem: MapProblem) => void, context: MapCheckContext): void;
|
|
30
|
+
}
|