@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
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import type { PlayerId } from './entity';
|
|
2
|
+
import { type Message, type MessageRef } from './messages';
|
|
3
|
+
import type { System } from './registry';
|
|
4
|
+
import type { World } from './world';
|
|
5
|
+
/**
|
|
6
|
+
* What a player is set to do, in a mission: survive ten waves, keep the hero alive, build a frost tower
|
|
7
|
+
*
|
|
8
|
+
* @beta
|
|
9
|
+
*/
|
|
10
|
+
export interface ObjectiveDef {
|
|
11
|
+
/** Shared by every game, like other ids: give it a prefix of the game's (`'td.hold'`) */
|
|
12
|
+
id: string;
|
|
13
|
+
/** What it says, in the words of the game: a message key, with params where it shows numbers */
|
|
14
|
+
text: MessageRef;
|
|
15
|
+
/** Whether the mission needs it: all of them done is a victory, one failed a defeat. True when left out */
|
|
16
|
+
required?: boolean;
|
|
17
|
+
/** More about it, in the words of the game: shown under it when the player opens it in the quest panel (campaign plan CP5) */
|
|
18
|
+
detail?: MessageRef;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Typed help for writing one
|
|
22
|
+
*
|
|
23
|
+
* @beta
|
|
24
|
+
*/
|
|
25
|
+
export declare const defineObjective: (def: ObjectiveDef) => ObjectiveDef;
|
|
26
|
+
/** @beta */
|
|
27
|
+
export type ObjectiveStatus = 'open' | 'done' | 'failed';
|
|
28
|
+
/**
|
|
29
|
+
* An objective of a player, as it stands. Plain data: it is kept in the player's state, and sent to their screen
|
|
30
|
+
*
|
|
31
|
+
* @beta
|
|
32
|
+
*/
|
|
33
|
+
export interface ObjectiveState {
|
|
34
|
+
id: string;
|
|
35
|
+
text: Message;
|
|
36
|
+
required: boolean;
|
|
37
|
+
status: ObjectiveStatus;
|
|
38
|
+
/** How far along it is, for the ones that count: 3 of 10 waves */
|
|
39
|
+
progress?: {
|
|
40
|
+
value: number;
|
|
41
|
+
max: number;
|
|
42
|
+
};
|
|
43
|
+
/** Why it failed, for a failed one that says */
|
|
44
|
+
reason?: Message;
|
|
45
|
+
/** More about it (`ObjectiveDef.detail`) */
|
|
46
|
+
detail?: Message;
|
|
47
|
+
}
|
|
48
|
+
/** A player's objectives, in the order they were given */
|
|
49
|
+
export declare const objectives: import("./components").Component<ObjectiveState[], ObjectiveState[]>;
|
|
50
|
+
/**
|
|
51
|
+
* The objectives of the players of a world. What changes in them is the engine's `objectiveChanged` event, which
|
|
52
|
+
* the player is shown, and which a game's listeners and sequences can wait for
|
|
53
|
+
*
|
|
54
|
+
* @beta
|
|
55
|
+
*/
|
|
56
|
+
export declare class Objectives {
|
|
57
|
+
private readonly world;
|
|
58
|
+
constructor(world: World);
|
|
59
|
+
/** Gives a player an objective, open. Its words' params and its progress can be given with it */
|
|
60
|
+
add(player: PlayerId, def: ObjectiveDef, options?: {
|
|
61
|
+
params?: Message['params'];
|
|
62
|
+
progress?: {
|
|
63
|
+
value: number;
|
|
64
|
+
max: number;
|
|
65
|
+
};
|
|
66
|
+
}): ObjectiveState;
|
|
67
|
+
/** Done. Only an open one can be */
|
|
68
|
+
complete(player: PlayerId, id: string): void;
|
|
69
|
+
/** Failed, and why when that is worth saying. Only an open one can be */
|
|
70
|
+
fail(player: PlayerId, id: string, reason?: MessageRef): void;
|
|
71
|
+
/** How far along an open one is. Its words' params can change with it: "wave 3 of 10" */
|
|
72
|
+
progress(player: PlayerId, id: string, value: number, options?: {
|
|
73
|
+
max?: number;
|
|
74
|
+
params?: Message['params'];
|
|
75
|
+
}): void;
|
|
76
|
+
/** A player's objectives, in the order they were given */
|
|
77
|
+
of(player: PlayerId): readonly ObjectiveState[];
|
|
78
|
+
get(player: PlayerId, id: string): ObjectiveState;
|
|
79
|
+
/** Whether a player has the objective, open or not */
|
|
80
|
+
has(player: PlayerId, id: string): boolean;
|
|
81
|
+
private settle;
|
|
82
|
+
private changed;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* The rule of a mission: a player who failed an objective the mission needs is out, and a player who did all of
|
|
86
|
+
* them wins, for their team. Like a melee game, a team whose players are all out loses, and the last team standing
|
|
87
|
+
* wins. A game uses it as its `victory`
|
|
88
|
+
*
|
|
89
|
+
* @beta
|
|
90
|
+
*/
|
|
91
|
+
export declare const objectiveVictory: System;
|
|
92
|
+
/** An objective changed, to whose it is */
|
|
93
|
+
export declare const toldObjective: import("./replication").ReplicatedEvent;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { type EntityId } from '#engine/entity';
|
|
2
|
+
import type { Vec2 } from '#engine/math';
|
|
3
|
+
import type { OrderBehavior, OrderInits } from '#engine/registry';
|
|
4
|
+
/**
|
|
5
|
+
* What `hold` keeps in its order: what it is fighting, 0 for nothing
|
|
6
|
+
*
|
|
7
|
+
* @beta
|
|
8
|
+
*/
|
|
9
|
+
export interface HoldState {
|
|
10
|
+
/** What it fights, 0 for nothing */
|
|
11
|
+
target?: EntityId;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* What `attack` keeps: whether it lost sight and walks to where it last saw its target
|
|
15
|
+
*
|
|
16
|
+
* @beta
|
|
17
|
+
*/
|
|
18
|
+
export interface AttackState {
|
|
19
|
+
/** Walking to where it last saw its target */
|
|
20
|
+
searching?: boolean;
|
|
21
|
+
/** Where it last saw it */
|
|
22
|
+
lastSeen?: Vec2;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* What walking to a point and fighting on the way keeps (`attackMove`, `attackPath`, `patrol`)
|
|
26
|
+
*
|
|
27
|
+
* @beta
|
|
28
|
+
*/
|
|
29
|
+
export interface AdvanceState {
|
|
30
|
+
/** What it fights, 0 for nothing */
|
|
31
|
+
target?: EntityId;
|
|
32
|
+
/** To walk on again once the fight is over */
|
|
33
|
+
resume?: boolean;
|
|
34
|
+
/** Held up behind its own, waiting */
|
|
35
|
+
waiting?: boolean;
|
|
36
|
+
/** The point it last set out for */
|
|
37
|
+
heading?: Vec2;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* What an order along a path keeps (`followPath`, `attackPath`): the bend it goes to next, and which way. Set as it starts
|
|
41
|
+
*
|
|
42
|
+
* @beta
|
|
43
|
+
*/
|
|
44
|
+
export interface AlongPath {
|
|
45
|
+
/** The bend of the path it goes to next, by its place in the path */
|
|
46
|
+
leg: number;
|
|
47
|
+
/** Which way along the path: towards its last point (1) or its first (-1) */
|
|
48
|
+
step: 1 | -1;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* What `patrol` keeps: its two ends and the one it goes to (set as it starts), and whether it found one out of reach
|
|
52
|
+
*
|
|
53
|
+
* @beta
|
|
54
|
+
*/
|
|
55
|
+
export interface PatrolState extends AdvanceState {
|
|
56
|
+
/** The point it was sent to, and where it stood */
|
|
57
|
+
ends: [Vec2, Vec2];
|
|
58
|
+
/** Which of the two it goes to */
|
|
59
|
+
leg: number;
|
|
60
|
+
/** It could not get to the other end */
|
|
61
|
+
stuck?: boolean;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* What `follow` keeps: the tick it last set out after its target
|
|
65
|
+
*
|
|
66
|
+
* @beta
|
|
67
|
+
*/
|
|
68
|
+
export interface FollowState {
|
|
69
|
+
/** The tick it last set out after its target */
|
|
70
|
+
tried?: number;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* What `attackGround` keeps: whether it walked into range already
|
|
74
|
+
*
|
|
75
|
+
* @beta
|
|
76
|
+
*/
|
|
77
|
+
export interface AttackGroundState {
|
|
78
|
+
/** It walked into range already */
|
|
79
|
+
walked?: boolean;
|
|
80
|
+
}
|
|
81
|
+
/** What a move remembers: what it shoots at on its way, with an attack that fires on the move (`AttackDef.onTheMove`) */
|
|
82
|
+
export interface MoveState {
|
|
83
|
+
shooting?: number;
|
|
84
|
+
}
|
|
85
|
+
export declare const moveOrder: OrderBehavior<MoveState, OrderInits['move']>;
|
|
86
|
+
/** Stand still and only fight what comes into range */
|
|
87
|
+
export declare const holdOrder: OrderBehavior<HoldState, OrderInits['hold']>;
|
|
88
|
+
export declare const attackOrder: OrderBehavior<AttackState, OrderInits['attack']>;
|
|
89
|
+
/** Walk to a point, fighting everything met on the way */
|
|
90
|
+
export declare const attackMoveOrder: OrderBehavior<AdvanceState, OrderInits['attackMove']>;
|
|
91
|
+
/** Walk back and forth between where the unit stands and a point, fighting everything met on the way, until told otherwise */
|
|
92
|
+
export declare const patrolOrder: OrderBehavior<PatrolState, OrderInits['patrol']>;
|
|
93
|
+
/** Stay with a unit wherever it goes, for as long as it lives */
|
|
94
|
+
export declare const followOrder: OrderBehavior<FollowState, OrderInits['follow']>;
|
|
95
|
+
/** Attack a spot on the ground, or what stands there, until told otherwise. For attacks that hit an area */
|
|
96
|
+
export declare const attackGroundOrder: OrderBehavior<AttackGroundState, OrderInits['attackGround']>;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { type Cost, type UnitTypeDef } from '#engine/defs';
|
|
2
|
+
import { type Entity, type EntityId, type PlayerId } from '#engine/entity';
|
|
3
|
+
import { type Rect, type Vec2 } from '#engine/math';
|
|
4
|
+
import type { OrderBehavior, OrderInits } from '#engine/registry';
|
|
5
|
+
import type { World } from '#engine/world';
|
|
6
|
+
import { type MessageRef } from '#engine/messages';
|
|
7
|
+
/**
|
|
8
|
+
* Ground a structure of this type covers when placed at `point`
|
|
9
|
+
*
|
|
10
|
+
* @beta
|
|
11
|
+
*/
|
|
12
|
+
export declare function siteOf(def: UnitTypeDef, point: Vec2): Rect & {
|
|
13
|
+
cellX: number;
|
|
14
|
+
cellZ: number;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Why this structure cannot be placed here right now, or undefined when it can. The ground has to be free,
|
|
18
|
+
* then the `canPlace` hook has its say. With `fog`, ground the player has never seen counts as taken too:
|
|
19
|
+
* that is for the player's own preview, which must not give away what is in the dark
|
|
20
|
+
*
|
|
21
|
+
* @beta
|
|
22
|
+
*/
|
|
23
|
+
export declare function placementProblem(world: World, def: UnitTypeDef, point: Vec2, player?: PlayerId, fog?: boolean): MessageRef | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* The resource a building that goes up on one (`UnitTypeDef.builtOn`) would stand on when placed at `point`: one of its
|
|
26
|
+
* kind that covers the very same ground. None where there is none
|
|
27
|
+
*
|
|
28
|
+
* @beta
|
|
29
|
+
*/
|
|
30
|
+
export declare function resourceAt(world: World, def: UnitTypeDef, point: Vec2): Entity | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Which cells of the ground a structure would cover at `point` are in the way, row by row from its corner (`w` across,
|
|
33
|
+
* `d` rows: `siteOf`'s cell first): taken (`free` says no), or not explored (`explored` says no, where it is asked).
|
|
34
|
+
* What a preview draws cell by cell (RV88); `placementProblem` says the whole, the game's own say among it. None for a
|
|
35
|
+
* structure built on a resource, whose ground is the resource's
|
|
36
|
+
*
|
|
37
|
+
* @beta
|
|
38
|
+
*/
|
|
39
|
+
export declare function placementCells(def: UnitTypeDef, point: Vec2, free: (cellX: number, cellZ: number) => boolean, explored?: (cellX: number, cellZ: number) => boolean): boolean[] | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* Whether this structure can be placed here right now, see `placementProblem`
|
|
42
|
+
*
|
|
43
|
+
* @beta
|
|
44
|
+
*/
|
|
45
|
+
export declare function canPlaceStructure(world: World, def: UnitTypeDef, point: Vec2, player?: PlayerId, fog?: boolean): boolean;
|
|
46
|
+
/**
|
|
47
|
+
* What `construct` keeps: the seconds to its builder's next blow of the hammer
|
|
48
|
+
*
|
|
49
|
+
* @beta
|
|
50
|
+
*/
|
|
51
|
+
export interface WorkState {
|
|
52
|
+
/** Seconds to its next blow, for the screen (`worked`) */
|
|
53
|
+
hammer?: number;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* What `build` keeps: whether it walked to the site already, and the building once it is put down
|
|
57
|
+
*
|
|
58
|
+
* @beta
|
|
59
|
+
*/
|
|
60
|
+
export interface BuildState extends WorkState {
|
|
61
|
+
/** It walked to the site already */
|
|
62
|
+
walked?: boolean;
|
|
63
|
+
/** It walks through the others: its walk to the site failed once, held up among them (workers round a mine) */
|
|
64
|
+
ghost?: boolean;
|
|
65
|
+
/** The building, once it is put down */
|
|
66
|
+
building?: EntityId;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* What `repair` keeps: whether it walked to it already, what of the cost it still owes, the seconds to its next swing
|
|
70
|
+
*
|
|
71
|
+
* @beta
|
|
72
|
+
*/
|
|
73
|
+
export interface RepairState {
|
|
74
|
+
/** It walked to it already */
|
|
75
|
+
walked?: boolean;
|
|
76
|
+
/** What of the cost of the repair it owes still */
|
|
77
|
+
owed?: Cost;
|
|
78
|
+
/** Seconds to its next swing */
|
|
79
|
+
hammer?: number;
|
|
80
|
+
}
|
|
81
|
+
export declare const buildOrder: OrderBehavior<BuildState, OrderInits['build']>;
|
|
82
|
+
/** Work on an existing construction site: resuming an abandoned one or helping another builder */
|
|
83
|
+
export declare const constructOrder: OrderBehavior<WorkState, OrderInits['construct']>;
|
|
84
|
+
/**
|
|
85
|
+
* Whether a worker of the player could mend it
|
|
86
|
+
*
|
|
87
|
+
* @beta
|
|
88
|
+
*/
|
|
89
|
+
export declare function canRepair(world: World, player: number, target: Entity): boolean;
|
|
90
|
+
/** Mend a damaged building. It is paid for as the work goes on */
|
|
91
|
+
export declare const repairOrder: OrderBehavior<RepairState, OrderInits['repair']>;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { type AbilityDef } from '#engine/defs';
|
|
2
|
+
import { type Entity, type ItemInstance } from '#engine/entity';
|
|
3
|
+
import { type Vec2 } from '#engine/math';
|
|
4
|
+
import type { OrderBehavior, OrderInits } from '#engine/registry';
|
|
5
|
+
import type { World } from '#engine/world';
|
|
6
|
+
import { type Message } from '#engine/messages';
|
|
7
|
+
import { type TargetFacts } from '#engine/shared';
|
|
8
|
+
/**
|
|
9
|
+
* Whether an ability may be used on a target: as its `targets` say, and the `canTarget` hook
|
|
10
|
+
*
|
|
11
|
+
* @beta
|
|
12
|
+
*/
|
|
13
|
+
export declare function validTarget(world: World, caster: Entity, ability: AbilityDef, target: Entity): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* What a target is to a caster, for `targetRefusal`
|
|
16
|
+
*
|
|
17
|
+
* @beta
|
|
18
|
+
*/
|
|
19
|
+
export declare function targetFacts(world: World, caster: Entity, target: Entity, ability?: AbilityDef): TargetFacts;
|
|
20
|
+
/**
|
|
21
|
+
* How far away the target of an ability may be: what it says, and for some as far as the caster's attacks reach on top
|
|
22
|
+
*
|
|
23
|
+
* @beta
|
|
24
|
+
*/
|
|
25
|
+
export declare function castRange(world: World, caster: Entity, ability: AbilityDef, level: number): number;
|
|
26
|
+
/**
|
|
27
|
+
* Seconds of the wind-up of an ability: in code, or as it says
|
|
28
|
+
*
|
|
29
|
+
* @beta
|
|
30
|
+
*/
|
|
31
|
+
export declare const castTimeOf: (world: World, caster: Entity, ability: AbilityDef, level: number) => number;
|
|
32
|
+
/**
|
|
33
|
+
* Whether the ability is one of the spells the hero brought along, as opposed to what it learned
|
|
34
|
+
*
|
|
35
|
+
* @beta
|
|
36
|
+
*/
|
|
37
|
+
export declare const isSpell: (entity: Entity, ability: AbilityDef) => boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Why an ability cannot be used right now, or undefined when it can. Items ask for no mana, and silence does not stop them
|
|
40
|
+
*
|
|
41
|
+
* @beta
|
|
42
|
+
*/
|
|
43
|
+
export declare function notReady(world: World, entity: Entity, ability: AbilityDef, item?: ItemInstance): Message | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* Pays for an ability and lets it happen. In order:
|
|
46
|
+
* 1. the `beforeCast` hook, which can change the mana cost and the cooldown, or call it off;
|
|
47
|
+
* 2. the caster pays, the cooldown starts, and one of its charges is spent where it has them;
|
|
48
|
+
* 3. the effects of the ability happen;
|
|
49
|
+
* 4. the `afterCast` hook, for what follows: the caster's passives that react to its casts.
|
|
50
|
+
*/
|
|
51
|
+
export declare function fire(world: World, caster: Entity, ability: AbilityDef, target: Entity | undefined, item?: ItemInstance): void;
|
|
52
|
+
/**
|
|
53
|
+
* Casts what goes off on the spot without the caster dropping what it is doing: a hero drinks a potion while it walks,
|
|
54
|
+
* and leaps in the middle of a run. `point` is where it is aimed, for what goes off towards somewhere.
|
|
55
|
+
* False when it cannot be cast this way, and takes an order
|
|
56
|
+
*/
|
|
57
|
+
export declare function castAside(world: World, caster: Entity, from: {
|
|
58
|
+
ability?: string;
|
|
59
|
+
item?: number;
|
|
60
|
+
}, point?: Vec2): boolean;
|
|
61
|
+
/**
|
|
62
|
+
* What `cast` keeps in its order: the seconds of its wind-up left (from when it is in range), whether it walked to its
|
|
63
|
+
* point already, whether it is past turning back (`isCommitted`), what it channels, and whether the ability carries the
|
|
64
|
+
* caster off (a dash)
|
|
65
|
+
*
|
|
66
|
+
* @beta
|
|
67
|
+
*/
|
|
68
|
+
export interface CastState {
|
|
69
|
+
/** Seconds of its wind-up left, from when it is in range */
|
|
70
|
+
windup?: number;
|
|
71
|
+
/** It walked to its point already */
|
|
72
|
+
walked?: boolean;
|
|
73
|
+
/** Past turning back (`isCommitted`) */
|
|
74
|
+
locked?: boolean;
|
|
75
|
+
/** What it channels, once it fired */
|
|
76
|
+
channel?: CastChannel;
|
|
77
|
+
/** The ability carries the caster off (a dash): the order is over when it lands */
|
|
78
|
+
rushing?: boolean;
|
|
79
|
+
}
|
|
80
|
+
/** Use an ability: walk into range, turn towards the target, wind up, fire */
|
|
81
|
+
export declare const castOrder: OrderBehavior<CastState, OrderInits['cast']>;
|
|
82
|
+
/** A channelled ability being kept up: plain data, in the order's state, so that a save has it */
|
|
83
|
+
/**
|
|
84
|
+
* An ability being channelled, kept in the cast order (`CastState.channel`)
|
|
85
|
+
*
|
|
86
|
+
* @beta
|
|
87
|
+
*/
|
|
88
|
+
export interface CastChannel {
|
|
89
|
+
/** The ability, and its level */
|
|
90
|
+
ability: string;
|
|
91
|
+
level: number;
|
|
92
|
+
/** What it is aimed at, and where */
|
|
93
|
+
target?: number;
|
|
94
|
+
point: Vec2;
|
|
95
|
+
/** Seconds still to go, and gone */
|
|
96
|
+
left: number;
|
|
97
|
+
elapsed: number;
|
|
98
|
+
/** Over: kept up to its end, or broken off */
|
|
99
|
+
done?: boolean;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* A caster was hurt: a channelled ability it keeps up that breaks on damage (`channel.breaksOnDamage`, a recall) is
|
|
103
|
+
* broken off, as another order would
|
|
104
|
+
*/
|
|
105
|
+
export declare function hurtWhileChannelling(world: World, caster: Entity): void;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the engine asks of an entity's current order (`orderSays`): its behaviour's to say (`OrderBehavior.committed`,
|
|
3
|
+
* `waiting`, `channelling`, `building`), where it once read those fields of any order's state by name
|
|
4
|
+
*/
|
|
5
|
+
import type { Entity } from '#engine/entity';
|
|
6
|
+
import type { OrderFact } from '#engine/registry';
|
|
7
|
+
import type { World } from '#engine/world';
|
|
8
|
+
/**
|
|
9
|
+
* What an entity's current order says of a fact (`OrderFact`): false for an entity with no order, or an order whose
|
|
10
|
+
* behaviour says nothing of it
|
|
11
|
+
*
|
|
12
|
+
* @beta
|
|
13
|
+
*/
|
|
14
|
+
export declare function orderSays(world: World, entity: Entity, fact: OrderFact): boolean;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import type { ResourceKind } from '#engine/defs';
|
|
2
|
+
import { type Entity, type EntityId, type HarvesterState } from '#engine/entity';
|
|
3
|
+
import type { GatheringInfo } from '#engine/session/protocol';
|
|
4
|
+
import { type Vec2 } from '#engine/math';
|
|
5
|
+
import type { OrderBehavior, OrderInits } from '#engine/registry';
|
|
6
|
+
import type { World } from '#engine/world';
|
|
7
|
+
/**
|
|
8
|
+
* What a worker carries and where it gathers (`UnitTypeDef.harvester`): set as it is spawned (and as its type changes),
|
|
9
|
+
* for a type that gathers. Its owner and their allies are told what it carries (`GatheringInfo`)
|
|
10
|
+
*
|
|
11
|
+
* @beta
|
|
12
|
+
*/
|
|
13
|
+
export declare const gathering: import("#engine/components").Component<HarvesterState, GatheringInfo>;
|
|
14
|
+
/**
|
|
15
|
+
* What a worker carries and where it gathers: none for a type that does not gather (`gathering`)
|
|
16
|
+
*
|
|
17
|
+
* @beta
|
|
18
|
+
*/
|
|
19
|
+
export declare const harvesterOf: (entity: Entity) => HarvesterState | undefined;
|
|
20
|
+
/** Closest building of the player that takes the resource */
|
|
21
|
+
export declare function findDropOff(world: World, entity: Entity, kind?: ResourceKind | null | undefined): Entity | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Whether a worker may gather from a resource: one of a kind it gathers (`harvester.kinds`), and then as the game's
|
|
24
|
+
* `canHarvest` hook says
|
|
25
|
+
*
|
|
26
|
+
* @beta
|
|
27
|
+
*/
|
|
28
|
+
export declare function canHarvest(world: World, worker: Entity, source: Entity): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Closest resource with something left within `radius` of the point, of a kind when one is named.
|
|
31
|
+
* `free` only takes what another worker can still get at. Among equally close ones, the oldest.
|
|
32
|
+
*/
|
|
33
|
+
export declare function findResource(world: World, near: Vec2, radius: number, kind?: ResourceKind, free?: boolean, worker?: Entity, skip?: readonly EntityId[]): Entity | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* What harvesting keeps through every step of it, and from one load to the next: the kind it gathers and where it last
|
|
36
|
+
* did, the resource it holds a place at (`claimed`, a tree, a place round a building on a resource), the building it
|
|
37
|
+
* gathers at (`inPlace`), the place it walks to and the one it waits at, whether it walked to its place already, the
|
|
38
|
+
* seconds to its next swing (`chop`: the rhythm goes on from one load to the next), the hall it brings its loads to
|
|
39
|
+
*
|
|
40
|
+
* @beta
|
|
41
|
+
*/
|
|
42
|
+
export interface HarvestKept {
|
|
43
|
+
kind?: ResourceKind;
|
|
44
|
+
at?: Vec2;
|
|
45
|
+
claimed?: EntityId;
|
|
46
|
+
inPlace?: EntityId;
|
|
47
|
+
spot?: Vec2;
|
|
48
|
+
waitSpot?: Vec2;
|
|
49
|
+
walked?: boolean;
|
|
50
|
+
/** The trees it walked to and could not get next to, the last few: not gone for again by this order */
|
|
51
|
+
outOfReach?: EntityId[];
|
|
52
|
+
chop?: number;
|
|
53
|
+
dropOff?: EntityId;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Walking to its resource, and to its place at it (`HarvestState`)
|
|
57
|
+
*
|
|
58
|
+
* @beta
|
|
59
|
+
*/
|
|
60
|
+
export interface HarvestToResource extends HarvestKept {
|
|
61
|
+
phase: 'toResource';
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* At work (`HarvestState`): the seconds of it left, and what it works (`working`) or is inside of (a mine's, `inside`)
|
|
65
|
+
*
|
|
66
|
+
* @beta
|
|
67
|
+
*/
|
|
68
|
+
export interface HarvestGathering extends HarvestKept {
|
|
69
|
+
phase: 'gathering';
|
|
70
|
+
timer: number;
|
|
71
|
+
working?: EntityId;
|
|
72
|
+
inside?: EntityId;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Bringing the load home (`HarvestState`): whether it is its last, the resource used up
|
|
76
|
+
*
|
|
77
|
+
* @beta
|
|
78
|
+
*/
|
|
79
|
+
export interface HarvestToDropOff extends HarvestKept {
|
|
80
|
+
phase: 'toDropOff';
|
|
81
|
+
last?: boolean;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* What `harvest` and `return` keep in their orders: the step it is at, with what that step keeps beside what every
|
|
85
|
+
* step does (`HarvestKept`). A step's own fields stay in the order as it goes on to the next (a save has them as they
|
|
86
|
+
* were), and are read only in their step
|
|
87
|
+
*
|
|
88
|
+
* @beta
|
|
89
|
+
*/
|
|
90
|
+
export type HarvestState = HarvestToResource | HarvestGathering | HarvestToDropOff;
|
|
91
|
+
/** Gather from a resource, bring it home, repeat */
|
|
92
|
+
export declare const harvestOrder: OrderBehavior<HarvestState, OrderInits['harvest']>;
|
|
93
|
+
/** Hand in what the worker carries, then go back to gathering */
|
|
94
|
+
export declare const returnOrder: OrderBehavior<HarvestState, OrderInits['return']>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Entity } from '#engine/entity';
|
|
2
|
+
import type { World } from '#engine/world';
|
|
3
|
+
/**
|
|
4
|
+
* What units do without orders: attack enemies that come close, fight back
|
|
5
|
+
* when attacked, and return to where they stood afterwards.
|
|
6
|
+
*/
|
|
7
|
+
export declare function idle(world: World, entity: Entity, dt: number): void;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { OrderBehavior, OrderInits } from '#engine/registry';
|
|
2
|
+
/**
|
|
3
|
+
* What the item orders keep: whether they walked to it already
|
|
4
|
+
*
|
|
5
|
+
* @beta
|
|
6
|
+
*/
|
|
7
|
+
export interface ItemOrderState {
|
|
8
|
+
/** It walked to it already */
|
|
9
|
+
walked?: boolean;
|
|
10
|
+
}
|
|
11
|
+
/** Walk to an item on the ground and take it */
|
|
12
|
+
export declare const pickUpOrder: OrderBehavior<ItemOrderState, OrderInits['pickUp']>;
|
|
13
|
+
/** Put an item down somewhere, or hand it to someone */
|
|
14
|
+
export declare const dropItemOrder: OrderBehavior<ItemOrderState, OrderInits['dropItem']>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Entity, Order } from '#engine/entity';
|
|
2
|
+
import type { OrderInit } from '#engine/registry';
|
|
3
|
+
import type { World } from '#engine/world';
|
|
4
|
+
/** Classic RTS games cap queues as well. Mostly a guard against runaway shift-clicking */
|
|
5
|
+
export declare const MAX_QUEUED_ORDERS = 32;
|
|
6
|
+
export declare function createOrder(world: World, init: OrderInit, groupId?: number): Order;
|
|
7
|
+
/** Back to a neutral stance between orders: not walking, not mid swing, free to be pushed. */
|
|
8
|
+
export declare function resetStance(world: World, entity: Entity): void;
|
|
9
|
+
/** Drops everything the entity was doing */
|
|
10
|
+
export declare function clearOrders(world: World, entity: Entity): void;
|
|
11
|
+
/** Whether the entity is in the middle of something it cannot be called away from, like casting (`OrderBehavior.committed`) */
|
|
12
|
+
export declare const isCommitted: (world: World, entity: Entity) => boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Drops what the entity was doing, as far as it lets itself be called away:
|
|
15
|
+
* what it is committed to is finished first, only what was to come after is dropped.
|
|
16
|
+
*/
|
|
17
|
+
export declare function interrupt(world: World, entity: Entity): void;
|
|
18
|
+
/**
|
|
19
|
+
* Gives an order. Queued orders wait their turn, anything else replaces what the unit is doing,
|
|
20
|
+
* or comes right after it when the unit is committed to it.
|
|
21
|
+
*/
|
|
22
|
+
export declare function giveOrder(world: World, entity: Entity, order: Order, queue?: boolean): void;
|
|
23
|
+
/** Removes the order at the front of the queue once it finished */
|
|
24
|
+
export declare function completeOrder(world: World, entity: Entity, order: Order): void;
|