@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":"burning.js","names":[],"sources":["../src/burning.ts"],"sourcesContent":["import { defineEffect, effectFilter } from './abilities/effects'\nimport { areaReach, effectArea, inArea } from './abilities/shapes'\nimport { defineComponent } from './components'\nimport type { DamageType, UnitTypeDef } from './defs'\nimport { deposit, edgeDistance, type Entity, type EntityId } from './entity'\nimport { defineEvent } from './events'\nimport { cos, exp, sin } from './exactMath'\nimport { type FoliageFireRules, foliageFireOf } from './foliage'\nimport { type Cancellable, defineHook, defineHookType } from './hooks'\nimport type { MapEnvironment } from './map/look'\nimport { mapInfo } from './names'\nimport type { GamePack } from './packs/pack'\nimport type { System } from './registry'\nimport type { World } from './world'\n\n/*\n * Things that burn, an opt-in pack: trees by default, and any type a game names (a wooden wall, a\n * hut). Apart from the grass's fire (`foliage.ts`): what burns here is an entity, not a cell, and the pack works with\n * no foliage pack at all; where both are on, each may light the other (`FoliageFire.lights`, `lightsFoliage`), as fire\n * passes, not at once: both ways are tried at this pack's turn (its system), each try by a chance of its own, asked of\n * the game, what caught set alight at the end of the turn, and trying nothing before its own next turn. Nothing lights\n * within the call or the event that lit another, so a forest in a meadow burns over seconds, not in one call.\n *\n * What burns carries a component of its own (`onFire`: what kind of burning, from which tick to which, put out when),\n * told to everyone who sees it, which is what its look goes by on the screen; the world keeps the ids of what burns\n * now, in order (`fireList`). A tick looks at those alone: scenery that burns is not woken (`world.wake`), so a forest\n * of thousands of trees costs nothing while nothing burns, and what burns costs what this pack does with it and\n * nothing in every system that looks at every actor. Not a buff: a buff on a tree wakes it, and 2,000 trees woken cost\n * 0.42-0.48 ms a tick before anything of the fire was done (measured).\n */\n\n/**\n * The burning pack's id (`burningPack`), for `hasPack`\n *\n * @beta\n */\nexport const BURNING = 'burning'\n\n/**\n * How a thing burns (`UnitTypeDef.burns`, `BurningOptions`): for how long, what is left of it, whether its wood is kept,\n * and what kind of burning it is. What a type does not say is the pack's, then what each field says it is when left\n * out. Plain data: the editor writes it\n *\n * @beta\n */\nexport interface BurnsDef {\n\t/** Seconds it burns before it is burnt down: 20 when left out */\n\tseconds?: number\n\t/**\n\t * What is left once it has burnt down: `felled` (it comes down, as a tree a blast brings down: the death's reason is\n\t * `felled`), `nothing` (it burns away: the reason is `burnt`), or the id of a unit type put down where it stood (a\n\t * charred stump, a heap of ash: the reason `burnt` too). `felled` when left out\n\t */\n\tleaves?: 'felled' | 'nothing' | (string & {})\n\t/**\n\t * Whether what it leaves keeps its wood: a resource left in its place (`leaves` a type with `resource`) holds what\n\t * it had left of its own. No when left out, and what is left holds what its type says\n\t */\n\twood?: boolean\n\t/**\n\t * What kind of burning it is, for the screen (the look's `burning.how`) and its death (`death.how`): `burnt` when\n\t * left out. Another word for another kind: a blight that withers it, frost that shatters it\n\t */\n\thow?: string\n}\n\n/**\n * How fire passes from a burning thing to what burns about it (`BurningOptions.spread`): how far, how likely, how much\n * the wind decides, how often it tries. It passes to what stands (trees, buildings, a wall): a unit that burns is set\n * alight by a call or an ability alone\n *\n * @beta\n */\nexport interface BurningSpread {\n\t/** How far it reaches, edge to edge, in cells: 1.5 when left out */\n\treach?: number\n\t/** How likely a try is to light one thing within reach in still air, 0 to 1: 0.15 when left out */\n\tchance?: number\n\t/** How much the wind decides which way it goes (`MapEnvironment.wind`), 0 (not at all) and up: 1 when left out */\n\twind?: number\n\t/** Seconds between a burning thing's tries: 1 when left out */\n\tevery?: number\n}\n\n/**\n * What the burning pack is made with (`burningPack`): what burns, how (the defaults of `BurnsDef`, under what a type\n * says), whether fire passes from one thing to the next, what it does to those who stand by, and how much may burn\n *\n * @beta\n */\nexport interface BurningOptions extends BurnsDef {\n\t/**\n\t * What burns, and how, in code: `true` (as its type and the pack say), a `BurnsDef` over those, or `false`. Where it\n\t * says nothing, its type's `burns`; where that says nothing, what can be felled (`fellable`: trees)\n\t */\n\tburns?: (world: World, entity: Entity) => boolean | BurnsDef | undefined\n\t/** Whether a burning thing lights what burns about it (`BurningSpread`): `true` for the defaults. Never when left out */\n\tspread?: BurningSpread | boolean\n\t/**\n\t * Damage a second to units on the ground within `damageReach` of a burning thing, by whoever lit it (the first of\n\t * those about it, in order of their ids): none when left out. Dealt twice a second, each unit on a turn of its own\n\t */\n\tdamage?: number\n\t/** How far its heat hurts, edge to edge, in cells: 1 when left out */\n\tdamageReach?: number\n\t/** The type that damage is dealt as: magic when left out */\n\tdamageType?: DamageType\n\t/** The most things that burn at once: past it, nothing more catches until something has burnt down. 2000 when left out */\n\tmaxBurning?: number\n\t/**\n\t * Whether a burning thing may set alight the grass about it, in a game with the foliage pack too (`foliagePack`):\n\t * the cells under it and one cell round, of every layer of that pack, or of those named. No when left out. It\n\t * passes as fire does, not at once: once a second while it burns, each cell by a chance of its own (0.2 for a style\n\t * of `flammable` 1 in still, dry air, likelier downwind), asked of the game (`foliageIgnite`, `cause: 'burning'`),\n\t * under the most that may burn there (`FoliageFire.maxBurning`). What caught is set alight at the end of this pack's\n\t * turn, and tries nothing before its own next turn. The other way is that pack's to say (`FoliageFire.lights`)\n\t */\n\tlightsFoliage?: boolean | readonly string[]\n}\n\n/**\n * What sets a thing alight: set alight by a call or an ability (`light`), caught from a burning thing about it\n * (`spread`), or from burning grass (`foliage`)\n *\n * @beta\n */\nexport type BurnCause = 'light' | 'spread' | 'foliage'\n\n/**\n * A thing about to catch fire (the `burnStart` hook): `cancel()` keeps it from catching; `chance` is a handler's to\n * change (a wet grove, a building that does not burn while it is being built). Asked once a try\n *\n * @beta\n */\nexport interface BurnStart extends Cancellable {\n\t/** What is about to catch */\n\treadonly entity: Entity\n\t/** How it catches */\n\treadonly cause: BurnCause\n\t/** The burning thing it catches from, for a spread */\n\treadonly from?: Entity\n\t/** The layer of grass of the burning cell it catches from, for one caught from grass (`foliage`) */\n\treadonly layer?: string\n\t/** The burning cell it catches from, by its index in that layer, for one caught from grass (`foliage`) */\n\treadonly cell?: number\n\t/** Who set alight the fire it is of, where someone did */\n\treadonly by?: Entity\n\t/** What kind of burning it is (`BurnsDef.how`) */\n\treadonly how: string\n\t/**\n\t * How likely it is to catch, 0 to 1: 1 for one set alight, the spread's chance in the wind for one caught from a\n\t * burning thing, the grass's for one caught from grass (`FoliageFire.lights`). What a handler leaves it at is held\n\t * to 0 to 1 (more than 1 is sure, less than 0 never)\n\t */\n\tchance: number\n}\n\n/**\n * Asked before a thing catches fire (`BurnStart`): a handler refuses it or changes its chance. Once for every try:\n * of a call, a spread, or grass burning beside it; so a handler does little\n *\n * @beta\n */\nexport const burnStart = /* @__PURE__ */ defineHookType<BurnStart>({ id: 'burning.start' })\n\n/**\n * Something caught fire: how, who lit the fire it is of, what kind of burning it is. What a game's rules and its computer\n * players hear; the screens are told by what burns (`onFire`)\n *\n * @beta\n */\nexport const burnStarted = defineEvent<{ entity: EntityId; cause: BurnCause; how: string; by?: EntityId }>({ id: 'burning.started' })\n\n/**\n * Something burnt down: what kind of burning it was, who lit it, and what it left where it stood (`BurnsDef.leaves`), where\n * it left a thing\n *\n * @beta\n */\nexport const burnt = defineEvent<{ entity: EntityId; how: string; by?: EntityId; left?: EntityId }>({ id: 'burning.burnt' })\n\n/**\n * Something that burnt was put out (`putOut`, an ability): it stands, charred as far as it burnt\n *\n * @beta\n */\nexport const burnPutOut = defineEvent<{ entity: EntityId }>({ id: 'burning.putOut' })\n\n/**\n * What burns, as everyone who sees it is told (`onFire`): the kind of burning, the tick it started and the tick it burns\n * down at; `out`, the tick it was put out at, for one that burns no more (charred as far as it came: `(out - since) /\n * (ends - since)`). A screen draws how far it has burnt from these and its own tick, with nothing sent as it goes\n *\n * @beta\n */\nexport interface FireShown {\n\t/** What kind of burning it is (`BurnsDef.how`) */\n\thow: string\n\t/** The tick it started to burn at: as far back as it had burnt already, for one lit again */\n\tsince: number\n\t/** The tick it burns down at */\n\tends: number\n\t/** The tick it was put out at, for one that burns no more */\n\tout?: number\n}\n\n/**\n * What burns or burnt and was put out, on the thing itself (`FireShown`): told to everyone who sees it as it is (no\n * part of it one player's, so that what a team remembers of a tree is the same for each of them), kept by a save.\n * `snapshotOf(entity.state, onFire)` on a screen; `isBurning` and `burningOf` in the rules\n *\n * @beta\n */\nexport const onFire = /* @__PURE__ */ defineComponent<FireShown>({\n\tid: 'burning',\n\treplicate: 'everyone',\n\tsame: (a, b) => a.how === b.how && a.since === b.since && a.ends === b.ends && a.out === b.out\n})\n\n/**\n * What burns in a world: the ids of the things that burn now, in order, who lit the fire each is of (0 for nobody),\n * and the tick each burns down at: what a tick goes by without looking the thing up, but on its turn\n */\ninterface FireList {\n\tids: number[]\n\tby: number[]\n\tends: number[]\n}\n\n/** What burns in a world (`FireList`), kept by a save */\nconst fireList = /* @__PURE__ */ defineComponent<FireList>({ id: 'burning.list', default: () => ({ ids: [], by: [], ends: [] }) })\n\n/** What `BurnsDef` says, each as it is when left out */\ntype Burns = Required<Omit<BurnsDef, 'leaves'>> & { leaves: string }\n\n/** The air over the map as its environment says (`MapEnvironment.wind`): the wind's way on the ground and strength */\ninterface Air {\n\t/** The environment it was worked out of: another (`world.setEnvironment`) works it out again */\n\tof: MapEnvironment | undefined\n\t/** How strong the wind is, 0 (still) to 1 (a gale) */\n\tstrength: number\n\t/** Downwind on the ground, along x and z */\n\tx: number\n\tz: number\n}\n\n/** How much a gale makes a try downwind likelier (`BurningSpread.wind` 1, the wind's strength 1: e² ≈ 7.4 times), and upwind less */\nconst WIND = 2\n/** How often a burning thing that tries nothing is looked at, to see it still stands, in seconds */\nconst LOOK_EVERY = 1\n/** How often who stands by a burning thing is hurt (`BurningOptions.damage`), in seconds */\nconst SCORCH_EVERY = 0.5\n/**\n * How likely a burning cell of grass is to light a thing that burns on it or beside it at one of its tries (four a\n * second, `FoliageFire.every`, `FoliageFire.lights`): of grass of `fuel` 1, in still air and dry. A tree a front\n * reaches, three or four cells about it burning, catches in a second or two, seldom in the first tick\n */\nconst FROM_GRASS = 0.05\n\n/** Where the pack keeps its rules, on the pack, for the calls made on a world of its game */\nconst RULES = Symbol('burning rules')\n\n/** The burning pack with its rules beside it */\ntype BurningPack = GamePack & { [RULES]?: BurningRules }\n\n/**\n * The pack's rules: its settings, and what a tick and the calls do with a world's `fireList` and `onFire`. One a pack,\n * for every world of its game: what it keeps of a world is scratch, emptied as each call ends\n */\nclass BurningRules {\n\t/** What burns, as the pack was told, before its type is asked */\n\treadonly decides: BurningOptions['burns']\n\t/** The defaults of `BurnsDef` */\n\treadonly base: Burns\n\t/** Whether fire passes from one thing to the next, and how: none for never */\n\treadonly spread: Required<BurningSpread> | undefined\n\t/** Damage a second to who stands by */\n\treadonly damage: number\n\t/** How far that reaches */\n\treadonly damageReach: number\n\t/** The type it is dealt as */\n\treadonly damageType: DamageType\n\t/** The most that burns at once */\n\treadonly maxBurning: number\n\t/** Whether what burns tries the grass about it: the layers named, or every layer of the foliage pack (`true`) */\n\treadonly lightsFoliage: boolean | readonly string[]\n\t/** The system that runs it */\n\treadonly system: System\n\t/** The air as last worked out (`airOf`) */\n\tprivate air: Air | undefined\n\t/** How each type burns where the game decides nothing in code, by its definition: null for one that does not */\n\tprivate readonly typed = new WeakMap<UnitTypeDef, Burns | null>()\n\t/** Scratch of a call: what a search found */\n\tprivate readonly found: Entity[] = []\n\t/** Scratch of a call: what of it may catch, or be hurt, in order of their ids */\n\tprivate readonly near: Entity[] = []\n\t/** Scratch of a tick: what caught in it, how, and who lit the fire it caught from */\n\tprivate readonly fresh: { entity: Entity; by: number; cause: BurnCause }[] = []\n\t/** Scratch of a tick: the cells of grass that caught from what burns in it (`lightsFoliage`), by layer, cell and whose */\n\tprivate readonly grassCaught = { layers: [] as number[], cells: [] as number[], by: [] as number[], keys: new Set<number>() }\n\t/** The link to the grass of each game seen, by its packs: none where neither way is on, or the game has no grass that burns */\n\tprivate readonly links = new WeakMap<readonly GamePack[], GrassLink | null>()\n\t/** Scratch of a tick: who is hurt in it, and by whom */\n\tprivate readonly hurt: { unit: Entity; by: number }[] = []\n\t/** The thing being burnt down right now: its death is given its `how` (the `death` hook) */\n\tending: { entity: Entity; how: string } | undefined\n\n\tconstructor(options: BurningOptions) {\n\t\tthis.decides = options.burns\n\t\tthis.base = {\n\t\t\tseconds: Math.max(0, options.seconds ?? 20),\n\t\t\tleaves: options.leaves ?? 'felled',\n\t\t\twood: options.wood ?? false,\n\t\t\thow: options.how ?? 'burnt'\n\t\t}\n\t\tconst spread = options.spread === true ? {} : options.spread || undefined\n\t\tthis.spread = spread && {\n\t\t\treach: Math.max(0, spread.reach ?? 1.5),\n\t\t\tchance: Math.min(1, Math.max(0, spread.chance ?? 0.15)),\n\t\t\twind: Math.max(0, spread.wind ?? 1),\n\t\t\tevery: Math.max(0, spread.every ?? 1)\n\t\t}\n\t\tthis.damage = Math.max(0, options.damage ?? 0)\n\t\tthis.damageReach = Math.max(0, options.damageReach ?? 1)\n\t\tthis.damageType = options.damageType ?? 'magic'\n\t\tthis.maxBurning = Math.max(0, Math.floor(options.maxBurning ?? 2000))\n\t\tthis.lightsFoliage = options.lightsFoliage ?? false\n\t\tthis.system = {\n\t\t\tname: 'burning',\n\t\t\tphase: 'resolve',\n\t\t\tupdate: (world) => {\n\t\t\t\t// nothing was ever set alight, and no grass burns beside what may catch from it: nothing to look at\n\t\t\t\tconst list = world.states.has(fireList) ? world.state(fireList) : undefined\n\t\t\t\tconst grass = this.linkOf(world)\n\t\t\t\tif (list?.ids.length || (grass?.fromGrass && grass.fire.anyBurning(world))) this.tick(world, list, grass)\n\t\t\t}\n\t\t}\n\t}\n\n\t/** The link to the grass of a world's game (`GrassLink`): none where neither way is on or it has no grass that burns */\n\tlinkOf(world: World): GrassLink | undefined {\n\t\tconst packs = world.registry.assembly?.rules.packs\n\t\tif (!packs) return undefined\n\t\tlet link = this.links.get(packs)\n\t\tif (link === undefined) {\n\t\t\tconst fire = foliageFireOf(world)\n\t\t\tconst lights = this.lightsFoliage\n\t\t\tconst toGrass = !fire\n\t\t\t\t? []\n\t\t\t\t: fire.layers.flatMap((layer, l) => (lights === true || (Array.isArray(lights) && lights.includes(layer)) ? [l] : []))\n\t\t\tlink = fire && (fire.lights || toGrass.length) ? { fire, toGrass, fromGrass: fire.lights } : null\n\t\t\tthis.links.set(packs, link)\n\t\t}\n\t\treturn link ?? undefined\n\t}\n\n\t/** How a thing burns (`Burns`): none for what does not */\n\tburnsOf(world: World, entity: Entity): Burns | undefined {\n\t\tconst decided = this.decides?.(world, entity)\n\t\t// what its type says alone, worked out once a type: asked of every tree a fire tries\n\t\tif (decided === undefined) {\n\t\t\tlet typed = this.typed.get(entity.def)\n\t\t\tif (typed === undefined) this.typed.set(entity.def, (typed = this.burnsBy(entity, undefined) ?? null))\n\t\t\treturn typed ?? undefined\n\t\t}\n\t\treturn this.burnsBy(entity, decided)\n\t}\n\n\t/** How a thing burns, as the game decided in code (`decided`) over its type, over the pack */\n\tprivate burnsBy(entity: Entity, decided: boolean | BurnsDef | undefined): Burns | undefined {\n\t\tconst own = decided ?? entity.def.burns ?? (entity.def.fellable ? true : undefined)\n\t\tif (!own) return undefined\n\t\tconst def = entity.def.burns\n\t\tconst typed = typeof def === 'object' ? def : undefined\n\t\tconst said = typeof own === 'object' ? own : undefined\n\t\treturn {\n\t\t\tseconds: Math.max(0, said?.seconds ?? typed?.seconds ?? this.base.seconds),\n\t\t\tleaves: said?.leaves ?? typed?.leaves ?? this.base.leaves,\n\t\t\twood: said?.wood ?? typed?.wood ?? this.base.wood,\n\t\t\thow: said?.how ?? typed?.how ?? this.base.how\n\t\t}\n\t}\n\n\t/** The air over the map now (`Air`), worked out again as the map's environment changes */\n\tairOf(world: World): Air {\n\t\tconst environment = world.state(mapInfo).environment\n\t\tif (this.air && this.air.of === environment) return this.air\n\t\t// the client's fields (`MapWind`), which the engine does not name: read as the grass's fire reads them\n\t\tconst wind = (environment as { wind?: { around?: number; strength?: number } } | undefined)?.wind\n\t\tconst strength = Math.min(1, Math.max(0, wind?.strength ?? 0))\n\t\tconst turn = (((wind?.around ?? 0) % 360) * Math.PI) / 180\n\t\t// downwind on the ground, as the screens have it: 0 north (towards -z), 90 east (+x)\n\t\treturn (this.air = { of: environment, strength, x: strength ? sin(turn) : 0, z: strength ? -cos(turn) : 0 })\n\t}\n\n\t/** Whether something with a chance happens: by the world's numbers where it is neither sure nor never */\n\thappens(world: World, chance: number): boolean {\n\t\treturn chance >= 1 || (chance > 0 && world.rng.next() < chance)\n\t}\n\n\t/** How many ticks a stretch of seconds is: at least one */\n\tticks(world: World, seconds: number): number {\n\t\treturn Math.max(1, Math.round(seconds / world.dt))\n\t}\n\n\t/**\n\t * Sets a thing alight, as `setAlight` says: asked of the game (`burnStart`) at `chance`, once, rolled where it is not\n\t * sure, under the most that may burn; started (`start`). Whether it caught\n\t */\n\tlight(world: World, entity: Entity, cause: BurnCause, by: number, from: Entity | undefined, chance: number, options: LightOptions = {}): boolean {\n\t\tif (!entity.alive || isBurning(entity)) return false\n\t\tconst burns = this.burnsOf(world, entity)\n\t\tif (!burns) return false\n\t\tif (world.states.has(fireList) && world.state(fireList).ids.length >= this.maxBurning) return false\n\t\tif (world.hooks.has(burnStart)) {\n\t\t\tconst asked = world.hooks.run(burnStart, {\n\t\t\t\tentity,\n\t\t\t\tcause,\n\t\t\t\t...(from ? { from } : {}),\n\t\t\t\t...(by ? { by: world.entities.get(by) } : {}),\n\t\t\t\thow: options.how ?? burns.how,\n\t\t\t\tchance,\n\t\t\t\tcancelled: false\n\t\t\t})\n\t\t\tif (asked.cancelled) return false\n\t\t\tchance = held(asked.chance)\n\t\t}\n\t\tif (!this.happens(world, chance)) return false\n\t\treturn this.start(world, entity, cause, by, options)\n\t}\n\n\t/**\n\t * A thing catches, asked and rolled already (by `light`, or at a try of a spread or of the grass): set burning for\n\t * its time, under the most that may burn, and told (`burnStarted`). Into the list first, then marked (`onFire`):\n\t * what is marked is never outside the list, whatever throws (one listed and not marked is dropped at its next\n\t * turn). Whether it caught\n\t */\n\tstart(world: World, entity: Entity, cause: BurnCause, by: number, options: LightOptions = {}): boolean {\n\t\tif (!entity.alive || isBurning(entity)) return false\n\t\tconst burns = this.burnsOf(world, entity)\n\t\tif (!burns) return false\n\t\tconst list = world.state(fireList)\n\t\tif (list.ids.length >= this.maxBurning) return false\n\t\tconst how = options.how ?? burns.how\n\t\tconst { tick } = world\n\t\tconst length = this.ticks(world, options.seconds ?? burns.seconds)\n\t\t// lit again where it was put out: on from as far as it had burnt\n\t\tconst was = entity.get(onFire)\n\t\tconst done = was?.out !== undefined && was.ends > was.since ? Math.min(1, (was.out - was.since) / (was.ends - was.since)) : 0\n\t\tconst since = tick - Math.round(done * length)\n\t\tconst ends = Math.max(tick + 1, since + length)\n\t\tinsertId(list, entity.id, by, ends)\n\t\tentity.set(onFire, { how, since, ends })\n\t\tworld.events.emit(burnStarted, { entity: entity.id, cause, how, ...(by ? { by } : {}) })\n\t\treturn true\n\t}\n\n\t/** Puts out a thing that burns: it stands, charred as far as it burnt. Whether it burnt */\n\tputOut(world: World, entity: Entity): boolean {\n\t\tconst state = entity.get(onFire)\n\t\tif (!state || state.out !== undefined) return false\n\t\tentity.set(onFire, { ...state, out: world.tick })\n\t\tif (world.states.has(fireList)) removeId(world.state(fireList), entity.id)\n\t\tworld.events.emit(burnPutOut, { entity: entity.id })\n\t\treturn true\n\t}\n\n\t/**\n\t * A tick: what burns out burns down, what tries its neighbours this tick tries them (things, and the grass about it\n\t * once a second where the pack says), burning grass whose turn it is tries what stands beside it\n\t * (`FoliageFire.lights`), who stands by is hurt. What caught is set alight at the end, in order (things by their\n\t * ids, cells by layer and index), and tries nothing this tick: nothing lights within what lit it\n\t */\n\ttick(world: World, list: FireList | undefined, grass: GrassLink | undefined): void {\n\t\tconst { tick } = world\n\t\tconst spread = this.spread\n\t\tconst stride = spread ? this.ticks(world, spread.every) : 1\n\t\tconst look = this.ticks(world, LOOK_EVERY)\n\t\tconst tries = !!spread && spread.chance > 0\n\t\tconst scorch = this.ticks(world, SCORCH_EVERY)\n\t\tconst toGrass = grass?.toGrass.length ? grass : undefined\n\t\tconst fresh = this.fresh\n\t\tconst hurt = this.hurt\n\t\tconst caught = this.grassCaught\n\t\tfresh.length = 0\n\t\thurt.length = 0\n\t\tcaught.layers.length = caught.cells.length = caught.by.length = 0\n\t\tcaught.keys.clear()\n\t\tlet out: { entity: Entity; by: number }[] | undefined\n\t\tif (list?.ids.length) {\n\t\t\tconst { ids, by, ends } = list\n\t\t\tlet kept = 0\n\t\t\tfor (let i = 0; i < ids.length; i++) {\n\t\t\t\tconst id = ids[i]\n\t\t\t\tconst whose = by[i]\n\t\t\t\tconst end = ends[i]\n\t\t\t\t// looked up on its turns alone (to try those about it, and once a second to see it still stands and to try\n\t\t\t\t// the grass about it) and as it burns down: the rest of the ticks it is three numbers\n\t\t\t\tconst trying = tries && turnOf(id, stride) === tick % stride\n\t\t\t\tconst looking = turnOf(id, look) === tick % look\n\t\t\t\tif (end > tick && !trying && !looking) {\n\t\t\t\t\tids[kept] = id\n\t\t\t\t\tby[kept] = whose\n\t\t\t\t\tends[kept++] = end\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tconst entity = world.entities.get(id)\n\t\t\t\tconst state = entity?.get(onFire)\n\t\t\t\t// gone by other means (felled, killed, taken away), or put out: out of the list, as it is\n\t\t\t\tif (!entity || !entity.alive || !state || state.out !== undefined) continue\n\t\t\t\tif (end <= tick) {\n\t\t\t\t\t;(out ??= []).push({ entity, by: whose })\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tids[kept] = id\n\t\t\t\tby[kept] = whose\n\t\t\t\tends[kept++] = end\n\t\t\t\tif (trying && ids.length + fresh.length < this.maxBurning) this.tryAround(world, entity, whose, spread!)\n\t\t\t\tif (toGrass && looking) this.tryGrass(world, entity, whose, toGrass)\n\t\t\t}\n\t\t\tids.length = kept\n\t\t\tby.length = kept\n\t\t\tends.length = kept\n\t\t\t// who stands by what burns, each unit on its own turn\n\t\t\tif (this.damage && ids.length) this.scorch(world, list, scorch)\n\t\t}\n\t\t// the burning grass whose turn it is, at what stands beside it\n\t\tif (grass?.fromGrass) this.fromGrass(world, grass.fire, list?.ids.length ?? 0)\n\t\t// what caught this tick, in order of their ids, each once: set alight now, to try on from their next turn\n\t\tif (fresh.length) {\n\t\t\tfresh.sort((a, b) => a.entity.id - b.entity.id)\n\t\t\tlet last = -1\n\t\t\tfor (const each of fresh) {\n\t\t\t\tif (each.entity.id === last) continue\n\t\t\t\tlast = each.entity.id\n\t\t\t\tthis.start(world, each.entity, each.cause, each.by)\n\t\t\t}\n\t\t\tfresh.length = 0\n\t\t}\n\t\t// the grass that caught from what burns, by layer and cell: lit now, to try on from its next turn\n\t\tif (caught.cells.length) {\n\t\t\tgrass!.fire.lightCaught(world, caught.layers, caught.cells, caught.by)\n\t\t\tcaught.layers.length = caught.cells.length = caught.by.length = 0\n\t\t\tcaught.keys.clear()\n\t\t}\n\t\t// who stood by, hurt once a turn whatever burns about them, in order of their ids\n\t\tif (hurt.length) {\n\t\t\tconst amount = this.damage * scorch * world.dt\n\t\t\thurt.sort((a, b) => a.unit.id - b.unit.id)\n\t\t\tlet last = -1\n\t\t\tfor (const each of hurt) {\n\t\t\t\tconst { unit } = each\n\t\t\t\tif (unit.id === last || !unit.alive) continue\n\t\t\t\tlast = unit.id\n\t\t\t\tworld.damage(unit, amount, each.by ? world.entities.get(each.by) : undefined, { damageType: this.damageType, tags: ['fire'], how: 'burnt' })\n\t\t\t}\n\t\t\thurt.length = 0\n\t\t}\n\t\tif (out) for (const each of out) this.burnDown(world, each.entity, each.by)\n\t}\n\n\t/**\n\t * A burning thing's try at what burns within its reach (`BurningSpread`): each by the spread's chance, likelier\n\t * downwind and less upwind, asked of the game (`burnStart`, once a try) and rolled in order of their ids. Into the\n\t * tick's fresh\n\t */\n\ttryAround(world: World, entity: Entity, by: number, spread: Required<BurningSpread>): void {\n\t\tconst near = this.near\n\t\tnear.length = 0\n\t\tconst { x, z } = entity.pos\n\t\tfor (const other of world.spatial.queryStatic(x, z, spread.reach + entity.def.radius, this.found)) {\n\t\t\tif (other !== entity && other.alive && !other.hidden && !isBurning(other)) near.push(other)\n\t\t}\n\t\tif (!near.length) return\n\t\tnear.sort((a, b) => a.id - b.id)\n\t\tconst air = this.airOf(world)\n\t\tconst hooked = world.hooks.has(burnStart)\n\t\tfor (const other of near) {\n\t\t\tif (edgeDistance(entity, other) > spread.reach) continue\n\t\t\tconst burns = this.burnsOf(world, other)\n\t\t\tif (!burns) continue\n\t\t\tlet chance = spread.chance\n\t\t\tif (air.strength && spread.wind) {\n\t\t\t\tconst dx = other.pos.x - x\n\t\t\t\tconst dz = other.pos.z - z\n\t\t\t\tconst far = Math.sqrt(dx * dx + dz * dz)\n\t\t\t\tif (far > 0) chance *= exp((WIND * spread.wind * air.strength * (dx * air.x + dz * air.z)) / far)\n\t\t\t}\n\t\t\tchance = Math.min(1, chance)\n\t\t\tif (hooked) {\n\t\t\t\tconst asked = world.hooks.run(burnStart, {\n\t\t\t\t\tentity: other,\n\t\t\t\t\tcause: 'spread',\n\t\t\t\t\tfrom: entity,\n\t\t\t\t\t...(by ? { by: world.entities.get(by) } : {}),\n\t\t\t\t\thow: burns.how,\n\t\t\t\t\tchance,\n\t\t\t\t\tcancelled: false\n\t\t\t\t})\n\t\t\t\tif (asked.cancelled) continue\n\t\t\t\tchance = held(asked.chance)\n\t\t\t}\n\t\t\tif (this.happens(world, chance)) this.fresh.push({ entity: other, by, cause: 'spread' })\n\t\t}\n\t\tnear.length = 0\n\t}\n\n\t/**\n\t * A burning thing's try at the grass under it and one cell round (`lightsFoliage`), once a second: each cell of the\n\t * layers it lights that may catch, by the grass's chance (`FoliageFireRules.chanceFrom`: its style, the wet, the\n\t * wind by this pack's `wind`), asked of the game (`foliageIgnite`, `burning`, once a try) and rolled, in order of\n\t * the layers and the cells. Into the tick's grass caught, as many as the grass has room for\n\t */\n\ttryGrass(world: World, entity: Entity, by: number, link: GrassLink): void {\n\t\tconst { fire, toGrass } = link\n\t\tconst caught = this.grassCaught\n\t\tlet room = fire.room(world) - caught.cells.length\n\t\tif (room <= 0) return\n\t\tconst { width, depth } = world.terrain\n\t\tconst size = width * depth\n\t\tconst { x, z, hw, hd } = entity.rect\n\t\tconst weight = this.spread?.wind ?? 1\n\t\tfor (const l of toGrass)\n\t\t\tfor (let cz = Math.max(Math.floor(z - hd) - 1, 0); cz <= Math.min(Math.ceil(z + hd), depth - 1); cz++)\n\t\t\t\tfor (let cx = Math.max(Math.floor(x - hw) - 1, 0); cx <= Math.min(Math.ceil(x + hw), width - 1); cx++) {\n\t\t\t\t\tconst cell = cz * width + cx\n\t\t\t\t\tconst key = l * size + cell\n\t\t\t\t\tif (caught.keys.has(key)) continue\n\t\t\t\t\tconst chance = fire.chanceFrom(world, l, cell, entity.pos.x, entity.pos.z, weight)\n\t\t\t\t\tif (!(chance > 0) || !this.happens(world, fire.ask(world, l, cell, 'burning', undefined, by, chance, entity))) continue\n\t\t\t\t\tcaught.keys.add(key)\n\t\t\t\t\tcaught.layers.push(l)\n\t\t\t\t\tcaught.cells.push(cell)\n\t\t\t\t\tcaught.by.push(by)\n\t\t\t\t\tif (--room <= 0) return\n\t\t\t\t}\n\t}\n\n\t/**\n\t * The burning grass whose turn it is this tick (`FoliageFire.every`), at what burns and stands on its cell or one\n\t * next to it (`FoliageFire.lights`): each by `FROM_GRASS` and the cell's heat, likelier downwind (by the grass's\n\t * `wind`), asked of the game (`burnStart`, `foliage`, once a try) and rolled, cell by cell in order and what stands\n\t * by each in order of their ids. Into the tick's fresh, under the most that may burn\n\t */\n\tfromGrass(world: World, fire: FoliageFireRules, burning: number): void {\n\t\tif (burning + this.fresh.length >= this.maxBurning) return\n\t\tconst { width } = world.terrain\n\t\tconst { grid } = world\n\t\tconst air = this.airOf(world)\n\t\tconst weight = fire.wind\n\t\tconst hooked = world.hooks.has(burnStart)\n\t\tconst near = this.near\n\t\tfire.eachTrying(world, (l, cell, by, heat) => {\n\t\t\tif (burning + this.fresh.length >= this.maxBurning) return\n\t\t\tconst cx = cell % width\n\t\t\tconst cz = (cell - cx) / width\n\t\t\tconst x = cx + 0.5\n\t\t\tconst z = cz + 0.5\n\t\t\tnear.length = 0\n\t\t\t// what stands on the cell or on one next to it: whatever stands (all but what moves) holds the cells of its\n\t\t\t// footprint (`world.grid`), so the nine cells' holders, each once; nothing looked up where none is\n\t\t\tfor (let dz = -1; dz <= 1; dz++)\n\t\t\t\tfor (let dx = -1; dx <= 1; dx++) {\n\t\t\t\t\tconst id = grid.occupantAt(cx + dx, cz + dz)\n\t\t\t\t\tif (id <= 0 || near.some((each) => each.id === id)) continue\n\t\t\t\t\tconst other = world.entities.get(id)\n\t\t\t\t\tif (other && other.alive && !other.hidden && !isBurning(other)) near.push(other)\n\t\t\t\t}\n\t\t\tif (!near.length) return\n\t\t\tnear.sort((a, b) => a.id - b.id)\n\t\t\tfor (const other of near) {\n\t\t\t\tconst burns = this.burnsOf(world, other)\n\t\t\t\tif (!burns) continue\n\t\t\t\tlet chance = FROM_GRASS * heat\n\t\t\t\tif (air.strength && weight) {\n\t\t\t\t\tconst dx = other.pos.x - x\n\t\t\t\t\tconst dz = other.pos.z - z\n\t\t\t\t\tconst far = Math.sqrt(dx * dx + dz * dz)\n\t\t\t\t\tif (far > 0) chance *= exp((WIND * weight * air.strength * (dx * air.x + dz * air.z)) / far)\n\t\t\t\t}\n\t\t\t\tchance = Math.min(1, chance)\n\t\t\t\tif (hooked) {\n\t\t\t\t\tconst asked = world.hooks.run(burnStart, {\n\t\t\t\t\t\tentity: other,\n\t\t\t\t\t\tcause: 'foliage',\n\t\t\t\t\t\tlayer: fire.layers[l],\n\t\t\t\t\t\tcell,\n\t\t\t\t\t\t...(by ? { by: world.entities.get(by) } : {}),\n\t\t\t\t\t\thow: burns.how,\n\t\t\t\t\t\tchance,\n\t\t\t\t\t\tcancelled: false\n\t\t\t\t\t})\n\t\t\t\t\tif (asked.cancelled) continue\n\t\t\t\t\tchance = held(asked.chance)\n\t\t\t\t}\n\t\t\t\tif (this.happens(world, chance)) this.fresh.push({ entity: other, by, cause: 'foliage' })\n\t\t\t}\n\t\t\tnear.length = 0\n\t\t})\n\t}\n\n\t/**\n\t * Who stands by what burns, into the tick's hurt: units on the ground, each on its turn (once in `stride` ticks, by a\n\t * hash of its id), looked at for something burning within `damageReach` of it; hurt once, by whoever lit the first\n\t * of those in order of their ids. Done from the units, of which there are fewer than trees in a forest fire\n\t */\n\tscorch(world: World, list: FireList, stride: number): void {\n\t\tconst turn = world.tick % stride\n\t\tconst reach = this.damageReach\n\t\tfor (const unit of world.units.values()) {\n\t\t\tif (turnOf(unit.id, stride) !== turn) continue\n\t\t\tif (!unit.alive || unit.hidden || unit.flying || unit.def.kind !== 'unit' || unit.def.footprint) continue\n\t\t\tlet first: Entity | undefined\n\t\t\tfor (const thing of world.spatial.queryStatic(unit.pos.x, unit.pos.z, reach + unit.def.radius, this.found)) {\n\t\t\t\tif (thing === unit || !isBurning(thing) || (first && first.id < thing.id) || edgeDistance(thing, unit) > reach) continue\n\t\t\t\tfirst = thing\n\t\t\t}\n\t\t\tif (!first) continue\n\t\t\tconst at = placeOf(list.ids, first.id)\n\t\t\tthis.hurt.push({ unit, by: list.ids[at] === first.id ? list.by[at] : 0 })\n\t\t}\n\t}\n\n\t/**\n\t * A thing burnt down: told (`burnt`), killed as its `leaves` says (`felled`, or `burnt`, its death's `how` the kind of\n\t * burning), and what it leaves put down where it stood, with its wood where it keeps it\n\t */\n\tburnDown(world: World, entity: Entity, whose: number): void {\n\t\tconst state = entity.get(onFire)\n\t\tif (!entity.alive || !state) return\n\t\tconst burns = this.burnsOf(world, entity) ?? this.base\n\t\tconst by = whose ? world.entities.get(whose) : undefined\n\t\tconst at = { x: entity.pos.x, z: entity.pos.z }\n\t\tconst { owner } = entity\n\t\tconst wood = entity.get(deposit)?.amount\n\t\tconst leaves = burns.leaves\n\t\tthis.ending = { entity, how: state.how }\n\t\ttry {\n\t\t\tworld.kill(entity, by, false, leaves === 'felled' ? 'felled' : 'burnt')\n\t\t} finally {\n\t\t\tthis.ending = undefined\n\t\t}\n\t\tlet left: Entity | undefined\n\t\tif (leaves !== 'felled' && leaves !== 'nothing' && world.registry.units.has(leaves)) {\n\t\t\tleft = world.spawn(leaves, owner, at)\n\t\t\tconst holds = left.get(deposit)\n\t\t\tif (burns.wood && holds && wood !== undefined) holds.amount = wood\n\t\t}\n\t\tworld.events.emit(burnt, { entity: entity.id, how: state.how, ...(whose ? { by: whose } : {}), ...(left ? { left: left.id } : {}) })\n\t}\n}\n\n/** What `setAlight` is told besides who lit it: another kind of burning, another time to burn */\ninterface LightOptions {\n\t/** What kind of burning it is (`BurnsDef.how`): its own when left out */\n\thow?: string\n\t/** Seconds it burns: its own when left out */\n\tseconds?: number\n}\n\n/** The link to the grass's fire of a game (`lightsFoliage`, `FoliageFire.lights`), where it has grass that burns */\ninterface GrassLink {\n\t/** The grass's fire */\n\tfire: FoliageFireRules\n\t/** The layers of it, by their index, that what burns lights (`lightsFoliage`): none for none */\n\ttoGrass: number[]\n\t/** Whether burning grass lights what burns beside it (`FoliageFire.lights`) */\n\tfromGrass: boolean\n}\n\n/** A chance a handler of `burnStart` left, held to 0 to 1 */\nconst held = (chance: number): number => Math.min(1, Math.max(0, chance || 0))\n\n/**\n * Which tick of every `stride` a burning thing tries those about it on: of a hash of its id, so that a forest's trees\n * take their turns spread over the ticks\n */\nconst turnOf = (id: number, stride: number): number => (Math.imul(id, 0x9e3779b1) >>> 16) % stride\n\n/** Where an id is, or would go, in a list of ids in order */\nfunction placeOf(ids: readonly number[], id: number): number {\n\tlet low = 0\n\tlet high = ids.length\n\twhile (low < high) {\n\t\tconst middle = (low + high) >> 1\n\t\tif (ids[middle] < id) low = middle + 1\n\t\telse high = middle\n\t}\n\treturn low\n}\n\n/** A thing put into what burns, in order of the ids, once, with who lit it and when it burns down */\nfunction insertId(list: FireList, id: number, by: number, ends: number): void {\n\tconst at = placeOf(list.ids, id)\n\tif (list.ids[at] === id) return\n\tlist.ids.splice(at, 0, id)\n\tlist.by.splice(at, 0, by)\n\tlist.ends.splice(at, 0, ends)\n}\n\n/** A thing taken out of what burns, where it is there */\nfunction removeId(list: FireList, id: number): void {\n\tconst at = placeOf(list.ids, id)\n\tif (list.ids[at] !== id) return\n\tlist.ids.splice(at, 1)\n\tlist.by.splice(at, 1)\n\tlist.ends.splice(at, 1)\n}\n\n/** The pack's rules of a world's game: none where it has no burning pack. `what` names the call that asks, which throws then */\nfunction rulesOf(world: World, what: string): BurningRules {\n\tconst pack = world.registry.assembly?.rules.packs?.find((each) => each.id === BURNING) as BurningPack | undefined\n\tif (!pack) throw new Error(`${what}: the game has no burning pack (burningPack)`)\n\treturn (pack[RULES] ??= new BurningRules(pack.options as BurningOptions))\n}\n\n/** The pack's rules of a world's game, where it has the pack */\nfunction rulesIfAny(world: World): BurningRules | undefined {\n\tconst pack = world.registry.assembly?.rules.packs?.find((each) => each.id === BURNING) as BurningPack | undefined\n\treturn pack && (pack[RULES] ??= new BurningRules(pack.options as BurningOptions))\n}\n\n/**\n * Sets a thing alight: it burns for its time (`BurnsDef.seconds`), then burns down and leaves what it leaves\n * (`BurnsDef.leaves`). `by`: who lit it, whom its damage and its kill are by; `how`: another kind of burning than its\n * own; `seconds`: another time. The game is asked first (`burnStart`). One that burns already, does not burn, or is\n * past the most that may burn at once (`BurningOptions.maxBurning`) does not catch. One put out before goes on from\n * as far as it had burnt. Whether it caught\n *\n * @beta\n */\nexport function setAlight(world: World, entity: Entity, options: { by?: Entity; how?: string; seconds?: number } = {}): boolean {\n\tconst { by, ...rest } = options\n\treturn rulesOf(world, 'setAlight').light(world, entity, 'light', by?.id ?? 0, undefined, 1, rest)\n}\n\n/**\n * Puts out a thing that burns: it stands, charred as far as it burnt, and may be set alight again. Whether it burnt\n *\n * @beta\n */\nexport function putOut(world: World, entity: Entity): boolean {\n\treturn rulesOf(world, 'putOut').putOut(world, entity)\n}\n\n/**\n * Whether a thing burns now: not one put out, nor one burnt down (or killed by other means while it burnt)\n *\n * @beta\n */\nexport function isBurning(entity: Entity): boolean {\n\tif (!entity.alive) return false\n\tconst state = entity.get(onFire)\n\treturn !!state && state.out === undefined\n}\n\n/**\n * What the rules know of a thing that burns, or burnt and was put out (`burningOf`)\n *\n * @beta\n */\nexport interface BurningInfo {\n\t/** Whether it burns now (`isBurning`): false for one put out, or burnt down */\n\tburning: boolean\n\t/** What kind of burning it is (`BurnsDef.how`) */\n\thow: string\n\t/** How far it has burnt, 0 (just caught) to 1 (about to burn down) */\n\tshare: number\n\t/** Seconds it still burns: 0 for one put out, or burnt down */\n\tleft: number\n\t/** Who set alight the fire it is of, where someone did */\n\tby?: EntityId\n}\n\n/**\n * What the rules know of a thing that burns or burnt (`BurningInfo`): none for one that never caught\n *\n * @beta\n */\nexport function burningOf(world: World, entity: Entity): BurningInfo | undefined {\n\tconst state = entity.get(onFire)\n\tif (!state) return undefined\n\tconst now = state.out ?? world.tick\n\tconst length = Math.max(1, state.ends - state.since)\n\tconst burning = isBurning(entity)\n\tconst info: BurningInfo = {\n\t\tburning,\n\t\thow: state.how,\n\t\tshare: Math.min(1, Math.max(0, (now - state.since) / length)),\n\t\tleft: burning ? Math.max(0, state.ends - world.tick) * world.dt : 0\n\t}\n\tconst list = world.states.has(fireList) ? world.state(fireList) : undefined\n\tconst at = list && state.out === undefined ? placeOf(list.ids, entity.id) : -1\n\tif (list && at >= 0 && list.ids[at] === entity.id && list.by[at]) info.by = list.by[at]\n\treturn info\n}\n\n/** What `burningThings` gives where nothing burns */\nconst NONE: readonly EntityId[] = Object.freeze([])\n\n/**\n * The ids of what burns now, in order: for a game's rules and its computer players (one killed by other means, a\n * catapult's blast, is taken out within a second). Not to be kept or changed: the pack's own list\n *\n * @beta\n */\nexport function burningThings(world: World): readonly EntityId[] {\n\trulesOf(world, 'burningThings')\n\treturn world.states.has(fireList) ? world.state(fireList).ids : NONE\n}\n\n/**\n * Whether a thing burns at all in a world's game (`BurningOptions.burns`, `UnitTypeDef.burns`, trees): false in a game\n * without the burning pack\n *\n * @beta\n */\nexport function canBurn(world: World, entity: Entity): boolean {\n\treturn !!rulesIfAny(world)?.burnsOf(world, entity)\n}\n\n/**\n * The `burn` effect (`EffectTypes.burn`): sets alight what burns where it lands, by the caster (`light`), or puts it\n * out (`putOut`). Over its area (`radius`, `shape`), else the unit it was cast on, else what stands where it landed;\n * of those, what its fields of whom say (`affects`, `kinds`, `tags`, `layers`, `ifBuff`, `only`, `where`, `sort`,\n * `limit`: everything that burns, trees and what is the neutral player's among it, when it says none), and what the\n * game lets it reach (`beforeEffect`)\n */\nconst burnEffect = /* @__PURE__ */ defineEffect({\n\ttype: 'burn',\n\trun(context, effect) {\n\t\tconst { world, caster, target, point } = context\n\t\tconst rules = rulesOf(world, 'burn effect')\n\t\tconst area = effectArea(context, effect)\n\t\tlet things: Entity[]\n\t\tif (area) {\n\t\t\tconst reach = areaReach(area)\n\t\t\tthings = world.spatial\n\t\t\t\t.query(area.x, area.z, reach, [])\n\t\t\t\t.filter((thing) => thing.alive && !thing.hidden && inArea(area, thing.pos, thing.def.radius))\n\t\t} else if (target) things = [target]\n\t\telse\n\t\t\tthings = world.spatial.queryStatic(point.x, point.z, 0.5, []).filter((thing) => {\n\t\t\t\tconst { x, z, hw, hd } = thing.rect\n\t\t\t\treturn thing.alive && Math.abs(point.x - x) < hw && Math.abs(point.z - z) < hd\n\t\t\t})\n\t\t// what it acts on at all (what burns, or burns now to be put out), then what its fields of whom say of them\n\t\tconst putting = effect.act === 'putOut'\n\t\tthings = things.filter((thing) => (putting ? isBurning(thing) : !!rules.burnsOf(world, thing)))\n\t\tthings = effectFilter(context, effect, things, 'all').sort((a, b) => a.id - b.id)\n\t\tfor (const thing of things) {\n\t\t\tif (putting) rules.putOut(world, thing)\n\t\t\telse\n\t\t\t\trules.light(world, thing, 'light', caster.id, undefined, 1, {\n\t\t\t\t\t...(effect.how !== undefined ? { how: effect.how } : {}),\n\t\t\t\t\t...(effect.seconds !== undefined ? { seconds: effect.seconds } : {})\n\t\t\t\t})\n\t\t}\n\t},\n\tfields: [\n\t\t{ path: 'act', kind: 'choice', options: ['light', 'putOut'], hint: 'What it does to what burns where it lands: sets it alight, or puts it out' },\n\t\t{ path: 'how', kind: 'text', hint: 'What kind of burning it sets off, for the screen and the death: its own (burnt) when left out' },\n\t\t{ path: 'seconds', kind: 'number', min: 0, hint: 'Seconds what it sets alight burns: its own when left out' }\n\t]\n})\n\n/** A death of a thing burnt down given its kind of burning (`DeathEvent.how`): what its look's `death.how` goes by */\nconst burntDeath = /* @__PURE__ */ defineHook({\n\thook: 'death',\n\tid: 'burning',\n\trun(world, death) {\n\t\tconst ending = rulesIfAny(world)?.ending\n\t\tif (ending && ending.entity === death.entity) death.how = ending.how\n\t}\n})\n\n/**\n * Things that burn (`BurningOptions`): trees by default (what can be felled), any type that says `burns`\n * (`UnitTypeDef.burns`: a wooden wall, a hut), or what the game decides in code. Set alight by `setAlight`, an ability\n * (`{ type: 'burn', act: 'light' }`), the grass's fire (`FoliageFire.lights`) or one another (`spread`), a thing burns\n * for its seconds and burns down: felled, burnt away, or leaving a thing of its own (a charred stump), with or\n * without its wood. Put out with `putOut`. Its look says what plays on it while it burns (`UnitLook.burning`: fire\n * by default, or a game's own effect for its own kind of burning, `how`). Off unless a game turns it on:\n *\n * export const rules = { ...myGame, packs: [burningPack({ spread: { chance: 0.2 }, damage: 10 })] }\n *\n * What burns is not woken (`world.wake`): a forest costs nothing a tick while nothing in it burns\n *\n * @beta\n */\nexport function burningPack(options: BurningOptions = {}): GamePack {\n\tconst rules = new BurningRules(options)\n\tconst pack: BurningPack = {\n\t\tid: BURNING,\n\t\toptions,\n\t\tsystems: [rules.system],\n\t\thooks: [burntDeath],\n\t\t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OAAO,CAAC,UAAU;EAClB,YAAY,CAAC,QAAQ,QAAQ;EAC7B,QAAQ;GAAC;GAAa;GAAO;EAAU;EACvC,SAAS,CAAC,UAAU;GACnB,QAAQ;CAEH;AACR"}
|
package/dist/bytes.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
//#region src/bytes.ts
|
|
2
|
+
/** Bytes as text that survives JSON: base64 */
|
|
3
|
+
function packBytes(bytes) {
|
|
4
|
+
let text = "";
|
|
5
|
+
for (let i = 0; i < bytes.length; i += 32768) text += String.fromCharCode(...bytes.subarray(i, i + 32768));
|
|
6
|
+
return btoa(text);
|
|
7
|
+
}
|
|
8
|
+
/** Bytes back from `packBytes`. Undefined when there are not `length` of them */
|
|
9
|
+
function unpackBytes(text, length) {
|
|
10
|
+
const binary = atob(text);
|
|
11
|
+
if (binary.length !== length) return void 0;
|
|
12
|
+
const bytes = new Uint8Array(length);
|
|
13
|
+
for (let i = 0; i < length; i++) bytes[i] = binary.charCodeAt(i);
|
|
14
|
+
return bytes;
|
|
15
|
+
}
|
|
16
|
+
/** The bytes of numbers kept in a typed array, as text, see `packBytes` */
|
|
17
|
+
var packArray = (array) => packBytes(new Uint8Array(array.buffer, array.byteOffset, array.byteLength));
|
|
18
|
+
//#endregion
|
|
19
|
+
export { packArray, packBytes, unpackBytes };
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=bytes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bytes.js","names":[],"sources":["../src/bytes.ts"],"sourcesContent":["/** Bytes as text that survives JSON: base64 */\nexport function packBytes(bytes: Uint8Array): string {\n\tlet text = ''\n\tfor (let i = 0; i < bytes.length; i += 0x8000) text += String.fromCharCode(...bytes.subarray(i, i + 0x8000))\n\treturn btoa(text)\n}\n\n/** Bytes back from `packBytes`. Undefined when there are not `length` of them */\nexport function unpackBytes(text: string, length: number): Uint8Array | undefined {\n\tconst binary = atob(text)\n\tif (binary.length !== length) return undefined\n\tconst bytes = new Uint8Array(length)\n\tfor (let i = 0; i < length; i++) bytes[i] = binary.charCodeAt(i)\n\treturn bytes\n}\n\n/** The bytes of numbers kept in a typed array, as text, see `packBytes` */\nexport const packArray = (array: Float32Array | Int32Array | Uint8Array) =>\n\tpackBytes(new Uint8Array(array.buffer, array.byteOffset, array.byteLength))\n"],"mappings":";;AACA,SAAgB,UAAU,OAA2B;CACpD,IAAI,OAAO;CACX,KAAK,IAAI,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK,OAAQ,QAAQ,OAAO,aAAa,GAAG,MAAM,SAAS,GAAG,IAAI,KAAM,CAAC;CAC3G,OAAO,KAAK,IAAI;AACjB;;AAGA,SAAgB,YAAY,MAAc,QAAwC;CACjF,MAAM,SAAS,KAAK,IAAI;CACxB,IAAI,OAAO,WAAW,QAAQ,OAAO,KAAA;CACrC,MAAM,QAAQ,IAAI,WAAW,MAAM;CACnC,KAAK,IAAI,IAAI,GAAG,IAAI,QAAQ,KAAK,MAAM,KAAK,OAAO,WAAW,CAAC;CAC/D,OAAO;AACR;;AAGA,IAAa,aAAa,UACzB,UAAU,IAAI,WAAW,MAAM,QAAQ,MAAM,YAAY,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { UnitTypeDef } from './defs';
|
|
2
|
+
import type { Rules } from './game';
|
|
3
|
+
import type { Registry } from './registry';
|
|
4
|
+
/**
|
|
5
|
+
* One calling a hero may have (`HeroDef.callings`): what it is called and what it plays as, with its picture and
|
|
6
|
+
* colour for the HUD
|
|
7
|
+
*
|
|
8
|
+
* @beta
|
|
9
|
+
*/
|
|
10
|
+
export interface CallingDef {
|
|
11
|
+
/** Its id, what a hero's `callings` and an item's `suits` name it by: `vanguard` */
|
|
12
|
+
id: string;
|
|
13
|
+
/** What the player sees it called: Vanguard */
|
|
14
|
+
name: string;
|
|
15
|
+
/** What a hero of it does, in a few words, for a tooltip */
|
|
16
|
+
description?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Its picture: an address of an image, or the name of a glyph the HUD draws (`registerGlyph`). The HUD draws the
|
|
19
|
+
* engine's own callings by their ids; the first letter of the name for one with neither
|
|
20
|
+
*/
|
|
21
|
+
icon?: string;
|
|
22
|
+
/** The colour it is shown in, a CSS colour: the HUD's accent when left out */
|
|
23
|
+
color?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* How strong a hero is in a calling, from 1 (a little of it) to 3 (what it is above all)
|
|
27
|
+
*
|
|
28
|
+
* @beta
|
|
29
|
+
*/
|
|
30
|
+
export type CallingStrength = 1 | 2 | 3;
|
|
31
|
+
/**
|
|
32
|
+
* The callings the engine brings, those of a classic hero arena game under names of its own. What a game with the
|
|
33
|
+
* heroes pack has when it says none (`HeroSettings.callings`); a game takes them, some of them, changes them or gives
|
|
34
|
+
* its own: `heroesPack({ callings: [...defaultCallings().filter((each) => each.id !== 'roamer'), myOwn] })`. A new list
|
|
35
|
+
* each time it is asked, to change as a game likes
|
|
36
|
+
*
|
|
37
|
+
* @beta
|
|
38
|
+
*/
|
|
39
|
+
export declare function defaultCallings(): CallingDef[];
|
|
40
|
+
/**
|
|
41
|
+
* The callings of a game: those of its heroes pack (`heroesPack({ callings })`), what the rules say of heroes
|
|
42
|
+
* (`RuleSettings.heroes.callings`), or the engine's own (`defaultCallings`). Asked of a registry, the game's settings
|
|
43
|
+
* as they came out; of rules, what they say
|
|
44
|
+
*
|
|
45
|
+
* @beta
|
|
46
|
+
*/
|
|
47
|
+
export declare function callingsOf(game: Registry | Pick<Rules, 'packs' | 'settings'>): readonly CallingDef[];
|
|
48
|
+
/**
|
|
49
|
+
* A hero's callings, strongest first (in the order its type gives those of one strength), each with its definition:
|
|
50
|
+
* one the game has no definition of is named by its id. None for a unit type that is no hero or says none
|
|
51
|
+
*
|
|
52
|
+
* @beta
|
|
53
|
+
*/
|
|
54
|
+
export declare function heroCallings(game: Registry | Pick<Rules, 'packs' | 'settings'>, def: Pick<UnitTypeDef, 'hero'>): {
|
|
55
|
+
calling: CallingDef;
|
|
56
|
+
strength: CallingStrength;
|
|
57
|
+
}[];
|
|
58
|
+
/**
|
|
59
|
+
* How strong a hero's type is in a calling: 0 for one it does not have
|
|
60
|
+
*
|
|
61
|
+
* @beta
|
|
62
|
+
*/
|
|
63
|
+
export declare const callingStrength: (def: Pick<UnitTypeDef, 'hero'>, calling: string) => number;
|
|
64
|
+
/**
|
|
65
|
+
* The rules with their callings in the place of what they were (`callingsOf`): the heroes pack's, made again with them
|
|
66
|
+
* (its own options, rules and parts kept), or the rules' heroes settings for a game without the pack. What a
|
|
67
|
+
* `data.json`'s `callings` (`GameData.callings`) and the Data panel's Callings come to. The rules given are not changed
|
|
68
|
+
*
|
|
69
|
+
* @beta
|
|
70
|
+
*/
|
|
71
|
+
export declare function withCallings(rules: Rules, callings: readonly CallingDef[]): Rules;
|
package/dist/callings.js
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
//#region src/callings.ts
|
|
2
|
+
/**
|
|
3
|
+
* The callings the engine brings, those of a classic hero arena game under names of its own. What a game with the
|
|
4
|
+
* heroes pack has when it says none (`HeroSettings.callings`); a game takes them, some of them, changes them or gives
|
|
5
|
+
* its own: `heroesPack({ callings: [...defaultCallings().filter((each) => each.id !== 'roamer'), myOwn] })`. A new list
|
|
6
|
+
* each time it is asked, to change as a game likes
|
|
7
|
+
*
|
|
8
|
+
* @beta
|
|
9
|
+
*/
|
|
10
|
+
function defaultCallings() {
|
|
11
|
+
return [
|
|
12
|
+
{
|
|
13
|
+
id: "vanguard",
|
|
14
|
+
name: "Vanguard",
|
|
15
|
+
description: "Starts fights and takes the hits",
|
|
16
|
+
icon: "vanguard",
|
|
17
|
+
color: "#c9a66b"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
id: "keeper",
|
|
21
|
+
name: "Keeper",
|
|
22
|
+
description: "Heals, shields and saves allies",
|
|
23
|
+
icon: "keeper",
|
|
24
|
+
color: "#8fd694"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
id: "binder",
|
|
28
|
+
name: "Binder",
|
|
29
|
+
description: "Stuns, roots and holds enemies down",
|
|
30
|
+
icon: "binder",
|
|
31
|
+
color: "#7fb4e6"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
id: "reaver",
|
|
35
|
+
name: "Reaver",
|
|
36
|
+
description: "Lasting damage up close, and drains",
|
|
37
|
+
icon: "reaver",
|
|
38
|
+
color: "#d9734e"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
id: "stalker",
|
|
42
|
+
name: "Stalker",
|
|
43
|
+
description: "Picks off one target and gets out",
|
|
44
|
+
icon: "stalker",
|
|
45
|
+
color: "#b07ad9"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
id: "ranger",
|
|
49
|
+
name: "Ranger",
|
|
50
|
+
description: "Steady damage from range, stronger late",
|
|
51
|
+
icon: "ranger",
|
|
52
|
+
color: "#e6c84e"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
id: "arcanist",
|
|
56
|
+
name: "Arcanist",
|
|
57
|
+
description: "Bursts and areas of damage with spells",
|
|
58
|
+
icon: "arcanist",
|
|
59
|
+
color: "#6fa0ff"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
id: "roamer",
|
|
63
|
+
name: "Roamer",
|
|
64
|
+
description: "Clears camps and moves about the map",
|
|
65
|
+
icon: "roamer",
|
|
66
|
+
color: "#6cbf7a"
|
|
67
|
+
}
|
|
68
|
+
];
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* The callings of a game: those of its heroes pack (`heroesPack({ callings })`), what the rules say of heroes
|
|
72
|
+
* (`RuleSettings.heroes.callings`), or the engine's own (`defaultCallings`). Asked of a registry, the game's settings
|
|
73
|
+
* as they came out; of rules, what they say
|
|
74
|
+
*
|
|
75
|
+
* @beta
|
|
76
|
+
*/
|
|
77
|
+
function callingsOf(game) {
|
|
78
|
+
if ("kinds" in game) return game.settings.heroes.callings;
|
|
79
|
+
const pack = game.packs?.find((each) => each.id === "core.heroes");
|
|
80
|
+
const said = (game.settings?.heroes)?.callings;
|
|
81
|
+
return pack?.options?.callings ?? said ?? pack?.callings ?? defaultCallings();
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* A hero's callings, strongest first (in the order its type gives those of one strength), each with its definition:
|
|
85
|
+
* one the game has no definition of is named by its id. None for a unit type that is no hero or says none
|
|
86
|
+
*
|
|
87
|
+
* @beta
|
|
88
|
+
*/
|
|
89
|
+
function heroCallings(game, def) {
|
|
90
|
+
const said = def.hero?.callings;
|
|
91
|
+
if (!said) return [];
|
|
92
|
+
const known = callingsOf(game);
|
|
93
|
+
return Object.entries(said).map(([id, strength]) => ({
|
|
94
|
+
calling: known.find((each) => each.id === id) ?? {
|
|
95
|
+
id,
|
|
96
|
+
name: id
|
|
97
|
+
},
|
|
98
|
+
strength: clampStrength(strength)
|
|
99
|
+
})).sort((a, b) => b.strength - a.strength);
|
|
100
|
+
}
|
|
101
|
+
/** A strength as a calling has it, 1 to 3, whatever a data file said */
|
|
102
|
+
var clampStrength = (strength) => Math.min(Math.max(Math.round(strength), 1), 3);
|
|
103
|
+
/**
|
|
104
|
+
* How strong a hero's type is in a calling: 0 for one it does not have
|
|
105
|
+
*
|
|
106
|
+
* @beta
|
|
107
|
+
*/
|
|
108
|
+
var callingStrength = (def, calling) => def.hero?.callings?.[calling] ?? 0;
|
|
109
|
+
/**
|
|
110
|
+
* The rules with their callings in the place of what they were (`callingsOf`): the heroes pack's, made again with them
|
|
111
|
+
* (its own options, rules and parts kept), or the rules' heroes settings for a game without the pack. What a
|
|
112
|
+
* `data.json`'s `callings` (`GameData.callings`) and the Data panel's Callings come to. The rules given are not changed
|
|
113
|
+
*
|
|
114
|
+
* @beta
|
|
115
|
+
*/
|
|
116
|
+
function withCallings(rules, callings) {
|
|
117
|
+
const list = [...callings];
|
|
118
|
+
const packs = rules.packs ?? [];
|
|
119
|
+
const pack = packs.find((each) => each.id === "core.heroes");
|
|
120
|
+
if (!pack) return {
|
|
121
|
+
...rules,
|
|
122
|
+
settings: {
|
|
123
|
+
...rules.settings,
|
|
124
|
+
heroes: {
|
|
125
|
+
...rules.settings?.heroes,
|
|
126
|
+
callings: list
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
const own = pack.settings;
|
|
131
|
+
const remade = {
|
|
132
|
+
...pack,
|
|
133
|
+
options: {
|
|
134
|
+
...pack.options,
|
|
135
|
+
callings: list
|
|
136
|
+
},
|
|
137
|
+
callings: list,
|
|
138
|
+
settings: (settings) => {
|
|
139
|
+
const said = own?.call(pack, settings) ?? {};
|
|
140
|
+
return {
|
|
141
|
+
...said,
|
|
142
|
+
heroes: {
|
|
143
|
+
...said.heroes,
|
|
144
|
+
callings: list
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
return {
|
|
150
|
+
...rules,
|
|
151
|
+
packs: packs.map((each) => each === pack ? remade : each)
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
//#endregion
|
|
155
|
+
export { callingStrength, callingsOf, defaultCallings, heroCallings, withCallings };
|
|
156
|
+
|
|
157
|
+
//# sourceMappingURL=callings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"callings.js","names":[],"sources":["../src/callings.ts"],"sourcesContent":["import type { UnitTypeDef } from './defs'\nimport type { Rules } from './game'\nimport type { Registry } from './registry'\n\n/*\n * Callings (items-and-spells plan, phase 4): what a hero is good at, as Dota 2 has its roles. A hero is not boxed into\n * one: it has several, each with a strength from 1 to 3 (`HeroDef.callings`: Duskblade is Stalker 3 and Roamer 2).\n * They lock nothing; they guide: the shop's suggestions and filters, the tooltips, a computer player's picks. They are\n * data, so a game renames them, adds to them or replaces them (`heroesPack({ callings })`)\n */\n\n/**\n * One calling a hero may have (`HeroDef.callings`): what it is called and what it plays as, with its picture and\n * colour for the HUD\n *\n * @beta\n */\nexport interface CallingDef {\n\t/** Its id, what a hero's `callings` and an item's `suits` name it by: `vanguard` */\n\tid: string\n\t/** What the player sees it called: Vanguard */\n\tname: string\n\t/** What a hero of it does, in a few words, for a tooltip */\n\tdescription?: string\n\t/**\n\t * Its picture: an address of an image, or the name of a glyph the HUD draws (`registerGlyph`). The HUD draws the\n\t * engine's own callings by their ids; the first letter of the name for one with neither\n\t */\n\ticon?: string\n\t/** The colour it is shown in, a CSS colour: the HUD's accent when left out */\n\tcolor?: string\n}\n\n/**\n * How strong a hero is in a calling, from 1 (a little of it) to 3 (what it is above all)\n *\n * @beta\n */\nexport type CallingStrength = 1 | 2 | 3\n\n/**\n * The callings the engine brings, those of a classic hero arena game under names of its own. What a game with the\n * heroes pack has when it says none (`HeroSettings.callings`); a game takes them, some of them, changes them or gives\n * its own: `heroesPack({ callings: [...defaultCallings().filter((each) => each.id !== 'roamer'), myOwn] })`. A new list\n * each time it is asked, to change as a game likes\n *\n * @beta\n */\nexport function defaultCallings(): CallingDef[] {\n\treturn [\n\t\t{ id: 'vanguard', name: 'Vanguard', description: 'Starts fights and takes the hits', icon: 'vanguard', color: '#c9a66b' },\n\t\t{ id: 'keeper', name: 'Keeper', description: 'Heals, shields and saves allies', icon: 'keeper', color: '#8fd694' },\n\t\t{ id: 'binder', name: 'Binder', description: 'Stuns, roots and holds enemies down', icon: 'binder', color: '#7fb4e6' },\n\t\t{ id: 'reaver', name: 'Reaver', description: 'Lasting damage up close, and drains', icon: 'reaver', color: '#d9734e' },\n\t\t{ id: 'stalker', name: 'Stalker', description: 'Picks off one target and gets out', icon: 'stalker', color: '#b07ad9' },\n\t\t{ id: 'ranger', name: 'Ranger', description: 'Steady damage from range, stronger late', icon: 'ranger', color: '#e6c84e' },\n\t\t{ id: 'arcanist', name: 'Arcanist', description: 'Bursts and areas of damage with spells', icon: 'arcanist', color: '#6fa0ff' },\n\t\t{ id: 'roamer', name: 'Roamer', description: 'Clears camps and moves about the map', icon: 'roamer', color: '#6cbf7a' }\n\t]\n}\n\n/**\n * The callings of a game: those of its heroes pack (`heroesPack({ callings })`), what the rules say of heroes\n * (`RuleSettings.heroes.callings`), or the engine's own (`defaultCallings`). Asked of a registry, the game's settings\n * as they came out; of rules, what they say\n *\n * @beta\n */\nexport function callingsOf(game: Registry | Pick<Rules, 'packs' | 'settings'>): readonly CallingDef[] {\n\tif ('kinds' in game) return game.settings.heroes.callings\n\tconst pack = game.packs?.find((each) => each.id === 'core.heroes') as { callings?: readonly CallingDef[]; options?: { callings?: readonly CallingDef[] } } | undefined\n\tconst said = (game.settings?.heroes as { callings?: readonly CallingDef[] } | undefined)?.callings\n\treturn pack?.options?.callings ?? said ?? pack?.callings ?? defaultCallings()\n}\n\n/**\n * A hero's callings, strongest first (in the order its type gives those of one strength), each with its definition:\n * one the game has no definition of is named by its id. None for a unit type that is no hero or says none\n *\n * @beta\n */\nexport function heroCallings(\n\tgame: Registry | Pick<Rules, 'packs' | 'settings'>,\n\tdef: Pick<UnitTypeDef, 'hero'>\n): { calling: CallingDef; strength: CallingStrength }[] {\n\tconst said = def.hero?.callings\n\tif (!said) return []\n\tconst known = callingsOf(game)\n\treturn Object.entries(said)\n\t\t.map(([id, strength]) => ({ calling: known.find((each) => each.id === id) ?? { id, name: id }, strength: clampStrength(strength) }))\n\t\t.sort((a, b) => b.strength - a.strength)\n}\n\n/** A strength as a calling has it, 1 to 3, whatever a data file said */\nconst clampStrength = (strength: number): CallingStrength => Math.min(Math.max(Math.round(strength), 1), 3) as CallingStrength\n\n/**\n * How strong a hero's type is in a calling: 0 for one it does not have\n *\n * @beta\n */\nexport const callingStrength = (def: Pick<UnitTypeDef, 'hero'>, calling: string): number => def.hero?.callings?.[calling] ?? 0\n\n/**\n * The rules with their callings in the place of what they were (`callingsOf`): the heroes pack's, made again with them\n * (its own options, rules and parts kept), or the rules' heroes settings for a game without the pack. What a\n * `data.json`'s `callings` (`GameData.callings`) and the Data panel's Callings come to. The rules given are not changed\n *\n * @beta\n */\nexport function withCallings(rules: Rules, callings: readonly CallingDef[]): Rules {\n\tconst list = [...callings]\n\tconst packs = rules.packs ?? []\n\tconst pack = packs.find((each) => each.id === 'core.heroes') as\n\t\t| (NonNullable<Rules['packs']>[number] & { options?: Record<string, unknown>; callings?: readonly CallingDef[] })\n\t\t| undefined\n\tif (!pack) return { ...rules, settings: { ...rules.settings, heroes: { ...rules.settings?.heroes, callings: list } } as Rules['settings'] }\n\tconst own = pack.settings\n\tconst remade = {\n\t\t...pack,\n\t\toptions: { ...pack.options, callings: list },\n\t\tcallings: list,\n\t\tsettings: (settings: Parameters<NonNullable<typeof own>>[0]) => {\n\t\t\tconst said = own?.call(pack, settings) ?? {}\n\t\t\treturn { ...said, heroes: { ...said.heroes, callings: list } } as ReturnType<NonNullable<typeof own>>\n\t\t}\n\t}\n\treturn { ...rules, packs: packs.map((each) => (each === pack ? remade : each)) }\n}\n"],"mappings":";;;;;;;;;AAgDA,SAAgB,kBAAgC;CAC/C,OAAO;EACN;GAAE,IAAI;GAAY,MAAM;GAAY,aAAa;GAAoC,MAAM;GAAY,OAAO;EAAU;EACxH;GAAE,IAAI;GAAU,MAAM;GAAU,aAAa;GAAmC,MAAM;GAAU,OAAO;EAAU;EACjH;GAAE,IAAI;GAAU,MAAM;GAAU,aAAa;GAAuC,MAAM;GAAU,OAAO;EAAU;EACrH;GAAE,IAAI;GAAU,MAAM;GAAU,aAAa;GAAuC,MAAM;GAAU,OAAO;EAAU;EACrH;GAAE,IAAI;GAAW,MAAM;GAAW,aAAa;GAAqC,MAAM;GAAW,OAAO;EAAU;EACtH;GAAE,IAAI;GAAU,MAAM;GAAU,aAAa;GAA2C,MAAM;GAAU,OAAO;EAAU;EACzH;GAAE,IAAI;GAAY,MAAM;GAAY,aAAa;GAA0C,MAAM;GAAY,OAAO;EAAU;EAC9H;GAAE,IAAI;GAAU,MAAM;GAAU,aAAa;GAAwC,MAAM;GAAU,OAAO;EAAU;CACvH;AACD;;;;;;;;AASA,S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D,MAAM,OAAO,KAAK,KAAK,MAAM,QAAQ,KAAK,CAAC;GAC3C,OAAO;IAAE,GAAG;IAAM,QAAQ;KAAE,GAAG,KAAK;KAAQ,UAAU;IAAK;GAAE;EAC9D;CACD;CACA,OAAO;EAAE,GAAG;EAAO,OAAO,MAAM,KAAK,SAAU,SAAS,OAAO,SAAS,IAAK;CAAE;AAChF"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { PlayerId } from './entity';
|
|
2
|
+
import type { Step } from './sequences';
|
|
3
|
+
import type { World } from './world';
|
|
4
|
+
/**
|
|
5
|
+
* The rules move one player's camera, as Warcraft III's triggers do: a pan, a part of the map it stays in, a shake.
|
|
6
|
+
* The camera is the screen's, so nothing of this changes the game; what the rules say comes at the same moment of the
|
|
7
|
+
* game on that player's screen alone, and a replay has it, being said by the rules or by a command. What lasts (`lock`,
|
|
8
|
+
* `bounds`) is kept in the world, so that a save and a player who comes back have it; what is over at once (`pan`,
|
|
9
|
+
* `shake`) is an event
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* A part of the map, in cells: what a camera looks at, at most
|
|
13
|
+
*
|
|
14
|
+
* @beta
|
|
15
|
+
*/
|
|
16
|
+
export interface CameraRect {
|
|
17
|
+
/** The west edge of the part, in cells */
|
|
18
|
+
minX: number;
|
|
19
|
+
/** The north edge of the part, in cells */
|
|
20
|
+
minZ: number;
|
|
21
|
+
/** The east edge of the part, in cells */
|
|
22
|
+
maxX: number;
|
|
23
|
+
/** The south edge of the part, in cells */
|
|
24
|
+
maxZ: number;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* What the rules may say of a player's camera (`cameraFor`, the `camera` command). Any of them, together
|
|
28
|
+
*
|
|
29
|
+
* @beta
|
|
30
|
+
*/
|
|
31
|
+
export interface CameraOrder {
|
|
32
|
+
/** Moves the view over to a point, in `seconds` (1 when left out), by an ease of the view's by name (`inOutQuad` when left out) */
|
|
33
|
+
pan?: {
|
|
34
|
+
x: number;
|
|
35
|
+
z: number;
|
|
36
|
+
seconds?: number;
|
|
37
|
+
ease?: string;
|
|
38
|
+
};
|
|
39
|
+
/** Keeps the view in this part of the map until told otherwise (`RtsCamera.lock`). `null` lets it go (`RtsCamera.free`) */
|
|
40
|
+
lock?: CameraRect | null;
|
|
41
|
+
/** Where the player may look from now on, under any `lock` (`RtsCamera.bounds`). `null` goes back to what the game's view says */
|
|
42
|
+
bounds?: CameraRect | null;
|
|
43
|
+
/** Shakes the view, about 1 for a big blast. Where it looks when no `x` and `z`, felt less the farther off they are (`RtsCamera.shake`) */
|
|
44
|
+
shake?: {
|
|
45
|
+
strength: number;
|
|
46
|
+
x?: number;
|
|
47
|
+
z?: number;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* What the rules said of a player's camera that lasts (`Snapshot.camera`)
|
|
52
|
+
*
|
|
53
|
+
* @beta
|
|
54
|
+
*/
|
|
55
|
+
export interface SeatCamera {
|
|
56
|
+
/** The part the view is kept in until told otherwise */
|
|
57
|
+
lock?: CameraRect;
|
|
58
|
+
/** The part the player may look at, under any `lock` */
|
|
59
|
+
bounds?: CameraRect;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* The rules say something of one player's camera: on their screen alone, the same moment of the game each time.
|
|
63
|
+
* `cameraFor(world, 1, { pan: { x: 40, z: 60, seconds: 2 }, shake: { strength: 0.5 } })`
|
|
64
|
+
*
|
|
65
|
+
* @throws Invalid for an order that is not one (a part of the map with its minimum over its maximum)
|
|
66
|
+
* @beta
|
|
67
|
+
*/
|
|
68
|
+
export declare function cameraFor(world: World, player: PlayerId, order: CameraOrder): void;
|
|
69
|
+
/**
|
|
70
|
+
* A step of a sequence that says something of a player's camera (see `cameraFor`): `[wait(4), cameraStep(1, { shake: { strength: 1 } })]`
|
|
71
|
+
*
|
|
72
|
+
* @beta
|
|
73
|
+
*/
|
|
74
|
+
export declare const cameraStep: <D = undefined>(player: PlayerId, order: CameraOrder) => Step<D>;
|
|
75
|
+
/** A pan or a shake, to the player it is for */
|
|
76
|
+
export declare const toldCamera: import("./replication").ReplicatedEvent;
|
|
77
|
+
/** What lasts of what the rules said of the camera, to the player it is about; never a computer's, which has no view */
|
|
78
|
+
export declare const cameraPart: import("./replication").SnapshotField<keyof import(".").Snapshot>;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { defineComponent } from "./components.js";
|
|
2
|
+
import { cameraOrdered } from "./engineEvents.js";
|
|
3
|
+
import { replicateEvent, snapshotField } from "./replication.js";
|
|
4
|
+
import { Invalid, id, number, object, optional, string } from "./fields.js";
|
|
5
|
+
//#region src/cameraOrders.ts
|
|
6
|
+
var rect = object({
|
|
7
|
+
minX: number,
|
|
8
|
+
minZ: number,
|
|
9
|
+
maxX: number,
|
|
10
|
+
maxZ: number
|
|
11
|
+
});
|
|
12
|
+
/** A part of the map, or `null` for none, or nothing said */
|
|
13
|
+
var rectOrNone = (value, path) => {
|
|
14
|
+
if (value === void 0 || value === null) return value;
|
|
15
|
+
const checked = rect(value, path);
|
|
16
|
+
if (checked.minX > checked.maxX || checked.minZ > checked.maxZ) throw new Invalid(`${path} is a part of the map with its minimum under its maximum`);
|
|
17
|
+
return checked;
|
|
18
|
+
};
|
|
19
|
+
var notUnderZero = (value, path) => {
|
|
20
|
+
const checked = number(value, path);
|
|
21
|
+
if (checked < 0) throw new Invalid(`${path} is not under 0`);
|
|
22
|
+
return checked;
|
|
23
|
+
};
|
|
24
|
+
var orderFields = {
|
|
25
|
+
pan: optional(object({
|
|
26
|
+
x: number,
|
|
27
|
+
z: number,
|
|
28
|
+
seconds: optional(notUnderZero),
|
|
29
|
+
ease: optional(string)
|
|
30
|
+
})),
|
|
31
|
+
lock: rectOrNone,
|
|
32
|
+
bounds: rectOrNone,
|
|
33
|
+
shake: optional(object({
|
|
34
|
+
strength: notUnderZero,
|
|
35
|
+
x: optional(number),
|
|
36
|
+
z: optional(number)
|
|
37
|
+
}))
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* The fields of the `camera` command: an order (`CameraOrder`), and whose camera it is about, the sender's when left out
|
|
41
|
+
*
|
|
42
|
+
* @internal
|
|
43
|
+
*/
|
|
44
|
+
var cameraCommandFields = {
|
|
45
|
+
seat: optional(id),
|
|
46
|
+
...orderFields
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* What lasts of what the rules said of each player's camera: only there once they said any, so a game that says none is as it was
|
|
50
|
+
*
|
|
51
|
+
* @internal
|
|
52
|
+
*/
|
|
53
|
+
var seatCameras = defineComponent({
|
|
54
|
+
id: "core.seatCameras",
|
|
55
|
+
default: () => ({})
|
|
56
|
+
});
|
|
57
|
+
function carryOut(world, player, order) {
|
|
58
|
+
const { lock, bounds, pan, shake } = order;
|
|
59
|
+
if (lock !== void 0 || bounds !== void 0) {
|
|
60
|
+
const all = world.state(seatCameras);
|
|
61
|
+
const seat = { ...all[player] };
|
|
62
|
+
if (lock) seat.lock = lock;
|
|
63
|
+
else if (lock === null) delete seat.lock;
|
|
64
|
+
if (bounds) seat.bounds = bounds;
|
|
65
|
+
else if (bounds === null) delete seat.bounds;
|
|
66
|
+
const next = { ...all };
|
|
67
|
+
if (seat.lock || seat.bounds) next[player] = seat;
|
|
68
|
+
else delete next[player];
|
|
69
|
+
world.setState(seatCameras, next);
|
|
70
|
+
}
|
|
71
|
+
if (pan || shake) world.events.emit(cameraOrdered, {
|
|
72
|
+
player,
|
|
73
|
+
...pan && { pan },
|
|
74
|
+
...shake && { shake }
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* The rules say something of one player's camera: on their screen alone, the same moment of the game each time.
|
|
79
|
+
* `cameraFor(world, 1, { pan: { x: 40, z: 60, seconds: 2 }, shake: { strength: 0.5 } })`
|
|
80
|
+
*
|
|
81
|
+
* @throws Invalid for an order that is not one (a part of the map with its minimum over its maximum)
|
|
82
|
+
* @beta
|
|
83
|
+
*/
|
|
84
|
+
function cameraFor(world, player, order) {
|
|
85
|
+
carryOut(world, player, object(orderFields)(order, "camera"));
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* A step of a sequence that says something of a player's camera (see `cameraFor`): `[wait(4), cameraStep(1, { shake: { strength: 1 } })]`
|
|
89
|
+
*
|
|
90
|
+
* @beta
|
|
91
|
+
*/
|
|
92
|
+
var cameraStep = (player, order) => (world) => cameraFor(world, player, order);
|
|
93
|
+
/**
|
|
94
|
+
* The `camera` command carried out: a seat speaks for its own camera alone, so one that names another's is refused
|
|
95
|
+
*
|
|
96
|
+
* @internal
|
|
97
|
+
*/
|
|
98
|
+
function cameraCommanded(world, player, command) {
|
|
99
|
+
const { seat = player, ...order } = command;
|
|
100
|
+
if (seat !== player) world.message(player, "cannotDoThat");
|
|
101
|
+
else carryOut(world, player, order);
|
|
102
|
+
}
|
|
103
|
+
/** A pan or a shake, to the player it is for */
|
|
104
|
+
var toldCamera = replicateEvent(cameraOrdered, "camera", ({ player, pan, shake }, view) => player === view.player ? {
|
|
105
|
+
type: "camera",
|
|
106
|
+
...pan && { pan },
|
|
107
|
+
...shake && { shake }
|
|
108
|
+
} : void 0);
|
|
109
|
+
/** What lasts of what the rules said of the camera, to the player it is about; never a computer's, which has no view */
|
|
110
|
+
var cameraPart = snapshotField("camera", ({ world, player, forComputer }) => forComputer || !world.states.has(seatCameras) ? void 0 : world.state(seatCameras)[player]);
|
|
111
|
+
//#endregion
|
|
112
|
+
export { cameraCommandFields, cameraCommanded, cameraFor, cameraPart, cameraStep, seatCameras, toldCamera };
|
|
113
|
+
|
|
114
|
+
//# sourceMappingURL=cameraOrders.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cameraOrders.js","names":[],"sources":["../src/cameraOrders.ts"],"sourcesContent":["import { cameraOrdered } from '#engine/engineEvents'\nimport { defineComponent } from './components'\nimport type { PlayerId } from './entity'\nimport { type Check, type Checked, Invalid, id, number, object, optional, string } from './fields'\nimport { replicateEvent, snapshotField } from './replication'\nimport type { Step } from './sequences'\nimport type { World } from './world'\n\n/**\n * The rules move one player's camera, as Warcraft III's triggers do: a pan, a part of the map it stays in, a shake.\n * The camera is the screen's, so nothing of this changes the game; what the rules say comes at the same moment of the\n * game on that player's screen alone, and a replay has it, being said by the rules or by a command. What lasts (`lock`,\n * `bounds`) is kept in the world, so that a save and a player who comes back have it; what is over at once (`pan`,\n * `shake`) is an event\n */\n\n/**\n * A part of the map, in cells: what a camera looks at, at most\n *\n * @beta\n */\nexport interface CameraRect {\n\t/** The west edge of the part, in cells */\n\tminX: number\n\t/** The north edge of the part, in cells */\n\tminZ: number\n\t/** The east edge of the part, in cells */\n\tmaxX: number\n\t/** The south edge of the part, in cells */\n\tmaxZ: number\n}\n\n/**\n * What the rules may say of a player's camera (`cameraFor`, the `camera` command). Any of them, together\n *\n * @beta\n */\nexport interface CameraOrder {\n\t/** Moves the view over to a point, in `seconds` (1 when left out), by an ease of the view's by name (`inOutQuad` when left out) */\n\tpan?: { x: number; z: number; seconds?: number; ease?: string }\n\t/** Keeps the view in this part of the map until told otherwise (`RtsCamera.lock`). `null` lets it go (`RtsCamera.free`) */\n\tlock?: CameraRect | null\n\t/** Where the player may look from now on, under any `lock` (`RtsCamera.bounds`). `null` goes back to what the game's view says */\n\tbounds?: CameraRect | null\n\t/** Shakes the view, about 1 for a big blast. Where it looks when no `x` and `z`, felt less the farther off they are (`RtsCamera.shake`) */\n\tshake?: { strength: number; x?: number; z?: number }\n}\n\n/**\n * What the rules said of a player's camera that lasts (`Snapshot.camera`)\n *\n * @beta\n */\nexport interface SeatCamera {\n\t/** The part the view is kept in until told otherwise */\n\tlock?: CameraRect\n\t/** The part the player may look at, under any `lock` */\n\tbounds?: CameraRect\n}\n\nconst rect = object({ minX: number, minZ: number, maxX: number, maxZ: number })\n\n/** A part of the map, or `null` for none, or nothing said */\nconst rectOrNone: Check<CameraRect | null | undefined> = (value, path) => {\n\tif (value === undefined || value === null) return value\n\tconst checked = rect(value, path)\n\tif (checked.minX > checked.maxX || checked.minZ > checked.maxZ) throw new Invalid(`${path} is a part of the map with its minimum under its maximum`)\n\treturn checked\n}\n\nconst notUnderZero: Check<number> = (value, path) => {\n\tconst checked = number(value, path)\n\tif (checked < 0) throw new Invalid(`${path} is not under 0`)\n\treturn checked\n}\n\nconst orderFields = {\n\tpan: optional(object({ x: number, z: number, seconds: optional(notUnderZero), ease: optional(string) })),\n\tlock: rectOrNone,\n\tbounds: rectOrNone,\n\tshake: optional(object({ strength: notUnderZero, x: optional(number), z: optional(number) }))\n}\n\n/**\n * The fields of the `camera` command: an order (`CameraOrder`), and whose camera it is about, the sender's when left out\n *\n * @internal\n */\nexport const cameraCommandFields = { seat: optional(id), ...orderFields }\n\n/**\n * What lasts of what the rules said of each player's camera: only there once they said any, so a game that says none is as it was\n *\n * @internal\n */\nexport const seatCameras = defineComponent<Record<PlayerId, SeatCamera>>({ id: 'core.seatCameras', default: () => ({}) })\n\nfunction carryOut(world: World, player: PlayerId, order: Checked<typeof orderFields>): void {\n\tconst { lock, bounds, pan, shake } = order\n\tif (lock !== undefined || bounds !== undefined) {\n\t\tconst all = world.state(seatCameras)\n\t\tconst seat: SeatCamera = { ...all[player] }\n\t\tif (lock) seat.lock = lock\n\t\telse if (lock === null) delete seat.lock\n\t\tif (bounds) seat.bounds = bounds\n\t\telse if (bounds === null) delete seat.bounds\n\t\tconst next = { ...all }\n\t\tif (seat.lock || seat.bounds) next[player] = seat\n\t\telse delete next[player]\n\t\tworld.setState(seatCameras, next)\n\t}\n\tif (pan || shake) world.events.emit(cameraOrdered, { player, ...(pan && { pan }), ...(shake && { shake }) })\n}\n\n/**\n * The rules say something of one player's camera: on their screen alone, the same moment of the game each time.\n * `cameraFor(world, 1, { pan: { x: 40, z: 60, seconds: 2 }, shake: { strength: 0.5 } })`\n *\n * @throws Invalid for an order that is not one (a part of the map with its minimum over its maximum)\n * @beta\n */\nexport function cameraFor(world: World, player: PlayerId, order: CameraOrder): void {\n\tcarryOut(world, player, object(orderFields)(order, 'camera'))\n}\n\n/**\n * A step of a sequence that says something of a player's camera (see `cameraFor`): `[wait(4), cameraStep(1, { shake: { strength: 1 } })]`\n *\n * @beta\n */\nexport const cameraStep =\n\t<D = undefined>(player: PlayerId, order: CameraOrder): Step<D> =>\n\t(world) =>\n\t\tcameraFor(world, player, order)\n\n/**\n * The `camera` command carried out: a seat speaks for its own camera alone, so one that names another's is refused\n *\n * @internal\n */\nexport function cameraCommanded(world: World, player: PlayerId, command: Checked<typeof cameraCommandFields>): void {\n\tconst { seat = player, ...order } = command\n\tif (seat !== player) world.message(player, 'cannotDoThat')\n\telse carryOut(world, player, order)\n}\n\n/** A pan or a shake, to the player it is for */\nexport const toldCamera = replicateEvent(cameraOrdered, 'camera', ({ player, pan, shake }, view) =>\n\tplayer === view.player ? { type: 'camera', ...(pan && { pan }), ...(shake && { shake }) } : undefined\n)\n\n/** What lasts of what the rules said of the camera, to the player it is about; never a computer's, which has no view */\nexport const cameraPart = snapshotField('camera', ({ world, player, forComputer }) =>\n\tforComputer || !world.states.has(seatCameras) ? undefined : world.state(seatCameras)[player]\n)\n"],"mappings":";;;;;AA4DA,IAAM,OAAO,OAAO;CAAE,MAAM;CAAQ,MAAM;CAAQ,MAAM;CAAQ,MAAM;AAAO,CAAC;;AAG9E,IAAM,cAAoD,OAAO,SAAS;CACzE,IAAI,UAAU,KAAA,KAAa,UAAU,MAAM,OAAO;CAClD,MAAM,UAAU,KAAK,OAAO,IAAI;CAChC,IAAI,QAAQ,OAAO,QAAQ,QAAQ,QAAQ,OAAO,QAAQ,MAAM,MAAM,IAAI,QAAQ,GAAG,KAAK,yDAAyD;CACnJ,OAAO;AACR;AAEA,IAAM,gBAA+B,OAAO,SAAS;CACpD,MAAM,UAAU,OAAO,OAAO,IAAI;CAClC,IAAI,UAAU,GAAG,MAAM,IAAI,QAAQ,GAAG,KAAK,gBAAgB;CAC3D,OAAO;AACR;AAEA,IAAM,cAAc;CACnB,KAAK,SAAS,OAAO;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