@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":"debugCommands.js","names":[],"sources":["../src/debugCommands.ts"],"sourcesContent":["import { type CommandDef, defineCommand, type DefinedCommand } from './commands'\nimport { footprintOf } from './defs'\nimport type { PlayerId } from './entity'\nimport { bool, type Check, type Checked, type Fields, id, ids, Invalid, isObject, number, object, oneOf, optional, point, string } from './fields'\nimport { grantXp, heroesOf, setHeroLevel } from './hero'\nimport { createItem, giveItem } from './items'\nimport { gameOver } from './engineEvents'\nimport { defeat } from './systems/victory'\nimport { earn } from './player'\nimport type { World } from './world'\nimport { teamMemory } from './session/memory'\nimport {\n\tblankDefinition,\n\tCOPY_OF,\n\tDATA_KINDS,\n\tdefinitionIn,\n\teditableFields,\n\tfitValue,\n\tnested,\n\tNEW_DEFINITION,\n\tpathCheck,\n\tvalueCheck\n} from './gameData'\nimport { hypot } from './exactMath'\nimport { replicateEvent, snapshotField } from './replication'\nimport { groundReshaped } from './engineEvents'\nimport { type TerrainPatch, terrainPatchProblem } from './ground'\nimport type { MapObject } from './map'\nimport { giveMapOrders, spawnMapObject } from './mapObjects'\nimport { corpses } from './summons'\n\n/*\n * The debug tools as commands: cheats, the fog lifted, the time of day, the speed, things created and cleared, and\n * resources, experience and deaths given out. Commands like any other, so that they work the same wherever the\n * simulation runs, a server included; and only from players the session lets use them (`world.debugPlayers`): a seat\n * in the page that asked for it, a server started to allow it. Everyone else is told no\n */\n\n/**\n * A debug command of a game's or a scene's own: one that goes through only for players allowed the debug tools\n * (`world.debugPlayers`), and tells others so. Otherwise like `defineCommand`\n *\n * @beta\n */\nexport function defineDebugCommand<const T extends string, F extends Fields>(\n\ttype: T,\n\tfields: F,\n\texecute: (world: World, player: PlayerId, command: Checked<F>) => void\n): DefinedCommand<T, F> {\n\treturn defineCommand(type, fields, (world, player, command) => {\n\t\tif (!world.debugPlayers.has(player)) {\n\t\t\tworld.message(player, { key: 'debugNotAllowed' })\n\t\t\treturn\n\t\t}\n\t\texecute(world, player, command)\n\t})\n}\n\n/**\n * A prefab of the game's put down where it says, for the sender, turned as said: to try one out, and for the editor's Play\n *\n * @beta\n */\nexport const spawnPrefabCommand = defineDebugCommand(\n\t'debug.spawnPrefab',\n\t{ prefab: string, at: point, facing: optional(number) },\n\t(world, player, command) => {\n\t\tif (!world.registry.prefabs.has(command.prefab)) return world.message(player, { key: 'unknownPrefab', params: { prefab: command.prefab } })\n\t\tworld.spawnPrefab(command.prefab, { at: command.at, owner: player, facing: command.facing })\n\t}\n)\n\n/**\n * A switch for trying things out: abilities used again at once, abilities that cost no mana, the units of those who may\n * use the debug tools unharmed (`World.cheats`)\n *\n * @beta\n */\nexport const cheatCommand = defineDebugCommand(\n\t'debug.cheat',\n\t{ cheat: oneOf('noCooldowns', 'noManaCosts', 'invulnerable'), on: bool },\n\t(world, _player, command) => {\n\t\tworld.cheats[command.cheat] = command.on\n\t}\n)\n\n/**\n * Lifts the fog for the sender's team, or puts it back: in the simulation itself, so that units react to what is shown\n *\n * @beta\n */\nexport const revealCommand = defineDebugCommand('debug.reveal', { on: bool }, (world, player, command) => {\n\tworld.fog.setRevealed(world.player(player).team, command.on)\n})\n\n/**\n * The whole map explored for everyone, as a map that starts explored has it (`FogSettings.startExplored`): the fog stays,\n * over what is not seen now, but the ground is dim, not black, and what stands on it and is no player's is known. Or no\n * longer: each team has explored what it sees now, and forgets what it does not\n *\n * @beta\n */\nexport const exploreCommand = defineDebugCommand('debug.explore', { on: bool }, (world, _player, command) => {\n\tworld.fog.exploreFromStart(command.on)\n\tfor (const [team, memory] of Object.entries(world.state(teamMemory))) {\n\t\t// what stands on it put among what each team knows again, at its next look (`TeamMemory.startKnown`)\n\t\tmemory.startKnown = false\n\t\tif (command.on) continue\n\t\tfor (const [id, state] of Object.entries(memory.structures))\n\t\t\tif (!world.fog.isVisible(Number(team), state.x, state.z)) delete memory.structures[Number(id)]\n\t}\n})\n\n/**\n * The time of day, in a game with days and nights\n *\n * @beta\n */\nexport const hourCommand = defineDebugCommand('debug.hour', { hour: number }, (world, _player, command) => {\n\tif (world.registry.day) world.clock.setHour(((command.hour % 24) + 24) % 24)\n})\n\n/**\n * How fast the game goes, 0 to pause, 8 at most: whoever runs it (a session in the page, a server) goes by it\n *\n * @beta\n */\nexport const speedCommand = defineDebugCommand('debug.speed', { speed: number }, (world, _player, command) => {\n\tworld.cheats.speed = Math.min(Math.max(command.speed, 0), 8)\n})\n\n/**\n * Creates something at a point, for a player: a building or a resource where there is room, or a group of units\n * (`count`, 50 at most). `hidden`: what can be invisible is out of sight from the start\n *\n * @beta\n */\nexport const spawnCommand = defineDebugCommand(\n\t'debug.spawn',\n\t{ unitType: string, owner: id, point, count: optional(number), hidden: optional(bool) },\n\t(world, player, command) => {\n\t\tif (!world.registry.units.has(command.unitType) || !world.players.has(command.owner)) return\n\t\tconst def = world.registry.unit(command.unitType)\n\t\tconst at = command.point\n\t\tif (def.kind !== 'unit') {\n\t\t\tconst fp = footprintOf(def)\n\t\t\tconst cell = world.grid.cellFor(at.x, at.z, fp.w, fp.d)\n\t\t\tif (!world.grid.canPlace(cell.x, cell.z, fp.w, fp.d)) world.message(player, { key: 'noRoomHere' })\n\t\t\telse world.spawn(def.id, command.owner, at)\n\t\t\treturn\n\t\t}\n\t\tconst count = Math.min(Math.max(Math.round(command.count ?? 1), 1), 50)\n\t\tconst columns = Math.ceil(Math.sqrt(count))\n\t\tconst spacing = def.radius * 2 + 0.4\n\t\tfor (let i = 0; i < count; i++) {\n\t\t\tconst column = (i % columns) - (columns - 1) / 2\n\t\t\tconst row = Math.floor(i / columns) - (Math.ceil(count / columns) - 1) / 2\n\t\t\tconst entity = world.spawn(def.id, command.owner, { x: at.x + column * spacing, z: at.z - row * spacing })\n\t\t\tif (command.hidden && entity.unseenIn !== null) entity.unseenIn = 0\n\t\t}\n\t}\n)\n\n/**\n * A brush: fills a circle with what stands on the grid (trees, rocks), thinner towards its edge, wherever there is room;\n * or, with `erase`, clears it of that type\n *\n * @beta\n */\nexport const paintCommand = defineDebugCommand(\n\t'debug.paint',\n\t{ unitType: string, owner: id, point, radius: number, erase: bool },\n\t(world, _player, command) => {\n\t\tif (!world.registry.units.has(command.unitType)) return\n\t\tconst def = world.registry.unit(command.unitType)\n\t\tconst { point: at } = command\n\t\tconst radius = Math.min(Math.max(command.radius, 0.5), 20)\n\t\tif (command.erase) {\n\t\t\tfor (const entity of [...world.entities.values()]) {\n\t\t\t\tif (entity.def.id === def.id && hypot(entity.pos.x - at.x, entity.pos.z - at.z) <= radius) world.kill(entity, undefined, false, 'removed')\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tif (def.kind === 'unit' || !world.players.has(command.owner)) return\n\t\tconst fp = footprintOf(def)\n\t\tfor (let z = Math.floor(at.z - radius); z <= at.z + radius; z += fp.d) {\n\t\t\tfor (let x = Math.floor(at.x - radius); x <= at.x + radius; x += fp.w) {\n\t\t\t\tconst centre = { x: x + fp.w / 2, z: z + fp.d / 2 }\n\t\t\t\tconst distance = hypot(centre.x - at.x, centre.z - at.z)\n\t\t\t\tif (distance > radius) continue\n\t\t\t\t// thinner towards the edge, the same way for the same cell so that a stroke does not fill up by going over it\n\t\t\t\tconst chance = ((x * 73856093) ^ (z * 19349663)) >>> 0\n\t\t\t\tif (distance > radius * 0.6 && chance % 100 < ((distance / radius - 0.6) / 0.4) * 70) continue\n\t\t\t\tif (!world.grid.canPlace(x, z, fp.w, fp.d)) continue\n\t\t\t\tworld.spawn(def.id, command.owner, centre)\n\t\t\t}\n\t\t}\n\t}\n)\n\n/**\n * Gives the sender this much of every resource\n *\n * @beta\n */\nexport const giveCommand = defineDebugCommand('debug.give', { amount: number }, (world, player, command) => {\n\tfor (const resource of world.registry.resources) earn(world.player(player).resources, resource.id, command.amount)\n})\n\n/**\n * Gives the sender's heroes this much experience\n *\n * @beta\n */\nexport const experienceCommand = defineDebugCommand('debug.experience', { amount: number }, (world, player, command) => {\n\tfor (const hero of heroesOf(world, player)) if (hero.alive) grantXp(world, hero, command.amount)\n})\n\n/**\n * Puts units at a point, side by side, wherever they stood: structures stay where they were built. The way there is\n * not their concern (`World.place`)\n *\n * @internal\n */\nexport const teleportCommand = defineDebugCommand('debug.teleport', { entities: ids, point }, (world, _player, command) => {\n\tconst units = command.entities.flatMap((entityId) => {\n\t\tconst entity = world.get(entityId)\n\t\treturn entity?.alive && entity.isUnit ? [entity] : []\n\t})\n\tconst columns = Math.ceil(Math.sqrt(units.length))\n\tunits.forEach((entity, i) => {\n\t\tconst spacing = entity.def.radius * 2 + 0.4\n\t\tconst column = (i % columns) - (columns - 1) / 2\n\t\tconst row = Math.floor(i / columns) - (Math.ceil(units.length / columns) - 1) / 2\n\t\tworld.place(entity, { x: command.point.x + column * spacing, z: command.point.z - row * spacing })\n\t})\n})\n\n/**\n * Gives what it names to another player (`World.setOwner`): what it was doing is called off\n *\n * @internal\n */\nexport const setOwnerCommand = defineDebugCommand('debug.setOwner', { entities: ids, owner: id }, (world, _player, command) => {\n\tif (!world.players.has(command.owner)) return\n\tfor (const entityId of command.entities) {\n\t\tconst entity = world.get(entityId)\n\t\tif (entity?.alive) world.setOwner(entity, command.owner)\n\t}\n})\n\n/**\n * Puts an item of the game's in the first free slot of what carries things\n *\n * @beta\n */\nexport const giveItemCommand = defineDebugCommand('debug.giveItem', { entity: id, item: string }, (world, _player, command) => {\n\tconst entity = world.get(command.entity)\n\tif (!entity?.alive || !world.registry.items.has(command.item)) return\n\tgiveItem(world, entity, createItem(world, command.item))\n})\n\n/**\n * Researches an upgrade for the sender, to the level asked (its last when left out), at once and for nothing: what it\n * does to the units there are runs for each level it gains\n *\n * @internal\n */\nexport const researchCommand = defineDebugCommand('debug.research', { upgrade: string, level: optional(number) }, (world, player, command) => {\n\tif (!world.registry.upgrades.has(command.upgrade)) return\n\tconst def = world.registry.upgrade(command.upgrade)\n\tconst who = world.player(player)\n\tconst to = Math.min(Math.max(Math.round(command.level ?? def.maxLevel ?? 1), 0), def.maxLevel ?? 1)\n\tfor (let level = (who.upgrades.get(command.upgrade) ?? 0) + 1; level <= to; level++) {\n\t\twho.setUpgrade(command.upgrade, level)\n\t\tif (def.apply) for (const entity of [...world.index.ownedBy(player)]) if (entity.alive) def.apply(world, entity, level)\n\t}\n\twho.researching.delete(command.upgrade)\n})\n\n/**\n * Raises heroes to a level (never down, and no further than they can go: `setHeroLevel`)\n *\n * @beta\n */\nexport const setLevelCommand = defineDebugCommand('debug.setLevel', { entities: ids, level: number }, (world, _player, command) => {\n\tfor (const entityId of command.entities) {\n\t\tconst entity = world.get(entityId)\n\t\tif (entity?.alive) setHeroLevel(world, entity, command.level)\n\t}\n})\n\n/**\n * Wins the game for the sender's team: the others are out, and it is over. A game with a way to win of its own is\n * ended all the same\n *\n * @beta\n */\nexport const winCommand = defineDebugCommand('debug.win', {}, (world, player) => {\n\tif (world.winner !== null) return\n\tconst team = world.player(player).team\n\tfor (const other of world.players.values()) {\n\t\tif (other.neutral || other.creeps) continue\n\t\tother.established = true\n\t\tif (other.team !== team && !other.defeated) defeat(world, other.id)\n\t}\n\tworld.winner = team\n\tworld.events.emit(gameOver, { winner: team })\n})\n\n/**\n * Puts the sender out of the game, as if beaten: the others play on, or win by the game's own rule\n *\n * @beta\n */\nexport const loseCommand = defineDebugCommand('debug.lose', {}, (world, player) => {\n\tconst who = world.player(player)\n\tif (who.neutral || who.creeps || who.defeated || world.winner !== null) return\n\twho.established = true\n\tdefeat(world, player)\n})\n\n/**\n * Kills what it names, whoever's it is: what cannot be hurt included, but not scenery the map is made of\n *\n * @beta\n */\nexport const killCommand = defineDebugCommand('debug.kill', { entities: ids }, (world, _player, command) => {\n\tfor (const entityId of command.entities) {\n\t\tconst entity = world.get(entityId)\n\t\tif (entity?.alive && !entity.def.invulnerable) world.kill(entity, undefined, false, 'removed')\n\t}\n})\n\n/**\n * Changes a field of a definition while the game runs, as the editor's Data panel tries it: only one the game lets be\n * changed (`Rules.editable`), and for players allowed the debug tools\n *\n * @beta\n */\nexport const redefineCommand = defineDebugCommand(\n\t'debug.redefine',\n\t{ kind: oneOf(...DATA_KINDS), id: string, path: pathCheck, value: valueCheck },\n\t(world, player, command) => {\n\t\tconst def = definitionIn(world.registry, command.kind, command.id)\n\t\t// a copy made, of one the game lets be changed\n\t\tif (!def && command.path === COPY_OF && typeof command.value === 'string') {\n\t\t\tconst base = definitionIn(world.registry, command.kind, command.value)\n\t\t\tif (base && editableFields(world.registry.module, command.kind, base).length)\n\t\t\t\tworld.redefine(command.kind, command.id, { [COPY_OF]: command.value })\n\t\t\treturn\n\t\t}\n\t\t// one of its own made of nothing, of a kind the game lets be changed\n\t\tif (!def && command.path === NEW_DEFINITION && command.value === true) {\n\t\t\tif (editableFields(world.registry.module, command.kind, blankDefinition(command.kind, command.id)).length)\n\t\t\t\tworld.redefine(command.kind, command.id, { [NEW_DEFINITION]: true })\n\t\t\treturn\n\t\t}\n\t\tif (!def) return\n\t\tconst field = editableFields(world.registry.module, command.kind, def).find((each) => each.path === command.path)\n\t\tconst fit = field ? fitValue(field, command.value) : { error: `${command.path} cannot be changed` }\n\t\tif ('error' in fit) world.message(player, { key: 'dataRefused', params: { why: fit.error } })\n\t\telse world.redefine(command.kind, command.id, nested(command.path, fit.value))\n\t}\n)\n\n/** The most of anything a value of a map's own may hold, and as deep: a field of the game's, not a file */\nconst PLAIN_MOST = 10_000\nconst PLAIN_DEPTH = 16\n\n/** What the map's own fields hold (`MapObject.data`): numbers, words, switches, lists and objects of them, and nothing else */\nconst plain: Check<unknown> = (value, path) => {\n\tlet count = 0\n\tconst copy = (each: unknown, at: string, depth: number): unknown => {\n\t\tif (++count > PLAIN_MOST || depth > PLAIN_DEPTH) throw new Invalid(`${path} is more than a field of the map holds`)\n\t\tif (each === null || typeof each === 'boolean' || typeof each === 'string') return each\n\t\tif (typeof each === 'number') return number(each, at)\n\t\tif (Array.isArray(each)) return each.map((item, i) => copy(item, `${at}[${i}]`, depth + 1))\n\t\tif (isObject(each)) return Object.fromEntries(Object.entries(each).map(([key, item]) => [key, copy(item, `${at}.${key}`, depth + 1)]))\n\t\tthrow new Invalid(`${at} is not a value of the map's`)\n\t}\n\treturn copy(value, path, 0)\n}\n\n/** A list of what a check takes, so long at most */\nconst listOf =\n\t<T>(check: Check<T>, most: number): Check<T[]> =>\n\t(value, path) => {\n\t\tif (!Array.isArray(value) || value.length > most) throw new Invalid(`${path} is a list of at most ${most}`)\n\t\treturn value.map((item, i) => check(item, `${path}[${i}]`))\n\t}\n\n/** What a cell of the ground holds: 0 to 255 */\nconst byte: Check<number> = (value, path) => {\n\tif (!Number.isInteger(value) || (value as number) < 0 || (value as number) > 255) throw new Invalid(`${path} is a whole number of 0 to 255`)\n\treturn value as number\n}\n\n/** The most cells a patch of the ground has: a map of 2048 a side */\nconst MOST_CELLS = 2049 * 2049\n\n/** A patch of the ground (`TerrainPatch`), each layer the size the ground says, checked as it is put in */\nconst terrainPatchCheck: Check<TerrainPatch> = (value, path) => {\n\tconst checked = object({\n\t\tx: id,\n\t\tz: id,\n\t\twidth: id,\n\t\tdepth: id,\n\t\theights: listOf(number, MOST_CELLS),\n\t\twaterHeights: listOf(number, MOST_CELLS),\n\t\tlevels: listOf(byte, MOST_CELLS),\n\t\twater: listOf(byte, MOST_CELLS),\n\t\ttiles: listOf(byte, MOST_CELLS),\n\t\tblocked: listOf(byte, MOST_CELLS),\n\t\tcells: optional((layers, at): Record<string, number[]> => {\n\t\t\tif (!isObject(layers)) throw new Invalid(`${at} is the layers of cells by id`)\n\t\t\treturn Object.fromEntries(\n\t\t\t\tObject.entries(layers).map(([layer, cells]) => [string(layer, at), listOf(byte, MOST_CELLS)(cells, `${at}.${layer}`)])\n\t\t\t)\n\t\t})\n\t})(value, path)\n\treturn checked as TerrainPatch\n}\n\n/** An object of the map (`MapObject`), as the editor has it: what of it the world reads, checked. Not turned, and as big as its type, when it does not say */\nconst mapObjectCheck: Check<MapObject> = (value, path) =>\n\t({\n\t\tfacing: 0,\n\t\tscale: 1,\n\t\t...object({\n\t\t\tid,\n\t\t\ttype: string,\n\t\t\towner: id,\n\t\t\tx: number,\n\t\t\tz: number,\n\t\t\tfacing: optional(number),\n\t\t\tscale: optional(number),\n\t\t\tlook: optional(string),\n\t\t\tdrops: optional(string),\n\t\t\tname: optional(string),\n\t\t\thealth: optional(number),\n\t\t\tmana: optional(number),\n\t\t\tlevel: optional(number),\n\t\t\tabilities: optional(plain),\n\t\t\titems: optional(listOf(string, 100)),\n\t\t\tamount: optional(number),\n\t\t\tunderConstruction: optional(bool),\n\t\t\tlifetime: optional(number),\n\t\t\torders: optional(plain),\n\t\t\tdata: optional(plain)\n\t\t})(value, path)\n\t}) as MapObject\n\n/**\n * An object placed on the map put in the world as the map's are as the world is made (`spawnMapObject`): its type,\n * owner, where it stands and how it is turned, and the rest the map says of it (its health, level, items, the game's\n * fields, its orders), kept as the entity of that object (`World.fromMap`): what the editor's Play here sends as\n * something is placed on the map while it plays (EQ10). A building where there is no room is refused, as `debug.spawn`\n * refuses it\n *\n * @beta\n */\nexport const mapObjectCommand = defineDebugCommand('debug.mapObject', { object: mapObjectCheck }, (world, player, command) => {\n\tconst { object } = command\n\tif (!world.registry.units.has(object.type) || !world.players.has(object.owner)) return\n\tconst def = world.registry.unit(object.type)\n\tif (def.kind !== 'unit') {\n\t\tconst fp = footprintOf(def)\n\t\tconst cell = world.grid.cellFor(object.x, object.z, fp.w, fp.d)\n\t\tif (!world.grid.canPlace(cell.x, cell.z, fp.w, fp.d)) return world.message(player, { key: 'noRoomHere' })\n\t}\n\tconst entity = spawnMapObject(world, object)\n\tif (Array.isArray(object.orders) && object.orders.length) giveMapOrders(world, entity, object.orders)\n})\n\n/**\n * Moves what an object of the map became (`World.fromMap`, by the object's id) where it stands on the map now,\n * turned as it is: a unit is put there (`World.place`), the way there not its concern. A structure is not moved: the\n * editor takes it away and puts it down again\n *\n * @beta\n */\nexport const placeCommand = defineDebugCommand('debug.place', { object: id, point, facing: optional(number) }, (world, _player, command) => {\n\tconst entity = world.get(world.fromMap.get(command.object))\n\tif (!entity?.alive || entity.isStructure) return\n\tworld.place(entity, command.point)\n\tif (command.facing !== undefined) entity.facing = command.facing\n})\n\n/**\n * Takes what objects of the map became (`World.fromMap`, by the objects' ids) out of the world, whatever they\n * are, scenery included: no corpse is left. What the editor's Play here sends as something is taken off the map\n *\n * @beta\n */\nexport const unplaceCommand = defineDebugCommand('debug.unplace', { objects: ids }, (world, _player, command) => {\n\tconst gone = new Set<number>()\n\tfor (const object of command.objects) {\n\t\tconst entity = world.get(world.fromMap.get(object))\n\t\tworld.fromMap.delete(object)\n\t\tif (!entity?.alive) continue\n\t\tworld.kill(entity, undefined, false, 'removed')\n\t\tgone.add(entity.id)\n\t}\n\tconst lying = world.state(corpses)\n\tif (lying.some((corpse) => gone.has(corpse.id)))\n\t\tworld.setState(\n\t\t\tcorpses,\n\t\t\tlying.filter((corpse) => !gone.has(corpse.id))\n\t\t)\n})\n\n/**\n * Reshapes a part of the ground as the patch has it (`World.reshapeGround`): what the editor's Play here sends of the\n * map's ground as its heights, cliffs, water and paint are edited while it plays. A patch that does not fit the ground\n * is refused\n *\n * @beta\n */\nexport const groundCommand = defineDebugCommand('debug.ground', { patch: terrainPatchCheck }, (world, player, command) => {\n\tconst problem = terrainPatchProblem(world.terrain, command.patch)\n\tif (problem) return world.message(player, { key: 'dataRefused', params: { why: problem } })\n\tworld.reshapeGround(command.patch)\n})\n\n/** The ground reshaped (`World.reshapeGround`): to everyone, as it is now */\nexport const toldGround = replicateEvent(groundReshaped, 'ground', ({ patch }) => ({ type: 'ground', patch: structuredClone(patch) }))\n\n/**\n * The debug commands of the engine, which every game has; they go through only for who may use them\n *\n * @beta\n */\nexport const debugCommands: CommandDef[] = [\n\tcheatCommand,\n\trevealCommand,\n\texploreCommand,\n\thourCommand,\n\tspeedCommand,\n\tspawnCommand,\n\tpaintCommand,\n\tgiveCommand,\n\texperienceCommand,\n\tkillCommand,\n\tspawnPrefabCommand,\n\tteleportCommand,\n\tsetOwnerCommand,\n\tgiveItemCommand,\n\tresearchCommand,\n\tsetLevelCommand,\n\twinCommand,\n\tloseCommand,\n\tmapObjectCommand,\n\tplaceCommand,\n\tunplaceCommand,\n\tgroundCommand\n] as unknown as CommandDef[]\n\n/** What a player who may use the debug commands is told of them (`Snapshot.debug`): the switches on, and whether the map started explored */\nexport const debugPart = snapshotField(\n\t'debug',\n\t({ world, player }) => (world.debugPlayers.has(player) ? { ...world.cheats, explored: world.fog.exploredFromStart } : undefined),\n\ttrue\n)\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA4CA,SAAgB,mBACf,MACA,QACA,SACuB;CACvB,OAAO,cAAc,MAAM,SAAS,OAAO,QAAQ,YAAY;EAC9D,IAAI,CAAC,MAAM,aAAa,IAAI,MAAM,GAAG;GACpC,MAAM,QAAQ,QAAQ,EAAE,KAAK,kBAAkB,CAAC;GAChD;EACD;EACA,QAAQ,OAAO,QAAQ,OAAO;CAC/B,CAAC;AACF;;;;;;AAOA,IAAa,qBAAqB,mBACjC,qBACA;CAAE,QAAQ;CAAQ,IAAI;CAAO,QAAQ,SAAS,MAAM;AAAE,IACrD,OAAO,QAAQ,YAAY;CAC3B,IAAI,CAAC,MAAM,SAAS,QAAQ,IAAI,QAAQ,MAAM,GAAG,OAAO,MAAM,QAAQ,QAAQ;EAAE,KAAK;EAAiB,QAAQ,EAAE,QAAQ,QAAQ,OAAO;CAAE,CAAC;CAC1I,MAAM,YAAY,QAAQ,QAAQ;EAAE,IAAI,QAAQ;EAAI,OAAO;EAAQ,QAAQ,QAAQ;CAAO,CAAC;AAC5F,CACD;;;;;;;AAQA,IAAa,eAAe,mBAC3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AK,IAAI,OAAO,EAAE,CAAC,CAC9C;AACF,CAAC;;;;;;;;AASD,IAAa,gBAAgB,mBAAmB,gBAAgB,EAAE,OAAO,kBAAkB,IAAI,OAAO,QAAQ,YAAY;CACzH,MAAM,UAAU,oBAAoB,MAAM,SAAS,QAAQ,KAAK;CAChE,IAAI,SAAS,OAAO,MAAM,QAAQ,QAAQ;EAAE,KAAK;EAAe,QAAQ,EAAE,KAAK,QAAQ;CAAE,CAAC;CAC1F,MAAM,cAAc,QAAQ,KAAK;AAClC,CAAC;;AAGD,IAAa,aAAa,eAAe,gBAAgB,WAAW,EAAE,aAAa;CAAE,MAAM;CAAU,OAAO,gBAAgB,KAAK;AAAE,EAAE;;;;;;AAOrI,IAAa,gBAA8B;CAC1C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD;;AAGA,IAAa,YAAY,cACxB,UACC,EAAE,OAAO,aAAc,MAAM,aAAa,IAAI,MAAM,IAAI;CAAE,GAAG,MAAM;CAAQ,UAAU,MAAM,IAAI;AAAkB,IAAI,KAAA,GACtH,IACD"}
|
package/dist/debugging.d.ts
CHANGED
|
@@ -6,5 +6,6 @@
|
|
|
6
6
|
* debug tools imports none of this
|
|
7
7
|
*/
|
|
8
8
|
export { cheatCommand, debugCommands, defineDebugCommand, experienceCommand, exploreCommand, giveCommand, giveItemCommand, groundCommand, hourCommand, killCommand, loseCommand, mapObjectCommand, paintCommand, placeCommand, redefineCommand, revealCommand, setLevelCommand, spawnCommand, spawnPrefabCommand, speedCommand, unplaceCommand, winCommand } from './debugCommands';
|
|
9
|
+
export { cellStylesCommand, type FoliageBrushAct, foliageCommand, foliageDebugCommands, windCommand } from './foliageDebug';
|
|
9
10
|
export { type DebugChecks, setDebugChecks } from './debug';
|
|
10
11
|
export { EventLog, inspect } from './inspect';
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The engine's default sets (items-and-spells plan, phase 5): definitions a game takes whole, takes but some of, takes
|
|
3
|
+
* and changes, or leaves (`useDefaults`). The default items (`defaultItemSet`) are one; a set of hero spells or of
|
|
4
|
+
* callings plugs in the same way, by the field of the rules its definitions go in (`DefaultSet.kind`) or by a way of
|
|
5
|
+
* its own of laying them (`DefaultSet.lay`). What the game chose is kept with its rules (`Rules.defaults`), so that its
|
|
6
|
+
* `data.json` can choose again (`GameData.defaults`, read by `layData`): the Data panel's "start from the defaults"
|
|
7
|
+
*/
|
|
8
|
+
import type { AbilityDef, BuffDef, TagDef, UnitTypeDef } from './defs';
|
|
9
|
+
import type { Rules } from './game';
|
|
10
|
+
import type { GamePack } from './packs/pack';
|
|
11
|
+
/**
|
|
12
|
+
* A field of the rules a set's definitions go in (`DefaultSet.kind`): a list of definitions with ids
|
|
13
|
+
*
|
|
14
|
+
* @beta
|
|
15
|
+
*/
|
|
16
|
+
export type SetKind = 'units' | 'abilities' | 'buffs' | 'items' | 'upgrades' | 'races' | 'tags' | (string & {});
|
|
17
|
+
/**
|
|
18
|
+
* What a set's definitions use besides themselves, each taken along as a chosen definition names its id (anywhere in
|
|
19
|
+
* it, or in another taken along): an item's ability, the buff the ability puts on, the ward it plants. Tags all come,
|
|
20
|
+
* as the vocabulary of the set, unless nothing of it is chosen
|
|
21
|
+
*
|
|
22
|
+
* @beta
|
|
23
|
+
*/
|
|
24
|
+
export interface SetUses {
|
|
25
|
+
/** Abilities: what items do when used, their passives */
|
|
26
|
+
abilities?: readonly AbilityDef[];
|
|
27
|
+
/** Buffs the definitions or their abilities put on */
|
|
28
|
+
buffs?: readonly BuffDef[];
|
|
29
|
+
/** Unit types they bring into the world: a ward, a wolf */
|
|
30
|
+
units?: readonly UnitTypeDef[];
|
|
31
|
+
/** The tags they say, named and given a look (`Rules.tags`) */
|
|
32
|
+
tags?: readonly TagDef[];
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* A default set of definitions: what the engine offers a game to take whole or in part (`useDefaults`)
|
|
36
|
+
*
|
|
37
|
+
* @beta
|
|
38
|
+
*/
|
|
39
|
+
export interface DefaultSet<D extends {
|
|
40
|
+
id: string;
|
|
41
|
+
} = {
|
|
42
|
+
id: string;
|
|
43
|
+
}> {
|
|
44
|
+
/** The set's id: what a choice names it by (`{ items: 'all' }`) and a `data.json` too */
|
|
45
|
+
id: string;
|
|
46
|
+
/** What the editor calls it */
|
|
47
|
+
name: string;
|
|
48
|
+
/** A line about it */
|
|
49
|
+
description?: string;
|
|
50
|
+
/** The field of the rules its definitions go in (`items`), unless it lays them its own way (`lay`) */
|
|
51
|
+
kind: SetKind;
|
|
52
|
+
/** Its definitions, in order */
|
|
53
|
+
defs: readonly D[];
|
|
54
|
+
/** What they use besides (`SetUses`), taken along as they name it */
|
|
55
|
+
uses?: SetUses;
|
|
56
|
+
/** The packs it needs (the stats its items give), added to a game that has none of their ids while anything of it is chosen */
|
|
57
|
+
packs?: () => GamePack[];
|
|
58
|
+
/**
|
|
59
|
+
* Lays what was chosen of it in the rules, for a set that goes in no list of the rules (callings handed to a pack):
|
|
60
|
+
* the definitions chosen, all of them, in the place of what an earlier choice laid (none, to take it all out)
|
|
61
|
+
*/
|
|
62
|
+
lay?(rules: Rules, defs: readonly D[]): Rules;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* What a game takes of a default set, in code: `all` of it (when left out), `none`, or some: `only` these ids, all
|
|
66
|
+
* `except` these, with definitions of its own besides or in the place of the set's of the same id (`with`), and some of
|
|
67
|
+
* them changed (`change`, by id: fields laid over the set's, or a function of it)
|
|
68
|
+
*
|
|
69
|
+
* @beta
|
|
70
|
+
*/
|
|
71
|
+
export type SetChoice<D extends {
|
|
72
|
+
id: string;
|
|
73
|
+
} = {
|
|
74
|
+
id: string;
|
|
75
|
+
}> = 'all' | 'none' | SetPick<D>;
|
|
76
|
+
/**
|
|
77
|
+
* Some of a default set (`SetChoice`)
|
|
78
|
+
*
|
|
79
|
+
* @beta
|
|
80
|
+
*/
|
|
81
|
+
export interface SetPick<D extends {
|
|
82
|
+
id: string;
|
|
83
|
+
} = {
|
|
84
|
+
id: string;
|
|
85
|
+
}> {
|
|
86
|
+
/** Only these, by id: every one when left out */
|
|
87
|
+
only?: readonly string[];
|
|
88
|
+
/** All but these, by id */
|
|
89
|
+
except?: readonly string[];
|
|
90
|
+
/** Definitions of the game's besides: one with the id of one of the set's takes its place */
|
|
91
|
+
with?: readonly D[];
|
|
92
|
+
/** Changes to some of the set's, by id: fields laid over it (deep, a list whole), or a function of it */
|
|
93
|
+
change?: Readonly<Record<string, DeepPart<D> | ((def: D) => D)>>;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* What a game takes of a set, as `useDefaults` is given it for sets of any kind (`SetChoice`): a function of `change`
|
|
97
|
+
* says the kind of definition it is given (`(def: ItemDef) => ({ ...def, cost: { gold: 900 } })`)
|
|
98
|
+
*
|
|
99
|
+
* @beta
|
|
100
|
+
*/
|
|
101
|
+
export type AnySetChoice = 'all' | 'none' | {
|
|
102
|
+
only?: readonly string[];
|
|
103
|
+
except?: readonly string[];
|
|
104
|
+
with?: readonly {
|
|
105
|
+
id: string;
|
|
106
|
+
}[];
|
|
107
|
+
change?: Readonly<Record<string, object | ((def: never) => {
|
|
108
|
+
id: string;
|
|
109
|
+
})>>;
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* Part of a definition, at any depth: what a set's `change` lays over one
|
|
113
|
+
*
|
|
114
|
+
* @beta
|
|
115
|
+
*/
|
|
116
|
+
export type DeepPart<T> = T extends readonly unknown[] ? T : T extends object ? {
|
|
117
|
+
[K in keyof T]?: DeepPart<T[K]>;
|
|
118
|
+
} : T;
|
|
119
|
+
/**
|
|
120
|
+
* What a `data.json` takes of a default set (`GameData.defaults`): all of it, none, only some ids, or all but some.
|
|
121
|
+
* Over what the code chose of it, whose own definitions (`with`) and changes stay; the data changes the set's
|
|
122
|
+
* definitions as any other (`items.<id>`)
|
|
123
|
+
*
|
|
124
|
+
* @beta
|
|
125
|
+
*/
|
|
126
|
+
export type DataSetChoice = 'all' | 'none' | {
|
|
127
|
+
only?: string[];
|
|
128
|
+
except?: string[];
|
|
129
|
+
};
|
|
130
|
+
/**
|
|
131
|
+
* The default sets a game took, kept with its rules (`Rules.defaults`): the sets, what was chosen of each, and what
|
|
132
|
+
* they added to the rules by field (ids; `packs` by pack id), so that a choice made again takes it out first
|
|
133
|
+
*
|
|
134
|
+
* @beta
|
|
135
|
+
*/
|
|
136
|
+
export interface ChosenDefaults {
|
|
137
|
+
/** The sets, by their order of taking */
|
|
138
|
+
readonly sets: readonly DefaultSet<{
|
|
139
|
+
id: string;
|
|
140
|
+
}>[];
|
|
141
|
+
/** What was chosen of each, by set id */
|
|
142
|
+
readonly chosen: Readonly<Record<string, AnySetChoice>>;
|
|
143
|
+
/** What they put in the rules, by field (`items`, `abilities`, `packs`…), by id */
|
|
144
|
+
readonly added: Readonly<Record<string, readonly string[]>>;
|
|
145
|
+
/** The game's unit types before what it did not take of the sets came off their shops and loot, where something did */
|
|
146
|
+
readonly units?: Rules['units'];
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* The definitions a choice takes of a default set (`SetChoice`): those it keeps, changed as it says, and its own
|
|
150
|
+
* besides, one with an id of the set's in that one's place
|
|
151
|
+
*
|
|
152
|
+
* @beta
|
|
153
|
+
*/
|
|
154
|
+
export declare function chooseSet<D extends {
|
|
155
|
+
id: string;
|
|
156
|
+
}>(set: Pick<DefaultSet<D>, 'defs'>, choice?: SetChoice<D>): D[];
|
|
157
|
+
/**
|
|
158
|
+
* The game with default sets taken, as it chooses of each (`SetChoice`, all of a set it says nothing of): their
|
|
159
|
+
* definitions in the fields of the rules they go in, after the game's own, one of the game's with the id of one of a
|
|
160
|
+
* set's in that one's place; what they use besides (`SetUses`); the packs they need, where the game has none of their
|
|
161
|
+
* id. Kept with the rules (`Rules.defaults`), so that its `data.json` can choose again (`layData`), and so that calling
|
|
162
|
+
* it again chooses again: `useDefaults(game, [], { items: 'none' })`. The game given is not changed
|
|
163
|
+
*
|
|
164
|
+
* ```ts
|
|
165
|
+
* export const game = layData(useDefaults(rules, [defaultItemSet], { items: { except: ['sightWard'] } }), dataFile)
|
|
166
|
+
* ```
|
|
167
|
+
*
|
|
168
|
+
* @beta
|
|
169
|
+
*/
|
|
170
|
+
export declare function useDefaults(rules: Rules, sets: readonly DefaultSet[], choices?: Readonly<Record<string, AnySetChoice>>): Rules;
|
|
171
|
+
/**
|
|
172
|
+
* What a `data.json` takes of a set laid over what the code took (`DataSetChoice`): the data's all, none, only or except
|
|
173
|
+
* in the place of the code's, the code's own definitions (`with`) and changes kept
|
|
174
|
+
*
|
|
175
|
+
* @beta
|
|
176
|
+
*/
|
|
177
|
+
export declare function overChoice(code: AnySetChoice | undefined, data: DataSetChoice): AnySetChoice;
|
|
178
|
+
/**
|
|
179
|
+
* Why what a `data.json` says of the default sets is not right, where it first is not: nothing when it is
|
|
180
|
+
*
|
|
181
|
+
* @beta
|
|
182
|
+
*/
|
|
183
|
+
export declare function dataDefaultsProblem(said: unknown, rules: Rules): string | undefined;
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
//#region src/defaultSets.ts
|
|
2
|
+
var isPlain = (value) => typeof value === "object" && value !== null && !Array.isArray(value) && Object.getPrototypeOf(value) === Object.prototype;
|
|
3
|
+
/** `over` laid on `under` at any depth: plain objects part by part, anything else (a list) whole */
|
|
4
|
+
function deepLay(under, over) {
|
|
5
|
+
if (!isPlain(under) || !isPlain(over)) return over;
|
|
6
|
+
const out = { ...under };
|
|
7
|
+
for (const [key, value] of Object.entries(over)) out[key] = value === void 0 ? out[key] : deepLay(out[key], value);
|
|
8
|
+
return out;
|
|
9
|
+
}
|
|
10
|
+
/** A choice as a pick: `all` nothing said, `none` only nothing */
|
|
11
|
+
function pickOf(choice) {
|
|
12
|
+
if (choice === void 0 || choice === "all") return {};
|
|
13
|
+
if (choice === "none") return { only: [] };
|
|
14
|
+
return choice;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The definitions a choice takes of a default set (`SetChoice`): those it keeps, changed as it says, and its own
|
|
18
|
+
* besides, one with an id of the set's in that one's place
|
|
19
|
+
*
|
|
20
|
+
* @beta
|
|
21
|
+
*/
|
|
22
|
+
function chooseSet(set, choice) {
|
|
23
|
+
const pick = pickOf(choice);
|
|
24
|
+
const own = new Map((pick.with ?? []).map((def) => [def.id, def]));
|
|
25
|
+
return [...set.defs.filter((def) => (pick.only ? pick.only.includes(def.id) : true) && !pick.except?.includes(def.id)).map((def) => {
|
|
26
|
+
if (own.has(def.id)) {
|
|
27
|
+
const mine = own.get(def.id);
|
|
28
|
+
own.delete(def.id);
|
|
29
|
+
return mine;
|
|
30
|
+
}
|
|
31
|
+
const change = pick.change?.[def.id];
|
|
32
|
+
if (change === void 0) return def;
|
|
33
|
+
return typeof change === "function" ? change(def) : deepLay(def, change);
|
|
34
|
+
}), ...own.values()];
|
|
35
|
+
}
|
|
36
|
+
/** Every string anywhere in a value: the ids a definition names, wherever it names them */
|
|
37
|
+
function stringsIn(value, into, seen = /* @__PURE__ */ new Set()) {
|
|
38
|
+
if (typeof value === "string") into.add(value);
|
|
39
|
+
else if (typeof value === "object" && value !== null && !seen.has(value)) {
|
|
40
|
+
seen.add(value);
|
|
41
|
+
for (const each of Array.isArray(value) ? value : Object.values(value)) stringsIn(each, into, seen);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/** What of a set's uses the chosen definitions need: those whose ids they name, and those these name, by field */
|
|
45
|
+
function usedBy(defs, uses) {
|
|
46
|
+
const out = {};
|
|
47
|
+
if (!uses || !defs.length) return out;
|
|
48
|
+
const named = /* @__PURE__ */ new Set();
|
|
49
|
+
stringsIn(defs, named);
|
|
50
|
+
const taken = /* @__PURE__ */ new Set();
|
|
51
|
+
for (let more = true; more;) {
|
|
52
|
+
more = false;
|
|
53
|
+
for (const field of [
|
|
54
|
+
"abilities",
|
|
55
|
+
"buffs",
|
|
56
|
+
"units"
|
|
57
|
+
]) for (const def of uses[field] ?? []) {
|
|
58
|
+
if (taken.has(def) || !named.has(def.id)) continue;
|
|
59
|
+
taken.add(def);
|
|
60
|
+
(out[field] ??= []).push(def);
|
|
61
|
+
stringsIn(def, named);
|
|
62
|
+
more = true;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
if (uses.tags?.length) out.tags = [...uses.tags];
|
|
66
|
+
return out;
|
|
67
|
+
}
|
|
68
|
+
/** The rules with what earlier choices added taken out (`ChosenDefaults.added`), and the sets that lay their own way cleared */
|
|
69
|
+
function withoutDefaults(rules) {
|
|
70
|
+
const kept = rules.defaults;
|
|
71
|
+
if (!kept) return rules;
|
|
72
|
+
let out = { ...rules };
|
|
73
|
+
const table = out;
|
|
74
|
+
for (const [field, ids] of Object.entries(kept.added)) {
|
|
75
|
+
const list = table[field];
|
|
76
|
+
if (!Array.isArray(list)) continue;
|
|
77
|
+
const gone = new Set(ids);
|
|
78
|
+
table[field] = list.filter((def) => !gone.has(def.id));
|
|
79
|
+
}
|
|
80
|
+
for (const set of kept.sets) if (set.lay) out = set.lay(out, []);
|
|
81
|
+
if (kept.units) out.units = kept.units;
|
|
82
|
+
delete out.defaults;
|
|
83
|
+
return out;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* The game with default sets taken, as it chooses of each (`SetChoice`, all of a set it says nothing of): their
|
|
87
|
+
* definitions in the fields of the rules they go in, after the game's own, one of the game's with the id of one of a
|
|
88
|
+
* set's in that one's place; what they use besides (`SetUses`); the packs they need, where the game has none of their
|
|
89
|
+
* id. Kept with the rules (`Rules.defaults`), so that its `data.json` can choose again (`layData`), and so that calling
|
|
90
|
+
* it again chooses again: `useDefaults(game, [], { items: 'none' })`. The game given is not changed
|
|
91
|
+
*
|
|
92
|
+
* ```ts
|
|
93
|
+
* export const game = layData(useDefaults(rules, [defaultItemSet], { items: { except: ['sightWard'] } }), dataFile)
|
|
94
|
+
* ```
|
|
95
|
+
*
|
|
96
|
+
* @beta
|
|
97
|
+
*/
|
|
98
|
+
function useDefaults(rules, sets, choices = {}) {
|
|
99
|
+
const before = rules.defaults;
|
|
100
|
+
const all = [...(before?.sets ?? []).filter((set) => !sets.some((each) => each.id === set.id)), ...sets];
|
|
101
|
+
const chosen = {
|
|
102
|
+
...before?.chosen,
|
|
103
|
+
...choices
|
|
104
|
+
};
|
|
105
|
+
let out = { ...withoutDefaults(rules) };
|
|
106
|
+
const table = () => out;
|
|
107
|
+
const added = {};
|
|
108
|
+
/** Puts definitions after a field's own, those of an id already there left out: the game's own come first */
|
|
109
|
+
const put = (field, defs) => {
|
|
110
|
+
const there = table()[field] ?? [];
|
|
111
|
+
const ids = new Set(there.map((def) => def.id));
|
|
112
|
+
const fresh = defs.filter((def) => !ids.has(def.id));
|
|
113
|
+
if (!fresh.length) return;
|
|
114
|
+
table()[field] = [...there, ...fresh];
|
|
115
|
+
(added[field] ??= []).push(...fresh.map((def) => def.id));
|
|
116
|
+
};
|
|
117
|
+
for (const set of all) {
|
|
118
|
+
const defs = chooseSet(set, chosen[set.id]);
|
|
119
|
+
if (set.lay) out = set.lay(out, defs);
|
|
120
|
+
else put(set.kind, defs);
|
|
121
|
+
for (const [field, used] of Object.entries(usedBy(defs, set.uses))) put(field, used);
|
|
122
|
+
if (!defs.length || !set.packs) continue;
|
|
123
|
+
for (const pack of set.packs()) {
|
|
124
|
+
if ((out.packs ?? []).some((each) => each.id === pack.id)) continue;
|
|
125
|
+
out = {
|
|
126
|
+
...out,
|
|
127
|
+
packs: [...out.packs ?? [], pack]
|
|
128
|
+
};
|
|
129
|
+
(added.packs ??= []).push(pack.id);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
const shops = withoutLeftItems(out, all);
|
|
133
|
+
return {
|
|
134
|
+
...shops,
|
|
135
|
+
defaults: {
|
|
136
|
+
sets: all,
|
|
137
|
+
chosen,
|
|
138
|
+
added,
|
|
139
|
+
...shops.units !== out.units && { units: out.units }
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* The rules with the items of a set the game did not take off its shops and its loot (`UnitTypeDef.sells`, `drops`): a
|
|
145
|
+
* shop of the game's that sells the set's items whole sells what was taken of them
|
|
146
|
+
*/
|
|
147
|
+
function withoutLeftItems(rules, sets) {
|
|
148
|
+
const offered = new Set(sets.filter((set) => set.kind === "items").flatMap((set) => set.defs.map((def) => def.id)));
|
|
149
|
+
if (!offered.size) return rules;
|
|
150
|
+
const have = new Set((rules.items ?? []).map((def) => def.id));
|
|
151
|
+
const left = (id) => offered.has(id) && !have.has(id);
|
|
152
|
+
if (!rules.units.some((unit) => unit.sells?.some(left) || Array.isArray(unit.drops) && unit.drops.some((drop) => left(drop.item)))) return rules;
|
|
153
|
+
return {
|
|
154
|
+
...rules,
|
|
155
|
+
units: rules.units.map((unit) => {
|
|
156
|
+
const sells = unit.sells?.some(left) ? unit.sells.filter((id) => !left(id)) : unit.sells;
|
|
157
|
+
const drops = Array.isArray(unit.drops) && unit.drops.some((drop) => left(drop.item)) ? unit.drops.filter((drop) => !left(drop.item)) : unit.drops;
|
|
158
|
+
return sells === unit.sells && drops === unit.drops ? unit : {
|
|
159
|
+
...unit,
|
|
160
|
+
sells,
|
|
161
|
+
drops
|
|
162
|
+
};
|
|
163
|
+
})
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* What a `data.json` takes of a set laid over what the code took (`DataSetChoice`): the data's all, none, only or except
|
|
168
|
+
* in the place of the code's, the code's own definitions (`with`) and changes kept
|
|
169
|
+
*
|
|
170
|
+
* @beta
|
|
171
|
+
*/
|
|
172
|
+
function overChoice(code, data) {
|
|
173
|
+
const { with: own, change } = pickOf(code);
|
|
174
|
+
return {
|
|
175
|
+
...data === "all" ? {} : data === "none" ? { only: [] } : {
|
|
176
|
+
only: data.only,
|
|
177
|
+
except: data.except
|
|
178
|
+
},
|
|
179
|
+
...own && { with: own },
|
|
180
|
+
...change && { change }
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Why what a `data.json` says of the default sets is not right, where it first is not: nothing when it is
|
|
185
|
+
*
|
|
186
|
+
* @beta
|
|
187
|
+
*/
|
|
188
|
+
function dataDefaultsProblem(said, rules) {
|
|
189
|
+
if (!isPlain(said)) return "defaults is no object of sets";
|
|
190
|
+
const sets = rules.defaults?.sets ?? [];
|
|
191
|
+
for (const [id, choice] of Object.entries(said)) {
|
|
192
|
+
if (!sets.some((set) => set.id === id)) return `defaults.${id}: the game takes no default set "${id}" (useDefaults)`;
|
|
193
|
+
if (choice === "all" || choice === "none") continue;
|
|
194
|
+
if (!isPlain(choice)) return `defaults.${id} is all, none, or { only, except }`;
|
|
195
|
+
for (const [key, ids] of Object.entries(choice)) {
|
|
196
|
+
if (key !== "only" && key !== "except") return `defaults.${id}.${key} is nothing a data.json chooses by (only, except)`;
|
|
197
|
+
if (!Array.isArray(ids) || !ids.every((each) => typeof each === "string")) return `defaults.${id}.${key} is no list of ids`;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* The game with what its `data.json` takes of the default sets (`GameData.defaults`) over what its code took: what
|
|
203
|
+
* `layData` does first
|
|
204
|
+
*
|
|
205
|
+
* @internal
|
|
206
|
+
*/
|
|
207
|
+
function dataDefaults(rules, said) {
|
|
208
|
+
const chosen = rules.defaults?.chosen ?? {};
|
|
209
|
+
const choices = {};
|
|
210
|
+
for (const [id, choice] of Object.entries(said)) choices[id] = overChoice(chosen[id], choice);
|
|
211
|
+
return useDefaults(rules, [], choices);
|
|
212
|
+
}
|
|
213
|
+
//#endregion
|
|
214
|
+
export { chooseSet, dataDefaults, dataDefaultsProblem, overChoice, useDefaults };
|
|
215
|
+
|
|
216
|
+
//# sourceMappingURL=defaultSets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaultSets.js","names":[],"sources":["../src/defaultSets.ts"],"sourcesContent":["/**\n * The engine's default sets (items-and-spells plan, phase 5): definitions a game takes whole, takes but some of, takes\n * and changes, or leaves (`useDefaults`). The default items (`defaultItemSet`) are one; a set of hero spells or of\n * callings plugs in the same way, by the field of the rules its definitions go in (`DefaultSet.kind`) or by a way of\n * its own of laying them (`DefaultSet.lay`). What the game chose is kept with its rules (`Rules.defaults`), so that its\n * `data.json` can choose again (`GameData.defaults`, read by `layData`): the Data panel's \"start from the defaults\"\n */\nimport type { AbilityDef, BuffDef, TagDef, UnitTypeDef } from './defs'\nimport type { Rules } from './game'\nimport type { GamePack } from './packs/pack'\n\n/**\n * A field of the rules a set's definitions go in (`DefaultSet.kind`): a list of definitions with ids\n *\n * @beta\n */\nexport type SetKind = 'units' | 'abilities' | 'buffs' | 'items' | 'upgrades' | 'races' | 'tags' | (string & {})\n\n/**\n * What a set's definitions use besides themselves, each taken along as a chosen definition names its id (anywhere in\n * it, or in another taken along): an item's ability, the buff the ability puts on, the ward it plants. Tags all come,\n * as the vocabulary of the set, unless nothing of it is chosen\n *\n * @beta\n */\nexport interface SetUses {\n\t/** Abilities: what items do when used, their passives */\n\tabilities?: readonly AbilityDef[]\n\t/** Buffs the definitions or their abilities put on */\n\tbuffs?: readonly BuffDef[]\n\t/** Unit types they bring into the world: a ward, a wolf */\n\tunits?: readonly UnitTypeDef[]\n\t/** The tags they say, named and given a look (`Rules.tags`) */\n\ttags?: readonly TagDef[]\n}\n\n/**\n * A default set of definitions: what the engine offers a game to take whole or in part (`useDefaults`)\n *\n * @beta\n */\nexport interface DefaultSet<D extends { id: string } = { id: string }> {\n\t/** The set's id: what a choice names it by (`{ items: 'all' }`) and a `data.json` too */\n\tid: string\n\t/** What the editor calls it */\n\tname: string\n\t/** A line about it */\n\tdescription?: string\n\t/** The field of the rules its definitions go in (`items`), unless it lays them its own way (`lay`) */\n\tkind: SetKind\n\t/** Its definitions, in order */\n\tdefs: readonly D[]\n\t/** What they use besides (`SetUses`), taken along as they name it */\n\tuses?: SetUses\n\t/** The packs it needs (the stats its items give), added to a game that has none of their ids while anything of it is chosen */\n\tpacks?: () => GamePack[]\n\t/**\n\t * Lays what was chosen of it in the rules, for a set that goes in no list of the rules (callings handed to a pack):\n\t * the definitions chosen, all of them, in the place of what an earlier choice laid (none, to take it all out)\n\t */\n\tlay?(rules: Rules, defs: readonly D[]): Rules\n}\n\n/**\n * What a game takes of a default set, in code: `all` of it (when left out), `none`, or some: `only` these ids, all\n * `except` these, with definitions of its own besides or in the place of the set's of the same id (`with`), and some of\n * them changed (`change`, by id: fields laid over the set's, or a function of it)\n *\n * @beta\n */\nexport type SetChoice<D extends { id: string } = { id: string }> = 'all' | 'none' | SetPick<D>\n\n/**\n * Some of a default set (`SetChoice`)\n *\n * @beta\n */\nexport interface SetPick<D extends { id: string } = { id: string }> {\n\t/** Only these, by id: every one when left out */\n\tonly?: readonly string[]\n\t/** All but these, by id */\n\texcept?: readonly string[]\n\t/** Definitions of the game's besides: one with the id of one of the set's takes its place */\n\twith?: readonly D[]\n\t/** Changes to some of the set's, by id: fields laid over it (deep, a list whole), or a function of it */\n\tchange?: Readonly<Record<string, DeepPart<D> | ((def: D) => D)>>\n}\n\n/**\n * What a game takes of a set, as `useDefaults` is given it for sets of any kind (`SetChoice`): a function of `change`\n * says the kind of definition it is given (`(def: ItemDef) => ({ ...def, cost: { gold: 900 } })`)\n *\n * @beta\n */\nexport type AnySetChoice =\n\t| 'all'\n\t| 'none'\n\t| {\n\t\t\tonly?: readonly string[]\n\t\t\texcept?: readonly string[]\n\t\t\twith?: readonly { id: string }[]\n\t\t\tchange?: Readonly<Record<string, object | ((def: never) => { id: string })>>\n\t }\n\n/**\n * Part of a definition, at any depth: what a set's `change` lays over one\n *\n * @beta\n */\nexport type DeepPart<T> = T extends readonly unknown[] ? T : T extends object ? { [K in keyof T]?: DeepPart<T[K]> } : T\n\n/**\n * What a `data.json` takes of a default set (`GameData.defaults`): all of it, none, only some ids, or all but some.\n * Over what the code chose of it, whose own definitions (`with`) and changes stay; the data changes the set's\n * definitions as any other (`items.<id>`)\n *\n * @beta\n */\nexport type DataSetChoice = 'all' | 'none' | { only?: string[]; except?: string[] }\n\n/**\n * The default sets a game took, kept with its rules (`Rules.defaults`): the sets, what was chosen of each, and what\n * they added to the rules by field (ids; `packs` by pack id), so that a choice made again takes it out first\n *\n * @beta\n */\nexport interface ChosenDefaults {\n\t/** The sets, by their order of taking */\n\treadonly sets: readonly DefaultSet<{ id: string }>[]\n\t/** What was chosen of each, by set id */\n\treadonly chosen: Readonly<Record<string, AnySetChoice>>\n\t/** What they put in the rules, by field (`items`, `abilities`, `packs`…), by id */\n\treadonly added: Readonly<Record<string, readonly string[]>>\n\t/** The game's unit types before what it did not take of the sets came off their shops and loot, where something did */\n\treadonly units?: Rules['units']\n}\n\nconst isPlain = (value: unknown): value is Record<string, unknown> =>\n\ttypeof value === 'object' && value !== null && !Array.isArray(value) && Object.getPrototypeOf(value) === Object.prototype\n\n/** `over` laid on `under` at any depth: plain objects part by part, anything else (a list) whole */\nfunction deepLay<T>(under: T, over: unknown): T {\n\tif (!isPlain(under) || !isPlain(over)) return over as T\n\tconst out: Record<string, unknown> = { ...under }\n\tfor (const [key, value] of Object.entries(over)) out[key] = value === undefined ? out[key] : deepLay(out[key], value)\n\treturn out as T\n}\n\n/** A choice as a pick: `all` nothing said, `none` only nothing */\nfunction pickOf<D extends { id: string }>(choice: SetChoice<D> | undefined): SetPick<D> {\n\tif (choice === undefined || choice === 'all') return {}\n\tif (choice === 'none') return { only: [] }\n\treturn choice\n}\n\n/**\n * The definitions a choice takes of a default set (`SetChoice`): those it keeps, changed as it says, and its own\n * besides, one with an id of the set's in that one's place\n *\n * @beta\n */\nexport function chooseSet<D extends { id: string }>(set: Pick<DefaultSet<D>, 'defs'>, choice?: SetChoice<D>): D[] {\n\tconst pick = pickOf(choice)\n\tconst own = new Map((pick.with ?? []).map((def) => [def.id, def]))\n\tconst kept = set.defs.filter((def) => (pick.only ? pick.only.includes(def.id) : true) && !pick.except?.includes(def.id))\n\tconst out = kept.map((def) => {\n\t\tif (own.has(def.id)) {\n\t\t\tconst mine = own.get(def.id)!\n\t\t\town.delete(def.id)\n\t\t\treturn mine\n\t\t}\n\t\tconst change = pick.change?.[def.id]\n\t\tif (change === undefined) return def\n\t\treturn typeof change === 'function' ? change(def) : deepLay(def, change)\n\t})\n\treturn [...out, ...own.values()]\n}\n\n/** Every string anywhere in a value: the ids a definition names, wherever it names them */\nfunction stringsIn(value: unknown, into: Set<string>, seen = new Set<unknown>()): void {\n\tif (typeof value === 'string') into.add(value)\n\telse if (typeof value === 'object' && value !== null && !seen.has(value)) {\n\t\tseen.add(value)\n\t\tfor (const each of Array.isArray(value) ? value : Object.values(value)) stringsIn(each, into, seen)\n\t}\n}\n\n/** What of a set's uses the chosen definitions need: those whose ids they name, and those these name, by field */\nfunction usedBy(defs: readonly { id: string }[], uses: SetUses | undefined): Record<string, { id: string }[]> {\n\tconst out: Record<string, { id: string }[]> = {}\n\tif (!uses || !defs.length) return out\n\tconst named = new Set<string>()\n\tstringsIn(defs, named)\n\tconst taken = new Set<unknown>()\n\tfor (let more = true; more; ) {\n\t\tmore = false\n\t\tfor (const field of ['abilities', 'buffs', 'units'] as const) {\n\t\t\tfor (const def of uses[field] ?? []) {\n\t\t\t\tif (taken.has(def) || !named.has(def.id)) continue\n\t\t\t\ttaken.add(def)\n\t\t\t\t;(out[field] ??= []).push(def)\n\t\t\t\tstringsIn(def, named)\n\t\t\t\tmore = true\n\t\t\t}\n\t\t}\n\t}\n\tif (uses.tags?.length) out.tags = [...uses.tags]\n\treturn out\n}\n\n/** The rules with what earlier choices added taken out (`ChosenDefaults.added`), and the sets that lay their own way cleared */\nfunction withoutDefaults(rules: Rules): Rules {\n\tconst kept = rules.defaults\n\tif (!kept) return rules\n\tlet out: Rules = { ...rules }\n\tconst table = out as unknown as Record<string, unknown>\n\tfor (const [field, ids] of Object.entries(kept.added)) {\n\t\tconst list = table[field]\n\t\tif (!Array.isArray(list)) continue\n\t\tconst gone = new Set(ids)\n\t\ttable[field] = list.filter((def: { id?: string }) => !gone.has(def.id as string))\n\t}\n\tfor (const set of kept.sets) if (set.lay) out = set.lay(out, [])\n\tif (kept.units) out.units = kept.units\n\tdelete out.defaults\n\treturn out\n}\n\n/**\n * The game with default sets taken, as it chooses of each (`SetChoice`, all of a set it says nothing of): their\n * definitions in the fields of the rules they go in, after the game's own, one of the game's with the id of one of a\n * set's in that one's place; what they use besides (`SetUses`); the packs they need, where the game has none of their\n * id. Kept with the rules (`Rules.defaults`), so that its `data.json` can choose again (`layData`), and so that calling\n * it again chooses again: `useDefaults(game, [], { items: 'none' })`. The game given is not changed\n *\n * ```ts\n * export const game = layData(useDefaults(rules, [defaultItemSet], { items: { except: ['sightWard'] } }), dataFile)\n * ```\n *\n * @beta\n */\nexport function useDefaults(rules: Rules, sets: readonly DefaultSet[], choices: Readonly<Record<string, AnySetChoice>> = {}): Rules {\n\tconst before = rules.defaults\n\tconst all = [...(before?.sets ?? []).filter((set) => !sets.some((each) => each.id === set.id)), ...sets]\n\tconst chosen: Record<string, AnySetChoice> = { ...before?.chosen, ...choices }\n\tlet out: Rules = { ...withoutDefaults(rules) }\n\tconst table = () => out as unknown as Record<string, unknown>\n\tconst added: Record<string, string[]> = {}\n\t/** Puts definitions after a field's own, those of an id already there left out: the game's own come first */\n\tconst put = (field: string, defs: readonly { id: string }[]) => {\n\t\tconst there = (table()[field] as { id: string }[] | undefined) ?? []\n\t\tconst ids = new Set(there.map((def) => def.id))\n\t\tconst fresh = defs.filter((def) => !ids.has(def.id))\n\t\tif (!fresh.length) return\n\t\ttable()[field] = [...there, ...fresh]\n\t\t;(added[field] ??= []).push(...fresh.map((def) => def.id))\n\t}\n\tfor (const set of all) {\n\t\tconst defs = chooseSet(set, chosen[set.id] as SetChoice | undefined)\n\t\tif (set.lay) out = set.lay(out, defs)\n\t\telse put(set.kind, defs)\n\t\tfor (const [field, used] of Object.entries(usedBy(defs, set.uses))) put(field, used)\n\t\tif (!defs.length || !set.packs) continue\n\t\tfor (const pack of set.packs()) {\n\t\t\tif ((out.packs ?? []).some((each) => each.id === pack.id)) continue\n\t\t\tout = { ...out, packs: [...(out.packs ?? []), pack] }\n\t\t\t;(added.packs ??= []).push(pack.id)\n\t\t}\n\t}\n\tconst shops = withoutLeftItems(out, all)\n\treturn { ...shops, defaults: { sets: all, chosen, added, ...(shops.units !== out.units && { units: out.units }) } }\n}\n\n/**\n * The rules with the items of a set the game did not take off its shops and its loot (`UnitTypeDef.sells`, `drops`): a\n * shop of the game's that sells the set's items whole sells what was taken of them\n */\nfunction withoutLeftItems(rules: Rules, sets: readonly DefaultSet[]): Rules {\n\tconst offered = new Set(sets.filter((set) => set.kind === 'items').flatMap((set) => set.defs.map((def) => def.id)))\n\tif (!offered.size) return rules\n\tconst have = new Set((rules.items ?? []).map((def) => def.id))\n\tconst left = (id: string) => offered.has(id) && !have.has(id)\n\tif (!rules.units.some((unit) => unit.sells?.some(left) || (Array.isArray(unit.drops) && unit.drops.some((drop) => left(drop.item))))) return rules\n\treturn {\n\t\t...rules,\n\t\tunits: rules.units.map((unit) => {\n\t\t\tconst sells = unit.sells?.some(left) ? unit.sells.filter((id) => !left(id)) : unit.sells\n\t\t\tconst drops = Array.isArray(unit.drops) && unit.drops.some((drop) => left(drop.item)) ? unit.drops.filter((drop) => !left(drop.item)) : unit.drops\n\t\t\treturn sells === unit.sells && drops === unit.drops ? unit : { ...unit, sells, drops }\n\t\t})\n\t}\n}\n\n/**\n * What a `data.json` takes of a set laid over what the code took (`DataSetChoice`): the data's all, none, only or except\n * in the place of the code's, the code's own definitions (`with`) and changes kept\n *\n * @beta\n */\nexport function overChoice(code: AnySetChoice | undefined, data: DataSetChoice): AnySetChoice {\n\tconst { with: own, change } = pickOf(code as SetChoice | undefined)\n\tconst said = data === 'all' ? {} : data === 'none' ? { only: [] } : { only: data.only, except: data.except }\n\treturn { ...said, ...(own && { with: own }), ...(change && { change }) }\n}\n\n/**\n * Why what a `data.json` says of the default sets is not right, where it first is not: nothing when it is\n *\n * @beta\n */\nexport function dataDefaultsProblem(said: unknown, rules: Rules): string | undefined {\n\tif (!isPlain(said)) return 'defaults is no object of sets'\n\tconst sets = rules.defaults?.sets ?? []\n\tfor (const [id, choice] of Object.entries(said)) {\n\t\tif (!sets.some((set) => set.id === id)) return `defaults.${id}: the game takes no default set \"${id}\" (useDefaults)`\n\t\tif (choice === 'all' || choice === 'none') continue\n\t\tif (!isPlain(choice)) return `defaults.${id} is all, none, or { only, except }`\n\t\tfor (const [key, ids] of Object.entries(choice)) {\n\t\t\tif (key !== 'only' && key !== 'except') return `defaults.${id}.${key} is nothing a data.json chooses by (only, except)`\n\t\t\tif (!Array.isArray(ids) || !ids.every((each) => typeof each === 'string')) return `defaults.${id}.${key} is no list of ids`\n\t\t}\n\t}\n\treturn undefined\n}\n\n/**\n * The game with what its `data.json` takes of the default sets (`GameData.defaults`) over what its code took: what\n * `layData` does first\n *\n * @internal\n */\nexport function dataDefaults(rules: Rules, said: Record<string, DataSetChoice>): Rules {\n\tconst chosen = rules.defaults?.chosen ?? {}\n\tconst choices: Record<string, AnySetChoice> = {}\n\tfor (const [id, choice] of Object.entries(said)) choices[id] = overChoice(chosen[id], choice)\n\treturn useDefaults(rules, [], choices)\n}\n"],"mappings":";AAyIA,IAAM,WAAW,UAChB,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK,KAAK,OAAO,eAAe,KAAK,MAAM,OAAO;;AAGjH,SAAS,QAAW,OAAU,MAAkB;CAC/C,IAAI,CAAC,QAAQ,KAAK,KAAK,CAAC,QAAQ,IAAI,GAAG,OAAO;CAC9C,MAAM,MAA+B,EAAE,GAAG,MAAM;CAChD,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,IAAI,GAAG,IAAI,OAAO,UAAU,KAAA,IAAY,IAAI,OAAO,QAAQ,IAAI,MAAM,KAAK;CACpH,OAAO;AACR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|
package/dist/definitions.d.ts
CHANGED
|
@@ -17,6 +17,11 @@ export declare class Definitions<T> {
|
|
|
17
17
|
/** What a definition must be to be taken: throws for one that is not */
|
|
18
18
|
private readonly check?;
|
|
19
19
|
private readonly byKey;
|
|
20
|
+
/**
|
|
21
|
+
* A number that changes whenever a definition is defined, defined again or taken out: what keeps something worked
|
|
22
|
+
* out of them (the flags of an entity's buffs) can tell it is out of date
|
|
23
|
+
*/
|
|
24
|
+
readonly version: number;
|
|
20
25
|
constructor(
|
|
21
26
|
/** What one is called, for what is said of one there is not: `unit type`, `ability` */
|
|
22
27
|
kind: string,
|
|
@@ -38,6 +43,7 @@ export declare class Definitions<T> {
|
|
|
38
43
|
/** Every key, in the order they were defined */
|
|
39
44
|
keys(): string[];
|
|
40
45
|
get size(): number;
|
|
46
|
+
private changed;
|
|
41
47
|
/** Takes another's definitions over its own: those it has that the other has not are kept */
|
|
42
48
|
takeFrom(other: Definitions<T>): void;
|
|
43
49
|
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
//#region src/definitions.ts
|
|
2
|
+
/**
|
|
3
|
+
* One kind of definition of a game's, by key (`Definitions`): its unit types, its abilities, its buffs... What every
|
|
4
|
+
* kind of a registry is, so that each is defined, found, listed and replaced the one way, and a tool that walks every
|
|
5
|
+
* kind (the Data panel, mods, saves) walks one list (`Registry.kinds`)
|
|
6
|
+
*/
|
|
7
|
+
/** The last `Definitions.version` handed out: one count for every registry, so that two never share a version */
|
|
8
|
+
var versions = 0;
|
|
9
|
+
/**
|
|
10
|
+
* The definitions of one kind, by key: in the order they were defined, one of a key defined again in the place of the
|
|
11
|
+
* one before it
|
|
12
|
+
*
|
|
13
|
+
* @beta
|
|
14
|
+
*/
|
|
15
|
+
var Definitions = class {
|
|
16
|
+
kind;
|
|
17
|
+
keyOf;
|
|
18
|
+
check;
|
|
19
|
+
byKey = /* @__PURE__ */ new Map();
|
|
20
|
+
/**
|
|
21
|
+
* A number that changes whenever a definition is defined, defined again or taken out: what keeps something worked
|
|
22
|
+
* out of them (the flags of an entity's buffs) can tell it is out of date
|
|
23
|
+
*/
|
|
24
|
+
version = ++versions;
|
|
25
|
+
constructor(kind, keyOf = (def) => def.id, check) {
|
|
26
|
+
this.kind = kind;
|
|
27
|
+
this.keyOf = keyOf;
|
|
28
|
+
this.check = check;
|
|
29
|
+
}
|
|
30
|
+
/** Takes a definition, in the place of the one of its key where there is one */
|
|
31
|
+
define(def) {
|
|
32
|
+
this.check?.(def);
|
|
33
|
+
this.byKey.set(this.keyOf(def), def);
|
|
34
|
+
this.changed();
|
|
35
|
+
return this;
|
|
36
|
+
}
|
|
37
|
+
/** Takes the definition of a key out: false for one there is not */
|
|
38
|
+
remove(key) {
|
|
39
|
+
this.changed();
|
|
40
|
+
return this.byKey.delete(key);
|
|
41
|
+
}
|
|
42
|
+
/** The definition of a key: throws for one there is not */
|
|
43
|
+
get(key) {
|
|
44
|
+
const def = this.byKey.get(key);
|
|
45
|
+
if (def === void 0) throw new Error(`Unknown ${this.kind} "${key}"`);
|
|
46
|
+
return def;
|
|
47
|
+
}
|
|
48
|
+
/** The definition of a key, or nothing for one there is not */
|
|
49
|
+
find(key) {
|
|
50
|
+
return this.byKey.get(key);
|
|
51
|
+
}
|
|
52
|
+
has(key) {
|
|
53
|
+
return this.byKey.has(key);
|
|
54
|
+
}
|
|
55
|
+
/** Every definition, in the order they were defined */
|
|
56
|
+
all() {
|
|
57
|
+
return [...this.byKey.values()];
|
|
58
|
+
}
|
|
59
|
+
/** Every key, in the order they were defined */
|
|
60
|
+
keys() {
|
|
61
|
+
return [...this.byKey.keys()];
|
|
62
|
+
}
|
|
63
|
+
get size() {
|
|
64
|
+
return this.byKey.size;
|
|
65
|
+
}
|
|
66
|
+
changed() {
|
|
67
|
+
this.version = ++versions;
|
|
68
|
+
}
|
|
69
|
+
/** Takes another's definitions over its own: those it has that the other has not are kept */
|
|
70
|
+
takeFrom(other) {
|
|
71
|
+
for (const [key, def] of other.byKey) this.byKey.set(key, def);
|
|
72
|
+
this.changed();
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
//#endregion
|
|
76
|
+
export { Definitions };
|
|
77
|
+
|
|
78
|
+
//# sourceMappingURL=definitions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definitions.js","names":[],"sources":["../src/definitions.ts"],"sourcesContent":["/**\n * One kind of definition of a game's, by key (`Definitions`): its unit types, its abilities, its buffs... What every\n * kind of a registry is, so that each is defined, found, listed and replaced the one way, and a tool that walks every\n * kind (the Data panel, mods, saves) walks one list (`Registry.kinds`)\n */\n\n/** The last `Definitions.version` handed out: one count for every registry, so that two never share a version */\nlet versions = 0\n\n/**\n * The definitions of one kind, by key: in the order they were defined, one of a key defined again in the place of the\n * one before it\n *\n * @beta\n */\nexport class Definitions<T> {\n\tprivate readonly byKey = new Map<string, T>()\n\t/**\n\t * A number that changes whenever a definition is defined, defined again or taken out: what keeps something worked\n\t * out of them (the flags of an entity's buffs) can tell it is out of date\n\t */\n\treadonly version: number = ++versions\n\n\tconstructor(\n\t\t/** What one is called, for what is said of one there is not: `unit type`, `ability` */\n\t\treadonly kind: string,\n\t\t/** Its key: the id, or an order's or a command's type */\n\t\tprivate readonly keyOf: (def: T) => string = (def) => (def as { id: string }).id,\n\t\t/** What a definition must be to be taken: throws for one that is not */\n\t\tprivate readonly check?: (def: T) => void\n\t) {}\n\n\t/** Takes a definition, in the place of the one of its key where there is one */\n\tdefine(def: T): this {\n\t\tthis.check?.(def)\n\t\tthis.byKey.set(this.keyOf(def), def)\n\t\tthis.changed()\n\t\treturn this\n\t}\n\n\t/** Takes the definition of a key out: false for one there is not */\n\tremove(key: string): boolean {\n\t\tthis.changed()\n\t\treturn this.byKey.delete(key)\n\t}\n\n\t/** The definition of a key: throws for one there is not */\n\tget(key: string): T {\n\t\tconst def = this.byKey.get(key)\n\t\tif (def === undefined) throw new Error(`Unknown ${this.kind} \"${key}\"`)\n\t\treturn def\n\t}\n\n\t/** The definition of a key, or nothing for one there is not */\n\tfind(key: string): T | undefined {\n\t\treturn this.byKey.get(key)\n\t}\n\n\thas(key: string): boolean {\n\t\treturn this.byKey.has(key)\n\t}\n\n\t/** Every definition, in the order they were defined */\n\tall(): T[] {\n\t\treturn [...this.byKey.values()]\n\t}\n\n\t/** Every key, in the order they were defined */\n\tkeys(): string[] {\n\t\treturn [...this.byKey.keys()]\n\t}\n\n\tget size(): number {\n\t\treturn this.byKey.size\n\t}\n\n\tprivate changed(): void {\n\t\t;(this as { version: number }).version = ++versions\n\t}\n\n\t/** Takes another's definitions over its own: those it has that the other has not are kept */\n\ttakeFrom(other: Definitions<T>): void {\n\t\tfor (const [key, def] of other.byKey) this.byKey.set(key, def)\n\t\tthis.changed()\n\t}\n}\n"],"mappings":";;;;;;;AAOA,IAAI,WAAW;;;;;;;AAQf,IAAa,cAAb,MAA4B;CAUjB;CAEQ;CAEA;CAblB,wBAAyB,IAAI,IAAe;;;;;CAK5C,UAA2B,EAAE;CAE7B,YAEC,MAEA,SAA8C,QAAS,IAAuB,IAE9E,OACC;EALQ,KAAA,OAAA;EAEQ,KAAA,QAAA;EAEA,KAAA,QAAA;CACf;;CAGH,OAAO,KAAc;EACpB,KAAK,QAAQ,GAAG;EAChB,KAAK,MAAM,IAAI,KAAK,MAAM,GAAG,GAAG,GAAG;EACnC,KAAK,QAAQ;EACb,OAAO;CACR;;CAGA,OAAO,KAAsB;EAC5B,KAAK,QAAQ;EACb,OAAO,KAAK,MAAM,OAAO,GAAG;CAC7B;;CAGA,IAAI,KAAgB;EACnB,MAAM,MAAM,KAAK,MAAM,IAAI,GAAG;EAC9B,IAAI,QAAQ,KAAA,GAAW,MAAM,IAAI,MAAM,WAAW,KAAK,KAAK,IAAI,IAAI,EAAE;EACtE,OAAO;CACR;;CAGA,KAAK,KAA4B;EAChC,OAAO,KAAK,MAAM,IAAI,GAAG;CAC1B;CAEA,IAAI,KAAsB;EACzB,OAAO,KAAK,MAAM,IAAI,GAAG;CAC1B;;CAGA,MAAW;EACV,OAAO,CAAC,GAAG,KAAK,MAAM,OAAO,CAAC;CAC/B;;CAGA,OAAiB;EAChB,OAAO,CAAC,GAAG,KAAK,MAAM,KAAK,CAAC;CAC7B;CAEA,IAAI,OAAe;EAClB,OAAO,KAAK,MAAM;CACnB;CAEA,UAAwB;EACtB,KAA8B,UAAU,EAAE;CAC5C;;CAGA,SAAS,OAA6B;EACrC,KAAK,MAAM,CAAC,KAAK,QAAQ,MAAM,OAAO,KAAK,MAAM,IAAI,KAAK,GAAG;EAC7D,KAAK,QAAQ;CACd;AACD"}
|