@v12-engine/engine 0.1.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/abilities/amounts.d.ts +28 -0
- package/dist/abilities/amounts.js +74 -0
- package/dist/abilities/amounts.js.map +1 -0
- package/dist/abilities/buffs.d.ts +106 -6
- package/dist/abilities/buffs.js +443 -0
- package/dist/abilities/buffs.js.map +1 -0
- package/dist/abilities/castTold.d.ts +2 -0
- package/dist/abilities/castTold.js +66 -0
- package/dist/abilities/castTold.js.map +1 -0
- package/dist/abilities/chance.d.ts +38 -0
- package/dist/abilities/chance.js +77 -0
- package/dist/abilities/chance.js.map +1 -0
- package/dist/abilities/charges.d.ts +18 -0
- package/dist/abilities/charges.js +101 -0
- package/dist/abilities/charges.js.map +1 -0
- package/dist/abilities/control.d.ts +28 -0
- package/dist/abilities/control.js +113 -0
- package/dist/abilities/control.js.map +1 -0
- package/dist/abilities/dispel.js +51 -0
- package/dist/abilities/dispel.js.map +1 -0
- package/dist/abilities/effectFields.d.ts +1 -1
- package/dist/abilities/effectFields.js +676 -0
- package/dist/abilities/effectFields.js.map +1 -0
- package/dist/abilities/effectIndex.d.ts +27 -0
- package/dist/abilities/effectIndex.js +64 -0
- package/dist/abilities/effectIndex.js.map +1 -0
- package/dist/abilities/effects/buff.d.ts +9 -3
- package/dist/abilities/effects/buff.js +84 -0
- package/dist/abilities/effects/buff.js.map +1 -0
- package/dist/abilities/effects/conditions.d.ts +2 -0
- package/dist/abilities/effects/conditions.js +41 -0
- package/dist/abilities/effects/conditions.js.map +1 -0
- package/dist/abilities/effects/core.js +54 -0
- package/dist/abilities/effects/core.js.map +1 -0
- package/dist/abilities/effects/damage.d.ts +1 -1
- package/dist/abilities/effects/damage.js +43 -0
- package/dist/abilities/effects/damage.js.map +1 -0
- package/dist/abilities/effects/heal.d.ts +2 -2
- package/dist/abilities/effects/heal.js +51 -0
- package/dist/abilities/effects/heal.js.map +1 -0
- package/dist/abilities/effects/missile.d.ts +13 -1
- package/dist/abilities/effects/missile.js +104 -0
- package/dist/abilities/effects/missile.js.map +1 -0
- package/dist/abilities/effects/morph.d.ts +5 -0
- package/dist/abilities/effects/morph.js +43 -0
- package/dist/abilities/effects/morph.js.map +1 -0
- package/dist/abilities/effects/moves.d.ts +16 -4
- package/dist/abilities/effects/moves.js +212 -0
- package/dist/abilities/effects/moves.js.map +1 -0
- package/dist/abilities/effects/passives.d.ts +19 -9
- package/dist/abilities/effects/passives.js +131 -0
- package/dist/abilities/effects/passives.js.map +1 -0
- package/dist/abilities/effects/proxy.d.ts +5 -0
- package/dist/abilities/effects/proxy.js +60 -0
- package/dist/abilities/effects/proxy.js.map +1 -0
- package/dist/abilities/effects/sight.d.ts +2 -2
- package/dist/abilities/effects/sight.js +39 -0
- package/dist/abilities/effects/sight.js.map +1 -0
- package/dist/abilities/effects/spawn.d.ts +5 -2
- package/dist/abilities/effects/spawn.js +40 -0
- package/dist/abilities/effects/spawn.js.map +1 -0
- package/dist/abilities/effects/timed.d.ts +2 -2
- package/dist/abilities/effects/timed.js +96 -0
- package/dist/abilities/effects/timed.js.map +1 -0
- package/dist/abilities/effects/trade.d.ts +1 -1
- package/dist/abilities/effects/trade.js +25 -0
- package/dist/abilities/effects/trade.js.map +1 -0
- package/dist/abilities/effects.d.ts +97 -23
- package/dist/abilities/effects.js +860 -0
- package/dist/abilities/effects.js.map +1 -0
- package/dist/abilities/land.d.ts +38 -4
- package/dist/abilities/land.js +189 -0
- package/dist/abilities/land.js.map +1 -0
- package/dist/abilities/recast.d.ts +45 -0
- package/dist/abilities/recast.js +118 -0
- package/dist/abilities/recast.js.map +1 -0
- package/dist/abilities/scaled.js +40 -0
- package/dist/abilities/scaled.js.map +1 -0
- package/dist/abilities/screen.d.ts +6 -0
- package/dist/abilities/screen.js +83 -0
- package/dist/abilities/screen.js.map +1 -0
- package/dist/abilities/shapes.d.ts +66 -0
- package/dist/abilities/shapes.js +122 -0
- package/dist/abilities/shapes.js.map +1 -0
- package/dist/abilities/text.d.ts +14 -2
- package/dist/abilities/text.js +204 -0
- package/dist/abilities/text.js.map +1 -0
- package/dist/abilities/triggers.d.ts +98 -0
- package/dist/abilities/triggers.js +351 -0
- package/dist/abilities/triggers.js.map +1 -0
- package/dist/abilityChanges.d.ts +131 -0
- package/dist/abilityChanges.js +345 -0
- package/dist/abilityChanges.js.map +1 -0
- package/dist/ai/area.d.ts +4 -1
- package/dist/ai/brain.d.ts +4 -1
- package/dist/ai/brain.js +844 -0
- package/dist/ai/brain.js.map +1 -0
- package/dist/ai/budget.js +74 -0
- package/dist/ai/budget.js.map +1 -0
- package/dist/ai/checks.d.ts +9 -1
- package/dist/ai/checks.js +242 -0
- package/dist/ai/checks.js.map +1 -0
- package/dist/ai/computer.d.ts +11 -4
- package/dist/ai/computer.js +251 -0
- package/dist/ai/computer.js.map +1 -0
- package/dist/ai/defence.d.ts +4 -0
- package/dist/ai/defence.js +430 -0
- package/dist/ai/defence.js.map +1 -0
- package/dist/ai/define.d.ts +3 -2
- package/dist/ai/define.js +31 -0
- package/dist/ai/define.js.map +1 -0
- package/dist/ai/economy.d.ts +10 -7
- package/dist/ai/economy.js +780 -0
- package/dist/ai/economy.js.map +1 -0
- package/dist/ai/geometry.js +38 -0
- package/dist/ai/geometry.js.map +1 -0
- package/dist/ai/goals.d.ts +1 -0
- package/dist/ai/goals.js +560 -0
- package/dist/ai/goals.js.map +1 -0
- package/dist/ai/knowledge.d.ts +72 -7
- package/dist/ai/knowledge.js +804 -0
- package/dist/ai/knowledge.js.map +1 -0
- package/dist/ai/lanes.d.ts +10 -2
- package/dist/ai/lanes.js +715 -0
- package/dist/ai/lanes.js.map +1 -0
- package/dist/ai/melee/build.js +264 -0
- package/dist/ai/melee/build.js.map +1 -0
- package/dist/ai/melee/goals.d.ts +7 -0
- package/dist/ai/melee/goals.js +720 -0
- package/dist/ai/melee/goals.js.map +1 -0
- package/dist/ai/melee/heroes.js +68 -0
- package/dist/ai/melee/heroes.js.map +1 -0
- package/dist/ai/melee/index.d.ts +1 -1
- package/dist/ai/melee/index.js +51 -0
- package/dist/ai/melee/index.js.map +1 -0
- package/dist/ai/melee/production.js +29 -0
- package/dist/ai/melee/production.js.map +1 -0
- package/dist/ai/melee/surrender.js +64 -0
- package/dist/ai/melee/surrender.js.map +1 -0
- package/dist/ai/micro.d.ts +9 -0
- package/dist/ai/micro.js +1316 -0
- package/dist/ai/micro.js.map +1 -0
- package/dist/ai/mission.d.ts +9 -2
- package/dist/ai/mission.js +538 -0
- package/dist/ai/mission.js.map +1 -0
- package/dist/ai/missionRules.d.ts +1 -1
- package/dist/ai/missionRules.js +26 -0
- package/dist/ai/missionRules.js.map +1 -0
- package/dist/ai/module.d.ts +6 -2
- package/dist/ai/module.js +37 -0
- package/dist/ai/module.js.map +1 -0
- package/dist/ai/options.d.ts +3 -3
- package/dist/ai/plans/build.d.ts +20 -1
- package/dist/ai/plans/build.js +608 -0
- package/dist/ai/plans/build.js.map +1 -0
- package/dist/ai/plans/placement.d.ts +4 -1
- package/dist/ai/plans/placement.js +295 -0
- package/dist/ai/plans/placement.js.map +1 -0
- package/dist/ai/plans/plans.d.ts +9 -0
- package/dist/ai/plans/plans.js +110 -0
- package/dist/ai/plans/plans.js.map +1 -0
- package/dist/ai/plans/production.d.ts +14 -2
- package/dist/ai/plans/production.js +434 -0
- package/dist/ai/plans/production.js.map +1 -0
- package/dist/ai/plans/purse.d.ts +6 -3
- package/dist/ai/plans/purse.js +139 -0
- package/dist/ai/plans/purse.js.map +1 -0
- package/dist/ai/plans/tech.d.ts +6 -0
- package/dist/ai/plans/tech.js +122 -0
- package/dist/ai/plans/tech.js.map +1 -0
- package/dist/ai/profiles.d.ts +4 -4
- package/dist/{profiles-B3NS9jwk.js → ai/profiles.js} +3 -98
- package/dist/ai/profiles.js.map +1 -0
- package/dist/ai/reach.js +54 -0
- package/dist/ai/reach.js.map +1 -0
- package/dist/ai/report.d.ts +8 -0
- package/dist/ai/report.js +87 -0
- package/dist/ai/report.js.map +1 -0
- package/dist/ai/roles.d.ts +4 -0
- package/dist/ai/roles.js +207 -0
- package/dist/ai/roles.js.map +1 -0
- package/dist/ai/rules.d.ts +8 -2
- package/dist/ai/rules.js +416 -0
- package/dist/ai/rules.js.map +1 -0
- package/dist/ai/scouting.d.ts +6 -0
- package/dist/ai/scouting.js +324 -0
- package/dist/ai/scouting.js.map +1 -0
- package/dist/ai/settings.js +99 -0
- package/dist/ai/settings.js.map +1 -0
- package/dist/ai/squads.d.ts +21 -2
- package/dist/ai/squads.js +916 -0
- package/dist/ai/squads.js.map +1 -0
- package/dist/ai/strength.js +320 -0
- package/dist/ai/strength.js.map +1 -0
- package/dist/ai/task.d.ts +3 -1
- package/dist/ai/task.js +17 -0
- package/dist/ai/task.js.map +1 -0
- package/dist/ai/tasks/attack.js +24 -0
- package/dist/ai/tasks/attack.js.map +1 -0
- package/dist/ai/tasks/capture.d.ts +3 -3
- package/dist/ai/tasks/capture.js +37 -0
- package/dist/ai/tasks/capture.js.map +1 -0
- package/dist/ai/tasks/creep.js +29 -0
- package/dist/ai/tasks/creep.js.map +1 -0
- package/dist/ai/tasks/defend.js +61 -0
- package/dist/ai/tasks/defend.js.map +1 -0
- package/dist/ai/tasks/drop.js +81 -0
- package/dist/ai/tasks/drop.js.map +1 -0
- package/dist/ai/tasks/escort.js +59 -0
- package/dist/ai/tasks/escort.js.map +1 -0
- package/dist/ai/tasks/gather.js +48 -0
- package/dist/ai/tasks/gather.js.map +1 -0
- package/dist/ai/tasks/harass.js +39 -0
- package/dist/ai/tasks/harass.js.map +1 -0
- package/dist/ai/tasks/hold.js +32 -0
- package/dist/ai/tasks/hold.js.map +1 -0
- package/dist/ai/tasks/index.js +34 -0
- package/dist/ai/tasks/index.js.map +1 -0
- package/dist/ai/tasks/move.js +26 -0
- package/dist/ai/tasks/move.js.map +1 -0
- package/dist/ai/tasks/patrol.js +59 -0
- package/dist/ai/tasks/patrol.js.map +1 -0
- package/dist/ai/tasks/retreat.js +28 -0
- package/dist/ai/tasks/retreat.js.map +1 -0
- package/dist/ai/tasks/scout.js +73 -0
- package/dist/ai/tasks/scout.js.map +1 -0
- package/dist/ai/tasks/shared.d.ts +1 -1
- package/dist/ai/tasks/shared.js +137 -0
- package/dist/ai/tasks/shared.js.map +1 -0
- package/dist/ai/team.d.ts +18 -1
- package/dist/ai/team.js +492 -0
- package/dist/ai/team.js.map +1 -0
- package/dist/ai/threat.d.ts +6 -0
- package/dist/ai/threat.js +206 -0
- package/dist/ai/threat.js.map +1 -0
- package/dist/ai/view.d.ts +21 -7
- package/dist/ai/view.js +677 -0
- package/dist/ai/view.js.map +1 -0
- package/dist/ai/waves.d.ts +6 -0
- package/dist/ai/waves.js +410 -0
- package/dist/ai/waves.js.map +1 -0
- package/dist/ai.js +54 -6239
- package/dist/aiTesting.d.ts +6 -3
- package/dist/aiTesting.js +229 -0
- package/dist/aiTesting.js.map +1 -0
- package/dist/areas.d.ts +4 -1
- package/dist/areas.js +295 -0
- package/dist/areas.js.map +1 -0
- package/dist/attacks.d.ts +3 -3
- package/dist/attacks.js +127 -0
- package/dist/attacks.js.map +1 -0
- package/dist/burning.d.ts +267 -0
- package/dist/burning.js +795 -0
- package/dist/burning.js.map +1 -0
- package/dist/bytes.js +21 -0
- package/dist/bytes.js.map +1 -0
- package/dist/callings.d.ts +71 -0
- package/dist/callings.js +157 -0
- package/dist/callings.js.map +1 -0
- package/dist/cameraOrders.d.ts +78 -0
- package/dist/cameraOrders.js +114 -0
- package/dist/cameraOrders.js.map +1 -0
- package/dist/camps.d.ts +70 -4
- package/dist/camps.js +501 -0
- package/dist/camps.js.map +1 -0
- package/dist/capture.d.ts +15 -3
- package/dist/capture.js +304 -0
- package/dist/capture.js.map +1 -0
- package/dist/cellLayers.d.ts +78 -13
- package/dist/cellLayers.js +275 -0
- package/dist/cellLayers.js.map +1 -0
- package/dist/cellPatches.d.ts +24 -0
- package/dist/cellPatches.js +73 -0
- package/dist/cellPatches.js.map +1 -0
- package/dist/cinematics.d.ts +10 -5
- package/dist/cinematics.js +161 -0
- package/dist/cinematics.js.map +1 -0
- package/dist/clock.d.ts +2 -2
- package/dist/clock.js +78 -0
- package/dist/clock.js.map +1 -0
- package/dist/commands.d.ts +36 -4
- package/dist/commands.js +636 -0
- package/dist/commands.js.map +1 -0
- package/dist/components.d.ts +31 -10
- package/dist/components.js +74 -0
- package/dist/components.js.map +1 -0
- package/dist/computers.d.ts +4 -4
- package/dist/computers.js +194 -0
- package/dist/computers.js.map +1 -0
- package/dist/concealment.d.ts +25 -2
- package/dist/concealment.js +409 -0
- package/dist/concealment.js.map +1 -0
- package/dist/coreComponents.js +130 -0
- package/dist/coreComponents.js.map +1 -0
- package/dist/createGame.d.ts +306 -0
- package/dist/createGame.js +405 -0
- package/dist/createGame.js.map +1 -0
- package/dist/dashing.d.ts +18 -2
- package/dist/dashing.js +41 -0
- package/dist/dashing.js.map +1 -0
- package/dist/debug.d.ts +8 -0
- package/dist/debug.js +5 -3
- package/dist/debug2.js +76 -0
- package/dist/debug2.js.map +1 -0
- package/dist/debugCommands.d.ts +6 -6
- package/dist/debugCommands.js +537 -0
- package/dist/debugCommands.js.map +1 -0
- package/dist/debugging.d.ts +1 -0
- package/dist/defaultSets.d.ts +183 -0
- package/dist/defaultSets.js +216 -0
- package/dist/defaultSets.js.map +1 -0
- package/dist/definitions.d.ts +6 -0
- package/dist/definitions.js +78 -0
- package/dist/definitions.js.map +1 -0
- package/dist/defs.d.ts +1895 -165
- package/dist/defs.js +380 -0
- package/dist/defs.js.map +1 -0
- package/dist/denying.d.ts +4 -4
- package/dist/denying.js +106 -0
- package/dist/denying.js.map +1 -0
- package/dist/destructibles.d.ts +2 -2
- package/dist/destructibles.js +36 -0
- package/dist/destructibles.js.map +1 -0
- package/dist/determinism.d.ts +4 -4
- package/dist/determinism.js +247 -0
- package/dist/determinism.js.map +1 -0
- package/dist/dialog.d.ts +17 -2
- package/dist/dialog.js +108 -0
- package/dist/dialog.js.map +1 -0
- package/dist/effectRefs.js +28 -0
- package/dist/effectRefs.js.map +1 -0
- package/dist/effects.d.ts +27 -11
- package/dist/effects.js +110 -0
- package/dist/effects.js.map +1 -0
- package/dist/endings.d.ts +1 -1
- package/dist/endings.js +78 -0
- package/dist/endings.js.map +1 -0
- package/dist/engagement.d.ts +40 -6
- package/dist/engagement.js +530 -0
- package/dist/engagement.js.map +1 -0
- package/dist/engineEvents.d.ts +72 -9
- package/dist/engineEvents.js +520 -0
- package/dist/engineEvents.js.map +1 -0
- package/dist/entity.d.ts +275 -26
- package/dist/entity.js +441 -0
- package/dist/entity.js.map +1 -0
- package/dist/entityIndex.d.ts +10 -3
- package/dist/entityIndex.js +149 -0
- package/dist/entityIndex.js.map +1 -0
- package/dist/errors.d.ts +6 -2
- package/dist/errors.js +59 -0
- package/dist/errors.js.map +1 -0
- package/dist/events.d.ts +11 -5
- package/dist/events.js +158 -0
- package/dist/events.js.map +1 -0
- package/dist/exactMath.js +273 -0
- package/dist/exactMath.js.map +1 -0
- package/dist/features.d.ts +1 -1
- package/dist/features.js +127 -0
- package/dist/features.js.map +1 -0
- package/dist/fields.d.ts +25 -5
- package/dist/fields.js +140 -0
- package/dist/fields.js.map +1 -0
- package/dist/fixture.d.ts +3 -3
- package/dist/fixture.js +512 -0
- package/dist/fixture.js.map +1 -0
- package/dist/fog.d.ts +26 -3
- package/dist/fog.js +333 -0
- package/dist/fog.js.map +1 -0
- package/dist/foliage.d.ts +476 -0
- package/dist/foliage.js +1478 -0
- package/dist/foliage.js.map +1 -0
- package/dist/foliageDebug.d.ts +57 -0
- package/dist/foliageDebug.js +172 -0
- package/dist/foliageDebug.js.map +1 -0
- package/dist/foliageRegrowth.d.ts +20 -0
- package/dist/foliageRegrowth.js +332 -0
- package/dist/foliageRegrowth.js.map +1 -0
- package/dist/formState.d.ts +67 -0
- package/dist/formState.js +65 -0
- package/dist/formState.js.map +1 -0
- package/dist/formation.d.ts +46 -8
- package/dist/formation.js +297 -0
- package/dist/formation.js.map +1 -0
- package/dist/forms.d.ts +58 -0
- package/dist/forms.js +146 -0
- package/dist/forms.js.map +1 -0
- package/dist/friendlyFire.d.ts +2 -2
- package/dist/friendlyFire.js +37 -0
- package/dist/friendlyFire.js.map +1 -0
- package/dist/game.d.ts +141 -48
- package/dist/game.js +834 -0
- package/dist/game.js.map +1 -0
- package/dist/gameData.d.ts +96 -22
- package/dist/gameData.js +1690 -0
- package/dist/gameData.js.map +1 -0
- package/dist/gameFiles.d.ts +3 -3
- package/dist/gameFiles.js +14 -0
- package/dist/gameFiles.js.map +1 -0
- package/dist/gates.js +92 -0
- package/dist/gates.js.map +1 -0
- package/dist/generate.d.ts +28 -1
- package/dist/generate.js +1062 -0
- package/dist/generate.js.map +1 -0
- package/dist/generateWorker.d.ts +7 -3
- package/dist/generateWorker.js +86 -0
- package/dist/generateWorker.js.map +1 -0
- package/dist/grid.d.ts +9 -0
- package/dist/grid.js +102 -0
- package/dist/grid.js.map +1 -0
- package/dist/ground.d.ts +17 -1
- package/dist/ground.js +375 -0
- package/dist/ground.js.map +1 -0
- package/dist/groundObjects.d.ts +70 -0
- package/dist/groundObjects.js +371 -0
- package/dist/groundObjects.js.map +1 -0
- package/dist/groundSpeed.d.ts +20 -3
- package/dist/groundSpeed.js +117 -0
- package/dist/groundSpeed.js.map +1 -0
- package/dist/hero.d.ts +126 -10
- package/dist/hero.js +432 -0
- package/dist/hero.js.map +1 -0
- package/dist/holds.d.ts +94 -0
- package/dist/holds.js +305 -0
- package/dist/holds.js.map +1 -0
- package/dist/home.d.ts +1 -1
- package/dist/home.js +30 -0
- package/dist/home.js.map +1 -0
- package/dist/hooks.d.ts +339 -57
- package/dist/hooks.js +105 -0
- package/dist/hooks.js.map +1 -0
- package/dist/hotReload.d.ts +6 -5
- package/dist/hotReload.js +145 -0
- package/dist/hotReload.js.map +1 -0
- package/dist/ids.d.ts +3 -3
- package/dist/ids.js +30 -0
- package/dist/ids.js.map +1 -0
- package/dist/idsFile.d.ts +36 -0
- package/dist/idsFile.js +134 -0
- package/dist/idsFile.js.map +1 -0
- package/dist/index.d.ts +105 -68
- package/dist/index.js +194 -4701
- package/dist/inspect.d.ts +29 -2
- package/dist/{inspect-D9dWHmZ0.js → inspect.js} +21 -12
- package/dist/inspect.js.map +1 -0
- package/dist/inventory.d.ts +14 -1
- package/dist/inventory.js +84 -0
- package/dist/inventory.js.map +1 -0
- package/dist/items.d.ts +136 -8
- package/dist/items.js +585 -0
- package/dist/items.js.map +1 -0
- package/dist/lanes.d.ts +12 -3
- package/dist/lanes.js +496 -0
- package/dist/lanes.js.map +1 -0
- package/dist/life.d.ts +6 -2
- package/dist/life.js +287 -0
- package/dist/life.js.map +1 -0
- package/dist/log.d.ts +26 -3
- package/dist/log.js +192 -0
- package/dist/log.js.map +1 -0
- package/dist/manaBurn.d.ts +2 -2
- package/dist/manaBurn.js +75 -0
- package/dist/manaBurn.js.map +1 -0
- package/dist/map/file.d.ts +56 -3
- package/dist/map/file.js +264 -0
- package/dist/map/file.js.map +1 -0
- package/dist/map/images.js +61 -0
- package/dist/map/images.js.map +1 -0
- package/dist/map/look.d.ts +1 -1
- package/dist/map/look.js +30 -0
- package/dist/map/look.js.map +1 -0
- package/dist/map/pathProfile.js +183 -0
- package/dist/map/pathProfile.js.map +1 -0
- package/dist/map/resize.d.ts +4 -0
- package/dist/map/resize.js +136 -0
- package/dist/map/resize.js.map +1 -0
- package/dist/map/schema.js +257 -0
- package/dist/map/schema.js.map +1 -0
- package/dist/map/terrain.js +214 -0
- package/dist/map/terrain.js.map +1 -0
- package/dist/map/types.d.ts +92 -13
- package/dist/map/types.js +251 -0
- package/dist/map/types.js.map +1 -0
- package/dist/mapCheck/cells.js +94 -0
- package/dist/mapCheck/cells.js.map +1 -0
- package/dist/mapCheck/rules/foliage.d.ts +9 -0
- package/dist/mapCheck/rules/foliage.js +83 -0
- package/dist/mapCheck/rules/foliage.js.map +1 -0
- package/dist/mapCheck/rules/names.js +39 -0
- package/dist/mapCheck/rules/names.js.map +1 -0
- package/dist/mapCheck/rules/objects.d.ts +1 -1
- package/dist/mapCheck/rules/objects.js +56 -0
- package/dist/mapCheck/rules/objects.js.map +1 -0
- package/dist/mapCheck/rules/paths.js +32 -0
- package/dist/mapCheck/rules/paths.js.map +1 -0
- package/dist/mapCheck/rules/players.js +20 -0
- package/dist/mapCheck/rules/players.js.map +1 -0
- package/dist/mapCheck/rules/races.js +56 -0
- package/dist/mapCheck/rules/races.js.map +1 -0
- package/dist/mapCheck/rules/random.js +47 -0
- package/dist/mapCheck/rules/random.js.map +1 -0
- package/dist/mapCheck/rules/regions.js +30 -0
- package/dist/mapCheck/rules/regions.js.map +1 -0
- package/dist/mapCheck/rules/targets.js +31 -0
- package/dist/mapCheck/rules/targets.js.map +1 -0
- package/dist/mapCheck/rules/walking.js +45 -0
- package/dist/mapCheck/rules/walking.js.map +1 -0
- package/dist/mapCheck.d.ts +2 -2
- package/dist/mapCheck.js +63 -0
- package/dist/mapCheck.js.map +1 -0
- package/dist/mapFields.d.ts +25 -2
- package/dist/mapFields.js +134 -0
- package/dist/mapFields.js.map +1 -0
- package/dist/mapFile.js +176 -0
- package/dist/mapFile.js.map +1 -0
- package/dist/mapMeasure.d.ts +8 -0
- package/dist/mapMeasure.js +283 -0
- package/dist/mapMeasure.js.map +1 -0
- package/dist/mapMerge.d.ts +1 -0
- package/dist/mapMerge.js +172 -0
- package/dist/mapMerge.js.map +1 -0
- package/dist/mapObjectives.js +138 -0
- package/dist/mapObjectives.js.map +1 -0
- package/dist/mapObjects.js +80 -0
- package/dist/mapObjects.js.map +1 -0
- package/dist/math.d.ts +37 -7
- package/dist/math.js +155 -0
- package/dist/math.js.map +1 -0
- package/dist/messages.d.ts +71 -4
- package/dist/messages.js +29 -0
- package/dist/messages.js.map +1 -0
- package/dist/missionRules.d.ts +10 -2
- package/dist/{missionRules-C-bGxm0Q.js → missionRules.js} +30 -150
- package/dist/missionRules.js.map +1 -0
- package/dist/mods.d.ts +39 -20
- package/dist/mods.js +271 -0
- package/dist/mods.js.map +1 -0
- package/dist/moves.d.ts +87 -0
- package/dist/moves.js +539 -0
- package/dist/moves.js.map +1 -0
- package/dist/names.d.ts +7 -0
- package/dist/names.js +122 -0
- package/dist/names.js.map +1 -0
- package/dist/navigation/agentParams.js +14 -0
- package/dist/navigation/agentParams.js.map +1 -0
- package/dist/navigation/air.d.ts +7 -3
- package/dist/navigation/air.js +401 -0
- package/dist/navigation/air.js.map +1 -0
- package/dist/navigation/builds.d.ts +34 -2
- package/dist/navigation/builds.js +287 -0
- package/dist/navigation/builds.js.map +1 -0
- package/dist/navigation/groundAreas.d.ts +59 -1
- package/dist/navigation/groundAreas.js +407 -0
- package/dist/navigation/groundAreas.js.map +1 -0
- package/dist/navigation/navigation.d.ts +98 -9
- package/dist/navigation/recast.d.ts +194 -18
- package/dist/navigation/recast.js +1379 -0
- package/dist/navigation/recast.js.map +1 -0
- package/dist/navigation/sidePaths.d.ts +8 -3
- package/dist/navigation/sidePaths.js +241 -0
- package/dist/navigation/sidePaths.js.map +1 -0
- package/dist/navigation/sized.js +243 -0
- package/dist/navigation/sized.js.map +1 -0
- package/dist/nearest.js +32 -0
- package/dist/nearest.js.map +1 -0
- package/dist/noise.js +59 -0
- package/dist/noise.js.map +1 -0
- package/dist/objectives.d.ts +12 -3
- package/dist/objectives.js +144 -0
- package/dist/objectives.js.map +1 -0
- package/dist/orders/basic.d.ts +5 -5
- package/dist/orders/basic.js +417 -0
- package/dist/orders/basic.js.map +1 -0
- package/dist/orders/build.js +278 -0
- package/dist/orders/build.js.map +1 -0
- package/dist/orders/cast.d.ts +13 -3
- package/dist/orders/cast.js +558 -0
- package/dist/orders/cast.js.map +1 -0
- package/dist/orders/facts.js +16 -0
- package/dist/orders/facts.js.map +1 -0
- package/dist/orders/harvest.d.ts +21 -5
- package/dist/orders/harvest.js +540 -0
- package/dist/orders/harvest.js.map +1 -0
- package/dist/orders/idle.d.ts +3 -1
- package/dist/orders/idle.js +234 -0
- package/dist/orders/idle.js.map +1 -0
- package/dist/orders/items.js +92 -0
- package/dist/orders/items.js.map +1 -0
- package/dist/orders/queue.js +108 -0
- package/dist/orders/queue.js.map +1 -0
- package/dist/orders/waiting.d.ts +39 -0
- package/dist/orders/waiting.js +149 -0
- package/dist/orders/waiting.js.map +1 -0
- package/dist/pack.schema.js +13 -0
- package/dist/pack.schema.js.map +1 -0
- package/dist/pack.schema.json +7622 -841
- package/dist/packs/director/index.d.ts +13 -5
- package/dist/packs/director/index.js +204 -0
- package/dist/packs/director/index.js.map +1 -0
- package/dist/packs/heroes/campaign.d.ts +3 -2
- package/dist/packs/heroes/campaign.js +241 -0
- package/dist/packs/heroes/campaign.js.map +1 -0
- package/dist/packs/heroes/carry.d.ts +6 -0
- package/dist/packs/heroes/carry.js +112 -0
- package/dist/packs/heroes/carry.js.map +1 -0
- package/dist/packs/heroes/commands.js +115 -0
- package/dist/packs/heroes/commands.js.map +1 -0
- package/dist/packs/heroes/fallen.d.ts +43 -0
- package/dist/packs/heroes/fallen.js +61 -0
- package/dist/packs/heroes/fallen.js.map +1 -0
- package/dist/packs/heroes/hire.js +60 -0
- package/dist/packs/heroes/hire.js.map +1 -0
- package/dist/packs/heroes/index.d.ts +7 -6
- package/dist/packs/heroes/index.js +130 -0
- package/dist/packs/heroes/index.js.map +1 -0
- package/dist/packs/heroes/loop.d.ts +95 -0
- package/dist/packs/heroes/loop.js +250 -0
- package/dist/packs/heroes/loop.js.map +1 -0
- package/dist/packs/heroes/making.d.ts +6 -3
- package/dist/packs/heroes/making.js +55 -0
- package/dist/packs/heroes/making.js.map +1 -0
- package/dist/packs/heroes/respawn.d.ts +3 -3
- package/dist/packs/heroes/respawn.js +87 -0
- package/dist/packs/heroes/respawn.js.map +1 -0
- package/dist/packs/heroes/sets.d.ts +32 -0
- package/dist/packs/heroes/sets.js +51 -0
- package/dist/packs/heroes/sets.js.map +1 -0
- package/dist/packs/heroes/spells.d.ts +16 -0
- package/dist/packs/heroes/spells.js +269 -0
- package/dist/packs/heroes/spells.js.map +1 -0
- package/dist/packs/items/defaults.d.ts +43 -0
- package/dist/packs/items/defaults.js +1504 -0
- package/dist/packs/items/defaults.js.map +1 -0
- package/dist/packs/items/index.d.ts +27 -0
- package/dist/packs/items/index.js +214 -0
- package/dist/packs/items/index.js.map +1 -0
- package/dist/packs/moba/index.d.ts +3 -3
- package/dist/packs/moba/index.js +174 -0
- package/dist/packs/moba/index.js.map +1 -0
- package/dist/packs/pack.d.ts +15 -15
- package/dist/packs/pack.js +14 -0
- package/dist/packs/pack.js.map +1 -0
- package/dist/packs.d.ts +15 -7
- package/dist/packs.js +222 -0
- package/dist/packs.js.map +1 -0
- package/dist/paths.d.ts +2 -0
- package/dist/paths.js +109 -0
- package/dist/paths.js.map +1 -0
- package/dist/plain.js +57 -0
- package/dist/plain.js.map +1 -0
- package/dist/player.d.ts +33 -10
- package/dist/player.js +159 -0
- package/dist/player.js.map +1 -0
- package/dist/portals.d.ts +1 -1
- package/dist/portals.js +194 -0
- package/dist/portals.js.map +1 -0
- package/dist/prefabs.d.ts +25 -2
- package/dist/prefabs.js +239 -0
- package/dist/prefabs.js.map +1 -0
- package/dist/presetBuildings.js +58 -0
- package/dist/presetBuildings.js.map +1 -0
- package/dist/presetFoliage.d.ts +27 -0
- package/dist/presetFoliage.js +98 -0
- package/dist/presetFoliage.js.map +1 -0
- package/dist/presetGround.js +65 -0
- package/dist/presetGround.js.map +1 -0
- package/dist/proxies.d.ts +12 -0
- package/dist/proxies.js +79 -0
- package/dist/proxies.js.map +1 -0
- package/dist/query.d.ts +56 -0
- package/dist/query.js +88 -0
- package/dist/query.js.map +1 -0
- package/dist/races.d.ts +15 -14
- package/dist/races.js +172 -0
- package/dist/races.js.map +1 -0
- package/dist/randomGroups.js +91 -0
- package/dist/randomGroups.js.map +1 -0
- package/dist/registry.d.ts +117 -53
- package/dist/registry.js +323 -0
- package/dist/registry.js.map +1 -0
- package/dist/remains.d.ts +11 -9
- package/dist/remains.js +188 -0
- package/dist/remains.js.map +1 -0
- package/dist/replication.d.ts +12 -7
- package/dist/replication.js +100 -0
- package/dist/replication.js.map +1 -0
- package/dist/rng.d.ts +2 -0
- package/dist/rng.js +40 -0
- package/dist/rng.js.map +1 -0
- package/dist/rules.d.ts +186 -99
- package/dist/rules.js +179 -0
- package/dist/rules.js.map +1 -0
- package/dist/rulesCheck.d.ts +5 -4
- package/dist/rulesCheck.js +693 -0
- package/dist/rulesCheck.js.map +1 -0
- package/dist/runes.d.ts +2 -2
- package/dist/runes.js +80 -0
- package/dist/runes.js.map +1 -0
- package/dist/save.d.ts +37 -12
- package/dist/save.js +532 -0
- package/dist/save.js.map +1 -0
- package/dist/scenario.d.ts +2 -2
- package/dist/scenario.js +99 -0
- package/dist/scenario.js.map +1 -0
- package/dist/scheduler.d.ts +3 -0
- package/dist/scheduler.js +156 -0
- package/dist/scheduler.js.map +1 -0
- package/dist/score.d.ts +19 -19
- package/dist/score.js +709 -0
- package/dist/score.js.map +1 -0
- package/dist/sequences.d.ts +10 -6
- package/dist/sequences.js +206 -0
- package/dist/sequences.js.map +1 -0
- package/dist/server/doorman.js +154 -0
- package/dist/server/doorman.js.map +1 -0
- package/dist/server/gameServer.d.ts +16 -1
- package/dist/server/gameServer.js +643 -0
- package/dist/server/gameServer.js.map +1 -0
- package/dist/server/index.d.ts +1 -1
- package/dist/server/lobby.js +199 -0
- package/dist/server/lobby.js.map +1 -0
- package/dist/server/log.js +18 -0
- package/dist/server/log.js.map +1 -0
- package/dist/server/match.js +267 -0
- package/dist/server/match.js.map +1 -0
- package/dist/server/mode.d.ts +18 -9
- package/dist/server/mode.js +220 -0
- package/dist/server/mode.js.map +1 -0
- package/dist/{navigation-worker.js → server/navigation-worker.js} +1 -1
- package/dist/server/navigation-worker.js.map +1 -0
- package/dist/server/navigation.js +39 -0
- package/dist/server/navigation.js.map +1 -0
- package/dist/server/ops.d.ts +4 -0
- package/dist/server/ops.js +137 -0
- package/dist/server/ops.js.map +1 -0
- package/dist/server/packs.d.ts +3 -3
- package/dist/server/packs.js +32 -0
- package/dist/server/packs.js.map +1 -0
- package/dist/server/ratings.d.ts +5 -0
- package/dist/server/ratings.js +104 -0
- package/dist/server/ratings.js.map +1 -0
- package/dist/server/relay.d.ts +12 -2
- package/dist/server/relay.js +144 -0
- package/dist/server/relay.js.map +1 -0
- package/dist/server/rooms.d.ts +9 -2
- package/dist/server/rooms.js +442 -0
- package/dist/server/rooms.js.map +1 -0
- package/dist/server/seat.js +116 -0
- package/dist/server/seat.js.map +1 -0
- package/dist/server/seatSettings.d.ts +3 -3
- package/dist/server/seatSettings.js +63 -0
- package/dist/server/seatSettings.js.map +1 -0
- package/dist/server/secret.js +13 -0
- package/dist/server/secret.js.map +1 -0
- package/dist/server/start.d.ts +13 -6
- package/dist/server/start.js +76 -0
- package/dist/server/start.js.map +1 -0
- package/dist/server/websocket.d.ts +9 -1
- package/dist/server/websocket.js +306 -0
- package/dist/server/websocket.js.map +1 -0
- package/dist/server.js +15 -2861
- package/dist/session/can.js +26 -0
- package/dist/session/can.js.map +1 -0
- package/dist/session/commandReplay.d.ts +8 -2
- package/dist/session/commandReplay.js +293 -0
- package/dist/session/commandReplay.js.map +1 -0
- package/dist/session/debug.js +151 -0
- package/dist/session/debug.js.map +1 -0
- package/dist/session/delay.js +62 -0
- package/dist/session/delay.js.map +1 -0
- package/dist/session/delta.d.ts +14 -1
- package/dist/session/delta.js +407 -0
- package/dist/session/delta.js.map +1 -0
- package/dist/session/entityState.js +415 -0
- package/dist/session/entityState.js.map +1 -0
- package/dist/session/local.d.ts +47 -5
- package/dist/session/local.js +670 -0
- package/dist/session/local.js.map +1 -0
- package/dist/session/memory.d.ts +20 -2
- package/dist/session/memory.js +131 -0
- package/dist/session/memory.js.map +1 -0
- package/dist/session/protocol.d.ts +325 -31
- package/dist/session/protocol.js +55 -0
- package/dist/session/protocol.js.map +1 -0
- package/dist/session/remote.d.ts +74 -12
- package/dist/session/remote.js +1394 -0
- package/dist/session/remote.js.map +1 -0
- package/dist/session/replay.d.ts +11 -2
- package/dist/session/replay.js +160 -0
- package/dist/session/replay.js.map +1 -0
- package/dist/session/seed.js +12 -0
- package/dist/session/seed.js.map +1 -0
- package/dist/session/share.d.ts +5 -1
- package/dist/session/share.js +94 -0
- package/dist/session/share.js.map +1 -0
- package/dist/session/socket.d.ts +1 -1
- package/dist/session/socket.js +29 -0
- package/dist/session/socket.js.map +1 -0
- package/dist/session/wire.d.ts +5 -0
- package/dist/session/wire.js +84 -0
- package/dist/session/wire.js.map +1 -0
- package/dist/session/worker.d.ts +77 -12
- package/dist/session/worker.js +499 -0
- package/dist/session/worker.js.map +1 -0
- package/dist/shared.d.ts +31 -5
- package/dist/shared.js +166 -0
- package/dist/shared.js.map +1 -0
- package/dist/sides.d.ts +9 -3
- package/dist/sides.js +149 -0
- package/dist/sides.js.map +1 -0
- package/dist/sight.js +85 -0
- package/dist/sight.js.map +1 -0
- package/dist/simulate-worker.js +1 -1
- package/dist/simulate.d.ts +12 -8
- package/dist/{simulate-oXBiw1Ff.js → simulate.js} +10 -11
- package/dist/simulate.js.map +1 -0
- package/dist/smart.js +77 -0
- package/dist/smart.js.map +1 -0
- package/dist/spatial.d.ts +32 -16
- package/dist/spatial.js +234 -0
- package/dist/spatial.js.map +1 -0
- package/dist/spawning.d.ts +1 -0
- package/dist/spawning.js +224 -0
- package/dist/spawning.js.map +1 -0
- package/dist/stances.d.ts +6 -3
- package/dist/stances.js +169 -0
- package/dist/stances.js.map +1 -0
- package/dist/start.d.ts +10 -10
- package/dist/start.js +75 -0
- package/dist/start.js.map +1 -0
- package/dist/stats.d.ts +42 -16
- package/dist/stats.js +290 -0
- package/dist/stats.js.map +1 -0
- package/dist/summoned.d.ts +52 -0
- package/dist/summoned.js +38 -0
- package/dist/summoned.js.map +1 -0
- package/dist/summons.d.ts +10 -13
- package/dist/summons.js +271 -0
- package/dist/summons.js.map +1 -0
- package/dist/systems/abilities.js +224 -0
- package/dist/systems/abilities.js.map +1 -0
- package/dist/systems/combat.d.ts +35 -1
- package/dist/systems/combat.js +677 -0
- package/dist/systems/combat.js.map +1 -0
- package/dist/systems/combatTold.d.ts +3 -1
- package/dist/systems/combatTold.js +85 -0
- package/dist/systems/combatTold.js.map +1 -0
- package/dist/systems/construction.js +80 -0
- package/dist/systems/construction.js.map +1 -0
- package/dist/systems/economy.d.ts +0 -6
- package/dist/systems/economy.js +128 -0
- package/dist/systems/economy.js.map +1 -0
- package/dist/systems/fog.d.ts +1 -1
- package/dist/systems/fog.js +120 -0
- package/dist/systems/fog.js.map +1 -0
- package/dist/systems/life.js +32 -0
- package/dist/systems/life.js.map +1 -0
- package/dist/systems/movement.d.ts +24 -12
- package/dist/systems/movement.js +1247 -0
- package/dist/systems/movement.js.map +1 -0
- package/dist/systems/orders.js +64 -0
- package/dist/systems/orders.js.map +1 -0
- package/dist/systems/production.js +322 -0
- package/dist/systems/production.js.map +1 -0
- package/dist/systems/productionQueue.js +120 -0
- package/dist/systems/productionQueue.js.map +1 -0
- package/dist/systems/victory.d.ts +1 -1
- package/dist/systems/victory.js +56 -0
- package/dist/systems/victory.js.map +1 -0
- package/dist/talk.d.ts +6 -6
- package/dist/talk.js +153 -0
- package/dist/talk.js.map +1 -0
- package/dist/targeting.d.ts +142 -0
- package/dist/targeting.js +49 -0
- package/dist/targeting.js.map +1 -0
- package/dist/tech.d.ts +20 -3
- package/dist/tech.js +239 -0
- package/dist/tech.js.map +1 -0
- package/dist/techTree.d.ts +7 -0
- package/dist/techTree.js +90 -0
- package/dist/techTree.js.map +1 -0
- package/dist/terrain.d.ts +59 -7
- package/dist/terrain.js +389 -0
- package/dist/terrain.js.map +1 -0
- package/dist/terrainSave.d.ts +6 -0
- package/dist/terrainSave.js +74 -0
- package/dist/terrainSave.js.map +1 -0
- package/dist/testing.d.ts +8 -7
- package/dist/testing.js +13 -739
- package/dist/testing.js.map +1 -1
- package/dist/tiles.d.ts +1 -1
- package/dist/tiles.js +43 -0
- package/dist/tiles.js.map +1 -0
- package/dist/timers.d.ts +29 -4
- package/dist/timers.js +242 -0
- package/dist/timers.js.map +1 -0
- package/dist/tomes.d.ts +4 -4
- package/dist/tomes.js +94 -0
- package/dist/tomes.js.map +1 -0
- package/dist/trade.js +103 -0
- package/dist/trade.js.map +1 -0
- package/dist/transport.d.ts +6 -1
- package/dist/transport.js +281 -0
- package/dist/transport.js.map +1 -0
- package/dist/tunables.d.ts +10 -3
- package/dist/tunables.js +56 -0
- package/dist/tunables.js.map +1 -0
- package/dist/unitResources.d.ts +67 -0
- package/dist/unitResources.js +266 -0
- package/dist/unitResources.js.map +1 -0
- package/dist/upkeep.d.ts +6 -1
- package/dist/upkeep.js +26 -0
- package/dist/upkeep.js.map +1 -0
- package/dist/veterancy.d.ts +8 -3
- package/dist/veterancy.js +131 -0
- package/dist/veterancy.js.map +1 -0
- package/dist/vision.d.ts +36 -0
- package/dist/vision.js +133 -0
- package/dist/vision.js.map +1 -0
- package/dist/walls.d.ts +1 -1
- package/dist/walls.js +278 -0
- package/dist/walls.js.map +1 -0
- package/dist/world.d.ts +606 -88
- package/dist/world.js +1263 -0
- package/dist/world.js.map +1 -0
- package/package.json +2 -2
- package/dist/ai.js.map +0 -1
- package/dist/attributes.d.ts +0 -66
- package/dist/brain-BvVdUhX8.js +0 -7659
- package/dist/brain-BvVdUhX8.js.map +0 -1
- package/dist/builds-C6LfgvEU.js +0 -460
- package/dist/builds-C6LfgvEU.js.map +0 -1
- package/dist/coreComponents-syuh2fPG.js +0 -5149
- package/dist/coreComponents-syuh2fPG.js.map +0 -1
- package/dist/debugCommands-CzjrSm66.js +0 -14739
- package/dist/debugCommands-CzjrSm66.js.map +0 -1
- package/dist/determinism-BCymQwiE.js +0 -518
- package/dist/determinism-BCymQwiE.js.map +0 -1
- package/dist/game-DiJEN-Ks.js +0 -5800
- package/dist/game-DiJEN-Ks.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/inspect-D9dWHmZ0.js.map +0 -1
- package/dist/local-Dkovq42k.js +0 -1379
- package/dist/local-Dkovq42k.js.map +0 -1
- package/dist/missionRules-C-bGxm0Q.js.map +0 -1
- package/dist/navigation-worker.js.map +0 -1
- package/dist/packs-g5thvmGn.js +0 -3199
- package/dist/packs-g5thvmGn.js.map +0 -1
- package/dist/profiles-B3NS9jwk.js.map +0 -1
- package/dist/server.js.map +0 -1
- package/dist/simulate-oXBiw1Ff.js.map +0 -1
|
@@ -4,19 +4,33 @@
|
|
|
4
4
|
* @beta
|
|
5
5
|
*/
|
|
6
6
|
export interface NavigationBuildConfig {
|
|
7
|
+
/** Recast's cell size on the ground plane, in world units: how finely the ground is voxelised */
|
|
7
8
|
cs: number;
|
|
9
|
+
/** Recast's cell height, in world units: how finely the ground is voxelised vertically */
|
|
8
10
|
ch: number;
|
|
11
|
+
/** The size of one tile of the tile cache, in cells */
|
|
9
12
|
tileSize: number;
|
|
13
|
+
/** The steepest slope that is walkable, in degrees */
|
|
10
14
|
walkableSlopeAngle: number;
|
|
15
|
+
/** The least height of open space a unit needs to stand in, as Recast takes it */
|
|
11
16
|
walkableHeight: number;
|
|
17
|
+
/** The most a unit can step up, as Recast takes it */
|
|
12
18
|
walkableClimb: number;
|
|
19
|
+
/** How far the walkable area is kept from walls, as Recast takes it: the largest unit's radius */
|
|
13
20
|
walkableRadius: number;
|
|
21
|
+
/** The most the edges of the walkable regions' outlines may stray from the ground when simplified */
|
|
14
22
|
maxSimplificationError: number;
|
|
23
|
+
/** The smallest region that is kept apart; smaller ones are merged into a neighbour */
|
|
15
24
|
mergeRegionArea: number;
|
|
25
|
+
/** The most vertices a polygon of the navigation mesh has */
|
|
16
26
|
maxVertsPerPoly: number;
|
|
27
|
+
/** How far apart the points are where the mesh's height is sampled */
|
|
17
28
|
detailSampleDist: number;
|
|
29
|
+
/** The most the mesh's height may differ from the ground between sampled points */
|
|
18
30
|
detailSampleMaxError: number;
|
|
31
|
+
/** How many layers of walkable space a tile is expected to have, for the tile cache's size */
|
|
19
32
|
expectedLayersPerTile: number;
|
|
33
|
+
/** How many obstacles (buildings, shut gates) the tile cache has room for */
|
|
20
34
|
maxObstacles: number;
|
|
21
35
|
}
|
|
22
36
|
/**
|
|
@@ -25,8 +39,11 @@ export interface NavigationBuildConfig {
|
|
|
25
39
|
* @beta
|
|
26
40
|
*/
|
|
27
41
|
export interface NavigationBuild {
|
|
42
|
+
/** The ground's triangles as x, y, z triples, three vertices to a triangle */
|
|
28
43
|
positions: Float32Array;
|
|
44
|
+
/** The triangles as indices into `positions` */
|
|
29
45
|
indices: Uint32Array;
|
|
46
|
+
/** How the triangles are cut */
|
|
30
47
|
config: NavigationBuildConfig;
|
|
31
48
|
/**
|
|
32
49
|
* How fast one on foot goes over each cell of the ground (`groundSpeedOfCell`), for a path to weigh: none where every
|
|
@@ -40,8 +57,11 @@ export interface NavigationBuild {
|
|
|
40
57
|
* @beta
|
|
41
58
|
*/
|
|
42
59
|
export interface NavigationSpeeds {
|
|
60
|
+
/** The width of the speed grid in cells */
|
|
43
61
|
width: number;
|
|
62
|
+
/** The depth of the speed grid in cells */
|
|
44
63
|
depth: number;
|
|
64
|
+
/** The speed over each cell, a multiplier where 1 is the ground's ordinary pace */
|
|
45
65
|
values: Float32Array;
|
|
46
66
|
}
|
|
47
67
|
/**
|
|
@@ -58,7 +78,9 @@ export type NavigationBuilder = (build: NavigationBuild) => Promise<Uint8Array>;
|
|
|
58
78
|
* @beta
|
|
59
79
|
*/
|
|
60
80
|
export interface NavigationCache {
|
|
81
|
+
/** Gives what was built under the key, or undefined when nothing was; may answer later */
|
|
61
82
|
get(key: string): Uint8Array | undefined | Promise<Uint8Array | undefined>;
|
|
83
|
+
/** Keeps what was built under the key */
|
|
62
84
|
set(key: string, data: Uint8Array): void | Promise<void>;
|
|
63
85
|
}
|
|
64
86
|
/** Recast's WebAssembly, once for each thread */
|
|
@@ -82,11 +104,14 @@ export declare function memoryNavigationCache(maxBytes?: number): NavigationCach
|
|
|
82
104
|
* @beta
|
|
83
105
|
*/
|
|
84
106
|
export interface NavigationWorkerLike {
|
|
107
|
+
/** Sends the worker a message; `transfer` lists the buffers handed over rather than copied */
|
|
85
108
|
postMessage(message: unknown, transfer?: unknown[]): void;
|
|
109
|
+
/** Listens for the worker's `message` and `error`, as a page's worker does */
|
|
86
110
|
addEventListener?(type: 'message' | 'error', listener: (event: {
|
|
87
111
|
data?: unknown;
|
|
88
112
|
message?: string;
|
|
89
113
|
}) => void): void;
|
|
114
|
+
/** Listens for the worker's `message` and `error`, as Node's `worker_threads` worker does */
|
|
90
115
|
on?(type: 'message' | 'error', listener: (value: unknown) => void): void;
|
|
91
116
|
}
|
|
92
117
|
/**
|
|
@@ -97,21 +122,26 @@ export interface NavigationWorkerLike {
|
|
|
97
122
|
* `navigationWorker(() => new Worker(new URL('./navigation.worker.ts', import.meta.url), { type: 'module' }))`, the
|
|
98
123
|
* builder of every world it makes (`NavigationBuilds`).
|
|
99
124
|
* Given as a function, the worker is made at the first build: a page whose menu builds nothing fetches none of it
|
|
100
|
-
* until a world is made (OF2); given made, it is used as it is
|
|
125
|
+
* until a world is made (OF2); given made, it is used as it is. Given as a function, as many as `workers` are made as
|
|
126
|
+
* builds are asked at once (a world's navigations, one for each size of unit, the water's, each side's: built side by
|
|
127
|
+
* side, the Well's four in the time of its longest), each build to the one with the fewest under way
|
|
101
128
|
*
|
|
102
129
|
* @beta
|
|
103
130
|
*/
|
|
104
|
-
export declare function navigationWorker(given: NavigationWorkerLike | (() => NavigationWorkerLike)): NavigationBuilder;
|
|
131
|
+
export declare function navigationWorker(given: NavigationWorkerLike | (() => NavigationWorkerLike), workers?: number): NavigationBuilder;
|
|
105
132
|
/**
|
|
106
133
|
* Where a worker hears and answers: a page's worker scope, or Node's `parentPort`
|
|
107
134
|
*
|
|
108
135
|
* @beta
|
|
109
136
|
*/
|
|
110
137
|
export interface NavigationPort {
|
|
138
|
+
/** Sends a message back to whoever started the worker; `transfer` lists the buffers handed over */
|
|
111
139
|
postMessage(message: unknown, transfer?: unknown[]): void;
|
|
140
|
+
/** Listens for the messages sent to the worker, as a page's worker scope does */
|
|
112
141
|
addEventListener?(type: 'message', listener: (event: {
|
|
113
142
|
data: unknown;
|
|
114
143
|
}) => void): void;
|
|
144
|
+
/** Listens for the messages sent to the worker, as Node's `parentPort` does */
|
|
115
145
|
on?(type: 'message', listener: (value: unknown) => void): void;
|
|
116
146
|
}
|
|
117
147
|
/**
|
|
@@ -130,7 +160,9 @@ export declare function serveNavigationBuilds(port?: NavigationPort): void;
|
|
|
130
160
|
* @beta
|
|
131
161
|
*/
|
|
132
162
|
export interface NavigationBuilds {
|
|
163
|
+
/** Builds a navigation on this thread, or somewhere else when set to a worker's; this thread when left out */
|
|
133
164
|
builder?: NavigationBuilder;
|
|
165
|
+
/** Where what was built is kept between worlds; the process's memory when left out, nowhere for `null` */
|
|
134
166
|
cache?: NavigationCache | null;
|
|
135
167
|
}
|
|
136
168
|
/**
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
import { generateGroundTileCache } from "./groundAreas.js";
|
|
2
|
+
import { exportTileCache, init } from "@recast-navigation/core";
|
|
3
|
+
import { generateTileCache } from "@recast-navigation/generators";
|
|
4
|
+
//#region src/navigation/builds.ts
|
|
5
|
+
var initialized;
|
|
6
|
+
/** Recast's WebAssembly, once for each thread */
|
|
7
|
+
var initRecast = () => initialized ??= init();
|
|
8
|
+
/**
|
|
9
|
+
* Builds a navigation on this thread, and gives back what was built: what a worker does too
|
|
10
|
+
*
|
|
11
|
+
* @beta
|
|
12
|
+
*/
|
|
13
|
+
async function buildNavigationData(build) {
|
|
14
|
+
await initRecast();
|
|
15
|
+
return buildNavigationNow(build);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Builds a navigation on this thread at once, Recast's WebAssembly there already (`initRecast`): a navigation made
|
|
19
|
+
* again in the middle of a tick, its ground reshaped (`RecastNavigation.reshape`)
|
|
20
|
+
*
|
|
21
|
+
* @internal
|
|
22
|
+
*/
|
|
23
|
+
function buildNavigationNow(build) {
|
|
24
|
+
if (build.speeds) {
|
|
25
|
+
const { navMesh, tileCache } = generateGroundTileCache(build);
|
|
26
|
+
try {
|
|
27
|
+
return exportTileCache(navMesh, tileCache);
|
|
28
|
+
} finally {
|
|
29
|
+
tileCache.destroy();
|
|
30
|
+
navMesh.destroy();
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
const result = generateTileCache(build.positions, build.indices, build.config);
|
|
34
|
+
if (!result.success) throw new Error(`Navmesh generation failed: ${result.error}`);
|
|
35
|
+
const { navMesh, tileCache } = result;
|
|
36
|
+
try {
|
|
37
|
+
return exportTileCache(navMesh, tileCache);
|
|
38
|
+
} finally {
|
|
39
|
+
tileCache.destroy();
|
|
40
|
+
navMesh.destroy();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Kept in memory, the last built first, up to `maxBytes` of them (64 MB when left out): a map of 512 cells a side is
|
|
45
|
+
* under a megabyte
|
|
46
|
+
*
|
|
47
|
+
* @beta
|
|
48
|
+
*/
|
|
49
|
+
function memoryNavigationCache(maxBytes = 67108864) {
|
|
50
|
+
const kept = /* @__PURE__ */ new Map();
|
|
51
|
+
let bytes = 0;
|
|
52
|
+
return {
|
|
53
|
+
get(key) {
|
|
54
|
+
const data = kept.get(key);
|
|
55
|
+
if (!data) return void 0;
|
|
56
|
+
kept.delete(key);
|
|
57
|
+
kept.set(key, data);
|
|
58
|
+
return data;
|
|
59
|
+
},
|
|
60
|
+
set(key, data) {
|
|
61
|
+
const before = kept.get(key);
|
|
62
|
+
if (before) bytes -= before.byteLength;
|
|
63
|
+
kept.delete(key);
|
|
64
|
+
kept.set(key, data);
|
|
65
|
+
bytes += data.byteLength;
|
|
66
|
+
for (const [old, value] of kept) {
|
|
67
|
+
if (bytes <= maxBytes || old === key) break;
|
|
68
|
+
kept.delete(old);
|
|
69
|
+
bytes -= value.byteLength;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* The key of a build: a hash of the triangles and of how they are cut. Two builds of the same key make the same
|
|
76
|
+
* navigation
|
|
77
|
+
*
|
|
78
|
+
* @internal
|
|
79
|
+
*/
|
|
80
|
+
function navigationKey(build) {
|
|
81
|
+
let a = 2166136261;
|
|
82
|
+
let b = 1523705862;
|
|
83
|
+
const mix = (word) => {
|
|
84
|
+
a = Math.imul(a ^ word, 16777619);
|
|
85
|
+
b = Math.imul(b ^ word, 1540483477);
|
|
86
|
+
};
|
|
87
|
+
const positions = new Uint32Array(build.positions.buffer, build.positions.byteOffset, build.positions.length);
|
|
88
|
+
for (let i = 0; i < positions.length; i++) mix(positions[i]);
|
|
89
|
+
mix(4294967295);
|
|
90
|
+
for (let i = 0; i < build.indices.length; i++) mix(build.indices[i]);
|
|
91
|
+
const config = JSON.stringify(build.config, Object.keys(build.config).sort());
|
|
92
|
+
for (let i = 0; i < config.length; i++) mix(config.charCodeAt(i));
|
|
93
|
+
if (build.speeds) {
|
|
94
|
+
mix(4294967294);
|
|
95
|
+
mix(build.speeds.width);
|
|
96
|
+
const speeds = new Uint32Array(build.speeds.values.buffer, build.speeds.values.byteOffset, build.speeds.values.length);
|
|
97
|
+
for (let i = 0; i < speeds.length; i++) {
|
|
98
|
+
let word = speeds[i];
|
|
99
|
+
word = Math.imul(word ^ word >>> 16, 2246822507);
|
|
100
|
+
word = Math.imul(word ^ word >>> 13, 3266489909);
|
|
101
|
+
mix((word ^ word >>> 16) >>> 0);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return `${(a >>> 0).toString(16).padStart(8, "0")}${(b >>> 0).toString(16).padStart(8, "0")}-${positions.length}`;
|
|
105
|
+
}
|
|
106
|
+
/** How many workers a page's builder makes at most: three, or one fewer than the machine's threads where that is less */
|
|
107
|
+
function defaultWorkers() {
|
|
108
|
+
const threads = globalThis.navigator?.hardwareConcurrency ?? 2;
|
|
109
|
+
return Math.min(3, Math.max(1, threads - 1));
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* A builder that builds in a worker: one whose file serves builds (`serveNavigationBuilds`). In a page, the page makes
|
|
113
|
+
* the worker, as its bundler wants it: the library makes no worker of its own there.
|
|
114
|
+
*
|
|
115
|
+
* A worker's file of two lines (`serveNavigationBuilds` imported from the engine, and called), and the page:
|
|
116
|
+
* `navigationWorker(() => new Worker(new URL('./navigation.worker.ts', import.meta.url), { type: 'module' }))`, the
|
|
117
|
+
* builder of every world it makes (`NavigationBuilds`).
|
|
118
|
+
* Given as a function, the worker is made at the first build: a page whose menu builds nothing fetches none of it
|
|
119
|
+
* until a world is made (OF2); given made, it is used as it is. Given as a function, as many as `workers` are made as
|
|
120
|
+
* builds are asked at once (a world's navigations, one for each size of unit, the water's, each side's: built side by
|
|
121
|
+
* side, the Well's four in the time of its longest), each build to the one with the fewest under way
|
|
122
|
+
*
|
|
123
|
+
* @beta
|
|
124
|
+
*/
|
|
125
|
+
function navigationWorker(given, workers = defaultWorkers()) {
|
|
126
|
+
let next = 0;
|
|
127
|
+
const waiting = /* @__PURE__ */ new Map();
|
|
128
|
+
const answered = (answer) => {
|
|
129
|
+
const wait = waiting.get(answer.id);
|
|
130
|
+
if (!wait) return;
|
|
131
|
+
waiting.delete(answer.id);
|
|
132
|
+
wait.by.busy--;
|
|
133
|
+
if (answer.data) wait.done(answer.data);
|
|
134
|
+
else wait.failed(new Error(answer.error ?? "The navigation could not be built"));
|
|
135
|
+
};
|
|
136
|
+
const broke = (hired, error) => {
|
|
137
|
+
const reason = /* @__PURE__ */ new Error(`The navigation's worker stopped: ${error instanceof Error ? error.message : String(error?.message ?? error)}`);
|
|
138
|
+
for (const [id, wait] of waiting) if (wait.by === hired) {
|
|
139
|
+
waiting.delete(id);
|
|
140
|
+
wait.failed(reason);
|
|
141
|
+
}
|
|
142
|
+
hired.busy = 0;
|
|
143
|
+
};
|
|
144
|
+
const hired = [];
|
|
145
|
+
const hire = (worker) => {
|
|
146
|
+
const one = {
|
|
147
|
+
worker,
|
|
148
|
+
busy: 0
|
|
149
|
+
};
|
|
150
|
+
if (worker.on) {
|
|
151
|
+
worker.on("message", (value) => answered(value));
|
|
152
|
+
worker.on("error", (error) => broke(one, error));
|
|
153
|
+
} else {
|
|
154
|
+
worker.addEventListener?.("message", (event) => answered(event.data));
|
|
155
|
+
worker.addEventListener?.("error", (error) => broke(one, error));
|
|
156
|
+
}
|
|
157
|
+
hired.push(one);
|
|
158
|
+
return one;
|
|
159
|
+
};
|
|
160
|
+
const worker = () => {
|
|
161
|
+
const idle = hired.reduce((best, each) => !best || each.busy < best.busy ? each : best, void 0);
|
|
162
|
+
if (idle && (idle.busy === 0 || typeof given !== "function" || hired.length >= Math.max(1, workers))) return idle;
|
|
163
|
+
return hire(typeof given === "function" ? given() : given);
|
|
164
|
+
};
|
|
165
|
+
if (typeof given !== "function") hire(given);
|
|
166
|
+
return (build) => new Promise((done, failed) => {
|
|
167
|
+
const id = ++next;
|
|
168
|
+
const by = worker();
|
|
169
|
+
by.busy++;
|
|
170
|
+
waiting.set(id, {
|
|
171
|
+
done,
|
|
172
|
+
failed,
|
|
173
|
+
by
|
|
174
|
+
});
|
|
175
|
+
by.worker.postMessage({
|
|
176
|
+
id,
|
|
177
|
+
build: {
|
|
178
|
+
positions: build.positions.slice(),
|
|
179
|
+
indices: build.indices.slice(),
|
|
180
|
+
config: build.config,
|
|
181
|
+
...build.speeds && { speeds: {
|
|
182
|
+
...build.speeds,
|
|
183
|
+
values: build.speeds.values.slice()
|
|
184
|
+
} }
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* What a navigation worker's file does: it builds what it is sent and sends back what it built. `port` is where it
|
|
191
|
+
* hears: the worker's own scope when left out (a page's worker)
|
|
192
|
+
*
|
|
193
|
+
* @beta
|
|
194
|
+
*/
|
|
195
|
+
function serveNavigationBuilds(port = globalThis) {
|
|
196
|
+
const asked = async (message) => {
|
|
197
|
+
const { id, build } = message;
|
|
198
|
+
try {
|
|
199
|
+
const data = await buildNavigationData(build);
|
|
200
|
+
port.postMessage({
|
|
201
|
+
id,
|
|
202
|
+
data
|
|
203
|
+
}, [data.buffer]);
|
|
204
|
+
} catch (error) {
|
|
205
|
+
port.postMessage({
|
|
206
|
+
id,
|
|
207
|
+
error: error instanceof Error ? error.message : String(error)
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
if (port.on) port.on("message", (value) => void asked(value));
|
|
212
|
+
else port.addEventListener?.("message", (event) => void asked(event.data));
|
|
213
|
+
}
|
|
214
|
+
/** Where a world says nothing: this thread, and kept in the process's memory, which every world's ground may read */
|
|
215
|
+
var defaults = {
|
|
216
|
+
builder: buildNavigationData,
|
|
217
|
+
cache: memoryNavigationCache()
|
|
218
|
+
};
|
|
219
|
+
/**
|
|
220
|
+
* What was built from this: kept, or built now (by the builder set) and kept. A builder that fails falls back to this
|
|
221
|
+
* thread once, and says why in what it throws only when that fails too
|
|
222
|
+
*/
|
|
223
|
+
async function navigationData(build, using = {}) {
|
|
224
|
+
const cache = using.cache !== void 0 ? using.cache : defaults.cache;
|
|
225
|
+
const builder = using.builder ?? defaults.builder;
|
|
226
|
+
const key = cache ? navigationKey(build) : "";
|
|
227
|
+
const building = cache ? buildsOf(cache) : void 0;
|
|
228
|
+
const under = building?.get(key);
|
|
229
|
+
if (under) return under;
|
|
230
|
+
const made = (async () => {
|
|
231
|
+
const kept = cache ? await cache.get(key) : void 0;
|
|
232
|
+
if (kept) return kept;
|
|
233
|
+
let data;
|
|
234
|
+
try {
|
|
235
|
+
data = await builder(build);
|
|
236
|
+
} catch (error) {
|
|
237
|
+
if (builder === buildNavigationData) throw error;
|
|
238
|
+
data = await buildNavigationData(build);
|
|
239
|
+
}
|
|
240
|
+
if (cache) await cache.set(key, data);
|
|
241
|
+
return data;
|
|
242
|
+
})();
|
|
243
|
+
if (!building) return made;
|
|
244
|
+
building.set(key, made);
|
|
245
|
+
try {
|
|
246
|
+
return await made;
|
|
247
|
+
} finally {
|
|
248
|
+
building.delete(key);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
/** The last of the works on this thread asked to go one after another (`inTurn`): settled once it is done */
|
|
252
|
+
var turn = Promise.resolve();
|
|
253
|
+
/**
|
|
254
|
+
* Runs `work` once every work asked before it this way is done, failed or not: Recast's WebAssembly on this thread, a
|
|
255
|
+
* navigation built and read before the next is built (`RecastNavigation.create`)
|
|
256
|
+
*
|
|
257
|
+
* @internal
|
|
258
|
+
*/
|
|
259
|
+
function inTurn(work) {
|
|
260
|
+
const done = turn.then(work, work);
|
|
261
|
+
turn = done.catch(() => void 0);
|
|
262
|
+
return done;
|
|
263
|
+
}
|
|
264
|
+
/** The builds under way for what a cache keeps, by their key */
|
|
265
|
+
var underWay = /* @__PURE__ */ new WeakMap();
|
|
266
|
+
var buildsOf = (cache) => {
|
|
267
|
+
let builds = underWay.get(cache);
|
|
268
|
+
if (!builds) underWay.set(cache, builds = /* @__PURE__ */ new Map());
|
|
269
|
+
return builds;
|
|
270
|
+
};
|
|
271
|
+
/**
|
|
272
|
+
* What each makes, made side by side and given back in their order: where one fails, those the others made are freed
|
|
273
|
+
* (WebAssembly memory) once all are settled, and the first failure is thrown
|
|
274
|
+
*
|
|
275
|
+
* @internal
|
|
276
|
+
*/
|
|
277
|
+
async function allOrFreed(makes) {
|
|
278
|
+
const settled = await Promise.allSettled(makes.map((make) => make()));
|
|
279
|
+
const failed = settled.find((each) => each.status === "rejected");
|
|
280
|
+
if (!failed) return settled.map((each) => each.value);
|
|
281
|
+
for (const each of settled) if (each.status === "fulfilled") each.value?.dispose();
|
|
282
|
+
throw failed.reason;
|
|
283
|
+
}
|
|
284
|
+
//#endregion
|
|
285
|
+
export { allOrFreed, buildNavigationData, buildNavigationNow, inTurn, initRecast, memoryNavigationCache, navigationData, navigationKey, navigationWorker, serveNavigationBuilds };
|
|
286
|
+
|
|
287
|
+
//# sourceMappingURL=builds.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builds.js","names":[],"sources":["../../src/navigation/builds.ts"],"sourcesContent":["import { exportTileCache, init } from '@recast-navigation/core'\nimport { generateTileCache } from '@recast-navigation/generators'\nimport { generateGroundTileCache } from './groundAreas'\n\n/*\n * Building a navigation off the thread that runs the game, and not again for ground it was built for (S37). A build of\n * the whole map blocks: 0.1 s for 128 cells a side, 0.4 s for 256, 2 s for 512, on every world made or loaded. What a\n * build makes is data (Recast's tile cache, exported): built once, it is kept by a hash of what it was built from, and\n * a world made again on the same ground (a restart, a load, Play here) reads it in a few milliseconds. Every navigation\n * is read from that data, built just now or kept, so the two are the same navigation: nothing depends on whether a\n * build was kept, nor on how long it took, and the world does not step until it is there.\n */\n\n/**\n * How Recast is told to cut the ground: what the tile cache is generated with\n *\n * @beta\n */\nexport interface NavigationBuildConfig {\n\t/** Recast's cell size on the ground plane, in world units: how finely the ground is voxelised */\n\tcs: number\n\t/** Recast's cell height, in world units: how finely the ground is voxelised vertically */\n\tch: number\n\t/** The size of one tile of the tile cache, in cells */\n\ttileSize: number\n\t/** The steepest slope that is walkable, in degrees */\n\twalkableSlopeAngle: number\n\t/** The least height of open space a unit needs to stand in, as Recast takes it */\n\twalkableHeight: number\n\t/** The most a unit can step up, as Recast takes it */\n\twalkableClimb: number\n\t/** How far the walkable area is kept from walls, as Recast takes it: the largest unit's radius */\n\twalkableRadius: number\n\t/** The most the edges of the walkable regions' outlines may stray from the ground when simplified */\n\tmaxSimplificationError: number\n\t/** The smallest region that is kept apart; smaller ones are merged into a neighbour */\n\tmergeRegionArea: number\n\t/** The most vertices a polygon of the navigation mesh has */\n\tmaxVertsPerPoly: number\n\t/** How far apart the points are where the mesh's height is sampled */\n\tdetailSampleDist: number\n\t/** The most the mesh's height may differ from the ground between sampled points */\n\tdetailSampleMaxError: number\n\t/** How many layers of walkable space a tile is expected to have, for the tile cache's size */\n\texpectedLayersPerTile: number\n\t/** How many obstacles (buildings, shut gates) the tile cache has room for */\n\tmaxObstacles: number\n}\n\n/**\n * What a navigation is built from: the ground's (or the water's) triangles, and how to cut them. Plain data, sent to a worker as it is\n *\n * @beta\n */\nexport interface NavigationBuild {\n\t/** The ground's triangles as x, y, z triples, three vertices to a triangle */\n\tpositions: Float32Array\n\t/** The triangles as indices into `positions` */\n\tindices: Uint32Array\n\t/** How the triangles are cut */\n\tconfig: NavigationBuildConfig\n\t/**\n\t * How fast one on foot goes over each cell of the ground (`groundSpeedOfCell`), for a path to weigh: none where every\n\t * cell is 1, which cuts the ground as it always was\n\t */\n\tspeeds?: NavigationSpeeds\n}\n\n/**\n * Each cell's speed on the ground, row by row (`NavigationBuild.speeds`)\n *\n * @beta\n */\nexport interface NavigationSpeeds {\n\t/** The width of the speed grid in cells */\n\twidth: number\n\t/** The depth of the speed grid in cells */\n\tdepth: number\n\t/** The speed over each cell, a multiplier where 1 is the ground's ordinary pace */\n\tvalues: Float32Array\n}\n\n/**\n * What builds a navigation: given what to build, gives back what was built (Recast's tile cache, exported). On this\n * thread (`buildNavigationData`), or in a worker (`navigationWorker`)\n *\n * @beta\n */\nexport type NavigationBuilder = (build: NavigationBuild) => Promise<Uint8Array>\n\n/**\n * Where what was built is kept, by a hash of what it was built from: in memory when nothing else is said\n * (`memoryNavigationCache`). A game keeps it elsewhere with one of its own (the browser's storage, a file)\n *\n * @beta\n */\nexport interface NavigationCache {\n\t/** Gives what was built under the key, or undefined when nothing was; may answer later */\n\tget(key: string): Uint8Array | undefined | Promise<Uint8Array | undefined>\n\t/** Keeps what was built under the key */\n\tset(key: string, data: Uint8Array): void | Promise<void>\n}\n\nlet initialized: Promise<void> | undefined\n\n/** Recast's WebAssembly, once for each thread */\nexport const initRecast = (): Promise<void> => (initialized ??= init())\n\n/**\n * Builds a navigation on this thread, and gives back what was built: what a worker does too\n *\n * @beta\n */\nexport async function buildNavigationData(build: NavigationBuild): Promise<Uint8Array> {\n\tawait initRecast()\n\treturn buildNavigationNow(build)\n}\n\n/**\n * Builds a navigation on this thread at once, Recast's WebAssembly there already (`initRecast`): a navigation made\n * again in the middle of a tick, its ground reshaped (`RecastNavigation.reshape`)\n *\n * @internal\n */\nexport function buildNavigationNow(build: NavigationBuild): Uint8Array {\n\t// slow ground marked as it is cut (EN2); ground without any, as Recast cuts it\n\tif (build.speeds) {\n\t\tconst { navMesh, tileCache } = generateGroundTileCache(build)\n\t\ttry {\n\t\t\treturn exportTileCache(navMesh, tileCache)\n\t\t} finally {\n\t\t\ttileCache.destroy()\n\t\t\tnavMesh.destroy()\n\t\t}\n\t}\n\tconst result = generateTileCache(build.positions, build.indices, build.config)\n\tif (!result.success) throw new Error(`Navmesh generation failed: ${result.error}`)\n\tconst { navMesh, tileCache } = result\n\ttry {\n\t\treturn exportTileCache(navMesh, tileCache)\n\t} finally {\n\t\ttileCache.destroy()\n\t\tnavMesh.destroy()\n\t}\n}\n\n/**\n * Kept in memory, the last built first, up to `maxBytes` of them (64 MB when left out): a map of 512 cells a side is\n * under a megabyte\n *\n * @beta\n */\nexport function memoryNavigationCache(maxBytes = 64 * 1024 * 1024): NavigationCache {\n\tconst kept = new Map<string, Uint8Array>()\n\tlet bytes = 0\n\treturn {\n\t\tget(key) {\n\t\t\tconst data = kept.get(key)\n\t\t\tif (!data) return undefined\n\t\t\t// used: the last to go\n\t\t\tkept.delete(key)\n\t\t\tkept.set(key, data)\n\t\t\treturn data\n\t\t},\n\t\tset(key, data) {\n\t\t\tconst before = kept.get(key)\n\t\t\tif (before) bytes -= before.byteLength\n\t\t\tkept.delete(key)\n\t\t\tkept.set(key, data)\n\t\t\tbytes += data.byteLength\n\t\t\tfor (const [old, value] of kept) {\n\t\t\t\tif (bytes <= maxBytes || old === key) break\n\t\t\t\tkept.delete(old)\n\t\t\t\tbytes -= value.byteLength\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * The key of a build: a hash of the triangles and of how they are cut. Two builds of the same key make the same\n * navigation\n *\n * @internal\n */\nexport function navigationKey(build: NavigationBuild): string {\n\t// FNV-1a over the words, twice over with different starts, for 64 bits: enough to tell grounds apart, not a secret\n\tlet a = 0x811c9dc5\n\tlet b = 0x01000193 ^ 0x5bd1e995\n\tconst mix = (word: number) => {\n\t\ta = Math.imul(a ^ word, 0x01000193)\n\t\tb = Math.imul(b ^ word, 0x5bd1e995)\n\t}\n\tconst positions = new Uint32Array(build.positions.buffer, build.positions.byteOffset, build.positions.length)\n\tfor (let i = 0; i < positions.length; i++) mix(positions[i])\n\tmix(0xffffffff)\n\tfor (let i = 0; i < build.indices.length; i++) mix(build.indices[i])\n\tconst config = JSON.stringify(build.config, Object.keys(build.config).sort())\n\tfor (let i = 0; i < config.length; i++) mix(config.charCodeAt(i))\n\t// the paint's speeds too, where there are any: a build of none is keyed as one always was\n\tif (build.speeds) {\n\t\tmix(0xfffffffe)\n\t\tmix(build.speeds.width)\n\t\tconst speeds = new Uint32Array(build.speeds.values.buffer, build.speeds.values.byteOffset, build.speeds.values.length)\n\t\t// each word stirred first: FNV a word at a time carries a change of a word's high bits into the high bits alone, so\n\t\t// that speeds that differ only there (1 and -1, which stops one on foot) came to the same key, two cells apart\n\t\tfor (let i = 0; i < speeds.length; i++) {\n\t\t\tlet word = speeds[i]\n\t\t\tword = Math.imul(word ^ (word >>> 16), 0x85ebca6b)\n\t\t\tword = Math.imul(word ^ (word >>> 13), 0xc2b2ae35)\n\t\t\tmix((word ^ (word >>> 16)) >>> 0)\n\t\t}\n\t}\n\treturn `${(a >>> 0).toString(16).padStart(8, '0')}${(b >>> 0).toString(16).padStart(8, '0')}-${positions.length}`\n}\n\n/**\n * What a worker is, as far as building goes: a page's `Worker`, or Node's `worker_threads` one\n *\n * @beta\n */\nexport interface NavigationWorkerLike {\n\t/** Sends the worker a message; `transfer` lists the buffers handed over rather than copied */\n\tpostMessage(message: unknown, transfer?: unknown[]): void\n\t/** Listens for the worker's `message` and `error`, as a page's worker does */\n\taddEventListener?(type: 'message' | 'error', listener: (event: { data?: unknown; message?: string }) => void): void\n\t/** Listens for the worker's `message` and `error`, as Node's `worker_threads` worker does */\n\ton?(type: 'message' | 'error', listener: (value: unknown) => void): void\n}\n\n/** How many workers a page's builder makes at most: three, or one fewer than the machine's threads where that is less */\nfunction defaultWorkers(): number {\n\tconst threads = (globalThis as { navigator?: { hardwareConcurrency?: number } }).navigator?.hardwareConcurrency ?? 2\n\treturn Math.min(3, Math.max(1, threads - 1))\n}\n\ninterface BuildAnswer {\n\tid: number\n\tdata?: Uint8Array\n\terror?: string\n}\n\n/**\n * A builder that builds in a worker: one whose file serves builds (`serveNavigationBuilds`). In a page, the page makes\n * the worker, as its bundler wants it: the library makes no worker of its own there.\n *\n * A worker's file of two lines (`serveNavigationBuilds` imported from the engine, and called), and the page:\n * `navigationWorker(() => new Worker(new URL('./navigation.worker.ts', import.meta.url), { type: 'module' }))`, the\n * builder of every world it makes (`NavigationBuilds`).\n * Given as a function, the worker is made at the first build: a page whose menu builds nothing fetches none of it\n * until a world is made (OF2); given made, it is used as it is. Given as a function, as many as `workers` are made as\n * builds are asked at once (a world's navigations, one for each size of unit, the water's, each side's: built side by\n * side, the Well's four in the time of its longest), each build to the one with the fewest under way\n *\n * @beta\n */\nexport function navigationWorker(given: NavigationWorkerLike | (() => NavigationWorkerLike), workers = defaultWorkers()): NavigationBuilder {\n\tlet next = 0\n\tconst waiting = new Map<number, { done: (data: Uint8Array) => void; failed: (error: Error) => void; by: Hired }>()\n\tinterface Hired {\n\t\tworker: NavigationWorkerLike\n\t\tbusy: number\n\t}\n\tconst answered = (answer: BuildAnswer) => {\n\t\tconst wait = waiting.get(answer.id)\n\t\tif (!wait) return\n\t\twaiting.delete(answer.id)\n\t\twait.by.busy--\n\t\tif (answer.data) wait.done(answer.data)\n\t\telse wait.failed(new Error(answer.error ?? 'The navigation could not be built'))\n\t}\n\tconst broke = (hired: Hired, error: unknown) => {\n\t\tconst reason = new Error(\n\t\t\t`The navigation's worker stopped: ${error instanceof Error ? error.message : String((error as { message?: string })?.message ?? error)}`\n\t\t)\n\t\t// what that worker was building: the others go on\n\t\tfor (const [id, wait] of waiting)\n\t\t\tif (wait.by === hired) {\n\t\t\t\twaiting.delete(id)\n\t\t\t\twait.failed(reason)\n\t\t\t}\n\t\thired.busy = 0\n\t}\n\tconst hired: Hired[] = []\n\tconst hire = (worker: NavigationWorkerLike) => {\n\t\tconst one: Hired = { worker, busy: 0 }\n\t\tif (worker.on) {\n\t\t\tworker.on('message', (value) => answered(value as BuildAnswer))\n\t\t\tworker.on('error', (error) => broke(one, error))\n\t\t} else {\n\t\t\tworker.addEventListener?.('message', (event) => answered(event.data as BuildAnswer))\n\t\t\tworker.addEventListener?.('error', (error) => broke(one, error))\n\t\t}\n\t\thired.push(one)\n\t\treturn one\n\t}\n\t// the one with the fewest builds under way; another made while each has some and there may be more\n\tconst worker = (): Hired => {\n\t\tconst idle = hired.reduce<Hired | undefined>((best, each) => (!best || each.busy < best.busy ? each : best), undefined)\n\t\tif (idle && (idle.busy === 0 || typeof given !== 'function' || hired.length >= Math.max(1, workers))) return idle\n\t\treturn hire(typeof given === 'function' ? given() : given)\n\t}\n\t// a worker given made is listened to now; one given as what makes it is made at the first build\n\tif (typeof given !== 'function') hire(given)\n\treturn (build) =>\n\t\tnew Promise<Uint8Array>((done, failed) => {\n\t\t\tconst id = ++next\n\t\t\tconst by = worker()\n\t\t\tby.busy++\n\t\t\twaiting.set(id, { done, failed, by })\n\t\t\t// copies: the triangles are the terrain's, and stay where they are\n\t\t\tby.worker.postMessage({\n\t\t\t\tid,\n\t\t\t\tbuild: {\n\t\t\t\t\tpositions: build.positions.slice(),\n\t\t\t\t\tindices: build.indices.slice(),\n\t\t\t\t\tconfig: build.config,\n\t\t\t\t\t...(build.speeds && { speeds: { ...build.speeds, values: build.speeds.values.slice() } })\n\t\t\t\t}\n\t\t\t})\n\t\t})\n}\n\n/**\n * Where a worker hears and answers: a page's worker scope, or Node's `parentPort`\n *\n * @beta\n */\nexport interface NavigationPort {\n\t/** Sends a message back to whoever started the worker; `transfer` lists the buffers handed over */\n\tpostMessage(message: unknown, transfer?: unknown[]): void\n\t/** Listens for the messages sent to the worker, as a page's worker scope does */\n\taddEventListener?(type: 'message', listener: (event: { data: unknown }) => void): void\n\t/** Listens for the messages sent to the worker, as Node's `parentPort` does */\n\ton?(type: 'message', listener: (value: unknown) => void): void\n}\n\n/**\n * What a navigation worker's file does: it builds what it is sent and sends back what it built. `port` is where it\n * hears: the worker's own scope when left out (a page's worker)\n *\n * @beta\n */\nexport function serveNavigationBuilds(port: NavigationPort = globalThis as unknown as NavigationPort): void {\n\tconst asked = async (message: unknown) => {\n\t\tconst { id, build } = message as { id: number; build: NavigationBuild }\n\t\ttry {\n\t\t\tconst data = await buildNavigationData(build)\n\t\t\tport.postMessage({ id, data } satisfies BuildAnswer, [data.buffer])\n\t\t} catch (error) {\n\t\t\tport.postMessage({ id, error: error instanceof Error ? error.message : String(error) } satisfies BuildAnswer)\n\t\t}\n\t}\n\tif (port.on) port.on('message', (value) => void asked(value))\n\telse port.addEventListener?.('message', (event) => void asked(event.data))\n}\n\n/**\n * Who builds a world's navigations and where what was built is kept (`CreateWorldOptions.navigation.builds`): this\n * thread when the builder is left out (a worker of the page's own: `navigationWorker`), the process's memory when the\n * cache is, `cache: null` for nowhere (every world built anew). What an app hands every world it makes (`launch`,\n * `startApp`, `GameServer.start`)\n *\n * @beta\n */\nexport interface NavigationBuilds {\n\t/** Builds a navigation on this thread, or somewhere else when set to a worker's; this thread when left out */\n\tbuilder?: NavigationBuilder\n\t/** Where what was built is kept between worlds; the process's memory when left out, nowhere for `null` */\n\tcache?: NavigationCache | null\n}\n\n/** Where a world says nothing: this thread, and kept in the process's memory, which every world's ground may read */\nconst defaults: { readonly builder: NavigationBuilder; readonly cache: NavigationCache } = {\n\tbuilder: buildNavigationData,\n\tcache: memoryNavigationCache()\n}\n\n/**\n * What was built from this: kept, or built now (by the builder set) and kept. A builder that fails falls back to this\n * thread once, and says why in what it throws only when that fails too\n */\nexport async function navigationData(build: NavigationBuild, using: NavigationBuilds = {}): Promise<Uint8Array> {\n\t// `using`: who builds this one and where it is kept (a page's worker, a game's worker asked by its page: S54)\n\tconst cache = using.cache !== undefined ? using.cache : defaults.cache\n\tconst builder = using.builder ?? defaults.builder\n\tconst key = cache ? navigationKey(build) : ''\n\t// the same ground asked again while it is built (each side's navigation, asked side by side): that build\n\tconst building = cache ? buildsOf(cache) : undefined\n\tconst under = building?.get(key)\n\tif (under) return under\n\tconst made = (async () => {\n\t\tconst kept = cache ? await cache.get(key) : undefined\n\t\tif (kept) return kept\n\t\tlet data: Uint8Array\n\t\ttry {\n\t\t\tdata = await builder(build)\n\t\t} catch (error) {\n\t\t\tif (builder === buildNavigationData) throw error\n\t\t\tdata = await buildNavigationData(build)\n\t\t}\n\t\tif (cache) await cache.set(key, data)\n\t\treturn data\n\t})()\n\tif (!building) return made\n\tbuilding.set(key, made)\n\ttry {\n\t\treturn await made\n\t} finally {\n\t\tbuilding.delete(key)\n\t}\n}\n\n/** The last of the works on this thread asked to go one after another (`inTurn`): settled once it is done */\nlet turn: Promise<unknown> = Promise.resolve()\n\n/**\n * Runs `work` once every work asked before it this way is done, failed or not: Recast's WebAssembly on this thread, a\n * navigation built and read before the next is built (`RecastNavigation.create`)\n *\n * @internal\n */\nexport function inTurn<T>(work: () => Promise<T>): Promise<T> {\n\tconst done = turn.then(work, work)\n\tturn = done.catch(() => undefined)\n\treturn done\n}\n\n/** The builds under way for what a cache keeps, by their key */\nconst underWay = new WeakMap<NavigationCache, Map<string, Promise<Uint8Array>>>()\nconst buildsOf = (cache: NavigationCache) => {\n\tlet builds = underWay.get(cache)\n\tif (!builds) underWay.set(cache, (builds = new Map()))\n\treturn builds\n}\n\n/**\n * What each makes, made side by side and given back in their order: where one fails, those the others made are freed\n * (WebAssembly memory) once all are settled, and the first failure is thrown\n *\n * @internal\n */\nexport async function allOrFreed<T extends { dispose(): void } | undefined>(makes: readonly (() => Promise<T>)[]): Promise<T[]> {\n\tconst settled = await Promise.allSettled(makes.map((make) => make()))\n\tconst failed = settled.find((each) => each.status === 'rejected')\n\tif (!failed) return settled.map((each) => (each as PromiseFulfilledResult<T>).value)\n\tfor (const each of settled) if (each.status === 'fulfilled') each.value?.dispose()\n\tthrow failed.reason\n}\n"],"mappings":"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"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NavMesh, type QueryFilter, TileCache, TileCacheMeshProcess } from '@recast-navigation/core';
|
|
1
|
+
import { createRcConfig, NavMesh, type QueryFilter, Raw, TileCache, TileCacheData, TileCacheMeshProcess } from '@recast-navigation/core';
|
|
2
2
|
import type { NavigationBuild, NavigationSpeeds } from './builds';
|
|
3
3
|
/** The area of ground of this speed: 0 for ordinary ground, else its speed in sixteenths, 1 at the least and 62 at the most */
|
|
4
4
|
export declare function areaOfSpeed(speed: number): number;
|
|
@@ -11,6 +11,17 @@ export declare function speedOfBuild(speeds: NavigationSpeeds | undefined, x: nu
|
|
|
11
11
|
* under its middle (`speedAt`). Without one, every polygon is ordinary ground, as Recast's default makes them
|
|
12
12
|
*/
|
|
13
13
|
export declare function groundMeshProcess(speedAt?: (x: number, z: number) => number): TileCacheMeshProcess;
|
|
14
|
+
/** How a build is cut into tiles: Recast's config for one tile with its border, the bounds of the whole, the grid of tiles */
|
|
15
|
+
export interface TileCut {
|
|
16
|
+
config: ReturnType<typeof createRcConfig>;
|
|
17
|
+
bbMin: [number, number, number];
|
|
18
|
+
bbMax: [number, number, number];
|
|
19
|
+
/** Tiles across and down */
|
|
20
|
+
tileWidth: number;
|
|
21
|
+
tileHeight: number;
|
|
22
|
+
expectedLayersPerTile: number;
|
|
23
|
+
maxObstacles: number;
|
|
24
|
+
}
|
|
14
25
|
/**
|
|
15
26
|
* Builds a tile cache and its navmesh from a build, as Recast's `generateTileCache` does, but with each triangle of the
|
|
16
27
|
* ground marked with its cell's speed (`NavigationBuild.speeds`) before it is rasterised. What it gives is Recast's own;
|
|
@@ -21,3 +32,50 @@ export declare function generateGroundTileCache(build: NavigationBuild): {
|
|
|
21
32
|
tileCache: TileCache;
|
|
22
33
|
process: TileCacheMeshProcess;
|
|
23
34
|
};
|
|
35
|
+
/** A tile of the grid by its column and row: `tx * 65536 + ty` */
|
|
36
|
+
export declare const tileKey: (tx: number, ty: number) => number;
|
|
37
|
+
/**
|
|
38
|
+
* Some tiles of a build made again (`RecastNavigation.reshape`): each tile's compressed layers, made as
|
|
39
|
+
* `generateGroundTileCache` makes them, from the triangles that reach it. Also the bounds of the whole build, for the
|
|
40
|
+
* caller to know the tiles are cut on the grid it has (a build of other bounds is cut on another). `speedOf` is the speed
|
|
41
|
+
* of the ground at a point where the build has no speeds of its own (a part of the ground, `RecastNavigation.groundChanged`).
|
|
42
|
+
* Undefined where they could not be made
|
|
43
|
+
*/
|
|
44
|
+
export declare function groundTileLayers(build: NavigationBuild, tiles: readonly number[], cut?: TileCut, speedOf?: (x: number, z: number) => number): Map<number, Uint8Array[]> | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* The grid a build is cut on: its bounds and its tiles across and down. A build of the same grid as another's is cut
|
|
47
|
+
* into the same tiles, so a tile of one may be made again alone from the other (`groundTileLayers`)
|
|
48
|
+
*/
|
|
49
|
+
export declare function tileGridOf(build: NavigationBuild): {
|
|
50
|
+
bbMin: readonly number[];
|
|
51
|
+
bbMax: readonly number[];
|
|
52
|
+
tileWidth: number;
|
|
53
|
+
tileHeight: number;
|
|
54
|
+
/** A tile's side, in ground units */
|
|
55
|
+
tileSize: number;
|
|
56
|
+
/** How far round a tile the ground it is made of reaches, in ground units */
|
|
57
|
+
border: number;
|
|
58
|
+
/** The whole of how it is cut, for `groundTileLayers` and `emptyTileCache` not to work it out again */
|
|
59
|
+
cut: TileCut;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* A tile cache of the grid a build is cut on (`tileGridOf`), empty, with room for `room`'s tiles and obstacles: what
|
|
63
|
+
* a column of tiles made again alone is made into the navmesh's tiles through (`RecastNavigation.groundChanged`,
|
|
64
|
+
* `reshape`), as the whole's tile cache would make them. It works in the allocator and compressor given (the whole's:
|
|
65
|
+
* a tile is made in one call, and each starts the allocator over), which it does not take. Undefined where Recast
|
|
66
|
+
* would not make it
|
|
67
|
+
*/
|
|
68
|
+
export declare function columnTileCache(cut: TileCut, process: TileCacheMeshProcess, room: {
|
|
69
|
+
tiles: number;
|
|
70
|
+
obstacles: number;
|
|
71
|
+
}, allocator: InstanceType<typeof Raw.RecastLinearAllocator>, compressor: InstanceType<typeof Raw.RecastFastLZCompressor>): TileCache | undefined;
|
|
72
|
+
/**
|
|
73
|
+
* Puts a compressed layer (`groundTileLayers`) in a tile cache, which does not take it: its copy is given back, to be let
|
|
74
|
+
* go of (`destroy`) once the tile cache is. Undefined where the tile cache would not take it
|
|
75
|
+
*/
|
|
76
|
+
export declare function addTileLayer(tileCache: TileCache, bytes: Uint8Array): InstanceType<typeof TileCacheData> | undefined;
|
|
77
|
+
/**
|
|
78
|
+
* Which layer of its column a compressed layer (`groundTileLayers`) is: the navmesh's tile made of it is at that layer.
|
|
79
|
+
* Its header (Detour's `dtTileCacheLayerHeader`) leads it uncompressed: magic, version, tx, ty, then the layer, each an int
|
|
80
|
+
*/
|
|
81
|
+
export declare const layerOf: (bytes: Uint8Array) => number;
|