@v12-engine/engine 0.1.1 → 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
|
@@ -1,138 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var MAP_OBJECTIVES = "core.mapObjectives";
|
|
9
|
-
/**
|
|
10
|
-
* The key of the map's data its objectives are kept under (`GameMap.data.objectives`)
|
|
11
|
-
*
|
|
12
|
-
* @beta
|
|
13
|
-
*/
|
|
14
|
-
var MAP_OBJECTIVES_KEY = "objectives";
|
|
15
|
-
/** The words of an objective as a file may hold them: a key, or a key with params */
|
|
16
|
-
var isWords = (text) => typeof text === "string" ? text.trim() !== "" : typeof text === "object" && text !== null && typeof text.key === "string" && text.key !== "";
|
|
17
|
-
/**
|
|
18
|
-
* The objectives a map gives (`GameMap.data.objectives`), in the order it gives them: none for a map with none. What is
|
|
19
|
-
* 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
|
|
20
|
-
* it; the map's checks say so (`mapObjectives`)
|
|
21
|
-
*
|
|
22
|
-
* @beta
|
|
23
|
-
*/
|
|
24
|
-
function mapObjectivesOf(map) {
|
|
25
|
-
const kept = map.data[MAP_OBJECTIVES_KEY];
|
|
26
|
-
if (!Array.isArray(kept)) return [];
|
|
27
|
-
return kept.filter((each) => typeof each === "object" && each !== null && typeof each.id === "string" && each.id !== "" && isWords(each.text)).map((each) => ({
|
|
28
|
-
id: each.id,
|
|
29
|
-
text: each.text,
|
|
30
|
-
...each.detail !== void 0 && isWords(each.detail) && { detail: each.detail },
|
|
31
|
-
...each.required !== void 0 && { required: each.required !== false },
|
|
32
|
-
at: each.at === "rule" ? "rule" : "start"
|
|
33
|
-
}));
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Who is given a map's objective when the rules do not say (`giveMapObjective`): the map's players a person plays, not
|
|
37
|
-
* those it says the computer plays or nobody does (`MapPlayer.controller`), in the order of their ids
|
|
38
|
-
*
|
|
39
|
-
* @beta
|
|
40
|
-
*/
|
|
41
|
-
function mapObjectivePlayers(world) {
|
|
42
|
-
return [...world.players.values()].filter((player) => !player.neutral && !player.creeps).filter((player) => {
|
|
43
|
-
const controller = world.map.player(player.id)?.controller;
|
|
44
|
-
return controller !== "computer" && controller !== "nobody";
|
|
45
|
-
}).map((player) => player.id).sort((a, b) => a - b);
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Gives players an objective of the map's, by its id (`MapObjective`): those given by a rule (`at: 'rule'`), when the
|
|
49
|
-
* rules say. To every player a person plays when `players` is left out (`mapObjectivePlayers`); a player who has it
|
|
50
|
-
* already keeps theirs. Its words' params and its progress go with it, as `world.objectives.add`. Throws for an id the
|
|
51
|
-
* map does not have: an id in the code that is not on the map is a mistake
|
|
52
|
-
*
|
|
53
|
-
* @beta
|
|
54
|
-
*/
|
|
55
|
-
function giveMapObjective(world, id, options = {}) {
|
|
56
|
-
const def = mapObjectivesOf(world.map).find((objective) => objective.id === id);
|
|
57
|
-
if (!def) throw new Error(`The map${world.map.name ? ` "${world.map.name}"` : ""} has no objective "${id}"`);
|
|
58
|
-
const { at: _at, ...objective } = def;
|
|
59
|
-
const given = [];
|
|
60
|
-
for (const player of options.players ?? mapObjectivePlayers(world)) {
|
|
61
|
-
if (world.objectives.has(player, id)) continue;
|
|
62
|
-
given.push(world.objectives.add(player, objective, {
|
|
63
|
-
params: options.params,
|
|
64
|
-
progress: options.progress
|
|
65
|
-
}));
|
|
66
|
-
}
|
|
67
|
-
return given;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* What is wrong with a map's objectives (`GameMap.data.objectives`): one with no id or with another's, one with no
|
|
71
|
-
* words, a list that is not one. Each a click away in the Objectives panel
|
|
72
|
-
*
|
|
73
|
-
* @beta
|
|
74
|
-
*/
|
|
75
|
-
function checkMapObjectives(map) {
|
|
76
|
-
const kept = map.data[MAP_OBJECTIVES_KEY];
|
|
77
|
-
if (kept === void 0) return [];
|
|
78
|
-
if (!Array.isArray(kept)) return [{
|
|
79
|
-
message: "The map’s objectives are not a list",
|
|
80
|
-
error: true,
|
|
81
|
-
rule: "objectives"
|
|
82
|
-
}];
|
|
83
|
-
const problems = [];
|
|
84
|
-
const seen = /* @__PURE__ */ new Set();
|
|
85
|
-
kept.forEach((each, index) => {
|
|
86
|
-
const id = typeof each?.id === "string" ? each.id : "";
|
|
87
|
-
const reveal = {
|
|
88
|
-
panel: "objectives",
|
|
89
|
-
entry: id || String(index)
|
|
90
|
-
};
|
|
91
|
-
if (!id) problems.push({
|
|
92
|
-
message: `Objective ${index + 1} has no id`,
|
|
93
|
-
error: true,
|
|
94
|
-
rule: "objective-id",
|
|
95
|
-
reveal
|
|
96
|
-
});
|
|
97
|
-
else if (seen.has(id)) problems.push({
|
|
98
|
-
message: `Two objectives have the id "${id}"`,
|
|
99
|
-
error: true,
|
|
100
|
-
rule: "objective-id",
|
|
101
|
-
reveal
|
|
102
|
-
});
|
|
103
|
-
seen.add(id);
|
|
104
|
-
if (!isWords(each?.text)) problems.push({
|
|
105
|
-
message: `The objective "${id || index + 1}" has no words`,
|
|
106
|
-
error: true,
|
|
107
|
-
rule: "objective-text",
|
|
108
|
-
reveal
|
|
109
|
-
});
|
|
110
|
-
});
|
|
111
|
-
return problems;
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Objectives as data on the map (campaign plan EQ3): a map's objectives (`MapObjective`, kept in `GameMap.data.objectives`,
|
|
115
|
-
* written by the editor's Objectives panel) given at the start to every player a person plays, as the world is made
|
|
116
|
-
* from the map; those given by a rule wait for the rules (`giveMapObjective(world, id)`). Done and failed as any
|
|
117
|
-
* objective is (`world.objectives.complete`, `fail`); a game that is won by them has `objectiveVictory` as its
|
|
118
|
-
* `victory`. The map's checks say what is wrong with them (`checkMapObjectives`)
|
|
119
|
-
*
|
|
120
|
-
* @beta
|
|
121
|
-
*/
|
|
122
|
-
function mapObjectives() {
|
|
123
|
-
return {
|
|
124
|
-
id: MAP_OBJECTIVES,
|
|
125
|
-
hooks: [defineHook({
|
|
126
|
-
hook: "mapStart",
|
|
127
|
-
id: MAP_OBJECTIVES,
|
|
128
|
-
run(world) {
|
|
129
|
-
for (const objective of mapObjectivesOf(world.map)) if (objective.at === "start") giveMapObjective(world, objective.id);
|
|
130
|
-
}
|
|
131
|
-
})],
|
|
132
|
-
check: (map) => checkMapObjectives(map)
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
//#endregion
|
|
1
|
+
import { defineComponent } from "./components.js";
|
|
2
|
+
import { defineEngineEvent } from "./events.js";
|
|
3
|
+
import { gameOver } from "./engineEvents.js";
|
|
4
|
+
import { defineTimer } from "./timers.js";
|
|
5
|
+
import { playCinematic } from "./cinematics.js";
|
|
6
|
+
import { defeat } from "./systems/victory.js";
|
|
7
|
+
import { giveMapObjective, mapObjectivePlayers, mapObjectivesOf } from "./mapObjectives.js";
|
|
136
8
|
//#region src/missionRules.ts
|
|
137
9
|
/**
|
|
138
10
|
* The mission rules pack's id
|
|
@@ -151,17 +23,20 @@ var MAP_RULES_KEY = "rules";
|
|
|
151
23
|
*
|
|
152
24
|
* @internal
|
|
153
25
|
*/
|
|
154
|
-
var missionRulesState = defineComponent(
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
26
|
+
var missionRulesState = defineComponent({
|
|
27
|
+
id: "core.missionRules",
|
|
28
|
+
default: () => ({
|
|
29
|
+
rules: {},
|
|
30
|
+
told: [],
|
|
31
|
+
timers: {}
|
|
32
|
+
})
|
|
33
|
+
});
|
|
159
34
|
/**
|
|
160
35
|
* A mission rule fired: its id. For a pack of the game's that does what the rules cannot
|
|
161
36
|
*
|
|
162
37
|
* @beta
|
|
163
38
|
*/
|
|
164
|
-
var ruleFired =
|
|
39
|
+
var ruleFired = defineEngineEvent({ id: "core.ruleFired" });
|
|
165
40
|
var ACTIONS = [
|
|
166
41
|
"objective",
|
|
167
42
|
"say",
|
|
@@ -341,11 +216,14 @@ function rulePlayers(world) {
|
|
|
341
216
|
*
|
|
342
217
|
* @internal
|
|
343
218
|
*/
|
|
344
|
-
var ruleTimer = defineTimer(
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
219
|
+
var ruleTimer = defineTimer({
|
|
220
|
+
id: "core.missionRules.timer",
|
|
221
|
+
run: (world, { word, to }, timer) => {
|
|
222
|
+
const state = world.state(missionRulesState);
|
|
223
|
+
if (state.timers[word] === timer.id) delete state.timers[word];
|
|
224
|
+
for (const player of to ?? []) world.timers.hide(player, timer.id);
|
|
225
|
+
tellRules(world, word);
|
|
226
|
+
}
|
|
349
227
|
});
|
|
350
228
|
/**
|
|
351
229
|
* Does one action of a rule, now
|
|
@@ -362,11 +240,13 @@ function doMissionAction(world, rule, action) {
|
|
|
362
240
|
giveMapObjective(world, id, { players: to });
|
|
363
241
|
} else for (const player of to) if (world.objectives.has(player, id)) what === "complete" ? world.objectives.complete(player, id) : world.objectives.fail(player, id, reason);
|
|
364
242
|
} else if ("say" in action) {
|
|
365
|
-
const { speaker, text, seconds, to = people } = action.say;
|
|
243
|
+
const { speaker, text, seconds, to = people, unit, emotion } = action.say;
|
|
366
244
|
world.dialog.say(to, {
|
|
367
245
|
speaker,
|
|
368
246
|
text,
|
|
369
|
-
...seconds !== void 0 && { seconds }
|
|
247
|
+
...seconds !== void 0 && { seconds },
|
|
248
|
+
...unit && { unit },
|
|
249
|
+
...emotion && { emotion }
|
|
370
250
|
});
|
|
371
251
|
} else if ("cinematic" in action) {
|
|
372
252
|
const { id, to, hold, skippable } = action.cinematic;
|
|
@@ -518,6 +398,6 @@ function missionRulesPack(options) {
|
|
|
518
398
|
};
|
|
519
399
|
}
|
|
520
400
|
//#endregion
|
|
521
|
-
export {
|
|
401
|
+
export { MAP_RULES_KEY, MISSION_RULES, checkMissionRules, doMissionAction, missionRuleState, missionRulesOf, missionRulesPack, missionRulesState, ruleFired, rulePlayers, ruleTimer, tellRules };
|
|
522
402
|
|
|
523
|
-
//# sourceMappingURL=missionRules
|
|
403
|
+
//# sourceMappingURL=missionRules.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"missionRules.js","names":[],"sources":["../src/missionRules.ts"],"sourcesContent":["import type { AiConditionData } from './ai/rules'\nimport { playCinematic } from './cinematics'\nimport { defineComponent } from './components'\nimport type { PlayerId } from './entity'\nimport { gameOver } from './engineEvents'\nimport { defineEngineEvent } from './events'\nimport type { GameMap } from './map'\nimport type { MapProblem } from './mapFields'\nimport { giveMapObjective, mapObjectivePlayers, mapObjectivesOf } from './mapObjectives'\nimport type { Vec2 } from './math'\nimport type { MessageRef } from './messages'\nimport type { GamePack } from './packs/pack'\nimport type { Registry, System } from './registry'\nimport { defeat } from './systems/victory'\nimport { defineTimer } from './timers'\nimport type { PlayerRelation, World } from './world'\n\n/*\n * Mission rules as data (campaign plan MS1): what a mission scripts without code, kept on the map (`GameMap.data.rules`),\n * written in the editor's Rules panel, and run by the mission rules pack (`missionRules` of `@v12-engine/engine/ai`, where the\n * computer players' kit it asks the conditions of lives: `ai/missionRules.ts`). A rule is `when` a\n * condition of the computer players' language (`AiConditionData`, `docs/ai/scripting.md`: the hero nears the camp, a region has\n * units in it, an objective is done, a word was told, so many seconds went by) and `do` a list of actions from a closed\n * set: give, complete or fail an objective of the map's, say a line, play a cinematic, spawn a prefab, tell a computer\n * player a word, set what two players are to each other, start a timer, win, lose. No variables and no code by name:\n * what needs code is a pack of the game's, which the rules reach through the words they are told (`tellRules`) and\n * the event each firing is (`ruleFired`).\n *\n * The conditions are asked of a watcher: a brain with no modules of its own, seated at the player the rule is `as`\n * (the first person playing when it says none), which sees the whole map (an observer's session) and reads it as a\n * computer player does (`Brain.view`, `knowledge`), once a second. So `{ units: { of: 'enemy' } }` means that\n * player's enemies, and every form of the table in `docs/ai/scripting.md` works as it does for a brain. A rule fires as its\n * condition turns true, once (`once`) or each time, or again every so many seconds while it holds (`every`), as a\n * brain's rules do. What the rules remember (whether each held, when and how often it fired, the words told and not yet\n * heard, the timers started) is in the world's state, and the watchers' memory in the system's: a save mid-mission has\n * it all, and a game loaded from one goes on where it was\n */\n\n/**\n * The mission rules pack's id\n *\n * @beta\n */\nexport const MISSION_RULES = 'core.missionRules'\n\n/**\n * The key of the map's data its rules are kept under (`GameMap.data.rules`)\n *\n * @beta\n */\nexport const MAP_RULES_KEY = 'rules'\n\n/**\n * What a mission rule does, as plain data: one of a closed set of actions. Each takes who it is for (`to`) where that\n * matters: every player a person plays when left out (`mapObjectivePlayers`), as the map's objectives are given\n *\n * @beta\n */\nexport type MissionActionData =\n\t/** An objective of the map's (`MapObjective`), by id: given (`give`, the default), done or failed (with why) */\n\t| { objective: { id: string; do?: 'give' | 'complete' | 'fail'; to?: PlayerId[]; reason?: MessageRef } }\n\t/**\n\t * A line said (`world.dialog.say`): who speaks (a speaker of the view's), what (a message key, or the words), for how\n\t * long; the unit that says it (by its name on the map: its face talks in the portrait box) and how (`emotion`)\n\t */\n\t| { say: { speaker: string; text: MessageRef; seconds?: number; to?: PlayerId[]; unit?: string; emotion?: string } }\n\t/** A cinematic of the view's played (`playCinematic`), to everyone when `to` is left out */\n\t| { cinematic: { id: string; to?: PlayerId[]; hold?: boolean; skippable?: boolean } }\n\t/**\n\t * A prefab of the game's spawned (`world.spawnPrefab`) at a place: a point or a region of the map by name, a named\n\t * thing of the map, or a point; for a player, or neutral\n\t */\n\t| { spawn: { prefab: string; at: string | Vec2; owner?: PlayerId; facing?: number } }\n\t/** A word told to a computer player (`world.computers.tell`), with what goes with it */\n\t| { tell: { computer: PlayerId; word: string; data?: unknown } }\n\t/** What two players are to each other from now on (`world.sides.setRelation`) */\n\t| { relation: { a: PlayerId; b: PlayerId; how: PlayerRelation } }\n\t/**\n\t * A timer started: so many seconds on, the rules are told its id as a word (a rule `when: { told: id }` fires), and\n\t * with `label` it counts down on the players' screens meanwhile (`world.timers.show`). Started again, it starts over\n\t */\n\t| { timer: { id: string; seconds: number; label?: MessageRef; to?: PlayerId[] } }\n\t/** The game is won by the players' team */\n\t| { win: true | { to?: PlayerId[] } }\n\t/** The players are out of the game (`defeat`) */\n\t| { lose: true | { to?: PlayerId[] } }\n\n/**\n * A rule of a mission, as the map keeps it and the mission rules pack runs it: `when` a condition of the computer\n * players' language holds, `do` its actions. Fires as the condition turns true; `once` the first time only, ever; with\n * `every`, again while it holds, at most so often. Asked `as` a player: whose the units of `of: 'mine'` are, whose\n * objectives `{ objective }` reads; the first player a person plays when left out\n *\n * @beta\n */\nexport interface MissionRule {\n\t/** What the log, the checks and the editor know it by; no two the same */\n\tid: string\n\t/** When it fires: plain data (`docs/ai/scripting.md`, \"Conditions\") */\n\twhen: AiConditionData\n\t/** What it does, in order */\n\tdo: MissionActionData[]\n\t/** The first time only, ever */\n\tonce?: boolean\n\t/** Seconds: fired again while its condition holds, at most so often */\n\tevery?: number\n\t/** The player the condition is asked for */\n\tas?: PlayerId\n}\n\n/** What the rules remember of one rule, in the world's state */\ninterface RuleMemory {\n\t/** Whether its condition held at the last check: a rule fires as it turns true */\n\twas?: boolean\n\t/** The tick it last fired at */\n\tfired?: number\n\t/** How many times it fired */\n\tcount: number\n}\n\n/** A word the rules were told and have not heard yet */\ninterface ToldWord {\n\tword: string\n\tdata?: unknown\n\ttick: number\n}\n\n/** What the rules keep in the world: plain data, into a save */\ninterface RulesState {\n\trules: Record<string, RuleMemory>\n\ttold: ToldWord[]\n\t/** The timers the rules started and have not heard yet, by their id in the rules, as the world numbers them */\n\ttimers: Record<string, number>\n}\n\n/**\n * What the mission rules remember: in the world's state, so that a save has it\n *\n * @internal\n */\nexport const missionRulesState = defineComponent<RulesState>({ id: 'core.missionRules', default: () => ({ rules: {}, told: [], timers: {} }) })\n\n/**\n * A mission rule fired: its id. For a pack of the game's that does what the rules cannot\n *\n * @beta\n */\nexport const ruleFired = defineEngineEvent<{ rule: string }>({ id: 'core.ruleFired' })\n\n/**\n * What a mission rule is now, for the report and the tests: whether its condition held at the last check, how often it\n * fired and when it last did\n *\n * @beta\n */\nexport interface MissionRuleState {\n\t/** Whether the rule's condition held at the last check */\n\tholds: boolean\n\t/** How many times the rule has fired */\n\tcount: number\n\t/** The tick the rule last fired at; left out when it has not */\n\tfired?: number\n}\n\nconst ACTIONS = ['objective', 'say', 'cinematic', 'spawn', 'tell', 'relation', 'timer', 'win', 'lose'] as const\n\n/** The form of an action, by its one key: none for data that is no action */\nconst actionKind = (action: unknown): (typeof ACTIONS)[number] | undefined => {\n\tif (typeof action !== 'object' || action === null) return undefined\n\tconst keys = Object.keys(action)\n\treturn keys.length === 1 && (ACTIONS as readonly string[]).includes(keys[0]) ? (keys[0] as (typeof ACTIONS)[number]) : undefined\n}\n\n/** Whether data is a rule's condition: an object of one form */\nconst isCondition = (when: unknown): when is AiConditionData => typeof when === 'object' && when !== null && Object.keys(when).length > 0\n\n/**\n * The rules a map keeps (`GameMap.data.rules`), in their order: none for a map with none. What is kept there and is no\n * rule (no id, no condition) is left out, so that a file changed by hand breaks no game that reads it; the map's checks\n * say so (`checkMissionRules`). Actions that are of no form the pack knows are left out of a rule the same way\n *\n * @beta\n */\nexport function missionRulesOf(map: { readonly data: Readonly<Record<string, unknown>> }): MissionRule[] {\n\tconst kept = map.data[MAP_RULES_KEY]\n\tif (!Array.isArray(kept)) return []\n\treturn kept\n\t\t.filter(\n\t\t\t(each): each is MissionRule =>\n\t\t\t\ttypeof each === 'object' && each !== null && typeof each.id === 'string' && each.id !== '' && isCondition(each.when)\n\t\t)\n\t\t.map((each) => ({\n\t\t\tid: each.id,\n\t\t\twhen: each.when,\n\t\t\tdo: Array.isArray(each.do) ? each.do.filter((action) => actionKind(action) !== undefined) : [],\n\t\t\t...(each.once !== undefined && { once: each.once === true }),\n\t\t\t...(typeof each.every === 'number' && each.every > 0 && { every: each.every }),\n\t\t\t...(typeof each.as === 'number' && { as: each.as })\n\t\t}))\n}\n\n/**\n * Tells the mission rules a word, as the game's code does for what the rules cannot know on their own (the boss fell,\n * the player chose): a rule `when: { told: word }` fires at the next check, and the word is heard no more after it.\n * What a rule's timer does as it goes off\n *\n * @beta\n */\nexport function tellRules(world: World, word: string, data?: unknown): void {\n\tworld.state(missionRulesState).told.push({ word, ...(data !== undefined && { data }), tick: world.tick })\n}\n\n/**\n * What a mission rule is now (`MissionRuleState`): none for a rule the world has not, or has not checked yet\n *\n * @beta\n */\nexport function missionRuleState(world: World, id: string): MissionRuleState | undefined {\n\tif (!world.states.has(missionRulesState)) return undefined\n\tconst kept = world.state(missionRulesState).rules[id]\n\treturn kept && { holds: !!kept.was, count: kept.count, ...(kept.fired !== undefined && { fired: kept.fired }) }\n}\n\n/** The names of the regions a condition asks about, wherever it is in it */\nfunction regionsNamed(when: unknown, out: string[] = []): string[] {\n\tif (typeof when !== 'object' || when === null) return out\n\tconst condition = when as Record<string, unknown>\n\tif ('region' in condition && typeof (condition.region as { name?: unknown })?.name === 'string')\n\t\tout.push((condition.region as { name: string }).name)\n\tfor (const key of ['all', 'any'] as const)\n\t\tif (Array.isArray(condition[key])) for (const each of condition[key] as unknown[]) regionsNamed(each, out)\n\tif ('not' in condition) regionsNamed(condition.not, out)\n\treturn out\n}\n\n/**\n * What is wrong with a map's rules (`GameMap.data.rules`): one with no id or with another's, one with no condition, an\n * action of no form the pack knows, a condition or an action naming what the map or the game has not (a region, an\n * objective, a prefab, a player). Each a click away in the Rules panel\n *\n * @beta\n */\nexport function checkMissionRules(map: GameMap, registry?: Registry): MapProblem[] {\n\tconst kept = map.data[MAP_RULES_KEY]\n\tif (kept === undefined) return []\n\tif (!Array.isArray(kept)) return [{ message: 'The map’s rules are not a list', error: true, rule: 'rules' }]\n\tconst problems: MapProblem[] = []\n\tconst seen = new Set<string>()\n\tconst regions = new Set(map.regions.map((region) => region.name))\n\tconst objectives = new Set(mapObjectivesOf(map).map((objective) => objective.id))\n\tconst players = new Set(map.players.map((player) => player.id))\n\tkept.forEach((each: Partial<MissionRule> | null, index) => {\n\t\tconst id = typeof each?.id === 'string' ? each.id : ''\n\t\tconst name = id || String(index + 1)\n\t\tconst reveal = { panel: 'rules', entry: id || String(index) }\n\t\tconst problem = (message: string, rule: string, error = true) => problems.push({ message, error, rule, reveal })\n\t\tif (!id) problem(`Rule ${index + 1} has no id`, 'rule-id')\n\t\telse if (seen.has(id)) problem(`Two rules have the id \"${id}\"`, 'rule-id')\n\t\tseen.add(id)\n\t\tif (!isCondition(each?.when)) problem(`The rule \"${name}\" has no condition`, 'rule-when')\n\t\telse\n\t\t\tfor (const region of regionsNamed(each!.when))\n\t\t\t\tif (!regions.has(region)) problem(`The rule \"${name}\" asks about a region \"${region}\" the map has not`, 'rule-name')\n\t\tif (each?.as !== undefined && !players.has(each.as)) problem(`The rule \"${name}\" is asked as a player ${each.as} the map has not`, 'rule-name')\n\t\tconst actions = Array.isArray(each?.do) ? each.do : []\n\t\tif (!actions.length) problem(`The rule \"${name}\" does nothing`, 'rule-action', false)\n\t\tfor (const action of actions as unknown[]) {\n\t\t\tconst kind = actionKind(action)\n\t\t\tif (!kind) {\n\t\t\t\tproblem(`The rule \"${name}\" has an action of no form the rules know (${Object.keys(action ?? {}).join(', ') || 'nothing'})`, 'rule-action')\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tconst data = (action as Record<string, Record<string, unknown>>)[kind]\n\t\t\tconst named = (player: unknown, what: string) => {\n\t\t\t\tif (typeof player === 'number' && !players.has(player)) problem(`The rule \"${name}\" ${what} a player ${player} the map has not`, 'rule-name')\n\t\t\t}\n\t\t\tif (kind === 'objective' && !objectives.has(String(data?.id ?? '')))\n\t\t\t\tproblem(`The rule \"${name}\" names an objective \"${data?.id ?? ''}\" the map has not`, 'rule-name')\n\t\t\tif (kind === 'spawn' && registry && !registry.prefabs.has(String(data?.prefab ?? '')))\n\t\t\t\tproblem(`The rule \"${name}\" spawns a prefab \"${data?.prefab ?? ''}\" the game has not`, 'rule-name')\n\t\t\tif (kind === 'spawn' && typeof data?.at === 'string' && !placeNamed(map, data.at))\n\t\t\t\tproblem(`The rule \"${name}\" spawns at \"${data.at}\", which the map has not`, 'rule-name')\n\t\t\tif (kind === 'spawn') named(data?.owner, 'spawns for')\n\t\t\tif (kind === 'tell') named(data?.computer, 'tells')\n\t\t\tif (kind === 'relation') {\n\t\t\t\tnamed(data?.a, 'sets')\n\t\t\t\tnamed(data?.b, 'sets')\n\t\t\t}\n\t\t\tif (typeof data === 'object' && data !== null && Array.isArray(data.to)) for (const player of data.to) named(player, 'is for')\n\t\t}\n\t})\n\treturn problems\n}\n\n/** Whether a map has a place of this name: a point, a region, or something placed and named */\nconst placeNamed = (map: GameMap, name: string): boolean =>\n\tmap.points.some((point) => point.name === name) ||\n\tmap.regions.some((region) => region.name === name) ||\n\tmap.objects.some((object) => object.name === name)\n\n/** Where a place is in the world: a point or a region of the map by name, a named thing, or the point given */\nfunction placeOf(world: World, at: string | Vec2): Vec2 | undefined {\n\tif (typeof at !== 'string') return { x: at.x, z: at.z }\n\tconst point = world.map.points.find((each) => each.name === at)\n\tif (point) return { x: point.x, z: point.z }\n\tconst region = world.map.regions.find((each) => each.name === at)\n\tif (region) return { x: region.shape.x, z: region.shape.z }\n\tconst named = world.named(at)\n\treturn named && { x: named.pos.x, z: named.pos.z }\n}\n\n/**\n * The players a rule's actions are for when they say none: the people, else everyone who can win or lose\n *\n * @internal\n */\nexport function rulePlayers(world: World): PlayerId[] {\n\tconst people = mapObjectivePlayers(world)\n\tif (people.length) return people\n\treturn [...world.players.values()]\n\t\t.filter((player) => !player.neutral && !player.creeps)\n\t\t.map((player) => player.id)\n\t\t.sort((a, b) => a - b)\n}\n\n/**\n * The timer of a rule's `timer` action: as it goes off, the rules are told its id, and the screens stop counting it\n *\n * @internal\n */\nexport const ruleTimer = defineTimer<{ word: string; to?: PlayerId[] }>({ id: 'core.missionRules.timer', run: (world, { word, to }, timer) => {\n\tconst state = world.state(missionRulesState)\n\tif (state.timers[word] === timer.id) delete state.timers[word]\n\tfor (const player of to ?? []) world.timers.hide(player, timer.id)\n\ttellRules(world, word)\n} })\n\n/**\n * Does one action of a rule, now\n *\n * @internal\n */\nexport function doMissionAction(world: World, rule: MissionRule, action: MissionActionData): void {\n\tconst warn = (line: string) => world.log.warn('rules', `the rule \"${rule.id}\" ${line}`)\n\tconst people = rulePlayers(world)\n\tif ('objective' in action) {\n\t\tconst { id, do: what = 'give', to = people, reason } = action.objective\n\t\tif (what === 'give') {\n\t\t\tif (!mapObjectivesOf(world.map).some((objective) => objective.id === id)) return warn(`gives an objective \"${id}\" the map has not`)\n\t\t\tgiveMapObjective(world, id, { players: to })\n\t\t} else\n\t\t\tfor (const player of to)\n\t\t\t\tif (world.objectives.has(player, id)) what === 'complete' ? world.objectives.complete(player, id) : world.objectives.fail(player, id, reason)\n\t} else if ('say' in action) {\n\t\tconst { speaker, text, seconds, to = people, unit, emotion } = action.say\n\t\tworld.dialog.say(to, { speaker, text, ...(seconds !== undefined && { seconds }), ...(unit && { unit }), ...(emotion && { emotion }) })\n\t} else if ('cinematic' in action) {\n\t\tconst { id, to, hold, skippable } = action.cinematic\n\t\tplayCinematic(world, id, { to: to ?? 'everyone', hold, skippable })\n\t} else if ('spawn' in action) {\n\t\tconst { prefab, at, owner, facing } = action.spawn\n\t\tif (!world.registry.prefabs.has(prefab)) return warn(`spawns a prefab \"${prefab}\" the game has not`)\n\t\tconst place = placeOf(world, at)\n\t\tif (!place) return warn(`spawns at \"${String(at)}\", which the map has not`)\n\t\tworld.spawnPrefab(prefab, { at: place, owner, facing })\n\t} else if ('tell' in action) {\n\t\tconst { computer, word, data } = action.tell\n\t\tif (!world.computers.tell(computer, word, data)) warn(`tells player ${computer} \"${word}\", and the computer does not play them`)\n\t} else if ('relation' in action) {\n\t\tconst { a, b, how } = action.relation\n\t\tworld.sides.setRelation(a, b, how)\n\t} else if ('timer' in action) {\n\t\tconst { id, seconds, label, to = people } = action.timer\n\t\tconst state = world.state(missionRulesState)\n\t\tif (state.timers[id] !== undefined) world.timers.cancel(state.timers[id])\n\t\tconst shown = label === undefined ? [] : to\n\t\tconst timer = world.timers.after(seconds, ruleTimer, { word: id, ...(shown.length && { to: shown }) })\n\t\tstate.timers[id] = timer\n\t\tfor (const player of shown) world.timers.show(player, timer, { label: label! })\n\t} else if ('win' in action) {\n\t\tconst to = action.win === true ? people : (action.win.to ?? people)\n\t\tif (world.winner !== null || !to.length) return\n\t\tconst team = world.player(to[0]).team\n\t\tworld.winner = team\n\t\tworld.events.emit(gameOver, { winner: team })\n\t} else if ('lose' in action) {\n\t\tconst to = action.lose === true ? people : (action.lose.to ?? people)\n\t\tfor (const player of to) if (!world.player(player).defeated) defeat(world, player)\n\t}\n}\n\n/**\n * What a rule's condition is asked of: a watcher seated as a player, which reads the game as a computer player does\n * (`ai/computer.ts`'s `ruleWatcher`: a brain with no modules of its own, on an observer's session). The engine itself\n * carries none of the computer players' kit, so the pack that runs the rules is the kit's (`missionRules` of\n * `@v12-engine/engine/ai`), and hands this to `missionRulesPack`\n *\n * @internal\n */\nexport interface RulesWatcher {\n\t/** Reads the picture of the game anew */\n\tthink(): void\n\t/** Whether a condition holds for it now */\n\task(condition: AiConditionData): boolean\n\t/** A word told to the rules, for `{ told }` to see */\n\ttell(word: string, data: unknown, tick: number): void\n\t/** The word heard: taken, it is seen no more */\n\ttakeTold(word: string): void\n\t/** What it remembers, for a save, and back */\n\tsave(): unknown\n\trestore(memory: unknown): void\n}\n\n/**\n * The system that runs the rules: once a second, each watcher reads the picture, the words told since the last check\n * are heard, and each rule's condition is asked and its actions done as it turns true. The watchers' memory is the\n * system's to save\n */\nfunction rulesSystem(world: World, own: readonly MissionRule[], watch: (world: World, player: PlayerId) => RulesWatcher): System {\n\t// the map's rules and the code's, read as the first check comes: the system is made before the world has its map\n\tlet read: MissionRule[] | undefined\n\tconst rulesOf = (): MissionRule[] => {\n\t\tif (read) return read\n\t\tread = []\n\t\tconst ids = new Set<string>()\n\t\tfor (const rule of [...missionRulesOf(world.map), ...own]) {\n\t\t\tif (ids.has(rule.id)) {\n\t\t\t\tworld.log.warn('rules', `two rules are called \"${rule.id}\": the second is left out`)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tids.add(rule.id)\n\t\t\tread.push(rule)\n\t\t}\n\t\treturn read\n\t}\n\tconst watchers = new Map<PlayerId, RulesWatcher>()\n\tlet restored: Record<string, unknown> | undefined\n\tconst defaultPlayer = (): PlayerId | undefined => rulePlayers(world)[0]\n\tconst watcher = (player: PlayerId): RulesWatcher | undefined => {\n\t\tlet made = watchers.get(player)\n\t\tif (made) return made\n\t\tif (!world.players.has(player)) return undefined\n\t\tmade = watch(world, player)\n\t\tconst memory = restored?.[player]\n\t\tif (memory !== undefined) made.restore(memory)\n\t\twatchers.set(player, made)\n\t\treturn made\n\t}\n\treturn {\n\t\tname: 'missionRules',\n\t\tphase: 'cleanup',\n\t\tevery: Math.max(1, Math.round(world.tickRate)),\n\t\toffset: 3,\n\t\tupdate() {\n\t\t\tconst rules = rulesOf()\n\t\t\tif (!rules.length) return\n\t\t\tconst state = world.state(missionRulesState)\n\t\t\t// the words told since the last check: heard by every watcher this once\n\t\t\tconst told = state.told.splice(0)\n\t\t\tconst asked = new Set<PlayerId>()\n\t\t\tfor (const rule of rules) {\n\t\t\t\tconst player = rule.as ?? defaultPlayer()\n\t\t\t\tif (player !== undefined) asked.add(player)\n\t\t\t}\n\t\t\tfor (const player of asked) {\n\t\t\t\tconst made = watcher(player)\n\t\t\t\tif (!made) continue\n\t\t\t\tmade.think()\n\t\t\t\tfor (const word of told) made.tell(word.word, word.data, word.tick)\n\t\t\t}\n\t\t\tfor (const rule of rules) {\n\t\t\t\tconst kept = (state.rules[rule.id] ??= { count: 0 })\n\t\t\t\tif (rule.once && kept.count > 0) continue\n\t\t\t\tconst player = rule.as ?? defaultPlayer()\n\t\t\t\tconst made = player === undefined ? undefined : watcher(player)\n\t\t\t\tif (!made) {\n\t\t\t\t\tif (kept.was === undefined)\n\t\t\t\t\t\tworld.log.warn('rules', `the rule \"${rule.id}\" is asked as a player ${player} the world has not: it never fires`)\n\t\t\t\t\tkept.was = false\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tconst holds = made.ask(rule.when)\n\t\t\t\tconst turned = holds && !kept.was\n\t\t\t\tkept.was = holds\n\t\t\t\tif (!holds) continue\n\t\t\t\tconst again = rule.every !== undefined && kept.fired !== undefined && world.tick - kept.fired >= Math.round(rule.every * world.tickRate)\n\t\t\t\tif (!turned && !again) continue\n\t\t\t\tkept.fired = world.tick\n\t\t\t\tkept.count++\n\t\t\t\tworld.log.info('rules', `the rule \"${rule.id}\" fires`)\n\t\t\t\tworld.events.emit(ruleFired, { rule: rule.id })\n\t\t\t\tfor (const action of rule.do) doMissionAction(world, rule, action)\n\t\t\t}\n\t\t\tfor (const made of watchers.values()) for (const word of new Set(told.map((each) => each.word))) made.takeTold(word)\n\t\t},\n\t\tsave: () => ({ watchers: Object.fromEntries([...watchers].map(([player, made]) => [player, made.save()])) }),\n\t\trestore: (_world, data) => {\n\t\t\trestored = (data as { watchers?: Record<string, unknown> } | undefined)?.watchers\n\t\t\tfor (const [player, made] of watchers) if (restored?.[player] !== undefined) made.restore(restored[player])\n\t\t}\n\t}\n}\n\n/**\n * The mission rules pack, given what asks a rule's condition (`RulesWatcher`): what `missionRules` of `@v12-engine/engine/ai`\n * makes, with a watcher of the computer players' kit. The map's rules and `rules` of the code's, run as the game plays\n *\n * @internal\n */\nexport function missionRulesPack(options: { rules?: MissionRule[]; watch: (world: World, player: PlayerId) => RulesWatcher }): GamePack {\n\tconst own = options.rules ?? []\n\treturn {\n\t\tid: MISSION_RULES,\n\t\tcomponents: [missionRulesState],\n\t\tevents: [ruleFired],\n\t\ttimers: [ruleTimer],\n\t\tsystems: [(world) => rulesSystem(world, own, options.watch)],\n\t\tcheck: (map, registry) => checkMissionRules(map, registry),\n\t\t...(own.length && { options: { rules: own.map((rule) => rule.id) } })\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;AA2CA,IAAa,gBAAgB;;;;;;AAO7B,IAAa,gBAAgB;;;;;;AA0F7B,IAAa,oBAAoB,gBAA4B;CAAE,IAAI;CAAqB,gBAAgB;EAAE,OAAO,CAAC;EAAG,MAAM,CAAC;EAAG,QAAQ,CAAC;CAAE;AAAG,CAAC;;;;;;AAO9I,IAAa,YAAY,kBAAoC,EAAE,IAAI,iBAAiB,CAAC;AAiBrF,IAAM,UAAU;CAAC;CAAa;CAAO;CAAa;CAAS;CAAQ;CAAY;CAAS;CAAO;AAAM;;AAGrG,IAAM,cAAc,WAA0D;CAC7E,IAAI,OAAO,WAAW,YAAY,WAAW,MAAM,OAAO,KAAA;CAC1D,MAAM,OAAO,OAAO,KAAK,MAAM;CAC/B,OAAO,KAAK,WAAW,KAAM,QAA8B,SAAS,KAAK,EAAE,IAAK,KAAK,KAAkC,KAAA;AACxH;;AAGA,IAAM,eAAe,SAA2C,OAAO,SAAS,YAAY,SAAS,QAAQ,OAAO,KAAK,IAAI,CAAC,CAAC,SAAS;;;;;;;;AASxI,SAAgB,eAAe,KAA0E;CACxG,MAAM,OAAO,IAAI,KAAK;CACtB,IAAI,CAAC,MAAM,QAAQ,IAAI,GAAG,OAAO,CAAC;CAClC,OAAO,KACL,QACC,SACA,OAAO,SAAS,YAAY,SAAS,QAAQ,OAAO,KAAK,OAAO,YAAY,KAAK,OAAO,MAAM,YAAY,KAAK,IAAI,CACrH,CAAC,CACA,KAAK,UAAU;EACf,IAAI,KAAK;EACT,MAAM,KAAK;EACX,IAAI,MAAM,QAAQ,KAAK,EAAE,IAAI,KAAK,GAAG,QAAQ,WAAW,WAAW,MAAM,MAAM,KAAA,CAAS,IAAI,CAAC;EAC7F,GAAI,KAAK,SAAS,KAA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,KAAK,IAAI,gBAAgB,OAAO,MAAM,MAAM;GAClE;GACA,KAAK,MAAM,QAAQ,SAAS,OAAO,GAAG,KAAK,MAAM,QAAQ,IAAI,IAAI,KAAK,KAAK,SAAS,KAAK,IAAI,CAAC,GAAG,KAAK,SAAS,IAAI;EACpH;EACA,aAAa,EAAE,UAAU,OAAO,YAAY,CAAC,GAAG,QAAQ,CAAC,CAAC,KAAK,CAAC,QAAQ,UAAU,CAAC,QAAQ,KAAK,KAAK,CAAC,CAAC,CAAC,EAAE;EAC1G,UAAU,QAAQ,SAAS;GAC1B,WAAY,MAA6D;GACzE,KAAK,MAAM,CAAC,QAAQ,SAAS,UAAU,IAAI,WAAW,YAAY,KAAA,GAAW,KAAK,QAAQ,SAAS,OAAO;EAC3G;CACD;AACD;;;;;;;AAQA,SAAgB,iBAAiB,SAAuG;CACvI,MAAM,MAAM,QAAQ,SAAS,CAAC;CAC9B,OAAO;EACN,IAAI;EACJ,YAAY,CAAC,iBAAiB;EAC9B,QAAQ,CAAC,SAAS;EAClB,QAAQ,CAAC,SAAS;EAClB,SAAS,EAAE,UAAU,YAAY,OAAO,KAAK,QAAQ,KAAK,CAAC;EAC3D,QAAQ,KAAK,aAAa,kBAAkB,KAAK,QAAQ;EACzD,GAAI,IAAI,UAAU,EAAE,SAAS,EAAE,OAAO,IAAI,KAAK,SAAS,KAAK,EAAE,EAAE,EAAE;CACpE;AACD"}
|
package/dist/mods.d.ts
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import type { RaceDef } from './races';
|
|
2
2
|
import type { Component } from './components';
|
|
3
3
|
import type { EventKey } from './events';
|
|
4
|
-
import type {
|
|
4
|
+
import type { EffectType } from './abilities/effects';
|
|
5
5
|
import type { CommandDef } from './commands';
|
|
6
|
-
import type { AbilityDef, BuffDef, ItemDef, ResourceDef, StatDef, UnitTypeDef, UpgradeDef } from './defs';
|
|
7
|
-
import type {
|
|
6
|
+
import type { AbilityDef, BuffDef, ItemDef, ResourceDef, StatDef, TagDef, UnitTypeDef, UpgradeDef } from './defs';
|
|
7
|
+
import type { Rules } from './game';
|
|
8
8
|
import type { AreaDef } from './areas';
|
|
9
|
+
import type { CellLayerDef } from './cellLayers';
|
|
9
10
|
import type { ListenerDef } from './events';
|
|
10
11
|
import type { SequenceDef } from './sequences';
|
|
11
12
|
import type { TimerDef } from './timers';
|
|
12
13
|
import type { HookDef } from './hooks';
|
|
13
14
|
import type { OrderBehavior, SystemDef } from './registry';
|
|
14
|
-
import { type
|
|
15
|
+
import { type RuleSettingsInit } from './rules';
|
|
15
16
|
import type { GamePack } from './packs/pack';
|
|
16
17
|
/**
|
|
17
18
|
* A mod: changes to a game, made on top of it instead of on a copy of it. A new hero, other numbers, a rule of its
|
|
@@ -21,13 +22,15 @@ import type { GamePack } from './packs/pack';
|
|
|
21
22
|
* @beta
|
|
22
23
|
*/
|
|
23
24
|
export interface ModDef {
|
|
25
|
+
/** The mod's id, shared by every mod: others list it in `requires` */
|
|
24
26
|
id: string;
|
|
25
27
|
/** `major.minor.patch`. Mods that need this one say which versions they work with */
|
|
26
28
|
version: string;
|
|
29
|
+
/** The mod's name as a list shows it; its id when left out */
|
|
27
30
|
name?: string;
|
|
28
31
|
/**
|
|
29
32
|
* The game and the mods it is made for, each `id`, `id@1.2.3` (that version only) or `id@^1.2` (that major version,
|
|
30
|
-
* from 1.2 on). The game counts as one of them, by its id and `
|
|
33
|
+
* from 1.2 on). The game counts as one of them, by its id and `Rules.version`
|
|
31
34
|
*/
|
|
32
35
|
requires?: string[];
|
|
33
36
|
/** Makes the changes, through the builder */
|
|
@@ -38,14 +41,15 @@ export interface ModDef {
|
|
|
38
41
|
*
|
|
39
42
|
* @beta
|
|
40
43
|
*/
|
|
41
|
-
export declare const defineMod: (def: ModDef) => ModDef;
|
|
42
44
|
/**
|
|
43
45
|
* Definitions of one kind, by id: what a mod adds, changes or takes out
|
|
44
46
|
*
|
|
45
47
|
* @beta
|
|
46
48
|
*/
|
|
47
49
|
export interface Collection<T> {
|
|
50
|
+
/** Finds the definition with this id; undefined when there is none */
|
|
48
51
|
get(id: string): T | undefined;
|
|
52
|
+
/** Whether a definition with this id is there */
|
|
49
53
|
has(id: string): boolean;
|
|
50
54
|
/** Throws when there is one of that id already: that is `override` */
|
|
51
55
|
add(def: T): void;
|
|
@@ -53,6 +57,7 @@ export interface Collection<T> {
|
|
|
53
57
|
override(id: string, change: Partial<T> | ((def: T) => T)): void;
|
|
54
58
|
/** Throws when there is none of that id */
|
|
55
59
|
remove(id: string): void;
|
|
60
|
+
/** Every definition in the collection, in order */
|
|
56
61
|
all(): readonly T[];
|
|
57
62
|
}
|
|
58
63
|
/**
|
|
@@ -62,19 +67,30 @@ export interface Collection<T> {
|
|
|
62
67
|
*/
|
|
63
68
|
export interface GameBuilder {
|
|
64
69
|
/** What the game is so far: to read, not to change. Changes go through the rest of the builder */
|
|
65
|
-
readonly current: Readonly<
|
|
70
|
+
readonly current: Readonly<Rules>;
|
|
71
|
+
/** The unit types of the game so far */
|
|
66
72
|
units: Collection<UnitTypeDef>;
|
|
73
|
+
/** The abilities of the game so far */
|
|
67
74
|
abilities: Collection<AbilityDef>;
|
|
75
|
+
/** The buffs of the game so far */
|
|
68
76
|
buffs: Collection<BuffDef>;
|
|
77
|
+
/** The items of the game so far */
|
|
69
78
|
items: Collection<ItemDef>;
|
|
79
|
+
/** The tags of items the game names (`Rules.tags`, `TagDef`): what a shop shows of a tag and filters by @beta */
|
|
80
|
+
tags: Collection<TagDef>;
|
|
81
|
+
/** The upgrades of the game so far */
|
|
70
82
|
upgrades: Collection<UpgradeDef>;
|
|
71
|
-
/** The sides players can play (`
|
|
83
|
+
/** The sides players can play (`Rules.races`) */
|
|
72
84
|
races: Collection<RaceDef>;
|
|
85
|
+
/** The stats a unit has, by id (`StatDef`) */
|
|
73
86
|
stats: Collection<StatDef>;
|
|
87
|
+
/** The resources players gather and spend (`Rules.resources`) */
|
|
74
88
|
resources: Collection<ResourceDef>;
|
|
75
89
|
/** Kinds of ability effects, by their type (`defineEffect`) */
|
|
76
|
-
effects: Collection<
|
|
90
|
+
effects: Collection<EffectType>;
|
|
91
|
+
/** How unit orders are carried out, by type */
|
|
77
92
|
orders: Collection<OrderBehavior>;
|
|
93
|
+
/** The commands a player can give, by type (`CommandDef`) */
|
|
78
94
|
commands: Collection<CommandDef>;
|
|
79
95
|
/** The game's hook handlers, by id. `withoutHook` takes out one of the engine's */
|
|
80
96
|
hooks: Collection<HookDef>;
|
|
@@ -86,28 +102,31 @@ export interface GameBuilder {
|
|
|
86
102
|
events: Collection<EventKey<any>>;
|
|
87
103
|
/** The parts of the map the rules watch, by id */
|
|
88
104
|
areas: Collection<AreaDef>;
|
|
105
|
+
/** The layers of cells painted on its maps, by id (`Rules.cellLayers`): a mod's own grass, with `foliagePack` among its packs @beta */
|
|
106
|
+
cellLayers: Collection<CellLayerDef>;
|
|
89
107
|
/** What the game can set to go off later, by id */
|
|
90
108
|
timers: Collection<TimerDef>;
|
|
91
109
|
/** The game's scripts of steps, by id */
|
|
92
110
|
sequences: Collection<SequenceDef>;
|
|
111
|
+
/** Takes out one of the engine's hook handlers by id, which `hooks` cannot reach */
|
|
93
112
|
withoutHook(id: string): void;
|
|
94
|
-
/** The parts of the rules the game opts into (`
|
|
113
|
+
/** The parts of the rules the game opts into (`Rules.packs`), by id: `packs.add(heroesPack())` @beta */
|
|
95
114
|
packs: Collection<GamePack>;
|
|
96
|
-
/** Takes out a command of the engine's or a pack's, by its type (`
|
|
115
|
+
/** Takes out a command of the engine's or a pack's, by its type (`Rules.withoutCommands`) @beta */
|
|
97
116
|
withoutCommand(type: string): void;
|
|
98
|
-
/** Takes out an order of the engine's or a pack's, by its type (`
|
|
117
|
+
/** Takes out an order of the engine's or a pack's, by its type (`Rules.withoutOrders`) @beta */
|
|
99
118
|
withoutOrder(type: string): void;
|
|
100
119
|
/** Adds a system of the mod's own, or one in place of the engine's of the same name */
|
|
101
120
|
addSystem(system: SystemDef): void;
|
|
102
121
|
/** Takes out a system: one of the engine's, or one the game gave as an object, by name */
|
|
103
122
|
withoutSystem(name: string): void;
|
|
104
|
-
/** Changes rules of the game (`
|
|
105
|
-
|
|
123
|
+
/** Changes rules of the game (`RuleSettings`): any of them, a group in part (`{ supply: { max: 200 } }`) */
|
|
124
|
+
settings(changes: RuleSettingsInit): void;
|
|
106
125
|
/** Changes one of the game's settings that are one thing, not a list */
|
|
107
|
-
set<K extends Setting>(key: K, value:
|
|
126
|
+
set<K extends Setting>(key: K, value: Rules[K]): void;
|
|
108
127
|
}
|
|
109
128
|
/** The parts of a game a mod can only put something else in the place of */
|
|
110
|
-
type Setting = 'name' | 'currency' | 'upkeep' | 'day' | 'victory' | '
|
|
129
|
+
type Setting = 'name' | 'currency' | 'upkeep' | 'day' | 'victory' | 'startingBase' | 'report' | 'ai';
|
|
111
130
|
/**
|
|
112
131
|
* Throws when a requirement is not met, or two mods change the same thing without one requiring the other
|
|
113
132
|
*
|
|
@@ -116,13 +135,13 @@ type Setting = 'name' | 'currency' | 'upkeep' | 'day' | 'victory' | 'start' | 'r
|
|
|
116
135
|
export declare class ModError extends Error {
|
|
117
136
|
}
|
|
118
137
|
/**
|
|
119
|
-
* A game with mods on it: a new `
|
|
138
|
+
* A game with mods on it: a new `Rules`, which `createWorld` takes like any other. Its id names the game and
|
|
120
139
|
* the mods (`melee+goldRush`), and `mods` lists them with their versions. Mods are applied after the ones they
|
|
121
140
|
* require, otherwise in the order given. Neither the game nor the mods are changed
|
|
122
141
|
*
|
|
123
142
|
* @beta
|
|
124
143
|
*/
|
|
125
|
-
export declare function composeGame(base:
|
|
144
|
+
export declare function composeGame(base: Rules, mods: ModDef[]): Rules;
|
|
126
145
|
/**
|
|
127
146
|
* A game made by `composeGame` made again, of its base and its mods as they are now (a base made of mods made again
|
|
128
147
|
* too): what a game played with mods takes as one of them, or its base, is saved while it runs (hot reload). A game not
|
|
@@ -130,13 +149,13 @@ export declare function composeGame(base: GameModule, mods: ModDef[]): GameModul
|
|
|
130
149
|
*
|
|
131
150
|
* @beta
|
|
132
151
|
*/
|
|
133
|
-
export declare function recompose(game:
|
|
152
|
+
export declare function recompose(game: Rules): Rules;
|
|
134
153
|
/**
|
|
135
154
|
* Whether a game is made of this game or mod: is it, or has it as its base or one of its mods, at any depth
|
|
136
155
|
*
|
|
137
156
|
* @beta
|
|
138
157
|
*/
|
|
139
|
-
export declare function isMadeOf(game:
|
|
158
|
+
export declare function isMadeOf(game: Rules, part: Rules | ModDef): boolean;
|
|
140
159
|
/**
|
|
141
160
|
* Whether a version is in a range: `1.2.3` exactly, or `^1.2` for 1.2 and later of major version 1
|
|
142
161
|
*
|