@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,251 @@
|
|
|
1
|
+
//#region src/map/types.ts
|
|
2
|
+
/**
|
|
3
|
+
* What a doodad keeps off a cell, in `Terrain.blocked`: building, walking too, or building on a bridge one walks on
|
|
4
|
+
*
|
|
5
|
+
* @beta
|
|
6
|
+
*/
|
|
7
|
+
var BLOCKS_BUILD = 1;
|
|
8
|
+
/**
|
|
9
|
+
* The `Terrain.blocked` value for a cell where walking and building are both kept off
|
|
10
|
+
*
|
|
11
|
+
* @beta
|
|
12
|
+
*/
|
|
13
|
+
var BLOCKS_WALK = 2;
|
|
14
|
+
/**
|
|
15
|
+
* The `Terrain.blocked` value for a bridge: walked on, nothing built on it
|
|
16
|
+
*
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
var BRIDGE = 3;
|
|
20
|
+
/**
|
|
21
|
+
* The format map files are written in. It goes up when a file of the format before would be read wrongly: a field
|
|
22
|
+
* that changes what it means, or one a reader must not ignore. A step in `MIGRATIONS` then brings older files up to
|
|
23
|
+
* it. A field that is merely new, and can be left out, needs no new format: a reader that does not know it carries
|
|
24
|
+
* it along (`GameMap.extra`, and whatever an object, a player or a camp holds besides what is known)
|
|
25
|
+
*
|
|
26
|
+
* @internal
|
|
27
|
+
*/
|
|
28
|
+
var MAP_FORMAT = 3;
|
|
29
|
+
/**
|
|
30
|
+
* Owner of trees, mines and whatever belongs to nobody
|
|
31
|
+
*
|
|
32
|
+
* @beta
|
|
33
|
+
*/
|
|
34
|
+
var MAP_NEUTRAL = 0;
|
|
35
|
+
/**
|
|
36
|
+
* Owner of the creeps
|
|
37
|
+
*
|
|
38
|
+
* @beta
|
|
39
|
+
*/
|
|
40
|
+
var MAP_CREEPS = 90;
|
|
41
|
+
/**
|
|
42
|
+
* Players a map may have at most, whatever the game: each could be a team of its own, and the fog of war keeps 32
|
|
43
|
+
* teams apart (`MAX_FOG_TEAMS`). How many a game allows is its own (`Rules.maxPlayers`, 8 when it says nothing)
|
|
44
|
+
*
|
|
45
|
+
* @beta
|
|
46
|
+
*/
|
|
47
|
+
var MAX_MAP_PLAYERS = 32;
|
|
48
|
+
/**
|
|
49
|
+
* Players a game allows on a map when it does not say (`Rules.maxPlayers`)
|
|
50
|
+
*
|
|
51
|
+
* @internal
|
|
52
|
+
*/
|
|
53
|
+
var DEFAULT_MAX_PLAYERS = 8;
|
|
54
|
+
/**
|
|
55
|
+
* Highest cliff level
|
|
56
|
+
*
|
|
57
|
+
* @beta
|
|
58
|
+
*/
|
|
59
|
+
var MAX_LEVEL = 4;
|
|
60
|
+
/**
|
|
61
|
+
* Cells a ramp reaches out on either side of where its slope is: long enough to walk up
|
|
62
|
+
*
|
|
63
|
+
* @internal
|
|
64
|
+
*/
|
|
65
|
+
var RAMP_REACH = 3;
|
|
66
|
+
/**
|
|
67
|
+
* The colours players are given by their number, in 0..1; past the end they start again
|
|
68
|
+
*
|
|
69
|
+
* @beta
|
|
70
|
+
*/
|
|
71
|
+
var PLAYER_COLORS = [
|
|
72
|
+
[
|
|
73
|
+
.16,
|
|
74
|
+
.38,
|
|
75
|
+
.95
|
|
76
|
+
],
|
|
77
|
+
[
|
|
78
|
+
.85,
|
|
79
|
+
.14,
|
|
80
|
+
.12
|
|
81
|
+
],
|
|
82
|
+
[
|
|
83
|
+
.1,
|
|
84
|
+
.72,
|
|
85
|
+
.62
|
|
86
|
+
],
|
|
87
|
+
[
|
|
88
|
+
.55,
|
|
89
|
+
.2,
|
|
90
|
+
.8
|
|
91
|
+
],
|
|
92
|
+
[
|
|
93
|
+
.95,
|
|
94
|
+
.85,
|
|
95
|
+
.15
|
|
96
|
+
],
|
|
97
|
+
[
|
|
98
|
+
.95,
|
|
99
|
+
.55,
|
|
100
|
+
.12
|
|
101
|
+
],
|
|
102
|
+
[
|
|
103
|
+
.25,
|
|
104
|
+
.75,
|
|
105
|
+
.2
|
|
106
|
+
],
|
|
107
|
+
[
|
|
108
|
+
.9,
|
|
109
|
+
.45,
|
|
110
|
+
.7
|
|
111
|
+
],
|
|
112
|
+
[
|
|
113
|
+
.58,
|
|
114
|
+
.58,
|
|
115
|
+
.6
|
|
116
|
+
],
|
|
117
|
+
[
|
|
118
|
+
.5,
|
|
119
|
+
.75,
|
|
120
|
+
.95
|
|
121
|
+
],
|
|
122
|
+
[
|
|
123
|
+
.06,
|
|
124
|
+
.38,
|
|
125
|
+
.27
|
|
126
|
+
],
|
|
127
|
+
[
|
|
128
|
+
.45,
|
|
129
|
+
.28,
|
|
130
|
+
.1
|
|
131
|
+
],
|
|
132
|
+
[
|
|
133
|
+
.55,
|
|
134
|
+
.05,
|
|
135
|
+
.12
|
|
136
|
+
],
|
|
137
|
+
[
|
|
138
|
+
.05,
|
|
139
|
+
.08,
|
|
140
|
+
.45
|
|
141
|
+
],
|
|
142
|
+
[
|
|
143
|
+
.25,
|
|
144
|
+
.85,
|
|
145
|
+
.85
|
|
146
|
+
],
|
|
147
|
+
[
|
|
148
|
+
.72,
|
|
149
|
+
.6,
|
|
150
|
+
.95
|
|
151
|
+
],
|
|
152
|
+
[
|
|
153
|
+
.92,
|
|
154
|
+
.82,
|
|
155
|
+
.62
|
|
156
|
+
],
|
|
157
|
+
[
|
|
158
|
+
.98,
|
|
159
|
+
.65,
|
|
160
|
+
.5
|
|
161
|
+
],
|
|
162
|
+
[
|
|
163
|
+
.6,
|
|
164
|
+
.95,
|
|
165
|
+
.65
|
|
166
|
+
],
|
|
167
|
+
[
|
|
168
|
+
.82,
|
|
169
|
+
.78,
|
|
170
|
+
.98
|
|
171
|
+
],
|
|
172
|
+
[
|
|
173
|
+
.18,
|
|
174
|
+
.18,
|
|
175
|
+
.2
|
|
176
|
+
],
|
|
177
|
+
[
|
|
178
|
+
.95,
|
|
179
|
+
.95,
|
|
180
|
+
.95
|
|
181
|
+
],
|
|
182
|
+
[
|
|
183
|
+
.05,
|
|
184
|
+
.6,
|
|
185
|
+
.3
|
|
186
|
+
],
|
|
187
|
+
[
|
|
188
|
+
.6,
|
|
189
|
+
.45,
|
|
190
|
+
.2
|
|
191
|
+
]
|
|
192
|
+
];
|
|
193
|
+
/**
|
|
194
|
+
* Makes the `MapPlayer` for a player's id, with the default name `Player <id>`, its own team and the colour from `PLAYER_COLORS`
|
|
195
|
+
*
|
|
196
|
+
* @beta
|
|
197
|
+
*/
|
|
198
|
+
var playerSlot = (id) => ({
|
|
199
|
+
id,
|
|
200
|
+
name: `Player ${id}`,
|
|
201
|
+
team: id,
|
|
202
|
+
color: PLAYER_COLORS[(id - 1) % PLAYER_COLORS.length]
|
|
203
|
+
});
|
|
204
|
+
/**
|
|
205
|
+
* Flat grass, two players and nothing on it
|
|
206
|
+
*
|
|
207
|
+
* @beta
|
|
208
|
+
*/
|
|
209
|
+
function createMap(options) {
|
|
210
|
+
const { width, depth, height = 1, players = 2 } = options;
|
|
211
|
+
const cells = width * depth;
|
|
212
|
+
return {
|
|
213
|
+
name: options.name ?? "New map",
|
|
214
|
+
description: "",
|
|
215
|
+
...options.game !== void 0 && { game: options.game },
|
|
216
|
+
width,
|
|
217
|
+
depth,
|
|
218
|
+
cliffHeight: 3,
|
|
219
|
+
ground: new Float32Array((width + 1) * (depth + 1)).fill(height),
|
|
220
|
+
levels: new Uint8Array(cells),
|
|
221
|
+
ramps: new Uint8Array(cells),
|
|
222
|
+
water: new Uint8Array(cells),
|
|
223
|
+
tiles: new Uint8Array(cells),
|
|
224
|
+
tileset: [...options.tileset ?? []],
|
|
225
|
+
players: Array.from({ length: players }, (_, i) => playerSlot(i + 1)),
|
|
226
|
+
objects: [],
|
|
227
|
+
camps: [],
|
|
228
|
+
regions: [],
|
|
229
|
+
points: [],
|
|
230
|
+
paths: [],
|
|
231
|
+
doodads: [],
|
|
232
|
+
cameras: [],
|
|
233
|
+
data: {}
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* The smallest a map can be made, each way: the editor's, and the size a map file is read at
|
|
238
|
+
*
|
|
239
|
+
* @internal
|
|
240
|
+
*/
|
|
241
|
+
var MIN_MAP_SIZE = 8;
|
|
242
|
+
/**
|
|
243
|
+
* The largest, the same for the editor and a map file. 512 until a game needs more (S37 is what makes more cost little)
|
|
244
|
+
*
|
|
245
|
+
* @beta
|
|
246
|
+
*/
|
|
247
|
+
var MAX_MAP_SIZE = 512;
|
|
248
|
+
//#endregion
|
|
249
|
+
export { BLOCKS_BUILD, BLOCKS_WALK, BRIDGE, DEFAULT_MAX_PLAYERS, MAP_CREEPS, MAP_FORMAT, MAP_NEUTRAL, MAX_LEVEL, MAX_MAP_PLAYERS, MAX_MAP_SIZE, MIN_MAP_SIZE, PLAYER_COLORS, RAMP_REACH, createMap, playerSlot };
|
|
250
|
+
|
|
251
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../src/map/types.ts"],"sourcesContent":["/*\n * A map's data as the engine reads it: the ground's layers, who plays, what stands on it, its names, and the constants they go by (design review E8a: `map.ts` in parts)\n */\nimport type { GameData } from '../gameData'\nimport type { AreaShape } from '../areas'\nimport type { PlayerId } from '../entity'\nimport type { GeneratedWith } from '../generate'\nimport type { Vec2 } from '../math'\nimport type { MapDoodadLight, MapEnvironment } from './look'\n\n/**\n * A map: the ground and what stands on it when the game begins, as data. The editor makes them, scenes play them.\n *\n * The ground is kept in layers that are edited apart and put together into a `Terrain`: the height of the land,\n * cliff levels, ramps between levels, water and paint. The layers are what a map file stores, the terrain is\n * derived from them whenever one changes.\n *\n * @public\n */\nexport interface GameMap {\n\t/** The map's name, as lists and the editor show it */\n\tname: string\n\t/** A line about the map, for lists of maps */\n\tdescription: string\n\t/**\n\t * The game the map was made for, by the id of its module (`Rules.id`): a world is not made from it for\n\t * another. For any game when left out, like the maps made before maps said\n\t */\n\tgame?: string\n\t/** The map's width in cells */\n\twidth: number\n\t/** The map's depth in cells */\n\tdepth: number\n\t/** How much higher a level stands than the one below */\n\tcliffHeight: number\n\t/** Height of the land per vertex, row by row, before cliffs and water */\n\tground: Float32Array\n\t/** Cliff level per cell */\n\tlevels: Uint8Array\n\t/** 1 where a cell is part of a ramp: the levels around it are joined by a slope instead of a cliff */\n\tramps: Uint8Array\n\t/** `WATER_*` per cell */\n\twater: Uint8Array\n\t/** Paint per cell: 0 for none, otherwise 1 and up into `tileset` */\n\ttiles: Uint8Array\n\t/**\n\t * The game's own layers of cells (`CellLayerDef`), by id: where the bushes are. A value per cell, row by row. Left\n\t * out, or a layer left out, for none\n\t */\n\tcells?: Record<string, Uint8Array>\n\t/**\n\t * What is kept off each cell by hand, as the editor's pathing brush paints it: `BLOCKS_BUILD` (no building there),\n\t * `BLOCKS_WALK` (nothing walks or builds there), 0 for nothing. With what doodads keep off, into `Terrain.blocked`:\n\t * no-build zones, invisible walls. Left out for none. While the game runs, a game blocks the way with obstacles\n\t * (`world.nav.addObstacle`) and keeps buildings off with the `canPlace` hook\n\t */\n\tpathing?: Uint8Array\n\t/**\n\t * The tiles the paint of `tiles` is, by name: index 1 is the first. The game's own list, as the map is opened with\n\t * a game (`adoptTileset`); names the game does not have come after it, kept for the file\n\t */\n\ttileset: string[]\n\t/** The players who can take part. Neutral and the creeps are always there on top of these */\n\tplayers: MapPlayer[]\n\t/** What stands on the map when the game begins: units, buildings, trees, mines */\n\tobjects: MapObject[]\n\t/** The creep camps of the map */\n\tcamps: MapCamp[]\n\t/** Parts of the map the rules watch by name: who walks in and out (see `MapRegion`) */\n\tregions: MapRegion[]\n\t/** Spots the rules know by name: where a wave comes in, where a hero waits (see `MapPoint`) */\n\tpoints: MapPoint[]\n\t/** Lines the rules know by name: a road, a patrol route (see `MapPath`) */\n\tpaths: MapPath[]\n\t/** Scenery, which the rules do not know of but where it blocks (see `MapDoodad`) */\n\tdoodads: MapDoodad[]\n\t/** Views of the map saved under names (see `MapCamera`) */\n\tcameras: MapCamera[]\n\t/** Groups what is placed can be drawn from when the game starts, and tables of what drops (see `MapRandomGroup`) */\n\trandomGroups?: MapRandomGroup[]\n\t/** The tables of what dropped things come from, by name (`MapObject.drops`) */\n\titemTables?: MapItemTable[]\n\t/**\n\t * The map's own definitions (campaign plan RC8), a `data.json` as the game's has it (`GameData`): laid over the\n\t * game's data as a world is made from the map, before its rules are checked. A footman of 200 health on this map\n\t * alone. Its rules hash has them, so a save of it is not one of another map with other definitions\n\t */\n\tdefinitions?: GameData\n\t/** Its teams, named, and what their players share (see `MapForce`). Teams by number only when left out */\n\tforces?: MapForce[]\n\t/** The races a lobby offers its players who have none fixed (`MapPlayer.race`), by id. All of the game's when left out */\n\traces?: string[]\n\t/** Who made it */\n\tauthor?: string\n\t/** The map's checks it does not want, by their rules' ids (`MapProblem.rule`): a desert map with no path to its mines */\n\tsilence?: string[]\n\t/** Who it is for, as lists show it: \"2 players\", \"2 v 2\" */\n\tmeantFor?: string\n\t/**\n\t * Whether the whole map starts explored for everyone, the fog over it all the same: its ground, and what stands on it\n\t * and belongs to no player (trees, mines, neutral buildings), seen from the first moment. Yes or no over the game's\n\t * (`FogSettings.startExplored`); the game's when left out\n\t */\n\texplored?: boolean\n\t/** What the loading screen says while it loads */\n\tloading?: string\n\t/** A picture of it, for lists of maps: a small PNG as a data URL, made from its ground in the editor */\n\tpreview?: string\n\t/** What the map looks like beyond its ground: its water, light, sky (see `MapEnvironment`) */\n\tenvironment?: MapEnvironment\n\t/** The hour the game starts at, and whether it moves (see `MapDay`) */\n\tday?: MapDay\n\t/** How it was made, where a generator made it (`generateMap`): the seed and the options, for the same again or another */\n\tgenerated?: GeneratedWith\n\t/**\n\t * The part of the map play happens in, in cells, when it is not all of it: nothing on foot goes outside it, nothing\n\t * is built there, the camera keeps to it, and the screen darkens what is beyond. Scenery around the edge\n\t */\n\tbounds?: CellRect\n\t/**\n\t * What the game keeps with the map, for its rules to read: a difficulty, the waves of this level. Plain data,\n\t * as in a save. The engine never looks inside\n\t */\n\tdata: Record<string, unknown>\n\t/**\n\t * What the map's editor keeps with it of its own (what is hidden or locked, its groups, its views, the instances of\n\t * prefabs): saved with the map as plain data, read by no game, world or rule, and taken away for play\n\t * (`withoutEditor`). The engine never looks inside: the editor says what it holds\n\t */\n\teditor?: Record<string, unknown>\n\t/**\n\t * What the file held that this reader does not know, as it was: written back when the map is saved, so that a map\n\t * from a newer editor loses nothing by passing through an older one\n\t */\n\textra?: Record<string, unknown>\n}\n\n/**\n * A seat for a player of the map: the player's id, name, team and colour with the options for what they start with\n *\n * @beta\n */\nexport interface MapPlayer {\n\t/** The player's id, the number units and entities are owned by */\n\tid: PlayerId\n\t/** The player's name as lobbies show it */\n\tname: string\n\t/** The player's team number; players of the same number are allies */\n\tteam: number\n\t/** The player's colour as red, green and blue in 0..1 */\n\tcolor: [number, number, number]\n\t/** Where their base goes, for a game that gives everyone a start */\n\tstart?: Vec2\n\t/** Where their view starts, by the name of a camera of the map (`MapCamera`). Over their start when it has one */\n\tcamera?: string\n\t/**\n\t * Who plays them: a person, the computer, or nobody (an open slot left empty). The game's to say when left out: the\n\t * game reads it (`world.map.player(id)`), the engine does nothing with it\n\t */\n\tcontroller?: 'person' | 'computer' | 'nobody'\n\t/** What they start with, by resource id, over what the game gives everyone */\n\tresources?: Record<string, number>\n\t/**\n\t * The race they play, fixed by the map (a campaign's), of the game's races (`Rules.races`), or `random`: not\n\t * chosen in a lobby. Left to the lobby, or the game's first, when left out\n\t */\n\trace?: string\n\t/** What the game's own fields for players were set to (`defineMapField` with `for: 'player'`) */\n\tdata?: Record<string, unknown>\n}\n\n/**\n * A team of a map, with a name, and what its players share: for the game to read (`world.map.forces`)\n *\n * @beta\n */\nexport interface MapForce {\n\t/** The team, as its players have it (`MapPlayer.team`) */\n\tteam: number\n\t/** The team's name, shown in lobbies and for the game to read */\n\tname: string\n\t/** Its players see what each other sees. Teams always do in this engine: kept for the game to read */\n\tsharedVision?: boolean\n\t/** Its players can give orders to each other's units: for the game to read */\n\tsharedControl?: boolean\n}\n\n/**\n * A view of the map saved under a name: what the camera looks at, from how far, which way and how steeply. For\n * cinematics (`cut.camera('gate')`), a player's first view, and code (`client.lookFrom('gate')`). The screen's\n *\n * @beta\n */\nexport interface MapCamera {\n\t/** The editor's, see `MapRegion.id` */\n\tid: number\n\t/** The camera's name, which cinematics and code find it by */\n\tname: string\n\t/** The camera's target on the map's x axis, in cells */\n\tx: number\n\t/** The camera's target on the map's z axis, in cells */\n\tz: number\n\t/** How far the camera is from what it looks at */\n\tdistance: number\n\t/** Radians around the vertical axis, 0 looking north, and between the view and the ground */\n\tyaw: number\n\t/** The angle between the view and the ground, in radians */\n\tpitch: number\n}\n\n/**\n * Something that stands on the map when the game begins: a unit, a building, a tree, a mine\n *\n * @beta\n */\nexport interface MapObject {\n\t/** The object's id on the map, used by the editor */\n\tid: number\n\t/** The id of the unit type placed */\n\ttype: string\n\t/** The player that owns it (`MAP_NEUTRAL` or `MAP_CREEPS` for the neutral and the creeps) */\n\towner: PlayerId\n\t/** Where it stands on the map's x axis, in cells */\n\tx: number\n\t/** Where it stands on the map's z axis, in cells */\n\tz: number\n\t/** The way it faces in radians, the way entities do (0 is along +z) */\n\tfacing: number\n\t/** How big it is drawn */\n\tscale: number\n\t/** Which of the models of its type it is drawn with, for things that come in kinds like trees. Left out: one picked for it */\n\tlook?: string\n\t/**\n\t * The random group it is drawn from when the game starts (`MapRandomGroup`, by name): `type` is what the editor\n\t * shows until then\n\t */\n\trandom?: string\n\t/** The item table it drops from when it dies (`MapItemTable`, by name) */\n\tdrops?: string\n\t/**\n\t * A name of its own, for the rules to find it by (`world.named('gate')`). No two things on a map have the same,\n\t * whatever they are\n\t */\n\tname?: string\n\t/** The health it starts with, as a part of what it can have: 0.5 is half. All of it when left out */\n\thealth?: number\n\t/** The mana it starts with, as a part of what it can have. What its type starts with when left out */\n\tmana?: number\n\t/** For a hero: the level it starts at */\n\tlevel?: number\n\t/** For a hero: what it has learned already, as the level of each ability by id. As far as its level lets it */\n\tabilities?: Record<string, number>\n\t/** The items it carries, by the id of each, as far as it has room */\n\titems?: string[]\n\t/** For a resource: how much there is of it. What its type holds when left out */\n\tamount?: number\n\t/** For a building: it starts as a site that is still to be built */\n\tunderConstruction?: boolean\n\t/** Seconds until it is gone, for what is not there to stay */\n\tlifetime?: number\n\t/**\n\t * What it is doing as the game begins, its own orders and no player's, one after the other (campaign plan MS2): a\n\t * guard walking a patrol route, a caravan on its road. Nothing but what a unit does by itself when left out\n\t */\n\torders?: MapObjectOrder[]\n\t/**\n\t * What the game's own fields were set to, by the id of each (see `defineMapField`). The engine does not look\n\t * inside: the `mapObject` hook hands it to the game\n\t */\n\tdata?: Record<string, unknown>\n}\n\n/**\n * An order a unit of the map is given as the game begins (`MapObject.orders`): to go somewhere (`move`), to walk to\n * and fro fighting what it meets (`patrol`), to stand somewhere and fight what comes near, coming back after\n * (`guard`), to stand its ground (`hold`); to a point, or along a path of the map by its name, bend after bend (a\n * patrol along one walks it back and forth)\n *\n * @beta\n */\nexport interface MapObjectOrder {\n\t/** What the order is: `move` to a point or along a path, `patrol`, `guard` or `hold` */\n\tkind: 'move' | 'patrol' | 'guard' | 'hold'\n\t/** The name of a path of the map it follows, bend after bend */\n\tpath?: string\n\t/** The point it goes to, or guards */\n\tpoint?: Vec2\n}\n\n/**\n * A named part of the map, which becomes an area of the world made from it (`AreaDef`): the rules hear who walks in\n * and out (`enteredArea`, `leftArea`) and ask who is in it (`world.areas`), by its name\n *\n * @beta\n */\nexport interface MapRegion {\n\t/** The editor's, to tell regions apart while one is renamed. The world knows it by its name */\n\tid: number\n\t/** What the rules know it by. No two things on a map have the same, whatever they are */\n\tname: string\n\t/** The shape of the region: a circle or a rectangle (`AreaShape`) */\n\tshape: AreaShape\n\t/** What it is drawn in, in the editor, to tell it from the others. The editor picks one when left out */\n\tcolor?: [number, number, number]\n\t/** What the game's own fields for regions were set to, see `MapObject.data`: the `mapRegion` hook hands it to the game */\n\tdata?: Record<string, unknown>\n\t/**\n\t * A cinematic the region plays (ED4): for everyone, once, the first time a unit of a player walks in, unless the game\n\t * plays it its own way (`play: 'code'`: the region says which, `world.map.regions`, and the game's rules play it)\n\t */\n\tcinematic?: MapRegionCinematic\n}\n\n/**\n * The cinematic a region of the map plays (`MapRegion.cinematic`): which, by its id (`GameView.cinematics.defs`), and who\n * plays it: the engine, as a unit of a player first walks in (`'enter'`, when left out), or the game's own code\n * (`'code'`)\n *\n * @beta\n */\nexport interface MapRegionCinematic {\n\t/** The cinematic, by its id: the game's (`GameView.cinematics.defs`) */\n\tid: string\n\t/** Who plays it: the engine as a unit of a player first walks in (`'enter'`, when left out), or the game's code */\n\tplay?: 'enter' | 'code'\n}\n\n/**\n * A named spot of the map, facing a way: `world.map.point('spawn')`\n *\n * @beta\n */\nexport interface MapPoint {\n\t/** The editor's, see `MapRegion.id` */\n\tid: number\n\t/** What the rules know it by. No two things on a map have the same, whatever they are */\n\tname: string\n\t/** Where it stands on the map's x axis, in cells */\n\tx: number\n\t/** Where it stands on the map's z axis, in cells */\n\tz: number\n\t/** Radians, the way entities face: 0 is along +z */\n\tfacing: number\n\t/** What it is drawn in, in the editor */\n\tcolor?: [number, number, number]\n}\n\n/**\n * Scenery: a model on the map that is no entity of the rules, with no health, owner or place in a snapshot. A rock, a\n * fence, a ruined arch, free to lean, float and stretch. What it keeps off the cells under it (`blocks`) the terrain\n * has, for the paths of units and for building\n *\n * @beta\n */\nexport interface MapDoodad {\n\t/** The editor's, see `MapRegion.id` */\n\tid: number\n\t/** The model, by its path in `models/`: the map's own, the game's, or a shared one */\n\tmodel: string\n\t/** Where it stands on the map's x axis, in cells */\n\tx: number\n\t/** Where it stands on the map's z axis, in cells */\n\tz: number\n\t/** How high above the ground under it */\n\ty?: number\n\t/** Radians: which way it faces, the way entities do (0 is along +z), then how far it leans forward and to the side */\n\tyaw: number\n\t/** How far it leans forward in radians; 0 when left out */\n\tpitch?: number\n\t/** How far it leans to the side in radians; 0 when left out */\n\troll?: number\n\t/** How much bigger or smaller it is drawn than it was made, across, up and deep */\n\tscale: [number, number, number]\n\t/** A colour it is drawn in, over its own */\n\ttint?: [number, number, number]\n\t/** What code knows it by (`client.doodads.named`). Doodads are the screen's: the rules never see them */\n\tname?: string\n\t/** What it keeps off the cells within `radius` of its middle: building there, or walking and building. Nothing when left out */\n\tblocks?: 'build' | 'walk'\n\t/**\n\t * A bridge: walked on, over deep water too, at its height (`y`) above the water. Nothing is built on it. Within\n\t * `radius` of its middle\n\t */\n\tbridge?: boolean\n\t/**\n\t * A gate: it keeps walking off the cells within `radius` while it is shut, and the rules open and shut it by its\n\t * name while the game runs (`setGate`). Shut when the game starts, unless `open`\n\t */\n\tgate?: boolean\n\t/** Whether the gate starts open; shut when left out */\n\topen?: boolean\n\t/** How far around its middle it blocks, in cells */\n\tradius?: number\n\t/**\n\t * A clip of its model it plays over and over (a windmill's sails, a flag, a chest held open), by its name: none when\n\t * left out, or as the game says of its model (`SceneryDef.animation`). It is drawn on its own while it plays\n\t */\n\tanimation?: string\n\t/**\n\t * Merged with the scenery near it, to be drawn in one go (`DoodadView`): yes when left out, as far as its model can be.\n\t * No keeps it a copy of its model's mesh: for a game's code that reaches for it\n\t */\n\tbatch?: boolean\n\t/**\n\t * This one's lights otherwise than its model's (`GameView.ground.scenery`): put out (`on: false`), another colour, brighter,\n\t * further. Laid over every light its model gives\n\t */\n\tlight?: MapDoodadLight\n\t/**\n\t * How this one is drawn by distance, over its model's (`MapDetail`): pinned to a level by its index (`level`: 0 always at\n\t * full), or levels of its own. As its model when left out\n\t */\n\tdetail?: MapDoodadDetail\n}\n\n/**\n * One way a thing is drawn, and when, as a map says it (`MapDetail.models`, `MapDoodad.detail`): the client's\n * `DetailLevel` without what only code can say. A level applies when any of its conditions holds; of a thing's levels the\n * last that applies is drawn, the first being its full self\n *\n * @beta\n */\nexport interface MapDetailLevel {\n\t/** What is drawn: a picture of the model (`impostor`), or nothing (`none`). The model, or `model`, when left out */\n\tdraw?: 'impostor' | 'none'\n\t/** Another model, by its path in `models/`, in place of the thing's own */\n\tmodel?: string\n\t/** Or a lighter version of the full model made from it: this part of its triangles (0.25) */\n\tratio?: number\n\t/** From this far from the camera, in cells */\n\tfrom?: number\n\t/** Or: once the thing is at most this tall on the screen, in pixels */\n\tunder?: number\n\t/** Or: while the camera is over a region of the map, by its name; or not over it (`!name`) */\n\tregion?: string\n\t/**\n\t * How its file is loaded: with the model (`eager`), once something comes near wanting it (`lazy`, when left out: within\n\t * half again its distance), by code alone (`never`), or as the camera comes over a region of the map, by its name\n\t */\n\tload?: 'eager' | 'lazy' | 'never' | { region: string }\n\t/**\n\t * The level its shadow is drawn at, by index: a lighter one is cheaper, and nobody sees a leaf's shadow. One of nothing\n\t * casts none. As the shadows' bias says when left out (`MapDetail.shadowBias`), else the level it is drawn at\n\t */\n\tshadow?: number\n}\n\n/**\n * How one doodad is drawn by distance (`MapDoodad.detail`)\n *\n * @beta\n */\nexport interface MapDoodadDetail {\n\t/** Always at this level, by its index: 0 at full */\n\tlevel?: number\n\t/** Its own levels, over its model's */\n\tlevels?: MapDetailLevel[]\n}\n\n/**\n * How much detail things are drawn with by their distance on a map (`MapEnvironment.detail`), over the game's\n * (`GameView.world.detail`): a forest map drawn lighter. The screen's: the rules never see it\n *\n * @beta\n */\nexport interface MapDetail {\n\t/** Every distance a level starts from, times this: under 1 lighter sooner, over 1 later. The game's when left out */\n\tscale?: number\n\t/** Past this far from the camera, in cells, no scenery, tree or mine is drawn at all, nor casts a shadow. None when left out */\n\tcull?: number\n\t/**\n\t * How many cells past the edges of the view what is there is drawn already, so that it is ready (its pictures, its\n\t * shaders, its scenery merged) before the camera brings it in: no trees coming in as the view moves, for a little more\n\t * drawn off the screen. The game's when left out\n\t */\n\tpreload?: number\n\t/**\n\t * How many levels coarser than it is drawn at a thing casts its shadow, where its level does not say (`shadow`): 1\n\t * draws a tree's shadow at its next lighter level. The game's when left out\n\t */\n\tshadowBias?: number\n\t/** The levels of every model that has none said of it, over the game's (`GameView.world.detail.levels`) */\n\tlevels?: MapDetailLevel[]\n\t/** A model's levels, by its path in `models/`, over its own and the game's */\n\tmodels?: Record<string, MapDetailLevel[]>\n}\n\n/**\n * A group a placed thing is drawn from when the game starts (random groups, as classic map editors have them): one of these types by\n * weight, or any creep of a level (\"a level 3 creep\")\n *\n * @beta\n */\nexport interface MapRandomGroup {\n\t/** The group's name, which `MapObject.random` names it by */\n\tname: string\n\t/** One of these, more likely by its weight */\n\tchoices?: { type: string; weight: number }[]\n\t/** Or any unit type with a bounty, of this level */\n\tlevel?: number\n}\n\n/**\n * What something drops when it dies (item tables, as classic map editors have them): one item by weight, or none\n *\n * @beta\n */\nexport interface MapItemTable {\n\t/** The table's name, which `MapObject.drops` names it by */\n\tname: string\n\t/** The lines of the table, one of which is picked by weight */\n\titems: MapItemTableEntry[]\n\t/** How likely it is to drop anything, 0..1. Always when left out */\n\tchance?: number\n}\n\n/**\n * A line of an item table (`MapItemTable.items`): an item by id, or any item of a level, a class, or both (campaign\n * plan GP3: `{ level: 3, weight: 2 }`), its weight shared among those of the game that match\n *\n * @beta\n */\nexport interface MapItemTableEntry {\n\t/** The item's id, for a line that names one */\n\titem?: string\n\t/** The level of item it stands for, for a line that does not name one */\n\tlevel?: number\n\t/** The class of item it stands for, for a line that does not name one */\n\tclass?: string\n\t/** How likely this line is among the table's, relative to the others' weights */\n\tweight: number\n}\n\n/**\n * What a doodad keeps off a cell, in `Terrain.blocked`: building, walking too, or building on a bridge one walks on\n *\n * @beta\n */\nexport const BLOCKS_BUILD = 1\n/**\n * The `Terrain.blocked` value for a cell where walking and building are both kept off\n *\n * @beta\n */\nexport const BLOCKS_WALK = 2\n/**\n * The `Terrain.blocked` value for a bridge: walked on, nothing built on it\n *\n * @internal\n */\nexport const BRIDGE = 3\n\n/**\n * A named line of the map, through points in order, with a width: `world.map.path('road')` (see `Path`)\n *\n * @beta\n */\nexport interface MapPath {\n\t/** The editor's, see `MapRegion.id` */\n\tid: number\n\t/** What the rules know it by. No two things on a map have the same, whatever they are */\n\tname: string\n\t/** The points of the path in order, in cells */\n\tpoints: Vec2[]\n\t/** How wide it is, in cells: what it paints and keeps clear, and what `Path.contains` says is on it */\n\twidth: number\n\t/** A tile of the game's, by id, that the ground under it is painted with, over the map's own paint */\n\tpaint?: string\n\t/** Nothing may be built on it: a road the invaders need to get through */\n\tkeepClear?: boolean\n\t/** What it is drawn in, in the editor */\n\tcolor?: [number, number, number]\n\t/**\n\t * A road's or a river's bed under it, carved in the ground and painted each time the terrain is worked out (the\n\t * map's own heights stay as they are, so the bed follows the path wherever its points go): `PathProfile`\n\t */\n\tprofile?: PathProfile\n}\n\n/**\n * The bed a path carves, as a road or a river: its middle as smooth along it as a road is (the land along it averaged\n * over four cells each way), lowered by `depth`, level across `width`, eased into the land over `banks` cells each\n * side; painted with `ground`, and with water in it for a river\n *\n * @beta\n */\nexport interface PathProfile {\n\t/** How wide the bed is, in cells: the path's own width when left out */\n\twidth?: number\n\t/** How far below the land along it the bed is (0, a road; a river's bed with its water), in the heights' units */\n\tdepth?: number\n\t/** A tile of the game's the bed is painted with, by id (over the path's `paint`) */\n\tground?: string\n\t/** Over how many cells each side the bed is eased into the land: 2 when left out */\n\tbanks?: number\n\t/** Water in the bed: deep where `depth` is 1 or more, else shallow (a river, a ford) */\n\twater?: boolean\n}\n\n/**\n * The time of day of a map, in a game with days (`Rules.day`). The rules': what is done at night is done by it\n *\n * @beta\n */\nexport interface MapDay {\n\t/** The hour the game starts at. The game's when left out */\n\tstart?: number\n\t/** The hour stays where it starts: always night, always noon */\n\tstill?: boolean\n}\n\n/**\n * Creeps that guard a spot\n *\n * @beta\n */\nexport interface MapCamp {\n\t/** The map's id for the camp, used by the editor */\n\tid: number\n\t/** Where the camp stands on the map's x axis, in cells */\n\tx: number\n\t/** Where the camp stands on the map's z axis, in cells */\n\tz: number\n\t/** Unit types, the first one stands in the middle */\n\tunits: string[]\n\t/** A name of its own, for the rules to find it by (`campNamed(world, 'ogres')`), see `MapObject.name` */\n\tname?: string\n\t/** What the game's own fields for camps were set to, see `MapObject.data`: the `mapCamp` hook hands it to the game */\n\tdata?: Record<string, unknown>\n\t/** Seconds after it is cleared that it comes back (see `Camp.respawn`). The game's rule when left out */\n\trespawn?: number\n}\n\n/**\n * The format map files are written in. It goes up when a file of the format before would be read wrongly: a field\n * that changes what it means, or one a reader must not ignore. A step in `MIGRATIONS` then brings older files up to\n * it. A field that is merely new, and can be left out, needs no new format: a reader that does not know it carries\n * it along (`GameMap.extra`, and whatever an object, a player or a camp holds besides what is known)\n *\n * @internal\n */\nexport const MAP_FORMAT = 3\n/**\n * Owner of trees, mines and whatever belongs to nobody\n *\n * @beta\n */\nexport const MAP_NEUTRAL: PlayerId = 0\n/**\n * Owner of the creeps\n *\n * @beta\n */\nexport const MAP_CREEPS: PlayerId = 90\n/**\n * Players a map may have at most, whatever the game: each could be a team of its own, and the fog of war keeps 32\n * teams apart (`MAX_FOG_TEAMS`). How many a game allows is its own (`Rules.maxPlayers`, 8 when it says nothing)\n *\n * @beta\n */\nexport const MAX_MAP_PLAYERS = 32\n/**\n * Players a game allows on a map when it does not say (`Rules.maxPlayers`)\n *\n * @internal\n */\nexport const DEFAULT_MAX_PLAYERS = 8\n/**\n * Highest cliff level\n *\n * @beta\n */\nexport const MAX_LEVEL = 4\n/**\n * Cells a ramp reaches out on either side of where its slope is: long enough to walk up\n *\n * @internal\n */\nexport const RAMP_REACH = 3\n\n/**\n * The colours players are given by their number, in 0..1; past the end they start again\n *\n * @beta\n */\nexport const PLAYER_COLORS: [number, number, number][] = [\n\t[0.16, 0.38, 0.95],\n\t[0.85, 0.14, 0.12],\n\t[0.1, 0.72, 0.62],\n\t[0.55, 0.2, 0.8],\n\t[0.95, 0.85, 0.15],\n\t[0.95, 0.55, 0.12],\n\t[0.25, 0.75, 0.2],\n\t[0.9, 0.45, 0.7],\n\t// past eight, as the classic twenty-four go on: each told apart from the eight and from each other\n\t[0.58, 0.58, 0.6],\n\t[0.5, 0.75, 0.95],\n\t[0.06, 0.38, 0.27],\n\t[0.45, 0.28, 0.1],\n\t[0.55, 0.05, 0.12],\n\t[0.05, 0.08, 0.45],\n\t[0.25, 0.85, 0.85],\n\t[0.72, 0.6, 0.95],\n\t[0.92, 0.82, 0.62],\n\t[0.98, 0.65, 0.5],\n\t[0.6, 0.95, 0.65],\n\t[0.82, 0.78, 0.98],\n\t[0.18, 0.18, 0.2],\n\t[0.95, 0.95, 0.95],\n\t[0.05, 0.6, 0.3],\n\t[0.6, 0.45, 0.2]\n]\n\n/**\n * Makes the `MapPlayer` for a player's id, with the default name `Player <id>`, its own team and the colour from `PLAYER_COLORS`\n *\n * @beta\n */\nexport const playerSlot = (id: number): MapPlayer => ({ id, name: `Player ${id}`, team: id, color: PLAYER_COLORS[(id - 1) % PLAYER_COLORS.length] })\n\n/**\n * The options `createMap` makes a map with\n *\n * @beta\n */\nexport interface NewMapOptions {\n\t/** The map's name: `New map` when left out */\n\tname?: string\n\t/** The map's width in cells */\n\twidth: number\n\t/** The map's depth in cells */\n\tdepth: number\n\t/** Height of the land everywhere */\n\theight?: number\n\t/** How many player slots the map has: 2 when left out */\n\tplayers?: number\n\t/** The game it is for, see `GameMap.game` */\n\tgame?: string\n\t/** The tiles it can be painted with, by name: the game's (`registry.tiles`). None when left out */\n\ttileset?: string[]\n}\n\n/**\n * Flat grass, two players and nothing on it\n *\n * @beta\n */\nexport function createMap(options: NewMapOptions): GameMap {\n\tconst { width, depth, height = 1, players = 2 } = options\n\tconst cells = width * depth\n\treturn {\n\t\tname: options.name ?? 'New map',\n\t\tdescription: '',\n\t\t...(options.game !== undefined && { game: options.game }),\n\t\twidth,\n\t\tdepth,\n\t\tcliffHeight: 3,\n\t\tground: new Float32Array((width + 1) * (depth + 1)).fill(height),\n\t\tlevels: new Uint8Array(cells),\n\t\tramps: new Uint8Array(cells),\n\t\twater: new Uint8Array(cells),\n\t\ttiles: new Uint8Array(cells),\n\t\ttileset: [...(options.tileset ?? [])],\n\t\tplayers: Array.from({ length: players }, (_, i) => playerSlot(i + 1)),\n\t\tobjects: [],\n\t\tcamps: [],\n\t\tregions: [],\n\t\tpoints: [],\n\t\tpaths: [],\n\t\tdoodads: [],\n\t\tcameras: [],\n\t\tdata: {}\n\t}\n}\n\n/**\n * A rectangle of a map, in cells\n *\n * @beta\n */\nexport interface CellRect {\n\t/** The rectangle's first cell on the x axis */\n\tx: number\n\t/** The rectangle's first cell on the z axis */\n\tz: number\n\t/** How many cells across it is */\n\twidth: number\n\t/** How many cells down it is */\n\tdepth: number\n}\n\n/**\n * The smallest a map can be made, each way: the editor's, and the size a map file is read at\n *\n * @internal\n */\nexport const MIN_MAP_SIZE = 8\n/**\n * The largest, the same for the editor and a map file. 512 until a game needs more (S37 is what makes more cost little)\n *\n * @beta\n */\nexport const MAX_MAP_SIZE = 512\n"],"mappings":";;;;;;AA0hBA,IAAa,eAAe;;;;;;AAM5B,IAAa,cAAc;;;;;;AAM3B,IAAa,SAAS;;;;;;;;;AA2FtB,IAAa,aAAa;;;;;;AAM1B,IAAa,cAAwB;;;;;;AAMrC,IAAa,aAAuB;;;;;;;AAOpC,IAAa,kBAAkB;;;;;;AAM/B,IAAa,sBAAsB;;;;;;AAMnC,IAAa,YAAY;;;;;;AAMzB,IAAa,aAAa;;;;;;AAO1B,IAAa,gBAA4C;CACxD;EAAC;EAAM;EAAM;CAAI;CACjB;EAAC;EAAM;EAAM;CAAI;CACjB;EAAC;EAAK;EAAM;CAAI;CAChB;EAAC;EAAM;EAAK;CAAG;CACf;EAAC;EAAM;EAAM;CAAI;CACjB;EAAC;EAAM;EAAM;CAAI;CACjB;EAAC;EAAM;EAAM;CAAG;CAChB;EAAC;EAAK;EAAM;CAAG;CAEf;EAAC;EAAM;EAAM;CAAG;CAChB;EAAC;EAAK;EAAM;CAAI;CAChB;EAAC;EAAM;EAAM;CAAI;CACjB;EAAC;EAAM;EAAM;CAAG;CAChB;EAAC;EAAM;EAAM;CAAI;CACjB;EAAC;EAAM;EAAM;CAAI;CACjB;EAAC;EAAM;EAAM;CAAI;CACjB;EAAC;EAAM;EAAK;CAAI;CAChB;EAAC;EAAM;EAAM;CAAI;CACjB;EAAC;EAAM;EAAM;CAAG;CAChB;EAAC;EAAK;EAAM;CAAI;CAChB;EAAC;EAAM;EAAM;CAAI;CACjB;EAAC;EAAM;EAAM;CAAG;CAChB;EAAC;EAAM;EAAM;CAAI;CACjB;EAAC;EAAM;EAAK;CAAG;CACf;EAAC;EAAK;EAAM;CAAG;AAChB;;;;;;AAOA,IAAa,cAAc,QAA2B;CAAE;CAAI,MAAM,UAAU;CAAM,MAAM;CAAI,OAAO,eAAe,KAAK,KAAK,cAAc;AAAQ;;;;;;AA6BlJ,SAAgB,UAAU,SAAiC;CAC1D,MAAM,EAAE,OAAO,OAAO,SAAS,GAAG,UAAU,MAAM;CAClD,MAAM,QAAQ,QAAQ;CACtB,OAAO;EACN,MAAM,QAAQ,QAAQ;EACtB,aAAa;EACb,GAAI,QAAQ,SAAS,KAAA,KAAa,EAAE,MAAM,QAAQ,KAAK;EACvD;EACA;EACA,aAAa;EACb,QAAQ,IAAI,cAAc,QAAQ,MAAM,QAAQ,EAAE,CAAC,CAAC,KAAK,MAAM;EAC/D,QAAQ,IAAI,WAAW,KAAK;EAC5B,OAAO,IAAI,WAAW,KAAK;EAC3B,OAAO,IAAI,WAAW,KAAK;EAC3B,OAAO,IAAI,WAAW,KAAK;EAC3B,SAAS,CAAC,GAAI,QAAQ,WAAW,CAAC,CAAE;EACpC,SAAS,MAAM,KAAK,EAAE,QAAQ,QAAQ,IAAI,GAAG,MAAM,WAAW,IAAI,CAAC,CAAC;EACpE,SAAS,CAAC;EACV,OAAO,CAAC;EACR,SAAS,CAAC;EACV,QAAQ,CAAC;EACT,OAAO,CAAC;EACR,SAAS,CAAC;EACV,SAAS,CAAC;EACV,MAAM,CAAC;CACR;AACD;;;;;;AAuBA,IAAa,eAAe;;;;;;AAM5B,IAAa,eAAe"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { footprintOf } from "../defs.js";
|
|
2
|
+
import "../map/types.js";
|
|
3
|
+
import { footprintCell } from "../grid.js";
|
|
4
|
+
import "../terrain.js";
|
|
5
|
+
import { mapTerrain } from "../map/terrain.js";
|
|
6
|
+
//#region src/mapCheck/cells.ts
|
|
7
|
+
/** The steepest ground something on foot walks, in radians: as the navigation mesh has it */
|
|
8
|
+
var WALKABLE_SLOPE = 38 * Math.PI / 180;
|
|
9
|
+
/**
|
|
10
|
+
* Which cells of a map something on foot can stand on (1) and which have a building or a mine on them (`built`): for
|
|
11
|
+
* the checks, and for what the editor shows of where one can walk and build. `steep` counts slopes too steep to walk
|
|
12
|
+
*
|
|
13
|
+
* @beta
|
|
14
|
+
*/
|
|
15
|
+
function mapCells(map, registry, terrain = mapTerrain(map), steep = false) {
|
|
16
|
+
const { width, depth } = map;
|
|
17
|
+
const open = new Uint8Array(width * depth);
|
|
18
|
+
const built = new Uint8Array(width * depth);
|
|
19
|
+
for (let c = 0; c < open.length; c++) {
|
|
20
|
+
const x = c % width;
|
|
21
|
+
const z = (c - x) / width;
|
|
22
|
+
open[c] = (terrain.water[c] !== 2 || terrain.blocked[c] === 3) && terrain.blocked[c] !== 2 && terrain.inPlay(x, z) && (!steep || terrain.slopeAt(x + .5, z + .5) <= WALKABLE_SLOPE) ? 1 : 0;
|
|
23
|
+
}
|
|
24
|
+
for (const object of map.objects) {
|
|
25
|
+
if (!registry.units.has(object.type)) continue;
|
|
26
|
+
const def = registry.unit(object.type);
|
|
27
|
+
if (def.kind === "unit") continue;
|
|
28
|
+
const { w, d } = footprintOf(def);
|
|
29
|
+
const corner = footprintCell(object.x, object.z, w, d);
|
|
30
|
+
for (let z = corner.z; z < corner.z + d; z++) for (let x = corner.x; x < corner.x + w; x++) {
|
|
31
|
+
if (x < 0 || z < 0 || x >= width || z >= depth) continue;
|
|
32
|
+
open[z * width + x] = 0;
|
|
33
|
+
built[z * width + x] = 1;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
open,
|
|
38
|
+
built
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/** Cells something on foot can stand on, and which of them it can get to from which: a number per cell, 0 for none */
|
|
42
|
+
function walkingAreas(map, registry) {
|
|
43
|
+
const { width, depth, levels, ramps } = map;
|
|
44
|
+
const { open } = mapCells(map, registry);
|
|
45
|
+
const passable = (a, b) => levels[a] === levels[b] || ramps[a] > 0 || ramps[b] > 0;
|
|
46
|
+
const area = new Int32Array(width * depth);
|
|
47
|
+
let next = 0;
|
|
48
|
+
const queue = new Int32Array(width * depth);
|
|
49
|
+
for (let start = 0; start < area.length; start++) {
|
|
50
|
+
if (!open[start] || area[start]) continue;
|
|
51
|
+
next++;
|
|
52
|
+
let head = 0;
|
|
53
|
+
let tail = 0;
|
|
54
|
+
queue[tail++] = start;
|
|
55
|
+
area[start] = next;
|
|
56
|
+
while (head < tail) {
|
|
57
|
+
const c = queue[head++];
|
|
58
|
+
const x = c % width;
|
|
59
|
+
const z = (c - x) / width;
|
|
60
|
+
for (const [nx, nz] of [
|
|
61
|
+
[x - 1, z],
|
|
62
|
+
[x + 1, z],
|
|
63
|
+
[x, z - 1],
|
|
64
|
+
[x, z + 1]
|
|
65
|
+
]) {
|
|
66
|
+
if (nx < 0 || nz < 0 || nx >= width || nz >= depth) continue;
|
|
67
|
+
const n = nz * width + nx;
|
|
68
|
+
if (!open[n] || area[n] || !passable(c, n)) continue;
|
|
69
|
+
area[n] = next;
|
|
70
|
+
queue[tail++] = n;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
/** The area a point is in, or the one next to it, for what stands on cells nothing walks on: a mine, a town hall */
|
|
75
|
+
const at = (point) => {
|
|
76
|
+
const cx = Math.floor(point.x);
|
|
77
|
+
const cz = Math.floor(point.z);
|
|
78
|
+
for (let r = 0; r <= 4; r++) for (let z = cz - r; z <= cz + r; z++) for (let x = cx - r; x <= cx + r; x++) {
|
|
79
|
+
if (x < 0 || z < 0 || x >= width || z >= depth) continue;
|
|
80
|
+
if (Math.max(Math.abs(x - cx), Math.abs(z - cz)) !== r) continue;
|
|
81
|
+
const found = area[z * width + x];
|
|
82
|
+
if (found) return found;
|
|
83
|
+
}
|
|
84
|
+
return 0;
|
|
85
|
+
};
|
|
86
|
+
return {
|
|
87
|
+
area,
|
|
88
|
+
at
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
//#endregion
|
|
92
|
+
export { mapCells, walkingAreas };
|
|
93
|
+
|
|
94
|
+
//# sourceMappingURL=cells.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cells.js","names":[],"sources":["../../src/mapCheck/cells.ts"],"sourcesContent":["/*\n * Where something on foot can stand on a map, and which of it can get to which: what the checks of walking go by, and\n * what the editor shows (design review E8b)\n */\nimport { footprintOf } from '../defs'\nimport { footprintCell } from '../grid'\nimport { BLOCKS_WALK, BRIDGE, type GameMap, mapTerrain } from '../map'\nimport type { Vec2 } from '../math'\nimport type { Registry } from '../registry'\nimport { type Terrain, WATER_DEEP } from '../terrain'\n\n/** The steepest ground something on foot walks, in radians: as the navigation mesh has it */\nconst WALKABLE_SLOPE = (38 * Math.PI) / 180\n\n/**\n * Which cells of a map something on foot can stand on (1) and which have a building or a mine on them (`built`): for\n * the checks, and for what the editor shows of where one can walk and build. `steep` counts slopes too steep to walk\n *\n * @beta\n */\nexport function mapCells(\n\tmap: GameMap,\n\tregistry: Registry,\n\tterrain: Terrain = mapTerrain(map),\n\tsteep = false\n): { open: Uint8Array; built: Uint8Array } {\n\tconst { width, depth } = map\n\tconst open = new Uint8Array(width * depth)\n\tconst built = new Uint8Array(width * depth)\n\tfor (let c = 0; c < open.length; c++) {\n\t\tconst x = c % width\n\t\tconst z = (c - x) / width\n\t\topen[c] =\n\t\t\t(terrain.water[c] !== WATER_DEEP || terrain.blocked[c] === BRIDGE) &&\n\t\t\tterrain.blocked[c] !== BLOCKS_WALK &&\n\t\t\tterrain.inPlay(x, z) &&\n\t\t\t(!steep || terrain.slopeAt(x + 0.5, z + 0.5) <= WALKABLE_SLOPE)\n\t\t\t\t? 1\n\t\t\t\t: 0\n\t}\n\t// what is built stands in the way\n\tfor (const object of map.objects) {\n\t\tif (!registry.units.has(object.type)) continue\n\t\tconst def = registry.unit(object.type)\n\t\tif (def.kind === 'unit') continue\n\t\tconst { w, d } = footprintOf(def)\n\t\tconst corner = footprintCell(object.x, object.z, w, d)\n\t\tfor (let z = corner.z; z < corner.z + d; z++) {\n\t\t\tfor (let x = corner.x; x < corner.x + w; x++) {\n\t\t\t\tif (x < 0 || z < 0 || x >= width || z >= depth) continue\n\t\t\t\topen[z * width + x] = 0\n\t\t\t\tbuilt[z * width + x] = 1\n\t\t\t}\n\t\t}\n\t}\n\treturn { open, built }\n}\n\n/** Cells something on foot can stand on, and which of them it can get to from which: a number per cell, 0 for none */\nexport function walkingAreas(map: GameMap, registry: Registry): { area: Int32Array; at: (point: Vec2) => number } {\n\tconst { width, depth, levels, ramps } = map\n\tconst { open } = mapCells(map, registry)\n\t// a step between two levels is a cliff, unless one side is a ramp\n\tconst passable = (a: number, b: number) => levels[a] === levels[b] || ramps[a] > 0 || ramps[b] > 0\n\tconst area = new Int32Array(width * depth)\n\tlet next = 0\n\tconst queue = new Int32Array(width * depth)\n\tfor (let start = 0; start < area.length; start++) {\n\t\tif (!open[start] || area[start]) continue\n\t\tnext++\n\t\tlet head = 0\n\t\tlet tail = 0\n\t\tqueue[tail++] = start\n\t\tarea[start] = next\n\t\twhile (head < tail) {\n\t\t\tconst c = queue[head++]\n\t\t\tconst x = c % width\n\t\t\tconst z = (c - x) / width\n\t\t\tfor (const [nx, nz] of [\n\t\t\t\t[x - 1, z],\n\t\t\t\t[x + 1, z],\n\t\t\t\t[x, z - 1],\n\t\t\t\t[x, z + 1]\n\t\t\t]) {\n\t\t\t\tif (nx < 0 || nz < 0 || nx >= width || nz >= depth) continue\n\t\t\t\tconst n = nz * width + nx\n\t\t\t\tif (!open[n] || area[n] || !passable(c, n)) continue\n\t\t\t\tarea[n] = next\n\t\t\t\tqueue[tail++] = n\n\t\t\t}\n\t\t}\n\t}\n\t/** The area a point is in, or the one next to it, for what stands on cells nothing walks on: a mine, a town hall */\n\tconst at = (point: Vec2) => {\n\t\tconst cx = Math.floor(point.x)\n\t\tconst cz = Math.floor(point.z)\n\t\tfor (let r = 0; r <= 4; r++) {\n\t\t\tfor (let z = cz - r; z <= cz + r; z++) {\n\t\t\t\tfor (let x = cx - r; x <= cx + r; x++) {\n\t\t\t\t\tif (x < 0 || z < 0 || x >= width || z >= depth) continue\n\t\t\t\t\tif (Math.max(Math.abs(x - cx), Math.abs(z - cz)) !== r) continue\n\t\t\t\t\tconst found = area[z * width + x]\n\t\t\t\t\tif (found) return found\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn 0\n\t}\n\treturn { area, at }\n}\n"],"mappings":";;;;;;;AAYA,IAAM,iBAAkB,KAAK,KAAK,KAAM;;;;;;;AAQxC,SAAgB,SACf,KACA,UACA,UAAmB,WAAW,GAAG,GACjC,QAAQ,OACkC;CAC1C,MAAM,EAAE,OAAO,UAAU;CACzB,MAAM,OAAO,IAAI,WAAW,QAAQ,KAAK;CACzC,MAAM,QAAQ,IAAI,WAAW,QAAQ,KAAK;CAC1C,KAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;EACrC,MAAM,IAAI,IAAI;EACd,MAAM,KAAK,IAAI,KAAK;EACpB,KAAK,MACH,QAAQ,MAAM,OAAA,KAAqB,QAAQ,QAAQ,OAAA,MACpD,QAAQ,QAAQ,OAAA,KAChB,QAAQ,OAAO,GAAG,CAAC,MAClB,CAAC,SAAS,QAAQ,QAAQ,IAAI,IAAK,IAAI,EAAG,KAAK,kBAC7C,IACA;CACL;CAEA,KAAK,MAAM,UAAU,IAAI,SAAS;EACjC,IAAI,CAAC,SAAS,MAAM,IAAI,OAAO,IAAI,GAAG;EACtC,MAAM,MAAM,SAAS,KAAK,OAAO,IAAI;EACrC,IAAI,IAAI,SAAS,QAAQ;EACzB,MAAM,EAAE,GAAG,MAAM,YAAY,GAAG;EAChC,MAAM,SAAS,cAAc,OAAO,GAAG,OAAO,GAAG,GAAG,CAAC;EACrD,KAAK,IAAI,IAAI,OAAO,GAAG,IAAI,OAAO,IAAI,GAAG,KACxC,KAAK,IAAI,IAAI,OAAO,GAAG,IAAI,OAAO,IAAI,GAAG,KAAK;GAC7C,IAAI,IAAI,KAAK,IAAI,KAAK,KAAK,SAAS,KAAK,OAAO;GAChD,KAAK,IAAI,QAAQ,KAAK;GACtB,MAAM,IAAI,QAAQ,KAAK;EACxB;CAEF;CACA,OAAO;EAAE;EAAM;CAAM;AACtB;;AAGA,SAAgB,aAAa,KAAc,UAAuE;CACjH,MAAM,EAAE,OAAO,OAAO,QAAQ,UAAU;CACxC,MAAM,EAAE,SAAS,SAAS,KAAK,QAAQ;CAEvC,MAAM,YAAY,GAAW,MAAc,OAAO,OAAO,OAAO,MAAM,MAAM,KAAK,KAAK,MAAM,KAAK;CACjG,MAAM,OAAO,IAAI,WAAW,QAAQ,KAAK;CACzC,IAAI,OAAO;CACX,MAAM,QAAQ,IAAI,WAAW,QAAQ,KAAK;CAC1C,KAAK,IAAI,QAAQ,GAAG,QAAQ,KAAK,QAAQ,SAAS;EACjD,IAAI,CAAC,KAAK,UAAU,KAAK,QAAQ;EACjC;EACA,IAAI,OAAO;EACX,IAAI,OAAO;EACX,MAAM,UAAU;EAChB,KAAK,SAAS;EACd,OAAO,OAAO,MAAM;GACnB,MAAM,IAAI,MAAM;GAChB,MAAM,IAAI,IAAI;GACd,MAAM,KAAK,IAAI,KAAK;GACpB,KAAK,MAAM,CAAC,IAAI,OAAO;IACtB,CAAC,IAAI,GAAG,CAAC;IACT,CAAC,IAAI,GAAG,CAAC;IACT,CAAC,GAAG,IAAI,CAAC;IACT,CAAC,GAAG,IAAI,CAAC;GACV,GAAG;IACF,IAAI,KAAK,KAAK,KAAK,KAAK,MAAM,SAAS,MAAM,OAAO;IACpD,MAAM,IAAI,KAAK,QAAQ;IACvB,IAAI,CAAC,KAAK,MAAM,KAAK,MAAM,CAAC,SAAS,GAAG,CAAC,GAAG;IAC5C,KAAK,KAAK;IACV,MAAM,UAAU;GACjB;EACD;CACD;;CAEA,MAAM,MAAM,UAAgB;EAC3B,MAAM,KAAK,KAAK,MAAM,MAAM,CAAC;EAC7B,MAAM,KAAK,KAAK,MAAM,MAAM,CAAC;EAC7B,KAAK,IAAI,IAAI,GAAG,KAAK,GAAG,KACvB,KAAK,IAAI,IAAI,KAAK,GAAG,KAAK,KAAK,GAAG,KACjC,KAAK,IAAI,IAAI,KAAK,GAAG,KAAK,KAAK,GAAG,KAAK;GACtC,IAAI,IAAI,KAAK,IAAI,KAAK,KAAK,SAAS,KAAK,OAAO;GAChD,IAAI,KAAK,IAAI,KAAK,IAAI,IAAI,EAAE,GAAG,KAAK,IAAI,IAAI,EAAE,CAAC,MAAM,GAAG;GACxD,MAAM,QAAQ,KAAK,IAAI,QAAQ;GAC/B,IAAI,OAAO,OAAO;EACnB;EAGF,OAAO;CACR;CACA,OAAO;EAAE;EAAM;CAAG;AACnB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { MapRule } from '../rule';
|
|
2
|
+
/**
|
|
3
|
+
* The styles of grass and bushes a map paints (`CellLayerValue.foliage`): cells painted with a value their layer names
|
|
4
|
+
* nothing of (a style the game and the map do not have, drawn as the layer and nothing to the rules); a style that
|
|
5
|
+
* hides but stands shorter than every unit on the ground the game has, and so hides none of them
|
|
6
|
+
* (`concealsTaller: false`); a style that burns in a game whose grass has no fire (no foliage pack, or its `fire` off).
|
|
7
|
+
* Warnings, each once a style, about the first cell painted with it
|
|
8
|
+
*/
|
|
9
|
+
export declare const foliageRules: MapRule;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { FOLIAGE, foliageLayers, foliageStyle } from "../../foliage.js";
|
|
2
|
+
import { cellLayerValues, layCellLayerData } from "../../cellLayers.js";
|
|
3
|
+
//#region src/mapCheck/rules/foliage.ts
|
|
4
|
+
/** The game's layers of cells as this map has them: the game's values with the map's definitions over them */
|
|
5
|
+
function layersOf(map, registry) {
|
|
6
|
+
const own = map.definitions?.cellLayers;
|
|
7
|
+
return own ? layCellLayerData(registry.cellLayers, own) : [...registry.cellLayers];
|
|
8
|
+
}
|
|
9
|
+
/** How tall a unit type stands to the rules' grass, as the foliage pack measures it when a game says nothing: twice its radius */
|
|
10
|
+
var heightOf = (radius) => radius * 2;
|
|
11
|
+
/**
|
|
12
|
+
* The styles of grass and bushes a map paints (`CellLayerValue.foliage`): cells painted with a value their layer names
|
|
13
|
+
* nothing of (a style the game and the map do not have, drawn as the layer and nothing to the rules); a style that
|
|
14
|
+
* hides but stands shorter than every unit on the ground the game has, and so hides none of them
|
|
15
|
+
* (`concealsTaller: false`); a style that burns in a game whose grass has no fire (no foliage pack, or its `fire` off).
|
|
16
|
+
* Warnings, each once a style, about the first cell painted with it
|
|
17
|
+
*/
|
|
18
|
+
var foliageRules = {
|
|
19
|
+
id: "foliage",
|
|
20
|
+
check(map, registry, say, _context) {
|
|
21
|
+
const cells = map.cells;
|
|
22
|
+
if (!cells || !registry.cellLayers.length) return;
|
|
23
|
+
const layers = layersOf(map, registry);
|
|
24
|
+
const packs = registry.assembly?.rules.packs;
|
|
25
|
+
const options = (packs?.find((each) => each.id === FOLIAGE))?.options;
|
|
26
|
+
const ofPack = new Set(options ? foliageLayers(options).map((each) => each.layer) : []);
|
|
27
|
+
const burns = !!options && options.fire !== false;
|
|
28
|
+
const game = {
|
|
29
|
+
cellLayers: layers,
|
|
30
|
+
packs
|
|
31
|
+
};
|
|
32
|
+
let shortest = Infinity;
|
|
33
|
+
for (const def of registry.units.all()) if (def.kind === "unit" && !def.flying && !def.footprint) shortest = Math.min(shortest, heightOf(def.radius));
|
|
34
|
+
const { width } = map;
|
|
35
|
+
for (const def of layers) {
|
|
36
|
+
const painted = cells[def.id];
|
|
37
|
+
if (!painted) continue;
|
|
38
|
+
const counts = /* @__PURE__ */ new Uint32Array(256);
|
|
39
|
+
const first = (/* @__PURE__ */ new Int32Array(256)).fill(-1);
|
|
40
|
+
for (let c = 0; c < painted.length; c++) {
|
|
41
|
+
const value = painted[c];
|
|
42
|
+
if (!value) continue;
|
|
43
|
+
if (!counts[value]) first[value] = c;
|
|
44
|
+
counts[value]++;
|
|
45
|
+
}
|
|
46
|
+
const named = new Map(cellLayerValues(def).map((each) => [each.value, each]));
|
|
47
|
+
const at = (value) => ({
|
|
48
|
+
x: first[value] % width + .5,
|
|
49
|
+
z: Math.floor(first[value] / width) + .5
|
|
50
|
+
});
|
|
51
|
+
for (let value = 1; value < 256; value++) {
|
|
52
|
+
if (!counts[value]) continue;
|
|
53
|
+
const cellsSaid = `${counts[value].toLocaleString("en")} ${counts[value] === 1 ? "cell" : "cells"}`;
|
|
54
|
+
const known = named.get(value);
|
|
55
|
+
if (!known) {
|
|
56
|
+
say({
|
|
57
|
+
message: `${cellsSaid} of ${def.name} are painted with ${value}, a style neither the game nor the map has: drawn as the layer, nothing to the rules`,
|
|
58
|
+
at: at(value),
|
|
59
|
+
rule: "unknown-foliage-style"
|
|
60
|
+
});
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
const style = foliageStyle(game, def.id, value);
|
|
64
|
+
if (!style) continue;
|
|
65
|
+
const height = style.height ?? 1;
|
|
66
|
+
if (ofPack.has(def.id) && style.conceals && style.concealsTaller === false && Number.isFinite(shortest) && shortest > height) say({
|
|
67
|
+
message: `${known.name} (${def.name}) hides units inside, but stands ${height} tall and the shortest unit on the ground of the game ${shortest} (twice its radius): it hides none of them`,
|
|
68
|
+
at: at(value),
|
|
69
|
+
rule: "foliage-hides-nobody"
|
|
70
|
+
});
|
|
71
|
+
if ((style.flammable ?? 0) > 0 && !burns) say({
|
|
72
|
+
message: `${known.name} (${def.name}) is flammable, but the game's grass has no fire (${options ? "foliagePack has fire: false" : "no foliagePack"}): it never burns`,
|
|
73
|
+
at: at(value),
|
|
74
|
+
rule: "foliage-no-fire"
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
//#endregion
|
|
81
|
+
export { foliageRules };
|
|
82
|
+
|
|
83
|
+
//# sourceMappingURL=foliage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"foliage.js","names":[],"sources":["../../../src/mapCheck/rules/foliage.ts"],"sourcesContent":["import { type CellLayerDef, cellLayerValues, layCellLayerData } from '../../cellLayers'\nimport { FOLIAGE, type FoliageOptions, foliageLayers, foliageStyle } from '../../foliage'\nimport type { GameMap } from '../../map'\nimport type { Registry } from '../../registry'\nimport type { MapRule } from '../rule'\n\n/** The game's layers of cells as this map has them: the game's values with the map's definitions over them */\nfunction layersOf(map: GameMap, registry: Registry): CellLayerDef[] {\n\tconst own = map.definitions?.cellLayers\n\treturn own ? layCellLayerData(registry.cellLayers, own) : [...registry.cellLayers]\n}\n\n/** How tall a unit type stands to the rules' grass, as the foliage pack measures it when a game says nothing: twice its radius */\nconst heightOf = (radius: number) => radius * 2\n\n/**\n * The styles of grass and bushes a map paints (`CellLayerValue.foliage`): cells painted with a value their layer names\n * nothing of (a style the game and the map do not have, drawn as the layer and nothing to the rules); a style that\n * hides but stands shorter than every unit on the ground the game has, and so hides none of them\n * (`concealsTaller: false`); a style that burns in a game whose grass has no fire (no foliage pack, or its `fire` off).\n * Warnings, each once a style, about the first cell painted with it\n */\nexport const foliageRules: MapRule = {\n\tid: 'foliage',\n\tcheck(map, registry, say, _context) {\n\t\tconst cells = map.cells\n\t\tif (!cells || !registry.cellLayers.length) return\n\t\tconst layers = layersOf(map, registry)\n\t\tconst packs = registry.assembly?.rules.packs\n\t\tconst pack = packs?.find((each) => each.id === FOLIAGE)\n\t\tconst options = pack?.options as FoliageOptions | undefined\n\t\tconst ofPack = new Set(options ? foliageLayers(options).map((each) => each.layer) : [])\n\t\tconst burns = !!options && options.fire !== false\n\t\tconst game = { cellLayers: layers, packs }\n\t\t// the units hiding is for: on the ground, not built; the shortest of them\n\t\tlet shortest = Infinity\n\t\tfor (const def of registry.units.all()) if (def.kind === 'unit' && !def.flying && !def.footprint) shortest = Math.min(shortest, heightOf(def.radius))\n\t\tconst { width } = map\n\t\tfor (const def of layers) {\n\t\t\tconst painted = cells[def.id]\n\t\t\tif (!painted) continue\n\t\t\t// how many cells each value has, and the first of each\n\t\t\tconst counts = new Uint32Array(256)\n\t\t\tconst first = new Int32Array(256).fill(-1)\n\t\t\tfor (let c = 0; c < painted.length; c++) {\n\t\t\t\tconst value = painted[c]\n\t\t\t\tif (!value) continue\n\t\t\t\tif (!counts[value]) first[value] = c\n\t\t\t\tcounts[value]++\n\t\t\t}\n\t\t\tconst named = new Map(cellLayerValues(def).map((each) => [each.value, each]))\n\t\t\tconst at = (value: number) => ({ x: (first[value] % width) + 0.5, z: Math.floor(first[value] / width) + 0.5 })\n\t\t\tfor (let value = 1; value < 256; value++) {\n\t\t\t\tif (!counts[value]) continue\n\t\t\t\tconst cellsSaid = `${counts[value].toLocaleString('en')} ${counts[value] === 1 ? 'cell' : 'cells'}`\n\t\t\t\tconst known = named.get(value)\n\t\t\t\tif (!known) {\n\t\t\t\t\tsay({\n\t\t\t\t\t\tmessage: `${cellsSaid} of ${def.name} are painted with ${value}, a style neither the game nor the map has: drawn as the layer, nothing to the rules`,\n\t\t\t\t\t\tat: at(value),\n\t\t\t\t\t\trule: 'unknown-foliage-style'\n\t\t\t\t\t})\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tconst style = foliageStyle(game, def.id, value)\n\t\t\t\tif (!style) continue\n\t\t\t\tconst height = style.height ?? 1\n\t\t\t\t// hiding is the foliage pack's, on its layers\n\t\t\t\tif (ofPack.has(def.id) &&\n\t\t\t\t\tstyle.conceals && style.concealsTaller === false && Number.isFinite(shortest) && shortest > height)\n\t\t\t\t\tsay({\n\t\t\t\t\t\tmessage: `${known.name} (${def.name}) hides units inside, but stands ${height} tall and the shortest unit on the ground of the game ${shortest} (twice its radius): it hides none of them`,\n\t\t\t\t\t\tat: at(value),\n\t\t\t\t\t\trule: 'foliage-hides-nobody'\n\t\t\t\t\t})\n\t\t\t\tif ((style.flammable ?? 0) > 0 && !burns)\n\t\t\t\t\tsay({\n\t\t\t\t\t\tmessage: `${known.name} (${def.name}) is flammable, but the game's grass has no fire (${options ? 'foliagePack has fire: false' : 'no foliagePack'}): it never burns`,\n\t\t\t\t\t\tat: at(value),\n\t\t\t\t\t\trule: 'foliage-no-fire'\n\t\t\t\t\t})\n\t\t\t}\n\t\t}\n\t}\n}\n"],"mappings":";;;;AAOA,SAAS,SAAS,KAAc,UAAoC;CACnE,MAAM,MAAM,IAAI,aAAa;CAC7B,OAAO,MAAM,iBAAiB,SAAS,YAAY,GAAG,IAAI,CAAC,GAAG,SAAS,UAAU;AAClF;;AAGA,IAAM,YAAY,WAAmB,SAAS;;;;;;;;AAS9C,IAAa,eAAwB;CACpC,IAAI;CACJ,MAAM,KAAK,UAAU,KAAK,UAAU;EACnC,MAAM,QAAQ,IAAI;EAClB,IAAI,CAAC,SAAS,CAAC,SAAS,WAAW,QAAQ;EAC3C,MAAM,SAAS,SAAS,KAAK,QAAQ;EACrC,MAAM,QAAQ,SAAS,UAAU,MAAM;EAEvC,MAAM,WADO,OAAO,MAAM,SAAS,KAAK,OAAO,OAAO,EAAA,EAChC;EACtB,MAAM,SAAS,IAAI,IAAI,UAAU,cAAc,OAAO,CAAC,CAAC,KAAK,SAAS,KAAK,KAAK,IAAI,CAAC,CAAC;EACtF,MAAM,QAAQ,CAAC,CAAC,WAAW,QAAQ,SAAS;EAC5C,MAAM,OAAO;GAAE,YAAY;GAAQ;EAAM;EAEzC,IAAI,WAAW;EACf,KAAK,MAAM,OAAO,SAAS,MAAM,IAAI,GAAG,IAAI,IAAI,SAAS,UAAU,CAAC,IAAI,UAAU,CAAC,IAAI,WAAW,WAAW,KAAK,IAAI,UAAU,SAAS,IAAI,MAAM,CAAC;EACpJ,MAAM,EAAE,UAAU;EAClB,KAAK,MAAM,OAAO,QAAQ;GACzB,MAAM,UAAU,MAAM,IAAI;GAC1B,IAAI,CAAC,SAAS;GAEd,MAAM,yBAAS,IAAI,YAAY,GAAG;GAClC,MAAM,yBAAQ,IAAI,WAAW,GAAG,EAAA,CAAE,KAAK,EAAE;GACzC,KAAK,IAAI,IAAI,GAAG,IAAI,QAAQ,QAAQ,KAAK;IACxC,MAAM,QAAQ,QAAQ;IACtB,IAAI,CAAC,OAAO;IACZ,IAAI,CAAC,OAAO,QAAQ,MAAM,SAAS;IACnC,OAAO,MAAM;GACd;GACA,MAAM,QAAQ,IAAI,IAAI,gBAAgB,GAAG,CAAC,CAAC,KAAK,SAAS,CAAC,KAAK,OAAO,IAAI,CAAC,CAAC;GAC5E,MAAM,MAAM,WAAmB;IAAE,GAAI,MAAM,SAAS,QAAS;IAAK,GAAG,KAAK,MAAM,MAAM,SAAS,KAAK,IAAI;GAAI;GAC5G,KAAK,IAAI,QAAQ,GAAG,QAAQ,KAAK,SAAS;IACzC,IAAI,CAAC,OAAO,QAAQ;IACpB,MAAM,YAAY,GAAG,OAAO,MAAM,CAAC,eAAe,IAAI,EAAE,GAAG,OAAO,WAAW,IAAI,SAAS;IAC1F,MAAM,QAAQ,MAAM,IAAI,KAAK;IAC7B,IAAI,CAAC,OAAO;KACX,IAAI;MACH,SAAS,GAAG,UAAU,MAAM,IAAI,KAAK,oBAAoB,MAAM;MAC/D,IAAI,GAAG,KAAK;MACZ,MAAM;KACP,CAAC;KACD;IACD;IACA,MAAM,QAAQ,aAAa,MAAM,IAAI,IAAI,KAAK;IAC9C,IAAI,CAAC,OAAO;IACZ,MAAM,SAAS,MAAM,UAAU;IAE/B,IAAI,OAAO,IAAI,IAAI,EAAE,KACpB,MAAM,YAAY,MAAM,mBAAmB,SAAS,OAAO,SAAS,QAAQ,KAAK,WAAW,QAC5F,IAAI;KACH,SAAS,GAAG,MAAM,KAAK,IAAI,IAAI,KAAK,mCAAmC,OAAO,wDAAwD,SAAS;KAC/I,IAAI,GAAG,KAAK;KACZ,MAAM;IACP,CAAC;IACF,KAAK,MAAM,aAAa,KAAK,KAAK,CAAC,OAClC,IAAI;KACH,SAAS,GAAG,MAAM,KAAK,IAAI,IAAI,KAAK,oDAAoD,UAAU,gCAAgC,iBAAiB;KACnJ,IAAI,GAAG,KAAK;KACZ,MAAM;IACP,CAAC;GACH;EACD;CACD;AACD"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
//#region src/mapCheck/rules/names.ts
|
|
2
|
+
/** One thing a name, and the cameras players start looking from */
|
|
3
|
+
var nameRules = {
|
|
4
|
+
id: "names",
|
|
5
|
+
check(map, _registry, say, _context) {
|
|
6
|
+
const named = /* @__PURE__ */ new Map();
|
|
7
|
+
const name = (value, at, about) => {
|
|
8
|
+
if (value) named.set(value, [...named.get(value) ?? [], {
|
|
9
|
+
at,
|
|
10
|
+
about
|
|
11
|
+
}]);
|
|
12
|
+
};
|
|
13
|
+
for (const object of map.objects) name(object.name, object, { object: object.id });
|
|
14
|
+
for (const camp of map.camps) name(camp.name, camp, { camp: camp.id });
|
|
15
|
+
for (const region of map.regions) name(region.name, region.shape, { region: region.id });
|
|
16
|
+
for (const point of map.points) name(point.name, point, { point: point.id });
|
|
17
|
+
for (const path of map.paths) name(path.name, path.points[0] ?? {
|
|
18
|
+
x: 0,
|
|
19
|
+
z: 0
|
|
20
|
+
}, { path: path.id });
|
|
21
|
+
for (const [value, places] of named) if (places.length > 1) say({
|
|
22
|
+
message: `"${value}" is the name of ${places.length} things: the rules find only one`,
|
|
23
|
+
error: true,
|
|
24
|
+
at: places[1].at,
|
|
25
|
+
rule: "name-twice",
|
|
26
|
+
about: places[1].about
|
|
27
|
+
});
|
|
28
|
+
for (const player of map.players) if (player.camera && !map.cameras.some((camera) => camera.name === player.camera)) say({
|
|
29
|
+
message: `${player.name} starts looking from "${player.camera}", which is no camera of the map`,
|
|
30
|
+
at: player.start,
|
|
31
|
+
rule: "unknown-camera",
|
|
32
|
+
about: { player: player.id }
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
//#endregion
|
|
37
|
+
export { nameRules };
|
|
38
|
+
|
|
39
|
+
//# sourceMappingURL=names.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"names.js","names":[],"sources":["../../../src/mapCheck/rules/names.ts"],"sourcesContent":["import type { MapTarget } from '../../mapFields'\nimport type { Vec2 } from '../../math'\nimport type { MapRule } from '../rule'\n\n/** One thing a name, and the cameras players start looking from */\nexport const nameRules: MapRule = {\n\tid: 'names',\n\tcheck(map, _registry, say, _context) {\n\t\t// the rules find things by name: one thing a name\n\t\tconst named = new Map<string, { at: Vec2; about: MapTarget }[]>()\n\t\tconst name = (value: string | undefined, at: Vec2, about: MapTarget) => {\n\t\t\tif (value) named.set(value, [...(named.get(value) ?? []), { at, about }])\n\t\t}\n\t\tfor (const object of map.objects) name(object.name, object, { object: object.id })\n\t\tfor (const camp of map.camps) name(camp.name, camp, { camp: camp.id })\n\t\tfor (const region of map.regions) name(region.name, region.shape, { region: region.id })\n\t\tfor (const point of map.points) name(point.name, point, { point: point.id })\n\t\tfor (const path of map.paths) name(path.name, path.points[0] ?? { x: 0, z: 0 }, { path: path.id })\n\t\tfor (const [value, places] of named) {\n\t\t\tif (places.length > 1)\n\t\t\t\tsay({\n\t\t\t\t\tmessage: `\"${value}\" is the name of ${places.length} things: the rules find only one`,\n\t\t\t\t\terror: true,\n\t\t\t\t\tat: places[1].at,\n\t\t\t\t\trule: 'name-twice',\n\t\t\t\t\tabout: places[1].about\n\t\t\t\t})\n\t\t}\n\t\tfor (const player of map.players) {\n\t\t\tif (player.camera && !map.cameras.some((camera) => camera.name === player.camera)) {\n\t\t\t\tsay({\n\t\t\t\t\tmessage: `${player.name} starts looking from \"${player.camera}\", which is no camera of the map`,\n\t\t\t\t\tat: player.start,\n\t\t\t\t\trule: 'unknown-camera',\n\t\t\t\t\tabout: { player: player.id }\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t}\n}\n"],"mappings":";;AAKA,IAAa,YAAqB;CACjC,IAAI;CACJ,MAAM,KAAK,WAAW,KAAK,UAAU;EAEpC,MAAM,wBAAQ,IAAI,IAA8C;EAChE,MAAM,QAAQ,OAA2B,IAAU,UAAqB;GACvE,IAAI,OAAO,MAAM,IAAI,OAAO,CAAC,GAAI,MAAM,IAAI,KAAK,KAAK,CAAC,GAAI;IAAE;IAAI;GAAM,CAAC,CAAC;EACzE;EACA,KAAK,MAAM,UAAU,IAAI,SAAS,KAAK,OAAO,MAAM,QAAQ,EAAE,QAAQ,OAAO,GAAG,CAAC;EACjF,KAAK,MAAM,QAAQ,IAAI,OAAO,KAAK,KAAK,MAAM,MAAM,EAAE,MAAM,KAAK,GAAG,CAAC;EACrE,KAAK,MAAM,UAAU,IAAI,SAAS,KAAK,OAAO,MAAM,OAAO,OAAO,EAAE,QAAQ,OAAO,GAAG,CAAC;EACvF,KAAK,MAAM,SAAS,IAAI,QAAQ,KAAK,MAAM,MAAM,OAAO,EAAE,OAAO,MAAM,GAAG,CAAC;EAC3E,KAAK,MAAM,QAAQ,IAAI,OAAO,KAAK,KAAK,MAAM,KAAK,OAAO,MAAM;GAAE,GAAG;GAAG,GAAG;EAAE,GAAG,EAAE,MAAM,KAAK,GAAG,CAAC;EACjG,KAAK,MAAM,CAAC,OAAO,WAAW,OAC7B,IAAI,OAAO,SAAS,GACnB,IAAI;GACH,SAAS,IAAI,MAAM,mBAAmB,OAAO,OAAO;GACpD,OAAO;GACP,IAAI,OAAO,EAAE,CAAC;GACd,MAAM;GACN,OAAO,OAAO,EAAE,CAAC;EAClB,CAAC;EAEH,KAAK,MAAM,UAAU,IAAI,SACxB,IAAI,OAAO,UAAU,CAAC,IAAI,QAAQ,MAAM,WAAW,OAAO,SAAS,OAAO,MAAM,GAC/E,IAAI;GACH,SAAS,GAAG,OAAO,KAAK,wBAAwB,OAAO,OAAO;GAC9D,IAAI,OAAO;GACX,MAAM;GACN,OAAO,EAAE,QAAQ,OAAO,GAAG;EAC5B,CAAC;CAGJ;AACD"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { MapRule } from '../rule';
|
|
2
|
-
/** What is placed and the camps: of types the game has, on the map, out of deep water */
|
|
2
|
+
/** What is placed and the camps: of types the game has, on the map, out of deep water (but what sails, or flies) */
|
|
3
3
|
export declare const objectRules: MapRule;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import "../../terrain.js";
|
|
2
|
+
//#region src/mapCheck/rules/objects.ts
|
|
3
|
+
/** What is placed and the camps: of types the game has, on the map, out of deep water (but what sails, or flies) */
|
|
4
|
+
var objectRules = {
|
|
5
|
+
id: "objects",
|
|
6
|
+
check(map, registry, say, { terrain, onMap }) {
|
|
7
|
+
for (const object of map.objects) {
|
|
8
|
+
if (!registry.units.has(object.type)) {
|
|
9
|
+
say({
|
|
10
|
+
message: `"${object.type}" is no unit type of the game: it is left out`,
|
|
11
|
+
at: object,
|
|
12
|
+
rule: "unknown-type",
|
|
13
|
+
about: { object: object.id }
|
|
14
|
+
});
|
|
15
|
+
continue;
|
|
16
|
+
}
|
|
17
|
+
if (!onMap(object)) {
|
|
18
|
+
say({
|
|
19
|
+
message: `${registry.unit(object.type).name} stands off the map`,
|
|
20
|
+
error: true,
|
|
21
|
+
at: object,
|
|
22
|
+
rule: "off-map",
|
|
23
|
+
about: { object: object.id }
|
|
24
|
+
});
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
const def = registry.unit(object.type);
|
|
28
|
+
if (!def.flying && !def.naval && terrain.waterAt(object.x, object.z) === 2) say({
|
|
29
|
+
message: `${def.name} stands in deep water`,
|
|
30
|
+
at: object,
|
|
31
|
+
rule: "deep-water",
|
|
32
|
+
about: { object: object.id }
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
for (const camp of map.camps) {
|
|
36
|
+
const strangers = camp.units.filter((type) => !type.startsWith("@") && !registry.units.has(type));
|
|
37
|
+
if (strangers.length) say({
|
|
38
|
+
message: `A camp has creeps the game does not have: ${strangers.join(", ")}`,
|
|
39
|
+
at: camp,
|
|
40
|
+
rule: "unknown-creeps",
|
|
41
|
+
about: { camp: camp.id }
|
|
42
|
+
});
|
|
43
|
+
if (!onMap(camp)) say({
|
|
44
|
+
message: "A camp stands off the map",
|
|
45
|
+
error: true,
|
|
46
|
+
at: camp,
|
|
47
|
+
rule: "off-map",
|
|
48
|
+
about: { camp: camp.id }
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
//#endregion
|
|
54
|
+
export { objectRules };
|
|
55
|
+
|
|
56
|
+
//# sourceMappingURL=objects.js.map
|