@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,325 @@
|
|
|
1
|
+
import type { DamageTable } from './rules';
|
|
2
|
+
import type { AiProfile } from './ai/profiles';
|
|
3
|
+
import { type AbilityDef, type BuffDef, type ItemDef, type ResourceDef, type UnitTypeDef, type UpgradeDef, type UpkeepTier } from './defs';
|
|
4
|
+
import { type Check } from './fields';
|
|
5
|
+
import type { GameModule } from './game';
|
|
6
|
+
import type { RaceDef } from './races';
|
|
7
|
+
import type { Registry } from './registry';
|
|
8
|
+
/**
|
|
9
|
+
* The kinds of definition a game's data is kept for, by the field of the game module they are listed in
|
|
10
|
+
*
|
|
11
|
+
* @beta
|
|
12
|
+
*/
|
|
13
|
+
export declare const DATA_KINDS: readonly ['units', 'abilities', 'buffs', 'items', 'upgrades', 'races'];
|
|
14
|
+
/** @beta */
|
|
15
|
+
export type DataKind = (typeof DATA_KINDS)[number];
|
|
16
|
+
/**
|
|
17
|
+
* What a definition of each kind must have besides its id and its name, as the type says (`UnitTypeDef.radius`...),
|
|
18
|
+
* with what one made of nothing starts as (`NEW_DEFINITION`: the Data panel's New, from empty). A unit type is a unit
|
|
19
|
+
* unless its `kind` says otherwise
|
|
20
|
+
*
|
|
21
|
+
* @beta
|
|
22
|
+
*/
|
|
23
|
+
export declare const REQUIRED_FIELDS: Readonly<Record<DataKind, Readonly<DataValues>>>;
|
|
24
|
+
/**
|
|
25
|
+
* What a definition in a `data.json` says to be one of its own, made of nothing, where the game has none by its id
|
|
26
|
+
* (`{ "new": true, "name": "Peon", "stats": { "health": 220 } }`): what its kind must have (`REQUIRED_FIELDS`), its
|
|
27
|
+
* name its id until it says, with what else is said over it. A unit type's `kind` is taken from it too
|
|
28
|
+
*
|
|
29
|
+
* @beta
|
|
30
|
+
*/
|
|
31
|
+
export declare const NEW_DEFINITION = "new";
|
|
32
|
+
/**
|
|
33
|
+
* A definition made of nothing, by an id: what its kind must have (`REQUIRED_FIELDS`), named by its id
|
|
34
|
+
*
|
|
35
|
+
* @beta
|
|
36
|
+
*/
|
|
37
|
+
export declare function blankDefinition<K extends DataKind>(kind: K, id: string, unitKind?: string): DataDefs[K];
|
|
38
|
+
/**
|
|
39
|
+
* A definition of each kind
|
|
40
|
+
*
|
|
41
|
+
* @beta
|
|
42
|
+
*/
|
|
43
|
+
export interface DataDefs {
|
|
44
|
+
units: UnitTypeDef;
|
|
45
|
+
abilities: AbilityDef;
|
|
46
|
+
buffs: BuffDef;
|
|
47
|
+
items: ItemDef;
|
|
48
|
+
upgrades: UpgradeDef;
|
|
49
|
+
races: RaceDef;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* What a field of the data can hold: a number, words, yes or no
|
|
53
|
+
*
|
|
54
|
+
* @beta
|
|
55
|
+
*/
|
|
56
|
+
export type DataValue = number | string | boolean;
|
|
57
|
+
/**
|
|
58
|
+
* What a field can be set to: one of those, a list of words (ids: the abilities of a unit, what a building trains), or a
|
|
59
|
+
* list of things whole (the effects of an ability: a `rows` field)
|
|
60
|
+
*
|
|
61
|
+
* @beta
|
|
62
|
+
*/
|
|
63
|
+
export type FieldValue = DataValue | string[] | DataValues[];
|
|
64
|
+
/**
|
|
65
|
+
* What a definition in a `data.json` is a copy of, when the game has none by its id: `{ "copyOf": "footman", "name":
|
|
66
|
+
* "Champion" }` is a footman by another name. The copy is the definition it names, with what else is said over it,
|
|
67
|
+
* and knows what it is a copy of (`basedOn`)
|
|
68
|
+
*
|
|
69
|
+
* @beta
|
|
70
|
+
*/
|
|
71
|
+
export declare const COPY_OF = "copyOf";
|
|
72
|
+
/**
|
|
73
|
+
* Values of a definition, as its own fields nest them: `{ stats: { health: 420 }, cost: { gold: 135 } }`. What a
|
|
74
|
+
* `data.json` keeps of each definition, and what `world.redefine` is given. A list of things by place (a unit's attacks)
|
|
75
|
+
* is written as a list or as its places (`{ attacks: { 0: { damagePoint: 0.5 } } }`), each over the thing there. A list
|
|
76
|
+
* of things changed whole (an ability's effects, the units a race's start adds: a `rows` field) written as places goes
|
|
77
|
+
* over the things there, and written as a list is the list: those things, in that order, each in full
|
|
78
|
+
*
|
|
79
|
+
* @beta
|
|
80
|
+
*/
|
|
81
|
+
export interface DataValues {
|
|
82
|
+
[field: string]: DataValue | DataValue[] | DataValues | DataValues[];
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* The values of a game's definitions, by kind and id: what its `data.json` holds. `removed` takes definitions of the
|
|
86
|
+
* game's out, by kind (the Data panel's Delete): what still names one is the rules' check's to say (`checkRules`)
|
|
87
|
+
*
|
|
88
|
+
* @beta
|
|
89
|
+
*/
|
|
90
|
+
export type GameData = Partial<Record<DataKind, Record<string, DataValues>>> & {
|
|
91
|
+
removed?: Partial<Record<DataKind, string[]>>;
|
|
92
|
+
/**
|
|
93
|
+
* How the game's computers play each race (campaign plan AR4), by race id: each a whole profile, in the place of the
|
|
94
|
+
* code's (`GameModule.ai.races`). What the editor's Data panel writes of a race's AI
|
|
95
|
+
*/
|
|
96
|
+
ai?: {
|
|
97
|
+
races?: Record<string, AiProfile>;
|
|
98
|
+
};
|
|
99
|
+
/** The rules as data (campaign plan RC7), laid over the game's (`DataRules`): what the Data panel's Rules writes */
|
|
100
|
+
rules?: DataRules;
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* The rules a `data.json` may say (campaign plan RC7), each over the game's: the damage table whole, the supply's and
|
|
104
|
+
* the heroes' numbers, the resources and the upkeep's tiers whole (in place of `GameModule.resources`, `upkeep`)
|
|
105
|
+
*
|
|
106
|
+
* @beta
|
|
107
|
+
*/
|
|
108
|
+
export interface DataRules {
|
|
109
|
+
combat?: {
|
|
110
|
+
damageTable?: DamageTable;
|
|
111
|
+
};
|
|
112
|
+
supply?: {
|
|
113
|
+
max?: number;
|
|
114
|
+
pools?: Record<string, {
|
|
115
|
+
name: string;
|
|
116
|
+
max: number;
|
|
117
|
+
}>;
|
|
118
|
+
};
|
|
119
|
+
heroes?: {
|
|
120
|
+
maxHeroes?: number;
|
|
121
|
+
maxHeroLevel?: number;
|
|
122
|
+
xpRange?: number;
|
|
123
|
+
};
|
|
124
|
+
resources?: ResourceDef[];
|
|
125
|
+
upkeep?: UpkeepTier[];
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Why rules said as data are not, where they are first wrong: nothing for rules that are
|
|
129
|
+
*
|
|
130
|
+
* @beta
|
|
131
|
+
*/
|
|
132
|
+
export declare function dataRulesProblem(rules: unknown): string | undefined;
|
|
133
|
+
/**
|
|
134
|
+
* A field of a definition the editor may change, and how it shows it
|
|
135
|
+
*
|
|
136
|
+
* @beta
|
|
137
|
+
*/
|
|
138
|
+
export interface EditableField {
|
|
139
|
+
/** Where it is in the definition, by its fields: `stats.health`, `cost.gold`, `bounty.0` (a place in a list) */
|
|
140
|
+
path: string;
|
|
141
|
+
/** What it is called in the editor: the last part of its path, when left out */
|
|
142
|
+
name?: string;
|
|
143
|
+
/**
|
|
144
|
+
* What it holds. What the definition has there now, when left out (a number where it has nothing). A `list` is of
|
|
145
|
+
* words, in order: ids of the kind `of` says, when it says. An `id` is one id of the kind `of` says (the hall a race
|
|
146
|
+
* starts with), picked from what the game has of that kind. `rows` is a list of things, each with fields of its own
|
|
147
|
+
* (`effects.0.amount`), added, taken out and put in another order whole: an ability's effects
|
|
148
|
+
*/
|
|
149
|
+
kind?: 'number' | 'integer' | 'text' | 'boolean' | 'choice' | 'list' | 'id' | 'rows';
|
|
150
|
+
/** Of a `list` or an `id`: the kind of definition its words are ids of (`abilities` for a unit's abilities) */
|
|
151
|
+
of?: DataKind;
|
|
152
|
+
/**
|
|
153
|
+
* Of a `list`: one id or a list of them (a building's `upgradesTo`). Shown as a list either way; a list of one is
|
|
154
|
+
* kept as the one id
|
|
155
|
+
*/
|
|
156
|
+
one?: boolean;
|
|
157
|
+
min?: number;
|
|
158
|
+
max?: number;
|
|
159
|
+
step?: number;
|
|
160
|
+
/** What a `choice` can be */
|
|
161
|
+
options?: readonly string[];
|
|
162
|
+
/** Of `rows` of effects: the types a row can be, those the game has (`defineEffect`). A row of no type when left out */
|
|
163
|
+
types?: readonly string[];
|
|
164
|
+
/** The heading it is shown under: the first part of its path, when left out (`stats`, `cost`) */
|
|
165
|
+
group?: string;
|
|
166
|
+
/** A line about it, shown when the pointer is over it */
|
|
167
|
+
hint?: string;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* A field as the editor shows it: everything said
|
|
171
|
+
*
|
|
172
|
+
* @beta
|
|
173
|
+
*/
|
|
174
|
+
export interface DataField extends EditableField {
|
|
175
|
+
name: string;
|
|
176
|
+
kind: NonNullable<EditableField['kind']>;
|
|
177
|
+
group: string;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Which fields of a kind of definition can be changed: `all` of them (every number, word and yes or no in the
|
|
181
|
+
* definition, as it has them, but its id and kind), some (their paths, or fields said in full), or none (nothing, or
|
|
182
|
+
* an empty list). A function says it for each definition, as it is now: null for none
|
|
183
|
+
*
|
|
184
|
+
* @beta
|
|
185
|
+
*/
|
|
186
|
+
export type EditableFields<D = unknown> = 'all' | readonly (string | EditableField)[] | ((def: D) => 'all' | readonly (string | EditableField)[] | null);
|
|
187
|
+
/**
|
|
188
|
+
* What of a game's data the editor can change, by kind (`GameModule.editable`). `all` for every field of every definition
|
|
189
|
+
*
|
|
190
|
+
* @beta
|
|
191
|
+
*/
|
|
192
|
+
export type EditableData = 'all' | {
|
|
193
|
+
[K in DataKind]?: EditableFields<DataDefs[K]>;
|
|
194
|
+
};
|
|
195
|
+
/**
|
|
196
|
+
* What is at a path of a definition, or undefined
|
|
197
|
+
*
|
|
198
|
+
* @beta
|
|
199
|
+
*/
|
|
200
|
+
export declare function valueAt(def: unknown, path: string): unknown;
|
|
201
|
+
/**
|
|
202
|
+
* Values with one field set, nested as the path says: `nested('stats.health', 420)` is `{ stats: { health: 420 } }`
|
|
203
|
+
*
|
|
204
|
+
* @beta
|
|
205
|
+
*/
|
|
206
|
+
export declare function nested(path: string, value: FieldValue): DataValues;
|
|
207
|
+
/**
|
|
208
|
+
* The fields an effect of a type has, by their path in it: those its type reads (`defineEffect`'s `fields`), then those
|
|
209
|
+
* every effect may have (`EffectCommon`). Only those every effect may have, for a type the game has not
|
|
210
|
+
*
|
|
211
|
+
* @beta
|
|
212
|
+
*/
|
|
213
|
+
export declare function effectFields(game: Pick<GameModule, 'effects'> | null | undefined, type: string): EditableField[];
|
|
214
|
+
/**
|
|
215
|
+
* The types of effect a game has (`defineEffect`): the engine's and its own, in order of their names
|
|
216
|
+
*
|
|
217
|
+
* @beta
|
|
218
|
+
*/
|
|
219
|
+
export declare function effectTypesOf(game: Pick<GameModule, 'effects'> | null | undefined): string[];
|
|
220
|
+
/**
|
|
221
|
+
* The fields of a definition the editor may change, as the game says (`GameModule.editable`), each with what it
|
|
222
|
+
* holds and the heading it goes under. None for a game that says nothing of that kind
|
|
223
|
+
*
|
|
224
|
+
* @beta
|
|
225
|
+
*/
|
|
226
|
+
export declare function editableFields<K extends DataKind>(game: (Pick<GameModule, 'editable'> & Partial<Pick<GameModule, 'effects' | 'stats'>>) | null | undefined, kind: K, def: DataDefs[K]): DataField[];
|
|
227
|
+
/**
|
|
228
|
+
* A value as a field takes it, or the reason it does not
|
|
229
|
+
*
|
|
230
|
+
* @beta
|
|
231
|
+
*/
|
|
232
|
+
export declare function fitValue(field: DataField, value: unknown): {
|
|
233
|
+
value: FieldValue;
|
|
234
|
+
} | {
|
|
235
|
+
error: string;
|
|
236
|
+
};
|
|
237
|
+
/**
|
|
238
|
+
* A definition with values over it: a copy, the parts the values go into copied too, the rest (its functions, its
|
|
239
|
+
* lists of things) shared with the one it was made from. Values by place (`{ attacks: { 0: { damagePoint: 0.5 } } }`)
|
|
240
|
+
* go into the list there, or make one where there is none. Nothing of the definition given is changed
|
|
241
|
+
*
|
|
242
|
+
* @beta
|
|
243
|
+
*/
|
|
244
|
+
export declare function withValues<D>(def: D, values: DataValues): D;
|
|
245
|
+
/**
|
|
246
|
+
* Values merged: what `b` says over what `a` says, at any depth. Places said over a list go into it (`{ 0: { amount:
|
|
247
|
+
* 50 } }` over a list of effects); a list said is the list
|
|
248
|
+
*
|
|
249
|
+
* @beta
|
|
250
|
+
*/
|
|
251
|
+
export declare function mergeValues(a: DataValues, b: DataValues): DataValues;
|
|
252
|
+
/**
|
|
253
|
+
* Only the values of the fields that can be changed, each as its field takes it. What is not is left out and said:
|
|
254
|
+
* a field the game no longer lets be changed, a value of another kind
|
|
255
|
+
*
|
|
256
|
+
* @beta
|
|
257
|
+
*/
|
|
258
|
+
export declare function editableValues(fields: readonly DataField[], values: DataValues, said?: (why: string) => void): DataValues;
|
|
259
|
+
/**
|
|
260
|
+
* The game with what its `data.json` says over what its code says: `export default withData(game, dataFile)`. Only
|
|
261
|
+
* the fields the game lets be changed (`GameModule.editable`) are taken, and of the kind each holds; anything else in
|
|
262
|
+
* the file is left out, and said in the log. The game given is not changed
|
|
263
|
+
*
|
|
264
|
+
* @beta
|
|
265
|
+
*/
|
|
266
|
+
export declare function withData(game: GameModule, file: unknown): GameModule;
|
|
267
|
+
/**
|
|
268
|
+
* What a world's definitions were changed to while it runs (`world.redefine`), by kind and id: kept with the world
|
|
269
|
+
* and in its save, so that a load has them again
|
|
270
|
+
*
|
|
271
|
+
* @beta
|
|
272
|
+
*/
|
|
273
|
+
export declare const redefinitions: import("./components").Component<GameData, GameData>;
|
|
274
|
+
/**
|
|
275
|
+
* A definition changed while the game runs: what it is now
|
|
276
|
+
*
|
|
277
|
+
* @beta
|
|
278
|
+
*/
|
|
279
|
+
export declare const definitionChanged: import("./events").EventKey<{
|
|
280
|
+
kind: DataKind;
|
|
281
|
+
id: string;
|
|
282
|
+
values?: DataValues;
|
|
283
|
+
}>;
|
|
284
|
+
/**
|
|
285
|
+
* Puts a definition with values over it into the registry, in the place of the one there: what is made of it from
|
|
286
|
+
* then on is made of the new one. False for a definition the game does not have
|
|
287
|
+
*
|
|
288
|
+
* @beta
|
|
289
|
+
*/
|
|
290
|
+
export declare function redefineIn(registry: Registry, kind: DataKind, id: string, values: DataValues): boolean;
|
|
291
|
+
/**
|
|
292
|
+
* A new definition, a copy of one the registry has, by an id it has nothing by: what it is drawn as is the one it is
|
|
293
|
+
* a copy of (`basedOn`) until the game gives it a look of its own. False for one it does not have, or an id it has
|
|
294
|
+
*
|
|
295
|
+
* @beta
|
|
296
|
+
*/
|
|
297
|
+
export declare function copyDefinition(registry: Registry, kind: DataKind, from: string, id: string): boolean;
|
|
298
|
+
/**
|
|
299
|
+
* Takes a definition out of the registry (the Data panel's Delete): what is made of it from then on is not. False for
|
|
300
|
+
* one it has not. Not for a world that runs: its units of the type are there
|
|
301
|
+
*
|
|
302
|
+
* @beta
|
|
303
|
+
*/
|
|
304
|
+
export declare function removeDefinition(registry: Registry, kind: DataKind, id: string): boolean;
|
|
305
|
+
/**
|
|
306
|
+
* The definition of a kind and id in the registry, as it is now, or undefined
|
|
307
|
+
*
|
|
308
|
+
* @beta
|
|
309
|
+
*/
|
|
310
|
+
export declare function definitionIn<K extends DataKind>(registry: Registry, kind: K, id: string): DataDefs[K] | undefined;
|
|
311
|
+
/**
|
|
312
|
+
* Every definition of a kind the registry has
|
|
313
|
+
*
|
|
314
|
+
* @beta
|
|
315
|
+
*/
|
|
316
|
+
export declare function definitionsIn<K extends DataKind>(registry: Registry, kind: K): DataDefs[K][];
|
|
317
|
+
/** Puts what a save kept of the definitions changed while it ran back into the registry: before its entities are made */
|
|
318
|
+
export declare function restoreRedefinitions(registry: Registry, kept: unknown): void;
|
|
319
|
+
/** A path into a definition: names and places, joined by dots */
|
|
320
|
+
/** A path into a definition, as the Data panel names a field: `stats.health` */
|
|
321
|
+
export declare const pathCheck: Check<string>;
|
|
322
|
+
/** A value of a field the Data panel may set: a number, words, yes or no, a list of words, or a list of things whole */
|
|
323
|
+
export declare const valueCheck: Check<FieldValue>;
|
|
324
|
+
/** A definition changed while the game runs (`world.redefine`): to everyone, whose screens read the definitions */
|
|
325
|
+
export declare const toldRedefined: import("./replication").ReplicatedEvent;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A file of a game's own data that its rules read as they run and a panel edits (`defineGameFile`): a campaign's waves,
|
|
3
|
+
* a tower defence's paths. Each world's registry holds what it was read as (`registry.file`), so two games on one page
|
|
4
|
+
* or two rooms of a server each play their own, and the editor's panel changes the one its game plays
|
|
5
|
+
* (`registry.setFile`); the file itself is the game's, written by the editor and taken again as code is (`hotRules`)
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* A file of the game's own data, and how it is read
|
|
9
|
+
*
|
|
10
|
+
* @beta
|
|
11
|
+
*/
|
|
12
|
+
export interface GameFileDef<T> {
|
|
13
|
+
/** Unique in the game: the file's name, as the editor writes it (`waves.json`) */
|
|
14
|
+
readonly id: string;
|
|
15
|
+
/** What the file says, as the game was built with it (an imported JSON file) */
|
|
16
|
+
readonly data: unknown;
|
|
17
|
+
/** What the rules read of it: checked, with what is not of its shape left out */
|
|
18
|
+
read(data: unknown): T;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* A file of the game's own data, for `GameModule.files`: `defineGameFile('waves.json', wavesFile, readWaves)`, read by
|
|
22
|
+
* the rules with `world.registry.file(waves)`
|
|
23
|
+
*
|
|
24
|
+
* @beta
|
|
25
|
+
*/
|
|
26
|
+
export declare function defineGameFile<T>(id: string, data: unknown, read: (data: unknown) => T): GameFileDef<T>;
|
package/dist/gates.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { World } from './world';
|
|
2
|
+
/**
|
|
3
|
+
* A gate opened or shut while the game runs: every screen hears it, to draw it open or shut
|
|
4
|
+
*
|
|
5
|
+
* @beta
|
|
6
|
+
*/
|
|
7
|
+
export declare const gateChanged: import("./events").EventKey<{
|
|
8
|
+
name: string;
|
|
9
|
+
open: boolean;
|
|
10
|
+
}>;
|
|
11
|
+
/**
|
|
12
|
+
* Puts the gates of the map in the world as they are: shut ones in the way of what walks. When the world is made from
|
|
13
|
+
* the map, and again when it is loaded from a save, which keeps which are open but not the obstacles
|
|
14
|
+
*/
|
|
15
|
+
export declare function setUpGates(world: World): void;
|
|
16
|
+
/**
|
|
17
|
+
* Whether a gate of the map is open, by its name. Nothing for a name that is no gate
|
|
18
|
+
*
|
|
19
|
+
* @beta
|
|
20
|
+
*/
|
|
21
|
+
export declare function isGateOpen(world: World, name: string): boolean | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Opens or shuts a gate of the map by its name, while the game runs: what walks goes through it or around, and every
|
|
24
|
+
* screen draws it so (`gateChanged`). False when the map has no gate by that name
|
|
25
|
+
*
|
|
26
|
+
* @beta
|
|
27
|
+
*/
|
|
28
|
+
export declare function setGate(world: World, name: string, open: boolean): boolean;
|