@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,415 @@
|
|
|
1
|
+
import { baseStats } from "../defs.js";
|
|
2
|
+
import { orderSays } from "../orders/facts.js";
|
|
3
|
+
import { changedStats } from "../stats.js";
|
|
4
|
+
import { deposit, fighting, moving } from "../entity.js";
|
|
5
|
+
import { shieldOf } from "../abilities/buffs.js";
|
|
6
|
+
import { dashing } from "../dashing.js";
|
|
7
|
+
import { assertPlainData } from "../debug2.js";
|
|
8
|
+
import { recastsLeft } from "../abilities/recast.js";
|
|
9
|
+
import { declaredRefusal, notReady } from "../orders/cast.js";
|
|
10
|
+
import { illusion } from "../summons.js";
|
|
11
|
+
import { same } from "./delta.js";
|
|
12
|
+
//#region src/session/entityState.ts
|
|
13
|
+
/**
|
|
14
|
+
* What a player is told of an entity (design review E7): what everyone in sight of it is, worked out once a tick for
|
|
15
|
+
* every seat of a host (`commonEntityState`), and on it what is one player's own (`playerEntityState`). A seat
|
|
16
|
+
* (`LocalSession`) puts them in its snapshots.
|
|
17
|
+
*
|
|
18
|
+
* Most of what stands in sight stands as it was told last tick, so what was told is kept (`Entity.told` for
|
|
19
|
+
* everyone's part, the seat's own memory for the player's) and handed back as the very same object while it still
|
|
20
|
+
* says the truth (`commonStillTold`, the own part's checks): the screen and a host's delta tell by the object that
|
|
21
|
+
* nothing changed, and go no further. Each check mirrors its builder field by field; `checkTold` (`debugChecks.snapshots`)
|
|
22
|
+
* catches a field the one tells and the other forgets
|
|
23
|
+
*/
|
|
24
|
+
/** A rule of `RuleSettings.hud` for one unit: its value, or what its function decides */
|
|
25
|
+
var ruleOf = (world, entity, rule) => typeof rule === "function" ? rule(world, entity) : rule;
|
|
26
|
+
/** The seconds left of one buff as told: -1 for one with no end, or kept up by an aura or a passive */
|
|
27
|
+
var buffTimeOf = (buff) => Number.isFinite(buff.remaining) && !buff.kept ? Math.max(buff.remaining, 0) : -1;
|
|
28
|
+
/** The seconds left of a unit's buffs, in their order (`buffTimeOf`) */
|
|
29
|
+
function buffTimesOf(entity) {
|
|
30
|
+
const times = new Array(entity.buffs.length);
|
|
31
|
+
for (let i = 0; i < entity.buffs.length; i++) times[i] = buffTimeOf(entity.buffs[i]);
|
|
32
|
+
return times;
|
|
33
|
+
}
|
|
34
|
+
/** Whether the buff times told are those of the unit's buffs now */
|
|
35
|
+
function sameBuffTimes(entity, times) {
|
|
36
|
+
if (times.length !== entity.buffs.length) return false;
|
|
37
|
+
for (let i = 0; i < times.length; i++) if (times[i] !== buffTimeOf(entity.buffs[i])) return false;
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
/** Whether a unit is camouflaged (`BuffDef.camouflage`, the vision pack: its enemies see it only from near) */
|
|
41
|
+
function camouflaged(world, entity) {
|
|
42
|
+
if (!entity.buffs.length) return false;
|
|
43
|
+
for (const buff of entity.buffs) if (world.registry.buff(buff.id).camouflage !== void 0) return true;
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* What everyone in sight of an entity is told of it this tick, the same for every seat (`EntityState`): where it is,
|
|
48
|
+
* its health and mana, its stats where they changed, its buffs, what the rules share for the plates over it. `name`
|
|
49
|
+
* is what the map calls it, where it has a name. `commonStillTold` mirrors it: a field told here is checked there
|
|
50
|
+
*
|
|
51
|
+
* @internal
|
|
52
|
+
*/
|
|
53
|
+
function commonEntityState(world, entity, name) {
|
|
54
|
+
const state = {
|
|
55
|
+
id: entity.id,
|
|
56
|
+
type: entity.def.id,
|
|
57
|
+
owner: entity.owner,
|
|
58
|
+
x: entity.pos.x,
|
|
59
|
+
z: entity.pos.z,
|
|
60
|
+
facing: entity.facing,
|
|
61
|
+
health: entity.health,
|
|
62
|
+
stats: changedStats(world, entity),
|
|
63
|
+
visible: true
|
|
64
|
+
};
|
|
65
|
+
const base = baseStats(entity.def, world.registry);
|
|
66
|
+
if (entity.maxHealth !== base.health) state.maxHealth = entity.maxHealth;
|
|
67
|
+
if (entity.buffs.length) state.shield = shieldOf(entity) || void 0;
|
|
68
|
+
const dash = entity.get(dashing);
|
|
69
|
+
if (dash?.height) state.leap = {
|
|
70
|
+
from: dash.from,
|
|
71
|
+
to: {
|
|
72
|
+
x: dash.x,
|
|
73
|
+
z: dash.z
|
|
74
|
+
},
|
|
75
|
+
height: dash.height
|
|
76
|
+
};
|
|
77
|
+
if (entity.maxMana > 0) {
|
|
78
|
+
state.mana = entity.mana;
|
|
79
|
+
if (entity.maxMana !== base.mana) state.maxMana = entity.maxMana;
|
|
80
|
+
}
|
|
81
|
+
if (entity.buffs.length) state.buffs = entity.buffs.map((buff) => buff.id);
|
|
82
|
+
for (const buff of entity.buffs) if (buff.stacks) (state.stacks ??= {})[buff.id] = buff.stacks;
|
|
83
|
+
const { hud } = world.settings;
|
|
84
|
+
if (hud.shareBuffTimes !== void 0 && entity.buffs.length && ruleOf(world, entity, hud.shareBuffTimes) === true) state.buffTimes = buffTimesOf(entity);
|
|
85
|
+
if (hud.shareAbilities !== void 0 && entity.abilities.length) {
|
|
86
|
+
const share = ruleOf(world, entity, hud.shareAbilities);
|
|
87
|
+
if (share === "icons" || share === "cooldowns") {
|
|
88
|
+
const abilities = [];
|
|
89
|
+
for (const { id, level, cooldown } of entity.abilities) if (level >= 1) abilities.push(share === "cooldowns" ? {
|
|
90
|
+
id,
|
|
91
|
+
level,
|
|
92
|
+
cooldown
|
|
93
|
+
} : {
|
|
94
|
+
id,
|
|
95
|
+
level
|
|
96
|
+
});
|
|
97
|
+
if (abilities.length) state.abilities = abilities;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
if (entity.get(deposit)) state.resource = entity.get(deposit).amount;
|
|
101
|
+
if (entity.on !== void 0) state.on = entity.on;
|
|
102
|
+
if (entity.asleep) state.asleep = true;
|
|
103
|
+
if (entity.orders.length) state.busy = true;
|
|
104
|
+
if (entity.scale !== 1) state.scale = entity.scale;
|
|
105
|
+
if (entity.look) state.look = entity.look;
|
|
106
|
+
if (entity.likeness) state.likeness = entity.likeness;
|
|
107
|
+
if (world.sight.isInvisible(entity) || camouflaged(world, entity)) state.unseen = true;
|
|
108
|
+
if (name !== void 0) state.name = name;
|
|
109
|
+
if (entity.expires !== null && !entity.has(illusion)) state.lifetime = {
|
|
110
|
+
left: entity.expires,
|
|
111
|
+
total: entity.lifetime
|
|
112
|
+
};
|
|
113
|
+
return state;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Whether what everyone was told of an entity (`state`, made by `commonEntityState`) is still what it would be told
|
|
117
|
+
* now: each field against where the builder reads it, those that change most often first. A field left out here
|
|
118
|
+
* would leave a screen stale: `checkTold` catches that
|
|
119
|
+
*
|
|
120
|
+
* @internal
|
|
121
|
+
*/
|
|
122
|
+
function commonStillTold(world, entity, state, name) {
|
|
123
|
+
if (state.x !== entity.pos.x || state.z !== entity.pos.z || state.facing !== entity.facing || state.health !== entity.health) return false;
|
|
124
|
+
if (state.type !== entity.def.id || state.owner !== entity.owner || state.name !== name) return false;
|
|
125
|
+
if (state.stats !== changedStats(world, entity)) return false;
|
|
126
|
+
const base = baseStats(entity.def, world.registry);
|
|
127
|
+
if (state.maxHealth !== (entity.maxHealth !== base.health ? entity.maxHealth : void 0)) return false;
|
|
128
|
+
if (entity.maxMana > 0) {
|
|
129
|
+
if (state.mana !== entity.mana || state.maxMana !== (entity.maxMana !== base.mana ? entity.maxMana : void 0)) return false;
|
|
130
|
+
} else if (state.mana !== void 0) return false;
|
|
131
|
+
const { buffs } = entity;
|
|
132
|
+
if (state.shield !== (buffs.length ? shieldOf(entity) || void 0 : void 0)) return false;
|
|
133
|
+
const dash = entity.get(dashing);
|
|
134
|
+
if (dash?.height) {
|
|
135
|
+
const { leap } = state;
|
|
136
|
+
if (!leap || leap.from.x !== dash.from.x || leap.from.z !== dash.from.z || leap.to.x !== dash.x || leap.to.z !== dash.z || leap.height !== dash.height) return false;
|
|
137
|
+
} else if (state.leap) return false;
|
|
138
|
+
if (buffs.length) {
|
|
139
|
+
const ids = state.buffs;
|
|
140
|
+
if (!ids || ids.length !== buffs.length) return false;
|
|
141
|
+
let stacked = 0;
|
|
142
|
+
for (let i = 0; i < buffs.length; i++) {
|
|
143
|
+
const buff = buffs[i];
|
|
144
|
+
if (ids[i] !== buff.id) return false;
|
|
145
|
+
if (buff.stacks) {
|
|
146
|
+
stacked++;
|
|
147
|
+
if (state.stacks?.[buff.id] !== buff.stacks) return false;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
if (stacked === 0 ? state.stacks !== void 0 : !state.stacks || Object.keys(state.stacks).length > stacked) return false;
|
|
151
|
+
} else if (state.buffs || state.stacks) return false;
|
|
152
|
+
const { hud } = world.settings;
|
|
153
|
+
if (hud.shareBuffTimes !== void 0 && buffs.length && ruleOf(world, entity, hud.shareBuffTimes) === true) {
|
|
154
|
+
if (!state.buffTimes || !sameBuffTimes(entity, state.buffTimes)) return false;
|
|
155
|
+
} else if (state.buffTimes) return false;
|
|
156
|
+
const share = hud.shareAbilities !== void 0 && entity.abilities.length ? ruleOf(world, entity, hud.shareAbilities) : void 0;
|
|
157
|
+
if (share === "icons" || share === "cooldowns") {
|
|
158
|
+
const told = state.abilities;
|
|
159
|
+
let n = 0;
|
|
160
|
+
for (const { id, level, cooldown } of entity.abilities) {
|
|
161
|
+
if (level < 1) continue;
|
|
162
|
+
const ability = told?.[n++];
|
|
163
|
+
if (!ability || ability.id !== id || ability.level !== level || ability.cooldown !== (share === "cooldowns" ? cooldown : void 0)) return false;
|
|
164
|
+
}
|
|
165
|
+
if ((told?.length ?? 0) !== n) return false;
|
|
166
|
+
} else if (state.abilities) return false;
|
|
167
|
+
if (state.resource !== entity.get(deposit)?.amount) return false;
|
|
168
|
+
if (state.on !== entity.on || state.asleep !== (entity.asleep || void 0) || state.busy !== (entity.orders.length ? true : void 0)) return false;
|
|
169
|
+
if (state.scale !== (entity.scale !== 1 ? entity.scale : void 0) || state.look !== (entity.look || void 0) || state.likeness !== (entity.likeness || void 0)) return false;
|
|
170
|
+
if (state.unseen !== (world.sight.isInvisible(entity) || camouflaged(world, entity) || void 0)) return false;
|
|
171
|
+
if (entity.expires !== null && !entity.has(illusion)) {
|
|
172
|
+
if (!state.lifetime || state.lifetime.left !== entity.expires || state.lifetime.total !== entity.lifetime) return false;
|
|
173
|
+
} else if (state.lifetime) return false;
|
|
174
|
+
return true;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Whether an entity has a component replicated to its owner, or shaping itself for each player (`Component.snapshot`)
|
|
178
|
+
*
|
|
179
|
+
* @internal
|
|
180
|
+
*/
|
|
181
|
+
function hasOnePlayersPart(world, entity) {
|
|
182
|
+
for (const held of entity.heldComponents()) {
|
|
183
|
+
const component = world.registry.component(held.id);
|
|
184
|
+
if (component?.replicate === "owner" || component?.replicate && component.snapshot) return true;
|
|
185
|
+
}
|
|
186
|
+
return false;
|
|
187
|
+
}
|
|
188
|
+
/** Whether the control of another's unit is shared with the player: its owner lets them command it */
|
|
189
|
+
var commands = (view, entity) => entity.owner !== view.player && !view.observer && view.world.mayCommand(view.player, entity);
|
|
190
|
+
/** Where the orders queued after the first go: a known target's place, or the point given. None for the orders of no place */
|
|
191
|
+
function eachWaypoint(view, entity, each) {
|
|
192
|
+
for (let i = 1; i < entity.orders.length; i++) {
|
|
193
|
+
const order = entity.orders[i];
|
|
194
|
+
const target = view.world.get(order.init.target);
|
|
195
|
+
const point = target && view.knows(target) ? target.pos : order.init.point;
|
|
196
|
+
if (point) each(point);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* What its side is told of a unit of theirs (`OwnEntityState`): its orders, where it goes, its abilities for the
|
|
201
|
+
* command card. `ownStillTold` mirrors it
|
|
202
|
+
*/
|
|
203
|
+
function ownEntityState(view, entity) {
|
|
204
|
+
const { world } = view;
|
|
205
|
+
const m = entity.get(moving);
|
|
206
|
+
let waypoints;
|
|
207
|
+
eachWaypoint(view, entity, (point) => (waypoints ??= []).push({
|
|
208
|
+
x: point.x,
|
|
209
|
+
z: point.z
|
|
210
|
+
}));
|
|
211
|
+
const own = {
|
|
212
|
+
...commands(view, entity) && { shared: true },
|
|
213
|
+
hidden: entity.hidden,
|
|
214
|
+
order: entity.orders[0]?.type ?? null,
|
|
215
|
+
build: entity.orders[0]?.type === "build" && !orderSays(world, entity, "building") ? entity.orders[0].init.unitType : void 0,
|
|
216
|
+
orders: entity.orders.length,
|
|
217
|
+
passive: entity.get(fighting)?.passive ?? false,
|
|
218
|
+
fighting: !!entity.get(fighting)?.autoTarget,
|
|
219
|
+
goal: m?.status === "moving" ? {
|
|
220
|
+
x: m.navGoal.x,
|
|
221
|
+
z: m.navGoal.z
|
|
222
|
+
} : void 0,
|
|
223
|
+
...waypoints && { waypoints }
|
|
224
|
+
};
|
|
225
|
+
if (entity.abilities.length) {
|
|
226
|
+
const hooked = world.hooks.has("canCast");
|
|
227
|
+
own.abilities = entity.abilities.map(({ id, level, cooldown, charges, refill, autocast, data, recast }) => {
|
|
228
|
+
const info = {
|
|
229
|
+
id,
|
|
230
|
+
level,
|
|
231
|
+
cooldown,
|
|
232
|
+
autocast
|
|
233
|
+
};
|
|
234
|
+
if (charges !== void 0) Object.assign(info, {
|
|
235
|
+
charges,
|
|
236
|
+
refill
|
|
237
|
+
});
|
|
238
|
+
if (recast) info.recast = {
|
|
239
|
+
left: recast.left,
|
|
240
|
+
total: recast.total,
|
|
241
|
+
count: recastsLeft(world.registry.ability(id), recast)
|
|
242
|
+
};
|
|
243
|
+
if (data) {
|
|
244
|
+
if (world.checks.events) assertPlainData(data, `Ability "${id}" of ${entity.def.id}#${entity.id}: its data`);
|
|
245
|
+
info.data = structuredClone(data);
|
|
246
|
+
}
|
|
247
|
+
if (!hooked || level < 1) return info;
|
|
248
|
+
const ability = world.registry.ability(id);
|
|
249
|
+
const declared = declaredRefusal(world, entity, ability);
|
|
250
|
+
const decided = notReady(world, entity, ability);
|
|
251
|
+
if (declared?.key !== decided?.key) info.decided = decided ?? null;
|
|
252
|
+
return info;
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
return own;
|
|
256
|
+
}
|
|
257
|
+
/** Whether the abilities a side was told of its unit (`ownEntityState`) are still what it would be told */
|
|
258
|
+
function abilitiesStillTold(view, entity, told) {
|
|
259
|
+
const { world } = view;
|
|
260
|
+
if (!entity.abilities.length) return told === void 0;
|
|
261
|
+
if (!told || told.length !== entity.abilities.length) return false;
|
|
262
|
+
const hooked = world.hooks.has("canCast");
|
|
263
|
+
for (let i = 0; i < told.length; i++) {
|
|
264
|
+
const info = told[i];
|
|
265
|
+
const { id, level, cooldown, charges, refill, autocast, data, recast } = entity.abilities[i];
|
|
266
|
+
if (info.id !== id || info.level !== level || info.cooldown !== cooldown || info.autocast !== autocast) return false;
|
|
267
|
+
if (charges !== void 0 ? info.charges !== charges || info.refill !== refill : info.charges !== void 0) return false;
|
|
268
|
+
if (recast) {
|
|
269
|
+
const r = info.recast;
|
|
270
|
+
if (!r || r.left !== recast.left || r.total !== recast.total || r.count !== recastsLeft(world.registry.ability(id), recast)) return false;
|
|
271
|
+
} else if (info.recast) return false;
|
|
272
|
+
if (data ? !info.data || !same(info.data, data) : info.data) return false;
|
|
273
|
+
if (hooked && level >= 1) {
|
|
274
|
+
const ability = world.registry.ability(id);
|
|
275
|
+
const declared = declaredRefusal(world, entity, ability);
|
|
276
|
+
const decided = notReady(world, entity, ability);
|
|
277
|
+
if (!same(info.decided, declared?.key !== decided?.key ? decided ?? null : void 0)) return false;
|
|
278
|
+
} else if (info.decided !== void 0) return false;
|
|
279
|
+
}
|
|
280
|
+
return true;
|
|
281
|
+
}
|
|
282
|
+
/** Whether what a side was told of its unit (`ownEntityState`) is still what it would be told: each field against where the builder reads it */
|
|
283
|
+
function ownStillTold(view, entity, own) {
|
|
284
|
+
const { world } = view;
|
|
285
|
+
const first = entity.orders[0];
|
|
286
|
+
if (own.orders !== entity.orders.length || own.order !== (first?.type ?? null) || own.hidden !== entity.hidden) return false;
|
|
287
|
+
if (own.shared !== (commands(view, entity) || void 0)) return false;
|
|
288
|
+
if (own.build !== (first?.type === "build" && !orderSays(world, entity, "building") ? first.init.unitType : void 0)) return false;
|
|
289
|
+
const fight = entity.get(fighting);
|
|
290
|
+
if (own.passive !== (fight?.passive ?? false) || own.fighting !== !!fight?.autoTarget) return false;
|
|
291
|
+
const m = entity.get(moving);
|
|
292
|
+
if (m?.status === "moving") {
|
|
293
|
+
if (!own.goal || own.goal.x !== m.navGoal.x || own.goal.z !== m.navGoal.z) return false;
|
|
294
|
+
} else if (own.goal) return false;
|
|
295
|
+
let n = 0;
|
|
296
|
+
let waypointsHold = true;
|
|
297
|
+
eachWaypoint(view, entity, (point) => {
|
|
298
|
+
const way = own.waypoints?.[n++];
|
|
299
|
+
if (!way || way.x !== point.x || way.z !== point.z) waypointsHold = false;
|
|
300
|
+
});
|
|
301
|
+
if (!waypointsHold || (own.waypoints?.length ?? 0) !== n) return false;
|
|
302
|
+
return abilitiesStillTold(view, entity, own.abilities);
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Whether what was told of a structure's components (`state.components`) is what they hold now: what lets a tree's or
|
|
306
|
+
* a mine's description be said again as it is (`LocalSession.see`). Components told to everyone as they are are
|
|
307
|
+
* compared; one shaped for each player (`snapshot`), or told to some alone, has it described anew. True for what holds
|
|
308
|
+
* none told, which is nearly every tree
|
|
309
|
+
*
|
|
310
|
+
* @internal
|
|
311
|
+
*/
|
|
312
|
+
function sharedStillTold(entity, state) {
|
|
313
|
+
const told = state.components;
|
|
314
|
+
let count = 0;
|
|
315
|
+
for (const held of entity.heldComponents()) {
|
|
316
|
+
if (!held.replicate) continue;
|
|
317
|
+
if (held.replicate !== "everyone" || held.snapshot) return false;
|
|
318
|
+
const was = told?.[held.id];
|
|
319
|
+
if (was === void 0 || !same(was, entity.get(held))) return false;
|
|
320
|
+
count++;
|
|
321
|
+
}
|
|
322
|
+
return !told || Object.keys(told).length === count;
|
|
323
|
+
}
|
|
324
|
+
/** Whether two sets of components' parts are the very same objects under the same ids */
|
|
325
|
+
function sameParts(a, b) {
|
|
326
|
+
if (a === b) return true;
|
|
327
|
+
if (!a || !b) return false;
|
|
328
|
+
for (const id in a) if (a[id] !== b[id]) return false;
|
|
329
|
+
for (const id in b) if (!(id in a)) return false;
|
|
330
|
+
return true;
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* What one player is told of an entity, on what everyone is (`shared`, `commonEntityState`): an illusion's lifetime on
|
|
334
|
+
* its own side, the components replicated to the player and what they make of themselves for them, and its own part
|
|
335
|
+
* (`own`: its orders, where it goes, its abilities) for one of the player's side. `shared` itself where there is
|
|
336
|
+
* nothing more.
|
|
337
|
+
*
|
|
338
|
+
* With what the player was told last (`before`), each part is last time's object where it still says the same, and
|
|
339
|
+
* the whole is last time's where every part is and `shared` is what it was made on: the very objects tell the screen
|
|
340
|
+
* and the delta that nothing changed
|
|
341
|
+
*
|
|
342
|
+
* @internal
|
|
343
|
+
*/
|
|
344
|
+
function playerEntityState(view, entity, shared, before) {
|
|
345
|
+
const { world, player, observer } = view;
|
|
346
|
+
const was = before?.state;
|
|
347
|
+
const ally = view.isAlly(entity.owner);
|
|
348
|
+
let lifetime;
|
|
349
|
+
if (entity.expires !== null && entity.has(illusion) && ally) {
|
|
350
|
+
const kept = was?.lifetime;
|
|
351
|
+
lifetime = kept && kept.left === entity.expires && kept.total === entity.lifetime ? kept : {
|
|
352
|
+
left: entity.expires,
|
|
353
|
+
total: entity.lifetime
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
let components;
|
|
357
|
+
let seen;
|
|
358
|
+
for (const held of entity.heldComponents()) {
|
|
359
|
+
const { id } = held;
|
|
360
|
+
const component = world.registry.component(id);
|
|
361
|
+
const audience = component?.replicate;
|
|
362
|
+
if (!audience) continue;
|
|
363
|
+
if (!(audience === "everyone" || (audience === "allies" ? ally : entity.owner === player))) continue;
|
|
364
|
+
const value = entity.get(held);
|
|
365
|
+
const kept = was?.components?.[id];
|
|
366
|
+
let sent;
|
|
367
|
+
if (component.snapshot) {
|
|
368
|
+
sent = component.snapshot(value, entity, seen ??= {
|
|
369
|
+
world,
|
|
370
|
+
player: observer ? void 0 : player,
|
|
371
|
+
own: entity.owner === player,
|
|
372
|
+
ally,
|
|
373
|
+
observer,
|
|
374
|
+
knows: view.knows,
|
|
375
|
+
isAlly: view.isAlly,
|
|
376
|
+
sees: view.sees
|
|
377
|
+
});
|
|
378
|
+
if (sent !== void 0 && kept !== void 0 && same(kept, sent)) sent = kept;
|
|
379
|
+
} else sent = kept !== void 0 && same(kept, value) ? kept : structuredClone(value);
|
|
380
|
+
if (sent !== void 0) (components ??= {})[id] = sent;
|
|
381
|
+
}
|
|
382
|
+
let buffTimes;
|
|
383
|
+
let own;
|
|
384
|
+
if (ally) {
|
|
385
|
+
const shareBuffTimes = world.settings.hud.shareBuffTimes;
|
|
386
|
+
if (shareBuffTimes !== void 0 && entity.buffs.length && !shared.buffTimes && ruleOf(world, entity, shareBuffTimes) === "allies") buffTimes = was?.buffTimes && sameBuffTimes(entity, was.buffTimes) ? was.buffTimes : buffTimesOf(entity);
|
|
387
|
+
own = was?.own && ownStillTold(view, entity, was.own) ? was.own : ownEntityState(view, entity);
|
|
388
|
+
}
|
|
389
|
+
if (!lifetime && !components && !buffTimes && !own) return shared;
|
|
390
|
+
if (was && was !== shared && before.shared === shared && (lifetime ?? shared.lifetime) === was.lifetime && (buffTimes ?? shared.buffTimes) === was.buffTimes && own === was.own && sameParts(components, was.components)) return was;
|
|
391
|
+
const state = { ...shared };
|
|
392
|
+
if (lifetime) state.lifetime = lifetime;
|
|
393
|
+
if (components) state.components = components;
|
|
394
|
+
if (buffTimes) state.buffTimes = buffTimes;
|
|
395
|
+
if (own) state.own = own;
|
|
396
|
+
return state;
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* Throws when what a player is told of an entity (`state`, kept from before in whole or in part) is not what
|
|
400
|
+
* describing it anew says: a field one of the builders tells and its check forgets. See `debugChecks.snapshots`
|
|
401
|
+
*
|
|
402
|
+
* @internal
|
|
403
|
+
*/
|
|
404
|
+
function checkTold(view, entity, state, name) {
|
|
405
|
+
const fresh = playerEntityState(view, entity, commonEntityState(view.world, entity, name));
|
|
406
|
+
const keys = /* @__PURE__ */ new Set([...Object.keys(fresh), ...Object.keys(state)]);
|
|
407
|
+
for (const key of keys) {
|
|
408
|
+
if (same(fresh[key], state[key])) continue;
|
|
409
|
+
throw new Error(`Stale entity state: ${entity.def.id}#${entity.id} for player ${view.player} says ${key} ${JSON.stringify(state[key])}, should be ${JSON.stringify(fresh[key])}`);
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
//#endregion
|
|
413
|
+
export { checkTold, commonEntityState, commonStillTold, hasOnePlayersPart, playerEntityState, sharedStillTold };
|
|
414
|
+
|
|
415
|
+
//# sourceMappingURL=entityState.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entityState.js","names":[],"sources":["../../src/session/entityState.ts"],"sourcesContent":["/**\n * What a player is told of an entity (design review E7): what everyone in sight of it is, worked out once a tick for\n * every seat of a host (`commonEntityState`), and on it what is one player's own (`playerEntityState`). A seat\n * (`LocalSession`) puts them in its snapshots.\n *\n * Most of what stands in sight stands as it was told last tick, so what was told is kept (`Entity.told` for\n * everyone's part, the seat's own memory for the player's) and handed back as the very same object while it still\n * says the truth (`commonStillTold`, the own part's checks): the screen and a host's delta tell by the object that\n * nothing changed, and go no further. Each check mirrors its builder field by field; `checkTold` (`debugChecks.snapshots`)\n * catches a field the one tells and the other forgets\n */\nimport { orderSays } from '#engine/orders/facts'\nimport { dashing } from '#engine/dashing'\nimport { illusion } from '#engine/summons'\nimport type { SnapshotView } from '#engine/components'\nimport type { Entity } from '#engine/entity'\nimport type { Vec2 } from '#engine/math'\nimport { declaredRefusal, notReady } from '#engine/orders/cast'\nimport { shieldOf } from '#engine/abilities/buffs'\nimport { recastsLeft } from '#engine/abilities/recast'\nimport { baseStats } from '#engine/defs'\nimport { assertPlainData } from '#engine/debug'\nimport { changedStats } from '#engine/stats'\nimport type { World } from '#engine/world'\nimport type { HudShareRule } from '#engine/rules'\nimport type { SessionView } from '#engine/replication'\nimport { deposit, fighting, moving } from '#engine/entity'\nimport { same } from './delta'\nimport type { AbilityInfo, EntityState, OwnEntityState, SharedAbility } from './protocol'\n\n/** A rule of `RuleSettings.hud` for one unit: its value, or what its function decides */\nconst ruleOf = <T>(world: World, entity: Entity, rule: HudShareRule<T>): T =>\n\ttypeof rule === 'function' ? (rule as (world: World, entity: Entity) => T)(world, entity) : rule\n\n/** The seconds left of one buff as told: -1 for one with no end, or kept up by an aura or a passive */\nconst buffTimeOf = (buff: Entity['buffs'][number]): number => (Number.isFinite(buff.remaining) && !buff.kept ? Math.max(buff.remaining, 0) : -1)\n\n/** The seconds left of a unit's buffs, in their order (`buffTimeOf`) */\nfunction buffTimesOf(entity: Entity): number[] {\n\tconst times = new Array<number>(entity.buffs.length)\n\tfor (let i = 0; i < entity.buffs.length; i++) times[i] = buffTimeOf(entity.buffs[i])\n\treturn times\n}\n\n/** Whether the buff times told are those of the unit's buffs now */\nfunction sameBuffTimes(entity: Entity, times: number[]): boolean {\n\tif (times.length !== entity.buffs.length) return false\n\tfor (let i = 0; i < times.length; i++) if (times[i] !== buffTimeOf(entity.buffs[i])) return false\n\treturn true\n}\n\n/** Whether a unit is camouflaged (`BuffDef.camouflage`, the vision pack: its enemies see it only from near) */\nfunction camouflaged(world: World, entity: Entity): boolean {\n\tif (!entity.buffs.length) return false\n\tfor (const buff of entity.buffs) if (world.registry.buff(buff.id).camouflage !== undefined) return true\n\treturn false\n}\n\n/**\n * What everyone in sight of an entity is told of it this tick, the same for every seat (`EntityState`): where it is,\n * its health and mana, its stats where they changed, its buffs, what the rules share for the plates over it. `name`\n * is what the map calls it, where it has a name. `commonStillTold` mirrors it: a field told here is checked there\n *\n * @internal\n */\nexport function commonEntityState(world: World, entity: Entity, name: string | undefined): EntityState {\n\tconst state: EntityState = {\n\t\tid: entity.id,\n\t\ttype: entity.def.id,\n\t\towner: entity.owner,\n\t\tx: entity.pos.x,\n\t\tz: entity.pos.z,\n\t\tfacing: entity.facing,\n\t\thealth: entity.health,\n\t\tstats: changedStats(world, entity),\n\t\tvisible: true\n\t}\n\tconst base = baseStats(entity.def, world.registry)\n\tif (entity.maxHealth !== base.health) state.maxHealth = entity.maxHealth\n\tif (entity.buffs.length) state.shield = shieldOf(entity) || undefined\n\tconst dash = entity.get(dashing)\n\tif (dash?.height) state.leap = { from: dash.from, to: { x: dash.x, z: dash.z }, height: dash.height }\n\tif (entity.maxMana > 0) {\n\t\tstate.mana = entity.mana\n\t\tif (entity.maxMana !== base.mana) state.maxMana = entity.maxMana\n\t}\n\tif (entity.buffs.length) state.buffs = entity.buffs.map((buff) => buff.id)\n\tfor (const buff of entity.buffs) if (buff.stacks) (state.stacks ??= {})[buff.id] = buff.stacks\n\t// what the game's rules share besides, for the plates over it (indicators-plan U3)\n\tconst { hud } = world.settings\n\tif (hud.shareBuffTimes !== undefined && entity.buffs.length && ruleOf(world, entity, hud.shareBuffTimes) === true)\n\t\tstate.buffTimes = buffTimesOf(entity)\n\tif (hud.shareAbilities !== undefined && entity.abilities.length) {\n\t\tconst share = ruleOf(world, entity, hud.shareAbilities)\n\t\tif (share === 'icons' || share === 'cooldowns') {\n\t\t\tconst abilities: SharedAbility[] = []\n\t\t\tfor (const { id, level, cooldown } of entity.abilities) {\n\t\t\t\tif (level >= 1) abilities.push(share === 'cooldowns' ? { id, level, cooldown } : { id, level })\n\t\t\t}\n\t\t\tif (abilities.length) state.abilities = abilities\n\t\t}\n\t}\n\tif (entity.get(deposit)) state.resource = entity.get(deposit)!.amount\n\tif (entity.on !== undefined) state.on = entity.on\n\tif (entity.asleep) state.asleep = true\n\tif (entity.orders.length) state.busy = true\n\tif (entity.scale !== 1) state.scale = entity.scale\n\tif (entity.look) state.look = entity.look\n\tif (entity.likeness) state.likeness = entity.likeness\n\t// invisible, or camouflaged\n\tif (world.sight.isInvisible(entity) || camouflaged(world, entity)) state.unseen = true\n\tif (name !== undefined) state.name = name\n\t// how long an illusion lasts would give it away: its side alone is told (`describe`)\n\tif (entity.expires !== null && !entity.has(illusion)) state.lifetime = { left: entity.expires, total: entity.lifetime }\n\treturn state\n}\n\n/**\n * Whether what everyone was told of an entity (`state`, made by `commonEntityState`) is still what it would be told\n * now: each field against where the builder reads it, those that change most often first. A field left out here\n * would leave a screen stale: `checkTold` catches that\n *\n * @internal\n */\nexport function commonStillTold(world: World, entity: Entity, state: EntityState, name: string | undefined): boolean {\n\tif (state.x !== entity.pos.x || state.z !== entity.pos.z || state.facing !== entity.facing || state.health !== entity.health) return false\n\tif (state.type !== entity.def.id || state.owner !== entity.owner || state.name !== name) return false\n\t// the same stats are the same object (`changedStats`)\n\tif (state.stats !== changedStats(world, entity)) return false\n\tconst base = baseStats(entity.def, world.registry)\n\tif (state.maxHealth !== (entity.maxHealth !== base.health ? entity.maxHealth : undefined)) return false\n\tif (entity.maxMana > 0) {\n\t\tif (state.mana !== entity.mana || state.maxMana !== (entity.maxMana !== base.mana ? entity.maxMana : undefined)) return false\n\t} else if (state.mana !== undefined) return false\n\tconst { buffs } = entity\n\tif (state.shield !== (buffs.length ? shieldOf(entity) || undefined : undefined)) return false\n\tconst dash = entity.get(dashing)\n\tif (dash?.height) {\n\t\tconst { leap } = state\n\t\tif (\n\t\t\t!leap ||\n\t\t\tleap.from.x !== dash.from.x ||\n\t\t\tleap.from.z !== dash.from.z ||\n\t\t\tleap.to.x !== dash.x ||\n\t\t\tleap.to.z !== dash.z ||\n\t\t\tleap.height !== dash.height\n\t\t)\n\t\t\treturn false\n\t} else if (state.leap) return false\n\tif (buffs.length) {\n\t\tconst ids = state.buffs\n\t\tif (!ids || ids.length !== buffs.length) return false\n\t\tlet stacked = 0\n\t\tfor (let i = 0; i < buffs.length; i++) {\n\t\t\tconst buff = buffs[i]\n\t\t\tif (ids[i] !== buff.id) return false\n\t\t\tif (buff.stacks) {\n\t\t\t\tstacked++\n\t\t\t\tif (state.stacks?.[buff.id] !== buff.stacks) return false\n\t\t\t}\n\t\t}\n\t\t// a stack count that fell to nothing leaves its key behind: it would be told still\n\t\tif (stacked === 0 ? state.stacks !== undefined : !state.stacks || Object.keys(state.stacks).length > stacked) return false\n\t} else if (state.buffs || state.stacks) return false\n\tconst { hud } = world.settings\n\tif (hud.shareBuffTimes !== undefined && buffs.length && ruleOf(world, entity, hud.shareBuffTimes) === true) {\n\t\tif (!state.buffTimes || !sameBuffTimes(entity, state.buffTimes)) return false\n\t} else if (state.buffTimes) return false\n\tconst share = hud.shareAbilities !== undefined && entity.abilities.length ? ruleOf(world, entity, hud.shareAbilities) : undefined\n\tif (share === 'icons' || share === 'cooldowns') {\n\t\tconst told = state.abilities\n\t\tlet n = 0\n\t\tfor (const { id, level, cooldown } of entity.abilities) {\n\t\t\tif (level < 1) continue\n\t\t\tconst ability = told?.[n++]\n\t\t\tif (!ability || ability.id !== id || ability.level !== level || ability.cooldown !== (share === 'cooldowns' ? cooldown : undefined))\n\t\t\t\treturn false\n\t\t}\n\t\tif ((told?.length ?? 0) !== n) return false\n\t} else if (state.abilities) return false\n\tif (state.resource !== entity.get(deposit)?.amount) return false\n\tif (state.on !== entity.on || state.asleep !== (entity.asleep || undefined) || state.busy !== (entity.orders.length ? true : undefined))\n\t\treturn false\n\tif (\n\t\tstate.scale !== (entity.scale !== 1 ? entity.scale : undefined) ||\n\t\tstate.look !== (entity.look || undefined) ||\n\t\tstate.likeness !== (entity.likeness || undefined)\n\t)\n\t\treturn false\n\tif (state.unseen !== (world.sight.isInvisible(entity) || camouflaged(world, entity) || undefined)) return false\n\tif (entity.expires !== null && !entity.has(illusion)) {\n\t\tif (!state.lifetime || state.lifetime.left !== entity.expires || state.lifetime.total !== entity.lifetime) return false\n\t} else if (state.lifetime) return false\n\treturn true\n}\n\n/**\n * Whether an entity has a component replicated to its owner, or shaping itself for each player (`Component.snapshot`)\n *\n * @internal\n */\nexport function hasOnePlayersPart(world: World, entity: Entity): boolean {\n\tfor (const held of entity.heldComponents()) {\n\t\tconst component = world.registry.component(held.id)\n\t\tif (component?.replicate === 'owner' || (component?.replicate && component.snapshot)) return true\n\t}\n\treturn false\n}\n\n/**\n * What a player was told of an entity last (`playerEntityState`): the whole of it, and what everyone was told that\n * it was made on. A seat keeps one per entity it described\n *\n * @internal\n */\nexport interface Told {\n\tshared: EntityState\n\tstate: EntityState\n}\n\n/** Whether the control of another's unit is shared with the player: its owner lets them command it */\nconst commands = (view: SessionView, entity: Entity): boolean =>\n\tentity.owner !== view.player && !view.observer && view.world.mayCommand(view.player, entity)\n\n/** Where the orders queued after the first go: a known target's place, or the point given. None for the orders of no place */\nfunction eachWaypoint(view: SessionView, entity: Entity, each: (point: Readonly<Vec2>) => void): void {\n\tfor (let i = 1; i < entity.orders.length; i++) {\n\t\tconst order = entity.orders[i]\n\t\tconst target = view.world.get(order.init.target)\n\t\tconst point = target && view.knows(target) ? target.pos : order.init.point\n\t\tif (point) each(point)\n\t}\n}\n\n/**\n * What its side is told of a unit of theirs (`OwnEntityState`): its orders, where it goes, its abilities for the\n * command card. `ownStillTold` mirrors it\n */\nfunction ownEntityState(view: SessionView, entity: Entity): OwnEntityState {\n\tconst { world } = view\n\tconst m = entity.get(moving)\n\t// the places of the orders queued after the first: none made for a unit with nothing queued, most of them (RV87)\n\tlet waypoints: Vec2[] | undefined\n\teachWaypoint(view, entity, (point) => (waypoints ??= []).push({ x: point.x, z: point.z }))\n\tconst own: OwnEntityState = {\n\t\t// another's that this player may command: its owner shares control with them\n\t\t...(commands(view, entity) && { shared: true }),\n\t\thidden: entity.hidden,\n\t\torder: entity.orders[0]?.type ?? null,\n\t\t// on its way to build it: once the site is down, what it builds is there to be counted itself\n\t\tbuild: entity.orders[0]?.type === 'build' && !orderSays(world, entity, 'building') ? entity.orders[0].init.unitType : undefined,\n\t\torders: entity.orders.length,\n\t\tpassive: entity.get(fighting)?.passive ?? false,\n\t\tfighting: !!entity.get(fighting)?.autoTarget,\n\t\tgoal: m?.status === 'moving' ? { x: m.navGoal.x, z: m.navGoal.z } : undefined,\n\t\t...(waypoints && { waypoints })\n\t}\n\tif (entity.abilities.length) {\n\t\tconst hooked = world.hooks.has('canCast')\n\t\town.abilities = entity.abilities.map(({ id, level, cooldown, charges, refill, autocast, data, recast }) => {\n\t\t\tconst info: AbilityInfo = { id, level, cooldown, autocast }\n\t\t\tif (charges !== undefined) Object.assign(info, { charges, refill })\n\t\t\t// its window to be cast again (AB8): what is left of it, and of its recasts\n\t\t\tif (recast) info.recast = { left: recast.left, total: recast.total, count: recastsLeft(world.registry.ability(id), recast) }\n\t\t\tif (data) {\n\t\t\t\tif (world.checks.events) assertPlainData(data, `Ability \"${id}\" of ${entity.def.id}#${entity.id}: its data`)\n\t\t\t\t// a copy: the game changes its own in place, and what was told before is kept to be told only what changed\n\t\t\t\tinfo.data = structuredClone(data)\n\t\t\t}\n\t\t\tif (!hooked || level < 1) return info\n\t\t\t// what the game's hook decides, where the screen could not work it out from what is declared\n\t\t\tconst ability = world.registry.ability(id)\n\t\t\tconst declared = declaredRefusal(world, entity, ability)\n\t\t\tconst decided = notReady(world, entity, ability)\n\t\t\tif (declared?.key !== decided?.key) info.decided = decided ?? null\n\t\t\treturn info\n\t\t})\n\t}\n\treturn own\n}\n\n/** Whether the abilities a side was told of its unit (`ownEntityState`) are still what it would be told */\nfunction abilitiesStillTold(view: SessionView, entity: Entity, told: AbilityInfo[] | undefined): boolean {\n\tconst { world } = view\n\tif (!entity.abilities.length) return told === undefined\n\tif (!told || told.length !== entity.abilities.length) return false\n\tconst hooked = world.hooks.has('canCast')\n\tfor (let i = 0; i < told.length; i++) {\n\t\tconst info = told[i]\n\t\tconst { id, level, cooldown, charges, refill, autocast, data, recast } = entity.abilities[i]\n\t\tif (info.id !== id || info.level !== level || info.cooldown !== cooldown || info.autocast !== autocast) return false\n\t\tif (charges !== undefined ? info.charges !== charges || info.refill !== refill : info.charges !== undefined) return false\n\t\tif (recast) {\n\t\t\tconst r = info.recast\n\t\t\tif (!r || r.left !== recast.left || r.total !== recast.total || r.count !== recastsLeft(world.registry.ability(id), recast)) return false\n\t\t} else if (info.recast) return false\n\t\tif (data ? !info.data || !same(info.data, data) : info.data) return false\n\t\tif (hooked && level >= 1) {\n\t\t\tconst ability = world.registry.ability(id)\n\t\t\tconst declared = declaredRefusal(world, entity, ability)\n\t\t\tconst decided = notReady(world, entity, ability)\n\t\t\tif (!same(info.decided, declared?.key !== decided?.key ? (decided ?? null) : undefined)) return false\n\t\t} else if (info.decided !== undefined) return false\n\t}\n\treturn true\n}\n\n/** Whether what a side was told of its unit (`ownEntityState`) is still what it would be told: each field against where the builder reads it */\nfunction ownStillTold(view: SessionView, entity: Entity, own: OwnEntityState): boolean {\n\tconst { world } = view\n\tconst first = entity.orders[0]\n\tif (own.orders !== entity.orders.length || own.order !== (first?.type ?? null) || own.hidden !== entity.hidden) return false\n\tif (own.shared !== (commands(view, entity) || undefined)) return false\n\tif (own.build !== (first?.type === 'build' && !orderSays(world, entity, 'building') ? first.init.unitType : undefined)) return false\n\tconst fight = entity.get(fighting)\n\tif (own.passive !== (fight?.passive ?? false) || own.fighting !== !!fight?.autoTarget) return false\n\tconst m = entity.get(moving)\n\tif (m?.status === 'moving') {\n\t\tif (!own.goal || own.goal.x !== m.navGoal.x || own.goal.z !== m.navGoal.z) return false\n\t} else if (own.goal) return false\n\tlet n = 0\n\tlet waypointsHold = true\n\teachWaypoint(view, entity, (point) => {\n\t\tconst way = own.waypoints?.[n++]\n\t\tif (!way || way.x !== point.x || way.z !== point.z) waypointsHold = false\n\t})\n\tif (!waypointsHold || (own.waypoints?.length ?? 0) !== n) return false\n\treturn abilitiesStillTold(view, entity, own.abilities)\n}\n\n/**\n * Whether what was told of a structure's components (`state.components`) is what they hold now: what lets a tree's or\n * a mine's description be said again as it is (`LocalSession.see`). Components told to everyone as they are are\n * compared; one shaped for each player (`snapshot`), or told to some alone, has it described anew. True for what holds\n * none told, which is nearly every tree\n *\n * @internal\n */\nexport function sharedStillTold(entity: Entity, state: EntityState): boolean {\n\tconst told = state.components\n\tlet count = 0\n\tfor (const held of entity.heldComponents()) {\n\t\tif (!held.replicate) continue\n\t\tif (held.replicate !== 'everyone' || held.snapshot) return false\n\t\tconst was = told?.[held.id]\n\t\tif (was === undefined || !same(was, entity.get(held))) return false\n\t\tcount++\n\t}\n\treturn !told || Object.keys(told).length === count\n}\n\n/** Whether two sets of components' parts are the very same objects under the same ids */\nfunction sameParts(a: Record<string, unknown> | undefined, b: Record<string, unknown> | undefined): boolean {\n\tif (a === b) return true\n\tif (!a || !b) return false\n\tfor (const id in a) if (a[id] !== b[id]) return false\n\tfor (const id in b) if (!(id in a)) return false\n\treturn true\n}\n\n/**\n * What one player is told of an entity, on what everyone is (`shared`, `commonEntityState`): an illusion's lifetime on\n * its own side, the components replicated to the player and what they make of themselves for them, and its own part\n * (`own`: its orders, where it goes, its abilities) for one of the player's side. `shared` itself where there is\n * nothing more.\n *\n * With what the player was told last (`before`), each part is last time's object where it still says the same, and\n * the whole is last time's where every part is and `shared` is what it was made on: the very objects tell the screen\n * and the delta that nothing changed\n *\n * @internal\n */\nexport function playerEntityState(view: SessionView, entity: Entity, shared: EntityState, before?: Told): EntityState {\n\tconst { world, player, observer } = view\n\tconst was = before?.state\n\tconst ally = view.isAlly(entity.owner)\n\tlet lifetime: EntityState['lifetime']\n\tif (entity.expires !== null && entity.has(illusion) && ally) {\n\t\tconst kept = was?.lifetime\n\t\tlifetime = kept && kept.left === entity.expires && kept.total === entity.lifetime ? kept : { left: entity.expires, total: entity.lifetime }\n\t}\n\tlet components: Record<string, unknown> | undefined\n\tlet seen: SnapshotView | undefined\n\tfor (const held of entity.heldComponents()) {\n\t\tconst { id } = held\n\t\tconst component = world.registry.component(id)\n\t\tconst audience = component?.replicate\n\t\tif (!audience) continue\n\t\tif (!(audience === 'everyone' || (audience === 'allies' ? ally : entity.owner === player))) continue\n\t\t// what the component makes of it for this player, or a copy: what is sent must not change with the world, nor change it\n\t\tconst value = entity.get(held)\n\t\tconst kept = was?.components?.[id]\n\t\tlet sent: unknown\n\t\tif (component!.snapshot) {\n\t\t\tsent = component!.snapshot(\n\t\t\t\tvalue,\n\t\t\t\tentity,\n\t\t\t\t(seen ??= {\n\t\t\t\t\tworld,\n\t\t\t\t\tplayer: observer ? undefined : player,\n\t\t\t\t\town: entity.owner === player,\n\t\t\t\t\tally,\n\t\t\t\t\tobserver: observer,\n\t\t\t\t\tknows: view.knows,\n\t\t\t\t\tisAlly: view.isAlly,\n\t\t\t\t\tsees: view.sees\n\t\t\t\t})\n\t\t\t)\n\t\t\t// what it made is what it made last time: last time's. As data, not as the component's `same` sees it, which is\n\t\t\t// the wire's coarser judgment (a progress to hundredths): a screen in the page is told what a fresh one would be\n\t\t\tif (sent !== undefined && kept !== undefined && same(kept, sent)) sent = kept\n\t\t} else sent = kept !== undefined && same(kept, value) ? kept : structuredClone(value)\n\t\tif (sent !== undefined) (components ??= {})[id] = sent\n\t}\n\tlet buffTimes: number[] | undefined\n\tlet own: OwnEntityState | undefined\n\tif (ally) {\n\t\tconst shareBuffTimes = world.settings.hud.shareBuffTimes\n\t\tif (shareBuffTimes !== undefined && entity.buffs.length && !shared.buffTimes && ruleOf(world, entity, shareBuffTimes) === 'allies')\n\t\t\tbuffTimes = was?.buffTimes && sameBuffTimes(entity, was.buffTimes) ? was.buffTimes : buffTimesOf(entity)\n\t\town = was?.own && ownStillTold(view, entity, was.own) ? was.own : ownEntityState(view, entity)\n\t}\n\tif (!lifetime && !components && !buffTimes && !own) return shared\n\t// (a part not the player's is `shared`'s own, copied: last time's copy has the same)\n\tif (\n\t\twas &&\n\t\twas !== shared &&\n\t\tbefore!.shared === shared &&\n\t\t(lifetime ?? shared.lifetime) === was.lifetime &&\n\t\t(buffTimes ?? shared.buffTimes) === was.buffTimes &&\n\t\town === was.own &&\n\t\tsameParts(components, was.components)\n\t)\n\t\treturn was\n\tconst state: EntityState = { ...shared }\n\tif (lifetime) state.lifetime = lifetime\n\tif (components) state.components = components\n\tif (buffTimes) state.buffTimes = buffTimes\n\tif (own) state.own = own\n\treturn state\n}\n\n/**\n * Throws when what a player is told of an entity (`state`, kept from before in whole or in part) is not what\n * describing it anew says: a field one of the builders tells and its check forgets. See `debugChecks.snapshots`\n *\n * @internal\n */\nexport function checkTold(view: SessionView, entity: Entity, state: EntityState, name: string | undefined): void {\n\tconst fresh = playerEntityState(view, entity, commonEntityState(view.world, entity, name))\n\tconst keys = new Set([...Object.keys(fresh), ...Object.keys(state)]) as Set<keyof EntityState>\n\tfor (const key of keys) {\n\t\tif (same(fresh[key], state[key])) continue\n\t\tthrow new Error(\n\t\t\t`Stale entity state: ${entity.def.id}#${entity.id} for player ${view.player} says ${key} ${JSON.stringify(state[key])}, should be ${JSON.stringify(fresh[key])}`\n\t\t)\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA+BA,IAAM,UAAa,OAAc,QAAgB,SAChD,OAAO,SAAS,aAAc,KAA6C,OAAO,MAAM,IAAI;;AAG7F,IAAM,cAAc,SAA2C,OAAO,SAAS,KAAK,SAAS,KAAK,CAAC,KAAK,OAAO,KAAK,IAAI,KAAK,WAAW,CAAC,IAAI;;AAG7I,SAAS,YAAY,QAA0B;CAC9C,MAAM,QAAQ,IAAI,MAAc,OAAO,MAAM,MAAM;CACnD,KAAK,IAAI,IAAI,GAAG,IAAI,OAAO,MAAM,QAAQ,KAAK,MAAM,KAAK,WAAW,OAAO,MAAM,EAAE;CACnF,OAAO;AACR;;AAGA,SAAS,cAAc,QAAgB,OAA0B;CAChE,IAAI,MAAM,WA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CACnC,IAAI,WAAW,MAAM,YAAY;CACjC,IAAI,KAAK,MAAM,MAAM;CACrB,OAAO;AACR;;;;;;;AAQA,SAAgB,UAAU,MAAmB,QAAgB,OAAoB,MAAgC;CAChH,MAAM,QAAQ,kBAAkB,MAAM,QAAQ,kBAAkB,KAAK,OAAO,QAAQ,IAAI,CAAC;CACzF,MAAM,uBAAO,IAAI,IAAI,CAAC,GAAG,OAAO,KAAK,KAAK,GAAG,GAAG,OAAO,KAAK,KAAK,CAAC,CAAC;CACnE,KAAK,MAAM,OAAO,MAAM;EACvB,IAAI,KAAK,MAAM,MAAM,MAAM,IAAI,GAAG;EAClC,MAAM,IAAI,MACT,uBAAuB,OAAO,IAAI,GAAG,GAAG,OAAO,GAAG,cAAc,KAAK,OAAO,QAAQ,IAAI,GAAG,KAAK,UAAU,MAAM,IAAI,EAAE,cAAc,KAAK,UAAU,MAAM,IAAI,GAC9J;CACD;AACD"}
|
package/dist/session/local.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { Logger } from '#engine/log';
|
|
2
2
|
import type { MapCamera, MapDoodad, MapEnvironment, MapPath, MapRegion } from '#engine/map';
|
|
3
3
|
import { type Lane } from '#engine/lanes';
|
|
4
|
-
import type { PlayerId } from '#engine/entity';
|
|
4
|
+
import type { EntityId, PlayerId } from '#engine/entity';
|
|
5
5
|
import type { Vec2 } from '#engine/math';
|
|
6
|
+
import { type FormationUnit } from '#engine/formation';
|
|
6
7
|
import type { Registry } from '#engine/registry';
|
|
7
8
|
import type { Terrain } from '#engine/terrain';
|
|
8
9
|
import type { World } from '#engine/world';
|
|
@@ -19,19 +20,33 @@ import { SessionView } from '#engine/replication';
|
|
|
19
20
|
* @beta
|
|
20
21
|
*/
|
|
21
22
|
export declare const COMPUTER_EVENTS: ReadonlySet<SessionEvent['type']>;
|
|
22
|
-
/**
|
|
23
|
+
/**
|
|
24
|
+
* 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
|
|
25
|
+
*
|
|
26
|
+
* @beta
|
|
27
|
+
*/
|
|
23
28
|
export declare class LocalSession implements GameSession {
|
|
24
29
|
/** For tools and tests. Clients have no business here, they go through the session */
|
|
25
30
|
readonly world: World;
|
|
31
|
+
/** The player whose seat this is, from whose side the snapshots are taken */
|
|
26
32
|
readonly playerId: PlayerId;
|
|
33
|
+
/** The ground of the world, for the client to draw and ask about */
|
|
27
34
|
readonly terrain: Terrain;
|
|
35
|
+
/** The map's look (sky, mist, light), when the world was made from a map that has one */
|
|
28
36
|
readonly environment?: MapEnvironment;
|
|
37
|
+
/** The map's scenery objects, which have no life at runtime */
|
|
29
38
|
readonly doodads: readonly MapDoodad[];
|
|
39
|
+
/** The map's named regions */
|
|
30
40
|
readonly regions: readonly MapRegion[];
|
|
41
|
+
/** The map's named camera positions */
|
|
31
42
|
readonly cameras: readonly MapCamera[];
|
|
43
|
+
/** The map's named paths */
|
|
32
44
|
readonly paths: readonly MapPath[];
|
|
45
|
+
/** The definitions of the game the world runs: unit types, abilities, orders and the rest */
|
|
33
46
|
readonly registry: Registry;
|
|
47
|
+
/** Simulation ticks per second of the world */
|
|
34
48
|
readonly tickRate: number;
|
|
49
|
+
/** 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 */
|
|
35
50
|
alpha: number;
|
|
36
51
|
/** What the world says (`World.log`): a session in the page has it, and the client shows it with its own */
|
|
37
52
|
get log(): Logger;
|
|
@@ -52,10 +67,12 @@ export declare class LocalSession implements GameSession {
|
|
|
52
67
|
private readonly namesNow;
|
|
53
68
|
private readonly disposers;
|
|
54
69
|
private pendingCheckpoint?;
|
|
70
|
+
/** The label and save taken at the last tick that a checkpoint was asked for, for the game to be taken back to */
|
|
55
71
|
checkpoint?: {
|
|
56
72
|
label: Message;
|
|
57
73
|
save: WorldSave;
|
|
58
74
|
};
|
|
75
|
+
/** The debug tools over this session's world */
|
|
59
76
|
readonly debug: LocalDebug;
|
|
60
77
|
/** Its pace, saves of its world, the debug tools' view, and what a computer player's brain reads (`SessionCan`) */
|
|
61
78
|
readonly can: SessionCan;
|
|
@@ -73,7 +90,9 @@ export declare class LocalSession implements GameSession {
|
|
|
73
90
|
readonly view: SessionView;
|
|
74
91
|
constructor(
|
|
75
92
|
/** For tools and tests. Clients have no business here, they go through the session */
|
|
76
|
-
world: World,
|
|
93
|
+
world: World,
|
|
94
|
+
/** The player whose seat this is, from whose side the snapshots are taken */
|
|
95
|
+
playerId: PlayerId,
|
|
77
96
|
/**
|
|
78
97
|
* `debug`: the player may use the debug commands (see `world.debugPlayers`). `ownsWorld`: the world is the
|
|
79
98
|
* session's, and goes with it (`dispose`): for a game played in the page, where the session is all the screen
|
|
@@ -103,10 +122,23 @@ export declare class LocalSession implements GameSession {
|
|
|
103
122
|
* the sessions of a world while a host's round of sending is on (`shareCaptures`), else for this session alone
|
|
104
123
|
*/
|
|
105
124
|
private common;
|
|
125
|
+
/**
|
|
126
|
+
* What this player was told of each entity last (`Told`), to be told again while it holds (`tell`): with the entity,
|
|
127
|
+
* gone with it
|
|
128
|
+
*/
|
|
129
|
+
private readonly told;
|
|
106
130
|
/**
|
|
107
131
|
* What this player is told of an entity: what everyone is (`common`, shared between the seats of a host), and on a
|
|
108
132
|
* copy of it what is this player's to know: an illusion's lifetime on its own side, the components replicated to it
|
|
109
|
-
* and what they make of themselves for it, and its own part (`own`) for an ally's
|
|
133
|
+
* and what they make of themselves for it, and its own part (`own`) for an ally's. Last time's objects wherever
|
|
134
|
+
* nothing changed (`playerEntityState`)
|
|
135
|
+
*/
|
|
136
|
+
private tell;
|
|
137
|
+
/** Remembers what the player was told of an entity (`told`) */
|
|
138
|
+
private keep;
|
|
139
|
+
/**
|
|
140
|
+
* What this player is told of an entity (`tell`), once for the seats of a side told the same while a host's round
|
|
141
|
+
* of sending is on (`Round.sides`): the side's object, which this seat remembers as its own, is this seat's too
|
|
110
142
|
*/
|
|
111
143
|
private describe;
|
|
112
144
|
/**
|
|
@@ -152,8 +184,9 @@ export declare class LocalSession implements GameSession {
|
|
|
152
184
|
* described again for them. The side's memory is the first seat's to keep
|
|
153
185
|
*/
|
|
154
186
|
private seeAsSide;
|
|
155
|
-
/** The rest of a snapshot, round its entities: the players, and every feature's part (`
|
|
187
|
+
/** The rest of a snapshot, round its entities: the players, and every feature's part (`SnapshotField`) */
|
|
156
188
|
private finish;
|
|
189
|
+
/** Takes a snapshot of the world as the seat sees it now, without stepping */
|
|
157
190
|
snapshot(): Snapshot;
|
|
158
191
|
/**
|
|
159
192
|
* Moves the game on by `ticks` at the next update, however fast it goes: a step of a paused game (`speed` 0), as
|
|
@@ -183,6 +216,7 @@ export declare class LocalSession implements GameSession {
|
|
|
183
216
|
private ranOn;
|
|
184
217
|
/** 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 */
|
|
185
218
|
private tickOnce;
|
|
219
|
+
/** 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 */
|
|
186
220
|
update(dt: number): Snapshot[];
|
|
187
221
|
/** Sends a command. `seq` is the sender's own number for it, for a host passing on what a remote player numbered */
|
|
188
222
|
send(command: PlayerCommand, seq?: number): number;
|
|
@@ -193,6 +227,7 @@ export declare class LocalSession implements GameSession {
|
|
|
193
227
|
* @beta
|
|
194
228
|
*/
|
|
195
229
|
lastSeq: number;
|
|
230
|
+
/** The seat's team's fog as cells, visible and explored */
|
|
196
231
|
fog(): FogState;
|
|
197
232
|
/** Where the game's money is mined, as the map shows it, seen or not (`GameSession.mines`, `minesFor`) */
|
|
198
233
|
mines(): readonly MineInfo[];
|
|
@@ -200,9 +235,15 @@ export declare class LocalSession implements GameSession {
|
|
|
200
235
|
lanes(): readonly Lane[];
|
|
201
236
|
/** The camps as the player knows them (`GameSession.camps`, `campsFor`): worked out once a tick */
|
|
202
237
|
camps(): readonly CampInfo[];
|
|
238
|
+
/** Whether the player could place a building of this type at the point now, seen as their team sees the ground */
|
|
203
239
|
canPlace(unitType: string, point: Vec2): boolean;
|
|
204
240
|
/** Which cells of a building's ground are in the way for the player: taken, or not explored by their team (`placementCells`) */
|
|
205
241
|
placeCells(unitType: string, point: Vec2): readonly boolean[] | undefined;
|
|
242
|
+
/** Where a group would stand sent to a point in a formation, the rules' own pick when none is named (`GameSession.formationPlaces`) */
|
|
243
|
+
formationPlaces(units: readonly (FormationUnit & {
|
|
244
|
+
readonly flying?: boolean;
|
|
245
|
+
})[], point: Vec2, facing?: number, formation?: string): Map<EntityId, Vec2>;
|
|
246
|
+
/** A path between two points on the ground, or in the air when `flying`; null when there is none */
|
|
206
247
|
findPath(from: Vec2, to: Vec2, flying?: boolean): Vec2[] | null;
|
|
207
248
|
/** What happened since the last snapshot, not yet given in one: a copy, for a computer's save */
|
|
208
249
|
pendingEvents(): SessionEvent[];
|
|
@@ -210,5 +251,6 @@ export declare class LocalSession implements GameSession {
|
|
|
210
251
|
restoreEvents(events: readonly SessionEvent[]): void;
|
|
211
252
|
/** Whether the world goes with the session */
|
|
212
253
|
private readonly ownsWorld;
|
|
254
|
+
/** Stops the session's listeners and debug tools, and the world too when the session owns it */
|
|
213
255
|
dispose(): void;
|
|
214
256
|
}
|