@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
|
@@ -0,0 +1,670 @@
|
|
|
1
|
+
import { checkpoint } from "../engineEvents.js";
|
|
2
|
+
import { SessionView } from "../replication.js";
|
|
3
|
+
import { deposit } from "../entity.js";
|
|
4
|
+
import { heroSummaries } from "../hero.js";
|
|
5
|
+
import { names } from "../names.js";
|
|
6
|
+
import { assertPlainData } from "../debug2.js";
|
|
7
|
+
import { formationPreview } from "../formation.js";
|
|
8
|
+
import { decidedAvailability, decidedUnlocks, techOf } from "../tech.js";
|
|
9
|
+
import { canPlaceStructure, placementCells } from "../orders/build.js";
|
|
10
|
+
import { shownFx } from "../effects.js";
|
|
11
|
+
import { minesFor } from "../systems/economy.js";
|
|
12
|
+
import { campsFor } from "../camps.js";
|
|
13
|
+
import { saveWorld } from "../save.js";
|
|
14
|
+
import { lanesOf } from "../lanes.js";
|
|
15
|
+
import { paceOf, savesOf } from "./can.js";
|
|
16
|
+
import { sameEntity } from "./delta.js";
|
|
17
|
+
import { LocalDebug } from "./debug.js";
|
|
18
|
+
import { checkTold, commonEntityState, commonStillTold, hasOnePlayersPart, playerEntityState, sharedStillTold } from "./entityState.js";
|
|
19
|
+
//#region src/session/local.ts
|
|
20
|
+
/**
|
|
21
|
+
* A seat at a world running in the same page. It does the job a server will do later:
|
|
22
|
+
* run the simulation, and hand the player only what their team is allowed to know.
|
|
23
|
+
*/
|
|
24
|
+
/** The effects of the rules a player was shown that are kept, for a stop to be told to them: the latest so many */
|
|
25
|
+
var MOST_EFFECTS = 1024;
|
|
26
|
+
/**
|
|
27
|
+
* The events a computer player's seat hears (`forComputer`): the facts a brain reads and a save keeps for it (deaths,
|
|
28
|
+
* damage, healing, pings, chat, the game's own events) and the answers to its commands. The rest is for a screen (an
|
|
29
|
+
* attack's swing, a shot, a buff, a hammer blow, a line said), and a computer's seat is spared hearing it
|
|
30
|
+
*
|
|
31
|
+
* @beta
|
|
32
|
+
*/
|
|
33
|
+
var COMPUTER_EVENTS = /* @__PURE__ */ new Set([
|
|
34
|
+
"death",
|
|
35
|
+
"damage",
|
|
36
|
+
"heal",
|
|
37
|
+
"ping",
|
|
38
|
+
"chat",
|
|
39
|
+
"game",
|
|
40
|
+
"command"
|
|
41
|
+
]);
|
|
42
|
+
var SHARED = /* @__PURE__ */ new WeakMap();
|
|
43
|
+
/**
|
|
44
|
+
* From here until `endSharedCaptures`, the sessions of the world describe each entity once between them (what
|
|
45
|
+
* everyone is told; what is one player's goes on a copy): for a host's round of sending, where every seat is captured
|
|
46
|
+
* from the same world. Not while the world changes: what was described is said again
|
|
47
|
+
*
|
|
48
|
+
* @internal
|
|
49
|
+
*/
|
|
50
|
+
function shareCaptures(world) {
|
|
51
|
+
SHARED.set(world, {
|
|
52
|
+
common: /* @__PURE__ */ new Map(),
|
|
53
|
+
sides: /* @__PURE__ */ new Map()
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
/** @internal */
|
|
57
|
+
function endSharedCaptures(world) {
|
|
58
|
+
SHARED.delete(world);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* A `GameSession` over a world in the same process: steps it from real time, takes a player's snapshots of it and sends their commands into it
|
|
62
|
+
*
|
|
63
|
+
* @beta
|
|
64
|
+
*/
|
|
65
|
+
var LocalSession = class {
|
|
66
|
+
world;
|
|
67
|
+
playerId;
|
|
68
|
+
/** The ground of the world, for the client to draw and ask about */
|
|
69
|
+
terrain;
|
|
70
|
+
/** The map's look (sky, mist, light), when the world was made from a map that has one */
|
|
71
|
+
environment;
|
|
72
|
+
/** The map's scenery objects, which have no life at runtime */
|
|
73
|
+
doodads;
|
|
74
|
+
/** The map's named regions */
|
|
75
|
+
regions;
|
|
76
|
+
/** The map's named camera positions */
|
|
77
|
+
cameras;
|
|
78
|
+
/** The map's named paths */
|
|
79
|
+
paths;
|
|
80
|
+
/** The definitions of the game the world runs: unit types, abilities, orders and the rest */
|
|
81
|
+
registry;
|
|
82
|
+
/** Simulation ticks per second of the world */
|
|
83
|
+
tickRate;
|
|
84
|
+
/** How far, 0..1, the time is between the last tick and the next, for the client to blend its drawing by; 1 when paused */
|
|
85
|
+
alpha = 1;
|
|
86
|
+
/** What the world says (`World.log`): a session in the page has it, and the client shows it with its own */
|
|
87
|
+
get log() {
|
|
88
|
+
return this.world.log;
|
|
89
|
+
}
|
|
90
|
+
/** Why the game ended on an error, once it has (`World.failure`) */
|
|
91
|
+
get failure() {
|
|
92
|
+
return this.world.failure;
|
|
93
|
+
}
|
|
94
|
+
/** Simulation speed multiplier, 0 pauses. A debug control, a real server sets the pace itself */
|
|
95
|
+
speed = 1;
|
|
96
|
+
accumulator = 0;
|
|
97
|
+
/** Whether the team saw the whole map at the last snapshot (the debug switch): what it saw then only is forgotten after */
|
|
98
|
+
wasRevealed = false;
|
|
99
|
+
/** What the player's team remembers, or an observer's own (`SessionView.memory`) */
|
|
100
|
+
get memory() {
|
|
101
|
+
return this.view.memory;
|
|
102
|
+
}
|
|
103
|
+
/** Ids of what made it into the snapshot being put together as in sight. Kept to be cleared, not made anew */
|
|
104
|
+
inSight = /* @__PURE__ */ new Set();
|
|
105
|
+
/** The names the map or the rules gave entities, by id, as of the snapshot being put together (`world.named`) */
|
|
106
|
+
namesNow = /* @__PURE__ */ new Map();
|
|
107
|
+
disposers = [];
|
|
108
|
+
pendingCheckpoint;
|
|
109
|
+
/** The label and save taken at the last tick that a checkpoint was asked for, for the game to be taken back to */
|
|
110
|
+
checkpoint;
|
|
111
|
+
/** The debug tools over this session's world */
|
|
112
|
+
debug;
|
|
113
|
+
/** Its pace, saves of its world, the debug tools' view, and what a computer player's brain reads (`SessionCan`) */
|
|
114
|
+
can = {
|
|
115
|
+
pace: paceOf(this),
|
|
116
|
+
saves: savesOf(this),
|
|
117
|
+
inspect: void 0,
|
|
118
|
+
computer: {
|
|
119
|
+
mines: () => this.mines(),
|
|
120
|
+
lanes: () => this.lanes(),
|
|
121
|
+
pendingEvents: () => this.pendingEvents(),
|
|
122
|
+
restoreEvents: (events) => this.restoreEvents(events)
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
/**
|
|
126
|
+
* Who only watches, and sees everything: every entity, the whole map, every player's resources and heroes. From
|
|
127
|
+
* `playerId`'s side all the same (who is an ally, an enemy). For a server's watchers, whose commands go nowhere
|
|
128
|
+
*/
|
|
129
|
+
observer;
|
|
130
|
+
/**
|
|
131
|
+
* Whose seat is a computer player's (`forComputer`): its snapshots leave out projectiles, missiles, corpses, reveals
|
|
132
|
+
* and the events a brain never reads, and it listens for none of those, so twelve computers cost the world less
|
|
133
|
+
*/
|
|
134
|
+
forComputer;
|
|
135
|
+
/** The seat's side of the world: whose it is, what they may know, what was told to them since the last snapshot */
|
|
136
|
+
view;
|
|
137
|
+
constructor(world, playerId, options = {}) {
|
|
138
|
+
this.world = world;
|
|
139
|
+
this.playerId = playerId;
|
|
140
|
+
this.observer = options.observer ?? false;
|
|
141
|
+
this.ownsWorld = options.ownsWorld ?? false;
|
|
142
|
+
this.forComputer = options.forComputer ?? false;
|
|
143
|
+
this.view = new SessionView(world, playerId, {
|
|
144
|
+
observer: this.observer,
|
|
145
|
+
forComputer: this.forComputer,
|
|
146
|
+
mostEffects: options.mostEffects ?? MOST_EFFECTS
|
|
147
|
+
});
|
|
148
|
+
if (options.debug) world.debugPlayers.add(playerId);
|
|
149
|
+
this.terrain = world.terrain;
|
|
150
|
+
this.environment = world.map.environment;
|
|
151
|
+
this.doodads = world.map.doodads;
|
|
152
|
+
this.regions = world.map.regions;
|
|
153
|
+
this.cameras = world.map.cameras;
|
|
154
|
+
this.paths = world.map.paths;
|
|
155
|
+
this.registry = world.registry;
|
|
156
|
+
this.tickRate = world.tickRate;
|
|
157
|
+
this.debug = new LocalDebug(world);
|
|
158
|
+
this.can.inspect = this.debug;
|
|
159
|
+
const { events } = world;
|
|
160
|
+
const { view } = this;
|
|
161
|
+
for (const replication of world.registry.replications) {
|
|
162
|
+
if (!this.hears(replication.as)) continue;
|
|
163
|
+
this.disposers.push(events.on(replication.event, (payload) => {
|
|
164
|
+
const said = replication.tell(payload, view);
|
|
165
|
+
if (said) view.events.push(said);
|
|
166
|
+
}));
|
|
167
|
+
}
|
|
168
|
+
this.disposers.push(events.on(checkpoint, ({ label }) => this.pendingCheckpoint = label));
|
|
169
|
+
if (this.hears("game")) this.disposers.push(events.watch((type, payload) => {
|
|
170
|
+
if (typeof type !== "string") return;
|
|
171
|
+
const audience = world.registry.event(type)?.replicate;
|
|
172
|
+
if (!audience) return;
|
|
173
|
+
if (audience !== "everyone" && !audience(payload, view)) return;
|
|
174
|
+
if (this.world.checks.events) assertPlainData(payload, `Event "${type}"`);
|
|
175
|
+
view.events.push({
|
|
176
|
+
type: "game",
|
|
177
|
+
event: type,
|
|
178
|
+
payload
|
|
179
|
+
});
|
|
180
|
+
}));
|
|
181
|
+
}
|
|
182
|
+
/** Whether the seat is told of events of a kind: a player's seat of all of them, a computer's of what a brain reads */
|
|
183
|
+
hears(kind) {
|
|
184
|
+
return !this.forComputer || COMPUTER_EVENTS.has(kind);
|
|
185
|
+
}
|
|
186
|
+
/** The player's team: theirs now, as the rules may move them to another (`setTeam`) */
|
|
187
|
+
get team() {
|
|
188
|
+
return this.view.team;
|
|
189
|
+
}
|
|
190
|
+
isAlly(owner) {
|
|
191
|
+
return this.view.isAlly(owner);
|
|
192
|
+
}
|
|
193
|
+
/** Whether the player's team sees a spot of the map right now: an observer sees all of it */
|
|
194
|
+
sees(x, z) {
|
|
195
|
+
return this.view.sees(x, z);
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* How many effects of the rules are kept for their stop to be told (`mostEffects`), for a test of the bound
|
|
199
|
+
*
|
|
200
|
+
* @internal
|
|
201
|
+
*/
|
|
202
|
+
get keptEffects() {
|
|
203
|
+
return shownFx(this.view).size;
|
|
204
|
+
}
|
|
205
|
+
/** Whether the player's team can see the entity right now */
|
|
206
|
+
knows(entity) {
|
|
207
|
+
return this.view.knows(entity);
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* What everyone in sight of an entity is told of it this tick, the same for every seat: worked out once for all
|
|
211
|
+
* the sessions of a world while a host's round of sending is on (`shareCaptures`), else for this session alone
|
|
212
|
+
*/
|
|
213
|
+
common(entity) {
|
|
214
|
+
const shared = SHARED.get(this.world)?.common;
|
|
215
|
+
const known = shared?.get(entity.id);
|
|
216
|
+
if (known) return known;
|
|
217
|
+
const name = this.namesNow.get(entity.id);
|
|
218
|
+
const { told } = entity;
|
|
219
|
+
const state = told && commonStillTold(this.world, entity, told, name) ? told : entity.told = commonEntityState(this.world, entity, name);
|
|
220
|
+
shared?.set(entity.id, state);
|
|
221
|
+
return state;
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* What this player was told of each entity last (`Told`), to be told again while it holds (`tell`): with the entity,
|
|
225
|
+
* gone with it
|
|
226
|
+
*/
|
|
227
|
+
told = /* @__PURE__ */ new WeakMap();
|
|
228
|
+
/**
|
|
229
|
+
* What this player is told of an entity: what everyone is (`common`, shared between the seats of a host), and on a
|
|
230
|
+
* copy of it what is this player's to know: an illusion's lifetime on its own side, the components replicated to it
|
|
231
|
+
* and what they make of themselves for it, and its own part (`own`) for an ally's. Last time's objects wherever
|
|
232
|
+
* nothing changed (`playerEntityState`)
|
|
233
|
+
*/
|
|
234
|
+
tell(entity) {
|
|
235
|
+
const shared = this.common(entity);
|
|
236
|
+
const before = this.told.get(entity);
|
|
237
|
+
const state = playerEntityState(this.view, entity, shared, before);
|
|
238
|
+
if (this.world.checks.snapshots) checkTold(this.view, entity, state, this.namesNow.get(entity.id));
|
|
239
|
+
this.keep(entity, shared, state);
|
|
240
|
+
return state;
|
|
241
|
+
}
|
|
242
|
+
/** Remembers what the player was told of an entity (`told`) */
|
|
243
|
+
keep(entity, shared, state) {
|
|
244
|
+
const told = this.told.get(entity);
|
|
245
|
+
if (!told) this.told.set(entity, {
|
|
246
|
+
shared,
|
|
247
|
+
state
|
|
248
|
+
});
|
|
249
|
+
else {
|
|
250
|
+
told.shared = shared;
|
|
251
|
+
told.state = state;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* What this player is told of an entity (`tell`), once for the seats of a side told the same while a host's round
|
|
256
|
+
* of sending is on (`Round.sides`): the side's object, which this seat remembers as its own, is this seat's too
|
|
257
|
+
*/
|
|
258
|
+
describe(entity) {
|
|
259
|
+
const side = this.sideNow;
|
|
260
|
+
if (!side) return this.tell(entity);
|
|
261
|
+
if (this.isOnePlayers(entity)) {
|
|
262
|
+
const state = this.tell(entity);
|
|
263
|
+
const first = side.alike.get(entity.id);
|
|
264
|
+
if (!first) side.alike.set(entity.id, state);
|
|
265
|
+
else if (first !== state && sameEntity(first, state)) {
|
|
266
|
+
this.keep(entity, this.common(entity), first);
|
|
267
|
+
return first;
|
|
268
|
+
}
|
|
269
|
+
return state;
|
|
270
|
+
}
|
|
271
|
+
const known = side.all.get(entity.id);
|
|
272
|
+
if (known) {
|
|
273
|
+
this.keep(entity, this.common(entity), known);
|
|
274
|
+
return known;
|
|
275
|
+
}
|
|
276
|
+
const state = this.tell(entity);
|
|
277
|
+
side.all.set(entity.id, state);
|
|
278
|
+
return state;
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* What the seats of this one's side are told alike this round (`Round.sides`), by entity: none outside a host's round.
|
|
282
|
+
* Set as the capture starts (`capture`)
|
|
283
|
+
*/
|
|
284
|
+
sideNow;
|
|
285
|
+
/**
|
|
286
|
+
* Which seats are told the same of an entity where nothing of it is one player's: an observer's, or a team's with the
|
|
287
|
+
* same allies among the players (relations are a pair of players', not a team's)
|
|
288
|
+
*/
|
|
289
|
+
sideKey() {
|
|
290
|
+
if (this.observer) return "observer";
|
|
291
|
+
let key = `team ${this.team}:`;
|
|
292
|
+
for (const player of this.world.players.keys()) key += this.isAlly(player) ? "1" : "0";
|
|
293
|
+
return key;
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Whether what this player is told of an entity is theirs alone, not their side's: a component replicated to its owner
|
|
297
|
+
* or shaping itself for each player (`Component.snapshot`), or control of another's unit shared with this player
|
|
298
|
+
*/
|
|
299
|
+
isOnePlayers(entity) {
|
|
300
|
+
if (hasOnePlayersPart(this.world, entity)) return true;
|
|
301
|
+
return entity.owner !== this.playerId && !this.observer && this.isAlly(entity.owner) && this.world.mayCommand(this.playerId, entity);
|
|
302
|
+
}
|
|
303
|
+
/** Where in the list being captured are those that may be one player's (`SideSeen.mine`): while the first seat of a side captures */
|
|
304
|
+
mineNow;
|
|
305
|
+
/**
|
|
306
|
+
* What the team remembers of a structure is every teammate's to be told, not this seat's: without the parts of the
|
|
307
|
+
* description shaped for one player (components replicated to the owner, or made by their `snapshot` for whoever is
|
|
308
|
+
* told), which the seat that happened to see it first would otherwise give to the whole team
|
|
309
|
+
*/
|
|
310
|
+
forTeam(entity, state) {
|
|
311
|
+
if (!state.components || !hasOnePlayersPart(this.world, entity)) return state;
|
|
312
|
+
const components = {};
|
|
313
|
+
for (const [id, part] of Object.entries(state.components)) {
|
|
314
|
+
const component = this.world.registry.component(id);
|
|
315
|
+
if (component?.replicate === "owner" || component?.replicate && component.snapshot) continue;
|
|
316
|
+
components[id] = part;
|
|
317
|
+
}
|
|
318
|
+
return {
|
|
319
|
+
...state,
|
|
320
|
+
components
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
/** Adds what the player sees of an entity in sight to the snapshot, and remembers structures for when they are out of sight */
|
|
324
|
+
see(entity, out, remembered) {
|
|
325
|
+
const before = remembered[entity.id];
|
|
326
|
+
const kept = entity.isResource && before?.visible && before.resource === entity.get(deposit)?.amount && sharedStillTold(entity, before);
|
|
327
|
+
const state = kept ? before : this.describe(entity);
|
|
328
|
+
if (!kept && this.mineNow && (this.isAlly(entity.owner) || hasOnePlayersPart(this.world, entity))) this.mineNow.push(out.length);
|
|
329
|
+
out.push(state);
|
|
330
|
+
this.inSight.add(entity.id);
|
|
331
|
+
if (entity.isStructure && !this.isAlly(entity.owner)) {
|
|
332
|
+
if (state !== before) remembered[entity.id] = this.forTeam(entity, state);
|
|
333
|
+
} else if (before) delete remembered[entity.id];
|
|
334
|
+
}
|
|
335
|
+
/** Throws when what was taken to be in sight is not what testing every entity gives. See `debugChecks` */
|
|
336
|
+
checkSight() {
|
|
337
|
+
for (const entity of this.world.entities.values()) {
|
|
338
|
+
if (!entity.alive || this.knows(entity) === this.inSight.has(entity.id)) continue;
|
|
339
|
+
const said = this.inSight.has(entity.id) ? "in sight" : "out of sight";
|
|
340
|
+
throw new Error(`Snapshot for player ${this.playerId} has ${entity.def.id}#${entity.id} ${said}, it is not`);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
/** The scenery the player's team sees right now */
|
|
344
|
+
*sceneryInSight() {
|
|
345
|
+
const { world } = this;
|
|
346
|
+
if (this.observer || world.fog.isRevealed(this.team)) {
|
|
347
|
+
for (const entity of world.entities.values()) if (entity.scenery) yield entity;
|
|
348
|
+
} else yield* world.sceneryInSight.get(this.team) ?? [];
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* On a map explored from the start, what stands on it and belongs to no player (trees, mines, rocks, neutral
|
|
352
|
+
* buildings, the creeps' own) known to the team from the first snapshot, as it stands, out of sight: the genre's melee
|
|
353
|
+
* maps. Once for a team (`TeamMemory.startKnown`); units, and players' buildings, only once seen
|
|
354
|
+
*/
|
|
355
|
+
knowStart(remembered) {
|
|
356
|
+
const { world } = this;
|
|
357
|
+
if (this.observer || !world.fog.exploredFromStart) return;
|
|
358
|
+
const memory = this.memory;
|
|
359
|
+
if (memory.startKnown) return;
|
|
360
|
+
memory.startKnown = true;
|
|
361
|
+
for (const entity of world.entities.values()) {
|
|
362
|
+
if (!entity.alive || !entity.isStructure || this.inSight.has(entity.id) || remembered[entity.id]) continue;
|
|
363
|
+
const owner = world.players.get(entity.owner);
|
|
364
|
+
if (!owner?.neutral && !owner?.creeps) continue;
|
|
365
|
+
remembered[entity.id] = {
|
|
366
|
+
...this.forTeam(entity, this.describe(entity)),
|
|
367
|
+
visible: false
|
|
368
|
+
};
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
capture() {
|
|
372
|
+
const { world } = this;
|
|
373
|
+
const round = SHARED.get(world);
|
|
374
|
+
if (round) {
|
|
375
|
+
const key = this.sideKey();
|
|
376
|
+
let side = round.sides.get(key);
|
|
377
|
+
if (!side) round.sides.set(key, side = {
|
|
378
|
+
all: /* @__PURE__ */ new Map(),
|
|
379
|
+
alike: /* @__PURE__ */ new Map()
|
|
380
|
+
});
|
|
381
|
+
this.sideNow = side;
|
|
382
|
+
} else this.sideNow = void 0;
|
|
383
|
+
const remembered = this.memory.structures;
|
|
384
|
+
this.namesNow.clear();
|
|
385
|
+
if (world.states.has(names)) for (const [name, id] of Object.entries(world.state(names))) this.namesNow.set(id, name);
|
|
386
|
+
const seen = this.sideNow?.seen;
|
|
387
|
+
const entities = seen ? this.seeAsSide(seen) : this.seeAll(remembered);
|
|
388
|
+
if (this.world.checks.sight) this.checkSight();
|
|
389
|
+
if (seen) return this.finish(entities);
|
|
390
|
+
this.knowStart(remembered);
|
|
391
|
+
const revealed = this.observer || world.fog.isRevealed(this.team);
|
|
392
|
+
if (this.wasRevealed && !revealed) {
|
|
393
|
+
for (const [key, state] of Object.entries(remembered)) if (!this.inSight.has(Number(key)) && !world.fog.isExplored(this.team, state.x, state.z)) delete remembered[Number(key)];
|
|
394
|
+
}
|
|
395
|
+
this.wasRevealed = revealed;
|
|
396
|
+
const forget = world.settings.fog?.explored === "nothing" && !revealed;
|
|
397
|
+
for (const [key, state] of Object.entries(remembered)) {
|
|
398
|
+
const id = Number(key);
|
|
399
|
+
if (this.inSight.has(id)) continue;
|
|
400
|
+
if (forget) {
|
|
401
|
+
delete remembered[id];
|
|
402
|
+
continue;
|
|
403
|
+
}
|
|
404
|
+
if (!world.get(id) && this.sees(state.x, state.z)) {
|
|
405
|
+
delete remembered[id];
|
|
406
|
+
continue;
|
|
407
|
+
}
|
|
408
|
+
const memory = state.visible ? {
|
|
409
|
+
...state,
|
|
410
|
+
visible: false
|
|
411
|
+
} : state;
|
|
412
|
+
if (memory !== state) remembered[id] = memory;
|
|
413
|
+
entities.push(memory);
|
|
414
|
+
}
|
|
415
|
+
if (this.sideNow) this.sideNow.seen = {
|
|
416
|
+
entities: [...entities],
|
|
417
|
+
inSight: new Set(this.inSight),
|
|
418
|
+
mine: this.mineNow ?? []
|
|
419
|
+
};
|
|
420
|
+
this.mineNow = void 0;
|
|
421
|
+
return this.finish(entities);
|
|
422
|
+
}
|
|
423
|
+
/** The entities in sight, and what the side remembers out of it, as the first seat of a side (or a seat on its own) sees them */
|
|
424
|
+
seeAll(remembered) {
|
|
425
|
+
const { world } = this;
|
|
426
|
+
const entities = [];
|
|
427
|
+
this.inSight.clear();
|
|
428
|
+
this.mineNow = this.sideNow ? [] : void 0;
|
|
429
|
+
for (const entity of world.units.values()) if (entity.alive && this.knows(entity)) this.see(entity, entities, remembered);
|
|
430
|
+
for (const entity of this.sceneryInSight()) if (entity.alive && entity.scenery) this.see(entity, entities, remembered);
|
|
431
|
+
return entities;
|
|
432
|
+
}
|
|
433
|
+
/**
|
|
434
|
+
* What another seat of the side saw this round, as this one sees it: the same, but what may be this player's alone
|
|
435
|
+
* described again for them. The side's memory is the first seat's to keep
|
|
436
|
+
*/
|
|
437
|
+
seeAsSide(seen) {
|
|
438
|
+
const entities = [...seen.entities];
|
|
439
|
+
this.inSight.clear();
|
|
440
|
+
for (const id of seen.inSight) this.inSight.add(id);
|
|
441
|
+
for (const at of seen.mine) entities[at] = this.describe(this.world.get(entities[at].id));
|
|
442
|
+
this.wasRevealed = this.observer || this.world.fog.isRevealed(this.team);
|
|
443
|
+
return entities;
|
|
444
|
+
}
|
|
445
|
+
/** The rest of a snapshot, round its entities: the players, and every feature's part (`SnapshotField`) */
|
|
446
|
+
finish(entities) {
|
|
447
|
+
const { world } = this;
|
|
448
|
+
const players = [];
|
|
449
|
+
for (const player of world.players.values()) {
|
|
450
|
+
const state = {
|
|
451
|
+
id: player.id,
|
|
452
|
+
name: player.name,
|
|
453
|
+
team: player.team,
|
|
454
|
+
color: player.color,
|
|
455
|
+
neutral: player.neutral,
|
|
456
|
+
creeps: player.creeps || void 0,
|
|
457
|
+
...player.race !== void 0 && { race: player.race },
|
|
458
|
+
defeated: player.defeated,
|
|
459
|
+
relation: player.id === this.playerId ? "self" : world.areAllies(this.playerId, player.id) ? "ally" : world.areEnemies(this.playerId, player.id) ? "enemy" : "neutral"
|
|
460
|
+
};
|
|
461
|
+
if (state.relation === "ally" && !player.neutral && !this.observer) {
|
|
462
|
+
const me = world.player(this.playerId);
|
|
463
|
+
state.shared = {
|
|
464
|
+
control: world.sides.controlOf(this.playerId).includes(player.id),
|
|
465
|
+
vision: me.team === player.team || world.sides.visionOf(me.team).includes(player.team)
|
|
466
|
+
};
|
|
467
|
+
}
|
|
468
|
+
if (player.id === this.playerId || this.observer && !player.neutral) {
|
|
469
|
+
state.own = {
|
|
470
|
+
resources: { ...player.resources },
|
|
471
|
+
supplyUsed: player.supplyUsed,
|
|
472
|
+
supplyCap: player.supplyCap,
|
|
473
|
+
...Object.keys(player.supplies).length > 0 && { supplies: structuredClone(player.supplies) },
|
|
474
|
+
upkeep: world.settings.economy.upkeep(world, player.id),
|
|
475
|
+
upgrades: Object.fromEntries(player.upgrades),
|
|
476
|
+
researching: [...player.researching],
|
|
477
|
+
tech: [...techOf(world, player.id)],
|
|
478
|
+
heroes: heroSummaries(world, player.id),
|
|
479
|
+
objectives: world.objectives.of(player.id).map((objective) => structuredClone(objective)),
|
|
480
|
+
...world.timers.shownTo(player.id).length && { timers: world.timers.shownTo(player.id) }
|
|
481
|
+
};
|
|
482
|
+
if (world.hooks.has("requirement") && player.id === this.playerId) state.own.unlocks = decidedUnlocks(world, player.id);
|
|
483
|
+
if (world.hooks.has("available") && player.id === this.playerId) {
|
|
484
|
+
const availability = decidedAvailability(world, player.id);
|
|
485
|
+
if (availability) state.own.availability = availability;
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
players.push(state);
|
|
489
|
+
}
|
|
490
|
+
const { view } = this;
|
|
491
|
+
const snapshot = { tick: world.tick };
|
|
492
|
+
const parts = world.registry.snapshotFields;
|
|
493
|
+
const take = (part) => {
|
|
494
|
+
const value = part.capture(view);
|
|
495
|
+
if (value !== void 0) snapshot[part.key] = value;
|
|
496
|
+
};
|
|
497
|
+
for (const part of parts) if (part.head) take(part);
|
|
498
|
+
snapshot.entities = entities;
|
|
499
|
+
snapshot.players = players;
|
|
500
|
+
for (const part of parts) if (!part.head) take(part);
|
|
501
|
+
return snapshot;
|
|
502
|
+
}
|
|
503
|
+
/** Takes a snapshot of the world as the seat sees it now, without stepping */
|
|
504
|
+
snapshot() {
|
|
505
|
+
return this.capture();
|
|
506
|
+
}
|
|
507
|
+
/**
|
|
508
|
+
* Moves the game on by `ticks` at the next update, however fast it goes: a step of a paused game (`speed` 0), as
|
|
509
|
+
* an editor's Step does. Ticks asked for while it runs are taken on top of its pace
|
|
510
|
+
*/
|
|
511
|
+
advance(ticks = 1) {
|
|
512
|
+
this.accumulator += this.world.dt * Math.max(0, Math.floor(ticks));
|
|
513
|
+
}
|
|
514
|
+
/** A save of the world as it stands (`saveWorld`): at once, as a promise for what a session elsewhere answers later */
|
|
515
|
+
save() {
|
|
516
|
+
try {
|
|
517
|
+
return Promise.resolve(saveWorld(this.world));
|
|
518
|
+
} catch (error) {
|
|
519
|
+
return Promise.reject(error);
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
/**
|
|
523
|
+
* Runs the game on by itself, a tick at a time, as fast as the page can, until `until` holds of the world, `most`
|
|
524
|
+
* ticks have run, the game is over, or `deadline` (`performance.now()`'s) is past: what an editor's "Play to" does a
|
|
525
|
+
* slice a frame, its pace and `advance` aside. The ticks are the same ticks the game runs at its own pace, so the
|
|
526
|
+
* same game comes to the same moment. What happened in them is in the next snapshot (`update`), as after a slow frame.
|
|
527
|
+
* `until` is asked before the first tick too: what holds already runs none
|
|
528
|
+
*/
|
|
529
|
+
runUntil(until, options = {}) {
|
|
530
|
+
const { world } = this;
|
|
531
|
+
const most = options.most ?? Infinity;
|
|
532
|
+
const deadline = options.deadline ?? Infinity;
|
|
533
|
+
let ticks = 0;
|
|
534
|
+
const over = () => world.failure !== null || world.winner !== null;
|
|
535
|
+
while (!until(world)) {
|
|
536
|
+
if (ticks >= most || over()) return this.ran(ticks, false, over());
|
|
537
|
+
if (ticks % 8 === 7 && performance.now() > deadline) return this.ran(ticks, false, false);
|
|
538
|
+
this.tickOnce();
|
|
539
|
+
ticks++;
|
|
540
|
+
}
|
|
541
|
+
return this.ran(ticks, true, over());
|
|
542
|
+
}
|
|
543
|
+
/** What `runUntil` gives back, the debug tools' view brought up to date where it ran */
|
|
544
|
+
ran(ticks, reached, over) {
|
|
545
|
+
if (ticks) {
|
|
546
|
+
this.debug.refresh();
|
|
547
|
+
this.ranOn = true;
|
|
548
|
+
}
|
|
549
|
+
return {
|
|
550
|
+
ticks,
|
|
551
|
+
reached,
|
|
552
|
+
over
|
|
553
|
+
};
|
|
554
|
+
}
|
|
555
|
+
/** Whether `runUntil` ran ticks since the last update: its next snapshot describes them, paused or not */
|
|
556
|
+
ranOn = false;
|
|
557
|
+
/** A tick of the world, and the checkpoint it marked saved as the world stood at its end, not at the end of the frame */
|
|
558
|
+
tickOnce() {
|
|
559
|
+
this.world.step();
|
|
560
|
+
if (this.pendingCheckpoint) {
|
|
561
|
+
this.checkpoint = {
|
|
562
|
+
label: this.pendingCheckpoint,
|
|
563
|
+
save: saveWorld(this.world)
|
|
564
|
+
};
|
|
565
|
+
this.pendingCheckpoint = void 0;
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
/** Adds `dt` real seconds (scaled by `speed`) and steps the world one tick for each tick's worth; returns a snapshot of how it stands after, or none when nothing happened */
|
|
569
|
+
update(dt) {
|
|
570
|
+
const { world } = this;
|
|
571
|
+
let stepped = this.ranOn;
|
|
572
|
+
this.ranOn = false;
|
|
573
|
+
this.accumulator += dt * this.speed * world.cheats.speed;
|
|
574
|
+
if (world.cheats.speed === 0 && this.speed > 0 && world.debugWaiting) this.accumulator += world.dt;
|
|
575
|
+
while (this.accumulator >= world.dt) {
|
|
576
|
+
this.tickOnce();
|
|
577
|
+
this.accumulator -= world.dt;
|
|
578
|
+
stepped = true;
|
|
579
|
+
}
|
|
580
|
+
this.alpha = this.speed * world.cheats.speed > 0 ? this.accumulator / world.dt : 1;
|
|
581
|
+
if (!stepped) return this.view.events.length ? [this.capture()] : [];
|
|
582
|
+
this.debug.refresh();
|
|
583
|
+
return [this.capture()];
|
|
584
|
+
}
|
|
585
|
+
/** Sends a command. `seq` is the sender's own number for it, for a host passing on what a remote player numbered */
|
|
586
|
+
send(command, seq = ++this.lastSeq) {
|
|
587
|
+
this.world.issue({
|
|
588
|
+
...command,
|
|
589
|
+
player: this.playerId,
|
|
590
|
+
seq
|
|
591
|
+
});
|
|
592
|
+
return seq;
|
|
593
|
+
}
|
|
594
|
+
/**
|
|
595
|
+
* The number of the last command sent: a computer's seat keeps it through a save, so the commands it sends after a
|
|
596
|
+
* load are numbered as they would have been
|
|
597
|
+
*
|
|
598
|
+
* @beta
|
|
599
|
+
*/
|
|
600
|
+
lastSeq = 0;
|
|
601
|
+
/** The seat's team's fog as cells, visible and explored */
|
|
602
|
+
fog() {
|
|
603
|
+
const { fog } = this.world;
|
|
604
|
+
const cells = fog.cells(this.team);
|
|
605
|
+
return {
|
|
606
|
+
width: fog.width,
|
|
607
|
+
depth: fog.depth,
|
|
608
|
+
version: fog.version,
|
|
609
|
+
revealed: this.observer || fog.isRevealed(this.team) || !cells,
|
|
610
|
+
visible: cells?.visible ?? /* @__PURE__ */ new Uint8Array(0),
|
|
611
|
+
explored: cells?.explored ?? /* @__PURE__ */ new Uint8Array(0)
|
|
612
|
+
};
|
|
613
|
+
}
|
|
614
|
+
/** Where the game's money is mined, as the map shows it, seen or not (`GameSession.mines`, `minesFor`) */
|
|
615
|
+
mines() {
|
|
616
|
+
return minesFor(this.view);
|
|
617
|
+
}
|
|
618
|
+
/** The lanes of the map, as the map shows them (`GameSession.lanes`) */
|
|
619
|
+
lanes() {
|
|
620
|
+
return lanesOf(this.world);
|
|
621
|
+
}
|
|
622
|
+
/** The camps as the player knows them (`GameSession.camps`, `campsFor`): worked out once a tick */
|
|
623
|
+
camps() {
|
|
624
|
+
return campsFor(this.view);
|
|
625
|
+
}
|
|
626
|
+
/** Whether the player could place a building of this type at the point now, seen as their team sees the ground */
|
|
627
|
+
canPlace(unitType, point) {
|
|
628
|
+
return this.registry.units.has(unitType) && canPlaceStructure(this.world, this.registry.unit(unitType), point, this.playerId, true);
|
|
629
|
+
}
|
|
630
|
+
/** Which cells of a building's ground are in the way for the player: taken, or not explored by their team (`placementCells`) */
|
|
631
|
+
placeCells(unitType, point) {
|
|
632
|
+
if (!this.registry.units.has(unitType)) return void 0;
|
|
633
|
+
const { world } = this;
|
|
634
|
+
const { team } = world.player(this.playerId);
|
|
635
|
+
return placementCells(this.registry.unit(unitType), point, (x, z) => world.grid.canPlace(x, z, 1, 1), (x, z) => world.fog.isExplored(team, x + .5, z + .5));
|
|
636
|
+
}
|
|
637
|
+
/** Where a group would stand sent to a point in a formation, the rules' own pick when none is named (`GameSession.formationPlaces`) */
|
|
638
|
+
formationPlaces(units, point, facing, formation) {
|
|
639
|
+
const { world } = this;
|
|
640
|
+
const id = formation ?? world.settings.movement.formation(world, units.flatMap((unit) => world.get(unit.id) ?? []), {
|
|
641
|
+
type: "move",
|
|
642
|
+
point
|
|
643
|
+
});
|
|
644
|
+
return formationPreview(this.registry, units, point, world, id, facing);
|
|
645
|
+
}
|
|
646
|
+
/** A path between two points on the ground, or in the air when `flying`; null when there is none */
|
|
647
|
+
findPath(from, to, flying = false) {
|
|
648
|
+
return (flying ? this.world.air : this.world.nav).findPath(from, to);
|
|
649
|
+
}
|
|
650
|
+
/** What happened since the last snapshot, not yet given in one: a copy, for a computer's save */
|
|
651
|
+
pendingEvents() {
|
|
652
|
+
return structuredClone(this.view.events);
|
|
653
|
+
}
|
|
654
|
+
/** Takes back what `pendingEvents` gave, ahead of what has happened since: in a game loaded from a save */
|
|
655
|
+
restoreEvents(events) {
|
|
656
|
+
this.view.events = [...structuredClone(events), ...this.view.events];
|
|
657
|
+
}
|
|
658
|
+
/** Whether the world goes with the session */
|
|
659
|
+
ownsWorld;
|
|
660
|
+
/** Stops the session's listeners and debug tools, and the world too when the session owns it */
|
|
661
|
+
dispose() {
|
|
662
|
+
for (const dispose of this.disposers.splice(0)) dispose();
|
|
663
|
+
this.debug.dispose();
|
|
664
|
+
if (this.ownsWorld) this.world.dispose();
|
|
665
|
+
}
|
|
666
|
+
};
|
|
667
|
+
//#endregion
|
|
668
|
+
export { COMPUTER_EVENTS, LocalSession, endSharedCaptures, shareCaptures };
|
|
669
|
+
|
|
670
|
+
//# sourceMappingURL=local.js.map
|