@v12-engine/engine 0.1.0 → 0.4.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/dist/abilities/amounts.d.ts +28 -0
- package/dist/abilities/amounts.js +74 -0
- package/dist/abilities/amounts.js.map +1 -0
- package/dist/abilities/buffs.d.ts +106 -6
- package/dist/abilities/buffs.js +443 -0
- package/dist/abilities/buffs.js.map +1 -0
- package/dist/abilities/castTold.d.ts +2 -0
- package/dist/abilities/castTold.js +66 -0
- package/dist/abilities/castTold.js.map +1 -0
- package/dist/abilities/chance.d.ts +38 -0
- package/dist/abilities/chance.js +77 -0
- package/dist/abilities/chance.js.map +1 -0
- package/dist/abilities/charges.d.ts +18 -0
- package/dist/abilities/charges.js +101 -0
- package/dist/abilities/charges.js.map +1 -0
- package/dist/abilities/control.d.ts +28 -0
- package/dist/abilities/control.js +113 -0
- package/dist/abilities/control.js.map +1 -0
- package/dist/abilities/dispel.js +51 -0
- package/dist/abilities/dispel.js.map +1 -0
- package/dist/abilities/effectFields.d.ts +1 -1
- package/dist/abilities/effectFields.js +676 -0
- package/dist/abilities/effectFields.js.map +1 -0
- package/dist/abilities/effectIndex.d.ts +27 -0
- package/dist/abilities/effectIndex.js +64 -0
- package/dist/abilities/effectIndex.js.map +1 -0
- package/dist/abilities/effects/buff.d.ts +9 -3
- package/dist/abilities/effects/buff.js +84 -0
- package/dist/abilities/effects/buff.js.map +1 -0
- package/dist/abilities/effects/conditions.d.ts +2 -0
- package/dist/abilities/effects/conditions.js +41 -0
- package/dist/abilities/effects/conditions.js.map +1 -0
- package/dist/abilities/effects/core.js +54 -0
- package/dist/abilities/effects/core.js.map +1 -0
- package/dist/abilities/effects/damage.d.ts +1 -1
- package/dist/abilities/effects/damage.js +43 -0
- package/dist/abilities/effects/damage.js.map +1 -0
- package/dist/abilities/effects/heal.d.ts +2 -2
- package/dist/abilities/effects/heal.js +51 -0
- package/dist/abilities/effects/heal.js.map +1 -0
- package/dist/abilities/effects/missile.d.ts +13 -1
- package/dist/abilities/effects/missile.js +104 -0
- package/dist/abilities/effects/missile.js.map +1 -0
- package/dist/abilities/effects/morph.d.ts +5 -0
- package/dist/abilities/effects/morph.js +43 -0
- package/dist/abilities/effects/morph.js.map +1 -0
- package/dist/abilities/effects/moves.d.ts +16 -4
- package/dist/abilities/effects/moves.js +212 -0
- package/dist/abilities/effects/moves.js.map +1 -0
- package/dist/abilities/effects/passives.d.ts +19 -9
- package/dist/abilities/effects/passives.js +131 -0
- package/dist/abilities/effects/passives.js.map +1 -0
- package/dist/abilities/effects/proxy.d.ts +5 -0
- package/dist/abilities/effects/proxy.js +60 -0
- package/dist/abilities/effects/proxy.js.map +1 -0
- package/dist/abilities/effects/sight.d.ts +2 -2
- package/dist/abilities/effects/sight.js +39 -0
- package/dist/abilities/effects/sight.js.map +1 -0
- package/dist/abilities/effects/spawn.d.ts +5 -2
- package/dist/abilities/effects/spawn.js +40 -0
- package/dist/abilities/effects/spawn.js.map +1 -0
- package/dist/abilities/effects/timed.d.ts +2 -2
- package/dist/abilities/effects/timed.js +96 -0
- package/dist/abilities/effects/timed.js.map +1 -0
- package/dist/abilities/effects/trade.d.ts +1 -1
- package/dist/abilities/effects/trade.js +25 -0
- package/dist/abilities/effects/trade.js.map +1 -0
- package/dist/abilities/effects.d.ts +97 -23
- package/dist/abilities/effects.js +860 -0
- package/dist/abilities/effects.js.map +1 -0
- package/dist/abilities/land.d.ts +38 -4
- package/dist/abilities/land.js +189 -0
- package/dist/abilities/land.js.map +1 -0
- package/dist/abilities/recast.d.ts +45 -0
- package/dist/abilities/recast.js +118 -0
- package/dist/abilities/recast.js.map +1 -0
- package/dist/abilities/scaled.js +40 -0
- package/dist/abilities/scaled.js.map +1 -0
- package/dist/abilities/screen.d.ts +6 -0
- package/dist/abilities/screen.js +83 -0
- package/dist/abilities/screen.js.map +1 -0
- package/dist/abilities/shapes.d.ts +66 -0
- package/dist/abilities/shapes.js +122 -0
- package/dist/abilities/shapes.js.map +1 -0
- package/dist/abilities/text.d.ts +14 -2
- package/dist/abilities/text.js +204 -0
- package/dist/abilities/text.js.map +1 -0
- package/dist/abilities/triggers.d.ts +98 -0
- package/dist/abilities/triggers.js +351 -0
- package/dist/abilities/triggers.js.map +1 -0
- package/dist/abilityChanges.d.ts +131 -0
- package/dist/abilityChanges.js +345 -0
- package/dist/abilityChanges.js.map +1 -0
- package/dist/ai/area.d.ts +4 -1
- package/dist/ai/brain.d.ts +4 -1
- package/dist/ai/brain.js +844 -0
- package/dist/ai/brain.js.map +1 -0
- package/dist/ai/budget.js +74 -0
- package/dist/ai/budget.js.map +1 -0
- package/dist/ai/checks.d.ts +9 -1
- package/dist/ai/checks.js +242 -0
- package/dist/ai/checks.js.map +1 -0
- package/dist/ai/computer.d.ts +11 -4
- package/dist/ai/computer.js +251 -0
- package/dist/ai/computer.js.map +1 -0
- package/dist/ai/defence.d.ts +4 -0
- package/dist/ai/defence.js +430 -0
- package/dist/ai/defence.js.map +1 -0
- package/dist/ai/define.d.ts +3 -2
- package/dist/ai/define.js +31 -0
- package/dist/ai/define.js.map +1 -0
- package/dist/ai/economy.d.ts +10 -7
- package/dist/ai/economy.js +780 -0
- package/dist/ai/economy.js.map +1 -0
- package/dist/ai/geometry.js +38 -0
- package/dist/ai/geometry.js.map +1 -0
- package/dist/ai/goals.d.ts +1 -0
- package/dist/ai/goals.js +560 -0
- package/dist/ai/goals.js.map +1 -0
- package/dist/ai/knowledge.d.ts +72 -7
- package/dist/ai/knowledge.js +804 -0
- package/dist/ai/knowledge.js.map +1 -0
- package/dist/ai/lanes.d.ts +10 -2
- package/dist/ai/lanes.js +715 -0
- package/dist/ai/lanes.js.map +1 -0
- package/dist/ai/melee/build.js +264 -0
- package/dist/ai/melee/build.js.map +1 -0
- package/dist/ai/melee/goals.d.ts +7 -0
- package/dist/ai/melee/goals.js +720 -0
- package/dist/ai/melee/goals.js.map +1 -0
- package/dist/ai/melee/heroes.js +68 -0
- package/dist/ai/melee/heroes.js.map +1 -0
- package/dist/ai/melee/index.d.ts +1 -1
- package/dist/ai/melee/index.js +51 -0
- package/dist/ai/melee/index.js.map +1 -0
- package/dist/ai/melee/production.js +29 -0
- package/dist/ai/melee/production.js.map +1 -0
- package/dist/ai/melee/surrender.js +64 -0
- package/dist/ai/melee/surrender.js.map +1 -0
- package/dist/ai/micro.d.ts +9 -0
- package/dist/ai/micro.js +1316 -0
- package/dist/ai/micro.js.map +1 -0
- package/dist/ai/mission.d.ts +9 -2
- package/dist/ai/mission.js +538 -0
- package/dist/ai/mission.js.map +1 -0
- package/dist/ai/missionRules.d.ts +1 -1
- package/dist/ai/missionRules.js +26 -0
- package/dist/ai/missionRules.js.map +1 -0
- package/dist/ai/module.d.ts +6 -2
- package/dist/ai/module.js +37 -0
- package/dist/ai/module.js.map +1 -0
- package/dist/ai/options.d.ts +3 -3
- package/dist/ai/plans/build.d.ts +20 -1
- package/dist/ai/plans/build.js +608 -0
- package/dist/ai/plans/build.js.map +1 -0
- package/dist/ai/plans/placement.d.ts +4 -1
- package/dist/ai/plans/placement.js +295 -0
- package/dist/ai/plans/placement.js.map +1 -0
- package/dist/ai/plans/plans.d.ts +9 -0
- package/dist/ai/plans/plans.js +110 -0
- package/dist/ai/plans/plans.js.map +1 -0
- package/dist/ai/plans/production.d.ts +14 -2
- package/dist/ai/plans/production.js +434 -0
- package/dist/ai/plans/production.js.map +1 -0
- package/dist/ai/plans/purse.d.ts +6 -3
- package/dist/ai/plans/purse.js +139 -0
- package/dist/ai/plans/purse.js.map +1 -0
- package/dist/ai/plans/tech.d.ts +6 -0
- package/dist/ai/plans/tech.js +122 -0
- package/dist/ai/plans/tech.js.map +1 -0
- package/dist/ai/profiles.d.ts +4 -4
- package/dist/{profiles-B3NS9jwk.js → ai/profiles.js} +3 -98
- package/dist/ai/profiles.js.map +1 -0
- package/dist/ai/reach.js +54 -0
- package/dist/ai/reach.js.map +1 -0
- package/dist/ai/report.d.ts +8 -0
- package/dist/ai/report.js +87 -0
- package/dist/ai/report.js.map +1 -0
- package/dist/ai/roles.d.ts +4 -0
- package/dist/ai/roles.js +207 -0
- package/dist/ai/roles.js.map +1 -0
- package/dist/ai/rules.d.ts +8 -2
- package/dist/ai/rules.js +416 -0
- package/dist/ai/rules.js.map +1 -0
- package/dist/ai/scouting.d.ts +6 -0
- package/dist/ai/scouting.js +324 -0
- package/dist/ai/scouting.js.map +1 -0
- package/dist/ai/settings.js +99 -0
- package/dist/ai/settings.js.map +1 -0
- package/dist/ai/squads.d.ts +21 -2
- package/dist/ai/squads.js +916 -0
- package/dist/ai/squads.js.map +1 -0
- package/dist/ai/strength.js +320 -0
- package/dist/ai/strength.js.map +1 -0
- package/dist/ai/task.d.ts +3 -1
- package/dist/ai/task.js +17 -0
- package/dist/ai/task.js.map +1 -0
- package/dist/ai/tasks/attack.js +24 -0
- package/dist/ai/tasks/attack.js.map +1 -0
- package/dist/ai/tasks/capture.d.ts +3 -3
- package/dist/ai/tasks/capture.js +37 -0
- package/dist/ai/tasks/capture.js.map +1 -0
- package/dist/ai/tasks/creep.js +29 -0
- package/dist/ai/tasks/creep.js.map +1 -0
- package/dist/ai/tasks/defend.js +61 -0
- package/dist/ai/tasks/defend.js.map +1 -0
- package/dist/ai/tasks/drop.js +81 -0
- package/dist/ai/tasks/drop.js.map +1 -0
- package/dist/ai/tasks/escort.js +59 -0
- package/dist/ai/tasks/escort.js.map +1 -0
- package/dist/ai/tasks/gather.js +48 -0
- package/dist/ai/tasks/gather.js.map +1 -0
- package/dist/ai/tasks/harass.js +39 -0
- package/dist/ai/tasks/harass.js.map +1 -0
- package/dist/ai/tasks/hold.js +32 -0
- package/dist/ai/tasks/hold.js.map +1 -0
- package/dist/ai/tasks/index.js +34 -0
- package/dist/ai/tasks/index.js.map +1 -0
- package/dist/ai/tasks/move.js +26 -0
- package/dist/ai/tasks/move.js.map +1 -0
- package/dist/ai/tasks/patrol.js +59 -0
- package/dist/ai/tasks/patrol.js.map +1 -0
- package/dist/ai/tasks/retreat.js +28 -0
- package/dist/ai/tasks/retreat.js.map +1 -0
- package/dist/ai/tasks/scout.js +73 -0
- package/dist/ai/tasks/scout.js.map +1 -0
- package/dist/ai/tasks/shared.d.ts +1 -1
- package/dist/ai/tasks/shared.js +137 -0
- package/dist/ai/tasks/shared.js.map +1 -0
- package/dist/ai/team.d.ts +18 -1
- package/dist/ai/team.js +492 -0
- package/dist/ai/team.js.map +1 -0
- package/dist/ai/threat.d.ts +6 -0
- package/dist/ai/threat.js +206 -0
- package/dist/ai/threat.js.map +1 -0
- package/dist/ai/view.d.ts +21 -7
- package/dist/ai/view.js +677 -0
- package/dist/ai/view.js.map +1 -0
- package/dist/ai/waves.d.ts +6 -0
- package/dist/ai/waves.js +410 -0
- package/dist/ai/waves.js.map +1 -0
- package/dist/ai.js +54 -6239
- package/dist/aiTesting.d.ts +6 -3
- package/dist/aiTesting.js +229 -0
- package/dist/aiTesting.js.map +1 -0
- package/dist/areas.d.ts +4 -1
- package/dist/areas.js +295 -0
- package/dist/areas.js.map +1 -0
- package/dist/attacks.d.ts +3 -3
- package/dist/attacks.js +127 -0
- package/dist/attacks.js.map +1 -0
- package/dist/burning.d.ts +267 -0
- package/dist/burning.js +795 -0
- package/dist/burning.js.map +1 -0
- package/dist/bytes.js +21 -0
- package/dist/bytes.js.map +1 -0
- package/dist/callings.d.ts +71 -0
- package/dist/callings.js +157 -0
- package/dist/callings.js.map +1 -0
- package/dist/cameraOrders.d.ts +78 -0
- package/dist/cameraOrders.js +114 -0
- package/dist/cameraOrders.js.map +1 -0
- package/dist/camps.d.ts +70 -4
- package/dist/camps.js +501 -0
- package/dist/camps.js.map +1 -0
- package/dist/capture.d.ts +15 -3
- package/dist/capture.js +304 -0
- package/dist/capture.js.map +1 -0
- package/dist/cellLayers.d.ts +78 -13
- package/dist/cellLayers.js +275 -0
- package/dist/cellLayers.js.map +1 -0
- package/dist/cellPatches.d.ts +24 -0
- package/dist/cellPatches.js +73 -0
- package/dist/cellPatches.js.map +1 -0
- package/dist/cinematics.d.ts +10 -5
- package/dist/cinematics.js +161 -0
- package/dist/cinematics.js.map +1 -0
- package/dist/clock.d.ts +2 -2
- package/dist/clock.js +78 -0
- package/dist/clock.js.map +1 -0
- package/dist/commands.d.ts +36 -4
- package/dist/commands.js +636 -0
- package/dist/commands.js.map +1 -0
- package/dist/components.d.ts +31 -10
- package/dist/components.js +74 -0
- package/dist/components.js.map +1 -0
- package/dist/computers.d.ts +4 -4
- package/dist/computers.js +194 -0
- package/dist/computers.js.map +1 -0
- package/dist/concealment.d.ts +25 -2
- package/dist/concealment.js +409 -0
- package/dist/concealment.js.map +1 -0
- package/dist/coreComponents.js +130 -0
- package/dist/coreComponents.js.map +1 -0
- package/dist/createGame.d.ts +306 -0
- package/dist/createGame.js +405 -0
- package/dist/createGame.js.map +1 -0
- package/dist/dashing.d.ts +18 -2
- package/dist/dashing.js +41 -0
- package/dist/dashing.js.map +1 -0
- package/dist/debug.d.ts +8 -0
- package/dist/debug.js +5 -3
- package/dist/debug2.js +76 -0
- package/dist/debug2.js.map +1 -0
- package/dist/debugCommands.d.ts +6 -6
- package/dist/debugCommands.js +537 -0
- package/dist/debugCommands.js.map +1 -0
- package/dist/debugging.d.ts +1 -0
- package/dist/defaultSets.d.ts +183 -0
- package/dist/defaultSets.js +216 -0
- package/dist/defaultSets.js.map +1 -0
- package/dist/definitions.d.ts +6 -0
- package/dist/definitions.js +78 -0
- package/dist/definitions.js.map +1 -0
- package/dist/defs.d.ts +1895 -165
- package/dist/defs.js +380 -0
- package/dist/defs.js.map +1 -0
- package/dist/denying.d.ts +4 -4
- package/dist/denying.js +106 -0
- package/dist/denying.js.map +1 -0
- package/dist/destructibles.d.ts +2 -2
- package/dist/destructibles.js +36 -0
- package/dist/destructibles.js.map +1 -0
- package/dist/determinism.d.ts +4 -4
- package/dist/determinism.js +247 -0
- package/dist/determinism.js.map +1 -0
- package/dist/dialog.d.ts +17 -2
- package/dist/dialog.js +108 -0
- package/dist/dialog.js.map +1 -0
- package/dist/effectRefs.js +28 -0
- package/dist/effectRefs.js.map +1 -0
- package/dist/effects.d.ts +27 -11
- package/dist/effects.js +110 -0
- package/dist/effects.js.map +1 -0
- package/dist/endings.d.ts +1 -1
- package/dist/endings.js +78 -0
- package/dist/endings.js.map +1 -0
- package/dist/engagement.d.ts +40 -6
- package/dist/engagement.js +530 -0
- package/dist/engagement.js.map +1 -0
- package/dist/engineEvents.d.ts +72 -9
- package/dist/engineEvents.js +520 -0
- package/dist/engineEvents.js.map +1 -0
- package/dist/entity.d.ts +275 -26
- package/dist/entity.js +441 -0
- package/dist/entity.js.map +1 -0
- package/dist/entityIndex.d.ts +10 -3
- package/dist/entityIndex.js +149 -0
- package/dist/entityIndex.js.map +1 -0
- package/dist/errors.d.ts +6 -2
- package/dist/errors.js +59 -0
- package/dist/errors.js.map +1 -0
- package/dist/events.d.ts +11 -5
- package/dist/events.js +158 -0
- package/dist/events.js.map +1 -0
- package/dist/exactMath.js +273 -0
- package/dist/exactMath.js.map +1 -0
- package/dist/features.d.ts +1 -1
- package/dist/features.js +127 -0
- package/dist/features.js.map +1 -0
- package/dist/fields.d.ts +25 -5
- package/dist/fields.js +140 -0
- package/dist/fields.js.map +1 -0
- package/dist/fixture.d.ts +3 -3
- package/dist/fixture.js +512 -0
- package/dist/fixture.js.map +1 -0
- package/dist/fog.d.ts +26 -3
- package/dist/fog.js +333 -0
- package/dist/fog.js.map +1 -0
- package/dist/foliage.d.ts +476 -0
- package/dist/foliage.js +1478 -0
- package/dist/foliage.js.map +1 -0
- package/dist/foliageDebug.d.ts +57 -0
- package/dist/foliageDebug.js +172 -0
- package/dist/foliageDebug.js.map +1 -0
- package/dist/foliageRegrowth.d.ts +20 -0
- package/dist/foliageRegrowth.js +332 -0
- package/dist/foliageRegrowth.js.map +1 -0
- package/dist/formState.d.ts +67 -0
- package/dist/formState.js +65 -0
- package/dist/formState.js.map +1 -0
- package/dist/formation.d.ts +46 -8
- package/dist/formation.js +297 -0
- package/dist/formation.js.map +1 -0
- package/dist/forms.d.ts +58 -0
- package/dist/forms.js +146 -0
- package/dist/forms.js.map +1 -0
- package/dist/friendlyFire.d.ts +2 -2
- package/dist/friendlyFire.js +37 -0
- package/dist/friendlyFire.js.map +1 -0
- package/dist/game.d.ts +141 -48
- package/dist/game.js +834 -0
- package/dist/game.js.map +1 -0
- package/dist/gameData.d.ts +96 -22
- package/dist/gameData.js +1690 -0
- package/dist/gameData.js.map +1 -0
- package/dist/gameFiles.d.ts +3 -3
- package/dist/gameFiles.js +14 -0
- package/dist/gameFiles.js.map +1 -0
- package/dist/gates.js +92 -0
- package/dist/gates.js.map +1 -0
- package/dist/generate.d.ts +28 -1
- package/dist/generate.js +1062 -0
- package/dist/generate.js.map +1 -0
- package/dist/generateWorker.d.ts +7 -3
- package/dist/generateWorker.js +86 -0
- package/dist/generateWorker.js.map +1 -0
- package/dist/grid.d.ts +9 -0
- package/dist/grid.js +102 -0
- package/dist/grid.js.map +1 -0
- package/dist/ground.d.ts +17 -1
- package/dist/ground.js +375 -0
- package/dist/ground.js.map +1 -0
- package/dist/groundObjects.d.ts +70 -0
- package/dist/groundObjects.js +371 -0
- package/dist/groundObjects.js.map +1 -0
- package/dist/groundSpeed.d.ts +20 -3
- package/dist/groundSpeed.js +117 -0
- package/dist/groundSpeed.js.map +1 -0
- package/dist/hero.d.ts +126 -10
- package/dist/hero.js +432 -0
- package/dist/hero.js.map +1 -0
- package/dist/holds.d.ts +94 -0
- package/dist/holds.js +305 -0
- package/dist/holds.js.map +1 -0
- package/dist/home.d.ts +1 -1
- package/dist/home.js +30 -0
- package/dist/home.js.map +1 -0
- package/dist/hooks.d.ts +339 -57
- package/dist/hooks.js +105 -0
- package/dist/hooks.js.map +1 -0
- package/dist/hotReload.d.ts +6 -5
- package/dist/hotReload.js +145 -0
- package/dist/hotReload.js.map +1 -0
- package/dist/ids.d.ts +3 -3
- package/dist/ids.js +30 -0
- package/dist/ids.js.map +1 -0
- package/dist/idsFile.d.ts +36 -0
- package/dist/idsFile.js +134 -0
- package/dist/idsFile.js.map +1 -0
- package/dist/index.d.ts +105 -68
- package/dist/index.js +194 -4701
- package/dist/inspect.d.ts +29 -2
- package/dist/{inspect-D9dWHmZ0.js → inspect.js} +21 -12
- package/dist/inspect.js.map +1 -0
- package/dist/inventory.d.ts +14 -1
- package/dist/inventory.js +84 -0
- package/dist/inventory.js.map +1 -0
- package/dist/items.d.ts +136 -8
- package/dist/items.js +585 -0
- package/dist/items.js.map +1 -0
- package/dist/lanes.d.ts +12 -3
- package/dist/lanes.js +496 -0
- package/dist/lanes.js.map +1 -0
- package/dist/life.d.ts +6 -2
- package/dist/life.js +287 -0
- package/dist/life.js.map +1 -0
- package/dist/log.d.ts +26 -3
- package/dist/log.js +192 -0
- package/dist/log.js.map +1 -0
- package/dist/manaBurn.d.ts +2 -2
- package/dist/manaBurn.js +75 -0
- package/dist/manaBurn.js.map +1 -0
- package/dist/map/file.d.ts +56 -3
- package/dist/map/file.js +264 -0
- package/dist/map/file.js.map +1 -0
- package/dist/map/images.js +61 -0
- package/dist/map/images.js.map +1 -0
- package/dist/map/look.d.ts +1 -1
- package/dist/map/look.js +30 -0
- package/dist/map/look.js.map +1 -0
- package/dist/map/pathProfile.js +183 -0
- package/dist/map/pathProfile.js.map +1 -0
- package/dist/map/resize.d.ts +4 -0
- package/dist/map/resize.js +136 -0
- package/dist/map/resize.js.map +1 -0
- package/dist/map/schema.js +257 -0
- package/dist/map/schema.js.map +1 -0
- package/dist/map/terrain.js +214 -0
- package/dist/map/terrain.js.map +1 -0
- package/dist/map/types.d.ts +92 -13
- package/dist/map/types.js +251 -0
- package/dist/map/types.js.map +1 -0
- package/dist/mapCheck/cells.js +94 -0
- package/dist/mapCheck/cells.js.map +1 -0
- package/dist/mapCheck/rules/foliage.d.ts +9 -0
- package/dist/mapCheck/rules/foliage.js +83 -0
- package/dist/mapCheck/rules/foliage.js.map +1 -0
- package/dist/mapCheck/rules/names.js +39 -0
- package/dist/mapCheck/rules/names.js.map +1 -0
- package/dist/mapCheck/rules/objects.d.ts +1 -1
- package/dist/mapCheck/rules/objects.js +56 -0
- package/dist/mapCheck/rules/objects.js.map +1 -0
- package/dist/mapCheck/rules/paths.js +32 -0
- package/dist/mapCheck/rules/paths.js.map +1 -0
- package/dist/mapCheck/rules/players.js +20 -0
- package/dist/mapCheck/rules/players.js.map +1 -0
- package/dist/mapCheck/rules/races.js +56 -0
- package/dist/mapCheck/rules/races.js.map +1 -0
- package/dist/mapCheck/rules/random.js +47 -0
- package/dist/mapCheck/rules/random.js.map +1 -0
- package/dist/mapCheck/rules/regions.js +30 -0
- package/dist/mapCheck/rules/regions.js.map +1 -0
- package/dist/mapCheck/rules/targets.js +31 -0
- package/dist/mapCheck/rules/targets.js.map +1 -0
- package/dist/mapCheck/rules/walking.js +45 -0
- package/dist/mapCheck/rules/walking.js.map +1 -0
- package/dist/mapCheck.d.ts +2 -2
- package/dist/mapCheck.js +63 -0
- package/dist/mapCheck.js.map +1 -0
- package/dist/mapFields.d.ts +25 -2
- package/dist/mapFields.js +134 -0
- package/dist/mapFields.js.map +1 -0
- package/dist/mapFile.js +176 -0
- package/dist/mapFile.js.map +1 -0
- package/dist/mapMeasure.d.ts +8 -0
- package/dist/mapMeasure.js +283 -0
- package/dist/mapMeasure.js.map +1 -0
- package/dist/mapMerge.d.ts +1 -0
- package/dist/mapMerge.js +172 -0
- package/dist/mapMerge.js.map +1 -0
- package/dist/mapObjectives.js +138 -0
- package/dist/mapObjectives.js.map +1 -0
- package/dist/mapObjects.js +80 -0
- package/dist/mapObjects.js.map +1 -0
- package/dist/math.d.ts +37 -7
- package/dist/math.js +155 -0
- package/dist/math.js.map +1 -0
- package/dist/messages.d.ts +71 -4
- package/dist/messages.js +29 -0
- package/dist/messages.js.map +1 -0
- package/dist/missionRules.d.ts +10 -2
- package/dist/{missionRules-C-bGxm0Q.js → missionRules.js} +30 -150
- package/dist/missionRules.js.map +1 -0
- package/dist/mods.d.ts +39 -20
- package/dist/mods.js +271 -0
- package/dist/mods.js.map +1 -0
- package/dist/moves.d.ts +87 -0
- package/dist/moves.js +539 -0
- package/dist/moves.js.map +1 -0
- package/dist/names.d.ts +7 -0
- package/dist/names.js +122 -0
- package/dist/names.js.map +1 -0
- package/dist/navigation/agentParams.js +14 -0
- package/dist/navigation/agentParams.js.map +1 -0
- package/dist/navigation/air.d.ts +7 -3
- package/dist/navigation/air.js +401 -0
- package/dist/navigation/air.js.map +1 -0
- package/dist/navigation/builds.d.ts +34 -2
- package/dist/navigation/builds.js +287 -0
- package/dist/navigation/builds.js.map +1 -0
- package/dist/navigation/groundAreas.d.ts +59 -1
- package/dist/navigation/groundAreas.js +407 -0
- package/dist/navigation/groundAreas.js.map +1 -0
- package/dist/navigation/navigation.d.ts +98 -9
- package/dist/navigation/recast.d.ts +194 -18
- package/dist/navigation/recast.js +1379 -0
- package/dist/navigation/recast.js.map +1 -0
- package/dist/navigation/sidePaths.d.ts +8 -3
- package/dist/navigation/sidePaths.js +241 -0
- package/dist/navigation/sidePaths.js.map +1 -0
- package/dist/navigation/sized.js +243 -0
- package/dist/navigation/sized.js.map +1 -0
- package/dist/nearest.js +32 -0
- package/dist/nearest.js.map +1 -0
- package/dist/noise.js +59 -0
- package/dist/noise.js.map +1 -0
- package/dist/objectives.d.ts +12 -3
- package/dist/objectives.js +144 -0
- package/dist/objectives.js.map +1 -0
- package/dist/orders/basic.d.ts +5 -5
- package/dist/orders/basic.js +417 -0
- package/dist/orders/basic.js.map +1 -0
- package/dist/orders/build.js +278 -0
- package/dist/orders/build.js.map +1 -0
- package/dist/orders/cast.d.ts +13 -3
- package/dist/orders/cast.js +558 -0
- package/dist/orders/cast.js.map +1 -0
- package/dist/orders/facts.js +16 -0
- package/dist/orders/facts.js.map +1 -0
- package/dist/orders/harvest.d.ts +21 -5
- package/dist/orders/harvest.js +540 -0
- package/dist/orders/harvest.js.map +1 -0
- package/dist/orders/idle.d.ts +3 -1
- package/dist/orders/idle.js +234 -0
- package/dist/orders/idle.js.map +1 -0
- package/dist/orders/items.js +92 -0
- package/dist/orders/items.js.map +1 -0
- package/dist/orders/queue.js +108 -0
- package/dist/orders/queue.js.map +1 -0
- package/dist/orders/waiting.d.ts +39 -0
- package/dist/orders/waiting.js +149 -0
- package/dist/orders/waiting.js.map +1 -0
- package/dist/pack.schema.js +13 -0
- package/dist/pack.schema.js.map +1 -0
- package/dist/pack.schema.json +7622 -841
- package/dist/packs/director/index.d.ts +13 -5
- package/dist/packs/director/index.js +204 -0
- package/dist/packs/director/index.js.map +1 -0
- package/dist/packs/heroes/campaign.d.ts +3 -2
- package/dist/packs/heroes/campaign.js +241 -0
- package/dist/packs/heroes/campaign.js.map +1 -0
- package/dist/packs/heroes/carry.d.ts +6 -0
- package/dist/packs/heroes/carry.js +112 -0
- package/dist/packs/heroes/carry.js.map +1 -0
- package/dist/packs/heroes/commands.js +115 -0
- package/dist/packs/heroes/commands.js.map +1 -0
- package/dist/packs/heroes/fallen.d.ts +43 -0
- package/dist/packs/heroes/fallen.js +61 -0
- package/dist/packs/heroes/fallen.js.map +1 -0
- package/dist/packs/heroes/hire.js +60 -0
- package/dist/packs/heroes/hire.js.map +1 -0
- package/dist/packs/heroes/index.d.ts +7 -6
- package/dist/packs/heroes/index.js +130 -0
- package/dist/packs/heroes/index.js.map +1 -0
- package/dist/packs/heroes/loop.d.ts +95 -0
- package/dist/packs/heroes/loop.js +250 -0
- package/dist/packs/heroes/loop.js.map +1 -0
- package/dist/packs/heroes/making.d.ts +6 -3
- package/dist/packs/heroes/making.js +55 -0
- package/dist/packs/heroes/making.js.map +1 -0
- package/dist/packs/heroes/respawn.d.ts +3 -3
- package/dist/packs/heroes/respawn.js +87 -0
- package/dist/packs/heroes/respawn.js.map +1 -0
- package/dist/packs/heroes/sets.d.ts +32 -0
- package/dist/packs/heroes/sets.js +51 -0
- package/dist/packs/heroes/sets.js.map +1 -0
- package/dist/packs/heroes/spells.d.ts +16 -0
- package/dist/packs/heroes/spells.js +269 -0
- package/dist/packs/heroes/spells.js.map +1 -0
- package/dist/packs/items/defaults.d.ts +43 -0
- package/dist/packs/items/defaults.js +1504 -0
- package/dist/packs/items/defaults.js.map +1 -0
- package/dist/packs/items/index.d.ts +27 -0
- package/dist/packs/items/index.js +214 -0
- package/dist/packs/items/index.js.map +1 -0
- package/dist/packs/moba/index.d.ts +3 -3
- package/dist/packs/moba/index.js +174 -0
- package/dist/packs/moba/index.js.map +1 -0
- package/dist/packs/pack.d.ts +15 -15
- package/dist/packs/pack.js +14 -0
- package/dist/packs/pack.js.map +1 -0
- package/dist/packs.d.ts +15 -7
- package/dist/packs.js +222 -0
- package/dist/packs.js.map +1 -0
- package/dist/paths.d.ts +2 -0
- package/dist/paths.js +109 -0
- package/dist/paths.js.map +1 -0
- package/dist/plain.js +57 -0
- package/dist/plain.js.map +1 -0
- package/dist/player.d.ts +33 -10
- package/dist/player.js +159 -0
- package/dist/player.js.map +1 -0
- package/dist/portals.d.ts +1 -1
- package/dist/portals.js +194 -0
- package/dist/portals.js.map +1 -0
- package/dist/prefabs.d.ts +25 -2
- package/dist/prefabs.js +239 -0
- package/dist/prefabs.js.map +1 -0
- package/dist/presetBuildings.js +58 -0
- package/dist/presetBuildings.js.map +1 -0
- package/dist/presetFoliage.d.ts +27 -0
- package/dist/presetFoliage.js +98 -0
- package/dist/presetFoliage.js.map +1 -0
- package/dist/presetGround.js +65 -0
- package/dist/presetGround.js.map +1 -0
- package/dist/proxies.d.ts +12 -0
- package/dist/proxies.js +79 -0
- package/dist/proxies.js.map +1 -0
- package/dist/query.d.ts +56 -0
- package/dist/query.js +88 -0
- package/dist/query.js.map +1 -0
- package/dist/races.d.ts +15 -14
- package/dist/races.js +172 -0
- package/dist/races.js.map +1 -0
- package/dist/randomGroups.js +91 -0
- package/dist/randomGroups.js.map +1 -0
- package/dist/registry.d.ts +117 -53
- package/dist/registry.js +323 -0
- package/dist/registry.js.map +1 -0
- package/dist/remains.d.ts +11 -9
- package/dist/remains.js +188 -0
- package/dist/remains.js.map +1 -0
- package/dist/replication.d.ts +12 -7
- package/dist/replication.js +100 -0
- package/dist/replication.js.map +1 -0
- package/dist/rng.d.ts +2 -0
- package/dist/rng.js +40 -0
- package/dist/rng.js.map +1 -0
- package/dist/rules.d.ts +186 -99
- package/dist/rules.js +179 -0
- package/dist/rules.js.map +1 -0
- package/dist/rulesCheck.d.ts +5 -4
- package/dist/rulesCheck.js +693 -0
- package/dist/rulesCheck.js.map +1 -0
- package/dist/runes.d.ts +2 -2
- package/dist/runes.js +80 -0
- package/dist/runes.js.map +1 -0
- package/dist/save.d.ts +37 -12
- package/dist/save.js +532 -0
- package/dist/save.js.map +1 -0
- package/dist/scenario.d.ts +2 -2
- package/dist/scenario.js +99 -0
- package/dist/scenario.js.map +1 -0
- package/dist/scheduler.d.ts +3 -0
- package/dist/scheduler.js +156 -0
- package/dist/scheduler.js.map +1 -0
- package/dist/score.d.ts +19 -19
- package/dist/score.js +709 -0
- package/dist/score.js.map +1 -0
- package/dist/sequences.d.ts +10 -6
- package/dist/sequences.js +206 -0
- package/dist/sequences.js.map +1 -0
- package/dist/server/doorman.js +154 -0
- package/dist/server/doorman.js.map +1 -0
- package/dist/server/gameServer.d.ts +16 -1
- package/dist/server/gameServer.js +643 -0
- package/dist/server/gameServer.js.map +1 -0
- package/dist/server/index.d.ts +1 -1
- package/dist/server/lobby.js +199 -0
- package/dist/server/lobby.js.map +1 -0
- package/dist/server/log.js +18 -0
- package/dist/server/log.js.map +1 -0
- package/dist/server/match.js +267 -0
- package/dist/server/match.js.map +1 -0
- package/dist/server/mode.d.ts +18 -9
- package/dist/server/mode.js +220 -0
- package/dist/server/mode.js.map +1 -0
- package/dist/{navigation-worker.js → server/navigation-worker.js} +1 -1
- package/dist/server/navigation-worker.js.map +1 -0
- package/dist/server/navigation.js +39 -0
- package/dist/server/navigation.js.map +1 -0
- package/dist/server/ops.d.ts +4 -0
- package/dist/server/ops.js +137 -0
- package/dist/server/ops.js.map +1 -0
- package/dist/server/packs.d.ts +3 -3
- package/dist/server/packs.js +32 -0
- package/dist/server/packs.js.map +1 -0
- package/dist/server/ratings.d.ts +5 -0
- package/dist/server/ratings.js +104 -0
- package/dist/server/ratings.js.map +1 -0
- package/dist/server/relay.d.ts +12 -2
- package/dist/server/relay.js +144 -0
- package/dist/server/relay.js.map +1 -0
- package/dist/server/rooms.d.ts +9 -2
- package/dist/server/rooms.js +442 -0
- package/dist/server/rooms.js.map +1 -0
- package/dist/server/seat.js +116 -0
- package/dist/server/seat.js.map +1 -0
- package/dist/server/seatSettings.d.ts +3 -3
- package/dist/server/seatSettings.js +63 -0
- package/dist/server/seatSettings.js.map +1 -0
- package/dist/server/secret.js +13 -0
- package/dist/server/secret.js.map +1 -0
- package/dist/server/start.d.ts +13 -6
- package/dist/server/start.js +76 -0
- package/dist/server/start.js.map +1 -0
- package/dist/server/websocket.d.ts +9 -1
- package/dist/server/websocket.js +306 -0
- package/dist/server/websocket.js.map +1 -0
- package/dist/server.js +15 -2861
- package/dist/session/can.js +26 -0
- package/dist/session/can.js.map +1 -0
- package/dist/session/commandReplay.d.ts +8 -2
- package/dist/session/commandReplay.js +293 -0
- package/dist/session/commandReplay.js.map +1 -0
- package/dist/session/debug.js +151 -0
- package/dist/session/debug.js.map +1 -0
- package/dist/session/delay.js +62 -0
- package/dist/session/delay.js.map +1 -0
- package/dist/session/delta.d.ts +14 -1
- package/dist/session/delta.js +407 -0
- package/dist/session/delta.js.map +1 -0
- package/dist/session/entityState.js +415 -0
- package/dist/session/entityState.js.map +1 -0
- package/dist/session/local.d.ts +47 -5
- package/dist/session/local.js +670 -0
- package/dist/session/local.js.map +1 -0
- package/dist/session/memory.d.ts +20 -2
- package/dist/session/memory.js +131 -0
- package/dist/session/memory.js.map +1 -0
- package/dist/session/protocol.d.ts +325 -31
- package/dist/session/protocol.js +55 -0
- package/dist/session/protocol.js.map +1 -0
- package/dist/session/remote.d.ts +74 -12
- package/dist/session/remote.js +1394 -0
- package/dist/session/remote.js.map +1 -0
- package/dist/session/replay.d.ts +11 -2
- package/dist/session/replay.js +160 -0
- package/dist/session/replay.js.map +1 -0
- package/dist/session/seed.js +12 -0
- package/dist/session/seed.js.map +1 -0
- package/dist/session/share.d.ts +5 -1
- package/dist/session/share.js +94 -0
- package/dist/session/share.js.map +1 -0
- package/dist/session/socket.d.ts +1 -1
- package/dist/session/socket.js +29 -0
- package/dist/session/socket.js.map +1 -0
- package/dist/session/wire.d.ts +5 -0
- package/dist/session/wire.js +84 -0
- package/dist/session/wire.js.map +1 -0
- package/dist/session/worker.d.ts +77 -12
- package/dist/session/worker.js +499 -0
- package/dist/session/worker.js.map +1 -0
- package/dist/shared.d.ts +31 -5
- package/dist/shared.js +166 -0
- package/dist/shared.js.map +1 -0
- package/dist/sides.d.ts +9 -3
- package/dist/sides.js +149 -0
- package/dist/sides.js.map +1 -0
- package/dist/sight.js +85 -0
- package/dist/sight.js.map +1 -0
- package/dist/simulate-worker.js +1 -1
- package/dist/simulate.d.ts +12 -8
- package/dist/{simulate-oXBiw1Ff.js → simulate.js} +10 -11
- package/dist/simulate.js.map +1 -0
- package/dist/smart.js +77 -0
- package/dist/smart.js.map +1 -0
- package/dist/spatial.d.ts +32 -16
- package/dist/spatial.js +234 -0
- package/dist/spatial.js.map +1 -0
- package/dist/spawning.d.ts +1 -0
- package/dist/spawning.js +224 -0
- package/dist/spawning.js.map +1 -0
- package/dist/stances.d.ts +6 -3
- package/dist/stances.js +169 -0
- package/dist/stances.js.map +1 -0
- package/dist/start.d.ts +10 -10
- package/dist/start.js +75 -0
- package/dist/start.js.map +1 -0
- package/dist/stats.d.ts +42 -16
- package/dist/stats.js +290 -0
- package/dist/stats.js.map +1 -0
- package/dist/summoned.d.ts +52 -0
- package/dist/summoned.js +38 -0
- package/dist/summoned.js.map +1 -0
- package/dist/summons.d.ts +10 -13
- package/dist/summons.js +271 -0
- package/dist/summons.js.map +1 -0
- package/dist/systems/abilities.js +224 -0
- package/dist/systems/abilities.js.map +1 -0
- package/dist/systems/combat.d.ts +35 -1
- package/dist/systems/combat.js +677 -0
- package/dist/systems/combat.js.map +1 -0
- package/dist/systems/combatTold.d.ts +3 -1
- package/dist/systems/combatTold.js +85 -0
- package/dist/systems/combatTold.js.map +1 -0
- package/dist/systems/construction.js +80 -0
- package/dist/systems/construction.js.map +1 -0
- package/dist/systems/economy.d.ts +0 -6
- package/dist/systems/economy.js +128 -0
- package/dist/systems/economy.js.map +1 -0
- package/dist/systems/fog.d.ts +1 -1
- package/dist/systems/fog.js +120 -0
- package/dist/systems/fog.js.map +1 -0
- package/dist/systems/life.js +32 -0
- package/dist/systems/life.js.map +1 -0
- package/dist/systems/movement.d.ts +24 -12
- package/dist/systems/movement.js +1247 -0
- package/dist/systems/movement.js.map +1 -0
- package/dist/systems/orders.js +64 -0
- package/dist/systems/orders.js.map +1 -0
- package/dist/systems/production.js +322 -0
- package/dist/systems/production.js.map +1 -0
- package/dist/systems/productionQueue.js +120 -0
- package/dist/systems/productionQueue.js.map +1 -0
- package/dist/systems/victory.d.ts +1 -1
- package/dist/systems/victory.js +56 -0
- package/dist/systems/victory.js.map +1 -0
- package/dist/talk.d.ts +6 -6
- package/dist/talk.js +153 -0
- package/dist/talk.js.map +1 -0
- package/dist/targeting.d.ts +142 -0
- package/dist/targeting.js +49 -0
- package/dist/targeting.js.map +1 -0
- package/dist/tech.d.ts +20 -3
- package/dist/tech.js +239 -0
- package/dist/tech.js.map +1 -0
- package/dist/techTree.d.ts +7 -0
- package/dist/techTree.js +90 -0
- package/dist/techTree.js.map +1 -0
- package/dist/terrain.d.ts +59 -7
- package/dist/terrain.js +389 -0
- package/dist/terrain.js.map +1 -0
- package/dist/terrainSave.d.ts +6 -0
- package/dist/terrainSave.js +74 -0
- package/dist/terrainSave.js.map +1 -0
- package/dist/testing.d.ts +8 -7
- package/dist/testing.js +13 -739
- package/dist/testing.js.map +1 -1
- package/dist/tiles.d.ts +1 -1
- package/dist/tiles.js +43 -0
- package/dist/tiles.js.map +1 -0
- package/dist/timers.d.ts +29 -4
- package/dist/timers.js +242 -0
- package/dist/timers.js.map +1 -0
- package/dist/tomes.d.ts +4 -4
- package/dist/tomes.js +94 -0
- package/dist/tomes.js.map +1 -0
- package/dist/trade.js +103 -0
- package/dist/trade.js.map +1 -0
- package/dist/transport.d.ts +6 -1
- package/dist/transport.js +281 -0
- package/dist/transport.js.map +1 -0
- package/dist/tunables.d.ts +10 -3
- package/dist/tunables.js +56 -0
- package/dist/tunables.js.map +1 -0
- package/dist/unitResources.d.ts +67 -0
- package/dist/unitResources.js +266 -0
- package/dist/unitResources.js.map +1 -0
- package/dist/upkeep.d.ts +6 -1
- package/dist/upkeep.js +26 -0
- package/dist/upkeep.js.map +1 -0
- package/dist/veterancy.d.ts +8 -3
- package/dist/veterancy.js +131 -0
- package/dist/veterancy.js.map +1 -0
- package/dist/vision.d.ts +36 -0
- package/dist/vision.js +133 -0
- package/dist/vision.js.map +1 -0
- package/dist/walls.d.ts +1 -1
- package/dist/walls.js +278 -0
- package/dist/walls.js.map +1 -0
- package/dist/world.d.ts +606 -88
- package/dist/world.js +1263 -0
- package/dist/world.js.map +1 -0
- package/package.json +2 -2
- package/dist/ai.js.map +0 -1
- package/dist/attributes.d.ts +0 -66
- package/dist/brain-BvVdUhX8.js +0 -7659
- package/dist/brain-BvVdUhX8.js.map +0 -1
- package/dist/builds-C6LfgvEU.js +0 -460
- package/dist/builds-C6LfgvEU.js.map +0 -1
- package/dist/coreComponents-syuh2fPG.js +0 -5149
- package/dist/coreComponents-syuh2fPG.js.map +0 -1
- package/dist/debugCommands-CzjrSm66.js +0 -14739
- package/dist/debugCommands-CzjrSm66.js.map +0 -1
- package/dist/determinism-BCymQwiE.js +0 -518
- package/dist/determinism-BCymQwiE.js.map +0 -1
- package/dist/game-DiJEN-Ks.js +0 -5800
- package/dist/game-DiJEN-Ks.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/inspect-D9dWHmZ0.js.map +0 -1
- package/dist/local-Dkovq42k.js +0 -1379
- package/dist/local-Dkovq42k.js.map +0 -1
- package/dist/missionRules-C-bGxm0Q.js.map +0 -1
- package/dist/navigation-worker.js.map +0 -1
- package/dist/packs-g5thvmGn.js +0 -3199
- package/dist/packs-g5thvmGn.js.map +0 -1
- package/dist/profiles-B3NS9jwk.js.map +0 -1
- package/dist/server.js.map +0 -1
- package/dist/simulate-oXBiw1Ff.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mapObjectives.js","names":[],"sources":["../src/mapObjectives.ts"],"sourcesContent":["import type { PlayerId } from './entity'\nimport { defineHook } from './hooks'\nimport type { GameMap } from './map'\nimport type { MapProblem } from './mapFields'\nimport type { Message } from './messages'\nimport type { ObjectiveDef, ObjectiveState } from './objectives'\nimport type { GamePack } from './packs/pack'\nimport type { World } from './world'\n\n/*\n * Objectives as data on the map (campaign plan EQ3): a list kept in the map's data (`GameMap.data.objectives`), which\n * the editor's Objectives panel writes, and which the map objectives pack reads (`mapObjectives`): those given at the\n * start are each player's as the world is made from the map, the rest are given by the rules by id\n * (`giveMapObjective`). What becomes of them, done or failed, is the rules' as for any objective (`world.objectives`)\n */\n\n/**\n * The map objectives pack's id\n *\n * @beta\n */\nexport const MAP_OBJECTIVES = 'core.mapObjectives'\n\n/**\n * The key of the map's data its objectives are kept under (`GameMap.data.objectives`)\n *\n * @beta\n */\nexport const MAP_OBJECTIVES_KEY = 'objectives'\n\n/**\n * An objective a map gives, as it keeps it: an objective (`ObjectiveDef`: its id, its words, whether the mission needs\n * it, more about it) and when it is given\n *\n * @beta\n */\nexport interface MapObjective extends ObjectiveDef {\n\t/**\n\t * When it is given: as the game starts (`start`), to every player a person plays (`mapObjectivePlayers`), or when\n\t * the rules say (`rule`: `giveMapObjective(world, id)`). Anything but `rule` is the start\n\t */\n\tat: 'start' | 'rule'\n}\n\n/** The words of an objective as a file may hold them: a key, or a key with params */\nconst isWords = (text: unknown): boolean =>\n\ttypeof text === 'string'\n\t\t? text.trim() !== ''\n\t\t: typeof text === 'object' && text !== null && typeof (text as Message).key === 'string' && (text as Message).key !== ''\n\n/**\n * The objectives a map gives (`GameMap.data.objectives`), in the order it gives them: none for a map with none. What is\n * kept there and is no objective (no id, no words) is left out, so that a file changed by hand breaks no rule that reads\n * it; the map's checks say so (`mapObjectives`)\n *\n * @beta\n */\nexport function mapObjectivesOf(map: { readonly data: Readonly<Record<string, unknown>> }): MapObjective[] {\n\tconst kept = map.data[MAP_OBJECTIVES_KEY]\n\tif (!Array.isArray(kept)) return []\n\treturn kept\n\t\t.filter(\n\t\t\t(each): each is MapObjective => typeof each === 'object' && each !== null && typeof each.id === 'string' && each.id !== '' && isWords(each.text)\n\t\t)\n\t\t.map((each) => ({\n\t\t\tid: each.id,\n\t\t\ttext: each.text,\n\t\t\t...(each.detail !== undefined && isWords(each.detail) && { detail: each.detail }),\n\t\t\t...(each.required !== undefined && { required: each.required !== false }),\n\t\t\tat: each.at === 'rule' ? 'rule' : 'start'\n\t\t}))\n}\n\n/**\n * Who is given a map's objective when the rules do not say (`giveMapObjective`): the map's players a person plays, not\n * those it says the computer plays or nobody does (`MapPlayer.controller`), in the order of their ids\n *\n * @beta\n */\nexport function mapObjectivePlayers(world: World): PlayerId[] {\n\treturn [...world.players.values()]\n\t\t.filter((player) => !player.neutral && !player.creeps)\n\t\t.filter((player) => {\n\t\t\tconst controller = world.map.player(player.id)?.controller\n\t\t\treturn controller !== 'computer' && controller !== 'nobody'\n\t\t})\n\t\t.map((player) => player.id)\n\t\t.sort((a, b) => a - b)\n}\n\n/**\n * Gives players an objective of the map's, by its id (`MapObjective`): those given by a rule (`at: 'rule'`), when the\n * rules say. To every player a person plays when `players` is left out (`mapObjectivePlayers`); a player who has it\n * already keeps theirs. Its words' params and its progress go with it, as `world.objectives.add`. Throws for an id the\n * map does not have: an id in the code that is not on the map is a mistake\n *\n * @beta\n */\nexport function giveMapObjective(\n\tworld: World,\n\tid: string,\n\toptions: { players?: readonly PlayerId[]; params?: Message['params']; progress?: { value: number; max: number } } = {}\n): ObjectiveState[] {\n\tconst def = mapObjectivesOf(world.map).find((objective) => objective.id === id)\n\tif (!def) throw new Error(`The map${world.map.name ? ` \"${world.map.name}\"` : ''} has no objective \"${id}\"`)\n\tconst { at: _at, ...objective } = def\n\tconst given: ObjectiveState[] = []\n\tfor (const player of options.players ?? mapObjectivePlayers(world)) {\n\t\tif (world.objectives.has(player, id)) continue\n\t\tgiven.push(world.objectives.add(player, objective, { params: options.params, progress: options.progress }))\n\t}\n\treturn given\n}\n\n/**\n * What is wrong with a map's objectives (`GameMap.data.objectives`): one with no id or with another's, one with no\n * words, a list that is not one. Each a click away in the Objectives panel\n *\n * @beta\n */\nexport function checkMapObjectives(map: GameMap): MapProblem[] {\n\tconst kept = map.data[MAP_OBJECTIVES_KEY]\n\tif (kept === undefined) return []\n\tif (!Array.isArray(kept)) return [{ message: 'The map’s objectives are not a list', error: true, rule: 'objectives' }]\n\tconst problems: MapProblem[] = []\n\tconst seen = new Set<string>()\n\tkept.forEach((each: Partial<MapObjective> | null, index) => {\n\t\tconst id = typeof each?.id === 'string' ? each.id : ''\n\t\tconst reveal = { panel: 'objectives', entry: id || String(index) }\n\t\tif (!id) problems.push({ message: `Objective ${index + 1} has no id`, error: true, rule: 'objective-id', reveal })\n\t\telse if (seen.has(id)) problems.push({ message: `Two objectives have the id \"${id}\"`, error: true, rule: 'objective-id', reveal })\n\t\tseen.add(id)\n\t\tif (!isWords(each?.text))\n\t\t\tproblems.push({ message: `The objective \"${id || index + 1}\" has no words`, error: true, rule: 'objective-text', reveal })\n\t})\n\treturn problems\n}\n\n/**\n * Objectives as data on the map (campaign plan EQ3): a map's objectives (`MapObjective`, kept in `GameMap.data.objectives`,\n * written by the editor's Objectives panel) given at the start to every player a person plays, as the world is made\n * from the map; those given by a rule wait for the rules (`giveMapObjective(world, id)`). Done and failed as any\n * objective is (`world.objectives.complete`, `fail`); a game that is won by them has `objectiveVictory` as its\n * `victory`. The map's checks say what is wrong with them (`checkMapObjectives`)\n *\n * @beta\n */\nexport function mapObjectives(): GamePack {\n\tconst atStart = defineHook({\n\t\thook: 'mapStart',\n\t\tid: MAP_OBJECTIVES,\n\t\trun(world) {\n\t\t\tfor (const objective of mapObjectivesOf(world.map)) if (objective.at === 'start') giveMapObjective(world, objective.id)\n\t\t}\n\t})\n\treturn { id: MAP_OBJECTIVES, hooks: [atStart], check: (map) => checkMapObjectives(map) }\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { clamp } from "./math.js";
|
|
2
|
+
import { inventorySlots } from "./inventory.js";
|
|
3
|
+
import { deposit } from "./entity.js";
|
|
4
|
+
import { learn, setHeroLevel } from "./hero.js";
|
|
5
|
+
import { mapObjectData } from "./mapFields.js";
|
|
6
|
+
import { createItem, giveItem } from "./items.js";
|
|
7
|
+
import { createOrder, giveOrder } from "./orders/queue.js";
|
|
8
|
+
import { mapDrops } from "./randomGroups.js";
|
|
9
|
+
//#region src/mapObjects.ts
|
|
10
|
+
/**
|
|
11
|
+
* Makes an entity what the map says it starts as, beyond where it stands and whose it is: hurt, at a level, with
|
|
12
|
+
* items. In an order that lets each count on the one before: the level first, which the health follows from
|
|
13
|
+
*/
|
|
14
|
+
function startAs(world, entity, object) {
|
|
15
|
+
if (object.level !== void 0) setHeroLevel(world, entity, object.level);
|
|
16
|
+
for (const [ability, level] of Object.entries(object.abilities ?? {})) for (let i = 0; i < level; i++) if (!learn(world, entity, ability)) break;
|
|
17
|
+
for (const item of object.items ?? []) if (world.registry.items.has(item) && entity.has(inventorySlots)) giveItem(world, entity, createItem(world, item));
|
|
18
|
+
if (object.amount !== void 0 && entity.get(deposit)) entity.get(deposit).amount = Math.max(object.amount, 0);
|
|
19
|
+
if (object.health !== void 0) entity.health = Math.max(Math.round(entity.maxHealth * clamp(object.health, 0, 1)), 1);
|
|
20
|
+
if (object.mana !== void 0) entity.mana = Math.round(entity.maxMana * clamp(object.mana, 0, 1));
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Puts an object of the map in the world as the map has it: where it stands, whose, turned, as big, named, hurt, at a
|
|
24
|
+
* level, with items and its drops, the game's fields on it and the game told (`mapObject`), and kept as the entity of
|
|
25
|
+
* that object (`World.fromMap`). Not its orders: those are given once everything stands (`giveMapOrders`). Its
|
|
26
|
+
* type as said: one drawn from a random group is drawn before
|
|
27
|
+
*
|
|
28
|
+
* @internal
|
|
29
|
+
*/
|
|
30
|
+
function spawnMapObject(world, object, map) {
|
|
31
|
+
const entity = world.spawn(object.type, object.owner, object, {
|
|
32
|
+
facing: object.facing,
|
|
33
|
+
scale: object.scale,
|
|
34
|
+
look: object.look,
|
|
35
|
+
name: object.name,
|
|
36
|
+
lifetime: object.lifetime,
|
|
37
|
+
underConstruction: object.underConstruction
|
|
38
|
+
});
|
|
39
|
+
startAs(world, entity, object);
|
|
40
|
+
if (object.drops) entity.set(mapDrops, object.drops);
|
|
41
|
+
const data = mapObjectData(world.registry, object, map);
|
|
42
|
+
for (const component of world.registry.listedComponents()) if (component.field && component.id in data) entity.set(component, structuredClone(data[component.id]));
|
|
43
|
+
if (world.hooks.has("mapObject")) world.hooks.run("mapObject", {
|
|
44
|
+
entity,
|
|
45
|
+
object,
|
|
46
|
+
data
|
|
47
|
+
});
|
|
48
|
+
world.fromMap.set(object.id, entity.id);
|
|
49
|
+
return entity;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* A unit of the map given what it does as the game begins (`MapObject.orders`): its own orders, one after the other,
|
|
53
|
+
* as no player's command. What it cannot be given (a path the map has not) is left out
|
|
54
|
+
*
|
|
55
|
+
* @internal
|
|
56
|
+
*/
|
|
57
|
+
function giveMapOrders(world, entity, orders) {
|
|
58
|
+
let queue = false;
|
|
59
|
+
for (const { kind, path, point } of orders) {
|
|
60
|
+
const init = kind === "hold" ? { type: "hold" } : path ? {
|
|
61
|
+
type: kind === "patrol" ? "patrolPath" : "followPath",
|
|
62
|
+
path
|
|
63
|
+
} : point ? {
|
|
64
|
+
type: kind === "patrol" ? "patrol" : "move",
|
|
65
|
+
point: {
|
|
66
|
+
x: point.x,
|
|
67
|
+
z: point.z
|
|
68
|
+
}
|
|
69
|
+
} : void 0;
|
|
70
|
+
if (!init) continue;
|
|
71
|
+
const order = createOrder(world, init);
|
|
72
|
+
if (!world.registry.order(init.type).accepts(world, entity, init)) continue;
|
|
73
|
+
giveOrder(world, entity, order, queue);
|
|
74
|
+
queue = true;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
//#endregion
|
|
78
|
+
export { giveMapOrders, spawnMapObject };
|
|
79
|
+
|
|
80
|
+
//# sourceMappingURL=mapObjects.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mapObjects.js","names":[],"sources":["../src/mapObjects.ts"],"sourcesContent":["import { deposit, type Entity } from './entity'\nimport { learn, setHeroLevel } from './hero'\nimport { inventorySlots } from './inventory'\nimport { createItem, giveItem } from './items'\nimport type { GameMap, MapObject, MapObjectOrder } from './map'\nimport { mapObjectData } from './mapFields'\nimport { clamp } from './math'\nimport { createOrder, giveOrder } from './orders/queue'\nimport { mapDrops } from './randomGroups'\nimport type { World } from './world'\n\n/*\n * What stands on a map put in the world: as the world is made of the map (`createWorldFromMap`), and one at a time\n * after, as the editor's Play here puts down what was placed on the map while it plays (`debug.mapObject`, EQ10)\n */\n\n/**\n * Makes an entity what the map says it starts as, beyond where it stands and whose it is: hurt, at a level, with\n * items. In an order that lets each count on the one before: the level first, which the health follows from\n */\nfunction startAs(world: World, entity: Entity, object: MapObject): void {\n\tif (object.level !== undefined) setHeroLevel(world, entity, object.level)\n\t// a point at a time, as a player would: what the level does not allow yet is left out\n\tfor (const [ability, level] of Object.entries(object.abilities ?? {})) {\n\t\tfor (let i = 0; i < level; i++) if (!learn(world, entity, ability)) break\n\t}\n\tfor (const item of object.items ?? []) {\n\t\tif (world.registry.items.has(item) && entity.has(inventorySlots)) giveItem(world, entity, createItem(world, item))\n\t}\n\tif (object.amount !== undefined && entity.get(deposit)) entity.get(deposit)!.amount = Math.max(object.amount, 0)\n\tif (object.health !== undefined) entity.health = Math.max(Math.round(entity.maxHealth * clamp(object.health, 0, 1)), 1)\n\tif (object.mana !== undefined) entity.mana = Math.round(entity.maxMana * clamp(object.mana, 0, 1))\n}\n\n/**\n * Puts an object of the map in the world as the map has it: where it stands, whose, turned, as big, named, hurt, at a\n * level, with items and its drops, the game's fields on it and the game told (`mapObject`), and kept as the entity of\n * that object (`World.fromMap`). Not its orders: those are given once everything stands (`giveMapOrders`). Its\n * type as said: one drawn from a random group is drawn before\n *\n * @internal\n */\nexport function spawnMapObject(world: World, object: MapObject, map?: GameMap): Entity {\n\tconst entity = world.spawn(object.type, object.owner, object, {\n\t\tfacing: object.facing,\n\t\tscale: object.scale,\n\t\tlook: object.look,\n\t\tname: object.name,\n\t\tlifetime: object.lifetime,\n\t\tunderConstruction: object.underConstruction\n\t})\n\tstartAs(world, entity, object)\n\tif (object.drops) entity.set(mapDrops, object.drops)\n\tconst data = mapObjectData(world.registry, object, map)\n\t// a component with a field of the map's starts as the object says, or as the field's default\n\tfor (const component of world.registry.listedComponents()) {\n\t\tif (component.field && component.id in data) entity.set(component, structuredClone(data[component.id]))\n\t}\n\t// the game's turn: what its own fields mean is its to say\n\tif (world.hooks.has('mapObject')) world.hooks.run('mapObject', { entity, object, data })\n\tworld.fromMap.set(object.id, entity.id)\n\treturn entity\n}\n\n/**\n * A unit of the map given what it does as the game begins (`MapObject.orders`): its own orders, one after the other,\n * as no player's command. What it cannot be given (a path the map has not) is left out\n *\n * @internal\n */\nexport function giveMapOrders(world: World, entity: Entity, orders: readonly MapObjectOrder[]): void {\n\tlet queue = false\n\tfor (const { kind, path, point } of orders) {\n\t\tconst init =\n\t\t\tkind === 'hold'\n\t\t\t\t? { type: 'hold' as const }\n\t\t\t\t: path\n\t\t\t\t\t? { type: kind === 'patrol' ? ('patrolPath' as const) : ('followPath' as const), path }\n\t\t\t\t\t: point\n\t\t\t\t\t\t? { type: kind === 'patrol' ? ('patrol' as const) : ('move' as const), point: { x: point.x, z: point.z } }\n\t\t\t\t\t\t: undefined\n\t\t// a guard with nowhere to go guards where it stands: what an idle unit does\n\t\tif (!init) continue\n\t\tconst order = createOrder(world, init as never)\n\t\tif (!world.registry.order(init.type).accepts(world, entity, init as never)) continue\n\t\tgiveOrder(world, entity, order, queue)\n\t\tqueue = true\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;AAoBA,SAAS,QAAQ,OAAc,QAAgB,QAAyB;CACvE,IAAI,OAAO,UAAU,KAAA,GAAW,aAAa,OAAO,QAAQ,OAAO,KAAK;CAExE,KAAK,MAAM,CAAC,SAAS,UAAU,OAAO,QAAQ,OAAO,aAAa,CAAC,CAAC,GACnE,KAAK,IAAI,IAAI,GAAG,IAAI,OAAO,KAAK,IAAI,CAAC,MAAM,OAAO,QAAQ,OAAO,GAAG;CAErE,KAAK,MAAM,QAAQ,OAAO,SAAS,CAAC,GACnC,IAAI,MAAM,SAAS,MAAM,IAAI,IAAI,KAAK,OAAO,IAAI,cAAc,GAAG,SAAS,OAAO,QAAQ,WAAW,OAAO,IAAI,CAAC;CAElH,IAAI,OAAO,WAAW,KAAA,KAAa,OAAO,IAAI,OAAO,GAAG,OAAO,IAAI,OAAO,CAAC,CAAE,SAAS,KAAK,IAAI,OAAO,QAAQ,CAAC;CAC/G,IAAI,OAAO,WAAW,KAAA,GAAW,OAAO,SAAS,KAAK,IAAI,KAAK,MAAM,OAAO,YAAY,MAAM,OAAO,QAAQ,GAAG,CAAC,CAAC,GAAG,CAAC;CACtH,IAAI,OAAO,SAAS,KAAA,GAAW,OAAO,OAAO,KAAK,MAAM,OAAO,UAAU,MAAM,OAAO,MAAM,GAAG,CAAC,CAAC;AAClG;;;;;;;;;AAUA,SAAgB,eAAe,OAAc,QAAmB,KAAuB;CACtF,MAAM,SAAS,MAAM,MAAM,OAAO,MAAM,OAAO,OAAO,QAAQ;EAC7D,QAAQ,OAAO;EACf,OAAO,OAAO;EACd,MAAM,OAAO;EACb,MAAM,OAAO;EACb,UAAU,OAAO;EACjB,mBAAmB,OAAO;CAC3B,CAAC;CACD,QAAQ,OAAO,QAAQ,MAAM;CAC7B,IAAI,OAAO,OAAO,OAAO,IAAI,UAAU,OAAO,KAAK;CACnD,MAAM,OAAO,cAAc,MAAM,UAAU,QAAQ,GAAG;CAEtD,KAAK,MAAM,aAAa,MAAM,SAAS,iBAAiB,GACvD,IAAI,UAAU,SAAS,UAAU,MAAM,MAAM,OAAO,IAAI,WAAW,gBAAgB,KAAK,UAAU,GAAG,CAAC;CAGvG,IAAI,MAAM,MAAM,IAAI,WAAW,GAAG,MAAM,MAAM,IAAI,aAAa;EAAE;EAAQ;EAAQ;CAAK,CAAC;CACvF,MAAM,QAAQ,IAAI,OAAO,IAAI,OAAO,EAAE;CACtC,OAAO;AACR;;;;;;;AAQA,SAAgB,cAAc,OAAc,QAAgB,QAAyC;CACpG,IAAI,QAAQ;CACZ,KAAK,MAAM,EAAE,MAAM,MAAM,WAAW,QAAQ;EAC3C,MAAM,OACL,SAAS,SACN,EAAE,MAAM,OAAgB,IACxB,OACC;GAAE,MAAM,SAAS,WAAY,eAA0B;GAAwB;EAAK,IACpF,QACC;GAAE,MAAM,SAAS,WAAY,WAAsB;GAAkB,OAAO;IAAE,GAAG,MAAM;IAAG,GAAG,MAAM;GAAE;EAAE,IACvG,KAAA;EAEN,IAAI,CAAC,MAAM;EACX,MAAM,QAAQ,YAAY,OAAO,IAAa;EAC9C,IAAI,CAAC,MAAM,SAAS,MAAM,KAAK,IAAI,CAAC,CAAC,QAAQ,OAAO,QAAQ,IAAa,GAAG;EAC5E,UAAU,OAAO,QAAQ,OAAO,KAAK;EACrC,QAAQ;CACT;AACD"}
|
package/dist/math.d.ts
CHANGED
|
@@ -1,17 +1,31 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* A point on the ground plane. The simulation is 2D; height always comes from the terrain.
|
|
3
3
|
*
|
|
4
|
-
* @
|
|
4
|
+
* @public
|
|
5
5
|
*/
|
|
6
6
|
export interface Vec2 {
|
|
7
|
+
/** The point's place on the ground plane's x axis */
|
|
7
8
|
x: number;
|
|
9
|
+
/** The point's place on the ground plane's z axis */
|
|
8
10
|
z: number;
|
|
9
11
|
}
|
|
10
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* Makes a point from an x and a z, both 0 when left out
|
|
14
|
+
*
|
|
15
|
+
* @beta
|
|
16
|
+
*/
|
|
11
17
|
export declare const vec2: (x?: number, z?: number) => Vec2;
|
|
12
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* Keeps a number between `min` and `max`: returns `min` below it, `max` above it
|
|
20
|
+
*
|
|
21
|
+
* @beta
|
|
22
|
+
*/
|
|
13
23
|
export declare const clamp: (v: number, min: number, max: number) => number;
|
|
14
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* Goes from `a` to `b` by `t` (0 gives `a`, 1 gives `b`); `t` is not limited to 0..1
|
|
26
|
+
*
|
|
27
|
+
* @beta
|
|
28
|
+
*/
|
|
15
29
|
export declare const lerp: (a: number, b: number, t: number) => number;
|
|
16
30
|
/**
|
|
17
31
|
* 0 at `from` and before, 1 at `to` and after, eased in and out between: a shader's `smoothstep`
|
|
@@ -25,11 +39,23 @@ export declare const smoothstep: (from: number, to: number, x: number) => number
|
|
|
25
39
|
* @beta
|
|
26
40
|
*/
|
|
27
41
|
export declare function hashInts(a: number, b: number): number;
|
|
28
|
-
/**
|
|
42
|
+
/**
|
|
43
|
+
* The squared distance between two points, for comparing distances without a square root
|
|
44
|
+
*
|
|
45
|
+
* @beta
|
|
46
|
+
*/
|
|
29
47
|
export declare const distSq: (a: Vec2, b: Vec2) => number;
|
|
30
|
-
/**
|
|
48
|
+
/**
|
|
49
|
+
* The distance between two points on the ground plane
|
|
50
|
+
*
|
|
51
|
+
* @beta
|
|
52
|
+
*/
|
|
31
53
|
export declare const dist: (a: Vec2, b: Vec2) => number;
|
|
32
|
-
/**
|
|
54
|
+
/**
|
|
55
|
+
* Goes from angle `a` to angle `b` by `t` the short way round, in radians
|
|
56
|
+
*
|
|
57
|
+
* @beta
|
|
58
|
+
*/
|
|
33
59
|
export declare const lerpAngle: (a: number, b: number, t: number) => number;
|
|
34
60
|
/**
|
|
35
61
|
* Axis aligned rectangle on the ground plane, described by its center and half sizes.
|
|
@@ -37,8 +63,12 @@ export declare const lerpAngle: (a: number, b: number, t: number) => number;
|
|
|
37
63
|
* @beta
|
|
38
64
|
*/
|
|
39
65
|
export interface Rect {
|
|
66
|
+
/** The rectangle's centre on the x axis */
|
|
40
67
|
x: number;
|
|
68
|
+
/** The rectangle's centre on the z axis */
|
|
41
69
|
z: number;
|
|
70
|
+
/** Half the rectangle's size along x */
|
|
42
71
|
hw: number;
|
|
72
|
+
/** Half the rectangle's size along z */
|
|
43
73
|
hd: number;
|
|
44
74
|
}
|
package/dist/math.js
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { atan2 } from "./exactMath.js";
|
|
2
|
+
//#region src/math.ts
|
|
3
|
+
/**
|
|
4
|
+
* Twice pi, a full turn in radians
|
|
5
|
+
*
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
var TAU = Math.PI * 2;
|
|
9
|
+
/**
|
|
10
|
+
* Makes a point from an x and a z, both 0 when left out
|
|
11
|
+
*
|
|
12
|
+
* @beta
|
|
13
|
+
*/
|
|
14
|
+
var vec2 = (x = 0, z = 0) => ({
|
|
15
|
+
x,
|
|
16
|
+
z
|
|
17
|
+
});
|
|
18
|
+
/**
|
|
19
|
+
* Keeps a number between `min` and `max`: returns `min` below it, `max` above it
|
|
20
|
+
*
|
|
21
|
+
* @beta
|
|
22
|
+
*/
|
|
23
|
+
var clamp = (v, min, max) => v < min ? min : v > max ? max : v;
|
|
24
|
+
/**
|
|
25
|
+
* Goes from `a` to `b` by `t` (0 gives `a`, 1 gives `b`); `t` is not limited to 0..1
|
|
26
|
+
*
|
|
27
|
+
* @beta
|
|
28
|
+
*/
|
|
29
|
+
var lerp = (a, b, t) => a + (b - a) * t;
|
|
30
|
+
/**
|
|
31
|
+
* 0 at `from` and before, 1 at `to` and after, eased in and out between: a shader's `smoothstep`
|
|
32
|
+
*
|
|
33
|
+
* @beta
|
|
34
|
+
*/
|
|
35
|
+
var smoothstep = (from, to, x) => {
|
|
36
|
+
const t = clamp((x - from) / (to - from), 0, 1);
|
|
37
|
+
return t * t * (3 - 2 * t);
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* A number in 0..1 for two whole numbers, the same each time and in every engine (it is integer arithmetic)
|
|
41
|
+
*
|
|
42
|
+
* @beta
|
|
43
|
+
*/
|
|
44
|
+
function hashInts(a, b) {
|
|
45
|
+
let h = Math.imul(a ^ 2654435769, 2246822507) ^ Math.imul(b, 3266489909);
|
|
46
|
+
h ^= h >>> 16;
|
|
47
|
+
h = Math.imul(h, 2146121005);
|
|
48
|
+
h ^= h >>> 15;
|
|
49
|
+
return (h >>> 0) / 4294967295;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* cyrb53: a 53-bit hash of text, the same in every engine (it is integer arithmetic)
|
|
53
|
+
*
|
|
54
|
+
* @internal
|
|
55
|
+
*/
|
|
56
|
+
function hashText(text) {
|
|
57
|
+
let h1 = 3735928559;
|
|
58
|
+
let h2 = 1103547991;
|
|
59
|
+
for (let i = 0; i < text.length; i++) {
|
|
60
|
+
const c = text.charCodeAt(i);
|
|
61
|
+
h1 = Math.imul(h1 ^ c, 2654435761);
|
|
62
|
+
h2 = Math.imul(h2 ^ c, 1597334677);
|
|
63
|
+
}
|
|
64
|
+
h1 = Math.imul(h1 ^ h1 >>> 16, 2246822507) ^ Math.imul(h2 ^ h2 >>> 13, 3266489909);
|
|
65
|
+
h2 = Math.imul(h2 ^ h2 >>> 16, 2246822507) ^ Math.imul(h1 ^ h1 >>> 13, 3266489909);
|
|
66
|
+
return (4294967296 * (2097151 & h2) + (h1 >>> 0)).toString(16).padStart(14, "0");
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* The squared distance between two points, for comparing distances without a square root
|
|
70
|
+
*
|
|
71
|
+
* @beta
|
|
72
|
+
*/
|
|
73
|
+
var distSq = (a, b) => {
|
|
74
|
+
const dx = a.x - b.x;
|
|
75
|
+
const dz = a.z - b.z;
|
|
76
|
+
return dx * dx + dz * dz;
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* The distance between two points on the ground plane
|
|
80
|
+
*
|
|
81
|
+
* @beta
|
|
82
|
+
*/
|
|
83
|
+
var dist = (a, b) => Math.sqrt(distSq(a, b));
|
|
84
|
+
/**
|
|
85
|
+
* Facing angle (radians) of the direction from `a` to `b`. 0 faces +z, increasing towards +x.
|
|
86
|
+
*
|
|
87
|
+
* @internal
|
|
88
|
+
*/
|
|
89
|
+
var angleTo = (a, b) => atan2(b.x - a.x, b.z - a.z);
|
|
90
|
+
/**
|
|
91
|
+
* Shortest signed difference between two angles, in (-PI, PI].
|
|
92
|
+
*
|
|
93
|
+
* @internal
|
|
94
|
+
*/
|
|
95
|
+
var angleDiff = (from, to) => {
|
|
96
|
+
let d = (to - from) % TAU;
|
|
97
|
+
if (d > Math.PI) d -= TAU;
|
|
98
|
+
else if (d <= -Math.PI) d += TAU;
|
|
99
|
+
return d;
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* Turns the angle `from` towards `to` by at most `maxStep` radians, the short way round, and returns the new angle
|
|
103
|
+
*
|
|
104
|
+
* @internal
|
|
105
|
+
*/
|
|
106
|
+
var rotateTowards = (from, to, maxStep) => {
|
|
107
|
+
const d = angleDiff(from, to);
|
|
108
|
+
if (Math.abs(d) <= maxStep) return to;
|
|
109
|
+
return from + Math.sign(d) * maxStep;
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* Goes from angle `a` to angle `b` by `t` the short way round, in radians
|
|
113
|
+
*
|
|
114
|
+
* @beta
|
|
115
|
+
*/
|
|
116
|
+
var lerpAngle = (a, b, t) => a + angleDiff(a, b) * t;
|
|
117
|
+
/**
|
|
118
|
+
* Distance from a point to the edge of a rectangle. 0 when the point is inside.
|
|
119
|
+
*
|
|
120
|
+
* @internal
|
|
121
|
+
*/
|
|
122
|
+
var distToRect = (p, r) => {
|
|
123
|
+
const dx = Math.max(Math.abs(p.x - r.x) - r.hw, 0);
|
|
124
|
+
const dz = Math.max(Math.abs(p.z - r.z) - r.hd, 0);
|
|
125
|
+
return Math.sqrt(dx * dx + dz * dz);
|
|
126
|
+
};
|
|
127
|
+
/**
|
|
128
|
+
* Closest point to `p` on the border of `r` grown by `margin`. Points inside are pushed out through the nearest side.
|
|
129
|
+
*
|
|
130
|
+
* @internal
|
|
131
|
+
*/
|
|
132
|
+
var closestPointOnRect = (p, r, margin = 0) => {
|
|
133
|
+
const hw = r.hw + margin;
|
|
134
|
+
const hd = r.hd + margin;
|
|
135
|
+
const lx = p.x - r.x;
|
|
136
|
+
const lz = p.z - r.z;
|
|
137
|
+
if (Math.abs(lx) < hw && Math.abs(lz) < hd) {
|
|
138
|
+
if (hw - Math.abs(lx) < hd - Math.abs(lz)) return {
|
|
139
|
+
x: r.x + (lx < 0 ? -hw : hw),
|
|
140
|
+
z: p.z
|
|
141
|
+
};
|
|
142
|
+
return {
|
|
143
|
+
x: p.x,
|
|
144
|
+
z: r.z + (lz < 0 ? -hd : hd)
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
return {
|
|
148
|
+
x: r.x + clamp(lx, -hw, hw),
|
|
149
|
+
z: r.z + clamp(lz, -hd, hd)
|
|
150
|
+
};
|
|
151
|
+
};
|
|
152
|
+
//#endregion
|
|
153
|
+
export { TAU, angleDiff, angleTo, clamp, closestPointOnRect, dist, distSq, distToRect, hashInts, hashText, lerp, lerpAngle, rotateTowards, smoothstep, vec2 };
|
|
154
|
+
|
|
155
|
+
//# sourceMappingURL=math.js.map
|
package/dist/math.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"math.js","names":[],"sources":["../src/math.ts"],"sourcesContent":["import { atan2 } from './exactMath'\n/**\n * A point on the ground plane. The simulation is 2D; height always comes from the terrain.\n *\n * @public\n */\nexport interface Vec2 {\n\t/** The point's place on the ground plane's x axis */\n\tx: number\n\t/** The point's place on the ground plane's z axis */\n\tz: number\n}\n\n/**\n * Twice pi, a full turn in radians\n *\n * @internal\n */\nexport const TAU = Math.PI * 2\n\n/**\n * Makes a point from an x and a z, both 0 when left out\n *\n * @beta\n */\nexport const vec2 = (x = 0, z = 0): Vec2 => ({ x, z })\n\n/**\n * Keeps a number between `min` and `max`: returns `min` below it, `max` above it\n *\n * @beta\n */\nexport const clamp = (v: number, min: number, max: number) => (v < min ? min : v > max ? max : v)\n\n/**\n * Goes from `a` to `b` by `t` (0 gives `a`, 1 gives `b`); `t` is not limited to 0..1\n *\n * @beta\n */\nexport const lerp = (a: number, b: number, t: number) => a + (b - a) * t\n\n/**\n * 0 at `from` and before, 1 at `to` and after, eased in and out between: a shader's `smoothstep`\n *\n * @beta\n */\nexport const smoothstep = (from: number, to: number, x: number) => {\n\tconst t = clamp((x - from) / (to - from), 0, 1)\n\treturn t * t * (3 - 2 * t)\n}\n\n/**\n * A number in 0..1 for two whole numbers, the same each time and in every engine (it is integer arithmetic)\n *\n * @beta\n */\nexport function hashInts(a: number, b: number): number {\n\tlet h = Math.imul(a ^ 0x9e3779b9, 0x85ebca6b) ^ Math.imul(b, 0xc2b2ae35)\n\th ^= h >>> 16\n\th = Math.imul(h, 0x7feb352d)\n\th ^= h >>> 15\n\treturn (h >>> 0) / 0xffffffff\n}\n\n/**\n * cyrb53: a 53-bit hash of text, the same in every engine (it is integer arithmetic)\n *\n * @internal\n */\nexport function hashText(text: string): string {\n\tlet h1 = 0xdeadbeef\n\tlet h2 = 0x41c6ce57\n\tfor (let i = 0; i < text.length; i++) {\n\t\tconst c = text.charCodeAt(i)\n\t\th1 = Math.imul(h1 ^ c, 2654435761)\n\t\th2 = Math.imul(h2 ^ c, 1597334677)\n\t}\n\th1 = Math.imul(h1 ^ (h1 >>> 16), 2246822507) ^ Math.imul(h2 ^ (h2 >>> 13), 3266489909)\n\th2 = Math.imul(h2 ^ (h2 >>> 16), 2246822507) ^ Math.imul(h1 ^ (h1 >>> 13), 3266489909)\n\treturn (4294967296 * (2097151 & h2) + (h1 >>> 0)).toString(16).padStart(14, '0')\n}\n\n/**\n * The squared distance between two points, for comparing distances without a square root\n *\n * @beta\n */\nexport const distSq = (a: Vec2, b: Vec2) => {\n\tconst dx = a.x - b.x\n\tconst dz = a.z - b.z\n\treturn dx * dx + dz * dz\n}\n\n/**\n * The distance between two points on the ground plane\n *\n * @beta\n */\nexport const dist = (a: Vec2, b: Vec2) => Math.sqrt(distSq(a, b))\n\n/**\n * Facing angle (radians) of the direction from `a` to `b`. 0 faces +z, increasing towards +x.\n *\n * @internal\n */\nexport const angleTo = (a: Vec2, b: Vec2) => atan2(b.x - a.x, b.z - a.z)\n\n/**\n * Shortest signed difference between two angles, in (-PI, PI].\n *\n * @internal\n */\nexport const angleDiff = (from: number, to: number) => {\n\tlet d = (to - from) % TAU\n\tif (d > Math.PI) d -= TAU\n\telse if (d <= -Math.PI) d += TAU\n\treturn d\n}\n\n/**\n * Turns the angle `from` towards `to` by at most `maxStep` radians, the short way round, and returns the new angle\n *\n * @internal\n */\nexport const rotateTowards = (from: number, to: number, maxStep: number) => {\n\tconst d = angleDiff(from, to)\n\tif (Math.abs(d) <= maxStep) return to\n\treturn from + Math.sign(d) * maxStep\n}\n\n/**\n * Goes from angle `a` to angle `b` by `t` the short way round, in radians\n *\n * @beta\n */\nexport const lerpAngle = (a: number, b: number, t: number) => a + angleDiff(a, b) * t\n\n/**\n * Axis aligned rectangle on the ground plane, described by its center and half sizes.\n *\n * @beta\n */\nexport interface Rect {\n\t/** The rectangle's centre on the x axis */\n\tx: number\n\t/** The rectangle's centre on the z axis */\n\tz: number\n\t/** Half the rectangle's size along x */\n\thw: number\n\t/** Half the rectangle's size along z */\n\thd: number\n}\n\n/**\n * Distance from a point to the edge of a rectangle. 0 when the point is inside.\n *\n * @internal\n */\nexport const distToRect = (p: Vec2, r: Rect) => {\n\tconst dx = Math.max(Math.abs(p.x - r.x) - r.hw, 0)\n\tconst dz = Math.max(Math.abs(p.z - r.z) - r.hd, 0)\n\treturn Math.sqrt(dx * dx + dz * dz)\n}\n\n/**\n * Closest point to `p` on the border of `r` grown by `margin`. Points inside are pushed out through the nearest side.\n *\n * @internal\n */\nexport const closestPointOnRect = (p: Vec2, r: Rect, margin = 0): Vec2 => {\n\tconst hw = r.hw + margin\n\tconst hd = r.hd + margin\n\tconst lx = p.x - r.x\n\tconst lz = p.z - r.z\n\tif (Math.abs(lx) < hw && Math.abs(lz) < hd) {\n\t\t// inside: exit through the closest side\n\t\tif (hw - Math.abs(lx) < hd - Math.abs(lz)) return { x: r.x + (lx < 0 ? -hw : hw), z: p.z }\n\t\treturn { x: p.x, z: r.z + (lz < 0 ? -hd : hd) }\n\t}\n\treturn { x: r.x + clamp(lx, -hw, hw), z: r.z + clamp(lz, -hd, hd) }\n}\n"],"mappings":"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"}
|
package/dist/messages.d.ts
CHANGED
|
@@ -9,10 +9,16 @@
|
|
|
9
9
|
* @beta
|
|
10
10
|
*/
|
|
11
11
|
export interface Message {
|
|
12
|
+
/** The message's key, which the player's screen has words for (`EngineMessages` for the engine's, a game's own otherwise) */
|
|
12
13
|
key: string;
|
|
14
|
+
/** What the words name or count, by param name; ids for what is a resource, a unit type or an upgrade */
|
|
13
15
|
params?: MessageParams;
|
|
14
16
|
}
|
|
15
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* The values a message's params can hold: a string, a number or a list of strings
|
|
19
|
+
*
|
|
20
|
+
* @beta
|
|
21
|
+
*/
|
|
16
22
|
export type MessageParams = Record<string, string | number | string[]>;
|
|
17
23
|
/**
|
|
18
24
|
* A message, or a bare key for one without params. What hooks give as the reason something is called off
|
|
@@ -20,7 +26,11 @@ export type MessageParams = Record<string, string | number | string[]>;
|
|
|
20
26
|
* @beta
|
|
21
27
|
*/
|
|
22
28
|
export type MessageRef = Message | string;
|
|
23
|
-
/**
|
|
29
|
+
/**
|
|
30
|
+
* Turns a `MessageRef` into a `Message`: a bare key becomes `{ key }`, a message is returned as it is
|
|
31
|
+
*
|
|
32
|
+
* @beta
|
|
33
|
+
*/
|
|
24
34
|
export declare const toMessage: (message: MessageRef) => Message;
|
|
25
35
|
/**
|
|
26
36
|
* The messages the engine sends, and their params. The client has words for each of these.
|
|
@@ -41,18 +51,23 @@ export interface EngineMessages {
|
|
|
41
51
|
requires: {
|
|
42
52
|
units: string[];
|
|
43
53
|
};
|
|
54
|
+
/** A building's or hero's production queue has no room for more */
|
|
44
55
|
queueFull: {};
|
|
56
|
+
/** The player already has the hero being asked for */
|
|
45
57
|
alreadyHaveHero: {};
|
|
58
|
+
/** The player has as many heroes as the rules allow (`RuleSettings.heroes`) */
|
|
46
59
|
tooManyHeroes: {};
|
|
47
|
-
/** Out of supply, and could build more of what provides it. `pool` for one of the game's own (`
|
|
60
|
+
/** Out of supply, and could build more of what provides it. `pool` for one of the game's own (`RuleSettings.supply.pools`) */
|
|
48
61
|
supplyBlocked: {
|
|
49
62
|
pool?: string;
|
|
50
63
|
};
|
|
51
|
-
/** Out of supply, and at the most anyone can have (`
|
|
64
|
+
/** Out of supply, and at the most anyone can have (`RuleSettings.supply.max`, a pool's `max`) */
|
|
52
65
|
supplyLimit: {
|
|
53
66
|
pool?: string;
|
|
54
67
|
};
|
|
68
|
+
/** The upgrade being asked for is already being researched */
|
|
55
69
|
alreadyResearching: {};
|
|
70
|
+
/** Research of the upgrade finished; `upgrade` is its id */
|
|
56
71
|
researchDone: {
|
|
57
72
|
upgrade: string;
|
|
58
73
|
};
|
|
@@ -61,6 +76,7 @@ export interface EngineMessages {
|
|
|
61
76
|
unit: string;
|
|
62
77
|
level: number;
|
|
63
78
|
};
|
|
79
|
+
/** The player has lost the game */
|
|
64
80
|
defeated: {};
|
|
65
81
|
/** Another player gave up. `player` is their name */
|
|
66
82
|
surrendered: {
|
|
@@ -68,23 +84,46 @@ export interface EngineMessages {
|
|
|
68
84
|
};
|
|
69
85
|
/** Every pause of the player's is used */
|
|
70
86
|
noPausesLeft: {};
|
|
87
|
+
/** A structure cannot be placed at that spot */
|
|
71
88
|
cannotBuildThere: {};
|
|
72
89
|
/** The navigation has no room for another building in the way (`RecastNavigationOptions.maxObstacles`) */
|
|
73
90
|
tooManyBuildings: {};
|
|
91
|
+
/** A worker could not find a way to the building site */
|
|
74
92
|
cannotReachSite: {};
|
|
93
|
+
/** A unit could not find a way to where it was sent */
|
|
75
94
|
cannotReach: {};
|
|
76
95
|
/** A worker with something to bring back and nowhere to bring it. `resource` is its id */
|
|
77
96
|
nowhereToReturn: {
|
|
78
97
|
resource: string;
|
|
79
98
|
};
|
|
99
|
+
/** A worker cannot gather from a resource of that id */
|
|
80
100
|
cannotGather: {
|
|
81
101
|
resource: string;
|
|
82
102
|
};
|
|
103
|
+
/** A structure cannot be placed on a resource of that id */
|
|
83
104
|
buildOnResource: {
|
|
84
105
|
resource: string;
|
|
85
106
|
};
|
|
107
|
+
/** The unit's inventory has no free slot */
|
|
86
108
|
inventoryFull: {};
|
|
109
|
+
/** The inventory of the unit it is given to has no free slot */
|
|
87
110
|
theirInventoryFull: {};
|
|
111
|
+
/**
|
|
112
|
+
* The carrier has as many of the item's group as it may (`ItemDef.group`, `groupLimit`): one pair of boots. `item`
|
|
113
|
+
* is the item's id, `group` the group's, `limit` how many it may carry
|
|
114
|
+
*/
|
|
115
|
+
groupLimit: {
|
|
116
|
+
item: string;
|
|
117
|
+
group: string;
|
|
118
|
+
limit: number;
|
|
119
|
+
};
|
|
120
|
+
/** The unit it is handed to has as many of the item's group as it may (`groupLimit`'s params) */
|
|
121
|
+
theirGroupLimit: {
|
|
122
|
+
item: string;
|
|
123
|
+
group: string;
|
|
124
|
+
limit: number;
|
|
125
|
+
};
|
|
126
|
+
/** A shop is out of the item */
|
|
88
127
|
outOfStock: {};
|
|
89
128
|
/** Buying needs one of the player's heroes at the shop, with a free slot */
|
|
90
129
|
heroAtShop: {};
|
|
@@ -94,19 +133,46 @@ export interface EngineMessages {
|
|
|
94
133
|
alreadyHired: {
|
|
95
134
|
unit: string;
|
|
96
135
|
};
|
|
136
|
+
/** No shop is near enough for the buyer */
|
|
97
137
|
noShopNear: {};
|
|
138
|
+
/** No purchase to undo (`undoBuy`): none within the time, the hero away from the shop, the item used */
|
|
139
|
+
nothingToUndo: {};
|
|
140
|
+
/** The thing asked for cannot be done, the engine's word where a handler gave no reason */
|
|
98
141
|
cannotDoThat: {};
|
|
142
|
+
/** The ability or action is not ready yet, such as on cooldown */
|
|
99
143
|
notReady: {};
|
|
144
|
+
/** An item that refills has none of its charges now (`ItemDef.refill`) */
|
|
145
|
+
noCharges: {};
|
|
146
|
+
/** The caster has too little mana */
|
|
100
147
|
notEnoughMana: {};
|
|
148
|
+
/** The caster has too little health to pay what the ability costs */
|
|
101
149
|
notEnoughHealth: {};
|
|
150
|
+
/** The game has no buyback for this hero (`HeroSettings.buybackCost`) */
|
|
151
|
+
noBuyback: {};
|
|
152
|
+
/** The hero was bought back a moment ago, and may be again in so many seconds */
|
|
153
|
+
buybackNotReady: {
|
|
154
|
+
seconds: number;
|
|
155
|
+
};
|
|
156
|
+
/** The caster is silenced and cannot cast */
|
|
102
157
|
silenced: {};
|
|
158
|
+
/** An ability that rushes or jumps the caster, which a buff keeps from it (`BuffDef.grounded`) */
|
|
159
|
+
grounded: {};
|
|
160
|
+
/** A recast that goes to the unit the cast marked (`AbilityRecast.mark`), while none carries the mark */
|
|
161
|
+
noMark: {};
|
|
103
162
|
/** An ability used on something it is not for */
|
|
104
163
|
cannotTargetThat: {};
|
|
164
|
+
/** An ability used on a friend that does not target friends */
|
|
105
165
|
cannotTargetFriends: {};
|
|
166
|
+
/** An ability used on its caster that does not target itself */
|
|
106
167
|
cannotTargetSelf: {};
|
|
168
|
+
/** An ability used on a flying unit that does not hit the air */
|
|
107
169
|
cannotTargetAir: {};
|
|
170
|
+
/** An ability used on a unit that is not flying but needs a flying target */
|
|
108
171
|
mustTargetAir: {};
|
|
172
|
+
/** An ability used on a unit that is not a hero but needs a hero */
|
|
109
173
|
mustTargetHero: {};
|
|
174
|
+
/** An ability used on a hero that targets anything but heroes (`targets.heroes: false`) */
|
|
175
|
+
cannotTargetHero: {};
|
|
110
176
|
/** An ability used on what is immune to spells */
|
|
111
177
|
targetSpellImmune: {};
|
|
112
178
|
/** Pinged too often: the rest go nowhere for a moment */
|
|
@@ -123,6 +189,7 @@ export interface EngineMessages {
|
|
|
123
189
|
resource: string;
|
|
124
190
|
player: string;
|
|
125
191
|
};
|
|
192
|
+
/** Resources arrived from an ally: the `amount` of the `resource` from the `player` by name */
|
|
126
193
|
received: {
|
|
127
194
|
amount: number;
|
|
128
195
|
resource: string;
|
package/dist/messages.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { messageSent } from "./engineEvents.js";
|
|
2
|
+
import { replicateEvent } from "./replication.js";
|
|
3
|
+
//#region src/messages.ts
|
|
4
|
+
/**
|
|
5
|
+
* Turns a `MessageRef` into a `Message`: a bare key becomes `{ key }`, a message is returned as it is
|
|
6
|
+
*
|
|
7
|
+
* @beta
|
|
8
|
+
*/
|
|
9
|
+
var toMessage = (message) => typeof message === "string" ? { key: message } : message;
|
|
10
|
+
/**
|
|
11
|
+
* A message of the engine's own, with its params checked
|
|
12
|
+
*
|
|
13
|
+
* @beta
|
|
14
|
+
*/
|
|
15
|
+
var engineMessage = (key, ...params) => params.length ? {
|
|
16
|
+
key,
|
|
17
|
+
params: params[0]
|
|
18
|
+
} : { key };
|
|
19
|
+
/** A message, to whom it is for */
|
|
20
|
+
var toldMessage = replicateEvent(messageSent, "message", (message, view) => message.player === view.player ? {
|
|
21
|
+
type: "message",
|
|
22
|
+
message: message.message,
|
|
23
|
+
kind: message.kind,
|
|
24
|
+
...message.seconds !== void 0 && { seconds: message.seconds }
|
|
25
|
+
} : void 0);
|
|
26
|
+
//#endregion
|
|
27
|
+
export { engineMessage, toMessage, toldMessage };
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=messages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.js","names":[],"sources":["../src/messages.ts"],"sourcesContent":["import { messageSent } from '#engine/engineEvents'\nimport { replicateEvent } from './replication'\n/**\n * What the simulation tells a player, like \"Not enough gold\", is a key and some params, never words. The words are\n * the business of the player's screen: the client has English for the engine's keys, and a game's view gives its own\n * (`GameView.hud.messages`) or other words for the engine's. That keeps the engine free of any one language, and lets\n * a game say \"build more farms\" where the engine only knows about supply.\n *\n * Params that name something are ids (a resource, a unit type, an upgrade), for the screen to find the name of.\n *\n * @beta\n */\nexport interface Message {\n\t/** The message's key, which the player's screen has words for (`EngineMessages` for the engine's, a game's own otherwise) */\n\tkey: string\n\t/** What the words name or count, by param name; ids for what is a resource, a unit type or an upgrade */\n\tparams?: MessageParams\n}\n\n/**\n * The values a message's params can hold: a string, a number or a list of strings\n *\n * @beta\n */\nexport type MessageParams = Record<string, string | number | string[]>\n\n/**\n * A message, or a bare key for one without params. What hooks give as the reason something is called off\n *\n * @beta\n */\nexport type MessageRef = Message | string\n\n/**\n * Turns a `MessageRef` into a `Message`: a bare key becomes `{ key }`, a message is returned as it is\n *\n * @beta\n */\nexport const toMessage = (message: MessageRef): Message => (typeof message === 'string' ? { key: message } : message)\n\n/**\n * The messages the engine sends, and their params. The client has words for each of these.\n * A game can send keys of its own as well.\n *\n * @beta\n */\nexport interface EngineMessages {\n\t/** Cannot afford something: `resource` is the id of what is short */\n\tnotEnough: { resource: string }\n\t/** A prefab asked for by a name the game has not (`debug.spawnPrefab`) */\n\tunknownPrefab: { prefab: string }\n\t/** The unit types the player still needs to build to make or research something, by id */\n\trequires: { units: string[] }\n\t/** A building's or hero's production queue has no room for more */\n\tqueueFull: {}\n\t/** The player already has the hero being asked for */\n\talreadyHaveHero: {}\n\t/** The player has as many heroes as the rules allow (`RuleSettings.heroes`) */\n\ttooManyHeroes: {}\n\t/** Out of supply, and could build more of what provides it. `pool` for one of the game's own (`RuleSettings.supply.pools`) */\n\tsupplyBlocked: { pool?: string }\n\t/** Out of supply, and at the most anyone can have (`RuleSettings.supply.max`, a pool's `max`) */\n\tsupplyLimit: { pool?: string }\n\t/** The upgrade being asked for is already being researched */\n\talreadyResearching: {}\n\t/** Research of the upgrade finished; `upgrade` is its id */\n\tresearchDone: { upgrade: string }\n\t/** `unit` is the id of the hero's type */\n\theroLevel: { unit: string; level: number }\n\t/** The player has lost the game */\n\tdefeated: {}\n\t/** Another player gave up. `player` is their name */\n\tsurrendered: { player: string }\n\t/** Every pause of the player's is used */\n\tnoPausesLeft: {}\n\t/** A structure cannot be placed at that spot */\n\tcannotBuildThere: {}\n\t/** The navigation has no room for another building in the way (`RecastNavigationOptions.maxObstacles`) */\n\ttooManyBuildings: {}\n\t/** A worker could not find a way to the building site */\n\tcannotReachSite: {}\n\t/** A unit could not find a way to where it was sent */\n\tcannotReach: {}\n\t/** A worker with something to bring back and nowhere to bring it. `resource` is its id */\n\tnowhereToReturn: { resource: string }\n\t/** A worker cannot gather from a resource of that id */\n\tcannotGather: { resource: string }\n\t/** A structure cannot be placed on a resource of that id */\n\tbuildOnResource: { resource: string }\n\t/** The unit's inventory has no free slot */\n\tinventoryFull: {}\n\t/** The inventory of the unit it is given to has no free slot */\n\ttheirInventoryFull: {}\n\t/**\n\t * The carrier has as many of the item's group as it may (`ItemDef.group`, `groupLimit`): one pair of boots. `item`\n\t * is the item's id, `group` the group's, `limit` how many it may carry\n\t */\n\tgroupLimit: { item: string; group: string; limit: number }\n\t/** The unit it is handed to has as many of the item's group as it may (`groupLimit`'s params) */\n\ttheirGroupLimit: { item: string; group: string; limit: number }\n\t/** A shop is out of the item */\n\toutOfStock: {}\n\t/** Buying needs one of the player's heroes at the shop, with a free slot */\n\theroAtShop: {}\n\t/** Hiring needs one of the player's units at the place that hires */\n\tunitAtShop: {}\n\t/** A hero is hired once: the player has it already. `unit` is its type */\n\talreadyHired: { unit: string }\n\t/** No shop is near enough for the buyer */\n\tnoShopNear: {}\n\t/** No purchase to undo (`undoBuy`): none within the time, the hero away from the shop, the item used */\n\tnothingToUndo: {}\n\t/** The thing asked for cannot be done, the engine's word where a handler gave no reason */\n\tcannotDoThat: {}\n\t/** The ability or action is not ready yet, such as on cooldown */\n\tnotReady: {}\n\t/** An item that refills has none of its charges now (`ItemDef.refill`) */\n\tnoCharges: {}\n\t/** The caster has too little mana */\n\tnotEnoughMana: {}\n\t/** The caster has too little health to pay what the ability costs */\n\tnotEnoughHealth: {}\n\t/** The game has no buyback for this hero (`HeroSettings.buybackCost`) */\n\tnoBuyback: {}\n\t/** The hero was bought back a moment ago, and may be again in so many seconds */\n\tbuybackNotReady: { seconds: number }\n\t/** The caster is silenced and cannot cast */\n\tsilenced: {}\n\t/** An ability that rushes or jumps the caster, which a buff keeps from it (`BuffDef.grounded`) */\n\tgrounded: {}\n\t/** A recast that goes to the unit the cast marked (`AbilityRecast.mark`), while none carries the mark */\n\tnoMark: {}\n\t/** An ability used on something it is not for */\n\tcannotTargetThat: {}\n\t/** An ability used on a friend that does not target friends */\n\tcannotTargetFriends: {}\n\t/** An ability used on its caster that does not target itself */\n\tcannotTargetSelf: {}\n\t/** An ability used on a flying unit that does not hit the air */\n\tcannotTargetAir: {}\n\t/** An ability used on a unit that is not flying but needs a flying target */\n\tmustTargetAir: {}\n\t/** An ability used on a unit that is not a hero but needs a hero */\n\tmustTargetHero: {}\n\t/** An ability used on a hero that targets anything but heroes (`targets.heroes: false`) */\n\tcannotTargetHero: {}\n\t/** An ability used on what is immune to spells */\n\ttargetSpellImmune: {}\n\t/** Pinged too often: the rest go nowhere for a moment */\n\ttooManyPings: {}\n\t/** Said too much too quickly: the rest goes nowhere for a moment */\n\ttooManyLines: {}\n\t/** Sent commands faster than the game takes them (a server's rate, `World.commandLimit`): the rest went nowhere */\n\ttooManyCommands: {}\n\t/** Resources given to someone who is not an ally */\n\tnotAnAlly: {}\n\t/** Resources given to an ally, and received from one (see `give`) */\n\tsent: { amount: number; resource: string; player: string }\n\t/** Resources arrived from an ally: the `amount` of the `resource` from the `player` by name */\n\treceived: { amount: number; resource: string; player: string }\n\t/** One resource traded for another at a rate (see `exchange`): `amount` of `resource` went, `received` of `for` came */\n\texchanged: { amount: number; resource: string; received: number; for: string }\n\t/** A field of a definition the game does not let be changed, or a value it does not take (`debug.redefine`) */\n\tdataRefused: { why: string }\n}\n\n/**\n * A message of the engine's own, with its params checked\n *\n * @beta\n */\nexport const engineMessage = <K extends keyof EngineMessages>(\n\tkey: K,\n\t// a message whose params may all be left out takes them or not\n\t...params: {} extends EngineMessages[K] ? [] | [EngineMessages[K]] : [EngineMessages[K]]\n): Message => (params.length ? { key, params: params[0] as MessageParams } : { key })\n\n/** A message, to whom it is for */\nexport const toldMessage = replicateEvent(messageSent, 'message', (message, view) =>\n\tmessage.player === view.player\n\t\t? { type: 'message', message: message.message, kind: message.kind, ...(message.seconds !== undefined && { seconds: message.seconds }) }\n\t\t: undefined\n)\n"],"mappings":";;;;;;;;AAsCA,IAAa,aAAa,YAAkC,OAAO,YAAY,WAAW,EAAE,KAAK,QAAQ,IAAI;;;;;;AAqI7G,IAAa,iBACZ,KAEA,GAAG,WACW,OAAO,SAAS;CAAE;CAAK,QAAQ,OAAO;AAAoB,IAAI,EAAE,IAAI;;AAGnF,IAAa,cAAc,eAAe,aAAa,YAAY,SAAS,SAC3E,QAAQ,WAAW,KAAK,SACrB;CAAE,MAAM;CAAW,SAAS,QAAQ;CAAS,MAAM,QAAQ;CAAM,GAAI,QAAQ,YAAY,KAAA,KAAa,EAAE,SAAS,QAAQ,QAAQ;AAAG,IACpI,KAAA,CACJ"}
|
package/dist/missionRules.d.ts
CHANGED
|
@@ -34,13 +34,18 @@ export type MissionActionData =
|
|
|
34
34
|
reason?: MessageRef;
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
|
-
/**
|
|
37
|
+
/**
|
|
38
|
+
* A line said (`world.dialog.say`): who speaks (a speaker of the view's), what (a message key, or the words), for how
|
|
39
|
+
* long; the unit that says it (by its name on the map: its face talks in the portrait box) and how (`emotion`)
|
|
40
|
+
*/
|
|
38
41
|
| {
|
|
39
42
|
say: {
|
|
40
43
|
speaker: string;
|
|
41
44
|
text: MessageRef;
|
|
42
45
|
seconds?: number;
|
|
43
46
|
to?: PlayerId[];
|
|
47
|
+
unit?: string;
|
|
48
|
+
emotion?: string;
|
|
44
49
|
};
|
|
45
50
|
}
|
|
46
51
|
/** A cinematic of the view's played (`playCinematic`), to everyone when `to` is left out */
|
|
@@ -115,7 +120,7 @@ export type MissionActionData =
|
|
|
115
120
|
export interface MissionRule {
|
|
116
121
|
/** What the log, the checks and the editor know it by; no two the same */
|
|
117
122
|
id: string;
|
|
118
|
-
/** When it fires: plain data (`docs/ai.md`, "Conditions") */
|
|
123
|
+
/** When it fires: plain data (`docs/ai/scripting.md`, "Conditions") */
|
|
119
124
|
when: AiConditionData;
|
|
120
125
|
/** What it does, in order */
|
|
121
126
|
do: MissionActionData[];
|
|
@@ -141,8 +146,11 @@ export declare const ruleFired: import("./events").EventKey<{
|
|
|
141
146
|
* @beta
|
|
142
147
|
*/
|
|
143
148
|
export interface MissionRuleState {
|
|
149
|
+
/** Whether the rule's condition held at the last check */
|
|
144
150
|
holds: boolean;
|
|
151
|
+
/** How many times the rule has fired */
|
|
145
152
|
count: number;
|
|
153
|
+
/** The tick the rule last fired at; left out when it has not */
|
|
146
154
|
fired?: number;
|
|
147
155
|
}
|
|
148
156
|
/**
|