@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":"camps.js","names":["campReturnedEvent","campClearedEvent"],"sources":["../src/camps.ts"],"sourcesContent":["/**\n * Creep camps: groups of neutral hostile creeps that guard a spot. They go for whoever comes close or attacks one of\n * them, all of them at once, keep a list of who hurt them (`Camp.aggro`) and fight it out to the end of their leash,\n * give up a chase that brings no blow (`CampSettings.chaseTime`), go home a while after the last blow (`resetAfter`), heal\n * on the way back, and sleep at night. A feature a game turns on by taking `campHooks` and `campListeners` (the heroes\n * pack has them); the engine itself knows only the player the creeps belong to. Without it, creeps are units like any\n * other, that stand where they are put and fight back. See docs/creeps.md\n */\nimport { campCleared as campClearedEvent, campReturned as campReturnedEvent, damaged } from '#engine/engineEvents'\nimport { engagedLike, engageWith, isBlocked, isShunned, roomFor, shun } from './engagement'\nimport { defineComponent } from './components'\nimport { at, declaredAt, lowerChain } from './defs'\nimport { edgeDistance, type Entity, type EntityId, type PlayerId, moving, fighting } from './entity'\nimport { defineListener, type ListenerDef } from './events'\nimport { defineHook, type HookDef, type TargetScore } from './hooks'\nimport { dist, type Vec2 } from './math'\nimport { createOrder, giveOrder } from './orders/queue'\nimport { freeToHelp } from './orders/idle'\nimport { acquireTarget, canAttack, canSee, disengage, engage } from './systems/combat'\nimport { halt, moveTo } from './systems/movement'\nimport type { System } from './registry'\nimport type { World } from './world'\nimport { cos, sin } from './exactMath'\nimport type { SessionView } from './replication'\nimport type { CampInfo } from './session/protocol'\n\n/**\n * Someone a camp is fighting, on its list (`Camp.aggro`)\n *\n * @beta\n */\nexport interface CampAggro {\n\t/** Who it is */\n\tid: EntityId\n\t/** The damage it has done the camp's creeps: the most is gone for first, then the nearest (`campTarget`) */\n\tthreat: number\n\t/** When it last hit one of the camp's creeps or was hit by one, in seconds of the game */\n\tlastHitAt: number\n}\n\n/**\n * A group of creeps guarding a spot\n *\n * @beta\n */\nexport interface Camp {\n\t/** The camp's number: its place in the world's camps, plus one */\n\tid: number\n\t/** Where the middle of the camp is, east-west in cells */\n\tx: number\n\t/** Where the middle of the camp is, north-south in cells */\n\tz: number\n\t/** Levels of its creeps added up, as it was set up */\n\tlevel: number\n\t/** How far from the camp's centre its creeps fight: what goes past it is let go of (`CampSettings.leash`) */\n\tleash: number\n\t/** The entity ids of its creeps */\n\tmembers: EntityId[]\n\t/**\n\t * Who the camp is fighting, as its creeps pick (`campTarget`): fed by every hit on one of them (the damage done, as\n\t * threat) and by their own hits, rid of the dead and of what is past the leash, emptied as the camp goes home\n\t */\n\taggro: CampAggro[]\n\t/** The last it went for: what wakes one of them wakes the rest */\n\talarm: EntityId\n\t/** When one of its creeps last hit or was hit, in seconds of the game: it goes home `resetAfter` after. None at peace */\n\tfoughtAt?: number\n\t/** Seconds a creep of it chases what it neither hits nor is hit by before it lets it go: the rules' `chaseTime` when left out */\n\tchaseTime?: number\n\t/** Seconds without a blow before it goes home: the rules' `resetAfter` when left out */\n\tresetAfter?: number\n\t/** Whether all of it answers a hit at once: the rules' `helpAtOnce` when left out */\n\thelpAtOnce?: boolean\n\t/** The name it was given on the map, for the rules to find it by (`campNamed`) */\n\tname?: string\n\t/** Who its creeps are, and of what types, for it to come back the same (see `respawn`). None in saves of before */\n\towner?: PlayerId\n\t/** The unit type ids of its creeps, kept for it to come back the same after `respawn` */\n\ttypes?: string[]\n\t/**\n\t * Seconds after it was cleared that it comes back, its creeps where they stood, as a hero arena game's jungle camps\n\t * do. Never when left out, as in classic RTS games. Set it from code as the game goes (`campsOf`) to change it\n\t */\n\trespawn?: number\n\t/** When it was found empty, in seconds of the game: it comes back `respawn` seconds after */\n\tclearedAt?: number\n}\n\n/**\n * Ties a creep to the camp it guards\n *\n * @beta\n */\nexport interface CampMember {\n\t/** The number of the camp the creep guards */\n\tcamp: number\n\t/** Where the creep returns to when the camp gives up the fight */\n\thome: Vec2\n\t/** On its way back after the camp gave up the fight. Deaf to everything but a hit, and to that for `RETURN_GRACE` */\n\treturning: boolean\n\t/** When it turned for home, in seconds of the game */\n\treturningAt?: number\n\t/** Where it was attacked from by something it could not see, and is going to look */\n\tsearching: Vec2 | null\n\t/** When it last traded a blow with what it goes for, or took it up: a chase with none for `chaseTime` is given up */\n\tblowAt?: number\n}\n\n/**\n * Seconds a creep on its way home is deaf even to a hit: so that one led to the end of its leash does not turn on the\n * first arrow in its back and come straight back out\n *\n * @beta\n */\nexport const RETURN_GRACE = 1.5\n\n/** How far past the leash a creep may itself stand, fighting what is just inside it */\nconst LEASH_SLACK = 2\n\n/**\n * On a creep: the camp it belongs to\n *\n * @beta\n */\nexport const campMember = defineComponent<CampMember>({ id: 'core.camp' })\n\n/**\n * The camps of a world, by id less one\n *\n * @beta\n */\nexport const camps = defineComponent<Camp[]>({ id: 'core.camps', default: () => [] })\n\n/**\n * Gives the camps of a world, the list `camps` holds\n *\n * @internal\n */\nexport const campsOf = (world: World): Camp[] => world.state(camps)\n\n/**\n * The camp of this name, as it was given one on the map. It is there for as long as the game, with or without its creeps\n *\n * @beta\n */\nexport const campNamed = (world: World, name: string): Camp | undefined => campsOf(world).find((camp) => camp.name === name)\n\n/**\n * Where the creeps of a camp stand: the first one in the middle, the rest in a ring around it, facing out\n *\n * @beta\n */\nexport function campLayout(point: Vec2, count: number): { x: number; z: number; facing: number }[] {\n\treturn Array.from({ length: count }, (_, i) => {\n\t\tconst angle = (i / Math.max(count - 1, 1)) * Math.PI * 2\n\t\tconst spread = i === 0 ? 0 : 1.6\n\t\treturn { x: point.x + sin(angle) * spread, z: point.z + cos(angle) * spread, facing: angle }\n\t})\n}\n\n/**\n * Puts a camp of creeps on the map. The creeps stand around the point and come back to it\n *\n * @beta\n */\nexport function spawnCamp(world: World, owner: PlayerId, point: Vec2, types: string[], leash = world.settings.camps.leash): Camp {\n\tconst all = campsOf(world)\n\tconst level = types.reduce((sum, type) => sum + (world.registry.unit(type).level ?? 1), 0)\n\tconst camp: Camp = { id: all.length + 1, x: point.x, z: point.z, level, leash, members: [], aggro: [], alarm: 0, owner, types: [...types] }\n\tconst { respawn } = world.settings.camps\n\tif (respawn !== undefined) camp.respawn = respawn\n\tall.push(camp)\n\tpopulate(world, camp, owner, types)\n\treturn camp\n}\n\n/** Puts a camp's creeps where they stand, as its members */\nfunction populate(world: World, camp: Camp, owner: PlayerId, types: string[]): void {\n\tconst layout = campLayout(camp, types.length)\n\tcamp.members = []\n\ttypes.forEach((type, i) => {\n\t\tconst { x, z, facing } = layout[i]\n\t\tconst creep = world.spawn(type, owner, { x, z }, { facing })\n\t\tcreep.set(campMember, { camp: camp.id, home: { x: creep.pos.x, z: creep.pos.z }, returning: false, searching: null })\n\t\tcamp.members.push(creep.id)\n\t})\n}\n\n/**\n * Brings a cleared camp back now, the same creeps where they stood (`campReturned`): from code, or when its time comes\n *\n * @beta\n */\nexport function respawnCamp(world: World, camp: Camp): void {\n\tif (!camp.types?.length || camp.owner === undefined) return\n\tpopulate(world, camp, camp.owner, camp.types)\n\tcamp.alarm = 0\n\tcamp.aggro = []\n\tcamp.foughtAt = undefined\n\tcamp.clearedAt = undefined\n\tworld.events.emit(campReturnedEvent, { camp })\n}\n\n/** Whether every creep of a camp is gone */\nconst emptied = (world: World, camp: Camp) => camp.members.every((id) => !world.get(id)?.alive)\n\n/**\n * Camps that come back (`Camp.respawn`): told when one is found empty (`campCleared`), and brought back once its time is\n * up, when nobody but its own kind stands in it. Once a second, at the rate of 30 ticks\n *\n * @internal\n */\nexport const campRespawnSystem: System = {\n\tname: 'campRespawn',\n\tphase: 'cleanup',\n\tevery: 30,\n\tupdate(world: World): void {\n\t\tfor (const camp of campsOf(world)) {\n\t\t\tif (!emptied(world, camp)) continue\n\t\t\tif (camp.clearedAt === undefined) {\n\t\t\t\tcamp.clearedAt = world.time\n\t\t\t\tworld.events.emit(campClearedEvent, { camp })\n\t\t\t}\n\t\t\tif (camp.respawn === undefined || world.time - camp.clearedAt < camp.respawn) continue\n\t\t\t// not on top of whoever stands there: it waits for them to go\n\t\t\tconst there = world.spatial.query(camp.x, camp.z, 3, found)\n\t\t\tif (there.some((entity) => entity.alive && entity.isUnit && entity.owner !== camp.owner)) continue\n\t\t\trespawnCamp(world, camp)\n\t\t}\n\t}\n}\n\n/** Part of their health creeps regain per second on the way home */\nconst RETREAT_HEALING = 0.1\nconst found: Entity[] = []\n\n/** Uses an ability that hits what is around the creep, when that is worth it */\nfunction lashOut(world: World, entity: Entity): boolean {\n\tfor (const state of entity.abilities) {\n\t\tif (state.level < 1 || state.cooldown > 0) continue\n\t\tconst ability = world.registry.ability(state.id)\n\t\tif (ability.target !== 'none' || at(ability.manaCost, state.level) > entity.mana) continue\n\t\tconst radius = lowerChain(ability.effects).reduce(\n\t\t\t(max, effect) => Math.max(max, effect.type === 'damage' ? declaredAt(effect.radius, state.level) : 0),\n\t\t\t0\n\t\t)\n\t\tif (!radius) continue\n\t\tlet caught = 0\n\t\tfor (const other of world.spatial.query(entity.pos.x, entity.pos.z, radius, found)) {\n\t\t\tif (other.isUnit && canAttack(world, entity, other) && edgeDistance(entity, other) <= radius) caught++\n\t\t}\n\t\tif (caught < 2) continue\n\t\tgiveOrder(world, entity, createOrder(world, { type: 'cast', ability: ability.id }))\n\t\treturn true\n\t}\n\treturn false\n}\n\n/** The camp's own `chaseTime`, or the rules' */\nconst chaseTimeOf = (world: World, camp: Camp) => camp.chaseTime ?? world.settings.camps.chaseTime\n/** The camp's own `resetAfter`, or the rules' */\nconst resetAfterOf = (world: World, camp: Camp) => camp.resetAfter ?? world.settings.camps.resetAfter\n/** The camp's own `helpAtOnce`, or the rules' */\nconst helpsAtOnce = (world: World, camp: Camp) => camp.helpAtOnce ?? world.settings.camps.helpAtOnce\n\n/** Whether the creep may go for it: an enemy it sees, inside the camp's leash, and not one it leaves alone for now (`shun`) */\nfunction mayChase(world: World, entity: Entity, camp: Camp, other: Entity | undefined): other is Entity {\n\treturn (\n\t\t!!other &&\n\t\tother.alive &&\n\t\tcanAttack(world, entity, other) &&\n\t\tcanSee(world, entity, other) &&\n\t\tdist(other.pos, camp) <= camp.leash &&\n\t\t!isShunned(world, entity, other)\n\t)\n}\n\n/** The camp's list rid of the dead, the gone and what stands past the leash */\nfunction prune(world: World, camp: Camp): void {\n\tlet kept = 0\n\tfor (const entry of camp.aggro) {\n\t\tconst other = world.get(entry.id)\n\t\tif (other?.alive && dist(other.pos, camp) <= camp.leash) camp.aggro[kept++] = entry\n\t}\n\tcamp.aggro.length = kept\n}\n\n/** What the `targetScore` hook is asked with for each on a camp's list: one, used again */\nconst scoring: TargetScore = { attacker: undefined!, target: undefined!, distance: 0, engaged: 0, room: 0, score: 0 }\n\n/**\n * What a creep of the camp goes for of the camp's list (`Camp.aggro`): the most threat, then the nearest, the\n * `targetScore` hook having the last word; nothing it leaves alone for now (`shun`: it could not get at it, or chased it\n * too long), cannot see or attack, or that stands past the leash. None when the list has nothing for it\n *\n * @beta\n */\nexport function campTarget(world: World, entity: Entity, camp: Camp): Entity | undefined {\n\tprune(world, camp)\n\tconst hooked = world.hooks.has('targetScore')\n\tlet best: Entity | undefined\n\tlet bestScore = -Infinity\n\tfor (const entry of camp.aggro) {\n\t\tconst other = world.get(entry.id)\n\t\tif (!mayChase(world, entity, camp, other)) continue\n\t\tconst distance = edgeDistance(entity, other)\n\t\tlet score = entry.threat * 1000 - distance\n\t\tif (hooked) {\n\t\t\tscoring.attacker = entity\n\t\t\tscoring.target = other\n\t\t\tscoring.distance = distance\n\t\t\tscoring.engaged = engagedLike(world, other, entity)\n\t\t\tscoring.room = roomFor(world, other, entity)\n\t\t\tscoring.score = score\n\t\t\tscore = world.hooks.run('targetScore', scoring).score\n\t\t}\n\t\tif (score > bestScore) {\n\t\t\tbestScore = score\n\t\t\tbest = other\n\t\t}\n\t}\n\treturn best\n}\n\n/** Its entry on the camp's list, put on it with no threat if it was not */\nfunction entryOf(world: World, camp: Camp, other: Entity): CampAggro {\n\tlet entry = camp.aggro.find((each) => each.id === other.id)\n\tif (!entry) camp.aggro.push((entry = { id: other.id, threat: 0, lastHitAt: world.time }))\n\treturn entry\n}\n\n/** The creep goes for it now: put on the camp's list, the camp's alarm, the chase timed from now */\nfunction take(world: World, entity: Entity, member: CampMember, camp: Camp, target: Entity): void {\n\tengageWith(world, entity, target)\n\tentity.get(fighting)!.autoTarget = target.id\n\tmember.searching = null\n\tmember.blowAt = world.time\n\tcamp.alarm = target.id\n\tentryOf(world, camp, target)\n}\n\n/** Whether a creep of the camp on its way home takes a fight again: once it has been on the way `RETURN_GRACE` seconds */\nconst pastGrace = (world: World, member: CampMember) => world.time - (member.returningAt ?? -Infinity) >= RETURN_GRACE\n\n/**\n * Every creep of the camp free to fight goes for the best of the camp's list now, not at its next look round: those\n * asleep woken, those fighting left to it, those on their way home only past `RETURN_GRACE`, those with an order of their\n * player's (a hold) or standing down (`CombatState.passive`) not at all\n */\nfunction rally(world: World, camp: Camp): void {\n\tfor (const id of camp.members) {\n\t\tconst creep = world.get(id)\n\t\tconst member = creep?.get(campMember)\n\t\tif (!creep?.alive || !member || !freeToHelp(creep)) continue\n\t\tif (member.returning && !pastGrace(world, member)) continue\n\t\tconst combat = creep.get(fighting)!\n\t\tif (combat.autoTarget && world.get(combat.autoTarget)?.alive) continue\n\t\tconst next = campTarget(world, creep, camp)\n\t\tif (!next) continue\n\t\tcreep.asleep = false\n\t\tmember.returning = false\n\t\ttake(world, creep, member, camp, next)\n\t}\n}\n\n/**\n * Puts someone on a camp's list as if it had done the camp `threat` damage (`Camp.aggro`): a taunt, or a game's own\n * reason for the creeps to come. The camp comes at once, as for a hit, where it helps at once (`CampSettings.helpAtOnce`)\n *\n * @beta\n */\nexport function aggroCamp(world: World, camp: Camp, entity: Entity, threat = 0): void {\n\tconst entry = entryOf(world, camp, entity)\n\tentry.threat += threat\n\tentry.lastHitAt = world.time\n\tcamp.foughtAt = world.time\n\tif (!world.get(camp.alarm)) camp.alarm = entity.id\n\tif (helpsAtOnce(world, camp)) rally(world, camp)\n}\n\n/**\n * The camp gives up the fight now, as it does `resetAfter` after the last blow: its list emptied, every creep of it on\n * the way home\n *\n * @beta\n */\nexport function resetCamp(world: World, camp: Camp): void {\n\tcamp.aggro.length = 0\n\tcamp.foughtAt = undefined\n\tcamp.alarm = 0\n\tfor (const id of camp.members) {\n\t\tconst creep = world.get(id)\n\t\tconst member = creep?.get(campMember)\n\t\tif (creep?.alive && member && !member.returning) goHome(world, creep, member)\n\t}\n}\n\n/** A creep of the camp lets go of what it fought and walks home, healing as it goes */\nfunction goHome(world: World, entity: Entity, member: CampMember): void {\n\tconst combat = entity.get(fighting)\n\tif (combat) combat.autoTarget = 0\n\tdisengage(world, entity)\n\tmember.searching = null\n\tif (entity.get(moving) && dist(entity.pos, member.home) > 1.5) {\n\t\tmember.returning = true\n\t\tmember.returningAt = world.time\n\t\tmoveTo(world, entity, member.home)\n\t}\n}\n\n/**\n * A hit on a creep of a camp, or by one: the camp's list fed (the damage done, as threat), its fight kept up, a chase of\n * the one hit or hitting timed anew, and the camp brought at once (`helpAtOnce`). A creep on its way home turns when hit\n * past `RETURN_GRACE`\n */\nfunction hit(world: World, target: Entity, source: Entity | undefined, amount: number): void {\n\tif (!source || !world.areEnemies(source.owner, target.owner)) return\n\tconst struck = target.get(campMember)\n\tconst camp = struck && campsOf(world)[struck.camp - 1]\n\tif (struck && camp) {\n\t\tconst entry = entryOf(world, camp, source)\n\t\tentry.threat += amount\n\t\tentry.lastHitAt = world.time\n\t\tcamp.foughtAt = world.time\n\t\tif (!world.get(camp.alarm)) camp.alarm = source.id\n\t\tif (target.get(fighting)?.autoTarget === source.id) struck.blowAt = world.time\n\t\tif (target.alive && struck.returning && pastGrace(world, struck)) struck.returning = false\n\t\tif (helpsAtOnce(world, camp)) rally(world, camp)\n\t}\n\tconst striker = source.get(campMember)\n\tconst own = striker && campsOf(world)[striker.camp - 1]\n\tif (striker && own) {\n\t\tentryOf(world, own, target).lastHitAt = world.time\n\t\town.foughtAt = world.time\n\t\tif (source.get(fighting)?.autoTarget === target.id) striker.blowAt = world.time\n\t}\n}\n\n/**\n * What creeps do: guard their camp. They go for whoever comes close or attacks one of them, the most threat on the\n * camp's list first; give up a chase that brings no blow for `chaseTime`, and what goes past the leash from the camp's\n * centre; wait where they stand while the camp's fight is on, and go home `resetAfter` after its last blow, healing on\n * the way. At night they sleep at home\n */\nfunction guardCamp(world: World, entity: Entity, dt: number): void {\n\tconst member = entity.get(campMember)!\n\tconst combat = entity.get(fighting)!\n\tconst camp = campsOf(world)[member.camp - 1]\n\tconst m = entity.get(moving)\n\n\tif (entity.asleep) {\n\t\t// what wakes one of them sounds the alarm for the rest\n\t\tif (world.night && !combat.lastAttacker && !world.get(camp.alarm)) return\n\t\tentity.asleep = false\n\t}\n\n\tif (member.returning) {\n\t\tentity.health = Math.min(entity.health + entity.maxHealth * RETREAT_HEALING * dt, entity.maxHealth)\n\t\tif (m && m.status === 'moving') return\n\t\tif (m && dist(entity.pos, member.home) > 1.5 && m.status !== 'failed') {\n\t\t\tmoveTo(world, entity, member.home)\n\t\t\treturn\n\t\t}\n\t\tmember.returning = false\n\t\tmember.returningAt = undefined\n\t\tcombat.lastAttacker = 0\n\t\tif (camp.alarm && !world.get(camp.alarm)) camp.alarm = 0\n\t\treturn\n\t}\n\n\tlet dropped = false\n\tif (combat.autoTarget) {\n\t\tconst target = world.get(combat.autoTarget)\n\t\t// what went past the leash from the camp's centre, or led this one past it\n\t\tconst tooFar = !target || dist(target.pos, camp) > camp.leash || dist(entity.pos, camp) > camp.leash + LEASH_SLACK\n\t\tif (!tooFar && lashOut(world, entity)) return\n\t\tlet result = tooFar ? 'invalid' : engage(world, entity, target, dt, !!m)\n\t\t// held up on the way, or after it too long without a blow either way: the next of the list then\n\t\tconst stale = world.time - (member.blowAt ?? world.time) > chaseTimeOf(world, camp)\n\t\tif (result === 'chasing' && target && (stale || isBlocked(world, entity, target))) {\n\t\t\tshun(world, entity, target)\n\t\t\tresult = 'invalid'\n\t\t}\n\t\tif (result === 'attacking' || result === 'chasing') return\n\t\tcombat.autoTarget = 0\n\t\tdisengage(world, entity)\n\t\tdropped = true\n\t}\n\n\t// the next at once when it let one go, else at its look round, every fourth tick\n\tif (!dropped && (world.tick + entity.id) % 4 !== 0) return\n\tlet next = campTarget(world, entity, camp)\n\tif (!next) {\n\t\tconst seen = acquireTarget(world, entity)\n\t\tif (mayChase(world, entity, camp, seen)) next = seen\n\t}\n\tconst hitter = world.get(combat.lastAttacker)\n\tif (!next && mayChase(world, entity, camp, hitter)) next = hitter\n\tconst alarm = world.get(camp.alarm)\n\tif (!next && mayChase(world, entity, camp, alarm)) next = alarm\n\t// hit by something it cannot see: go and look where that came from\n\tif (!next && m && hitter && canAttack(world, entity, hitter) && !isShunned(world, entity, hitter) && dist(hitter.pos, camp) <= camp.leash) {\n\t\tmember.searching = { x: hitter.pos.x, z: hitter.pos.z }\n\t\tmoveTo(world, entity, member.searching)\n\t}\n\tcombat.lastAttacker = 0\n\tif (next) {\n\t\ttake(world, entity, member, camp, next)\n\t\treturn\n\t}\n\tif (member.searching && m?.status === 'moving' && dist(entity.pos, camp) <= camp.leash) return\n\tmember.searching = null\n\t// the camp's fight is on while one of it trades blows: it waits where it stands, for what comes next\n\tif (camp.foughtAt !== undefined && world.time - camp.foughtAt < resetAfterOf(world, camp)) {\n\t\tif (m?.status === 'moving') halt(world, entity)\n\t\treturn\n\t}\n\tif (camp.foughtAt !== undefined || camp.aggro.length) {\n\t\tcamp.aggro.length = 0\n\t\tcamp.foughtAt = undefined\n\t}\n\tconst intruder = world.get(camp.alarm)\n\tif (camp.alarm && (!intruder || dist(intruder.pos, camp) > camp.leash)) camp.alarm = 0\n\tgoHome(world, entity, member)\n\tif (world.night && world.settings.camps.sleep && !member.returning && !camp.alarm) entity.asleep = true\n}\n\n/**\n * What turns camps on: creeps of a camp guard it instead of doing what idle units do\n *\n * @internal\n */\nexport const campHooks: HookDef[] = [\n\tdefineHook({\n\t\thook: 'idle',\n\t\tid: 'guardCamp',\n\t\trun(world, event) {\n\t\t\tif (event.handled || !event.fights || !event.entity.has(campMember)) return\n\t\t\tguardCamp(world, event.entity, event.dt)\n\t\t\tevent.handled = true\n\t\t}\n\t})\n]\n\n/**\n * What feeds the camps' lists (`Camp.aggro`): every hit on a creep of a camp, or by one, as it is told (`damaged`). The\n * heroes pack's, with `campHooks`\n *\n * @internal\n */\nexport const campListeners: ListenerDef[] = [\n\tdefineListener({\n\t\tevent: damaged,\n\t\tid: 'campAggro',\n\t\trun: (world, { target, source, amount }) => hit(world, target, source, amount)\n\t})\n]\n\n/** What a seat says of the camps, kept up to date once a tick (`campsFor`) */\nconst CAMPS = {}\n\n/**\n * The camps as a seat's player knows them (`GameSession.camps`): where they are and how strong, and which their team\n * has seen empty. Worked out once a tick, as the minimap asks every frame: the same list and objects every time, kept\n * up to date, so it is to read, not to keep\n *\n * @beta\n */\nexport function campsFor(view: SessionView): readonly CampInfo[] {\n\tconst kept = view.keep(CAMPS, () => ({ at: -1, infos: [] as CampInfo[] }))\n\tconst { world } = view\n\tif (kept.at === world.tick) return kept.infos\n\tkept.at = world.tick\n\tconst all = campsOf(world)\n\tconst { cleared } = view.memory\n\tconst occupied = (members: readonly number[]) => members.some((id) => !!world.get(id))\n\tfor (let i = 0; i < all.length; i++) {\n\t\tconst camp = all[i]\n\t\tconst known = cleared.indexOf(camp.id)\n\t\t// an empty camp is only known to be empty once someone has looked\n\t\tif (known < 0 && view.sees(camp.x, camp.z) && !occupied(camp.members)) cleared.push(camp.id)\n\t\telse if (known >= 0 && view.sees(camp.x, camp.z) && occupied(camp.members)) {\n\t\t\t// back, as camps that come back do: known once someone looks again\n\t\t\tcleared.splice(known, 1)\n\t\t}\n\t\tconst info = (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
|
/**
|
|
14
|
-
* A capture point given in code (`
|
|
14
|
+
* A capture point given in code (`capturePack`'s `points`); one placed on the map says the same with its fields
|
|
15
15
|
*
|
|
16
16
|
* @beta
|
|
17
17
|
*/
|
|
18
18
|
export interface CapturePoint {
|
|
19
19
|
/** Unique among the game's points: what the events name it by, and `capturePoint` */
|
|
20
20
|
id: string;
|
|
21
|
+
/** What the point is called to the players; nothing when left out */
|
|
21
22
|
name?: string;
|
|
23
|
+
/** Where the middle of the point is, in cells */
|
|
22
24
|
at: Vec2;
|
|
23
25
|
/** How far around its middle counts, in cells: 4 when left out */
|
|
24
26
|
radius?: number;
|
|
@@ -36,15 +38,25 @@ export interface CapturePoint {
|
|
|
36
38
|
* @beta
|
|
37
39
|
*/
|
|
38
40
|
export interface CaptureState {
|
|
41
|
+
/** The point's id, which the events name it by */
|
|
39
42
|
id: string;
|
|
43
|
+
/** What the point is called to the players, where it has a name */
|
|
40
44
|
name?: string;
|
|
45
|
+
/** Where the middle of the point is, east-west in cells */
|
|
41
46
|
x: number;
|
|
47
|
+
/** Where the middle of the point is, north-south in cells */
|
|
42
48
|
z: number;
|
|
49
|
+
/** How far around its middle counts as in it, in cells */
|
|
43
50
|
radius: number;
|
|
51
|
+
/** Seconds a side alone in it takes to make it its own */
|
|
44
52
|
time: number;
|
|
53
|
+
/** What the point does while two sides stand in it */
|
|
45
54
|
contested: Contested;
|
|
55
|
+
/** The player it belongs to; null while nobody holds it */
|
|
46
56
|
owner: PlayerId | null;
|
|
57
|
+
/** The team taking it now; null while nobody is */
|
|
47
58
|
by: number | null;
|
|
59
|
+
/** How far the taker has got, 0..1 */
|
|
48
60
|
progress: number;
|
|
49
61
|
}
|
|
50
62
|
/**
|
|
@@ -107,7 +119,7 @@ export declare const captureOf: (world: World, id: string) => CaptureState | und
|
|
|
107
119
|
*/
|
|
108
120
|
export declare function capturePoint(world: World, id: string, owner: PlayerId | null): boolean;
|
|
109
121
|
/**
|
|
110
|
-
* What a game turns capture points on with (`
|
|
122
|
+
* What a game turns capture points on with (`capturePack`)
|
|
111
123
|
*
|
|
112
124
|
* @beta
|
|
113
125
|
*/
|
|
@@ -128,4 +140,4 @@ export interface CaptureOptions {
|
|
|
128
140
|
*
|
|
129
141
|
* @beta
|
|
130
142
|
*/
|
|
131
|
-
export declare function
|
|
143
|
+
export declare function capturePack(options?: CaptureOptions): GamePack;
|
package/dist/capture.js
ADDED
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
import { defineComponent } from "./components.js";
|
|
2
|
+
import { defineEngineEvent } from "./events.js";
|
|
3
|
+
//#region src/capture.ts
|
|
4
|
+
/**
|
|
5
|
+
* The kind of thing on the map a capture point is placed as (the editor's `captureKind`)
|
|
6
|
+
*
|
|
7
|
+
* @beta
|
|
8
|
+
*/
|
|
9
|
+
var CAPTURE_KIND = "capture";
|
|
10
|
+
/**
|
|
11
|
+
* The fields of a capture point on the map, as the editor's kind offers them and the rules read them: its reach, its
|
|
12
|
+
* time, what it does contested, and whose it is at the start
|
|
13
|
+
*
|
|
14
|
+
* @beta
|
|
15
|
+
*/
|
|
16
|
+
var CAPTURE_FIELDS = [
|
|
17
|
+
{
|
|
18
|
+
id: "radius",
|
|
19
|
+
name: "Reach",
|
|
20
|
+
kind: "number",
|
|
21
|
+
default: 4,
|
|
22
|
+
min: 1,
|
|
23
|
+
max: 24,
|
|
24
|
+
step: .5,
|
|
25
|
+
hint: "How far around its middle counts, in cells"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
id: "time",
|
|
29
|
+
name: "Seconds to take",
|
|
30
|
+
kind: "number",
|
|
31
|
+
default: 10,
|
|
32
|
+
min: 1,
|
|
33
|
+
max: 300,
|
|
34
|
+
step: 1,
|
|
35
|
+
hint: "Seconds a side alone in it takes to make it its own"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
id: "contested",
|
|
39
|
+
name: "While contested",
|
|
40
|
+
kind: "choice",
|
|
41
|
+
default: "pause",
|
|
42
|
+
options: [
|
|
43
|
+
{
|
|
44
|
+
value: "pause",
|
|
45
|
+
label: "Nothing moves"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
value: "reset",
|
|
49
|
+
label: "What was gained is lost"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
value: "majority",
|
|
53
|
+
label: "The larger side takes it"
|
|
54
|
+
}
|
|
55
|
+
],
|
|
56
|
+
hint: "What it does while two sides stand in it"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
id: "owner",
|
|
60
|
+
name: "Whose at the start",
|
|
61
|
+
kind: "player",
|
|
62
|
+
hint: "Nobody’s when left out"
|
|
63
|
+
}
|
|
64
|
+
];
|
|
65
|
+
/**
|
|
66
|
+
* The capture points of the world, by id: whose each is and who is taking it. Kept in a save; in the game's report
|
|
67
|
+
* as `captures` (a list), for the HUD and the computer
|
|
68
|
+
*
|
|
69
|
+
* @beta
|
|
70
|
+
*/
|
|
71
|
+
var captures = defineComponent({
|
|
72
|
+
id: "core.captures",
|
|
73
|
+
default: () => ({})
|
|
74
|
+
});
|
|
75
|
+
/** Whether the points were set up from the code's list and the map: once a world, kept in a save */
|
|
76
|
+
var ready = defineComponent({
|
|
77
|
+
id: "core.capturesReady",
|
|
78
|
+
default: () => false
|
|
79
|
+
});
|
|
80
|
+
/**
|
|
81
|
+
* A point changed hands: whose it is now (nobody's for one let go by code), and whose it was
|
|
82
|
+
*
|
|
83
|
+
* @beta
|
|
84
|
+
*/
|
|
85
|
+
var captured = defineEngineEvent({
|
|
86
|
+
id: "core.captured",
|
|
87
|
+
replicate: "everyone"
|
|
88
|
+
});
|
|
89
|
+
/**
|
|
90
|
+
* A side (a team) began taking a point, or none is any more
|
|
91
|
+
*
|
|
92
|
+
* @beta
|
|
93
|
+
*/
|
|
94
|
+
var capturing = defineEngineEvent({
|
|
95
|
+
id: "core.capturing",
|
|
96
|
+
replicate: "everyone"
|
|
97
|
+
});
|
|
98
|
+
/**
|
|
99
|
+
* The area of a point, as the rules watch it (`world.areas`)
|
|
100
|
+
*
|
|
101
|
+
* @internal
|
|
102
|
+
*/
|
|
103
|
+
var captureAreaOf = (id) => `core.capture.${id}`;
|
|
104
|
+
/**
|
|
105
|
+
* The capture points of a world, as they stand
|
|
106
|
+
*
|
|
107
|
+
* @beta
|
|
108
|
+
*/
|
|
109
|
+
var capturesOf = (world) => Object.values(world.state(captures));
|
|
110
|
+
/**
|
|
111
|
+
* A point by id, or nothing for an id the world has not got
|
|
112
|
+
*
|
|
113
|
+
* @beta
|
|
114
|
+
*/
|
|
115
|
+
var captureOf = (world, id) => world.state(captures)[id];
|
|
116
|
+
/**
|
|
117
|
+
* Gives a point to a player, or to nobody, from the rules: its progress forgotten, and `captured` said
|
|
118
|
+
*
|
|
119
|
+
* @beta
|
|
120
|
+
*/
|
|
121
|
+
function capturePoint(world, id, owner) {
|
|
122
|
+
const point = world.state(captures)[id];
|
|
123
|
+
if (!point) return false;
|
|
124
|
+
const from = point.owner;
|
|
125
|
+
point.owner = owner;
|
|
126
|
+
point.by = null;
|
|
127
|
+
point.progress = 0;
|
|
128
|
+
world.events.emit(captured, {
|
|
129
|
+
id,
|
|
130
|
+
owner,
|
|
131
|
+
from
|
|
132
|
+
});
|
|
133
|
+
return true;
|
|
134
|
+
}
|
|
135
|
+
/** A thing of the map as a point: named as the thing is, else by its number */
|
|
136
|
+
function pointOfThing(thing) {
|
|
137
|
+
const data = thing.data;
|
|
138
|
+
const owner = typeof data.owner === "number" && data.owner > 0 ? data.owner : void 0;
|
|
139
|
+
return {
|
|
140
|
+
id: thing.name ?? `capture-${thing.id}`,
|
|
141
|
+
name: thing.name,
|
|
142
|
+
at: {
|
|
143
|
+
x: thing.x,
|
|
144
|
+
z: thing.z
|
|
145
|
+
},
|
|
146
|
+
radius: data.radius,
|
|
147
|
+
time: data.time,
|
|
148
|
+
contested: data.contested,
|
|
149
|
+
owner
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
/** Puts the points of the code and the map in the world: once, as the first count comes (a loaded one has them) */
|
|
153
|
+
function setUp(world, options) {
|
|
154
|
+
const state = world.state(captures);
|
|
155
|
+
const things = world.map.things(options.kind ?? "capture", CAPTURE_FIELDS).map(pointOfThing);
|
|
156
|
+
for (const point of [...options.points ?? [], ...things]) state[point.id] ??= {
|
|
157
|
+
id: point.id,
|
|
158
|
+
...point.name && { name: point.name },
|
|
159
|
+
x: point.at.x,
|
|
160
|
+
z: point.at.z,
|
|
161
|
+
radius: point.radius ?? 4,
|
|
162
|
+
time: Math.max(point.time ?? 10, .1),
|
|
163
|
+
contested: point.contested ?? "pause",
|
|
164
|
+
owner: point.owner ?? null,
|
|
165
|
+
by: null,
|
|
166
|
+
progress: 0
|
|
167
|
+
};
|
|
168
|
+
world.setState(ready, true);
|
|
169
|
+
}
|
|
170
|
+
/** The area of a point, as the rules watch it: added as the first count comes (a loaded world brings its own back) */
|
|
171
|
+
function areaOf(world, point) {
|
|
172
|
+
const id = captureAreaOf(point.id);
|
|
173
|
+
if (!world.areas.has(id)) {
|
|
174
|
+
const area = {
|
|
175
|
+
id,
|
|
176
|
+
shape: {
|
|
177
|
+
kind: "circle",
|
|
178
|
+
x: point.x,
|
|
179
|
+
z: point.z,
|
|
180
|
+
radius: point.radius
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
world.areas.add(area);
|
|
184
|
+
}
|
|
185
|
+
return id;
|
|
186
|
+
}
|
|
187
|
+
/** Who stands in a point, by team: how many, and one of them to own it */
|
|
188
|
+
var standing = /* @__PURE__ */ new Map();
|
|
189
|
+
/** A count of who stands in each point, and what follows: progress, a side let go of, a point changed hands */
|
|
190
|
+
function count(world, dt) {
|
|
191
|
+
for (const point of Object.values(world.state(captures))) {
|
|
192
|
+
standing.clear();
|
|
193
|
+
for (const entity of world.areas.inside(areaOf(world, point))) {
|
|
194
|
+
if (!entity.alive || entity.hidden || entity.def.kind !== "unit") continue;
|
|
195
|
+
const player = world.player(entity.owner);
|
|
196
|
+
if (player.neutral) continue;
|
|
197
|
+
const seen = standing.get(player.team);
|
|
198
|
+
if (seen) seen.count++;
|
|
199
|
+
else standing.set(player.team, {
|
|
200
|
+
count: 1,
|
|
201
|
+
player: entity.owner
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
if (!standing.size) continue;
|
|
205
|
+
let actor;
|
|
206
|
+
if (standing.size === 1) {
|
|
207
|
+
const [team, each] = [...standing][0];
|
|
208
|
+
actor = {
|
|
209
|
+
team,
|
|
210
|
+
player: each.player
|
|
211
|
+
};
|
|
212
|
+
} else if (point.contested === "reset") {
|
|
213
|
+
if (point.progress > 0 || point.by !== null) {
|
|
214
|
+
point.progress = 0;
|
|
215
|
+
point.by = null;
|
|
216
|
+
world.events.emit(capturing, {
|
|
217
|
+
id: point.id,
|
|
218
|
+
by: null
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
continue;
|
|
222
|
+
} else if (point.contested === "majority") {
|
|
223
|
+
let best;
|
|
224
|
+
let tie = false;
|
|
225
|
+
for (const entry of standing) if (!best || entry[1].count > best[1].count) {
|
|
226
|
+
best = entry;
|
|
227
|
+
tie = false;
|
|
228
|
+
} else if (entry[1].count === best[1].count) tie = true;
|
|
229
|
+
if (!best || tie) continue;
|
|
230
|
+
actor = {
|
|
231
|
+
team: best[0],
|
|
232
|
+
player: best[1].player
|
|
233
|
+
};
|
|
234
|
+
} else continue;
|
|
235
|
+
const step = dt / point.time;
|
|
236
|
+
const ownerTeam = point.owner === null ? null : world.player(point.owner).team;
|
|
237
|
+
if (actor.team === ownerTeam) {
|
|
238
|
+
if (point.progress > 0) point.progress = Math.max(0, point.progress - step);
|
|
239
|
+
if (point.progress === 0 && point.by !== null) {
|
|
240
|
+
point.by = null;
|
|
241
|
+
world.events.emit(capturing, {
|
|
242
|
+
id: point.id,
|
|
243
|
+
by: null
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
continue;
|
|
247
|
+
}
|
|
248
|
+
if (point.by !== null && point.by !== actor.team) {
|
|
249
|
+
point.progress = Math.max(0, point.progress - step);
|
|
250
|
+
if (point.progress === 0) point.by = null;
|
|
251
|
+
continue;
|
|
252
|
+
}
|
|
253
|
+
if (point.by === null) {
|
|
254
|
+
point.by = actor.team;
|
|
255
|
+
world.events.emit(capturing, {
|
|
256
|
+
id: point.id,
|
|
257
|
+
by: actor.team
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
point.progress = Math.min(1, point.progress + step);
|
|
261
|
+
if (point.progress < 1) continue;
|
|
262
|
+
const from = point.owner;
|
|
263
|
+
point.owner = actor.player;
|
|
264
|
+
point.by = null;
|
|
265
|
+
point.progress = 0;
|
|
266
|
+
world.events.emit(captured, {
|
|
267
|
+
id: point.id,
|
|
268
|
+
owner: actor.player,
|
|
269
|
+
from
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* A game with capture points: the points of `options.points` and of the map (things of the `capture` kind, which the
|
|
275
|
+
* editor places with the client's `captureKind`), each an area, counted every few ticks; whose each is and who is
|
|
276
|
+
* taking it in the world (`captures`, `capturesOf`) and in the game's report (`captures`); `captured` and
|
|
277
|
+
* `capturing` as they change; `capturePoint` for the rules' own say. Units count, alive and in sight of nobody in
|
|
278
|
+
* particular; buildings, scenery and the neutral player's do not
|
|
279
|
+
*
|
|
280
|
+
* @beta
|
|
281
|
+
*/
|
|
282
|
+
function capturePack(options = {}) {
|
|
283
|
+
const every = Math.max(1, Math.round(options.every ?? 3));
|
|
284
|
+
return {
|
|
285
|
+
id: "capture",
|
|
286
|
+
options,
|
|
287
|
+
components: [captures, ready],
|
|
288
|
+
events: [captured, capturing],
|
|
289
|
+
systems: [{
|
|
290
|
+
name: "core.capture",
|
|
291
|
+
phase: "cleanup",
|
|
292
|
+
every,
|
|
293
|
+
update(world) {
|
|
294
|
+
if (!world.state(ready)) setUp(world, options);
|
|
295
|
+
count(world, every / world.tickRate);
|
|
296
|
+
}
|
|
297
|
+
}],
|
|
298
|
+
report: (world) => ({ captures: capturesOf(world) })
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
//#endregion
|
|
302
|
+
export { CAPTURE_FIELDS, CAPTURE_KIND, captureAreaOf, captureOf, capturePack, capturePoint, captured, captures, capturesOf, capturing, ready };
|
|
303
|
+
|
|
304
|
+
//# sourceMappingURL=capture.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capture.js","names":[],"sources":["../src/capture.ts"],"sourcesContent":["import type { AreaDef } from './areas'\nimport type { GamePack } from './packs/pack'\nimport { defineComponent } from './components'\nimport type { PlayerId } from './entity'\nimport { defineEngineEvent } from './events'\nimport type { MapFieldDef, MapThing } from './mapFields'\nimport type { Vec2 } from './math'\nimport type { System } from './registry'\nimport type { World } from './world'\n\n/*\n * Capture points (master plan FI2): places on the map a side takes by standing in them, as a king of the hill or a\n * control point is. A pack a game turns on (`capturePack`): the points come from code (`CapturePoint`) and from the\n * map, as things of the `capture` kind the editor places (the client's `captureKind`); each is an area the rules\n * watch, with its owner and how far a side has got toward taking it kept in the world (`captures`, in a save and in\n * the game's report, which the HUD and the computer read). A system counts who stands in each every few ticks, and\n * says when one changes hands (`captured`) and when a side starts taking it (`capturing`)\n */\n\n/**\n * What a point does while two sides stand in it: nothing moves (`pause`), what was gained is lost (`reset`), or the\n * larger side takes it as if alone (`majority`; a tie pauses)\n *\n * @beta\n */\nexport type Contested = 'pause' | 'reset' | 'majority'\n\n/**\n * A capture point given in code (`capturePack`'s `points`); one placed on the map says the same with its fields\n *\n * @beta\n */\nexport interface CapturePoint {\n\t/** Unique among the game's points: what the events name it by, and `capturePoint` */\n\tid: string\n\t/** What the point is called to the players; nothing when left out */\n\tname?: string\n\t/** Where the middle of the point is, in cells */\n\tat: Vec2\n\t/** How far around its middle counts, in cells: 4 when left out */\n\tradius?: number\n\t/** Seconds a side alone in it takes to make it its own: 10 when left out */\n\ttime?: number\n\t/** What it does while two sides stand in it: `pause` when left out */\n\tcontested?: Contested\n\t/** Whose it is as the game starts: nobody's when left out */\n\towner?: PlayerId\n}\n\n/**\n * A capture point as the world keeps it: where it is, how it is taken, whose it is, and who is taking it now (a team)\n * and how far they have got (0 to 1)\n *\n * @beta\n */\nexport interface CaptureState {\n\t/** The point's id, which the events name it by */\n\tid: string\n\t/** What the point is called to the players, where it has a name */\n\tname?: string\n\t/** Where the middle of the point is, east-west in cells */\n\tx: number\n\t/** Where the middle of the point is, north-south in cells */\n\tz: number\n\t/** How far around its middle counts as in it, in cells */\n\tradius: number\n\t/** Seconds a side alone in it takes to make it its own */\n\ttime: number\n\t/** What the point does while two sides stand in it */\n\tcontested: Contested\n\t/** The player it belongs to; null while nobody holds it */\n\towner: PlayerId | null\n\t/** The team taking it now; null while nobody is */\n\tby: number | null\n\t/** How far the taker has got, 0..1 */\n\tprogress: number\n}\n\n/**\n * The kind of thing on the map a capture point is placed as (the editor's `captureKind`)\n *\n * @beta\n */\nexport const CAPTURE_KIND = 'capture'\n\n/**\n * The fields of a capture point on the map, as the editor's kind offers them and the rules read them: its reach, its\n * time, what it does contested, and whose it is at the start\n *\n * @beta\n */\nexport const CAPTURE_FIELDS: readonly Omit<MapFieldDef, 'for'>[] = [\n\t{ id: 'radius', name: 'Reach', kind: 'number', default: 4, min: 1, max: 24, step: 0.5, hint: 'How far around its middle counts, in cells' },\n\t{\n\t\tid: 'time',\n\t\tname: 'Seconds to take',\n\t\tkind: 'number',\n\t\tdefault: 10,\n\t\tmin: 1,\n\t\tmax: 300,\n\t\tstep: 1,\n\t\thint: 'Seconds a side alone in it takes to make it its own'\n\t},\n\t{\n\t\tid: 'contested',\n\t\tname: 'While contested',\n\t\tkind: 'choice',\n\t\tdefault: 'pause',\n\t\toptions: [\n\t\t\t{ value: 'pause', label: 'Nothing moves' },\n\t\t\t{ value: 'reset', label: 'What was gained is lost' },\n\t\t\t{ value: 'majority', label: 'The larger side takes it' }\n\t\t],\n\t\thint: 'What it does while two sides stand in it'\n\t},\n\t{ id: 'owner', name: 'Whose at the start', kind: 'player', hint: 'Nobody’s when left out' }\n]\n\n/**\n * The capture points of the world, by id: whose each is and who is taking it. Kept in a save; in the game's report\n * as `captures` (a list), for the HUD and the computer\n *\n * @beta\n */\nexport const captures = defineComponent<Record<string, CaptureState>>({ id: 'core.captures', default: () => ({}) })\n\n/** Whether the points were set up from the code's list and the map: once a world, kept in a save */\nexport const ready = defineComponent<boolean>({ id: 'core.capturesReady', default: () => false })\n\n/**\n * A point changed hands: whose it is now (nobody's for one let go by code), and whose it was\n *\n * @beta\n */\nexport const captured = defineEngineEvent<{ id: string; owner: PlayerId | null; from: PlayerId | null }>({\n\tid: 'core.captured',\n\treplicate: 'everyone'\n})\n\n/**\n * A side (a team) began taking a point, or none is any more\n *\n * @beta\n */\nexport const capturing = defineEngineEvent<{ id: string; by: number | null }>({ id: 'core.capturing', replicate: 'everyone' })\n\n/**\n * The area of a point, as the rules watch it (`world.areas`)\n *\n * @internal\n */\nexport const captureAreaOf = (id: string): string => `core.capture.${id}`\n\n/**\n * The capture points of a world, as they stand\n *\n * @beta\n */\nexport const capturesOf = (world: World): CaptureState[] => Object.values(world.state(captures))\n\n/**\n * A point by id, or nothing for an id the world has not got\n *\n * @beta\n */\nexport const captureOf = (world: World, id: string): CaptureState | undefined => world.state(captures)[id]\n\n/**\n * Gives a point to a player, or to nobody, from the rules: its progress forgotten, and `captured` said\n *\n * @beta\n */\nexport function capturePoint(world: World, id: string, owner: PlayerId | null): boolean {\n\tconst point = world.state(captures)[id]\n\tif (!point) return false\n\tconst from = point.owner\n\tpoint.owner = owner\n\tpoint.by = null\n\tpoint.progress = 0\n\tworld.events.emit(captured, { id, owner, from })\n\treturn true\n}\n\n/**\n * What a game turns capture points on with (`capturePack`)\n *\n * @beta\n */\nexport interface CaptureOptions {\n\t/** Points given in code, beside what the map places */\n\tpoints?: readonly CapturePoint[]\n\t/** Ticks between two counts of who stands where: 3 when left out */\n\tevery?: number\n\t/** The kind of thing on the map a point is placed as: `capture` when left out */\n\tkind?: string\n}\n\n/** A thing of the map as a point: named as the thing is, else by its number */\nfunction pointOfThing(thing: MapThing): CapturePoint {\n\tconst data = thing.data as { radius?: number; time?: number; contested?: Contested; owner?: unknown }\n\tconst owner = typeof data.owner === 'number' && data.owner > 0 ? data.owner : undefined\n\treturn {\n\t\tid: thing.name ?? `capture-${thing.id}`,\n\t\tname: thing.name,\n\t\tat: { x: thing.x, z: thing.z },\n\t\tradius: data.radius,\n\t\ttime: data.time,\n\t\tcontested: data.contested,\n\t\towner\n\t}\n}\n\n/** Puts the points of the code and the map in the world: once, as the first count comes (a loaded one has them) */\nfunction setUp(world: World, options: CaptureOptions): void {\n\tconst state = world.state(captures)\n\tconst things = world.map.things(options.kind ?? CAPTURE_KIND, CAPTURE_FIELDS).map(pointOfThing)\n\tfor (const point of [...(options.points ?? []), ...things]) {\n\t\tstate[point.id] ??= {\n\t\t\tid: point.id,\n\t\t\t...(point.name && { name: point.name }),\n\t\t\tx: point.at.x,\n\t\t\tz: point.at.z,\n\t\t\tradius: point.radius ?? 4,\n\t\t\ttime: Math.max(point.time ?? 10, 0.1),\n\t\t\tcontested: point.contested ?? 'pause',\n\t\t\towner: point.owner ?? null,\n\t\t\tby: null,\n\t\t\tprogress: 0\n\t\t}\n\t}\n\tworld.setState(ready, true)\n}\n\n/** The area of a point, as the rules watch it: added as the first count comes (a loaded world brings its own back) */\nfunction areaOf(world: World, point: CaptureState): string {\n\tconst id = captureAreaOf(point.id)\n\tif (!world.areas.has(id)) {\n\t\tconst area: AreaDef = { id, shape: { kind: 'circle', x: point.x, z: point.z, radius: point.radius } }\n\t\tworld.areas.add(area)\n\t}\n\treturn id\n}\n\n/** Who stands in a point, by team: how many, and one of them to own it */\nconst standing = new Map<number, { count: number; player: PlayerId }>()\n\n/** A count of who stands in each point, and what follows: progress, a side let go of, a point changed hands */\nfunction count(world: World, dt: number): void {\n\tfor (const point of Object.values(world.state(captures))) {\n\t\tstanding.clear()\n\t\tfor (const entity of world.areas.inside(areaOf(world, point))) {\n\t\t\tif (!entity.alive || entity.hidden || entity.def.kind !== 'unit') continue\n\t\t\tconst player = world.player(entity.owner)\n\t\t\tif (player.neutral) continue\n\t\t\tconst seen = standing.get(player.team)\n\t\t\tif (seen) seen.count++\n\t\t\telse standing.set(player.team, { count: 1, player: entity.owner })\n\t\t}\n\t\t// nobody: as it was\n\t\tif (!standing.size) continue\n\t\tlet actor: { team: number; player: PlayerId } | undefined\n\t\tif (standing.size === 1) {\n\t\t\tconst [team, each] = [...standing][0]\n\t\t\tactor = { team, player: each.player }\n\t\t} else if (point.contested === 'reset') {\n\t\t\tif (point.progress > 0 || point.by !== null) {\n\t\t\t\tpoint.progress = 0\n\t\t\t\tpoint.by = null\n\t\t\t\tworld.events.emit(capturing, { id: point.id, by: null })\n\t\t\t}\n\t\t\tcontinue\n\t\t} else if (point.contested === 'majority') {\n\t\t\tlet best: [number, { count: number; player: PlayerId }] | undefined\n\t\t\tlet tie = false\n\t\t\tfor (const entry of standing) {\n\t\t\t\tif (!best || entry[1].count > best[1].count) {\n\t\t\t\t\tbest = entry\n\t\t\t\t\ttie = false\n\t\t\t\t} else if (entry[1].count === best[1].count) tie = true\n\t\t\t}\n\t\t\tif (!best || tie) continue\n\t\t\tactor = { team: best[0], player: best[1].player }\n\t\t} else continue\n\t\tconst step = dt / point.time\n\t\tconst ownerTeam = point.owner === null ? null : world.player(point.owner).team\n\t\t// its owner's own in it: whatever another side gained fades\n\t\tif (actor.team === ownerTeam) {\n\t\t\tif (point.progress > 0) point.progress = Math.max(0, point.progress - step)\n\t\t\tif (point.progress === 0 && point.by !== null) {\n\t\t\t\tpoint.by = null\n\t\t\t\tworld.events.emit(capturing, { id: point.id, by: null })\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\t// another side's gains fade before this one's begin\n\t\tif (point.by !== null && point.by !== actor.team) {\n\t\t\tpoint.progress = Math.max(0, point.progress - step)\n\t\t\tif (point.progress === 0) point.by = null\n\t\t\tcontinue\n\t\t}\n\t\tif (point.by === null) {\n\t\t\tpoint.by = actor.team\n\t\t\tworld.events.emit(capturing, { id: point.id, by: actor.team })\n\t\t}\n\t\tpoint.progress = Math.min(1, point.progress + step)\n\t\tif (point.progress < 1) continue\n\t\tconst from = point.owner\n\t\tpoint.owner = actor.player\n\t\tpoint.by = null\n\t\tpoint.progress = 0\n\t\tworld.events.emit(captured, { id: point.id, owner: actor.player, from })\n\t}\n}\n\n/**\n * A game with capture points: the points of `options.points` and of the map (things of the `capture` kind, which the\n * editor places with the client's `captureKind`), each an area, counted every few ticks; whose each is and who is\n * taking it in the world (`captures`, `capturesOf`) and in the game's report (`captures`); `captured` and\n * `capturing` as they change; `capturePoint` for the rules' own say. Units count, alive and in sight of nobody in\n * particular; buildings, scenery and the neutral player's do not\n *\n * @beta\n */\nexport function capturePack(options: CaptureOptions = {}): GamePack {\n\tconst every = Math.max(1, Math.round(options.every ?? 3))\n\t// the points are set up as the first count comes, a tick in: the map is in the world by then (a loaded one has them)\n\tconst system: System = {\n\t\tname: 'core.capture',\n\t\tphase: 'cleanup',\n\t\tevery,\n\t\tupdate(world) {\n\t\t\tif (!world.state(ready)) setUp(world, options)\n\t\t\tcount(world, every / world.tickRate)\n\t\t}\n\t}\n\treturn {\n\t\tid: 'capture',\n\t\toptions,\n\t\tcomponents: [captures, ready],\n\t\tevents: [captured, capturing],\n\t\tsystems: [system],\n\t\t// what each point ended as, beside the game's own report\n\t\treport: (world) => ({ captures: capturesOf(world) })\n\t}\n}\n"],"mappings":";;;;;;;;AAmFA,IAAa,eAAe;;;;;;;AAQ5B,IAAa,iBAAsD;CAClE;EAAE,IAAI;EAAU,MAAM;EAAS,MAAM;EAAU,SAAS;EAAG,KAAK;EAAG,KAAK;EAAI,MAAM;EAAK,MAAM;CAA6C;CAC1I;EACC,IAAI;EACJ,MAAM;EACN,MAAM;EACN,SAAS;EACT,KAAK;EACL,KAAK;EACL,MAAM;EACN,MAAM;CACP;CACA;EACC,IAAI;EACJ,MAAM;EACN,MAAM;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{ World } from './world';
|
|
4
|
+
import { type FoliageStyleDef } from './foliage';
|
|
4
5
|
/**
|
|
5
6
|
* A layer of cells a game paints its maps with, for its rules to read: where the bushes are, what burns, where a
|
|
6
7
|
* lane runs. A value per cell (0 to 255, 0 being none), kept with the map (`GameMap.cells`), in the world's ground
|
|
7
8
|
* (`Terrain.cells`, read with `terrain.cellAt`), its saves and what each player is sent. The rules change it while
|
|
8
9
|
* the game runs with `world.setCells`: the players who see a cell are told at once, the others as it comes into their
|
|
9
10
|
* sight (`TeamMemory.cells`), so a change in the dark is not given away. The editor paints the layers a game lists
|
|
10
|
-
* (`
|
|
11
|
+
* (`Rules.cellLayers`), with the values it names
|
|
11
12
|
*
|
|
12
13
|
* @beta
|
|
13
14
|
*/
|
|
@@ -22,13 +23,9 @@ export interface CellLayerDef {
|
|
|
22
23
|
color?: [number, number, number];
|
|
23
24
|
/**
|
|
24
25
|
* The values the editor paints with, named: `[{ value: 1, name: 'Bush' }]`. One value, 1, named after the layer when
|
|
25
|
-
* left out: a layer of cells that are or are not
|
|
26
|
+
* left out: a layer of cells that are or are not. Of a layer of grass or bushes, its styles (`CellLayerValue.foliage`)
|
|
26
27
|
*/
|
|
27
|
-
values?:
|
|
28
|
-
value: number;
|
|
29
|
-
name: string;
|
|
30
|
-
color?: [number, number, number];
|
|
31
|
-
}[];
|
|
28
|
+
values?: CellLayerValue[];
|
|
32
29
|
/**
|
|
33
30
|
* How fast one on foot goes over a cell of the layer that is not 0, as a multiplier of its speed: a swamp at 0.5. 1
|
|
34
31
|
* when left out; a cell of several such layers is slowed by each (`groundSpeedOfCell`)
|
|
@@ -36,17 +33,71 @@ export interface CellLayerDef {
|
|
|
36
33
|
speed?: number;
|
|
37
34
|
}
|
|
38
35
|
/**
|
|
39
|
-
*
|
|
36
|
+
* A value a layer of cells is painted with (`CellLayerDef.values`): its number in the cells, what the editor calls it,
|
|
37
|
+
* and, of a layer of grass or bushes, the style it is to the rules
|
|
38
|
+
*
|
|
39
|
+
* @beta
|
|
40
|
+
*/
|
|
41
|
+
export interface CellLayerValue {
|
|
42
|
+
/** The value in the cells, 1 to 255 */
|
|
43
|
+
value: number;
|
|
44
|
+
/** What the editor calls it */
|
|
45
|
+
name: string;
|
|
46
|
+
/** The colour the editor shows it in, 0 to 1 each: the layer's when left out */
|
|
47
|
+
color?: [number, number, number];
|
|
48
|
+
/**
|
|
49
|
+
* Of a layer of grass or bushes (`foliagePack`): what this style is to the rules (`FoliageStyleDef`), whether it
|
|
50
|
+
* hides, burns, slows. Over the layer's own (`FoliageLayerOptions.style`)
|
|
51
|
+
*/
|
|
52
|
+
foliage?: FoliageStyleDef;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* What a `data.json`, or a map's definitions, says of a value of a layer of cells (`DataCellLayer.values`): its name,
|
|
56
|
+
* colour and style, any of them, over the game's value of the same number; one the game has not is a value of its own
|
|
57
|
+
*
|
|
58
|
+
* @beta
|
|
59
|
+
*/
|
|
60
|
+
export type DataCellLayerValue = Partial<Omit<CellLayerValue, 'value'>>;
|
|
61
|
+
/**
|
|
62
|
+
* What a `data.json` (`GameData.cellLayers`, every map) or a map's definitions (`GameMap.definitions`, that map alone)
|
|
63
|
+
* says of one of the game's layers of cells: its values, by their number, each over the code's (`DataCellLayerValue`),
|
|
64
|
+
* or `false` to take one of the game's out. What the editor writes of a style made or changed there:
|
|
65
|
+
* `{ "grass": { "values": { "3": { "name": "Dry field", "foliage": { "flammable": 1 } } } } }`
|
|
66
|
+
*
|
|
67
|
+
* @beta
|
|
68
|
+
*/
|
|
69
|
+
export interface DataCellLayer {
|
|
70
|
+
/** The layer's values, by number (1 to 255): each over the game's of that number, a new one, or `false` for none */
|
|
71
|
+
values?: Record<number, DataCellLayerValue | false>;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Why what a `data.json` says of the game's layers of cells (`GameData.cellLayers`) is not right, where it first is
|
|
75
|
+
* not: nothing when it is
|
|
40
76
|
*
|
|
41
77
|
* @beta
|
|
42
78
|
*/
|
|
79
|
+
export declare function dataCellLayersProblem(said: unknown): string | undefined;
|
|
80
|
+
/**
|
|
81
|
+
* A game's layers of cells with what its data says of them laid over (`DataCellLayer`): each value over the layer's of
|
|
82
|
+
* the same number, field by field (its `foliage` style too), one the layer has not added (named `Style <n>` where it
|
|
83
|
+
* says no name), one said `false` taken out; in the order of their numbers. A layer that lists no values has its one
|
|
84
|
+
* value, 1, first. A layer the game has not is left out. The layers given are not changed
|
|
85
|
+
*
|
|
86
|
+
* @beta
|
|
87
|
+
*/
|
|
88
|
+
export declare function layCellLayerData(layers: readonly CellLayerDef[], said: Readonly<Record<string, DataCellLayer>>): CellLayerDef[];
|
|
89
|
+
/**
|
|
90
|
+
* Typed help for writing a layer of cells
|
|
91
|
+
*
|
|
92
|
+
* @public
|
|
93
|
+
*/
|
|
43
94
|
export declare const defineCellLayer: (def: CellLayerDef) => CellLayerDef;
|
|
44
95
|
/**
|
|
45
96
|
* The values a layer is painted with, as the editor offers them: its own, or 1, named after the layer
|
|
46
97
|
*
|
|
47
98
|
* @beta
|
|
48
99
|
*/
|
|
49
|
-
export declare const cellLayerValues: (def: CellLayerDef) =>
|
|
100
|
+
export declare const cellLayerValues: (def: CellLayerDef) => CellLayerValue[];
|
|
50
101
|
/**
|
|
51
102
|
* The cells of a terrain in a shape, as indices into its layers: the cells whose middle is in it
|
|
52
103
|
*
|
|
@@ -55,15 +106,26 @@ export declare const cellLayerValues: (def: CellLayerDef) => NonNullable<CellLay
|
|
|
55
106
|
export declare function cellsIn(terrain: Pick<Terrain, 'width' | 'depth'>, shape: AreaShape): number[];
|
|
56
107
|
/**
|
|
57
108
|
* Cells of a layer the rules set (`world.setCells`), each with what it was: what each team that does not see a cell
|
|
58
|
-
* keeps of it as it last knew it (`TeamMemory.cells`), to be told when it comes into sight. A
|
|
59
|
-
* team knows is nothing to tell; one the team sees is told now
|
|
109
|
+
* keeps of it as it last knew it (`TeamMemory.cells`, a `CellMemory` a layer), to be told when it comes into sight. A
|
|
110
|
+
* cell set back to what the team knows is nothing to tell; one the team sees is told now. A fire changes cells every
|
|
111
|
+
* tick: each team's sight is read as its grid, and nothing is made but a layer's memory the first time
|
|
60
112
|
*/
|
|
61
113
|
export declare function rememberUnseenCells(world: World, layer: string, cells: readonly number[], was: readonly number[], value: number): void;
|
|
62
114
|
/**
|
|
63
115
|
* The cells changed out of a team's sight that are in it now (`TeamMemory.cells`), told to the team as they are now
|
|
64
|
-
* (`cellsSeen
|
|
116
|
+
* (`cellsSeen`, in order of the cells) and forgotten: after the fog is worked out again (`fogSystem`). A layer's
|
|
117
|
+
* memory is gone through a word of 32 cells at a time, those it remembers none of passed over, each held against what
|
|
118
|
+
* the team sees of those 32 as bits (`FogOfWar.sightBits`) where the fog has them, else cell by cell
|
|
65
119
|
*/
|
|
66
120
|
export declare function tellCellsInSight(world: World): void;
|
|
121
|
+
/**
|
|
122
|
+
* What a team remembers of cells the rules changed out of its sight (`TeamMemory.cells`), as a save keeps it: by
|
|
123
|
+
* layer, the value it last knew by cell, a copy. `undefined` where it remembers none; a layer it remembered and has
|
|
124
|
+
* forgotten all of may stay, empty, until the team's next look
|
|
125
|
+
*
|
|
126
|
+
* @beta
|
|
127
|
+
*/
|
|
128
|
+
export declare function rememberedCells(world: World, team: number): Record<string, Record<number, number>> | undefined;
|
|
67
129
|
/**
|
|
68
130
|
* The world's ground as a team knows it: its layers' cells as the team last saw those changed out of its sight
|
|
69
131
|
* (`TeamMemory.cells`). The ground itself where the team knows all of it, or for an observer (no team)
|
|
@@ -71,5 +133,8 @@ export declare function tellCellsInSight(world: World): void;
|
|
|
71
133
|
export declare function groundKnownTo(world: World, team: number | undefined): Terrain;
|
|
72
134
|
/** A layer's cells changed (`world.setCells`): to those who see them. The others are told as they come into sight (`toldCellsSeen`) */
|
|
73
135
|
export declare const toldCells: import("./replication").ReplicatedEvent;
|
|
74
|
-
/**
|
|
136
|
+
/**
|
|
137
|
+
* Cells changed out of a team's sight came into it (`tellCellsInSight`): to the team, as they are now, said to be seen
|
|
138
|
+
* so (`seen`: a screen does not show them changing now). An observer was told already
|
|
139
|
+
*/
|
|
75
140
|
export declare const toldCellsSeen: import("./replication").ReplicatedEvent;
|