hivedesk 0.2.1 → 1.0.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/CHANGELOG.md +111 -74
- package/FIRST-RUN.md +14 -20
- package/PROTOCOL.md +19 -3
- package/README.md +303 -238
- package/assets/banner-1.0-pt.png +0 -0
- package/assets/banner-1.0-pt.svg +6 -0
- package/assets/banner-1.0.png +0 -0
- package/assets/banner-1.0.svg +6 -0
- package/assets/banner.png +0 -0
- package/assets/banner.svg +1 -513
- package/assets/crew/designer.svg +1 -42
- package/assets/crew/dev.svg +1 -43
- package/assets/crew/mel.svg +1 -44
- package/assets/crew/qa.svg +1 -43
- package/assets/crew/writer.svg +1 -40
- package/assets/icons/1.0/achievements.svg +1 -0
- package/assets/icons/1.0/api.svg +1 -0
- package/assets/icons/1.0/auto-update.svg +1 -0
- package/assets/icons/1.0/city.svg +1 -0
- package/assets/icons/1.0/cli.svg +1 -0
- package/assets/icons/1.0/clipboard.svg +1 -0
- package/assets/icons/1.0/contact-sheet.svg +1 -0
- package/assets/icons/1.0/cpu-share.svg +1 -0
- package/assets/icons/1.0/crew.svg +1 -0
- package/assets/icons/1.0/data.svg +1 -0
- package/assets/icons/1.0/desktop.svg +1 -0
- package/assets/icons/1.0/editor.svg +1 -0
- package/assets/icons/1.0/extension.svg +1 -0
- package/assets/icons/1.0/file-send.svg +1 -0
- package/assets/icons/1.0/game.svg +1 -0
- package/assets/icons/1.0/git.svg +1 -0
- package/assets/icons/1.0/github.svg +1 -0
- package/assets/icons/1.0/gpu-share.svg +1 -0
- package/assets/icons/1.0/installer.svg +1 -0
- package/assets/icons/1.0/languages.svg +1 -0
- package/assets/icons/1.0/linkedin.svg +1 -0
- package/assets/icons/1.0/machines.svg +1 -0
- package/assets/icons/1.0/mobile.svg +1 -0
- package/assets/icons/1.0/models.svg +1 -0
- package/assets/icons/1.0/p2p-invite.svg +1 -0
- package/assets/icons/1.0/phone-remote.svg +1 -0
- package/assets/icons/1.0/playbooks.svg +1 -0
- package/assets/icons/1.0/pooled-models.svg +1 -0
- package/assets/icons/1.0/privacy.svg +1 -0
- package/assets/icons/1.0/profile.svg +1 -0
- package/assets/icons/1.0/question-card.svg +1 -0
- package/assets/icons/1.0/remote-desktop.svg +1 -0
- package/assets/icons/1.0/rotation.svg +1 -0
- package/assets/icons/1.0/security-audit.svg +1 -0
- package/assets/icons/1.0/sprite.svg +85 -0
- package/assets/icons/1.0/terminal.svg +1 -0
- package/assets/icons/1.0/tiles/achievements.svg +1 -0
- package/assets/icons/1.0/tiles/api.svg +1 -0
- package/assets/icons/1.0/tiles/auto-update.svg +1 -0
- package/assets/icons/1.0/tiles/city.svg +1 -0
- package/assets/icons/1.0/tiles/cli.svg +1 -0
- package/assets/icons/1.0/tiles/clipboard.svg +1 -0
- package/assets/icons/1.0/tiles/cpu-share.svg +1 -0
- package/assets/icons/1.0/tiles/crew.svg +1 -0
- package/assets/icons/1.0/tiles/data.svg +1 -0
- package/assets/icons/1.0/tiles/desktop.svg +1 -0
- package/assets/icons/1.0/tiles/editor.svg +1 -0
- package/assets/icons/1.0/tiles/extension.svg +1 -0
- package/assets/icons/1.0/tiles/file-send.svg +1 -0
- package/assets/icons/1.0/tiles/game.svg +1 -0
- package/assets/icons/1.0/tiles/git.svg +1 -0
- package/assets/icons/1.0/tiles/github.svg +1 -0
- package/assets/icons/1.0/tiles/gpu-share.svg +1 -0
- package/assets/icons/1.0/tiles/installer.svg +1 -0
- package/assets/icons/1.0/tiles/languages.svg +1 -0
- package/assets/icons/1.0/tiles/machines.svg +1 -0
- package/assets/icons/1.0/tiles/mobile.svg +1 -0
- package/assets/icons/1.0/tiles/models.svg +1 -0
- package/assets/icons/1.0/tiles/p2p-invite.svg +1 -0
- package/assets/icons/1.0/tiles/phone-remote.svg +1 -0
- package/assets/icons/1.0/tiles/playbooks.svg +1 -0
- package/assets/icons/1.0/tiles/pooled-models.svg +1 -0
- package/assets/icons/1.0/tiles/privacy.svg +1 -0
- package/assets/icons/1.0/tiles/profile.svg +1 -0
- package/assets/icons/1.0/tiles/question-card.svg +1 -0
- package/assets/icons/1.0/tiles/remote-desktop.svg +1 -0
- package/assets/icons/1.0/tiles/rotation.svg +1 -0
- package/assets/icons/1.0/tiles/security-audit.svg +1 -0
- package/assets/icons/1.0/tiles/terminal.svg +1 -0
- package/assets/icons/1.0/tiles/voice.svg +1 -0
- package/assets/icons/1.0/tiles/web.svg +1 -0
- package/assets/icons/1.0/voice.svg +1 -0
- package/assets/icons/1.0/web.svg +1 -0
- package/assets/icons/approval.svg +1 -1
- package/assets/icons/arrow.svg +1 -1
- package/assets/icons/chat.svg +1 -1
- package/assets/icons/check.svg +1 -1
- package/assets/icons/clock.svg +1 -1
- package/assets/icons/code.svg +1 -1
- package/assets/icons/compass.svg +1 -1
- package/assets/icons/contact-sheet.svg +1 -1
- package/assets/icons/copy.svg +1 -1
- package/assets/icons/cpu.svg +1 -1
- package/assets/icons/design.svg +1 -1
- package/assets/icons/download.svg +1 -1
- package/assets/icons/folder.svg +1 -1
- package/assets/icons/github-honey.svg +1 -1
- package/assets/icons/github.svg +1 -1
- package/assets/icons/globe.svg +1 -1
- package/assets/icons/gpu.svg +1 -1
- package/assets/icons/hire.svg +1 -1
- package/assets/icons/hive.svg +1 -1
- package/assets/icons/honey/approval.svg +1 -0
- package/assets/icons/honey/chat.svg +1 -0
- package/assets/icons/honey/code.svg +1 -0
- package/assets/icons/honey/design.svg +1 -0
- package/assets/icons/honey/github.svg +1 -0
- package/assets/icons/honey/globe.svg +1 -0
- package/assets/icons/honey/gpu.svg +1 -0
- package/assets/icons/honey/hire.svg +1 -0
- package/assets/icons/honey/hive.svg +1 -0
- package/assets/icons/honey/key.svg +1 -0
- package/assets/icons/honey/lend.svg +1 -0
- package/assets/icons/honey/lock.svg +1 -0
- package/assets/icons/honey/model.svg +1 -0
- package/assets/icons/honey/office.svg +1 -0
- package/assets/icons/honey/plan.svg +1 -0
- package/assets/icons/honey/playbook.svg +1 -0
- package/assets/icons/honey/qa.svg +1 -0
- package/assets/icons/honey/replay.svg +1 -0
- package/assets/icons/honey/sparkle.svg +1 -0
- package/assets/icons/honey/wand.svg +1 -0
- package/assets/icons/key.svg +1 -1
- package/assets/icons/lend.svg +1 -1
- package/assets/icons/linkedin-honey.svg +1 -1
- package/assets/icons/linkedin.svg +1 -1
- package/assets/icons/linux.svg +1 -1
- package/assets/icons/lock.svg +1 -1
- package/assets/icons/macos.svg +1 -1
- package/assets/icons/model.svg +1 -1
- package/assets/icons/npm.svg +1 -1
- package/assets/icons/office.svg +1 -1
- package/assets/icons/offline.svg +1 -1
- package/assets/icons/plan.svg +1 -1
- package/assets/icons/playbook.svg +1 -1
- package/assets/icons/preview.svg +1 -1
- package/assets/icons/qa.svg +1 -1
- package/assets/icons/queue.svg +1 -1
- package/assets/icons/replay.svg +1 -1
- package/assets/icons/search.svg +1 -0
- package/assets/icons/sparkle.svg +1 -1
- package/assets/icons/sprite.svg +12 -11
- package/assets/icons/star.svg +1 -1
- package/assets/icons/stop.svg +1 -1
- package/assets/icons/tag.svg +1 -1
- package/assets/icons/terminal.svg +1 -1
- package/assets/icons/wand.svg +1 -1
- package/assets/icons/windows.svg +1 -1
- package/assets/icons/words.svg +1 -1
- package/assets/icons/writer.svg +1 -1
- package/assets/icons/x.svg +1 -1
- package/assets/illustrations/1.0/hero-plain.svg +6 -0
- package/assets/illustrations/1.0/hero-pt.svg +6 -0
- package/assets/illustrations/1.0/hero.svg +6 -0
- package/assets/illustrations/1.0/how-it-works-pt.svg +6 -0
- package/assets/illustrations/1.0/how-it-works.svg +6 -0
- package/assets/illustrations/1.0/installers-pt.svg +6 -0
- package/assets/illustrations/1.0/installers.svg +6 -0
- package/assets/illustrations/1.0/p2p-gpu-pt.svg +6 -0
- package/assets/illustrations/1.0/p2p-gpu.svg +6 -0
- package/assets/illustrations/1.0/phone-remote.svg +6 -0
- package/assets/illustrations/1.0/remote-desktop-pt.svg +6 -0
- package/assets/illustrations/1.0/remote-desktop.svg +6 -0
- package/assets/illustrations/1.0/security.svg +6 -0
- package/assets/illustrations/1.0/voice-orb.svg +6 -0
- package/assets/illustrations/bee.svg +1 -27
- package/assets/illustrations/city-p2p-pt.svg +113 -0
- package/assets/illustrations/city-p2p.svg +113 -0
- package/assets/illustrations/crew.svg +1 -248
- package/assets/illustrations/first-run.svg +1 -48
- package/assets/illustrations/hardware.svg +1 -39
- package/assets/illustrations/hive-city.svg +1 -113
- package/assets/illustrations/lend.svg +1 -67
- package/assets/illustrations/privacy.svg +1 -39
- package/assets/illustrations/steps-pt.svg +1 -0
- package/assets/illustrations/steps.svg +1 -0
- package/assets/logo.svg +1 -13
- package/assets/mascot-dark.svg +1 -197
- package/assets/mascot.png +0 -0
- package/assets/mascot.svg +1 -194
- package/assets/mel-wave.svg +1 -205
- package/assets/og.svg +5 -254
- package/assets/screenshots/1.0/chat.webp +0 -0
- package/assets/screenshots/1.0/city-mobile.webp +0 -0
- package/assets/screenshots/1.0/city-room.webp +0 -0
- package/assets/screenshots/1.0/city.webp +0 -0
- package/assets/screenshots/1.0/editor.webp +0 -0
- package/assets/screenshots/1.0/machines.webp +0 -0
- package/assets/screenshots/1.0/office-mobile.webp +0 -0
- package/assets/screenshots/1.0/office.webp +0 -0
- package/assets/screenshots/1.0/profile.webp +0 -0
- package/assets/screenshots/1.0/remote.webp +0 -0
- package/assets/social-preview.png +0 -0
- package/assets/social-preview.svg +5 -254
- package/desktop/README.md +85 -10
- package/desktop/RELEASE.md +93 -0
- package/desktop/app/resources/icons/trayIconRemote.png +0 -0
- package/desktop/app/resources/icons/trayIconRemote@2x.png +0 -0
- package/desktop/controller.js +120 -5
- package/desktop/helpers/win-input.ps1 +426 -0
- package/desktop/i18n.json +480 -10
- package/desktop/icons/tray-remote.svg +5 -0
- package/desktop/installer/linux/hivedesk-linux-install.sh +124 -0
- package/desktop/installer/macos/Read me first.txt +36 -0
- package/desktop/installer/macos/background.html +43 -0
- package/desktop/installer/macos/background.png +0 -0
- package/desktop/installer/macos/background@2x.png +0 -0
- package/desktop/installer/macos/make-dmg.sh +59 -0
- package/desktop/installer/windows/Art.xaml +158 -0
- package/desktop/installer/windows/Core.cs +1019 -0
- package/desktop/installer/windows/Setup.cs +504 -0
- package/desktop/installer/windows/Theme.xaml +268 -0
- package/desktop/installer/windows/Ui.cs +1069 -0
- package/desktop/installer/windows/app.manifest +23 -0
- package/desktop/installer/windows/strings.json +1012 -0
- package/desktop/launcher/linux/hivedesk +5 -0
- package/desktop/launcher/windows/Launcher.cs +10 -0
- package/desktop/native.js +49 -0
- package/desktop/profile/avatars.json +147 -0
- package/desktop/profile/index.js +53 -0
- package/desktop/release-notes/1.0.0.json +12 -0
- package/desktop/scripts/build-setup.mjs +86 -0
- package/desktop/scripts/dmg-art.mjs +27 -0
- package/desktop/scripts/manifest.mjs +57 -0
- package/desktop/scripts/package.mjs +8 -2
- package/desktop/scripts/shell-screens.mjs +60 -0
- package/desktop/scripts/sign-release.mjs +79 -0
- package/desktop/scripts/update-keygen.mjs +48 -0
- package/desktop/shell.html +295 -1
- package/desktop/state.js +4 -2
- package/desktop/update/apply.js +268 -0
- package/desktop/update/download.js +114 -0
- package/desktop/update/guard.js +89 -0
- package/desktop/update/layout.js +52 -0
- package/desktop/update/manifest.js +120 -0
- package/desktop/update/pubkey.js +3 -0
- package/desktop/update/service.js +310 -0
- package/desktop/update/tar.js +65 -0
- package/desktop/update/version.js +43 -0
- package/desktop/zip.js +75 -1
- package/i18n/README.pt-BR.md +304 -218
- package/i18n/de.json +1549 -1
- package/i18n/en.json +1549 -1
- package/i18n/es.json +1549 -1
- package/i18n/fr.json +1549 -1
- package/i18n/it.json +1549 -1
- package/i18n/ja.json +1549 -1
- package/i18n/ko.json +1549 -1
- package/i18n/parts/city.de.json +312 -0
- package/i18n/parts/city.en.json +312 -0
- package/i18n/parts/city.es.json +312 -0
- package/i18n/parts/city.fr.json +312 -0
- package/i18n/parts/city.it.json +312 -0
- package/i18n/parts/city.ja.json +312 -0
- package/i18n/parts/city.ko.json +312 -0
- package/i18n/parts/city.pt-BR.json +312 -0
- package/i18n/parts/city.ru.json +312 -0
- package/i18n/parts/city.zh-CN.json +312 -0
- package/i18n/parts/design.de.json +132 -0
- package/i18n/parts/design.en.json +132 -0
- package/i18n/parts/design.es.json +132 -0
- package/i18n/parts/design.fr.json +132 -0
- package/i18n/parts/design.it.json +132 -0
- package/i18n/parts/design.ja.json +132 -0
- package/i18n/parts/design.ko.json +132 -0
- package/i18n/parts/design.pt-BR.json +132 -0
- package/i18n/parts/design.ru.json +132 -0
- package/i18n/parts/design.zh-CN.json +132 -0
- package/i18n/parts/domains.de.json +263 -0
- package/i18n/parts/domains.en.json +263 -0
- package/i18n/parts/domains.es.json +263 -0
- package/i18n/parts/domains.fr.json +263 -0
- package/i18n/parts/domains.it.json +263 -0
- package/i18n/parts/domains.ja.json +263 -0
- package/i18n/parts/domains.ko.json +263 -0
- package/i18n/parts/domains.pt-BR.json +263 -0
- package/i18n/parts/domains.ru.json +263 -0
- package/i18n/parts/domains.zh-CN.json +263 -0
- package/i18n/parts/s1-core.de.json +33 -0
- package/i18n/parts/s1-core.en.json +33 -0
- package/i18n/parts/s1-core.es.json +33 -0
- package/i18n/parts/s1-core.fr.json +33 -0
- package/i18n/parts/s1-core.it.json +33 -0
- package/i18n/parts/s1-core.ja.json +33 -0
- package/i18n/parts/s1-core.ko.json +33 -0
- package/i18n/parts/s1-core.pt-BR.json +33 -0
- package/i18n/parts/s1-core.ru.json +33 -0
- package/i18n/parts/s1-core.zh-CN.json +33 -0
- package/i18n/parts/s2-p2p.de.json +58 -0
- package/i18n/parts/s2-p2p.en.json +58 -0
- package/i18n/parts/s2-p2p.es.json +58 -0
- package/i18n/parts/s2-p2p.fr.json +58 -0
- package/i18n/parts/s2-p2p.it.json +58 -0
- package/i18n/parts/s2-p2p.ja.json +58 -0
- package/i18n/parts/s2-p2p.ko.json +58 -0
- package/i18n/parts/s2-p2p.pt-BR.json +58 -0
- package/i18n/parts/s2-p2p.ru.json +58 -0
- package/i18n/parts/s2-p2p.zh-CN.json +58 -0
- package/i18n/parts/s3-compute.de.json +63 -0
- package/i18n/parts/s3-compute.en.json +63 -0
- package/i18n/parts/s3-compute.es.json +63 -0
- package/i18n/parts/s3-compute.fr.json +63 -0
- package/i18n/parts/s3-compute.it.json +63 -0
- package/i18n/parts/s3-compute.ja.json +63 -0
- package/i18n/parts/s3-compute.ko.json +63 -0
- package/i18n/parts/s3-compute.pt-BR.json +63 -0
- package/i18n/parts/s3-compute.ru.json +63 -0
- package/i18n/parts/s3-compute.zh-CN.json +63 -0
- package/i18n/parts/s6-remote.de.json +169 -0
- package/i18n/parts/s6-remote.en.json +169 -0
- package/i18n/parts/s6-remote.es.json +169 -0
- package/i18n/parts/s6-remote.fr.json +169 -0
- package/i18n/parts/s6-remote.it.json +169 -0
- package/i18n/parts/s6-remote.ja.json +169 -0
- package/i18n/parts/s6-remote.ko.json +169 -0
- package/i18n/parts/s6-remote.pt-BR.json +169 -0
- package/i18n/parts/s6-remote.ru.json +169 -0
- package/i18n/parts/s6-remote.zh-CN.json +169 -0
- package/i18n/parts/s7-phone.de.json +41 -0
- package/i18n/parts/s7-phone.en.json +41 -0
- package/i18n/parts/s7-phone.es.json +41 -0
- package/i18n/parts/s7-phone.fr.json +41 -0
- package/i18n/parts/s7-phone.it.json +41 -0
- package/i18n/parts/s7-phone.ja.json +41 -0
- package/i18n/parts/s7-phone.ko.json +41 -0
- package/i18n/parts/s7-phone.pt-BR.json +41 -0
- package/i18n/parts/s7-phone.ru.json +41 -0
- package/i18n/parts/s7-phone.zh-CN.json +41 -0
- package/i18n/parts/voice.de.json +135 -0
- package/i18n/parts/voice.en.json +135 -0
- package/i18n/parts/voice.es.json +135 -0
- package/i18n/parts/voice.fr.json +135 -0
- package/i18n/parts/voice.it.json +135 -0
- package/i18n/parts/voice.ja.json +135 -0
- package/i18n/parts/voice.ko.json +135 -0
- package/i18n/parts/voice.pt-BR.json +135 -0
- package/i18n/parts/voice.ru.json +135 -0
- package/i18n/parts/voice.zh-CN.json +135 -0
- package/i18n/parts/workbench.de.json +331 -0
- package/i18n/parts/workbench.en.json +331 -0
- package/i18n/parts/workbench.es.json +331 -0
- package/i18n/parts/workbench.fr.json +331 -0
- package/i18n/parts/workbench.it.json +331 -0
- package/i18n/parts/workbench.ja.json +331 -0
- package/i18n/parts/workbench.ko.json +331 -0
- package/i18n/parts/workbench.pt-BR.json +331 -0
- package/i18n/parts/workbench.ru.json +331 -0
- package/i18n/parts/workbench.zh-CN.json +331 -0
- package/i18n/pt-BR.json +1549 -1
- package/i18n/ru.json +1549 -1
- package/i18n/zh-CN.json +1549 -1
- package/package.json +10 -2
- package/src/brain/catalog/catalog.json +15790 -0
- package/src/brain/catalog/commands.js +105 -0
- package/src/brain/catalog/consent.js +90 -0
- package/src/brain/catalog/estimate.js +90 -0
- package/src/brain/catalog/families.js +196 -0
- package/src/brain/catalog/index.js +127 -0
- package/src/brain/catalog/measured.js +27 -0
- package/src/brain/catalog/pool.js +137 -0
- package/src/brain/catalog/recommend.js +226 -0
- package/src/brain/catalog/refresh.mjs +166 -0
- package/src/brain/catalog/router.js +193 -0
- package/src/brain/hardware.js +144 -13
- package/src/brain/keys.js +3 -1
- package/src/brain/local.js +24 -2
- package/src/brain/manager.js +359 -61
- package/src/brain/models.js +71 -25
- package/src/brain/pool/index.js +208 -0
- package/src/brain/pool/lender.js +247 -0
- package/src/brain/pool/llama-release.json +86 -0
- package/src/brain/pool/p2p.js +264 -0
- package/src/brain/pool/refresh-release.mjs +53 -0
- package/src/brain/pool/release.js +94 -0
- package/src/brain/pool/session.js +76 -0
- package/src/brain/pool/tunnel.js +161 -0
- package/src/brain/rotation.js +289 -0
- package/src/brain/runtime.js +3 -1
- package/src/bus.js +10 -135
- package/src/changelog/index.js +9 -1
- package/src/city/demo.js +4 -3
- package/src/city/index.js +254 -53
- package/src/city/membership.js +347 -0
- package/src/city/state.js +156 -8
- package/src/cli.js +172 -69
- package/src/compute/estimate.js +135 -0
- package/src/compute/index.js +295 -0
- package/src/compute/jobs-log.js +37 -0
- package/src/compute/probe.js +335 -0
- package/src/compute/requester.js +518 -0
- package/src/compute/scheduler.js +264 -0
- package/src/compute/share-cli.js +122 -0
- package/src/compute/share.js +178 -0
- package/src/compute/task-bridge.js +64 -0
- package/src/compute/types.js +114 -0
- package/src/compute/win-gpu.js +248 -0
- package/src/compute/wire.js +234 -0
- package/src/compute/worker.js +367 -0
- package/src/core/bus.js +254 -0
- package/src/core/city-report.js +52 -0
- package/src/core/deadline.js +78 -0
- package/src/core/demo.js +49 -0
- package/src/core/doctor-checks.js +61 -0
- package/src/core/events.js +116 -0
- package/src/core/log.js +147 -0
- package/src/core/migrate.js +145 -0
- package/src/core/origin.js +62 -0
- package/src/core/router.js +196 -0
- package/src/core/schema.js +73 -0
- package/src/core/shell.js +160 -0
- package/src/core/snapshots.js +58 -0
- package/src/core/store.js +130 -0
- package/src/crew/brief.js +2 -0
- package/src/crew/domains/attach.js +32 -0
- package/src/crew/domains/classify.js +176 -0
- package/src/crew/domains/flow.js +269 -0
- package/src/crew/domains/index.js +116 -0
- package/src/crew/domains/questions.js +551 -0
- package/src/crew/domains/security/advisories.json +35 -0
- package/src/crew/domains/security/fixes.js +98 -0
- package/src/crew/domains/security/scan.js +274 -0
- package/src/crew/domains/skeletons.js +77 -0
- package/src/crew/domains/templates/backend/README.md +27 -0
- package/src/crew/domains/templates/backend/package.json +12 -0
- package/src/crew/domains/templates/backend/src/app.js +70 -0
- package/src/crew/domains/templates/backend/src/server.js +61 -0
- package/src/crew/domains/templates/backend/test/api.test.js +47 -0
- package/src/crew/domains/templates/cli/README.md +18 -0
- package/src/crew/domains/templates/cli/bin/cli.js +48 -0
- package/src/crew/domains/templates/cli/package.json +12 -0
- package/src/crew/domains/templates/cli/src/lib.js +20 -0
- package/src/crew/domains/templates/cli/test/cli.test.js +43 -0
- package/src/crew/domains/templates/data/README.md +17 -0
- package/src/crew/domains/templates/data/bin/run.js +34 -0
- package/src/crew/domains/templates/data/data/sample.csv +7 -0
- package/src/crew/domains/templates/data/package.json +11 -0
- package/src/crew/domains/templates/data/src/csv.js +48 -0
- package/src/crew/domains/templates/data/src/report.js +39 -0
- package/src/crew/domains/templates/data/test/report.test.js +40 -0
- package/src/crew/domains/templates/desktop/README.md +17 -0
- package/src/crew/domains/templates/desktop/neutralino.config.json +34 -0
- package/src/crew/domains/templates/desktop/package.json +13 -0
- package/src/crew/domains/templates/desktop/resources/index.html +24 -0
- package/src/crew/domains/templates/desktop/resources/js/main.js +57 -0
- package/src/crew/domains/templates/desktop/resources/js/notes.js +25 -0
- package/src/crew/domains/templates/desktop/resources/styles.css +12 -0
- package/src/crew/domains/templates/desktop/test/notes.test.js +20 -0
- package/src/crew/domains/templates/extension/README.md +16 -0
- package/src/crew/domains/templates/extension/background.js +18 -0
- package/src/crew/domains/templates/extension/manifest.json +13 -0
- package/src/crew/domains/templates/extension/package.json +10 -0
- package/src/crew/domains/templates/extension/popup.css +11 -0
- package/src/crew/domains/templates/extension/popup.html +19 -0
- package/src/crew/domains/templates/extension/popup.js +34 -0
- package/src/crew/domains/templates/extension/src/notes.js +20 -0
- package/src/crew/domains/templates/extension/test/notes.test.js +25 -0
- package/src/crew/domains/templates/game/README.md +13 -0
- package/src/crew/domains/templates/game/index.html +18 -0
- package/src/crew/domains/templates/game/package.json +10 -0
- package/src/crew/domains/templates/game/src/game.js +58 -0
- package/src/crew/domains/templates/game/src/main.js +76 -0
- package/src/crew/domains/templates/game/style.css +9 -0
- package/src/crew/domains/templates/game/test/game.test.js +45 -0
- package/src/crew/domains/templates/mobile/README.md +25 -0
- package/src/crew/domains/templates/mobile/capacitor.config.json +8 -0
- package/src/crew/domains/templates/mobile/package.json +14 -0
- package/src/crew/domains/templates/mobile/test/store.test.js +27 -0
- package/src/crew/domains/templates/mobile/www/app.js +42 -0
- package/src/crew/domains/templates/mobile/www/icon.svg +1 -0
- package/src/crew/domains/templates/mobile/www/index.html +30 -0
- package/src/crew/domains/templates/mobile/www/manifest.webmanifest +12 -0
- package/src/crew/domains/templates/mobile/www/store.js +35 -0
- package/src/crew/domains/templates/mobile/www/style.css +42 -0
- package/src/crew/domains/templates/mobile/www/sw.js +16 -0
- package/src/crew/domains/text.js +34 -0
- package/src/crew/engine.js +283 -38
- package/src/crew/library/checks.js +574 -0
- package/src/crew/library/entries/app-types/appointment-booking.json +53 -0
- package/src/crew/library/entries/app-types/brick-breaker-game.json +50 -0
- package/src/crew/library/entries/app-types/budget-tracker-app.json +55 -0
- package/src/crew/library/entries/app-types/calculator-app.json +48 -0
- package/src/crew/library/entries/app-types/chat-ui-local.json +53 -0
- package/src/crew/library/entries/app-types/color-sequence-game.json +50 -0
- package/src/crew/library/entries/app-types/contact-book.json +52 -0
- package/src/crew/library/entries/app-types/countdown-to-date.json +53 -0
- package/src/crew/library/entries/app-types/crud-records-manager.json +56 -0
- package/src/crew/library/entries/app-types/currency-converter.json +50 -0
- package/src/crew/library/entries/app-types/dashboard-from-json.json +53 -0
- package/src/crew/library/entries/app-types/dice-roller.json +51 -0
- package/src/crew/library/entries/app-types/drawing-canvas.json +52 -0
- package/src/crew/library/entries/app-types/expense-splitter.json +54 -0
- package/src/crew/library/entries/app-types/flashcards-spaced-repetition.json +55 -0
- package/src/crew/library/entries/app-types/four-in-a-row-game.json +50 -0
- package/src/crew/library/entries/app-types/guess-the-number.json +50 -0
- package/src/crew/library/entries/app-types/habit-tracker.json +52 -0
- package/src/crew/library/entries/app-types/hangman-game.json +50 -0
- package/src/crew/library/entries/app-types/image-filters-canvas.json +49 -0
- package/src/crew/library/entries/app-types/inventory-tracker.json +53 -0
- package/src/crew/library/entries/app-types/kanban-board-app.json +53 -0
- package/src/crew/library/entries/app-types/loan-calculator.json +52 -0
- package/src/crew/library/entries/app-types/markdown-editor-preview.json +47 -0
- package/src/crew/library/entries/app-types/markdown-notes-app.json +53 -0
- package/src/crew/library/entries/app-types/maze-game.json +48 -0
- package/src/crew/library/entries/app-types/memory-card-game.json +52 -0
- package/src/crew/library/entries/app-types/metronome-web-audio.json +51 -0
- package/src/crew/library/entries/app-types/mines-grid-game.json +49 -0
- package/src/crew/library/entries/app-types/month-calendar.json +53 -0
- package/src/crew/library/entries/app-types/music-playlist-player.json +51 -0
- package/src/crew/library/entries/app-types/name-picker-wheel.json +52 -0
- package/src/crew/library/entries/app-types/password-generator.json +48 -0
- package/src/crew/library/entries/app-types/poll-voting.json +50 -0
- package/src/crew/library/entries/app-types/pomodoro-timer.json +54 -0
- package/src/crew/library/entries/app-types/quiz-app.json +53 -0
- package/src/crew/library/entries/app-types/reading-list.json +52 -0
- package/src/crew/library/entries/app-types/recipe-box.json +52 -0
- package/src/crew/library/entries/app-types/rock-paper-scissors.json +50 -0
- package/src/crew/library/entries/app-types/shopping-list.json +50 -0
- package/src/crew/library/entries/app-types/sliding-tiles-merge-game.json +51 -0
- package/src/crew/library/entries/app-types/snake-game.json +50 -0
- package/src/crew/library/entries/app-types/stopwatch-laps.json +50 -0
- package/src/crew/library/entries/app-types/sudoku-game.json +48 -0
- package/src/crew/library/entries/app-types/table-tennis-game.json +47 -0
- package/src/crew/library/entries/app-types/tap-to-fly-game.json +51 -0
- package/src/crew/library/entries/app-types/tic-tac-toe-game.json +49 -0
- package/src/crew/library/entries/app-types/time-tracker.json +51 -0
- package/src/crew/library/entries/app-types/tip-calculator.json +52 -0
- package/src/crew/library/entries/app-types/todo-list-app.json +52 -0
- package/src/crew/library/entries/app-types/typing-speed-test.json +51 -0
- package/src/crew/library/entries/app-types/unit-converter.json +52 -0
- package/src/crew/library/entries/app-types/weather-card-json.json +50 -0
- package/src/crew/library/entries/app-types/whack-a-mole-game.json +52 -0
- package/src/crew/library/entries/app-types/word-guess-game.json +51 -0
- package/src/crew/library/entries/backend/api-docs-markdown-contract.json +41 -0
- package/src/crew/library/entries/backend/api-etag-conditional-requests.json +41 -0
- package/src/crew/library/entries/backend/api-key-quotas-sliding-window.json +41 -0
- package/src/crew/library/entries/backend/api-resource-modeling.json +41 -0
- package/src/crew/library/entries/backend/api-tests-random-port.json +42 -0
- package/src/crew/library/entries/backend/api-versioning-policy.json +41 -0
- package/src/crew/library/entries/backend/config-environments-secret-files.json +41 -0
- package/src/crew/library/entries/backend/cors-policy-decisions.json +40 -0
- package/src/crew/library/entries/backend/health-readiness-endpoints.json +43 -0
- package/src/crew/library/entries/backend/http-error-class-handler.json +42 -0
- package/src/crew/library/entries/backend/in-process-job-queue.json +42 -0
- package/src/crew/library/entries/backend/json-body-reader-limits.json +41 -0
- package/src/crew/library/entries/backend/jwt-token-pitfalls.json +43 -0
- package/src/crew/library/entries/backend/keyset-pagination-filters.json +41 -0
- package/src/crew/library/entries/backend/legacy-password-hash-migration.json +42 -0
- package/src/crew/library/entries/backend/node-http-router-module.json +42 -0
- package/src/crew/library/entries/backend/request-id-async-context.json +40 -0
- package/src/crew/library/entries/backend/role-permission-checks.json +42 -0
- package/src/crew/library/entries/backend/route-input-schemas.json +40 -0
- package/src/crew/library/entries/backend/server-session-store.json +42 -0
- package/src/crew/library/entries/backend/shutdown-order-and-test.json +42 -0
- package/src/crew/library/entries/backend/sql-file-migrations.json +41 -0
- package/src/crew/library/entries/backend/sql-params-transactions.json +41 -0
- package/src/crew/library/entries/backend/upload-stream-to-disk.json +42 -0
- package/src/crew/library/entries/backend/webhook-receiver-hmac.json +42 -0
- package/src/crew/library/entries/data/accessible-chart-fallback.json +39 -0
- package/src/crew/library/entries/data/app-data-model-design.json +38 -0
- package/src/crew/library/entries/data/backup-restore-json.json +37 -0
- package/src/crew/library/entries/data/calendar-heatmap.json +41 -0
- package/src/crew/library/entries/data/csv-export-download.json +38 -0
- package/src/crew/library/entries/data/csv-parse-quoted.json +37 -0
- package/src/crew/library/entries/data/data-cleaning-normalize.json +37 -0
- package/src/crew/library/entries/data/dates-timezones-intl.json +37 -0
- package/src/crew/library/entries/data/dedupe-records.json +36 -0
- package/src/crew/library/entries/data/file-import-json-csv.json +42 -0
- package/src/crew/library/entries/data/form-validation-client.json +39 -0
- package/src/crew/library/entries/data/fuzzy-search-ranking.json +38 -0
- package/src/crew/library/entries/data/haversine-distance.json +39 -0
- package/src/crew/library/entries/data/histogram-binning.json +38 -0
- package/src/crew/library/entries/data/ids-random-uuid.json +36 -0
- package/src/crew/library/entries/data/intl-collator-sorting.json +37 -0
- package/src/crew/library/entries/data/join-merge-datasets.json +37 -0
- package/src/crew/library/entries/data/json-group-transform.json +38 -0
- package/src/crew/library/entries/data/list-search-filter-sort.json +39 -0
- package/src/crew/library/entries/data/localstorage-versioned-state.json +37 -0
- package/src/crew/library/entries/data/log-line-parsing.json +40 -0
- package/src/crew/library/entries/data/markdown-to-html-safe.json +36 -0
- package/src/crew/library/entries/data/money-integer-cents.json +38 -0
- package/src/crew/library/entries/data/nice-axis-ticks.json +36 -0
- package/src/crew/library/entries/data/number-currency-intl.json +37 -0
- package/src/crew/library/entries/data/offline-sync-queue.json +40 -0
- package/src/crew/library/entries/data/paginate-data.json +38 -0
- package/src/crew/library/entries/data/parse-date-strings.json +36 -0
- package/src/crew/library/entries/data/personal-data-minimization.json +41 -0
- package/src/crew/library/entries/data/pubsub-state-store.json +39 -0
- package/src/crew/library/entries/data/realistic-seed-data.json +40 -0
- package/src/crew/library/entries/data/schema-validation-handwritten.json +38 -0
- package/src/crew/library/entries/data/sparkline-inline.json +38 -0
- package/src/crew/library/entries/data/stats-summary-numbers.json +38 -0
- package/src/crew/library/entries/data/svg-bar-chart.json +39 -0
- package/src/crew/library/entries/data/svg-donut-chart.json +38 -0
- package/src/crew/library/entries/data/svg-line-chart.json +39 -0
- package/src/crew/library/entries/data/table-to-chart.json +37 -0
- package/src/crew/library/entries/data/undo-redo-history.json +36 -0
- package/src/crew/library/entries/data/validator-functions.json +37 -0
- package/src/crew/library/entries/design/brand-palette-from-one-color.json +38 -0
- package/src/crew/library/entries/design/breakpoint-strategy.json +38 -0
- package/src/crew/library/entries/design/button-hierarchy.json +38 -0
- package/src/crew/library/entries/design/color-palette-aa.json +39 -0
- package/src/crew/library/entries/design/corner-radius-system.json +35 -0
- package/src/crew/library/entries/design/dark-palette-design.json +37 -0
- package/src/crew/library/entries/design/dataviz-colors.json +37 -0
- package/src/crew/library/entries/design/design-consistency-audit.json +38 -0
- package/src/crew/library/entries/design/design-critique.json +36 -0
- package/src/crew/library/entries/design/design-tokens-css.json +37 -0
- package/src/crew/library/entries/design/elevation-shadows.json +37 -0
- package/src/crew/library/entries/design/error-offline-states-design.json +38 -0
- package/src/crew/library/entries/design/fluid-type-clamp.json +37 -0
- package/src/crew/library/entries/design/font-stack-pairing.json +38 -0
- package/src/crew/library/entries/design/form-design.json +38 -0
- package/src/crew/library/entries/design/header-logo-placement.json +38 -0
- package/src/crew/library/entries/design/icon-usage.json +37 -0
- package/src/crew/library/entries/design/image-aspect-ratio.json +38 -0
- package/src/crew/library/entries/design/layout-auto-fit-grid.json +37 -0
- package/src/crew/library/entries/design/layout-bento-grid.json +37 -0
- package/src/crew/library/entries/design/layout-centered-column.json +37 -0
- package/src/crew/library/entries/design/layout-holy-grail.json +38 -0
- package/src/crew/library/entries/design/layout-magazine.json +37 -0
- package/src/crew/library/entries/design/layout-sidebar-content.json +37 -0
- package/src/crew/library/entries/design/layout-split-hero.json +39 -0
- package/src/crew/library/entries/design/layout-sticky-footer.json +35 -0
- package/src/crew/library/entries/design/line-length-rhythm.json +39 -0
- package/src/crew/library/entries/design/loading-feedback.json +38 -0
- package/src/crew/library/entries/design/micro-interactions.json +38 -0
- package/src/crew/library/entries/design/mobile-nav-patterns.json +38 -0
- package/src/crew/library/entries/design/motion-reduced.json +38 -0
- package/src/crew/library/entries/design/multi-theme.json +38 -0
- package/src/crew/library/entries/design/semantic-color-tokens.json +38 -0
- package/src/crew/library/entries/design/spacing-scale.json +38 -0
- package/src/crew/library/entries/design/style-guide-page.json +40 -0
- package/src/crew/library/entries/design/touch-target-focus.json +36 -0
- package/src/crew/library/entries/design/typography-scale.json +38 -0
- package/src/crew/library/entries/design/ui-microcopy.json +36 -0
- package/src/crew/library/entries/design/visual-direction.json +37 -0
- package/src/crew/library/entries/design/visual-hierarchy.json +37 -0
- package/src/crew/library/entries/design/whitespace-grouping.json +37 -0
- package/src/crew/library/entries/design/wireframe-lofi.json +40 -0
- package/src/crew/library/entries/desktop/desktop-app-security.json +43 -0
- package/src/crew/library/entries/desktop/desktop-auto-update.json +40 -0
- package/src/crew/library/entries/desktop/desktop-background-tasks.json +39 -0
- package/src/crew/library/entries/desktop/desktop-clipboard-integration.json +38 -0
- package/src/crew/library/entries/desktop/desktop-command-palette-registry.json +39 -0
- package/src/crew/library/entries/desktop/desktop-file-drag-drop.json +38 -0
- package/src/crew/library/entries/desktop/desktop-global-hotkeys.json +38 -0
- package/src/crew/library/entries/desktop/desktop-high-dpi-scaling.json +41 -0
- package/src/crew/library/entries/desktop/desktop-keyboard-focus-a11y.json +40 -0
- package/src/crew/library/entries/desktop/desktop-local-logs-crash-reports.json +40 -0
- package/src/crew/library/entries/desktop/desktop-localization.json +40 -0
- package/src/crew/library/entries/desktop/desktop-menus-shortcuts.json +40 -0
- package/src/crew/library/entries/desktop/desktop-offline-local-data.json +40 -0
- package/src/crew/library/entries/desktop/desktop-open-save-dialogs.json +39 -0
- package/src/crew/library/entries/desktop/desktop-os-theme-follow.json +40 -0
- package/src/crew/library/entries/desktop/desktop-packaging-installers.json +42 -0
- package/src/crew/library/entries/desktop/desktop-print-pdf-export.json +39 -0
- package/src/crew/library/entries/desktop/desktop-safe-file-writes.json +40 -0
- package/src/crew/library/entries/desktop/desktop-settings-user-data.json +38 -0
- package/src/crew/library/entries/desktop/desktop-single-instance-windows.json +38 -0
- package/src/crew/library/entries/desktop/desktop-testing-node-test.json +39 -0
- package/src/crew/library/entries/desktop/desktop-tray-notifications.json +38 -0
- package/src/crew/library/entries/desktop/desktop-web-app-migration.json +41 -0
- package/src/crew/library/entries/desktop/desktop-window-state.json +38 -0
- package/src/crew/library/entries/desktop/neutralino-app-setup.json +39 -0
- package/src/crew/library/entries/devops/backup-restore-drill.json +41 -0
- package/src/crew/library/entries/devops/ci-matrix-os-runtime.json +38 -0
- package/src/crew/library/entries/devops/ci-secrets-environments.json +39 -0
- package/src/crew/library/entries/devops/ci-test-workflow.json +39 -0
- package/src/crew/library/entries/devops/compose-app-database.json +39 -0
- package/src/crew/library/entries/devops/containerfile-python-script.json +41 -0
- package/src/crew/library/entries/devops/cron-scheduled-tasks.json +38 -0
- package/src/crew/library/entries/devops/dependency-update-routine.json +39 -0
- package/src/crew/library/entries/devops/deploy-rollback-plan.json +39 -0
- package/src/crew/library/entries/devops/deploy-script-gotchas.json +39 -0
- package/src/crew/library/entries/devops/dockerfile-node-service.json +41 -0
- package/src/crew/library/entries/devops/dockerignore-small-images.json +37 -0
- package/src/crew/library/entries/devops/healthcheck-restart-policy.json +40 -0
- package/src/crew/library/entries/devops/incident-runbook.json +40 -0
- package/src/crew/library/entries/devops/infrastructure-as-code-basics.json +39 -0
- package/src/crew/library/entries/devops/log-rotation-setup.json +38 -0
- package/src/crew/library/entries/devops/make-targets-ci-parity.json +39 -0
- package/src/crew/library/entries/devops/release-pipeline-tags.json +38 -0
- package/src/crew/library/entries/devops/reverse-proxy-node-app.json +41 -0
- package/src/crew/library/entries/devops/semver-bump-decision.json +39 -0
- package/src/crew/library/entries/devops/static-site-deploy.json +38 -0
- package/src/crew/library/entries/devops/systemd-unit-hardening.json +38 -0
- package/src/crew/library/entries/devops/tls-certificate-renewal.json +39 -0
- package/src/crew/library/entries/devops/uptime-check-monitoring.json +38 -0
- package/src/crew/library/entries/devops/zero-downtime-deploy-systemd.json +38 -0
- package/src/crew/library/entries/games/arcade-physics-velocity-gravity.json +37 -0
- package/src/crew/library/entries/games/auto-pause-blur-visibility.json +36 -0
- package/src/crew/library/entries/games/camera-follow-scrolling.json +37 -0
- package/src/crew/library/entries/games/canvas-game-profiling.json +39 -0
- package/src/crew/library/entries/games/card-deck-shuffle-rules.json +38 -0
- package/src/crew/library/entries/games/collision-aabb-circle.json +38 -0
- package/src/crew/library/entries/games/difficulty-curve-wave-spawner.json +39 -0
- package/src/crew/library/entries/games/fixed-timestep-game-loop.json +37 -0
- package/src/crew/library/entries/games/game-audio-unlock-mixer.json +39 -0
- package/src/crew/library/entries/games/game-hud-accessibility.json +42 -0
- package/src/crew/library/entries/games/game-scene-state-machine.json +38 -0
- package/src/crew/library/entries/games/grid-pathfinding-a-star.json +38 -0
- package/src/crew/library/entries/games/high-score-table-storage.json +40 -0
- package/src/crew/library/entries/games/input-action-mapping-gamepad.json +37 -0
- package/src/crew/library/entries/games/local-multiplayer-hot-seat.json +39 -0
- package/src/crew/library/entries/games/offline-game-pwa.json +40 -0
- package/src/crew/library/entries/games/particle-effects-budget.json +38 -0
- package/src/crew/library/entries/games/platformer-jump-feel.json +38 -0
- package/src/crew/library/entries/games/puzzle-undo-move-stack.json +38 -0
- package/src/crew/library/entries/games/seeded-procedural-generation.json +38 -0
- package/src/crew/library/entries/games/sprite-sheet-animation.json +38 -0
- package/src/crew/library/entries/games/tile-map-json-levels.json +40 -0
- package/src/crew/library/entries/games/top-down-shooter-basics.json +39 -0
- package/src/crew/library/entries/games/turn-based-rules-engine-tests.json +39 -0
- package/src/crew/library/entries/games/virtual-joystick-touch-controls.json +40 -0
- package/src/crew/library/entries/git-docs/api-reference-docs.json +39 -0
- package/src/crew/library/entries/git-docs/architecture-decision-record.json +39 -0
- package/src/crew/library/entries/git-docs/atomic-commits.json +36 -0
- package/src/crew/library/entries/git-docs/branching-workflow.json +38 -0
- package/src/crew/library/entries/git-docs/bug-report.json +38 -0
- package/src/crew/library/entries/git-docs/changelog-entry.json +37 -0
- package/src/crew/library/entries/git-docs/cli-help-text.json +38 -0
- package/src/crew/library/entries/git-docs/code-comments.json +37 -0
- package/src/crew/library/entries/git-docs/commit-message.json +36 -0
- package/src/crew/library/entries/git-docs/config-reference-docs.json +40 -0
- package/src/crew/library/entries/git-docs/contributing-guide.json +40 -0
- package/src/crew/library/entries/git-docs/docstrings-public-api.json +38 -0
- package/src/crew/library/entries/git-docs/faq-doc.json +36 -0
- package/src/crew/library/entries/git-docs/feature-request.json +37 -0
- package/src/crew/library/entries/git-docs/getting-started-tutorial.json +39 -0
- package/src/crew/library/entries/git-docs/git-bisect.json +38 -0
- package/src/crew/library/entries/git-docs/git-recover-mistakes.json +36 -0
- package/src/crew/library/entries/git-docs/gitignore-setup.json +35 -0
- package/src/crew/library/entries/git-docs/license-options.json +36 -0
- package/src/crew/library/entries/git-docs/merge-conflicts.json +38 -0
- package/src/crew/library/entries/git-docs/migration-guide.json +39 -0
- package/src/crew/library/entries/git-docs/pr-description.json +37 -0
- package/src/crew/library/entries/git-docs/readme-cli.json +39 -0
- package/src/crew/library/entries/git-docs/readme-library-api.json +40 -0
- package/src/crew/library/entries/git-docs/readme-project.json +40 -0
- package/src/crew/library/entries/git-docs/release-notes.json +37 -0
- package/src/crew/library/entries/git-docs/release-tag-semver.json +37 -0
- package/src/crew/library/entries/git-docs/review-reply.json +35 -0
- package/src/crew/library/entries/git-docs/security-policy.json +37 -0
- package/src/crew/library/entries/git-docs/troubleshooting-guide.json +38 -0
- package/src/crew/library/entries/mobile/capacitor-camera-geolocation-plugins.json +39 -0
- package/src/crew/library/entries/mobile/capacitor-project-setup.json +42 -0
- package/src/crew/library/entries/mobile/mobile-app-lifecycle-events.json +39 -0
- package/src/crew/library/entries/mobile/mobile-auth-secure-token-storage.json +41 -0
- package/src/crew/library/entries/mobile/mobile-camera-photo-upload.json +40 -0
- package/src/crew/library/entries/mobile/mobile-deep-links-app-links.json +41 -0
- package/src/crew/library/entries/mobile/mobile-form-keyboards-autofill.json +41 -0
- package/src/crew/library/entries/mobile/mobile-haptics-vibration.json +39 -0
- package/src/crew/library/entries/mobile/mobile-indexeddb-storage-wrapper.json +39 -0
- package/src/crew/library/entries/mobile/mobile-manifest-icon-set.json +41 -0
- package/src/crew/library/entries/mobile/mobile-media-for-phones.json +41 -0
- package/src/crew/library/entries/mobile/mobile-offline-cache-strategies.json +40 -0
- package/src/crew/library/entries/mobile/mobile-offline-location-maps.json +41 -0
- package/src/crew/library/entries/mobile/mobile-outbox-resume-sync.json +41 -0
- package/src/crew/library/entries/mobile/mobile-push-notifications-limits.json +40 -0
- package/src/crew/library/entries/mobile/mobile-pwa-app-shell.json +41 -0
- package/src/crew/library/entries/mobile/mobile-safe-area-insets.json +41 -0
- package/src/crew/library/entries/mobile/mobile-small-screen-device-testing.json +39 -0
- package/src/crew/library/entries/mobile/mobile-startup-performance-budget.json +41 -0
- package/src/crew/library/entries/mobile/mobile-store-release-checklist.json +41 -0
- package/src/crew/library/entries/mobile/mobile-system-theme-bars.json +40 -0
- package/src/crew/library/entries/mobile/mobile-tab-bar-back-button.json +40 -0
- package/src/crew/library/entries/mobile/mobile-touch-gestures.json +40 -0
- package/src/crew/library/entries/mobile/mobile-touch-screen-reader-a11y.json +41 -0
- package/src/crew/library/entries/mobile/mobile-web-bundle-versioning.json +40 -0
- package/src/crew/library/entries/planning/acceptance-criteria.json +34 -0
- package/src/crew/library/entries/planning/change-request-midjob.json +34 -0
- package/src/crew/library/entries/planning/clarifying-questions.json +34 -0
- package/src/crew/library/entries/planning/decision-log.json +35 -0
- package/src/crew/library/entries/planning/definition-of-done.json +33 -0
- package/src/crew/library/entries/planning/estimate-tasks.json +35 -0
- package/src/crew/library/entries/planning/identify-risks.json +34 -0
- package/src/crew/library/entries/planning/milestones.json +34 -0
- package/src/crew/library/entries/planning/one-task-per-file.json +33 -0
- package/src/crew/library/entries/planning/order-by-dependencies.json +33 -0
- package/src/crew/library/entries/planning/plan-accessibility.json +34 -0
- package/src/crew/library/entries/planning/plan-browser-game.json +35 -0
- package/src/crew/library/entries/planning/plan-bug-investigation.json +36 -0
- package/src/crew/library/entries/planning/plan-data-migration.json +35 -0
- package/src/crew/library/entries/planning/plan-documentation.json +34 -0
- package/src/crew/library/entries/planning/plan-for-small-models.json +34 -0
- package/src/crew/library/entries/planning/plan-multi-page-site.json +34 -0
- package/src/crew/library/entries/planning/plan-safe-refactor.json +34 -0
- package/src/crew/library/entries/planning/plan-small-api.json +34 -0
- package/src/crew/library/entries/planning/plan-tests.json +34 -0
- package/src/crew/library/entries/planning/prioritize-must-should-could.json +34 -0
- package/src/crew/library/entries/planning/recover-failed-task.json +36 -0
- package/src/crew/library/entries/planning/requirements-from-conversation.json +34 -0
- package/src/crew/library/entries/planning/review-plan-before-work.json +35 -0
- package/src/crew/library/entries/planning/scope-first-version.json +34 -0
- package/src/crew/library/entries/planning/split-into-tasks.json +35 -0
- package/src/crew/library/entries/planning/staff-the-crew.json +35 -0
- package/src/crew/library/entries/planning/success-measures.json +34 -0
- package/src/crew/library/entries/planning/timebox-work.json +33 -0
- package/src/crew/library/entries/planning/tradeoff-table.json +33 -0
- package/src/crew/library/entries/planning/user-stories.json +34 -0
- package/src/crew/library/entries/planning/vague-request-assumptions.json +33 -0
- package/src/crew/library/entries/practices/accessibility-audit.json +43 -0
- package/src/crew/library/entries/practices/accessible-names-labels.json +40 -0
- package/src/crew/library/entries/practices/add-jsdoc-types.json +36 -0
- package/src/crew/library/entries/practices/add-unit-tests.json +38 -0
- package/src/crew/library/entries/practices/algorithm-performance.json +38 -0
- package/src/crew/library/entries/practices/api-error-format.json +37 -0
- package/src/crew/library/entries/practices/async-race-condition.json +37 -0
- package/src/crew/library/entries/practices/boundary-validation.json +38 -0
- package/src/crew/library/entries/practices/bug-fix-from-error.json +39 -0
- package/src/crew/library/entries/practices/clean-console-warnings.json +38 -0
- package/src/crew/library/entries/practices/color-contrast-fix.json +38 -0
- package/src/crew/library/entries/practices/config-management.json +39 -0
- package/src/crew/library/entries/practices/consistent-code-style.json +38 -0
- package/src/crew/library/entries/practices/content-security-policy.json +38 -0
- package/src/crew/library/entries/practices/css-layout-overflow.json +41 -0
- package/src/crew/library/entries/practices/dark-mode.json +39 -0
- package/src/crew/library/entries/practices/data-format-migration.json +37 -0
- package/src/crew/library/entries/practices/debounce-throttle.json +35 -0
- package/src/crew/library/entries/practices/debug-failing-test.json +37 -0
- package/src/crew/library/entries/practices/deprecation-compat.json +37 -0
- package/src/crew/library/entries/practices/dom-batching-reflow.json +36 -0
- package/src/crew/library/entries/practices/edge-case-tests.json +36 -0
- package/src/crew/library/entries/practices/error-handling-strategy.json +38 -0
- package/src/crew/library/entries/practices/event-listener-not-firing.json +34 -0
- package/src/crew/library/entries/practices/feature-flags.json +37 -0
- package/src/crew/library/entries/practices/file-upload-handling.json +39 -0
- package/src/crew/library/entries/practices/focus-management.json +36 -0
- package/src/crew/library/entries/practices/graceful-shutdown.json +36 -0
- package/src/crew/library/entries/practices/http-caching-headers.json +36 -0
- package/src/crew/library/entries/practices/i18n-setup.json +38 -0
- package/src/crew/library/entries/practices/injection-risks.json +37 -0
- package/src/crew/library/entries/practices/keyboard-navigation-fix.json +37 -0
- package/src/crew/library/entries/practices/log-levels-redaction.json +37 -0
- package/src/crew/library/entries/practices/memory-leak-fix.json +36 -0
- package/src/crew/library/entries/practices/minimal-dependencies.json +39 -0
- package/src/crew/library/entries/practices/minimal-reproduction.json +35 -0
- package/src/crew/library/entries/practices/modernize-legacy-js.json +39 -0
- package/src/crew/library/entries/practices/money-float-precision.json +36 -0
- package/src/crew/library/entries/practices/not-a-function-error.json +36 -0
- package/src/crew/library/entries/practices/null-undefined-access.json +35 -0
- package/src/crew/library/entries/practices/off-by-one-errors.json +37 -0
- package/src/crew/library/entries/practices/page-load-performance.json +39 -0
- package/src/crew/library/entries/practices/password-session-basics.json +37 -0
- package/src/crew/library/entries/practices/plurals-number-date-format.json +36 -0
- package/src/crew/library/entries/practices/progressive-enhancement.json +37 -0
- package/src/crew/library/entries/practices/refactor-extract-function.json +35 -0
- package/src/crew/library/entries/practices/remove-dead-code.json +35 -0
- package/src/crew/library/entries/practices/rename-for-clarity.json +35 -0
- package/src/crew/library/entries/practices/responsive-fix-375.json +40 -0
- package/src/crew/library/entries/practices/responsive-images-srcset.json +38 -0
- package/src/crew/library/entries/practices/rest-api-conventions.json +39 -0
- package/src/crew/library/entries/practices/retry-backoff.json +37 -0
- package/src/crew/library/entries/practices/rtl-support.json +37 -0
- package/src/crew/library/entries/practices/secrets-handling.json +37 -0
- package/src/crew/library/entries/practices/security-review-xss.json +40 -0
- package/src/crew/library/entries/practices/seo-basics.json +42 -0
- package/src/crew/library/entries/practices/shared-mutation-bug.json +35 -0
- package/src/crew/library/entries/practices/sitemap-robots.json +38 -0
- package/src/crew/library/entries/practices/split-large-file.json +38 -0
- package/src/crew/library/entries/practices/structured-data-jsonld.json +35 -0
- package/src/crew/library/entries/practices/structured-logging.json +37 -0
- package/src/crew/library/entries/practices/test-dom-logic-split.json +37 -0
- package/src/crew/library/entries/practices/timeouts-abort.json +35 -0
- package/src/crew/library/entries/practices/user-facing-error-messages.json +36 -0
- package/src/crew/library/entries/practices/z-index-stacking.json +36 -0
- package/src/crew/library/entries/review-qa/bug-repro-triage.json +35 -0
- package/src/crew/library/entries/review-qa/cross-browser-standards.json +36 -0
- package/src/crew/library/entries/review-qa/edge-cases-dates-timezones.json +37 -0
- package/src/crew/library/entries/review-qa/edge-cases-empty-huge-data.json +35 -0
- package/src/crew/library/entries/review-qa/edge-cases-inputs.json +34 -0
- package/src/crew/library/entries/review-qa/edge-cases-numbers-money.json +37 -0
- package/src/crew/library/entries/review-qa/edge-cases-unicode.json +37 -0
- package/src/crew/library/entries/review-qa/exploratory-charter.json +35 -0
- package/src/crew/library/entries/review-qa/form-e2e-check.json +37 -0
- package/src/crew/library/entries/review-qa/game-logic-check.json +37 -0
- package/src/crew/library/entries/review-qa/keyboard-only-qa.json +36 -0
- package/src/crew/library/entries/review-qa/link-asset-check.json +36 -0
- package/src/crew/library/entries/review-qa/performance-budget-check.json +37 -0
- package/src/crew/library/entries/review-qa/persistence-reload-check.json +37 -0
- package/src/crew/library/entries/review-qa/regression-checklist.json +35 -0
- package/src/crew/library/entries/review-qa/release-signoff.json +40 -0
- package/src/crew/library/entries/review-qa/responsive-qa-breakpoints.json +37 -0
- package/src/crew/library/entries/review-qa/review-a11y-pass.json +39 -0
- package/src/crew/library/entries/review-qa/review-copy.json +36 -0
- package/src/crew/library/entries/review-qa/review-css.json +39 -0
- package/src/crew/library/entries/review-qa/review-data-migration.json +36 -0
- package/src/crew/library/entries/review-qa/review-dependencies.json +37 -0
- package/src/crew/library/entries/review-qa/review-error-handling.json +37 -0
- package/src/crew/library/entries/review-qa/review-html.json +40 -0
- package/src/crew/library/entries/review-qa/review-i18n.json +37 -0
- package/src/crew/library/entries/review-qa/review-javascript.json +39 -0
- package/src/crew/library/entries/review-qa/review-logging.json +36 -0
- package/src/crew/library/entries/review-qa/review-node-server.json +39 -0
- package/src/crew/library/entries/review-qa/review-performance-pass.json +39 -0
- package/src/crew/library/entries/review-qa/review-pr-scope.json +35 -0
- package/src/crew/library/entries/review-qa/review-python.json +39 -0
- package/src/crew/library/entries/review-qa/review-security-pass.json +39 -0
- package/src/crew/library/entries/review-qa/review-test-quality.json +36 -0
- package/src/crew/library/entries/review-qa/screen-reader-smoke.json +36 -0
- package/src/crew/library/entries/review-qa/severity-triage.json +36 -0
- package/src/crew/library/entries/review-qa/smoke-test-release.json +35 -0
- package/src/crew/library/entries/review-qa/test-plan-api.json +36 -0
- package/src/crew/library/entries/review-qa/test-plan-form.json +35 -0
- package/src/crew/library/entries/review-qa/test-plan-game.json +35 -0
- package/src/crew/library/entries/review-qa/test-plan-web-page.json +35 -0
- package/src/crew/library/entries/review-qa/verify-acceptance-criteria.json +35 -0
- package/src/crew/library/entries/review-qa/visual-qa-spacing.json +36 -0
- package/src/crew/library/entries/roles/architect-architecture-review.json +37 -0
- package/src/crew/library/entries/roles/architect-constraints-check.json +37 -0
- package/src/crew/library/entries/roles/architect-data-flow-sketch.json +38 -0
- package/src/crew/library/entries/roles/architect-interface-contracts.json +38 -0
- package/src/crew/library/entries/roles/architect-static-site-structure.json +37 -0
- package/src/crew/library/entries/roles/designer-design-qa-pass.json +36 -0
- package/src/crew/library/entries/roles/designer-look-from-brief.json +37 -0
- package/src/crew/library/entries/roles/designer-polish-existing-page.json +36 -0
- package/src/crew/library/entries/roles/designer-token-handoff.json +37 -0
- package/src/crew/library/entries/roles/designer-visual-spec.json +37 -0
- package/src/crew/library/entries/roles/developer-few-turns.json +36 -0
- package/src/crew/library/entries/roles/developer-read-before-edit.json +36 -0
- package/src/crew/library/entries/roles/developer-self-check.json +37 -0
- package/src/crew/library/entries/roles/developer-test-mjs.json +38 -0
- package/src/crew/library/entries/roles/developer-unclear-spec.json +35 -0
- package/src/crew/library/entries/roles/ops-backup-rollback.json +36 -0
- package/src/crew/library/entries/roles/ops-environment-check.json +35 -0
- package/src/crew/library/entries/roles/ops-log-triage.json +36 -0
- package/src/crew/library/entries/roles/ops-release-checklist.json +39 -0
- package/src/crew/library/entries/roles/ops-safe-commands.json +35 -0
- package/src/crew/library/entries/roles/qa-automatic-check-results.json +35 -0
- package/src/crew/library/entries/roles/qa-check-acceptance-criteria.json +36 -0
- package/src/crew/library/entries/roles/qa-findings-format.json +34 -0
- package/src/crew/library/entries/roles/qa-recheck-fixes.json +36 -0
- package/src/crew/library/entries/roles/qa-severity-calibration.json +36 -0
- package/src/crew/library/entries/roles/reviewer-constructive-comments.json +34 -0
- package/src/crew/library/entries/roles/reviewer-diff-review.json +36 -0
- package/src/crew/library/entries/roles/reviewer-fix-round.json +36 -0
- package/src/crew/library/entries/roles/reviewer-scope-creep.json +35 -0
- package/src/crew/library/entries/roles/reviewer-verdict-rules.json +35 -0
- package/src/crew/library/entries/roles/writer-copy-from-brief.json +37 -0
- package/src/crew/library/entries/roles/writer-docs-voice.json +36 -0
- package/src/crew/library/entries/roles/writer-edit-for-clarity.json +37 -0
- package/src/crew/library/entries/roles/writer-microcopy.json +39 -0
- package/src/crew/library/entries/roles/writer-translation-ready.json +36 -0
- package/src/crew/library/entries/security/auth-session-review.json +39 -0
- package/src/crew/library/entries/security/command-injection-review.json +39 -0
- package/src/crew/library/entries/security/cookie-flags-audit.json +40 -0
- package/src/crew/library/entries/security/csp-static-site-meta.json +41 -0
- package/src/crew/library/entries/security/csrf-protection.json +41 -0
- package/src/crew/library/entries/security/dependency-advisory-offline.json +41 -0
- package/src/crew/library/entries/security/extension-permission-review.json +41 -0
- package/src/crew/library/entries/security/idor-access-review.json +41 -0
- package/src/crew/library/entries/security/input-validation-review.json +38 -0
- package/src/crew/library/entries/security/log-leak-audit.json +40 -0
- package/src/crew/library/entries/security/password-storage-audit.json +40 -0
- package/src/crew/library/entries/security/path-traversal-review.json +41 -0
- package/src/crew/library/entries/security/secret-scan-rotate.json +40 -0
- package/src/crew/library/entries/security/security-audit-report.json +43 -0
- package/src/crew/library/entries/security/security-fix-triage.json +41 -0
- package/src/crew/library/entries/security/security-headers-checklist.json +40 -0
- package/src/crew/library/entries/security/sql-injection-review.json +40 -0
- package/src/crew/library/entries/security/ssrf-url-fetcher.json +41 -0
- package/src/crew/library/entries/security/threat-model-small-app.json +41 -0
- package/src/crew/library/entries/security/tls-verification-on.json +40 -0
- package/src/crew/library/entries/security/unsafe-deserialization.json +40 -0
- package/src/crew/library/entries/security/upload-attack-review.json +39 -0
- package/src/crew/library/entries/security/weak-crypto-audit.json +40 -0
- package/src/crew/library/entries/security/webview-bridge-hardening.json +42 -0
- package/src/crew/library/entries/security/xss-context-encoding.json +41 -0
- package/src/crew/library/entries/stacks/browser-es-modules.json +40 -0
- package/src/crew/library/entries/stacks/canvas-2d-animation-loop.json +38 -0
- package/src/crew/library/entries/stacks/config-ini-yaml-parsing.json +37 -0
- package/src/crew/library/entries/stacks/css-custom-properties-theme.json +43 -0
- package/src/crew/library/entries/stacks/css-grid-flex-layout.json +43 -0
- package/src/crew/library/entries/stacks/dom-event-delegation.json +39 -0
- package/src/crew/library/entries/stacks/drag-drop-reorder-api.json +38 -0
- package/src/crew/library/entries/stacks/env-config-module.json +38 -0
- package/src/crew/library/entries/stacks/fetch-timeout-abort.json +38 -0
- package/src/crew/library/entries/stacks/geolocation-permission.json +37 -0
- package/src/crew/library/entries/stacks/html-semantic-skeleton.json +51 -0
- package/src/crew/library/entries/stacks/indexeddb-wrapper.json +36 -0
- package/src/crew/library/entries/stacks/intersection-observer-uses.json +36 -0
- package/src/crew/library/entries/stacks/json-file-database.json +40 -0
- package/src/crew/library/entries/stacks/json-schema-format.json +38 -0
- package/src/crew/library/entries/stacks/makefile-task-runner.json +37 -0
- package/src/crew/library/entries/stacks/node-child-process.json +40 -0
- package/src/crew/library/entries/stacks/node-cli-parseargs.json +40 -0
- package/src/crew/library/entries/stacks/node-cors-preflight.json +38 -0
- package/src/crew/library/entries/stacks/node-file-watcher.json +40 -0
- package/src/crew/library/entries/stacks/node-folder-batch-script.json +42 -0
- package/src/crew/library/entries/stacks/node-http-crud-api.json +45 -0
- package/src/crew/library/entries/stacks/node-rate-limit.json +40 -0
- package/src/crew/library/entries/stacks/node-readline-prompts.json +39 -0
- package/src/crew/library/entries/stacks/node-scheduled-jobs.json +39 -0
- package/src/crew/library/entries/stacks/node-server-sent-events.json +39 -0
- package/src/crew/library/entries/stacks/node-static-file-server.json +41 -0
- package/src/crew/library/entries/stacks/node-streams-large-files.json +39 -0
- package/src/crew/library/entries/stacks/node-test-suite.json +40 -0
- package/src/crew/library/entries/stacks/package-json-scripts.json +37 -0
- package/src/crew/library/entries/stacks/password-hashing-scrypt.json +40 -0
- package/src/crew/library/entries/stacks/pwa-manifest-install.json +40 -0
- package/src/crew/library/entries/stacks/python-argparse-cli.json +39 -0
- package/src/crew/library/entries/stacks/python-csv-module.json +41 -0
- package/src/crew/library/entries/stacks/python-dataclasses-models.json +39 -0
- package/src/crew/library/entries/stacks/python-http-server-api.json +38 -0
- package/src/crew/library/entries/stacks/python-logging-setup.json +39 -0
- package/src/crew/library/entries/stacks/python-pathlib-files.json +41 -0
- package/src/crew/library/entries/stacks/python-re-text-processing.json +39 -0
- package/src/crew/library/entries/stacks/python-unittest-suite.json +40 -0
- package/src/crew/library/entries/stacks/python-urllib-client.json +40 -0
- package/src/crew/library/entries/stacks/python-venv-setup-notes.json +42 -0
- package/src/crew/library/entries/stacks/regex-writing-testing.json +37 -0
- package/src/crew/library/entries/stacks/service-worker-offline.json +36 -0
- package/src/crew/library/entries/stacks/shell-script-strict.json +38 -0
- package/src/crew/library/entries/stacks/sql-portable-queries.json +39 -0
- package/src/crew/library/entries/stacks/svg-icons-handwritten.json +39 -0
- package/src/crew/library/entries/stacks/web-audio-sounds.json +37 -0
- package/src/crew/library/entries/stacks/web-component-custom-element.json +38 -0
- package/src/crew/library/entries/stacks/web-worker-offload.json +36 -0
- package/src/crew/library/entries/tools/cli-batch-plan-dry-run.json +38 -0
- package/src/crew/library/entries/tools/cli-color-no-color.json +38 -0
- package/src/crew/library/entries/tools/cli-config-precedence.json +39 -0
- package/src/crew/library/entries/tools/cli-cross-platform-paths.json +38 -0
- package/src/crew/library/entries/tools/cli-exit-codes-stderr.json +39 -0
- package/src/crew/library/entries/tools/cli-help-from-option-table.json +39 -0
- package/src/crew/library/entries/tools/cli-package-bin-shebang.json +40 -0
- package/src/crew/library/entries/tools/cli-progress-output.json +38 -0
- package/src/crew/library/entries/tools/cli-prompts-noninteractive.json +38 -0
- package/src/crew/library/entries/tools/cli-stdin-pipes.json +39 -0
- package/src/crew/library/entries/tools/cli-subcommands-parseargs.json +39 -0
- package/src/crew/library/entries/tools/cli-tests-spawn-binary.json +39 -0
- package/src/crew/library/entries/tools/ext-content-scripts-isolation.json +39 -0
- package/src/crew/library/entries/tools/ext-context-menu-items.json +37 -0
- package/src/crew/library/entries/tools/ext-csp-no-remote-code.json +39 -0
- package/src/crew/library/entries/tools/ext-keyboard-commands.json +37 -0
- package/src/crew/library/entries/tools/ext-logic-node-tests.json +39 -0
- package/src/crew/library/entries/tools/ext-messaging.json +38 -0
- package/src/crew/library/entries/tools/ext-minimal-permissions.json +38 -0
- package/src/crew/library/entries/tools/ext-mv3-skeleton.json +38 -0
- package/src/crew/library/entries/tools/ext-options-page.json +40 -0
- package/src/crew/library/entries/tools/ext-popup-ui.json +41 -0
- package/src/crew/library/entries/tools/ext-storage-quotas.json +39 -0
- package/src/crew/library/entries/tools/ext-store-review-checklist.json +39 -0
- package/src/crew/library/entries/tools/python-cli-argparse-tests.json +40 -0
- package/src/crew/library/entries/ui-components/accordion-disclosure.json +42 -0
- package/src/crew/library/entries/ui-components/alert-banner.json +41 -0
- package/src/crew/library/entries/ui-components/announcement-bar.json +41 -0
- package/src/crew/library/entries/ui-components/avatar-badge.json +40 -0
- package/src/crew/library/entries/ui-components/back-to-top-button.json +38 -0
- package/src/crew/library/entries/ui-components/breadcrumb-trail.json +38 -0
- package/src/crew/library/entries/ui-components/card-grid.json +41 -0
- package/src/crew/library/entries/ui-components/carousel-accessible.json +40 -0
- package/src/crew/library/entries/ui-components/combobox-autocomplete.json +40 -0
- package/src/crew/library/entries/ui-components/command-palette.json +41 -0
- package/src/crew/library/entries/ui-components/comment-thread.json +42 -0
- package/src/crew/library/entries/ui-components/contact-card-vcard.json +41 -0
- package/src/crew/library/entries/ui-components/context-menu.json +37 -0
- package/src/crew/library/entries/ui-components/cookie-consent-banner.json +43 -0
- package/src/crew/library/entries/ui-components/copy-to-clipboard-button.json +38 -0
- package/src/crew/library/entries/ui-components/date-time-inputs.json +39 -0
- package/src/crew/library/entries/ui-components/dropdown-menu-button.json +40 -0
- package/src/crew/library/entries/ui-components/empty-state.json +41 -0
- package/src/crew/library/entries/ui-components/faq-section-jsonld.json +37 -0
- package/src/crew/library/entries/ui-components/file-upload-dropzone.json +42 -0
- package/src/crew/library/entries/ui-components/form-layout-grid.json +42 -0
- package/src/crew/library/entries/ui-components/hero-section.json +43 -0
- package/src/crew/library/entries/ui-components/image-gallery-lightbox.json +41 -0
- package/src/crew/library/entries/ui-components/inline-validation-field.json +44 -0
- package/src/crew/library/entries/ui-components/keyboard-shortcuts-dialog.json +39 -0
- package/src/crew/library/entries/ui-components/load-more-list.json +40 -0
- package/src/crew/library/entries/ui-components/modal-dialog.json +42 -0
- package/src/crew/library/entries/ui-components/multi-step-form-wizard.json +42 -0
- package/src/crew/library/entries/ui-components/navbar-responsive.json +44 -0
- package/src/crew/library/entries/ui-components/notification-center.json +40 -0
- package/src/crew/library/entries/ui-components/off-canvas-drawer.json +42 -0
- package/src/crew/library/entries/ui-components/pagination-nav.json +39 -0
- package/src/crew/library/entries/ui-components/popover-panel.json +39 -0
- package/src/crew/library/entries/ui-components/progress-bar-spinner.json +39 -0
- package/src/crew/library/entries/ui-components/quantity-stepper-input.json +41 -0
- package/src/crew/library/entries/ui-components/radio-cards-checkbox-group.json +40 -0
- package/src/crew/library/entries/ui-components/range-slider-input.json +39 -0
- package/src/crew/library/entries/ui-components/share-button-fallback.json +39 -0
- package/src/crew/library/entries/ui-components/sidebar-nav-collapsible.json +43 -0
- package/src/crew/library/entries/ui-components/site-footer.json +43 -0
- package/src/crew/library/entries/ui-components/skeleton-loader.json +38 -0
- package/src/crew/library/entries/ui-components/sortable-data-table.json +42 -0
- package/src/crew/library/entries/ui-components/star-rating-input.json +39 -0
- package/src/crew/library/entries/ui-components/stats-counter-strip.json +40 -0
- package/src/crew/library/entries/ui-components/sticky-mobile-cta-bar.json +41 -0
- package/src/crew/library/entries/ui-components/tabs-widget.json +41 -0
- package/src/crew/library/entries/ui-components/tag-chips-input.json +42 -0
- package/src/crew/library/entries/ui-components/testimonials-block.json +40 -0
- package/src/crew/library/entries/ui-components/toast-notifications.json +41 -0
- package/src/crew/library/entries/ui-components/toggle-switch.json +38 -0
- package/src/crew/library/entries/ui-components/toolbar-buttons.json +41 -0
- package/src/crew/library/entries/ui-components/tooltip-hint.json +39 -0
- package/src/crew/library/entries/ui-components/tree-view.json +39 -0
- package/src/crew/library/entries/ui-components/vertical-timeline.json +39 -0
- package/src/crew/library/entries/ui-components/video-embed-responsive.json +40 -0
- package/src/crew/library/entries/web-pages/about-page.json +48 -0
- package/src/crew/library/entries/web-pages/agency-services-page.json +49 -0
- package/src/crew/library/entries/web-pages/animal-adoption-site.json +49 -0
- package/src/crew/library/entries/web-pages/app-promo-page.json +49 -0
- package/src/crew/library/entries/web-pages/bakery-site.json +50 -0
- package/src/crew/library/entries/web-pages/band-music-site.json +50 -0
- package/src/crew/library/entries/web-pages/blog-home.json +47 -0
- package/src/crew/library/entries/web-pages/blog-post.json +49 -0
- package/src/crew/library/entries/web-pages/cafe-site.json +49 -0
- package/src/crew/library/entries/web-pages/careers-page.json +47 -0
- package/src/crew/library/entries/web-pages/clinic-site.json +50 -0
- package/src/crew/library/entries/web-pages/community-club-site.json +47 -0
- package/src/crew/library/entries/web-pages/contact-page.json +49 -0
- package/src/crew/library/entries/web-pages/course-page.json +50 -0
- package/src/crew/library/entries/web-pages/docs-site.json +50 -0
- package/src/crew/library/entries/web-pages/event-page.json +50 -0
- package/src/crew/library/entries/web-pages/gym-fitness-site.json +50 -0
- package/src/crew/library/entries/web-pages/help-center-page.json +46 -0
- package/src/crew/library/entries/web-pages/hotel-stay-site.json +51 -0
- package/src/crew/library/entries/web-pages/html-email.json +40 -0
- package/src/crew/library/entries/web-pages/landing-page.json +49 -0
- package/src/crew/library/entries/web-pages/legal-policy-page.json +46 -0
- package/src/crew/library/entries/web-pages/link-in-bio-page.json +47 -0
- package/src/crew/library/entries/web-pages/maintenance-page.json +44 -0
- package/src/crew/library/entries/web-pages/multi-page-site.json +49 -0
- package/src/crew/library/entries/web-pages/newsletter-archive-page.json +49 -0
- package/src/crew/library/entries/web-pages/nonprofit-donation-page.json +50 -0
- package/src/crew/library/entries/web-pages/not-found-404.json +45 -0
- package/src/crew/library/entries/web-pages/one-page-scroll-site.json +47 -0
- package/src/crew/library/entries/web-pages/podcast-site.json +48 -0
- package/src/crew/library/entries/web-pages/portfolio-creative.json +48 -0
- package/src/crew/library/entries/web-pages/portfolio-developer.json +50 -0
- package/src/crew/library/entries/web-pages/pricing-page.json +48 -0
- package/src/crew/library/entries/web-pages/printable-page.json +47 -0
- package/src/crew/library/entries/web-pages/product-detail-page.json +50 -0
- package/src/crew/library/entries/web-pages/product-updates-page.json +45 -0
- package/src/crew/library/entries/web-pages/qr-menu-page.json +47 -0
- package/src/crew/library/entries/web-pages/real-estate-listing.json +51 -0
- package/src/crew/library/entries/web-pages/recipe-page.json +47 -0
- package/src/crew/library/entries/web-pages/restaurant-site.json +50 -0
- package/src/crew/library/entries/web-pages/resume-page.json +48 -0
- package/src/crew/library/entries/web-pages/salon-booking-site.json +52 -0
- package/src/crew/library/entries/web-pages/sign-in-page.json +50 -0
- package/src/crew/library/entries/web-pages/status-page.json +49 -0
- package/src/crew/library/entries/web-pages/store-catalog.json +50 -0
- package/src/crew/library/entries/web-pages/store-locator-page.json +47 -0
- package/src/crew/library/entries/web-pages/thank-you-page.json +46 -0
- package/src/crew/library/entries/web-pages/trades-business-site.json +50 -0
- package/src/crew/library/entries/web-pages/travel-guide-page.json +48 -0
- package/src/crew/library/entries/web-pages/waitlist-page.json +50 -0
- package/src/crew/library/entries/web-pages/wedding-site.json +50 -0
- package/src/crew/library/hook.js +295 -0
- package/src/crew/library/index.js +245 -0
- package/src/crew/library/select.js +366 -0
- package/src/crew/planner.js +17 -12
- package/src/crew/prompts/index.js +10 -4
- package/src/crew/prompts/roles.js +51 -0
- package/src/crew/say.js +41 -0
- package/src/crew/scheduler.js +22 -5
- package/src/crew/talk.js +192 -0
- package/src/crew/worker.js +1 -1
- package/src/crew/workers.js +16 -0
- package/src/demo.js +11 -4
- package/src/doctor.js +6 -1
- package/src/extensions/create.js +3 -1
- package/src/extensions/index.js +11 -5
- package/src/github/git.js +114 -1
- package/src/github/index.js +7 -2
- package/src/index.js +180 -22
- package/src/lend/index.js +44 -4
- package/src/lend/share.js +73 -0
- package/src/p2p/audit.js +147 -0
- package/src/p2p/caps.js +193 -0
- package/src/p2p/city-port.js +92 -0
- package/src/p2p/cli.js +300 -0
- package/src/p2p/compute-link.js +101 -0
- package/src/p2p/doctor.js +233 -0
- package/src/p2p/encoding.js +50 -0
- package/src/p2p/engine.js +268 -0
- package/src/p2p/handshake.js +339 -0
- package/src/p2p/identity.js +195 -0
- package/src/p2p/invites.js +170 -0
- package/src/p2p/keyfile.js +119 -0
- package/src/p2p/messages.js +184 -0
- package/src/p2p/node.js +926 -0
- package/src/p2p/peers.js +209 -0
- package/src/p2p/pool-port.js +119 -0
- package/src/p2p/primitives.js +129 -0
- package/src/p2p/remote-port.js +265 -0
- package/src/p2p/session.js +282 -0
- package/src/p2p/transport/base.js +70 -0
- package/src/p2p/transport/browser-pipe.js +85 -0
- package/src/p2p/transport/index.js +7 -0
- package/src/p2p/transport/inproc.js +57 -0
- package/src/p2p/transport/ws-lan.js +88 -0
- package/src/p2p/workbench-port.js +116 -0
- package/src/phone/hub.js +621 -0
- package/src/phone/index.js +85 -0
- package/src/phone/pipe.js +79 -0
- package/src/phone/port.js +187 -0
- package/src/phone/store.js +123 -0
- package/src/phone/view.js +140 -0
- package/src/profile/index.js +203 -0
- package/src/profile/sanitize.js +39 -0
- package/src/remote/address.js +96 -0
- package/src/remote/clipnative.js +119 -0
- package/src/remote/clipsync.js +412 -0
- package/src/remote/desk.js +874 -0
- package/src/remote/helper.js +126 -0
- package/src/remote/index.js +242 -0
- package/src/remote/keys.js +86 -0
- package/src/remote/policy.js +135 -0
- package/src/remote/port.js +61 -0
- package/src/remote/transfer.js +412 -0
- package/src/remote/types.js +35 -0
- package/src/remote/unattended.js +99 -0
- package/src/remote/x11.js +140 -0
- package/src/replay/reduce.js +24 -3
- package/src/server.js +72 -23
- package/src/tasks/commands.js +46 -0
- package/src/tasks/crew-executor.js +134 -0
- package/src/tasks/engine.js +469 -0
- package/src/tasks/state.js +421 -0
- package/src/tools/approvals.js +1 -1
- package/src/tools/index.js +8 -4
- package/src/tools/run.js +10 -1
- package/src/tools/workspace.js +14 -1
- package/src/voice/catalog.js +111 -0
- package/src/voice/index.js +275 -0
- package/src/voice/piper.js +47 -0
- package/src/voice/reply.js +97 -0
- package/src/voice/store.js +149 -0
- package/src/voice/wav.js +59 -0
- package/src/voice/whisper.js +140 -0
- package/src/workbench/docs.js +185 -0
- package/src/workbench/fs.js +214 -0
- package/src/workbench/glob.js +102 -0
- package/src/workbench/index.js +569 -0
- package/src/workbench/match.js +103 -0
- package/src/workbench/origin.js +85 -0
- package/src/workbench/pty.js +223 -0
- package/src/workbench/scm.js +159 -0
- package/src/workbench/search-worker.js +52 -0
- package/src/workbench/search.js +216 -0
- package/src/workbench/settings.js +131 -0
- package/src/workbench/share.js +228 -0
- package/src/workbench/walk.js +57 -0
- package/themes/mel.hivedesk-theme.json +24 -24
- package/ui/changelog/changelog.css +4 -4
- package/ui/city/activity.js +140 -0
- package/ui/city/city.css +274 -131
- package/ui/city/city.js +260 -90
- package/ui/city/compute.js +272 -0
- package/ui/city/hub.js +91 -0
- package/ui/city/layout.js +5 -5
- package/ui/city/machines.js +135 -0
- package/ui/city/model.js +29 -6
- package/ui/city/onboarding.js +122 -0
- package/ui/city/panels.js +394 -0
- package/ui/city/peers.js +164 -0
- package/ui/city/roles.js +10 -0
- package/ui/city/scene.js +685 -869
- package/ui/city/strings.js +32 -0
- package/ui/css/hive.css +306 -376
- package/ui/css/polish.css +85 -98
- package/ui/css/tokens.css +160 -0
- package/ui/css/voice.css +35 -0
- package/ui/editor/editor.css +17 -17
- package/ui/editor/monaco.js +48 -51
- package/ui/editor/register.js +22 -9
- package/ui/editor/vendor/ts/VENDORED.txt +3 -0
- package/ui/editor/vendor/ts/tsMode.js +20 -0
- package/ui/editor/vendor/ts/tsWorker.js +51328 -0
- package/ui/favicon.svg +1 -1
- package/ui/github/github.css +4 -4
- package/ui/index.html +3 -2
- package/ui/js/actions.js +6 -3
- package/ui/js/art.js +113 -0
- package/ui/js/bees.js +60 -137
- package/ui/js/fx.js +9 -62
- package/ui/js/main.js +28 -0
- package/ui/js/onboarding-gate.js +21 -0
- package/ui/js/store.js +5 -0
- package/ui/js/topbar.js +1 -1
- package/ui/js/tour.js +15 -1
- package/ui/js/voice/audio.js +82 -0
- package/ui/js/voice/capture-worklet.js +25 -0
- package/ui/js/voice/conversation.js +177 -0
- package/ui/js/voice/engines.js +64 -0
- package/ui/js/voice/index.js +587 -164
- package/ui/js/voice/intents.js +21 -3
- package/ui/js/voice/mic.js +69 -0
- package/ui/js/voice/questions.js +110 -0
- package/ui/js/voice/sentences.js +59 -0
- package/ui/js/voice/session.js +222 -21
- package/ui/js/voice/speaker.js +129 -0
- package/ui/js/voice/turn.js +107 -0
- package/ui/js/voice/vad.js +70 -0
- package/ui/js/voice/wake.js +41 -0
- package/ui/js/widgets/activity.js +66 -0
- package/ui/js/widgets/brief.js +9 -6
- package/ui/js/widgets/chat.js +43 -7
- package/ui/js/widgets/library-strings.js +173 -0
- package/ui/js/widgets/library-used.js +118 -0
- package/ui/js/widgets/library.js +143 -0
- package/ui/js/widgets/machines.js +31 -0
- package/ui/js/widgets/providers.js +1 -1
- package/ui/js/widgets/question.js +295 -0
- package/ui/js/widgets/settings.js +14 -1
- package/ui/lend/core/p2p-pipe.js +213 -0
- package/ui/lend/core/pairing.js +4 -2
- package/ui/lend/index.html +1 -0
- package/ui/lend/join-window.js +9 -0
- package/ui/lend/lend-screen.js +14 -1
- package/ui/lend/lend.css +23 -7
- package/ui/lend/p2p-model.js +103 -0
- package/ui/lend/p2p-screen.js +228 -0
- package/ui/lend/p2p-text.js +86 -0
- package/ui/manifest.webmanifest +2 -2
- package/ui/models/index.js +304 -0
- package/ui/models/models.css +112 -0
- package/ui/models/strings/de.json +232 -0
- package/ui/models/strings/en.json +232 -0
- package/ui/models/strings/es.json +232 -0
- package/ui/models/strings/fr.json +232 -0
- package/ui/models/strings/it.json +232 -0
- package/ui/models/strings/ja.json +232 -0
- package/ui/models/strings/ko.json +232 -0
- package/ui/models/strings/pt-BR.json +232 -0
- package/ui/models/strings/ru.json +232 -0
- package/ui/models/strings/zh-CN.json +232 -0
- package/ui/models/t.js +41 -0
- package/ui/models/window.js +432 -0
- package/ui/office/office.css +89 -91
- package/ui/office/office.js +48 -23
- package/ui/office/popout.js +1 -1
- package/ui/office/scene.js +472 -779
- package/ui/offline.html +5 -5
- package/ui/phone/bridge.js +39 -0
- package/ui/phone/core/client.js +240 -0
- package/ui/phone/core/connect.js +195 -0
- package/ui/phone/core/crypto.js +211 -0
- package/ui/phone/core/grants.js +45 -0
- package/ui/phone/core/handshake.js +353 -0
- package/ui/phone/core/invite.js +55 -0
- package/ui/phone/core/messages.js +85 -0
- package/ui/phone/core/session.js +160 -0
- package/ui/phone/desktop.js +244 -0
- package/ui/phone/phone.css +36 -0
- package/ui/phone/strings.js +45 -0
- package/ui/profile/achievements.js +96 -0
- package/ui/profile/avatars.js +68 -0
- package/ui/profile/profile.css +53 -0
- package/ui/profile/stats.js +148 -0
- package/ui/profile/ui.js +207 -0
- package/ui/remote/abr.js +73 -0
- package/ui/remote/common.js +107 -0
- package/ui/remote/digits.js +20 -0
- package/ui/remote/home.js +148 -0
- package/ui/remote/host.js +259 -0
- package/ui/remote/index.js +107 -0
- package/ui/remote/media.js +180 -0
- package/ui/remote/pipes.js +64 -0
- package/ui/remote/pointer.js +67 -0
- package/ui/remote/remote.css +88 -0
- package/ui/remote/strings.js +173 -0
- package/ui/remote/viewer.js +267 -0
- package/ui/themes/core.js +21 -21
- package/ui/themes/themes.css +19 -19
- package/ui/widget.css +13 -16
- package/ui/widget.html +3 -2
- package/ui/widget.js +2 -2
- package/ui/workbench/commands.js +141 -0
- package/ui/workbench/dialogs.js +107 -0
- package/ui/workbench/editors.js +911 -0
- package/ui/workbench/explorer.js +419 -0
- package/ui/workbench/layout.js +203 -0
- package/ui/workbench/models.js +105 -0
- package/ui/workbench/net.js +26 -0
- package/ui/workbench/problems.js +94 -0
- package/ui/workbench/quick.js +98 -0
- package/ui/workbench/scmview.js +190 -0
- package/ui/workbench/searchview.js +215 -0
- package/ui/workbench/session.js +162 -0
- package/ui/workbench/settingsview.js +89 -0
- package/ui/workbench/strings.js +26 -0
- package/ui/workbench/terminal.js +314 -0
- package/ui/workbench/theme.js +153 -0
- package/ui/workbench/util.js +128 -0
- package/ui/workbench/vendor/xterm/LICENSE +21 -0
- package/ui/workbench/vendor/xterm/VENDORED.txt +3 -0
- package/ui/workbench/vendor/xterm/addon-fit.js +2 -0
- package/ui/workbench/vendor/xterm/xterm.css +218 -0
- package/ui/workbench/vendor/xterm/xterm.js +2 -0
- package/ui/workbench/workbench.css +388 -0
- package/ui/workbench/workbench.js +712 -0
- package/ui/screenshots/city-agent-card-1440.png +0 -0
- package/ui/screenshots/city-agent-card-1920.png +0 -0
- package/ui/screenshots/city-bridge-gpu-borrow-1440.png +0 -0
- package/ui/screenshots/city-bridge-gpu-borrow-1920.png +0 -0
- package/ui/screenshots/city-friend-rising-1440.png +0 -0
- package/ui/screenshots/city-friend-rising-1920.png +0 -0
- package/ui/screenshots/city-overview-1440.png +0 -0
- package/ui/screenshots/city-overview-1920.png +0 -0
- package/ui/screenshots/city-review-room-1440.png +0 -0
- package/ui/screenshots/city-review-room-1920.png +0 -0
- package/ui/screenshots/hive-1440-de.png +0 -0
- package/ui/screenshots/hive-1440-ja.png +0 -0
- package/ui/screenshots/hive-1440-job-running.png +0 -0
- package/ui/screenshots/hive-1440-model-download.png +0 -0
- package/ui/screenshots/hive-1440-pt-BR.png +0 -0
- package/ui/screenshots/hive-1440-tooltip.png +0 -0
- package/ui/screenshots/hive-1440-tour-step1.png +0 -0
- package/ui/screenshots/hive-1440-tour-step5.png +0 -0
- package/ui/screenshots/hive-1920-context-menu.png +0 -0
- package/ui/screenshots/hive-1920-desktop-menu.png +0 -0
- package/ui/screenshots/hive-1920-hire.png +0 -0
- package/ui/screenshots/hive-1920-job-running.png +0 -0
- package/ui/screenshots/hive-1920-palette.png +0 -0
- package/ui/screenshots/hive-1920-replay.png +0 -0
- package/ui/screenshots/hive-375-phone.png +0 -0
- package/ui/screenshots/office-1440-approval.png +0 -0
- package/ui/screenshots/office-1440-celebrate.png +0 -0
- package/ui/screenshots/office-1440-working.png +0 -0
- package/ui/screenshots/office-1920-approval.png +0 -0
- package/ui/screenshots/office-1920-celebrate.png +0 -0
- package/ui/screenshots/office-1920-working.png +0 -0
- package/ui/screenshots/office-widget.png +0 -0
package/ui/city/scene.js
CHANGED
|
@@ -1,23 +1,29 @@
|
|
|
1
|
-
// Hive City: an isometric little
|
|
2
|
-
//
|
|
3
|
-
// towers on their own islands, and bridges
|
|
1
|
+
// Hive City: an isometric little world of floating islands, drawn on one canvas with the Office
|
|
2
|
+
// kit (docs/1.0/DESIGN.md, section 5). Your building shows its rooms as an open architectural
|
|
3
|
+
// model, friend machines rise as towers on their own islands, and bridges carry data between them.
|
|
4
4
|
// Nothing here moves by itself: every walk, construction and glow follows a change in the city
|
|
5
|
-
// state (ui/city/model.js), which only changes from engine events.
|
|
5
|
+
// state (ui/city/model.js), which only changes from engine events. The load ring on a roof core
|
|
6
|
+
// is the measured GPU use (no ring when nothing measured it), the VRAM bar is the measured or
|
|
7
|
+
// reported memory, a bridge streams particles only while a job streams tokens over it, a failed
|
|
8
|
+
// job breaks the deck, a check that sends a task back draws a loop arc, and the Test light shows
|
|
9
|
+
// the last QA verdict. Colors come from the theme tokens through ui/js/art.js.
|
|
6
10
|
|
|
7
11
|
import { beeSvg } from '/js/bees.js';
|
|
8
12
|
import {
|
|
9
|
-
nightFactor, goldenFactor,
|
|
10
|
-
|
|
13
|
+
nightFactor, goldenFactor, roundRect, hexPath, hexScreen, wrap, drawNameTag, drawBubble, drawPill,
|
|
14
|
+
iconCheck, drawNoteIcon, drawParcel,
|
|
11
15
|
} from '/office/scene.js';
|
|
16
|
+
import { artTokens, worldPalette, statusColor, tone, mixHex, shade, alpha, rgb } from '/js/art.js';
|
|
12
17
|
import {
|
|
13
18
|
HOME, FRIEND_R, ROOMS, BUILDING, ENTRANCE, PLAZA, WALK_Z, SEAT_Z, roomCenter, spotFor, hexCorners, friendCenter, bridgeTo,
|
|
14
19
|
bridgePoint, towerOf, roomPath, exitPath, roomAt, CORRIDOR_Y,
|
|
15
20
|
} from './layout.js';
|
|
16
21
|
import { ROOM_COLOR, ROOM_KINDS, borrowOf } from './model.js';
|
|
17
22
|
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
const
|
|
23
|
+
const FRAME_LOG = 240;
|
|
24
|
+
|
|
25
|
+
const FONT = '"Inter","Segoe UI Variable Text","Segoe UI",system-ui,-apple-system,sans-serif';
|
|
26
|
+
const MONO = '"JetBrains Mono","Cascadia Mono","Cascadia Code",ui-monospace,Consolas,monospace';
|
|
21
27
|
const ZK = 1.12;
|
|
22
28
|
const WALL = 2.25;
|
|
23
29
|
const PART = 0.36;
|
|
@@ -32,37 +38,7 @@ const clamp = (v, a = 0, b = 1) => (v < a ? a : v > b ? b : v);
|
|
|
32
38
|
const lerp = (a, b, t) => a + (b - a) * t;
|
|
33
39
|
const easeInOut = (t) => (t < 0.5 ? 4 * t * t * t : 1 - Math.pow(-2 * t + 2, 3) / 2);
|
|
34
40
|
const easeOut = (t) => 1 - Math.pow(1 - t, 3);
|
|
35
|
-
const
|
|
36
|
-
const rnd = (a, b) => a + Math.random() * (b - a);
|
|
37
|
-
const pick = (arr) => arr[(Math.random() * arr.length) | 0];
|
|
38
|
-
const hash = (s) => { let h = 0; for (let i = 0; i < s.length; i++) h = (h * 31 + s.charCodeAt(i)) | 0; return Math.abs(h); };
|
|
39
|
-
|
|
40
|
-
const GLYPHS = {
|
|
41
|
-
design: ['#', 'px', 'rem', 'rgb', 'em', ':root'],
|
|
42
|
-
code: ['{ }', '</>', '=>', '( )', ';', 'fn', '++'],
|
|
43
|
-
review: ['+', '-', 'diff', '?', 'ok'],
|
|
44
|
-
test: ['ok?', 'assert', '==', 'test'],
|
|
45
|
-
ops: ['git', 'push', 'tag', 'v1'],
|
|
46
|
-
library: ['Aa', 'md', 'mem', '...'],
|
|
47
|
-
lobby: ['plan', '1.', '2.', '3.'],
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
/* ---------- day and night ---------- */
|
|
51
|
-
const DAY = {
|
|
52
|
-
grassA: '#A3C463', grassB: '#93B758', grassC: '#B0CD6E', grout: '#7E9E48', lip: '#6F8F3E',
|
|
53
|
-
path: '#EBD5A6', pathEdge: '#C4A675',
|
|
54
|
-
soil: '#7A5636', rockA: '#9A7656', rockB: '#7A5C44', rockC: '#57412F', rockD: '#3E2E22',
|
|
55
|
-
plinthTop: '#DCCAA6', plinthL: '#B69E78', plinthR: '#9D8562',
|
|
56
|
-
wallL: '#F0E3C9', wallR: '#E6D6B8', trim: '#7A5636', comb: '#C9A979',
|
|
57
|
-
floorA: '#8C6743', floorB: '#835F3D', floorC: '#946E48', grout2: '#634629', corridor: '#A88456',
|
|
58
|
-
deskTop: '#ECD6AA', deskL: '#D2B07A', deskR: '#B99560', panel: '#94724A',
|
|
59
|
-
part: '#EADBBF', partL: '#CDB993', partR: '#B8A37C',
|
|
60
|
-
deck: '#C79A62', deckB: '#B88B55', deckSide: '#7E5A36', rail: '#6B4A2C',
|
|
61
|
-
tree: '#6FA65A', treeB: '#5A8F4A', treeC: '#83B866', trunk: '#7A5636',
|
|
62
|
-
tower: '#E9DCC2', towerL: '#CDBB98', towerR: '#B6A27E',
|
|
63
|
-
};
|
|
64
|
-
const NIGHT_TINT = '#131A2E';
|
|
65
|
-
const DUSK_TINT = '#FF9A55';
|
|
41
|
+
const roomColor = (k) => tone(ROOM_COLOR[k] || '#8A919B', 0.28);
|
|
66
42
|
|
|
67
43
|
export class CityScene {
|
|
68
44
|
/**
|
|
@@ -99,8 +75,7 @@ export class CityScene {
|
|
|
99
75
|
this.hits = [];
|
|
100
76
|
this.machineHits = [];
|
|
101
77
|
this.synced = false;
|
|
102
|
-
this.stars = Array.from({ length:
|
|
103
|
-
this.clouds = Array.from({ length: 14 }, (_, i) => ({ x: ((i * 397) % 1000) / 1000, y: 0.08 + ((i * 211) % 1000) / 1000 * 0.5, s: 0.6 + ((i * 53) % 10) / 12, v: 0.004 + ((i * 17) % 7) / 1400 }));
|
|
78
|
+
this.stars = Array.from({ length: 60 }, (_, i) => ({ x: ((i * 7919) % 1000) / 1000, y: ((i * 4157) % 1000) / 1000, r: 0.5 + ((i * 13) % 5) / 8 }));
|
|
104
79
|
this.palAt = -1;
|
|
105
80
|
this.buildPaths();
|
|
106
81
|
}
|
|
@@ -138,19 +113,42 @@ export class CityScene {
|
|
|
138
113
|
const calm = this.isCalm();
|
|
139
114
|
if (calm && ts - this.lastDraw < 1000 / 30 - 2) return;
|
|
140
115
|
const dt = Math.min(0.1, (ts - this.last) / 1000);
|
|
116
|
+
const gap = ts - this.last;
|
|
141
117
|
this.last = ts;
|
|
142
118
|
this.lastDraw = ts;
|
|
143
119
|
this.now += dt;
|
|
120
|
+
const t0 = performance.now();
|
|
144
121
|
this.update(dt);
|
|
145
122
|
this.draw();
|
|
146
123
|
this.opts.onFrame?.(this);
|
|
124
|
+
const log = this.frames || (this.frames = []);
|
|
125
|
+
log.push({ gap, work: performance.now() - t0, calm });
|
|
126
|
+
if (log.length > FRAME_LOG) log.splice(0, log.length - FRAME_LOG);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/** Frame statistics of the last frames: the interval between frames and the work of one frame, in ms. */
|
|
130
|
+
perf() {
|
|
131
|
+
const log = (this.frames || []).filter((f) => !f.calm);
|
|
132
|
+
if (!log.length) return { frames: 0 };
|
|
133
|
+
const q = (arr, k) => { const a = [...arr].sort((x, y) => x - y); return Math.round(a[Math.min(a.length - 1, Math.floor(a.length * k))] * 10) / 10; };
|
|
134
|
+
const gaps = log.map((f) => f.gap); const work = log.map((f) => f.work);
|
|
135
|
+
return { frames: log.length, fps: Math.round(1000 / (gaps.reduce((a, b) => a + b, 0) / gaps.length)), gapP50: q(gaps, 0.5), gapP95: q(gaps, 0.95), workP50: q(work, 0.5), workP95: q(work, 0.95), w: this.w, h: this.h, dpr: this.dpr };
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/** Forgets the buildings, bees and notes on screen, for another city (a friend's, or back home). */
|
|
139
|
+
reset() {
|
|
140
|
+
this.actors.clear(); this.machines.clear(); this.notes.clear(); this.couriers = []; this.parts = [];
|
|
141
|
+
this.trafficSeen = new Set(); this.synced = false; this.focus = null; this.highlight = null; this.camSet = false;
|
|
142
|
+
if (this.w) this.fit(true);
|
|
147
143
|
}
|
|
148
144
|
|
|
149
145
|
isCalm() {
|
|
150
146
|
if (this.parts.length || this.couriers.length) return false;
|
|
151
147
|
if (Math.abs(this.cam.A - this.camT.A) > 0.05 || Math.abs(this.cam.x - this.camT.x) > 0.01 || Math.abs(this.cam.y - this.camT.y) > 0.01) return false;
|
|
152
|
-
for (const a of this.actors.values()) if (a.path.length || a.mode === 'working') return false;
|
|
153
|
-
for (const m of this.machines.values()) if (this.now - m.born < 6) return false;
|
|
148
|
+
for (const a of this.actors.values()) if (a.path.length || a.mode === 'working' || a.mode === 'thinking') return false;
|
|
149
|
+
for (const m of this.machines.values()) if (this.now - m.born < 6 || m.m?.bridge?.live || m.m?.bridge?.running) return false;
|
|
150
|
+
const c = this.getCity();
|
|
151
|
+
if (c?.loops?.length || c?.download || c?.qa?.running) return false;
|
|
154
152
|
return true;
|
|
155
153
|
}
|
|
156
154
|
|
|
@@ -205,8 +203,9 @@ export class CityScene {
|
|
|
205
203
|
for (const [x, y] of hexCorners(m.center.x, m.center.y, FRIEND_R)) pts.push([x, y, 0], [x, y, -1.5]);
|
|
206
204
|
pts.push([m.center.x, m.center.y, 9]);
|
|
207
205
|
}
|
|
208
|
-
const narrow = this.w <
|
|
209
|
-
|
|
206
|
+
const narrow = this.w < 760;
|
|
207
|
+
const ins = this.insets;
|
|
208
|
+
this.frame(pts, narrow ? { l: 16, r: 16, t: 120, b: 150 } : ins ? { l: ins.l, r: ins.r, t: ins.t, b: ins.b } : { l: this.w < 1100 ? 30 : 330, r: this.panelRight ? 410 : 40, t: 100, b: 110 }, instant, 46);
|
|
210
209
|
}
|
|
211
210
|
|
|
212
211
|
focusRoom(id, instant = false) {
|
|
@@ -214,8 +213,9 @@ export class CityScene {
|
|
|
214
213
|
if (!r) return;
|
|
215
214
|
this.focus = { kind: 'room', id };
|
|
216
215
|
const pts = [[r.x0, r.y0, 0], [r.x1, r.y0, 0], [r.x1, r.y1, 0], [r.x0, r.y1, 0], [r.x0, r.y0, r.row === 'back' ? WALL + 0.4 : 2.2], [r.x1, r.y0, r.row === 'back' ? WALL + 0.4 : 2.2]];
|
|
217
|
-
const narrow = this.w <
|
|
218
|
-
|
|
216
|
+
const narrow = this.w < 760;
|
|
217
|
+
const ins = this.insets;
|
|
218
|
+
this.frame(pts, narrow ? { l: 16, r: 16, t: 140, b: 260 } : ins ? { l: ins.l + 10, r: ins.r + 10, t: ins.t + 10, b: ins.b + 30 } : { l: 340, r: 420, t: 110, b: 150 }, instant, 170);
|
|
219
219
|
}
|
|
220
220
|
|
|
221
221
|
focusMachine(id, instant = false) {
|
|
@@ -226,7 +226,8 @@ export class CityScene {
|
|
|
226
226
|
const pts = [];
|
|
227
227
|
for (const [x, y] of hexCorners(m.center.x, m.center.y, FRIEND_R)) pts.push([x, y, 0]);
|
|
228
228
|
pts.push([m.center.x, m.center.y, this.towerHeight(m) + 3], [m.bridge.a.x, m.bridge.a.y, 0], [PLAZA.x, PLAZA.y, 0]);
|
|
229
|
-
|
|
229
|
+
const ins = this.insets;
|
|
230
|
+
this.frame(pts, ins ? { l: ins.l + 10, r: ins.r + 10, t: ins.t + 10, b: ins.b + 30 } : { l: 330, r: 420, t: 110, b: 150 }, instant, 60);
|
|
230
231
|
}
|
|
231
232
|
|
|
232
233
|
zoomAt(factor, sx, sy) {
|
|
@@ -269,7 +270,7 @@ export class CityScene {
|
|
|
269
270
|
const center = friendCenter(slot);
|
|
270
271
|
s = { id: m.id, slot, center, bridge: bridgeTo(center), born: first || this.reduced() ? -99 : this.now, glow: 0, m };
|
|
271
272
|
this.machines.set(m.id, s);
|
|
272
|
-
if (!first) { this.sound('build');
|
|
273
|
+
if (!first) { this.sound('build'); if (!this.userMoved && !this.focus) this.later(0.05, () => this.fit()); }
|
|
273
274
|
}
|
|
274
275
|
s.m = m;
|
|
275
276
|
}
|
|
@@ -289,14 +290,13 @@ export class CityScene {
|
|
|
289
290
|
// a walk is never cut short: the newest place waits until the bee arrives and has stayed a moment
|
|
290
291
|
if (a.placeKey !== place.key) { if (a.path.length || this.now < (a.dwellUntil || 0)) a.next = place; else this.walk(a, place); }
|
|
291
292
|
else a.next = null;
|
|
292
|
-
|
|
293
|
-
else if (ag.xp > a.xp && ag.level === a.level) this.label(a, this.t('city.fx.xp', { n: ag.xp - a.xp }), '#BFE3C6', 1.1);
|
|
293
|
+
// a new level is a quiet badge in the tag, never a burst
|
|
294
294
|
if (a.status !== ag.status && ag.status === 'idle' && a.status !== 'idle') a.idleSince = this.now;
|
|
295
295
|
}
|
|
296
296
|
a.level = ag.level; a.xp = ag.xp; a.status = ag.status;
|
|
297
297
|
}
|
|
298
298
|
for (const [id, a] of this.actors) if (!seenA.has(id) && !a.leaving) this.retire(a);
|
|
299
|
-
// tasks:
|
|
299
|
+
// tasks: cards on the room boards, flying when they change room
|
|
300
300
|
const seenT = new Set();
|
|
301
301
|
for (const t of Object.values(c.tasks)) {
|
|
302
302
|
seenT.add(t.id);
|
|
@@ -307,14 +307,14 @@ export class CityScene {
|
|
|
307
307
|
const from = this.notePos(n);
|
|
308
308
|
n.room = room;
|
|
309
309
|
n.fly = { from, t0: this.now };
|
|
310
|
-
if (t.status === 'done') { const a = t.assignee && this.actors.get(t.assignee); if (a)
|
|
310
|
+
if (t.status === 'done') { const a = t.assignee && this.actors.get(t.assignee); if (a) this.success(a); this.sound('pass'); }
|
|
311
311
|
}
|
|
312
|
-
if (n.t.status !== t.status && t.status === 'done' && n.room === room) { const a = this.actors.get(t.assignee); if (a) this.
|
|
312
|
+
if (n.t.status !== t.status && t.status === 'done' && n.room === room) { const a = this.actors.get(t.assignee); if (a) this.success(a); }
|
|
313
313
|
n.t = t;
|
|
314
314
|
}
|
|
315
315
|
for (const [id, n] of this.notes) if (!seenT.has(id)) { if (!n.gone) n.gone = this.now; if (this.now - n.gone > 0.6) this.notes.delete(id); }
|
|
316
316
|
this.layoutBoards();
|
|
317
|
-
// bridge traffic: tasks and GPU turns travel as
|
|
317
|
+
// bridge traffic: tasks and GPU turns travel as data packets
|
|
318
318
|
for (const tr of c.traffic || []) {
|
|
319
319
|
if (this.trafficSeen.has(tr.id)) continue;
|
|
320
320
|
this.trafficSeen.add(tr.id);
|
|
@@ -325,7 +325,8 @@ export class CityScene {
|
|
|
325
325
|
m.glow = Math.min(1.6, m.glow + 0.7);
|
|
326
326
|
if (this.hostGlow) this.hostGlow.glow = Math.min(1.6, this.hostGlow.glow + 0.5);
|
|
327
327
|
if (this.reduced()) continue;
|
|
328
|
-
|
|
328
|
+
const T = artTokens();
|
|
329
|
+
this.couriers.push({ m, kind: tr.kind, dir: tr.from === c.selfId ? 1 : -1, t0: this.now, dur: tr.kind === 'turn' ? 1.1 : 1.6, color: tr.kind === 'turn' ? T.link : T.accent });
|
|
329
330
|
if (tr.kind === 'turn') this.sound('blip');
|
|
330
331
|
}
|
|
331
332
|
if (this.trafficSeen.size > 400) this.trafficSeen = new Set([...this.trafficSeen].slice(-200));
|
|
@@ -363,8 +364,8 @@ export class CityScene {
|
|
|
363
364
|
const p = this.placePoint(place);
|
|
364
365
|
const a = {
|
|
365
366
|
id: ag.id, ag, placeKey: place.key, place, pos: { x: p.x, y: p.y, z: p.z }, desk: p.desk, path: [], alpha: 1, born: first ? -99 : this.now,
|
|
366
|
-
ph: Math.random() * 6.28,
|
|
367
|
-
|
|
367
|
+
ph: Math.random() * 6.28, level: ag.level, xp: ag.xp, status: ag.status, idleSince: this.now - 30,
|
|
368
|
+
bubble: null, sx: 0, sy: 0, facing: 1,
|
|
368
369
|
};
|
|
369
370
|
// a friend's agent steps out once its building is up
|
|
370
371
|
const mb = place.machine && this.machines.get(place.machine);
|
|
@@ -415,7 +416,6 @@ export class CityScene {
|
|
|
415
416
|
pts[pts.length - 1] = { ...to };
|
|
416
417
|
a.path = pts.map((p) => ({ x: p.x, y: p.y, z: p.z != null ? p.z : WALK_Z, bridge: p.z != null && p !== to }));
|
|
417
418
|
a.path[a.path.length - 1].final = true;
|
|
418
|
-
a.squashAt = this.now;
|
|
419
419
|
this.sound('whoosh');
|
|
420
420
|
}
|
|
421
421
|
|
|
@@ -468,13 +468,13 @@ export class CityScene {
|
|
|
468
468
|
const m = this.machines.get(room.slice(2));
|
|
469
469
|
if (!m) return null;
|
|
470
470
|
const tw = towerOf(m.center);
|
|
471
|
-
return { kind: 'stand', x0: tw.x1 + 0.35, x1: tw.x1 + 2.25, y: tw.y1 + 0.8, z0: 0.5, z1: 1.75, cols: 2, color: m.m?.color || '#
|
|
471
|
+
return { kind: 'stand', x0: tw.x1 + 0.35, x1: tw.x1 + 2.25, y: tw.y1 + 0.8, z0: 0.5, z1: 1.75, cols: 2, color: tone(m.m?.color || '#62B98C') };
|
|
472
472
|
}
|
|
473
473
|
if (!r) return null;
|
|
474
|
-
if (r.row === 'back') return { kind: 'wallR', x0: r.x0 + 0.35, x1: r.x0 + 2.05, y: 0, z0: 0.62, z1: 1.72, cols: 2, color:
|
|
475
|
-
if (room === 'library') return { kind: 'wallL', y0: 5.75, y1: 7.5, x: 0, z0: 0.62, z1: 1.72, cols: 2, color:
|
|
476
|
-
if (room === 'lobby') return { kind: 'stand', x0: 9.2, x1: 11.7, y: 5.9, z0: 0.48, z1: 1.9, cols: 3, color:
|
|
477
|
-
return { kind: 'stand', x0: 12.4, x1: 13.9, y: 5.85, z0: 0.48, z1: 1.55, cols: 2, color:
|
|
474
|
+
if (r.row === 'back') return { kind: 'wallR', x0: r.x0 + 0.35, x1: r.x0 + 2.05, y: 0, z0: 0.62, z1: 1.72, cols: 2, color: roomColor(room) };
|
|
475
|
+
if (room === 'library') return { kind: 'wallL', y0: 5.75, y1: 7.5, x: 0, z0: 0.62, z1: 1.72, cols: 2, color: roomColor(room) };
|
|
476
|
+
if (room === 'lobby') return { kind: 'stand', x0: 9.2, x1: 11.7, y: 5.9, z0: 0.48, z1: 1.9, cols: 3, color: roomColor(room) };
|
|
477
|
+
return { kind: 'stand', x0: 12.4, x1: 13.9, y: 5.85, z0: 0.48, z1: 1.55, cols: 2, color: roomColor(room) };
|
|
478
478
|
}
|
|
479
479
|
|
|
480
480
|
layoutBoards() {
|
|
@@ -504,32 +504,22 @@ export class CityScene {
|
|
|
504
504
|
return { x: bd.x0 + (col + 0.5) * w, y: bd.y + (bd.kind === 'stand' ? -0.06 : 0.02), z: zt };
|
|
505
505
|
}
|
|
506
506
|
|
|
507
|
-
/* ---------- effects ---------- */
|
|
507
|
+
/* ---------- effects: quiet, short, state driven ---------- */
|
|
508
508
|
spawn(p) {
|
|
509
|
-
if (this.reduced()
|
|
510
|
-
if (this.parts.length >
|
|
509
|
+
if (this.reduced()) return;
|
|
510
|
+
if (this.parts.length > 120) this.parts.shift();
|
|
511
511
|
p.age = 0;
|
|
512
512
|
if (p.max == null) p.max = p.life;
|
|
513
513
|
this.parts.push(p);
|
|
514
514
|
}
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
label(a, text, color, life = 1.4) {
|
|
520
|
-
this.spawn({ kind: 'label', x: a.sx + rnd(-6, 6), y: a.sy - 52 * this.k, vy: -22, text, color, life, max: life });
|
|
521
|
-
}
|
|
522
|
-
jar(a) { this.spawn({ kind: 'jarpop', x: a.sx, y: a.sy - 40 * this.k, vy: -30, life: 1.3 }); }
|
|
523
|
-
dust(m) {
|
|
524
|
-
for (let i = 0; i < 26; i++) this.later(rnd(0, 2.8), () => {
|
|
525
|
-
const an = rnd(0, 6.28); const r = rnd(1, FRIEND_R * 0.8);
|
|
526
|
-
const p = this.P(m.center.x + Math.cos(an) * r, m.center.y + Math.sin(an) * r, 0);
|
|
527
|
-
this.spawn({ kind: 'puff', x: p[0], y: p[1], vx: rnd(-20, 20), vy: rnd(-24, -6), life: rnd(0.8, 1.5), size: rnd(6, 14) * this.cam.A / 30 });
|
|
528
|
-
});
|
|
515
|
+
/** A finished task: a check mark over the unit and one short pulse at its feet. */
|
|
516
|
+
success(a) {
|
|
517
|
+
this.spawn({ kind: 'pulse', id: a.id, life: 0.4, max: 0.4 });
|
|
518
|
+
this.spawn({ kind: 'check', id: a.id, life: 1.4, max: 1.4 });
|
|
529
519
|
}
|
|
530
520
|
later(sec, fn) { (this.timers ||= []).push({ at: this.now + sec, fn }); }
|
|
531
521
|
|
|
532
|
-
get k() { return (this.cam.A * 1.
|
|
522
|
+
get k() { return (this.cam.A * 1.5) / 64; }
|
|
533
523
|
|
|
534
524
|
/* ---------- per frame update ---------- */
|
|
535
525
|
update(dt) {
|
|
@@ -554,24 +544,17 @@ export class CityScene {
|
|
|
554
544
|
if (dist <= step) {
|
|
555
545
|
a.pos = { x: to.x, y: to.y, z: to.z };
|
|
556
546
|
a.path.shift();
|
|
557
|
-
if (!a.path.length) { a.
|
|
547
|
+
if (!a.path.length) { a.onDone?.(); a.onDone = null; a.dwellUntil = this.now + (a.place.kind === 'room' && a.ag.taskId ? 2.5 : 0.6); }
|
|
558
548
|
} else {
|
|
559
549
|
a.pos.x += (dx / dist) * step; a.pos.y += (dy / dist) * step; a.pos.z += (dz / dist) * step;
|
|
560
550
|
}
|
|
561
551
|
}
|
|
562
552
|
if (a.next && !a.path.length && this.now >= (a.dwellUntil || 0)) { const nx = a.next; a.next = null; if (nx.key !== a.placeKey) this.walk(a, nx); }
|
|
563
|
-
if (a.born > 0) a.alpha = clamp((this.now - a.born) / 0.
|
|
564
|
-
if (a.leaving) a.alpha = 1 - clamp((this.now - a.leaving - 1.2) /
|
|
553
|
+
if (a.born > 0) a.alpha = clamp((this.now - a.born) / 0.25);
|
|
554
|
+
if (a.leaving) a.alpha = 1 - clamp((this.now - a.leaving - 1.2) / 0.6);
|
|
565
555
|
const st = a.ag.status;
|
|
566
|
-
a.mode = a.path.length ? 'walk' : st === 'working' ? 'working' : st === 'thinking' ? 'thinking' : st === 'waiting' ? 'waiting' : st === 'reviewing' ? 'reviewing' : st === 'testing' ? 'testing' : st === 'sleeping' || st === 'offline' ? 'sleep' :
|
|
556
|
+
a.mode = a.path.length ? 'walk' : st === 'working' ? 'working' : st === 'thinking' ? 'thinking' : st === 'waiting' ? 'waiting' : st === 'reviewing' ? 'reviewing' : st === 'testing' ? 'testing' : st === 'sleeping' || st === 'offline' ? 'sleep' : 'idle'; // only a sleeping or offline agent dozes: an idle one is awake and free
|
|
567
557
|
if (a.place.kind === 'roof' && !a.path.length) a.mode = 'borrow';
|
|
568
|
-
if (!reduced && !a.path.length) {
|
|
569
|
-
if (a.mode === 'working' && this.now > a.nextGlyph && this.cam.A > 16) { this.glyph(a); a.nextGlyph = this.now + rnd(0.18, 0.34); }
|
|
570
|
-
else if (a.mode === 'sleep' && this.now > a.nextZ && this.cam.A > 16) { this.spawn({ kind: 'z', x: a.sx + 10 * this.k, y: a.sy - 20 * this.k, vx: rnd(6, 14), vy: -14, life: 2.2, size: clamp(this.cam.A * 0.32, 9, 17) }); a.nextZ = this.now + 1.2; }
|
|
571
|
-
else if (a.mode === 'testing' && this.now > a.nextGlyph && this.cam.A > 16) { this.spawn({ kind: 'bubble', x: a.sx + rnd(-8, 8) + 26 * this.k, y: a.sy - 46 * this.k, vx: rnd(-6, 6), vy: rnd(-34, -20), life: rnd(0.7, 1.2), size: rnd(1.5, 3.2), color: '#7DC49B' }); a.nextGlyph = this.now + rnd(0.1, 0.22); }
|
|
572
|
-
else if (a.mode === 'borrow' && this.now > a.nextGlyph) { this.spawn({ kind: 'dot', x: a.sx + rnd(-12, 12) * this.k, y: a.sy + rnd(-10, 10) * this.k, vx: rnd(-10, 10), vy: rnd(-40, -20), life: rnd(0.6, 1), size: rnd(1.5, 3), color: '#7FE3FF' }); a.nextGlyph = this.now + 0.12; }
|
|
573
|
-
}
|
|
574
|
-
if (this.now > a.blinkAt + 0.14) a.blinkAt = this.now + rnd(2.2, 5.5);
|
|
575
558
|
if (a.bubble && this.now > a.bubble.until) a.bubble = null;
|
|
576
559
|
}
|
|
577
560
|
for (const m of this.machines.values()) m.glow = Math.max(borrowTo(c, m.id) ? 0.6 : 0, m.glow - dt * 0.35);
|
|
@@ -581,71 +564,44 @@ export class CityScene {
|
|
|
581
564
|
const p = this.parts[i];
|
|
582
565
|
p.age += dt;
|
|
583
566
|
if (p.age >= p.max) { this.parts.splice(i, 1); continue; }
|
|
584
|
-
p.vy = (p.vy || 0) + (p.g || 0) * dt;
|
|
585
|
-
p.x += (p.vx || 0) * dt;
|
|
586
|
-
p.y += (p.vy || 0) * dt;
|
|
587
567
|
}
|
|
588
568
|
}
|
|
589
569
|
|
|
590
|
-
glyph(a) {
|
|
591
|
-
const room = a.place.kind === 'room' ? a.place.room : 'code';
|
|
592
|
-
const base = [a.sx, a.sy - 6 * this.k];
|
|
593
|
-
this.spawn({ kind: 'glyph', x: base[0] + rnd(-16, 16) * this.k, y: base[1] - rnd(0, 6), vx: rnd(-10, 10), vy: rnd(-46, -30), life: rnd(1.1, 1.6), text: pick(GLYPHS[room] || GLYPHS.code), color: a.ag.color, size: clamp(this.cam.A * 0.3, 9, 20) });
|
|
594
|
-
}
|
|
595
|
-
|
|
596
570
|
/* ---------- palette ---------- */
|
|
597
571
|
palette() {
|
|
598
572
|
const h = this.hourFn();
|
|
599
|
-
const
|
|
573
|
+
const T = artTokens();
|
|
574
|
+
const key = `${Math.round(h * 12)}|${T.bg}|${T.accent}|${T.scheme}`;
|
|
600
575
|
if (key === this.palAt && this.pal) return this.pal;
|
|
601
576
|
this.palAt = key;
|
|
602
577
|
const night = nightFactor(h);
|
|
603
578
|
const gold = goldenFactor(h) * (1 - night * 0.6);
|
|
604
|
-
|
|
605
|
-
for (const [k, v] of Object.entries(DAY)) {
|
|
606
|
-
let c = mixHex(v, NIGHT_TINT, night * 0.55);
|
|
607
|
-
if (gold) c = mixHex(c, DUSK_TINT, gold * 0.12);
|
|
608
|
-
out[k] = c;
|
|
609
|
-
}
|
|
610
|
-
const skyTop = mixHex(mixHex('#6FA6D8', '#06091A', night), '#3E3470', gold * 0.75);
|
|
611
|
-
const skyMid = mixHex(mixHex('#A9CDE8', '#121836', night), '#C0627A', gold * 0.6);
|
|
612
|
-
const skyBot = mixHex(mixHex('#E9E6D6', '#1C2245', night), '#F7A65E', gold * 0.85);
|
|
613
|
-
Object.assign(out, { skyTop, skyMid, skyBot });
|
|
614
|
-
this.pal = out;
|
|
579
|
+
this.pal = { ...worldPalette(night), gold, hour: h };
|
|
615
580
|
this.skyGrad = null;
|
|
616
|
-
return
|
|
581
|
+
return this.pal;
|
|
617
582
|
}
|
|
618
583
|
|
|
619
584
|
buildPaths() {
|
|
620
|
-
// hexagon
|
|
585
|
+
// hexagon grids around the origin: hairlines only (the honeycomb stays, quietly)
|
|
621
586
|
const mk = (r, span) => {
|
|
622
587
|
const hw = Math.sqrt(3) * r; const vh = 1.5 * r;
|
|
623
|
-
const fill = [new Path2D(), new Path2D(), new Path2D()];
|
|
624
588
|
const grout = new Path2D();
|
|
589
|
+
const alt = new Path2D();
|
|
625
590
|
for (let row = -Math.ceil(span / vh) - 1; row * vh < span + r; row++) {
|
|
626
591
|
for (let col = -Math.ceil(span / hw) - 1; col * hw < span + hw; col++) {
|
|
627
592
|
const cx = col * hw + (row & 1 ? hw / 2 : 0); const cy = row * vh;
|
|
628
593
|
const q = col - (row - (row & 1)) / 2;
|
|
629
|
-
const idx = (((q - row) % 3) + 3) % 3;
|
|
630
594
|
const p = new Path2D();
|
|
631
595
|
for (let i = 0; i < 6; i++) { const an = (Math.PI / 180) * (60 * i - 30); const px = cx + r * Math.cos(an); const py = cy + r * Math.sin(an); if (i === 0) p.moveTo(px, py); else p.lineTo(px, py); }
|
|
632
596
|
p.closePath();
|
|
633
|
-
|
|
597
|
+
grout.addPath(p);
|
|
598
|
+
if ((((q - row) % 3) + 3) % 3 === 0) alt.addPath(p);
|
|
634
599
|
}
|
|
635
600
|
}
|
|
636
|
-
return {
|
|
601
|
+
return { grout, alt };
|
|
637
602
|
};
|
|
638
603
|
this.grassTiles = mk(0.95, 16);
|
|
639
604
|
this.floorTiles = mk(0.42, 18);
|
|
640
|
-
const comb = new Path2D(); const wr = 0.2; const whw = Math.sqrt(3) * wr;
|
|
641
|
-
for (let row = 0; row * 1.5 * wr < WALL + 0.3; row++) {
|
|
642
|
-
for (let col = -1; col * whw < 18; col++) {
|
|
643
|
-
const cx = col * whw + (row & 1 ? whw / 2 : 0); const cy = row * 1.5 * wr;
|
|
644
|
-
for (let i = 0; i < 6; i++) { const an = (Math.PI / 180) * (60 * i - 30); const px = cx + wr * 0.9 * Math.cos(an); const py = cy + wr * 0.9 * Math.sin(an); if (i === 0) comb.moveTo(px, py); else comb.lineTo(px, py); }
|
|
645
|
-
comb.closePath();
|
|
646
|
-
}
|
|
647
|
-
}
|
|
648
|
-
this.comb = comb;
|
|
649
605
|
}
|
|
650
606
|
|
|
651
607
|
/* ---------- transforms ---------- */
|
|
@@ -666,22 +622,24 @@ export class CityScene {
|
|
|
666
622
|
if (stroke) { ctx.strokeStyle = stroke; ctx.lineWidth = lw; ctx.stroke(); }
|
|
667
623
|
}
|
|
668
624
|
|
|
669
|
-
box(x, y, z, dx, dy, dz, top, left, right, edge = 'rgba(
|
|
625
|
+
box(x, y, z, dx, dy, dz, top, left, right, edge = 'rgba(0,0,0,.22)') {
|
|
670
626
|
const P = (X, Y, Z) => this.P(X, Y, Z);
|
|
671
627
|
this.poly([P(x, y + dy, z), P(x + dx, y + dy, z), P(x + dx, y + dy, z + dz), P(x, y + dy, z + dz)], left, edge);
|
|
672
628
|
this.poly([P(x + dx, y, z), P(x + dx, y + dy, z), P(x + dx, y + dy, z + dz), P(x + dx, y, z + dz)], right, edge);
|
|
673
629
|
this.poly([P(x, y, z + dz), P(x + dx, y, z + dz), P(x + dx, y + dy, z + dz), P(x, y + dy, z + dz)], top, edge);
|
|
674
630
|
}
|
|
675
631
|
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
const
|
|
679
|
-
const [
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
632
|
+
/** A hexagon prism (flat top in the world plane), drawn with its three faces toward the viewer. */
|
|
633
|
+
hexPrism(x, y, z, r, hgt, top, left, right, edge = null) {
|
|
634
|
+
const ring = [];
|
|
635
|
+
for (let i = 0; i < 6; i++) { const an = (Math.PI / 3) * i + Math.PI / 6; ring.push([x + r * Math.cos(an), y + r * Math.sin(an)]); }
|
|
636
|
+
for (let i = 0; i < 6; i++) {
|
|
637
|
+
const p = ring[i]; const q = ring[(i + 1) % 6];
|
|
638
|
+
const nx = (p[0] + q[0]) / 2 - x; const ny = (p[1] + q[1]) / 2 - y;
|
|
639
|
+
if (nx + ny <= 0.01) continue;
|
|
640
|
+
this.poly([this.P(p[0], p[1], z), this.P(q[0], q[1], z), this.P(q[0], q[1], z + hgt), this.P(p[0], p[1], z + hgt)], nx > ny ? right : left, edge);
|
|
641
|
+
}
|
|
642
|
+
this.poly(ring.map((p) => this.P(p[0], p[1], z + hgt)), top, edge);
|
|
685
643
|
}
|
|
686
644
|
|
|
687
645
|
/** True when a world box is (partly) on screen. */
|
|
@@ -695,20 +653,20 @@ export class CityScene {
|
|
|
695
653
|
/* ---------- drawing ---------- */
|
|
696
654
|
draw() {
|
|
697
655
|
if (!this.w) return;
|
|
698
|
-
const ctx = this.ctx;
|
|
699
656
|
const pal = this.palette();
|
|
700
657
|
this.computeOrigin();
|
|
701
|
-
this.anchorParticles();
|
|
702
658
|
this.base();
|
|
703
659
|
this.hits = [];
|
|
704
660
|
this.machineHits = [];
|
|
661
|
+
this.bridgeHits = [];
|
|
662
|
+
this.noteHits = [];
|
|
705
663
|
this.drawSky(pal);
|
|
706
664
|
const c = this.getCity();
|
|
707
665
|
const islands = [{ home: true, cx: HOME.cx, cy: HOME.cy, r: HOME.r }];
|
|
708
666
|
for (const m of this.machines.values()) islands.push({ m, cx: m.center.x, cy: m.center.y, r: FRIEND_R });
|
|
709
667
|
islands.sort((p, q) => (p.cx + p.cy) - (q.cx + q.cy));
|
|
710
668
|
for (const is of islands) this.drawIsland(is, pal);
|
|
711
|
-
// bridges and the
|
|
669
|
+
// bridges and the core mast behind the building go first, so its walls hide them
|
|
712
670
|
const behind = (m) => m.center.x + m.center.y < HOME.cx + HOME.cy - 4;
|
|
713
671
|
for (const m of this.machines.values()) if (behind(m)) this.drawBridge(m, pal, c);
|
|
714
672
|
if (this.visible(TANK.x - 2, TANK.y - 2, TANK.x + 2, TANK.y + 2, 8, 0)) this.drawTank(TANK.x, TANK.y, pal);
|
|
@@ -732,6 +690,8 @@ export class CityScene {
|
|
|
732
690
|
for (const it of list) it.f();
|
|
733
691
|
|
|
734
692
|
this.drawCouriers(c);
|
|
693
|
+
this.drawPipeline(c);
|
|
694
|
+
this.drawLoops(c);
|
|
735
695
|
this.drawLights(pal);
|
|
736
696
|
this.drawFocus();
|
|
737
697
|
this.drawOverlay(pal, c);
|
|
@@ -739,89 +699,33 @@ export class CityScene {
|
|
|
739
699
|
this.base();
|
|
740
700
|
}
|
|
741
701
|
|
|
742
|
-
/**
|
|
743
|
-
anchorParticles() {
|
|
744
|
-
const o = this.lastO;
|
|
745
|
-
this.lastO = { x: this.ox, y: this.oy, A: this.cam.A };
|
|
746
|
-
if (!o || (o.x === this.ox && o.y === this.oy && o.A === this.cam.A)) return;
|
|
747
|
-
const k = this.cam.A / o.A;
|
|
748
|
-
const mx = (x) => this.ox + (x - o.x) * k;
|
|
749
|
-
const my = (y) => this.oy + (y - o.y) * k;
|
|
750
|
-
for (const p of this.parts) {
|
|
751
|
-
p.x = mx(p.x); p.y = my(p.y);
|
|
752
|
-
if (k !== 1) { p.vx = (p.vx || 0) * k; p.vy = (p.vy || 0) * k; }
|
|
753
|
-
}
|
|
754
|
-
}
|
|
755
|
-
|
|
702
|
+
/** The graphite void: a faint vertical gradient, sparse dim stars at night, a low mist band. */
|
|
756
703
|
drawSky(pal) {
|
|
757
704
|
const ctx = this.ctx;
|
|
758
705
|
if (!this.skyGrad) {
|
|
759
706
|
const g = ctx.createLinearGradient(0, 0, 0, this.h);
|
|
760
|
-
g.addColorStop(0, pal.
|
|
707
|
+
g.addColorStop(0, pal.void1); g.addColorStop(0.6, pal.void0); g.addColorStop(1, pal.void1);
|
|
761
708
|
this.skyGrad = g;
|
|
762
709
|
}
|
|
763
710
|
ctx.fillStyle = this.skyGrad;
|
|
764
711
|
ctx.fillRect(0, 0, this.w, this.h);
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
ctx.fillStyle = '#FFF8E6';
|
|
712
|
+
if (pal.night > 0.3 && !pal.light) {
|
|
713
|
+
ctx.fillStyle = pal.T.text;
|
|
768
714
|
for (const s of this.stars) {
|
|
769
|
-
|
|
770
|
-
ctx.
|
|
771
|
-
ctx.beginPath(); ctx.arc(s.x * this.w, s.y * this.h * 0.7, s.r, 0, 6.28); ctx.fill();
|
|
715
|
+
ctx.globalAlpha = (pal.night - 0.3) * 0.32;
|
|
716
|
+
ctx.fillRect(s.x * this.w, s.y * this.h * 0.6, s.r, s.r);
|
|
772
717
|
}
|
|
773
718
|
ctx.globalAlpha = 1;
|
|
774
719
|
}
|
|
775
|
-
//
|
|
776
|
-
const
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
const
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
ctx.fillStyle = g; ctx.fillRect(sx - 150, sy - 150, 300, 300);
|
|
785
|
-
ctx.fillStyle = pal.gold > 0.3 ? '#FFC27A' : '#FFF4C8'; ctx.beginPath(); ctx.arc(sx, sy, 26, 0, 6.28); ctx.fill();
|
|
786
|
-
} else {
|
|
787
|
-
const g = ctx.createRadialGradient(sx, sy, 4, sx, sy, 110);
|
|
788
|
-
g.addColorStop(0, 'rgba(220,230,255,.22)'); g.addColorStop(1, 'rgba(220,230,255,0)');
|
|
789
|
-
ctx.fillStyle = g; ctx.fillRect(sx - 110, sy - 110, 220, 220);
|
|
790
|
-
ctx.fillStyle = '#F4EBCF'; ctx.beginPath(); ctx.arc(sx, sy, 20, 0, 6.28); ctx.fill();
|
|
791
|
-
ctx.fillStyle = pal.skyTop; ctx.beginPath(); ctx.arc(sx + 9, sy - 5, 17, 0, 6.28); ctx.fill();
|
|
792
|
-
}
|
|
793
|
-
// far islands, a soft silhouette layer that drifts with the camera
|
|
794
|
-
const par = 0.18;
|
|
795
|
-
const bx = -((this.cam.x - this.cam.y) * this.cam.A * par) % (this.w * 1.4);
|
|
796
|
-
ctx.fillStyle = mixHex(pal.skyMid, pal.skyTop, 0.35);
|
|
797
|
-
ctx.globalAlpha = 0.55;
|
|
798
|
-
for (let i = 0; i < 5; i++) {
|
|
799
|
-
const x = ((bx + i * this.w * 0.33 + this.w * 2.8) % (this.w * 1.4)) - this.w * 0.2;
|
|
800
|
-
const y = this.h * (0.3 + ((i * 37) % 10) / 40);
|
|
801
|
-
const s = 40 + ((i * 53) % 5) * 14;
|
|
802
|
-
ctx.beginPath(); ctx.ellipse(x, y, s, s * 0.22, 0, Math.PI, 0); ctx.lineTo(x + s * 0.4, y + s * 0.5); ctx.lineTo(x - s * 0.3, y + s * 0.45); ctx.closePath(); ctx.fill();
|
|
803
|
-
}
|
|
804
|
-
ctx.globalAlpha = 1;
|
|
805
|
-
// clouds
|
|
806
|
-
const drift = this.reduced() ? 0 : this.now;
|
|
807
|
-
for (const cl of this.clouds) {
|
|
808
|
-
const x = (((cl.x + drift * cl.v) % 1.3) - 0.15) * this.w;
|
|
809
|
-
const y = cl.y * this.h + 40;
|
|
810
|
-
const s = cl.s * Math.min(this.w, 1400) * 0.07;
|
|
811
|
-
ctx.fillStyle = pal.night > 0.5 ? `rgba(150,160,200,${0.08 + (1 - pal.night) * 0.2})` : `rgba(255,255,255,${0.42 + pal.gold * 0.1})`;
|
|
812
|
-
if (pal.gold > 0.3) ctx.fillStyle = `rgba(255,214,190,${0.45})`;
|
|
813
|
-
ctx.beginPath();
|
|
814
|
-
ctx.ellipse(x, y, s, s * 0.32, 0, 0, 6.28);
|
|
815
|
-
ctx.ellipse(x + s * 0.5, y - s * 0.14, s * 0.55, s * 0.3, 0, 0, 6.28);
|
|
816
|
-
ctx.ellipse(x - s * 0.45, y + s * 0.02, s * 0.45, s * 0.22, 0, 0, 6.28);
|
|
817
|
-
ctx.fill();
|
|
818
|
-
}
|
|
819
|
-
// a sea of clouds below the islands
|
|
820
|
-
const seaY = this.h * 0.86;
|
|
821
|
-
const g2 = ctx.createLinearGradient(0, seaY - 60, 0, this.h);
|
|
822
|
-
g2.addColorStop(0, 'rgba(255,255,255,0)');
|
|
823
|
-
g2.addColorStop(1, pal.night > 0.5 ? 'rgba(60,70,110,.5)' : pal.gold > 0.3 ? 'rgba(255,200,170,.55)' : 'rgba(255,255,255,.6)');
|
|
824
|
-
ctx.fillStyle = g2; ctx.fillRect(0, seaY - 60, this.w, this.h - seaY + 60);
|
|
720
|
+
// the key light: a very soft glow from the upper left
|
|
721
|
+
const kl = ctx.createRadialGradient(this.w * 0.18, -this.h * 0.1, 10, this.w * 0.18, -this.h * 0.1, Math.max(this.w, this.h) * 0.8);
|
|
722
|
+
kl.addColorStop(0, alpha(pal.T.info, 0.05 * (1 - pal.night * 0.6))); kl.addColorStop(1, alpha(pal.T.info, 0));
|
|
723
|
+
ctx.fillStyle = kl; ctx.fillRect(0, 0, this.w, this.h);
|
|
724
|
+
// a low mist band under the islands
|
|
725
|
+
const seaY = this.h * 0.8;
|
|
726
|
+
const g2 = ctx.createLinearGradient(0, seaY - 80, 0, this.h);
|
|
727
|
+
g2.addColorStop(0, alpha(pal.T.text, 0)); g2.addColorStop(1, alpha(pal.T.text, 0.035));
|
|
728
|
+
ctx.fillStyle = g2; ctx.fillRect(0, seaY - 80, this.w, this.h - seaY + 80);
|
|
825
729
|
}
|
|
826
730
|
|
|
827
731
|
drawIsland(is, pal) {
|
|
@@ -829,46 +733,43 @@ export class CityScene {
|
|
|
829
733
|
let rise = 0; let al = 1;
|
|
830
734
|
if (is.m) {
|
|
831
735
|
const t = this.now - is.m.born;
|
|
832
|
-
if (t < 1.4) { const u = easeOut(clamp(t / 1.4)); rise = (1 - u) * -
|
|
736
|
+
if (t < 1.4) { const u = easeOut(clamp(t / 1.4)); rise = (1 - u) * -6; al = clamp(t / 0.5); }
|
|
833
737
|
if (is.m.leaving) al = 1 - clamp((this.now - is.m.leaving) / 1.2);
|
|
834
738
|
}
|
|
835
739
|
if (!this.visible(cx - r, cy - r, cx + r, cy + r, 1, -r * 1.2 + rise)) return;
|
|
836
740
|
const ctx = this.ctx;
|
|
837
741
|
ctx.globalAlpha = al;
|
|
838
742
|
const corners = hexCorners(cx, cy, r);
|
|
839
|
-
const depth = is.home ?
|
|
743
|
+
const depth = is.home ? 1.6 : 1.2;
|
|
840
744
|
const P = (x, y, z) => this.P(x, y, z + rise);
|
|
841
|
-
// underside: a
|
|
842
|
-
const tip = P(cx + 0.6, cy + 0.6, -r * 0.
|
|
745
|
+
// underside: a dark low poly cone
|
|
746
|
+
const tip = P(cx + 0.6, cy + 0.6, -r * 0.75);
|
|
843
747
|
const bottom = corners.map(([x, y]) => P(x, y, -depth));
|
|
844
748
|
for (let i = 0; i < 6; i++) {
|
|
845
749
|
const p = bottom[i]; const q = bottom[(i + 1) % 6];
|
|
846
|
-
this.poly([p, q, tip], [pal.
|
|
750
|
+
this.poly([p, q, tip], [pal.sideC, pal.under, pal.under, pal.under, pal.sideC, pal.sideB][i]);
|
|
847
751
|
}
|
|
848
|
-
//
|
|
849
|
-
for (let i = 0; i <
|
|
850
|
-
const an = 0.
|
|
752
|
+
// two shards
|
|
753
|
+
for (let i = 0; i < 2; i++) {
|
|
754
|
+
const an = 0.5 + i * 1.6; const rr = r * (0.35 + i * 0.18);
|
|
851
755
|
const x = cx + Math.cos(an) * rr; const y = cy + Math.sin(an) * rr;
|
|
852
|
-
const top = P(x, y, -depth - r * 0.
|
|
853
|
-
this.poly([[top[0] - this.cam.A * 0.
|
|
756
|
+
const top = P(x, y, -depth - r * 0.2); const tp = P(x + 0.2, y + 0.2, -depth - r * (0.45 + i * 0.12));
|
|
757
|
+
this.poly([[top[0] - this.cam.A * 0.7, top[1]], [top[0] + this.cam.A * 0.7, top[1]], tp], pal.under);
|
|
854
758
|
}
|
|
855
|
-
//
|
|
759
|
+
// the faces toward the viewer: crisp facets with two strata lines and a rim
|
|
856
760
|
for (const i of [5, 0, 1]) {
|
|
857
761
|
const [x0, y0] = corners[i]; const [x1, y1] = corners[(i + 1) % 6];
|
|
858
|
-
const
|
|
859
|
-
this.poly([P(x0, y0, 0), P(x1, y1, 0), P(x1, y1, -depth), P(x0, y0, -depth)],
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
ctx.strokeStyle = 'rgba(20,12,6,.18)'; ctx.lineWidth = Math.max(1, this.cam.A * 0.04);
|
|
863
|
-
for (const zz of [-0.95, -1.5]) {
|
|
762
|
+
const face = i === 1 ? pal.sideA : i === 0 ? pal.sideB : pal.sideC;
|
|
763
|
+
this.poly([P(x0, y0, 0), P(x1, y1, 0), P(x1, y1, -depth), P(x0, y0, -depth)], face);
|
|
764
|
+
ctx.strokeStyle = pal.strata; ctx.lineWidth = 1;
|
|
765
|
+
for (const zz of [-0.55, -1.05]) {
|
|
864
766
|
if (-zz > depth) continue;
|
|
865
|
-
const a = P(x0, y0, zz); const b = P(x1, y1, zz
|
|
767
|
+
const a = P(x0, y0, zz); const b = P(x1, y1, zz);
|
|
866
768
|
ctx.beginPath(); ctx.moveTo(a[0], a[1]); ctx.lineTo(b[0], b[1]); ctx.stroke();
|
|
867
769
|
}
|
|
868
|
-
|
|
869
|
-
this.poly([P(x0, y0, 0), P(x1, y1, 0), P(x1, y1, -0.14), P(x0, y0, -0.14)], pal.lip);
|
|
770
|
+
this.poly([P(x0, y0, 0), P(x1, y1, 0), P(x1, y1, -0.08), P(x0, y0, -0.08)], pal.rim);
|
|
870
771
|
}
|
|
871
|
-
// top: honeycomb
|
|
772
|
+
// top: calm basalt with a hairline honeycomb grid, clipped to the hexagon
|
|
872
773
|
const d = this.dpr; const A = this.cam.A;
|
|
873
774
|
const o = this.P(cx, cy, rise);
|
|
874
775
|
ctx.setTransform(d * A, d * A / 2, -d * A, d * A / 2, d * o[0], d * o[1]);
|
|
@@ -876,78 +777,87 @@ export class CityScene {
|
|
|
876
777
|
ctx.beginPath();
|
|
877
778
|
hexCorners(0, 0, r).forEach(([x, y], i) => (i ? ctx.lineTo(x, y) : ctx.moveTo(x, y)));
|
|
878
779
|
ctx.closePath(); ctx.clip();
|
|
879
|
-
ctx.fillStyle = pal.
|
|
880
|
-
ctx.fillStyle = pal.
|
|
881
|
-
ctx.
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
ctx.lineCap = 'round';
|
|
780
|
+
ctx.fillStyle = pal.groundA; ctx.fill();
|
|
781
|
+
ctx.fillStyle = pal.groundB; ctx.fill(this.grassTiles.alt);
|
|
782
|
+
ctx.strokeStyle = pal.groundLine; ctx.lineWidth = 0.025; ctx.stroke(this.grassTiles.grout);
|
|
783
|
+
// paved lanes: home plaza to every bridge, friend tower to its bridge
|
|
784
|
+
ctx.lineCap = 'butt';
|
|
885
785
|
const paths = [];
|
|
886
786
|
if (is.home) { for (const m of this.machines.values()) paths.push([[PLAZA.x - cx, PLAZA.y - cy], [m.bridge.a.x - cx, m.bridge.a.y - cy]]); paths.push([[PLAZA.x - cx, PLAZA.y - cy], [ENTRANCE.x - cx, ENTRANCE.y - cy]]); }
|
|
887
787
|
else { paths.push([[0, 0], [is.m.bridge.b.x - cx, is.m.bridge.b.y - cy]]); paths.push([[0, 0], [3.7, 3.7]]); }
|
|
888
|
-
for (const [w, col] of [[1.
|
|
788
|
+
for (const [w, col] of [[1.2, pal.pathEdge], [1.1, pal.path]]) {
|
|
889
789
|
ctx.strokeStyle = col; ctx.lineWidth = w;
|
|
890
790
|
for (const [p0, p1] of paths) { ctx.beginPath(); ctx.moveTo(p0[0], p0[1]); ctx.lineTo(p1[0], p1[1]); ctx.stroke(); }
|
|
891
791
|
}
|
|
892
792
|
if (is.home) {
|
|
893
|
-
// the plaza: a
|
|
894
|
-
ctx.fillStyle = pal.pathEdge; ctx.beginPath(); hexPath(ctx, PLAZA.x - cx, PLAZA.y - cy + 0.4, 2.
|
|
895
|
-
ctx.fillStyle = pal.path; ctx.beginPath(); hexPath(ctx, PLAZA.x - cx, PLAZA.y - cy + 0.4, 2.
|
|
896
|
-
ctx.strokeStyle = alpha(
|
|
793
|
+
// the plaza: a paved hexagon with a thin amber inlay
|
|
794
|
+
ctx.fillStyle = pal.pathEdge; ctx.beginPath(); hexPath(ctx, PLAZA.x - cx, PLAZA.y - cy + 0.4, 2.5); ctx.fill();
|
|
795
|
+
ctx.fillStyle = pal.path; ctx.beginPath(); hexPath(ctx, PLAZA.x - cx, PLAZA.y - cy + 0.4, 2.42); ctx.fill();
|
|
796
|
+
ctx.strokeStyle = alpha(pal.T.accent, 0.4); ctx.lineWidth = 0.03; ctx.beginPath(); hexPath(ctx, PLAZA.x - cx, PLAZA.y - cy + 0.4, 1.3); ctx.stroke();
|
|
897
797
|
} else {
|
|
898
798
|
ctx.fillStyle = pal.pathEdge; ctx.beginPath(); hexPath(ctx, 0, 0, 3.6); ctx.fill();
|
|
899
|
-
ctx.fillStyle = pal.path; ctx.beginPath(); hexPath(ctx, 0, 0, 3.
|
|
799
|
+
ctx.fillStyle = pal.path; ctx.beginPath(); hexPath(ctx, 0, 0, 3.52); ctx.fill();
|
|
900
800
|
}
|
|
901
|
-
ctx.lineCap = 'butt';
|
|
902
801
|
ctx.restore();
|
|
903
802
|
this.base();
|
|
904
803
|
ctx.globalAlpha = 1;
|
|
905
804
|
}
|
|
906
805
|
|
|
907
|
-
/** Plinth, floors, corridor and the two tall back walls of your building. */
|
|
806
|
+
/** Plinth, room floors as clean zones, corridor and the two tall back walls of your building. */
|
|
908
807
|
drawBuildingGround(pal) {
|
|
909
808
|
if (!this.visible(-1, -1, 17, 11, WALL + 3, -1)) return;
|
|
910
809
|
const ctx = this.ctx;
|
|
810
|
+
const T = pal.T;
|
|
911
811
|
const P = (x, y, z) => this.P(x, y, z);
|
|
912
812
|
const { x0, x1, y0, y1 } = BUILDING;
|
|
913
813
|
const pz = 0.3;
|
|
914
814
|
// plinth
|
|
915
|
-
this.poly([P(x0 - 0.3, y1 + 0.3, 0), P(x1 + 0.3, y1 + 0.3, 0), P(x1 + 0.3, y1 + 0.3, pz), P(x0 - 0.3, y1 + 0.3, pz)], pal.plinthL
|
|
916
|
-
this.poly([P(x1 + 0.3, y0 - 0.3, 0), P(x1 + 0.3, y1 + 0.3, 0), P(x1 + 0.3, y1 + 0.3, pz), P(x1 + 0.3, y0 - 0.3, pz)], pal.plinthR
|
|
917
|
-
this.poly([P(x0 - 0.3, y0 - 0.3, pz), P(x1 + 0.3, y0 - 0.3, pz), P(x1 + 0.3, y1 + 0.3, pz), P(x0 - 0.3, y1 + 0.3, pz)], pal.plinthTop
|
|
815
|
+
this.poly([P(x0 - 0.3, y1 + 0.3, 0), P(x1 + 0.3, y1 + 0.3, 0), P(x1 + 0.3, y1 + 0.3, pz), P(x0 - 0.3, y1 + 0.3, pz)], pal.plinthL);
|
|
816
|
+
this.poly([P(x1 + 0.3, y0 - 0.3, 0), P(x1 + 0.3, y1 + 0.3, 0), P(x1 + 0.3, y1 + 0.3, pz), P(x1 + 0.3, y0 - 0.3, pz)], pal.plinthR);
|
|
817
|
+
this.poly([P(x0 - 0.3, y0 - 0.3, pz), P(x1 + 0.3, y0 - 0.3, pz), P(x1 + 0.3, y1 + 0.3, pz), P(x0 - 0.3, y1 + 0.3, pz)], pal.plinthTop);
|
|
918
818
|
// entrance steps
|
|
919
|
-
for (let i = 0; i < 2; i++) this.box(ENTRANCE.x - 1.1 + i * 0.15, y1 + 0.3 + (1 - i) * 0.35, 0, 2.2 - i * 0.3, 0.35, pz * (i + 1) / 2, pal.plinthTop, pal.plinthL, pal.plinthR);
|
|
920
|
-
// floors
|
|
819
|
+
for (let i = 0; i < 2; i++) this.box(ENTRANCE.x - 1.1 + i * 0.15, y1 + 0.3 + (1 - i) * 0.35, 0, 2.2 - i * 0.3, 0.35, pz * (i + 1) / 2, pal.plinthTop, pal.plinthL, pal.plinthR, null);
|
|
820
|
+
// room floors: a flat zone, a hairline hex grid, a room color rule at the threshold, the name painted on the floor
|
|
921
821
|
const d = this.dpr; const A = this.cam.A;
|
|
922
822
|
for (const [k, r] of Object.entries(ROOMS)) {
|
|
923
823
|
const o = this.P(0, 0, pz);
|
|
924
824
|
ctx.setTransform(d * A, d * A / 2, -d * A, d * A / 2, d * o[0], d * o[1]);
|
|
925
825
|
ctx.save();
|
|
926
826
|
ctx.beginPath(); ctx.rect(r.x0, r.y0, r.x1 - r.x0, r.y1 - r.y0); ctx.clip();
|
|
927
|
-
const
|
|
928
|
-
|
|
929
|
-
ctx.fillStyle =
|
|
930
|
-
ctx.
|
|
931
|
-
ctx.strokeStyle = pal.
|
|
932
|
-
//
|
|
933
|
-
ctx.fillStyle = alpha(
|
|
934
|
-
|
|
935
|
-
ctx.
|
|
936
|
-
if (
|
|
827
|
+
const hl = this.highlightRoom(k);
|
|
828
|
+
const rc = roomColor(k);
|
|
829
|
+
ctx.fillStyle = mixHex(pal.floor, rc, hl ? 0.07 : 0.025); ctx.fill();
|
|
830
|
+
ctx.fillRect(r.x0, r.y0, r.x1 - r.x0, r.y1 - r.y0);
|
|
831
|
+
ctx.strokeStyle = pal.floorLine; ctx.lineWidth = 0.014; ctx.stroke(this.floorTiles.grout);
|
|
832
|
+
// the threshold rule, on the corridor side
|
|
833
|
+
ctx.fillStyle = alpha(rc, hl ? 0.95 : 0.7);
|
|
834
|
+
if (r.row === 'back') ctx.fillRect(r.x0 + 0.12, r.y1 - 0.06, r.x1 - r.x0 - 0.24, 0.06);
|
|
835
|
+
else ctx.fillRect(r.x0 + 0.12, r.y0, r.x1 - r.x0 - 0.24, 0.06);
|
|
836
|
+
if (hl) { ctx.strokeStyle = alpha(T.accent, 0.75); ctx.lineWidth = 0.04; ctx.strokeRect(r.x0 + 0.06, r.y0 + 0.06, r.x1 - r.x0 - 0.12, r.y1 - r.y0 - 0.12); }
|
|
937
837
|
ctx.restore();
|
|
838
|
+
// the painted label, legible from mid zoom
|
|
839
|
+
if (A >= 22) {
|
|
840
|
+
ctx.save();
|
|
841
|
+
const lx = r.row === 'back' ? r.x0 + 0.3 : r.x0 + 0.3; const ly = r.row === 'back' ? r.y1 - 0.42 : r.y0 + 0.62;
|
|
842
|
+
ctx.translate(lx, ly); ctx.scale(0.01, 0.01);
|
|
843
|
+
ctx.font = `600 ${clamp(26, 20, 34)}px ${FONT}`;
|
|
844
|
+
ctx.fillStyle = alpha(T.text, 0.34);
|
|
845
|
+
ctx.fillText(this.t(`city.room.${k}`).toUpperCase(), 0, 0);
|
|
846
|
+
ctx.restore();
|
|
847
|
+
}
|
|
938
848
|
}
|
|
939
|
-
// corridor
|
|
849
|
+
// the corridor: a slightly lighter lane with a hairline center line
|
|
940
850
|
const o = this.P(0, 0, pz);
|
|
941
851
|
ctx.setTransform(d * A, d * A / 2, -d * A, d * A / 2, d * o[0], d * o[1]);
|
|
942
|
-
ctx.fillStyle = pal.
|
|
943
|
-
ctx.fillStyle = alpha(
|
|
852
|
+
ctx.fillStyle = mixHex(pal.floor, T.text, 0.025); ctx.fillRect(0, 4.6, 16, 0.8);
|
|
853
|
+
ctx.fillStyle = alpha(T.text, 0.08); ctx.fillRect(0.3, 4.985, 15.4, 0.03);
|
|
944
854
|
this.base();
|
|
945
|
-
// the two tall back walls with windows, wallpaper in each room color, signs and boards
|
|
946
855
|
this.drawBackWalls(pal);
|
|
947
856
|
}
|
|
948
857
|
|
|
949
858
|
drawBackWalls(pal) {
|
|
950
859
|
const ctx = this.ctx;
|
|
860
|
+
const T = pal.T;
|
|
951
861
|
const P = (x, y, z) => this.P(x, y, z);
|
|
952
862
|
const zb = 0.3; const zt = WALL + 0.3;
|
|
953
863
|
// left wall x = 0 (Design and Library), right wall y = 0 (the four pipeline rooms)
|
|
@@ -956,58 +866,41 @@ export class CityScene {
|
|
|
956
866
|
for (const side of ['L', 'R']) {
|
|
957
867
|
const len = side === 'L' ? 10 : 16;
|
|
958
868
|
if (side === 'L') this.wallLT(0, 10, zt); else this.wallRT(0, zt);
|
|
959
|
-
|
|
960
|
-
ctx.
|
|
961
|
-
|
|
962
|
-
for (
|
|
963
|
-
let u0; let u1;
|
|
964
|
-
if (side === 'R') { if (r.row !== 'back') continue; u0 = r.x0; u1 = r.x1; } else { if (r.x0 !== 0) continue; u0 = 10 - r.y1; u1 = 10 - r.y0; }
|
|
965
|
-
ctx.fillStyle = alpha(ROOM_COLOR[k], 0.1); ctx.fillRect(u0, 0, u1 - u0, WALL);
|
|
966
|
-
}
|
|
967
|
-
ctx.strokeStyle = alpha(pal.comb, 0.55); ctx.lineWidth = 0.012; ctx.stroke(this.comb);
|
|
968
|
-
ctx.restore();
|
|
969
|
-
ctx.fillStyle = side === 'L' ? mixHex(pal.trim, '#ffffff', 0.35) : mixHex(pal.trim, '#ffffff', 0.25);
|
|
970
|
-
ctx.fillRect(0, WALL - 0.65, len, 0.65);
|
|
971
|
-
ctx.fillStyle = pal.trim; ctx.fillRect(0, WALL - 0.69, len, 0.05); ctx.fillRect(0, WALL - 0.08, len, 0.08);
|
|
972
|
-
ctx.strokeStyle = 'rgba(36,22,12,.12)'; ctx.lineWidth = 0.02; ctx.beginPath();
|
|
973
|
-
for (let u = 0.5; u < len; u += 0.5) { ctx.moveTo(u, WALL - 0.63); ctx.lineTo(u, WALL - 0.08); }
|
|
869
|
+
// a thin base rule and joints every two units, a soft shade toward the corner
|
|
870
|
+
ctx.fillStyle = alpha(T.text, 0.04); ctx.fillRect(0, WALL - 0.1, len, 0.1);
|
|
871
|
+
ctx.strokeStyle = alpha('#000000', 0.12); ctx.lineWidth = 0.012; ctx.beginPath();
|
|
872
|
+
for (let u = 2; u < len; u += 2) { ctx.moveTo(u, 0); ctx.lineTo(u, WALL); }
|
|
974
873
|
ctx.stroke();
|
|
975
|
-
|
|
976
|
-
if (side === 'L') { ctx.fillStyle = 'rgba(36,22,12,.22)'; ctx.fillRect(10 - 5.4, 0, 0.8, WALL); }
|
|
874
|
+
if (side === 'L') { ctx.fillStyle = 'rgba(0,0,0,.2)'; ctx.fillRect(10 - 5.4, 0, 0.8, WALL); }
|
|
977
875
|
const g = ctx.createLinearGradient(side === 'L' ? len : 0, 0, side === 'L' ? len - 3 : 3, 0);
|
|
978
|
-
g.addColorStop(0, 'rgba(
|
|
876
|
+
g.addColorStop(0, 'rgba(0,0,0,.2)'); g.addColorStop(1, 'rgba(0,0,0,0)');
|
|
979
877
|
ctx.fillStyle = g; ctx.fillRect(0, 0, len, WALL);
|
|
980
878
|
}
|
|
981
879
|
this.base();
|
|
982
|
-
// windows: one per back room,
|
|
983
|
-
const night = this.pal.night;
|
|
984
|
-
const top = mixHex(mixHex('#78B9E6', '#0B1430', night), '#4A3F7E', this.pal.gold * 0.7);
|
|
985
|
-
const bot = mixHex(mixHex('#D6EEF8', '#1E2B4E', night), '#F5A766', this.pal.gold * 0.85);
|
|
880
|
+
// windows: dark glass panes, one per back room, with a single reflection
|
|
986
881
|
const win = (u0, u1, side) => {
|
|
987
882
|
if (side === 'L') this.wallLT(0, 10, zt); else this.wallRT(0, zt);
|
|
988
883
|
const t0 = 0.28; const t1 = 1.08;
|
|
989
|
-
const g = ctx.createLinearGradient(0, t0, 0, t1); g.addColorStop(0,
|
|
884
|
+
const g = ctx.createLinearGradient(0, t0, 0, t1); g.addColorStop(0, pal.glassTop); g.addColorStop(1, pal.glassBot);
|
|
990
885
|
ctx.fillStyle = g; ctx.fillRect(u0, t0, u1 - u0, t1 - t0);
|
|
991
|
-
|
|
992
|
-
ctx.
|
|
993
|
-
|
|
994
|
-
ctx.
|
|
886
|
+
ctx.fillStyle = pal.glassHi;
|
|
887
|
+
ctx.beginPath(); ctx.moveTo(u0 + 0.1, t0); ctx.lineTo(u0 + 0.3, t0); ctx.lineTo(u0 + 0.12, t1); ctx.lineTo(u0 - 0.08, t1); ctx.closePath(); ctx.fill();
|
|
888
|
+
if (pal.night > 0.5) { ctx.fillStyle = alpha(T.accent2, 0.5); for (let i = 0; i < 3; i++) ctx.fillRect(u0 + 0.1 + ((i * 37) % 9) / 10 * (u1 - u0 - 0.2), t0 + 0.12 + ((i * 23) % 5) / 12, 0.02, 0.02); }
|
|
889
|
+
ctx.strokeStyle = pal.cap; ctx.lineWidth = 0.025; ctx.strokeRect(u0, t0, u1 - u0, t1 - t0);
|
|
995
890
|
};
|
|
996
|
-
for (const k of ['design', 'code', '
|
|
891
|
+
for (const k of ['design', 'code', 'test', 'review']) { const r = ROOMS[k]; win(r.x1 - 1.6, r.x1 - 0.45, 'R'); }
|
|
997
892
|
win(10 - 3.4, 10 - 1.9, 'L');
|
|
998
893
|
win(10 - 9.1, 10 - 7.6, 'L');
|
|
999
894
|
this.base();
|
|
1000
895
|
// wall caps
|
|
1001
|
-
const
|
|
1002
|
-
this.poly([P(0, 0, zt), P(0, 10, zt), P(-
|
|
1003
|
-
this.poly([P(-
|
|
1004
|
-
this.poly([P(16, -
|
|
896
|
+
const Tt = 0.12;
|
|
897
|
+
this.poly([P(0, 0, zt), P(0, 10, zt), P(-Tt, 10, zt), P(-Tt, -Tt, zt), P(16, -Tt, zt), P(16, 0, zt)], pal.cap);
|
|
898
|
+
this.poly([P(-Tt, 10, zb), P(0, 10, zb), P(0, 10, zt), P(-Tt, 10, zt)], pal.capSide);
|
|
899
|
+
this.poly([P(16, -Tt, zb), P(16, 0, zb), P(16, 0, zt), P(16, -Tt, zt)], shade(pal.capSide, -0.15));
|
|
1005
900
|
// room plaques on the back walls
|
|
1006
|
-
for (const k of ['design', 'code', '
|
|
901
|
+
for (const k of ['design', 'code', 'test', 'review']) { const r = ROOMS[k]; this.plaque(k, 'R', r.x0 + 1.2, pal); }
|
|
1007
902
|
this.plaque('library', 'L', 10 - 9.4 + 0.9, pal);
|
|
1008
|
-
|
|
1009
|
-
for (const k of ['design', 'code', 'review', 'test', 'library']) this.drawBoard(k, pal);
|
|
1010
|
-
// wall decor per room (drawn flat on the walls)
|
|
903
|
+
for (const k of ['design', 'code', 'test', 'review', 'library']) this.drawBoard(k, pal);
|
|
1011
904
|
this.wallDecor(pal);
|
|
1012
905
|
}
|
|
1013
906
|
|
|
@@ -1017,84 +910,84 @@ export class CityScene {
|
|
|
1017
910
|
const zt = WALL + 0.3;
|
|
1018
911
|
if (side === 'L') this.wallLT(0, 10, zt, 100); else this.wallRT(0, zt, 100);
|
|
1019
912
|
const name = this.t(`city.room.${k}`).toUpperCase();
|
|
1020
|
-
ctx.font = `
|
|
1021
|
-
const
|
|
1022
|
-
|
|
1023
|
-
ctx.fillStyle =
|
|
1024
|
-
ctx.fillStyle = mixHex('#3A2A1C', NIGHT_TINT, pal.night * 0.3); roundRect(ctx, x - 10, y, tw + 34, 26, 6); ctx.fill();
|
|
1025
|
-
ctx.fillStyle = ROOM_COLOR[k]; ctx.beginPath(); hexScreen(ctx, x + 2, y + 13, 6); ctx.fill();
|
|
1026
|
-
ctx.fillStyle = '#F7EAD3'; ctx.fillText(name, x + 14, y + 18.5);
|
|
913
|
+
ctx.font = `600 13px ${FONT}`;
|
|
914
|
+
const x = u * 100; const y = 16;
|
|
915
|
+
ctx.fillStyle = roomColor(k); ctx.fillRect(x - 10, y + 2, 3, 16);
|
|
916
|
+
ctx.fillStyle = alpha(pal.T.text, 0.72); ctx.fillText(name, x, y + 15);
|
|
1027
917
|
this.base();
|
|
1028
918
|
}
|
|
1029
919
|
|
|
1030
920
|
wallDecor(pal) {
|
|
1031
921
|
const ctx = this.ctx;
|
|
922
|
+
const T = pal.T;
|
|
1032
923
|
const zt = WALL + 0.3;
|
|
1033
924
|
this.wallRT(0, zt);
|
|
1034
|
-
//
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
ctx.fillStyle =
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
ctx.fillStyle =
|
|
1041
|
-
ctx.fillStyle = ok ? '#5DB27E' : '#3C6B4E'; ctx.beginPath(); ctx.arc(14.21, 0.62, 0.06, 0, 6.28); ctx.fill();
|
|
1042
|
-
ctx.fillStyle = ok ? '#4A3A2B' : '#E8B45C'; ctx.beginPath(); ctx.arc(14.21, 0.8, 0.06, 0, 6.28); ctx.fill();
|
|
1043
|
-
ctx.fillStyle = '#4A3A2B'; ctx.beginPath(); ctx.arc(14.21, 0.96, 0.05, 0, 6.28); ctx.fill();
|
|
925
|
+
// Test: a status light that shows the last QA verdict (green passed, red failed) and amber while a test runs
|
|
926
|
+
const qa = this.getCity().qa || {};
|
|
927
|
+
const blink = qa.running && (this.reduced() || Math.floor(this.now * 1.2) % 2 === 0);
|
|
928
|
+
ctx.fillStyle = pal.screen; ctx.fillRect(10.1, 0.5, 0.22, 0.5);
|
|
929
|
+
ctx.fillStyle = qa.last === true ? T.ok : alpha(T.ok, 0.18); ctx.beginPath(); ctx.arc(10.21, 0.62, 0.05, 0, 6.28); ctx.fill();
|
|
930
|
+
ctx.fillStyle = blink ? T.accent : alpha(T.accent, 0.18); ctx.beginPath(); ctx.arc(10.21, 0.78, 0.05, 0, 6.28); ctx.fill();
|
|
931
|
+
ctx.fillStyle = qa.last === false ? T.bad : alpha(T.bad, 0.18); ctx.beginPath(); ctx.arc(10.21, 0.94, 0.05, 0, 6.28); ctx.fill();
|
|
1044
932
|
this.base();
|
|
1045
|
-
void pal;
|
|
1046
933
|
}
|
|
1047
934
|
|
|
1048
|
-
/** A task board with its
|
|
935
|
+
/** A task board with its cards, on a wall or standing: a dark display, cards with a status rule. */
|
|
1049
936
|
drawBoard(room, pal) {
|
|
1050
937
|
const bd = this.boardOf(room);
|
|
1051
938
|
if (!bd || this.cam.A < 9) return;
|
|
1052
939
|
const ctx = this.ctx;
|
|
940
|
+
const T = pal.T;
|
|
1053
941
|
let u0; let u1;
|
|
1054
|
-
if (bd.kind === 'wallR') { this.wallRT(0, bd.z1
|
|
942
|
+
if (bd.kind === 'wallR') { this.wallRT(0, bd.z1); u0 = bd.x0; u1 = bd.x1; }
|
|
1055
943
|
else if (bd.kind === 'wallL') { this.wallLT(0, 10, bd.z1); u0 = 10 - bd.y1; u1 = 10 - bd.y0; }
|
|
1056
944
|
else { this.wallRT(bd.y, bd.z1); u0 = bd.x0; u1 = bd.x1; }
|
|
1057
945
|
const hgt = bd.z1 - bd.z0;
|
|
1058
|
-
ctx.fillStyle =
|
|
1059
|
-
ctx.
|
|
1060
|
-
ctx.fillStyle =
|
|
1061
|
-
|
|
1062
|
-
// notes
|
|
946
|
+
ctx.fillStyle = pal.board; ctx.fillRect(u0, 0, u1 - u0, hgt);
|
|
947
|
+
ctx.strokeStyle = alpha(T.text, 0.1); ctx.lineWidth = 0.012; ctx.strokeRect(u0, 0, u1 - u0, hgt);
|
|
948
|
+
ctx.fillStyle = bd.color; ctx.fillRect(u0, 0, u1 - u0, 0.025);
|
|
949
|
+
// cards
|
|
1063
950
|
const list = [...this.notes.values()].filter((n) => n.room === room && !n.gone && !n.hidden && !(n.fly && this.now - n.fly.t0 < 0.9));
|
|
1064
951
|
for (const n of list) {
|
|
1065
952
|
const col = n.slot % bd.cols; const row = Math.floor(n.slot / bd.cols);
|
|
1066
953
|
const w = (u1 - u0) / bd.cols;
|
|
1067
954
|
const x = bd.kind === 'wallL' ? u1 - (col + 1) * w : u0 + col * w;
|
|
1068
|
-
const y = 0.
|
|
1069
|
-
const
|
|
955
|
+
const y = 0.14 + row * 0.34;
|
|
956
|
+
const appear = this.reduced() ? 1 : easeOut(clamp((this.now - Math.max(n.born, n.fly ? n.fly.t0 + 0.9 : -99)) / 0.2));
|
|
1070
957
|
const t = n.t;
|
|
1071
|
-
const
|
|
958
|
+
const rule = t.status === 'blocked' ? T.bad : t.status === 'done' ? T.ok : ['in_progress', 'in_review', 'in_test', 'claimed'].includes(t.status) ? T.accent : T.muted;
|
|
1072
959
|
ctx.save();
|
|
960
|
+
ctx.globalAlpha = appear;
|
|
1073
961
|
ctx.translate(x + w / 2, y + 0.14);
|
|
1074
|
-
ctx.
|
|
1075
|
-
ctx.
|
|
1076
|
-
ctx.
|
|
1077
|
-
ctx.fillStyle = color; ctx.fillRect(-w / 2 + 0.05, -0.14, w - 0.1, 0.27);
|
|
1078
|
-
const a = t.assignee && this.actors.get(t.assignee);
|
|
1079
|
-
ctx.fillStyle = a?.ag.color || '#FFB531'; ctx.fillRect(-w / 2 + 0.05, -0.14, 0.04, 0.27);
|
|
1080
|
-
if (this.dragTask === n.id || this.highlight?.id === n.id) { ctx.strokeStyle = '#E8951E'; ctx.lineWidth = 0.03; ctx.strokeRect(-w / 2 + 0.03, -0.16, w - 0.06, 0.31); }
|
|
962
|
+
ctx.fillStyle = pal.card; ctx.fillRect(-w / 2 + 0.05, -0.13, w - 0.1, 0.26);
|
|
963
|
+
ctx.fillStyle = rule; ctx.fillRect(-w / 2 + 0.05, -0.13, 0.025, 0.26);
|
|
964
|
+
if (this.dragTask === n.id || this.highlight?.id === n.id) { ctx.strokeStyle = T.accent; ctx.lineWidth = 0.018; ctx.strokeRect(-w / 2 + 0.05, -0.13, w - 0.1, 0.26); }
|
|
1081
965
|
if (this.cam.A > 34) {
|
|
1082
966
|
ctx.scale(0.01, 0.01);
|
|
1083
|
-
ctx.fillStyle = '
|
|
1084
|
-
ctx.font = `
|
|
1085
|
-
const line = wrap(ctx, t.title || '', (w - 0.
|
|
1086
|
-
ctx.fillText(line, (-w / 2 + 0.
|
|
1087
|
-
if (t.status === 'done') { ctx.fillStyle = '#3F8A5E'; ctx.font = `800 11px ${FONT}`; ctx.fillText('✓', (w / 2 - 0.2) * 100, 0.04 * 100); }
|
|
967
|
+
ctx.fillStyle = t.status === 'done' ? alpha(T.text, 0.55) : T.text;
|
|
968
|
+
ctx.font = `500 ${this.cam.A > 80 ? 9 : 10.5}px ${FONT}`;
|
|
969
|
+
const line = wrap(ctx, t.title || '', (w - 0.26) * 100, 1)[0] || '';
|
|
970
|
+
ctx.fillText(line, (-w / 2 + 0.12) * 100, 0.035 * 100);
|
|
1088
971
|
} else {
|
|
1089
|
-
ctx.fillStyle =
|
|
972
|
+
ctx.fillStyle = alpha(T.text, 0.28); ctx.fillRect(-w / 2 + 0.13, -0.05, w * 0.5, 0.03); ctx.fillRect(-w / 2 + 0.13, 0.02, w * 0.32, 0.03);
|
|
1090
973
|
}
|
|
1091
974
|
ctx.restore();
|
|
1092
975
|
}
|
|
976
|
+
if (this.cam.A >= 14) {
|
|
977
|
+
this.base();
|
|
978
|
+
for (const n of list) {
|
|
979
|
+
const c = this.notePos(n);
|
|
980
|
+
const [sx, sy] = this.P(c.x, c.y, c.z);
|
|
981
|
+
const hw = Math.max(10, this.cam.A * ((bd.x1 - bd.x0 || bd.y1 - bd.y0) / bd.cols) * 0.5);
|
|
982
|
+
this.noteHits.push({ id: n.id, x: sx - hw, y: sy - this.cam.A * 0.25, w: hw * 2, h: this.cam.A * 0.5 });
|
|
983
|
+
}
|
|
984
|
+
if (bd.kind === 'wallR') this.wallRT(0, bd.z1); else if (bd.kind === 'wallL') this.wallLT(0, 10, bd.z1); else this.wallRT(bd.y, bd.z1);
|
|
985
|
+
}
|
|
1093
986
|
const more = (this.boardCounts?.get(room)?.length || 0) - bd.cols * 3;
|
|
1094
987
|
if (more > 0 && this.cam.A > 24) {
|
|
1095
988
|
ctx.save(); ctx.scale(0.01, 0.01);
|
|
1096
|
-
ctx.fillStyle =
|
|
1097
|
-
ctx.fillText(`+${more}`, (u1 - 0.3) * 100, (hgt - 0.
|
|
989
|
+
ctx.fillStyle = alpha(T.text, 0.5); ctx.font = `500 10px ${MONO}`;
|
|
990
|
+
ctx.fillText(`+${more}`, (u1 - 0.3) * 100, (hgt - 0.05) * 100);
|
|
1098
991
|
ctx.restore();
|
|
1099
992
|
}
|
|
1100
993
|
this.base();
|
|
@@ -1103,21 +996,21 @@ export class CityScene {
|
|
|
1103
996
|
drawBoardItem(room, pal) {
|
|
1104
997
|
const bd = this.boardOf(room);
|
|
1105
998
|
if (!bd) return;
|
|
1106
|
-
// legs of a standing board
|
|
999
|
+
// two slim legs of a standing board
|
|
1107
1000
|
const ctx = this.ctx;
|
|
1108
1001
|
for (const x of [bd.x0 + 0.12, bd.x1 - 0.12]) {
|
|
1109
1002
|
const a = this.P(x, bd.y + 0.02, 0.3 * (room.startsWith('m:') ? 0 : 1)); const b = this.P(x, bd.y + 0.02, bd.z0 + 0.05);
|
|
1110
|
-
ctx.strokeStyle = pal.
|
|
1003
|
+
ctx.strokeStyle = pal.metal; ctx.lineWidth = Math.max(1, this.cam.A * 0.03);
|
|
1111
1004
|
ctx.beginPath(); ctx.moveTo(a[0], a[1]); ctx.lineTo(b[0], b[1]); ctx.stroke();
|
|
1112
1005
|
}
|
|
1113
1006
|
this.drawBoard(room, pal);
|
|
1114
1007
|
}
|
|
1115
1008
|
|
|
1116
|
-
/** Every piece of your building that needs depth sorting: partitions,
|
|
1009
|
+
/** Every piece of your building that needs depth sorting: partitions, workstations, racks, the gate. */
|
|
1117
1010
|
buildingItems(list, pal) {
|
|
1118
1011
|
if (!this.visible(-1, -1, 17, 11, WALL + 3, -1)) return;
|
|
1119
1012
|
const pz = 0.3;
|
|
1120
|
-
// low partitions with door gaps, split into short pieces so bees sort well against them
|
|
1013
|
+
// low glass partitions with door gaps, split into short pieces so bees sort well against them
|
|
1121
1014
|
const walls = [];
|
|
1122
1015
|
const gap = (x) => [x - 0.65, x + 0.65];
|
|
1123
1016
|
const along = (y, xa, xb, gaps) => { // wall along x at y
|
|
@@ -1129,19 +1022,22 @@ export class CityScene {
|
|
|
1129
1022
|
}
|
|
1130
1023
|
};
|
|
1131
1024
|
const across = (x, ya, yb) => { for (let s = ya; s < yb - 0.01; s += 1) walls.push({ kind: 'y', x, y0: s, y1: Math.min(yb, s + 1) }); };
|
|
1132
|
-
along(4.6, 0, 16, ['design', 'code', '
|
|
1025
|
+
along(4.6, 0, 16, ['design', 'code', 'test', 'review'].map((k) => gap(ROOMS[k].x0 + 2)));
|
|
1133
1026
|
along(5.4, 0, 16, [gap(2), gap(6.4), gap(14)]);
|
|
1134
1027
|
for (const x of [4, 8, 12]) across(x, 0, 4.6);
|
|
1135
1028
|
for (const x of [4, 12]) across(x, 5.4, 10);
|
|
1136
1029
|
// the front parapet and the right side, with the entrance gap
|
|
1137
1030
|
along(10, 0, 16, [[6.9, 9.1]]);
|
|
1138
1031
|
across(16, 0, 4.6); across(16, 5.4, 10);
|
|
1032
|
+
const glassTop = alpha(pal.T.text, 0.22); const glassL = alpha(pal.part, 0.55); const glassR = alpha(pal.partR, 0.55);
|
|
1139
1033
|
for (const wpc of walls) {
|
|
1140
|
-
const
|
|
1141
|
-
|
|
1142
|
-
|
|
1034
|
+
const outer = (wpc.kind === 'x' && wpc.y === 10) || (wpc.kind === 'y' && wpc.x === 16);
|
|
1035
|
+
const hgt = outer ? 0.26 : PART;
|
|
1036
|
+
const top = outer ? pal.part : glassTop; const l = outer ? pal.partL : glassL; const r = outer ? pal.partR : glassR;
|
|
1037
|
+
if (wpc.kind === 'x') list.push({ k: (wpc.x0 + wpc.x1) / 2 + wpc.y + 0.08, f: () => this.box(wpc.x0, wpc.y - 0.03, pz, wpc.x1 - wpc.x0, 0.06, hgt, top, l, r, null) });
|
|
1038
|
+
else list.push({ k: wpc.x + (wpc.y0 + wpc.y1) / 2 + 0.08, f: () => this.box(wpc.x - 0.03, wpc.y0, pz, 0.06, wpc.y1 - wpc.y0, hgt, top, l, r, null) });
|
|
1143
1039
|
}
|
|
1144
|
-
//
|
|
1040
|
+
// workstations and chairs at the seats
|
|
1145
1041
|
for (const k of Object.keys(ROOMS)) {
|
|
1146
1042
|
for (let i = 0; i < 4; i++) {
|
|
1147
1043
|
const s = spotFor(k, i);
|
|
@@ -1150,35 +1046,20 @@ export class CityScene {
|
|
|
1150
1046
|
list.push({ k: s.x + s.y - 0.3, f: () => this.drawChair(k, s, pal) });
|
|
1151
1047
|
}
|
|
1152
1048
|
}
|
|
1153
|
-
// room props
|
|
1154
1049
|
const add = (x, y, f) => list.push({ k: x + y, f });
|
|
1155
|
-
//
|
|
1156
|
-
add(
|
|
1157
|
-
|
|
1158
|
-
// Code: a coffee bar and a small server
|
|
1159
|
-
add(7.55, 0.55, () => { this.box(6.9, 0.25, pz, 1.0, 0.55, 0.62, pal.deskTop, pal.deskL, pal.deskR); this.cyl(7.15, 0.5, pz + 0.62, 0.12, 0.26, '#5A4836', '#3B2414'); this.cyl(7.6, 0.55, pz + 0.62, 0.07, 0.12, '#F2E9DA', '#3B2414'); });
|
|
1160
|
-
// Review: a sofa and a tall wall screen
|
|
1161
|
-
add(10, 0.5, () => this.drawScreen(8.7, 11.3, pal));
|
|
1162
|
-
add(11.4, 3.95, () => this.drawPlant(11.5, 4.0, 0.7, pz));
|
|
1163
|
-
// Test: a lab bench with flasks
|
|
1164
|
-
add(14, 0.6, () => { this.box(12.3, 0.25, pz, 3.3, 0.6, 0.58, pal.deskTop, pal.deskL, pal.deskR); ['#7DC49B', '#FFB531', '#86A9D6', '#FF7AB6', '#7DC49B'].forEach((c, i) => this.cyl(12.6 + i * 0.32, 0.55, pz + 0.58, 0.06, 0.3 + (i % 2) * 0.08, alpha(c, 0.85), '#F2E9DA')); });
|
|
1165
|
-
// Library: shelves along the left wall, an armchair, memory jars
|
|
1050
|
+
// Review: the wall display with the diff
|
|
1051
|
+
add(14, 0.5, () => this.drawScreen(12.7, 15.3, pal));
|
|
1052
|
+
// Library: storage racks along the left wall
|
|
1166
1053
|
add(0.3, 6.8, () => this.drawShelves(0.05, 5.6, 1.5, pal));
|
|
1167
1054
|
add(0.3, 9.1, () => this.drawShelves(0.05, 8.2, 1.6, pal));
|
|
1168
|
-
|
|
1169
|
-
// Lobby: Mel's desk, benches, the honey fountain, plants
|
|
1055
|
+
// Lobby: Mel's hexagon desk and the board
|
|
1170
1056
|
add(8, 7.6, () => this.drawReception(8, 7.6, pal));
|
|
1171
|
-
add(8, 9.0, () => this.drawFountain(8.0, 8.95, pal));
|
|
1172
|
-
add(4.6, 9.5, () => this.drawPlant(4.6, 9.5, 0.9, pz));
|
|
1173
|
-
add(11.4, 9.5, () => this.drawPlant(11.4, 9.5, 0.9, pz));
|
|
1174
|
-
add(5.6, 6.15, () => this.drawBench(5.0, 6.0, pal));
|
|
1175
1057
|
add(10.45, 5.95, () => this.drawBoardItem('lobby', pal));
|
|
1176
|
-
// Ops: server racks and
|
|
1058
|
+
// Ops: server racks with their activity lights, and the board
|
|
1177
1059
|
add(15.4, 6.0, () => this.drawRack(15.15, 5.7, pal));
|
|
1178
1060
|
add(15.4, 7.1, () => this.drawRack(15.15, 6.8, pal));
|
|
1179
1061
|
add(13.1, 6.0, () => this.drawBoardItem('ops', pal));
|
|
1180
|
-
|
|
1181
|
-
// the entrance gate over the Lobby
|
|
1062
|
+
// the entrance frame over the Lobby
|
|
1182
1063
|
add(9.2, 10.05, () => this.drawGate(pal));
|
|
1183
1064
|
}
|
|
1184
1065
|
|
|
@@ -1186,180 +1067,106 @@ export class CityScene {
|
|
|
1186
1067
|
|
|
1187
1068
|
drawDesk(room, s, pal) {
|
|
1188
1069
|
const ctx = this.ctx;
|
|
1070
|
+
const T = pal.T;
|
|
1189
1071
|
const pz = 0.3;
|
|
1190
1072
|
const x = s.x - DW / 2; const y = s.y + 0.18;
|
|
1191
|
-
|
|
1192
|
-
this.box(x +
|
|
1193
|
-
this.box(x + 0.
|
|
1194
|
-
this.box(x, y, pz + DH - 0.
|
|
1195
|
-
const z = pz + DH
|
|
1196
|
-
const col = ROOM_COLOR[room];
|
|
1073
|
+
// a clean workstation: two slim legs and a slab top
|
|
1074
|
+
this.box(x + 0.06, y + 0.08, pz, 0.05, DD - 0.16, DH - 0.05, pal.leg, pal.leg, shade(pal.leg, -0.2), null);
|
|
1075
|
+
this.box(x + DW - 0.11, y + 0.08, pz, 0.05, DD - 0.16, DH - 0.05, pal.leg, pal.leg, shade(pal.leg, -0.2), null);
|
|
1076
|
+
this.box(x, y, pz + DH - 0.05, DW, DD, 0.05, pal.deskTop, pal.deskL, pal.deskR, null);
|
|
1077
|
+
const z = pz + DH;
|
|
1197
1078
|
const sitter = [...this.actors.values()].find((a) => !a.path.length && a.place.kind === 'room' && a.place.room === room && Math.abs(a.pos.x - s.x) < 0.2 && Math.abs(a.pos.y - s.y) < 0.2);
|
|
1198
1079
|
const active = sitter && ['working', 'thinking', 'reviewing', 'testing'].includes(sitter.mode);
|
|
1199
|
-
//
|
|
1200
|
-
const
|
|
1201
|
-
this.box(
|
|
1202
|
-
this.box(
|
|
1203
|
-
const
|
|
1204
|
-
|
|
1205
|
-
ctx.
|
|
1206
|
-
ctx.
|
|
1207
|
-
if (active
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
ctx.fillStyle = this.pal.night > 0.3 ? '#FFE3A1' : '#F0B54A';
|
|
1217
|
-
ctx.beginPath(); ctx.moveTo(s1[0] - sw * 0.45, s1[1] - this.cam.A * 0.1); ctx.lineTo(s1[0] + sw * 0.45, s1[1] - this.cam.A * 0.1); ctx.lineTo(s1[0] + sw, s1[1] + this.cam.A * 0.035); ctx.lineTo(s1[0] - sw, s1[1] + this.cam.A * 0.035); ctx.closePath(); ctx.fill();
|
|
1218
|
-
(this.lamps ||= []).push([s1[0], s1[1] + this.cam.A * 0.04]);
|
|
1219
|
-
// a room prop on the desk
|
|
1220
|
-
const px = x + DW - 0.3; const py = y + DD - 0.25;
|
|
1221
|
-
if (room === 'design') ['#FF7AB6', '#6CC4FF', '#FFD072'].forEach((c, i) => { const p = this.P(px - 0.25 + i * 0.1, py, z + 0.01); ctx.fillStyle = c; ctx.beginPath(); ctx.ellipse(p[0], p[1], this.cam.A * 0.04, this.cam.A * 0.022, 0, 0, 6.28); ctx.fill(); });
|
|
1222
|
-
else if (room === 'test') this.cyl(px, py - 0.05, z, 0.05, 0.24, alpha('#7DC49B', 0.85), '#F2E9DA');
|
|
1223
|
-
else if (room === 'review') { const p = this.P(px - 0.1, py, z + 0.08); ctx.strokeStyle = '#4A3A2B'; ctx.lineWidth = Math.max(1, this.cam.A * 0.025); ctx.beginPath(); ctx.arc(p[0], p[1], this.cam.A * 0.07, 0, 6.28); ctx.stroke(); }
|
|
1224
|
-
else this.cyl(px, py, z, 0.08, 0.15, '#F2E9DA', '#3B2414');
|
|
1080
|
+
// the monitor: a thin slab facing the bee, its screen line lit in the agent color while it works
|
|
1081
|
+
const mx = s.x - 0.38; const my = y + 0.26; const mw = 0.76; const mh = 0.42;
|
|
1082
|
+
this.box(mx + mw / 2 - 0.04, my + 0.04, z, 0.08, 0.08, 0.1, pal.metal, pal.leg, pal.leg, null);
|
|
1083
|
+
this.box(mx, my, z + 0.1, mw, 0.03, mh, pal.screen, pal.screen, shade(pal.screen, -0.2), null);
|
|
1084
|
+
const c = active ? statusColor(sitter.mode, T) : alpha(T.text, 0.1);
|
|
1085
|
+
const s0 = this.P(mx + 0.05, my, z + 0.15); const s1 = this.P(mx + mw - 0.05, my, z + 0.15);
|
|
1086
|
+
ctx.strokeStyle = c; ctx.lineWidth = Math.max(1, this.cam.A * 0.025);
|
|
1087
|
+
ctx.beginPath(); ctx.moveTo(s0[0], s0[1]); ctx.lineTo(s1[0], s1[1]); ctx.stroke();
|
|
1088
|
+
if (active && this.cam.A > 30) {
|
|
1089
|
+
const col = tone(sitter.ag.color || T.accent);
|
|
1090
|
+
for (const [k, len] of [[0.62, 0.55], [0.45, 0.38]]) {
|
|
1091
|
+
const p0 = this.P(mx + 0.08, my, z + 0.1 + mh * k); const p1 = this.P(mx + 0.08 + mw * len, my, z + 0.1 + mh * k);
|
|
1092
|
+
ctx.strokeStyle = alpha(col, 0.5); ctx.lineWidth = Math.max(0.8, this.cam.A * 0.014);
|
|
1093
|
+
ctx.beginPath(); ctx.moveTo(p0[0], p0[1]); ctx.lineTo(p1[0], p1[1]); ctx.stroke();
|
|
1094
|
+
}
|
|
1095
|
+
}
|
|
1096
|
+
if (active) (this.screens ||= []).push([...this.P(mx + mw / 2, my, z + 0.3), tone(sitter.ag.color || T.accent)]);
|
|
1225
1097
|
}
|
|
1226
1098
|
|
|
1227
1099
|
drawChair(room, s, pal) {
|
|
1228
|
-
const x = s.x - 0.
|
|
1229
|
-
|
|
1230
|
-
this.
|
|
1231
|
-
this.box(x, y - 0.
|
|
1232
|
-
|
|
1233
|
-
void pal;
|
|
1234
|
-
}
|
|
1235
|
-
|
|
1236
|
-
drawEasel(x, y, pal) {
|
|
1237
|
-
const ctx = this.ctx; const pz = 0.3;
|
|
1238
|
-
const a = this.P(x - 0.3, y + 0.15, pz); const b = this.P(x, y, pz + 1.5); const c = this.P(x + 0.3, y - 0.15, pz);
|
|
1239
|
-
ctx.strokeStyle = pal.trim; ctx.lineWidth = Math.max(1.4, this.cam.A * 0.05);
|
|
1240
|
-
ctx.beginPath(); ctx.moveTo(a[0], a[1]); ctx.lineTo(b[0], b[1]); ctx.lineTo(c[0], c[1]); ctx.stroke();
|
|
1241
|
-
this.poly([this.P(x - 0.45, y + 0.12, pz + 0.55), this.P(x + 0.45, y + 0.12, pz + 0.55), this.P(x + 0.45, y + 0.12, pz + 1.3), this.P(x - 0.45, y + 0.12, pz + 1.3)], '#FFFDF6', 'rgba(36,22,12,.4)');
|
|
1242
|
-
const m = this.P(x, y + 0.12, pz + 0.92);
|
|
1243
|
-
ctx.fillStyle = '#FF7AB6'; ctx.beginPath(); ctx.arc(m[0] - this.cam.A * 0.1, m[1] - this.cam.A * 0.05, this.cam.A * 0.12, 0, 6.28); ctx.fill();
|
|
1244
|
-
ctx.fillStyle = '#6CC4FF'; ctx.fillRect(m[0], m[1] - this.cam.A * 0.02, this.cam.A * 0.2, this.cam.A * 0.14);
|
|
1100
|
+
const x = s.x - 0.22; const y = s.y - 0.28; const pz = 0.3;
|
|
1101
|
+
this.box(x + 0.19, y + 0.17, pz, 0.06, 0.06, 0.36, pal.leg, pal.leg, pal.leg, null);
|
|
1102
|
+
this.box(x, y - 0.02, pz + 0.36, 0.44, 0.44, 0.06, pal.partL, pal.partR, shade(pal.partR, -0.2), null);
|
|
1103
|
+
this.box(x, y - 0.06, pz + 0.42, 0.44, 0.05, 0.46, pal.partL, pal.partL, shade(pal.partR, -0.25), null);
|
|
1104
|
+
void room;
|
|
1245
1105
|
}
|
|
1246
1106
|
|
|
1247
1107
|
drawScreen(u0, u1, pal) {
|
|
1248
|
-
//
|
|
1108
|
+
// the Review wall display with a diff
|
|
1249
1109
|
const ctx = this.ctx;
|
|
1110
|
+
const T = pal.T;
|
|
1250
1111
|
this.wallRT(0.02, WALL + 0.3);
|
|
1251
1112
|
const t0 = 0.35; const t1 = 1.25;
|
|
1252
|
-
ctx.fillStyle =
|
|
1253
|
-
ctx.
|
|
1254
|
-
const off = this.reduced() ? 0 : Math.floor(this.now * 1.5);
|
|
1113
|
+
ctx.fillStyle = pal.screen; ctx.fillRect(u0 + 0.9, t0, u1 - u0 - 1.75, t1 - t0);
|
|
1114
|
+
ctx.strokeStyle = alpha(T.text, 0.14); ctx.lineWidth = 0.012; ctx.strokeRect(u0 + 0.9, t0, u1 - u0 - 1.75, t1 - t0);
|
|
1255
1115
|
for (let i = 0; i < 8; i++) {
|
|
1256
|
-
const k = (i
|
|
1116
|
+
const k = (i * 3) % 11;
|
|
1257
1117
|
const add = k % 4 === 1; const del = k % 5 === 3;
|
|
1258
|
-
ctx.fillStyle = add ?
|
|
1259
|
-
ctx.fillRect(u0 + 1.0, t0 + 0.07 + i * 0.1, 0.25 + ((k * 7) % 5) * 0.12, 0.
|
|
1118
|
+
ctx.fillStyle = add ? alpha(T.ok, 0.7) : del ? alpha(T.bad, 0.7) : alpha(T.text, 0.25);
|
|
1119
|
+
ctx.fillRect(u0 + 1.0, t0 + 0.07 + i * 0.1, 0.25 + ((k * 7) % 5) * 0.12, 0.035);
|
|
1260
1120
|
}
|
|
1261
1121
|
this.base();
|
|
1262
|
-
void pal;
|
|
1263
1122
|
}
|
|
1264
1123
|
|
|
1265
1124
|
drawShelves(x, y, len, pal) {
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
const
|
|
1125
|
+
// a storage rack: a dark frame, neutral volumes, a few accented ones (the agents' memory)
|
|
1126
|
+
const T = pal.T;
|
|
1127
|
+
const pz = 0.3;
|
|
1128
|
+
this.box(x, y, pz, 0.45, len, 1.6, pal.capSide, pal.leg, shade(pal.leg, -0.2), null);
|
|
1129
|
+
const spines = [pal.partL, pal.part, mixHex(pal.partL, T.info, 0.22), pal.partR, mixHex(pal.partL, T.accent, 0.2)];
|
|
1269
1130
|
for (let row = 0; row < 3; row++) {
|
|
1270
1131
|
const zz = pz + 0.12 + row * 0.5;
|
|
1271
1132
|
for (let i = 0; i < Math.floor(len / 0.22) - 1; i++) {
|
|
1272
1133
|
const yy = y + 0.1 + i * 0.22;
|
|
1273
|
-
|
|
1274
|
-
if (glow) {
|
|
1275
|
-
// a glowing memory jar
|
|
1276
|
-
const p = this.P(x + 0.45, yy + 0.08, zz + 0.14);
|
|
1277
|
-
ctx.fillStyle = '#FFB531'; ctx.globalAlpha = 0.9;
|
|
1278
|
-
roundRect(ctx, p[0] - this.cam.A * 0.07, p[1] - this.cam.A * 0.12, this.cam.A * 0.14, this.cam.A * 0.2, this.cam.A * 0.04); ctx.fill();
|
|
1279
|
-
ctx.globalAlpha = 1;
|
|
1280
|
-
(this.jarLights ||= []).push(p);
|
|
1281
|
-
} else this.poly([this.P(x + 0.45, yy, zz), this.P(x + 0.45, yy + 0.16, zz), this.P(x + 0.45, yy + 0.16, zz + 0.3 + ((i + row) % 3) * 0.05), this.P(x + 0.45, yy, zz + 0.3 + ((i + row) % 3) * 0.05)], colors[(i * 2 + row) % colors.length], 'rgba(36,22,12,.3)');
|
|
1134
|
+
this.poly([this.P(x + 0.45, yy, zz), this.P(x + 0.45, yy + 0.16, zz), this.P(x + 0.45, yy + 0.16, zz + 0.3 + ((i + row) % 3) * 0.05), this.P(x + 0.45, yy, zz + 0.3 + ((i + row) % 3) * 0.05)], spines[(i * 2 + row) % spines.length]);
|
|
1282
1135
|
}
|
|
1283
1136
|
}
|
|
1284
1137
|
}
|
|
1285
1138
|
|
|
1286
|
-
drawArmchair(x, y, pal) {
|
|
1287
|
-
const pz = 0.3; const c = '#B5654A';
|
|
1288
|
-
this.box(x - 0.45, y - 0.35, pz, 0.9, 0.75, 0.32, shade(c, 0.1), shade(c, -0.15), shade(c, -0.3));
|
|
1289
|
-
this.box(x - 0.45, y - 0.42, pz + 0.32, 0.9, 0.16, 0.55, shade(c, 0.05), shade(c, -0.2), shade(c, -0.35));
|
|
1290
|
-
this.box(x - 0.55, y - 0.35, pz + 0.2, 0.12, 0.75, 0.35, shade(c, 0), shade(c, -0.2), shade(c, -0.35));
|
|
1291
|
-
this.box(x + 0.45, y - 0.35, pz + 0.2, 0.12, 0.75, 0.35, shade(c, 0), shade(c, -0.2), shade(c, -0.35));
|
|
1292
|
-
void pal;
|
|
1293
|
-
}
|
|
1294
|
-
|
|
1295
1139
|
drawReception(x, y, pal) {
|
|
1296
|
-
// a
|
|
1297
|
-
const ctx = this.ctx; const pz = 0.3; const r = 0.7; const hgt = 0.62;
|
|
1298
|
-
const ring = [];
|
|
1299
|
-
for (let i = 0; i < 6; i++) { const an = (Math.PI / 3) * i + Math.PI / 6; ring.push([x + r * Math.cos(an), y + r * Math.sin(an)]); }
|
|
1300
|
-
for (let i = 0; i < 6; i++) {
|
|
1301
|
-
const p = ring[i]; const q = ring[(i + 1) % 6];
|
|
1302
|
-
const nx = (p[0] + q[0]) / 2 - x; const ny = (p[1] + q[1]) / 2 - y;
|
|
1303
|
-
if (nx + ny <= 0.01) continue;
|
|
1304
|
-
this.poly([this.P(p[0], p[1], pz), this.P(q[0], q[1], pz), this.P(q[0], q[1], pz + hgt), this.P(p[0], p[1], pz + hgt)], nx > ny ? pal.deskR : pal.deskL, 'rgba(36,22,12,.35)');
|
|
1305
|
-
}
|
|
1306
|
-
this.poly(ring.map((p) => this.P(p[0], p[1], pz + hgt)), pal.deskTop, 'rgba(36,22,12,.35)');
|
|
1307
|
-
const c = this.P(x, y, pz + hgt);
|
|
1308
|
-
ctx.fillStyle = '#E8951E'; ctx.beginPath(); ctx.ellipse(c[0], c[1], this.cam.A * 0.32, this.cam.A * 0.16, 0, 0, 6.28); ctx.fill();
|
|
1309
|
-
ctx.fillStyle = '#FFD072'; ctx.beginPath(); hexScreen(ctx, c[0], c[1] - this.cam.A * 0.02, this.cam.A * 0.1); ctx.fill();
|
|
1310
|
-
}
|
|
1311
|
-
|
|
1312
|
-
drawFountain(x, y, pal) {
|
|
1313
|
-
const ctx = this.ctx; const pz = 0.3;
|
|
1314
|
-
this.cyl(x, y, pz, 0.62, 0.26, pal.plinthL, pal.plinthTop);
|
|
1315
|
-
const t = this.P(x, y, pz + 0.26);
|
|
1316
|
-
ctx.fillStyle = '#F3A42A'; ctx.beginPath(); ctx.ellipse(t[0], t[1], this.cam.A * 0.72, this.cam.A * 0.36, 0, 0, 6.28); ctx.fill();
|
|
1317
|
-
ctx.fillStyle = 'rgba(255,240,190,.5)';
|
|
1318
|
-
const w = this.reduced() ? 0 : this.now;
|
|
1319
|
-
for (let i = 0; i < 3; i++) { const ph = ((w * 0.6 + i / 3) % 1); ctx.globalAlpha = 1 - ph; ctx.strokeStyle = '#FFE7A8'; ctx.lineWidth = 1; ctx.beginPath(); ctx.ellipse(t[0], t[1], this.cam.A * 0.7 * ph, this.cam.A * 0.35 * ph, 0, 0, 6.28); ctx.stroke(); }
|
|
1320
|
-
ctx.globalAlpha = 1;
|
|
1321
|
-
this.cyl(x, y, pz + 0.26, 0.1, 0.45, pal.plinthL, pal.plinthTop);
|
|
1322
|
-
const s = this.P(x, y, pz + 0.75);
|
|
1323
|
-
if (!this.reduced()) for (let i = 0; i < 2; i++) { const ph = ((w * 1.4 + i * 0.5) % 1); ctx.fillStyle = `rgba(255,200,90,${1 - ph})`; ctx.beginPath(); ctx.arc(s[0], s[1] - ph * this.cam.A * 0.3, this.cam.A * 0.05, 0, 6.28); ctx.fill(); }
|
|
1324
|
-
}
|
|
1325
|
-
|
|
1326
|
-
drawBench(x, y, pal) {
|
|
1140
|
+
// a hexagon desk for Mel, with an amber rim
|
|
1327
1141
|
const pz = 0.3;
|
|
1328
|
-
this.
|
|
1329
|
-
|
|
1330
|
-
|
|
1142
|
+
this.hexPrism(x, y, pz, 0.7, 0.6, pal.deskTop, pal.deskL, pal.deskR);
|
|
1143
|
+
const ring = [];
|
|
1144
|
+
for (let i = 0; i < 6; i++) { const an = (Math.PI / 3) * i + Math.PI / 6; ring.push(this.P(x + 0.7 * Math.cos(an), y + 0.7 * Math.sin(an), pz + 0.6)); }
|
|
1145
|
+
this.poly(ring, null, alpha(pal.T.accent, 0.6), 1);
|
|
1331
1146
|
}
|
|
1332
1147
|
|
|
1333
1148
|
drawRack(x, y, pal) {
|
|
1334
|
-
const ctx = this.ctx;
|
|
1335
|
-
|
|
1149
|
+
const ctx = this.ctx;
|
|
1150
|
+
const T = pal.T;
|
|
1151
|
+
const pz = 0.3;
|
|
1152
|
+
this.box(x, y, pz, 0.62, 0.85, 1.55, pal.capSide, pal.leg, shade(pal.leg, -0.25), null);
|
|
1153
|
+
// activity lights: they blink only while the host runs a turn or a job
|
|
1154
|
+
const c = this.getCity();
|
|
1155
|
+
const self = c.machines?.[c.selfId] || {};
|
|
1156
|
+
const busy = ((self.live?.jobs || 0) + (self.live?.slotsBusy || 0)) > 0;
|
|
1336
1157
|
for (let i = 0; i < 6; i++) {
|
|
1337
1158
|
for (let j = 0; j < 3; j++) {
|
|
1338
|
-
const on = this.reduced() ? (i + j) % 2 :
|
|
1159
|
+
const on = busy && (this.reduced() ? (i + j) % 2 : Math.sin(this.now * (2 + j) + i * 1.7 + x) > 0.2);
|
|
1339
1160
|
const p = this.P(x + 0.62, y + 0.18 + j * 0.24, pz + 0.25 + i * 0.22);
|
|
1340
|
-
ctx.fillStyle = on ? [
|
|
1341
|
-
ctx.fillRect(p[0] - 1, p[1] - 1, Math.max(2, this.cam.A * 0.
|
|
1161
|
+
ctx.fillStyle = on ? [T.ok, T.accent, T.info][j] : alpha(T.text, 0.1);
|
|
1162
|
+
ctx.fillRect(p[0] - 1, p[1] - 1, Math.max(2, this.cam.A * 0.04), Math.max(1, this.cam.A * 0.02));
|
|
1342
1163
|
}
|
|
1343
1164
|
}
|
|
1344
|
-
void pal;
|
|
1345
|
-
}
|
|
1346
|
-
|
|
1347
|
-
drawRocket(x, y, pal) {
|
|
1348
|
-
const ctx = this.ctx; const pz = 0.3;
|
|
1349
|
-
this.cyl(x, y, pz, 0.32, 0.08, '#4A3A2B', '#5A4836');
|
|
1350
|
-
const b = this.P(x, y, pz + 0.1); const t = this.P(x, y, pz + 1.1);
|
|
1351
|
-
const w = this.cam.A * 0.2;
|
|
1352
|
-
ctx.fillStyle = '#F2E9DA'; ctx.beginPath(); ctx.moveTo(b[0] - w, b[1]); ctx.lineTo(b[0] - w, t[1] + w); ctx.quadraticCurveTo(t[0], t[1] - w * 0.8, b[0] + w, t[1] + w); ctx.lineTo(b[0] + w, b[1]); ctx.closePath(); ctx.fill();
|
|
1353
|
-
ctx.strokeStyle = 'rgba(36,22,12,.5)'; ctx.lineWidth = 1; ctx.stroke();
|
|
1354
|
-
ctx.fillStyle = '#F08A5D'; ctx.beginPath(); ctx.moveTo(b[0] - w, b[1]); ctx.lineTo(b[0] - w * 1.7, b[1] + w * 0.3); ctx.lineTo(b[0] - w, b[1] - w * 1.2); ctx.fill();
|
|
1355
|
-
ctx.beginPath(); ctx.moveTo(b[0] + w, b[1]); ctx.lineTo(b[0] + w * 1.7, b[1] + w * 0.3); ctx.lineTo(b[0] + w, b[1] - w * 1.2); ctx.fill();
|
|
1356
|
-
ctx.fillStyle = '#6CC4FF'; ctx.beginPath(); ctx.arc(b[0], (b[1] + t[1]) / 2, w * 0.45, 0, 6.28); ctx.fill();
|
|
1357
|
-
void pal;
|
|
1358
1165
|
}
|
|
1359
1166
|
|
|
1360
1167
|
drawGate(pal) {
|
|
1361
1168
|
const ctx = this.ctx; const pz = 0.3; const y = 10.05;
|
|
1362
|
-
// see through the
|
|
1169
|
+
// see through the frame when the Lobby is zoomed in
|
|
1363
1170
|
const fade = this.focus?.kind === 'room' && ROOMS[this.focus.id]?.row === 'front';
|
|
1364
1171
|
if (fade) { ctx.save(); ctx.globalAlpha = 0.28; }
|
|
1365
1172
|
this.drawGateBody(pal, pz, y);
|
|
@@ -1368,109 +1175,97 @@ export class CityScene {
|
|
|
1368
1175
|
|
|
1369
1176
|
drawGateBody(pal, pz, y) {
|
|
1370
1177
|
const ctx = this.ctx;
|
|
1371
|
-
this.box(6.
|
|
1372
|
-
this.box(9.
|
|
1373
|
-
this.box(6.
|
|
1178
|
+
this.box(6.8, y - 0.08, pz, 0.14, 0.14, 2.0, pal.cap, pal.capSide, shade(pal.capSide, -0.2), null);
|
|
1179
|
+
this.box(9.06, y - 0.08, pz, 0.14, 0.14, 2.0, pal.cap, pal.capSide, shade(pal.capSide, -0.2), null);
|
|
1180
|
+
this.box(6.7, y - 0.1, pz + 2.0, 2.6, 0.2, 0.24, pal.cap, pal.capSide, shade(pal.capSide, -0.2), null);
|
|
1374
1181
|
if (this.cam.A < 12) return;
|
|
1375
|
-
this.wallRT(y + 0.
|
|
1376
|
-
ctx.fillStyle =
|
|
1377
|
-
ctx.textAlign = 'center'; ctx.fillText('hivedesk', 8.0 * 100, 0.
|
|
1182
|
+
this.wallRT(y + 0.11, pz + 2.24, 100);
|
|
1183
|
+
ctx.fillStyle = alpha(pal.T.text, 0.85); ctx.font = `600 16px ${FONT}`;
|
|
1184
|
+
ctx.textAlign = 'center'; ctx.fillText('hivedesk', 8.0 * 100, 0.18 * 100); ctx.textAlign = 'left';
|
|
1185
|
+
ctx.fillStyle = pal.T.accent; ctx.fillRect(8.0 * 100 - 30, 0.21 * 100, 60, 1.5);
|
|
1378
1186
|
this.base();
|
|
1379
1187
|
}
|
|
1380
1188
|
|
|
1189
|
+
/** The core mast of your building: a slim hexagon column with the GPU core on top (it replaced the honey tank). */
|
|
1381
1190
|
drawTank(x, y, pal) {
|
|
1382
|
-
// a honey water tower that gives the building its silhouette, with your GPU core on top
|
|
1383
|
-
const ctx = this.ctx;
|
|
1384
|
-
for (const [dx, dy] of [[-0.6, -0.6], [0.6, -0.6], [-0.6, 0.6], [0.6, 0.6]]) {
|
|
1385
|
-
const a = this.P(x + dx, y + dy, 0); const b = this.P(x + dx * 0.6, y + dy * 0.6, TANK.z);
|
|
1386
|
-
ctx.strokeStyle = pal.rail; ctx.lineWidth = Math.max(1.5, this.cam.A * 0.07); ctx.beginPath(); ctx.moveTo(a[0], a[1]); ctx.lineTo(b[0], b[1]); ctx.stroke();
|
|
1387
|
-
}
|
|
1388
|
-
this.cyl(x, y, TANK.z, 0.95, 1.4, '#E79A2A', '#C9862A');
|
|
1389
|
-
const p = this.P(x, y, TANK.z + 0.75);
|
|
1390
|
-
ctx.fillStyle = 'rgba(255,240,200,.45)'; ctx.fillRect(p[0] - this.cam.A * 0.95, p[1] - this.cam.A * 0.35, this.cam.A * 0.22, this.cam.A * 0.95);
|
|
1391
|
-
ctx.fillStyle = '#FFF1CF'; ctx.beginPath(); hexScreen(ctx, p[0] + this.cam.A * 0.2, p[1], this.cam.A * 0.3); ctx.fill();
|
|
1392
1191
|
const c = this.getCity();
|
|
1393
1192
|
const self = c.machines?.[c.selfId] || {};
|
|
1193
|
+
// the column and a platform
|
|
1194
|
+
this.hexPrism(x, y, 0, 0.32, TANK.z, pal.tower, pal.towerL, pal.towerR);
|
|
1195
|
+
this.hexPrism(x, y, TANK.z, 0.95, 0.18, pal.cap, pal.capSide, shade(pal.capSide, -0.2));
|
|
1394
1196
|
const hostGlow = this.hostGlow || (this.hostGlow = { glow: 0 });
|
|
1395
|
-
this.drawCore(hostGlow, x, y, TANK.z +
|
|
1197
|
+
this.drawCore(hostGlow, x, y, TANK.z + 0.18, self, pal.T.accent, false);
|
|
1198
|
+
if (c.download) this.drawCrane(x, y, TANK.z + 0.3, c.download);
|
|
1396
1199
|
}
|
|
1397
1200
|
|
|
1398
|
-
|
|
1201
|
+
/** A crane over the host mast while the model downloads; the hook rises with the bytes received. */
|
|
1202
|
+
drawCrane(x, y, z, dl) {
|
|
1399
1203
|
const ctx = this.ctx;
|
|
1400
|
-
|
|
1401
|
-
const
|
|
1402
|
-
const
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1204
|
+
const T = artTokens();
|
|
1205
|
+
const A = this.cam.A;
|
|
1206
|
+
const frac = dl.total ? clamp(dl.received / dl.total) : null;
|
|
1207
|
+
const mast0 = this.P(x + 1.1, y - 0.9, z); const mast1 = this.P(x + 1.1, y - 0.9, z + 3.2);
|
|
1208
|
+
ctx.strokeStyle = this.pal.metal; ctx.lineWidth = Math.max(1, A * 0.04);
|
|
1209
|
+
ctx.beginPath(); ctx.moveTo(mast0[0], mast0[1]); ctx.lineTo(mast1[0], mast1[1]); ctx.stroke();
|
|
1210
|
+
const jib = this.P(x - 1.6, y - 0.9, z + 3.2);
|
|
1211
|
+
ctx.beginPath(); ctx.moveTo(mast1[0], mast1[1]); ctx.lineTo(jib[0], jib[1]); ctx.stroke();
|
|
1212
|
+
const hookZ = z + 0.4 + (frac ?? 0.5) * 2.4;
|
|
1213
|
+
const hook = this.P(x - 1.2, y - 0.9, hookZ);
|
|
1214
|
+
ctx.strokeStyle = alpha(T.text, 0.4); ctx.lineWidth = 1;
|
|
1215
|
+
const top = this.P(x - 1.2, y - 0.9, z + 3.2);
|
|
1216
|
+
ctx.beginPath(); ctx.moveTo(top[0], top[1]); ctx.lineTo(hook[0], hook[1]); ctx.stroke();
|
|
1217
|
+
ctx.fillStyle = T.accent; ctx.fillRect(hook[0] - A * 0.18, hook[1], A * 0.36, A * 0.22);
|
|
1218
|
+
const label = frac == null ? this.t('city.fx.downloading') : this.t('city.fx.downloadPct', { n: Math.round(frac * 100) });
|
|
1219
|
+
drawPill(ctx, jib[0], jib[1] - A * 0.6, label, T.accent, clamp(A * 0.4, 10, 12));
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1222
|
+
/** A low poly tree: a thin trunk and a faceted cone in muted green gray. */
|
|
1411
1223
|
drawTree(x, y, s, pal, z = 0) {
|
|
1412
1224
|
const ctx = this.ctx;
|
|
1413
|
-
const b = this.P(x, y, z); const t = this.P(x, y, z +
|
|
1414
|
-
ctx.fillStyle = 'rgba(
|
|
1415
|
-
ctx.strokeStyle = pal.trunk; ctx.lineWidth = Math.max(
|
|
1416
|
-
ctx.beginPath(); ctx.moveTo(b[0], b[1]); ctx.lineTo(t[0], t[1]); ctx.stroke();
|
|
1417
|
-
const
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
ctx.fillStyle = pal.treeB;
|
|
1421
|
-
ctx.
|
|
1422
|
-
ctx.fillStyle = pal.treeC; ctx.beginPath(); ctx.arc(cx - r * 0.35, cy - r * 0.3, r * 0.4, 0, 6.28); ctx.fill();
|
|
1423
|
-
ctx.strokeStyle = 'rgba(30,40,10,.35)'; ctx.lineWidth = 1; ctx.beginPath(); ctx.arc(cx - r * 0.12, cy, r * 0.8, 0, 6.28); ctx.stroke();
|
|
1225
|
+
const b = this.P(x, y, z); const t = this.P(x, y, z + 0.45 * s); const top = this.P(x, y, z + 2.0 * s);
|
|
1226
|
+
ctx.fillStyle = 'rgba(0,0,0,.18)'; ctx.beginPath(); ctx.ellipse(b[0] + this.cam.A * 0.2, b[1], this.cam.A * 0.6 * s, this.cam.A * 0.28 * s, 0, 0, 6.28); ctx.fill();
|
|
1227
|
+
ctx.strokeStyle = pal.trunk; ctx.lineWidth = Math.max(1.5, this.cam.A * 0.08 * s);
|
|
1228
|
+
ctx.beginPath(); ctx.moveTo(b[0], b[1]); ctx.lineTo(t[0], t[1]); ctx.stroke();
|
|
1229
|
+
const w = this.cam.A * 0.62 * s;
|
|
1230
|
+
ctx.fillStyle = pal.tree;
|
|
1231
|
+
ctx.beginPath(); ctx.moveTo(top[0], top[1]); ctx.lineTo(t[0] - w, t[1] - w * 0.15); ctx.lineTo(t[0], t[1] + w * 0.3); ctx.closePath(); ctx.fill();
|
|
1232
|
+
ctx.fillStyle = pal.treeB;
|
|
1233
|
+
ctx.beginPath(); ctx.moveTo(top[0], top[1]); ctx.lineTo(t[0] + w, t[1] - w * 0.15); ctx.lineTo(t[0], t[1] + w * 0.3); ctx.closePath(); ctx.fill();
|
|
1424
1234
|
}
|
|
1425
1235
|
|
|
1426
1236
|
drawLamp(x, y, pal) {
|
|
1427
1237
|
const ctx = this.ctx;
|
|
1428
1238
|
const b = this.P(x, y, 0); const t = this.P(x, y, 1.9);
|
|
1429
|
-
ctx.strokeStyle =
|
|
1239
|
+
ctx.strokeStyle = pal.metal; ctx.lineWidth = Math.max(1, this.cam.A * 0.04);
|
|
1430
1240
|
ctx.beginPath(); ctx.moveTo(b[0], b[1]); ctx.lineTo(t[0], t[1]); ctx.stroke();
|
|
1431
1241
|
const on = this.pal.night > 0.25;
|
|
1432
|
-
ctx.fillStyle = on ?
|
|
1433
|
-
|
|
1434
|
-
ctx.
|
|
1435
|
-
if (on) (this.lamps ||= []).push([t[0], t[1]
|
|
1436
|
-
void pal;
|
|
1242
|
+
ctx.fillStyle = on ? pal.lamp : pal.capSide;
|
|
1243
|
+
const s = Math.max(2, this.cam.A * 0.09);
|
|
1244
|
+
ctx.fillRect(t[0] - s, t[1] - s * 0.6, s * 2, s * 1.2);
|
|
1245
|
+
if (on) (this.lamps ||= []).push([t[0], t[1], 1.6]);
|
|
1437
1246
|
}
|
|
1438
1247
|
|
|
1439
|
-
/**
|
|
1248
|
+
/** A few trees and lamps around your building, kept clear of the bridges. */
|
|
1440
1249
|
homeDecor(pal) {
|
|
1441
1250
|
const out = [];
|
|
1442
|
-
const spots = [[-3.4, 2.6, 1.
|
|
1251
|
+
const spots = [[-3.4, 2.6, 1.0], [-2.8, 7.4, 0.9], [3.2, 14.2, 0.95], [17.6, 11.6, 0.85], [19.4, 6.4, 1.05], [14.6, -3.4, 0.9], [5.0, -3.6, 0.95]];
|
|
1443
1252
|
const clear = (x, y) => {
|
|
1444
1253
|
for (const m of this.machines.values()) {
|
|
1445
1254
|
const br = m.bridge;
|
|
1446
|
-
const vx = br.b.x - br.a.x; const vy = br.b.y - br.a.y; const L = vx * vx + vy * vy;
|
|
1447
1255
|
// distance to the line from the plaza to the bridge start, and to the bridge
|
|
1448
1256
|
for (const [ax, ay, bx, by] of [[PLAZA.x, PLAZA.y, br.a.x, br.a.y], [br.a.x, br.a.y, br.b.x, br.b.y]]) {
|
|
1449
1257
|
const wx = bx - ax; const wy = by - ay; const LL = wx * wx + wy * wy || 1;
|
|
1450
1258
|
const u = clamp(((x - ax) * wx + (y - ay) * wy) / LL);
|
|
1451
1259
|
if (Math.hypot(ax + wx * u - x, ay + wy * u - y) < 2.4) return false;
|
|
1452
1260
|
}
|
|
1453
|
-
void L;
|
|
1454
1261
|
}
|
|
1455
1262
|
return true;
|
|
1456
1263
|
};
|
|
1457
1264
|
for (const [x, y, s] of spots) if (clear(x, y)) out.push({ k: x + y, f: () => this.drawTree(x, y, s, pal) });
|
|
1458
|
-
for (const [x, y] of [[5.4, 12.0], [10.6, 12.0]
|
|
1459
|
-
// flower beds by the steps
|
|
1460
|
-
for (const [x, y] of [[5.9, 10.7], [10.1, 10.7]]) out.push({ k: x + y, f: () => this.drawFlowers(x, y) });
|
|
1265
|
+
for (const [x, y] of [[5.4, 12.0], [10.6, 12.0]]) out.push({ k: x + y, f: () => this.drawLamp(x, y, pal) });
|
|
1461
1266
|
return out;
|
|
1462
1267
|
}
|
|
1463
1268
|
|
|
1464
|
-
drawFlowers(x, y) {
|
|
1465
|
-
const ctx = this.ctx;
|
|
1466
|
-
const colors = ['#FF7AB6', '#FFD072', '#FFFFFF', '#C9A0E8'];
|
|
1467
|
-
for (let i = 0; i < 9; i++) {
|
|
1468
|
-
const p = this.P(x + ((i * 37) % 10) / 10 - 0.5, y + ((i * 53) % 10) / 22 - 0.2, 0.05);
|
|
1469
|
-
ctx.fillStyle = '#4E8F5E'; ctx.fillRect(p[0] - 0.5, p[1] - this.cam.A * 0.12, 1, this.cam.A * 0.12);
|
|
1470
|
-
ctx.fillStyle = colors[i % 4]; ctx.beginPath(); ctx.arc(p[0], p[1] - this.cam.A * 0.14, Math.max(1.4, this.cam.A * 0.06), 0, 6.28); ctx.fill();
|
|
1471
|
-
}
|
|
1472
|
-
}
|
|
1473
|
-
|
|
1474
1269
|
friendDecor(m) {
|
|
1475
1270
|
const out = [];
|
|
1476
1271
|
const c = m.center;
|
|
@@ -1478,7 +1273,7 @@ export class CityScene {
|
|
|
1478
1273
|
const born = this.now - m.born;
|
|
1479
1274
|
const show = born > 3.6 || born < -50;
|
|
1480
1275
|
if (!show) return out;
|
|
1481
|
-
for (const [dx, dy, s] of [[-5.2, 1.2, 0.
|
|
1276
|
+
for (const [dx, dy, s] of [[-5.2, 1.2, 0.85], [5.2, -1.4, 0.9]]) {
|
|
1482
1277
|
const x = c.x + dx; const y = c.y + dy;
|
|
1483
1278
|
const br = m.bridge;
|
|
1484
1279
|
const vx = br.b.x - c.x; const vy = br.b.y - c.y; const L = Math.hypot(vx, vy) || 1;
|
|
@@ -1493,82 +1288,83 @@ export class CityScene {
|
|
|
1493
1288
|
/* ---------- friend towers ---------- */
|
|
1494
1289
|
drawTower(m, pal, city) {
|
|
1495
1290
|
const ctx = this.ctx;
|
|
1291
|
+
const T = pal.T;
|
|
1496
1292
|
const tw = towerOf(m.center);
|
|
1497
1293
|
const H = this.towerHeight(m);
|
|
1498
1294
|
const floors = Math.round((H - 0.4) / FLOOR_H);
|
|
1499
1295
|
const born = this.now - m.born;
|
|
1500
1296
|
const mm = m.m || {};
|
|
1501
|
-
const col = mm.color ||
|
|
1297
|
+
const col = tone(mm.color || T.ok);
|
|
1502
1298
|
const offline = mm.online === false;
|
|
1503
1299
|
const build = born < -50 ? 1 : clamp((born - 1.0) / 2.6);
|
|
1504
1300
|
const w = tw.x1 - tw.x0;
|
|
1505
1301
|
// foundation
|
|
1506
|
-
this.box(tw.x0 - 0.3, tw.y0 - 0.3, 0, w + 0.6, w + 0.6, 0.3, pal.plinthTop, pal.plinthL, pal.plinthR);
|
|
1302
|
+
this.box(tw.x0 - 0.3, tw.y0 - 0.3, 0, w + 0.6, w + 0.6, 0.3, pal.plinthTop, pal.plinthL, pal.plinthR, null);
|
|
1507
1303
|
// floors stack up one by one while it is being built
|
|
1508
1304
|
let topZ = 0.3;
|
|
1305
|
+
const lit = !offline && (pal.night > 0.3 || (mm.live?.util ?? 0) > 0.5 || (mm.live?.jobs || 0) > 0);
|
|
1509
1306
|
for (let i = 0; i < floors; i++) {
|
|
1510
1307
|
const fs = clamp(build * floors - i);
|
|
1511
1308
|
if (fs <= 0) break;
|
|
1512
|
-
const sc = this.reduced() ? 1 :
|
|
1309
|
+
const sc = this.reduced() ? 1 : easeOut(fs);
|
|
1513
1310
|
const z0 = 0.3 + i * FLOOR_H;
|
|
1514
1311
|
const hgt = FLOOR_H * Math.min(1, sc);
|
|
1515
|
-
const inset = i === floors - 1 ? 0.
|
|
1516
|
-
const wallL = offline ?
|
|
1517
|
-
const wallR = offline ?
|
|
1518
|
-
this.box(tw.x0 + inset, tw.y0 + inset, z0, w - inset * 2, w - inset * 2, hgt, pal.tower, wallL, wallR);
|
|
1519
|
-
// a
|
|
1520
|
-
this.poly([this.P(tw.x0 + inset, tw.y1 - inset, z0 + hgt - 0.12), this.P(tw.x1 - inset, tw.y1 - inset, z0 + hgt - 0.12), this.P(tw.x1 - inset, tw.y1 - inset, z0 + hgt), this.P(tw.x0 + inset, tw.y1 - inset, z0 + hgt)], shade(col, -0.1));
|
|
1521
|
-
this.poly([this.P(tw.x1 - inset, tw.y0 + inset, z0 + hgt - 0.12), this.P(tw.x1 - inset, tw.y1 - inset, z0 + hgt - 0.12), this.P(tw.x1 - inset, tw.y1 - inset, z0 + hgt), this.P(tw.x1 - inset, tw.y0 + inset, z0 + hgt)], shade(col, -0.3));
|
|
1522
|
-
// windows with frames and a glint; warm light at night or when the GPU works hard
|
|
1312
|
+
const inset = i === floors - 1 ? 0.15 : 0;
|
|
1313
|
+
const wallL = offline ? shade(pal.towerL, -0.3) : pal.towerL;
|
|
1314
|
+
const wallR = offline ? shade(pal.towerR, -0.3) : pal.towerR;
|
|
1315
|
+
this.box(tw.x0 + inset, tw.y0 + inset, z0, w - inset * 2, w - inset * 2, hgt, pal.tower, wallL, wallR, null);
|
|
1316
|
+
// a glass curtain band on each face, lit at night or when the GPU works
|
|
1523
1317
|
if (fs >= 1) {
|
|
1524
|
-
const
|
|
1525
|
-
const glass =
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
this.poly([pt(u0, zz), pt(u1, zz), pt(u1, zz + wh), pt(u0, zz + wh)], on ? '#FFD98A' : glass);
|
|
1536
|
-
if (!on) this.poly([pt(u0 + (u1 - u0) * 0.15, zz + wh * 0.25), pt(u0 + (u1 - u0) * 0.35, zz + wh * 0.25), pt(u0 + (u1 - u0) * 0.6, zz + wh), pt(u0 + (u1 - u0) * 0.4, zz + wh)], 'rgba(255,255,255,.22)');
|
|
1537
|
-
const mid = (u0 + u1) / 2;
|
|
1538
|
-
const a = pt(mid, zz); const b = pt(mid, zz + wh);
|
|
1539
|
-
this.ctx.strokeStyle = shade(col, -0.25); this.ctx.lineWidth = Math.max(1, this.cam.A * 0.03);
|
|
1540
|
-
this.ctx.beginPath(); this.ctx.moveTo(a[0], a[1]); this.ctx.lineTo(b[0], b[1]); this.ctx.stroke();
|
|
1541
|
-
this.poly([pt(u0 - 0.1, zz - 0.06), pt(u1 + 0.1, zz - 0.06), pt(u1 + 0.1, zz - 0.13), pt(u0 - 0.1, zz - 0.13)], pal.tower);
|
|
1542
|
-
if (on) (this.windowLights ||= []).push(pt(mid, zz + wh / 2));
|
|
1543
|
-
}
|
|
1318
|
+
const zz = z0 + 0.28; const wh = 0.66;
|
|
1319
|
+
const glass = lit && (i % 2 === 0 || pal.night > 0.5) ? mixHex(pal.glassTop, T.accent2, 0.35) : pal.glassTop;
|
|
1320
|
+
for (const side of ['L', 'R']) {
|
|
1321
|
+
const pt = (u, z) => (side === 'L' ? this.P(u, tw.y1 - inset, z) : this.P(tw.x1 - inset, u, z));
|
|
1322
|
+
const a0 = (side === 'L' ? tw.x0 : tw.y0) + inset + 0.3; const a1 = (side === 'L' ? tw.x1 : tw.y1) - inset - 0.3;
|
|
1323
|
+
if (i === 0 && side === 'L') continue; // the door face of the ground floor
|
|
1324
|
+
this.poly([pt(a0, zz), pt(a1, zz), pt(a1, zz + wh), pt(a0, zz + wh)], glass);
|
|
1325
|
+
// mullions
|
|
1326
|
+
ctx.strokeStyle = alpha('#000000', 0.25); ctx.lineWidth = 1;
|
|
1327
|
+
for (let u = a0 + 0.8; u < a1 - 0.1; u += 0.8) { const p = pt(u, zz); const q = pt(u, zz + wh); ctx.beginPath(); ctx.moveTo(p[0], p[1]); ctx.lineTo(q[0], q[1]); ctx.stroke(); }
|
|
1328
|
+
if (glass !== pal.glassTop) (this.windowLights ||= []).push(pt((a0 + a1) / 2, zz + wh / 2));
|
|
1544
1329
|
}
|
|
1545
1330
|
}
|
|
1546
1331
|
topZ = z0 + hgt;
|
|
1547
1332
|
}
|
|
1548
|
-
//
|
|
1549
|
-
if (build >= 1 || born < -50) {
|
|
1550
|
-
const r0 = tw.x0 + 0.2; const r1 = tw.x1 - 0.2; const s0 = tw.y0 + 0.2; const s1 = tw.y1 - 0.2; const t = 0.14;
|
|
1551
|
-
this.box(r0, s0, topZ, r1 - r0, t, 0.22, pal.tower, pal.towerL, pal.towerR);
|
|
1552
|
-
this.box(r0, s0, topZ, t, s1 - s0, 0.22, pal.tower, pal.towerL, pal.towerR);
|
|
1553
|
-
this.box(r0, s1 - t, topZ, r1 - r0, t, 0.22, shade(pal.tower, 0.05), mixHex(pal.towerL, col, 0.25), pal.towerR);
|
|
1554
|
-
this.box(r1 - t, s0, topZ, t, s1 - s0, 0.22, shade(pal.tower, 0.05), pal.towerL, mixHex(pal.towerR, col, 0.25));
|
|
1555
|
-
this.drawPlant(r0 + 0.55, s1 - 0.55, 0.55, topZ);
|
|
1556
|
-
const an0 = this.P(r0 + 0.5, s0 + 0.5, topZ); const an1 = this.P(r0 + 0.5, s0 + 0.5, topZ + 1.5);
|
|
1557
|
-
this.ctx.strokeStyle = '#5A4836'; this.ctx.lineWidth = Math.max(1, this.cam.A * 0.04);
|
|
1558
|
-
this.ctx.beginPath(); this.ctx.moveTo(an0[0], an0[1]); this.ctx.lineTo(an1[0], an1[1]); this.ctx.stroke();
|
|
1559
|
-
const blink = this.reduced() || Math.sin(this.now * 3 + m.slot) > 0;
|
|
1560
|
-
this.ctx.fillStyle = blink ? '#FF6B5A' : '#7A3A30'; this.ctx.beginPath(); this.ctx.arc(an1[0], an1[1], Math.max(2, this.cam.A * 0.07), 0, 6.28); this.ctx.fill();
|
|
1561
|
-
}
|
|
1562
|
-
// the door with an awning in the owner's color
|
|
1333
|
+
// the owner's color: a thin vertical accent on the front corner
|
|
1563
1334
|
if (build > 0.2) {
|
|
1335
|
+
const p0 = this.P(tw.x1, tw.y1, 0.3); const p1 = this.P(tw.x1, tw.y1, topZ);
|
|
1336
|
+
ctx.strokeStyle = offline ? alpha(T.text, 0.2) : col; ctx.lineWidth = Math.max(1.5, this.cam.A * 0.05);
|
|
1337
|
+
ctx.beginPath(); ctx.moveTo(p0[0], p0[1]); ctx.lineTo(p1[0], p1[1]); ctx.stroke();
|
|
1338
|
+
// the door: a recessed dark panel
|
|
1564
1339
|
const d0 = tw.x0 + (w - 1) / 2; const d1 = d0 + 1;
|
|
1565
|
-
this.poly([this.P(d0
|
|
1566
|
-
this.poly([this.P(d0, tw.y1,
|
|
1567
|
-
|
|
1340
|
+
this.poly([this.P(d0, tw.y1, 0.3), this.P(d1, tw.y1, 0.3), this.P(d1, tw.y1, 1.2), this.P(d0, tw.y1, 1.2)], pal.screen);
|
|
1341
|
+
this.poly([this.P(d0 - 0.1, tw.y1, 1.2), this.P(d1 + 0.1, tw.y1, 1.2), this.P(d1 + 0.1, tw.y1 + 0.3, 1.26), this.P(d0 - 0.1, tw.y1 + 0.3, 1.26)], pal.cap);
|
|
1342
|
+
}
|
|
1343
|
+
// the VRAM bar on the right face: used of total, only when measured or reported
|
|
1344
|
+
if (build >= 1 || born < -50) {
|
|
1345
|
+
const v = mm.live?.vram;
|
|
1346
|
+
if (v != null && this.cam.A >= 14) {
|
|
1347
|
+
const u = tw.y0 + 0.35; const z0b = 0.55; const z1b = topZ - 0.35;
|
|
1348
|
+
const p0 = this.P(tw.x1 + 0.02, u, z0b); const p1 = this.P(tw.x1 + 0.02, u, z1b); const pf = this.P(tw.x1 + 0.02, u, z0b + (z1b - z0b) * clamp(v));
|
|
1349
|
+
ctx.lineCap = 'round';
|
|
1350
|
+
ctx.strokeStyle = alpha('#000000', 0.45); ctx.lineWidth = Math.max(3, this.cam.A * 0.1);
|
|
1351
|
+
ctx.beginPath(); ctx.moveTo(p0[0], p0[1]); ctx.lineTo(p1[0], p1[1]); ctx.stroke();
|
|
1352
|
+
ctx.strokeStyle = v > 0.9 ? T.warn : T.link; ctx.lineWidth = Math.max(2, this.cam.A * 0.06);
|
|
1353
|
+
ctx.beginPath(); ctx.moveTo(p0[0], p0[1]); ctx.lineTo(pf[0], pf[1]); ctx.stroke();
|
|
1354
|
+
ctx.lineCap = 'butt';
|
|
1355
|
+
}
|
|
1356
|
+
}
|
|
1357
|
+
// the roof: a thin parapet
|
|
1358
|
+
if (build >= 1 || born < -50) {
|
|
1359
|
+
const r0 = tw.x0 + 0.15; const r1 = tw.x1 - 0.15; const s0 = tw.y0 + 0.15; const s1 = tw.y1 - 0.15; const t = 0.08;
|
|
1360
|
+
this.box(r0, s0, topZ, r1 - r0, t, 0.14, pal.cap, pal.capSide, pal.capSide, null);
|
|
1361
|
+
this.box(r0, s0, topZ, t, s1 - s0, 0.14, pal.cap, pal.capSide, pal.capSide, null);
|
|
1362
|
+
this.box(r0, s1 - t, topZ, r1 - r0, t, 0.14, pal.cap, pal.capSide, shade(pal.capSide, -0.15), null);
|
|
1363
|
+
this.box(r1 - t, s0, topZ, t, s1 - s0, 0.14, pal.cap, pal.capSide, shade(pal.capSide, -0.15), null);
|
|
1568
1364
|
}
|
|
1569
1365
|
// scaffolding and a crane while it is being built
|
|
1570
1366
|
if (build < 1 && !this.reduced()) {
|
|
1571
|
-
ctx.strokeStyle =
|
|
1367
|
+
ctx.strokeStyle = alpha(T.text, 0.25); ctx.lineWidth = 1;
|
|
1572
1368
|
const top = 0.3 + floors * FLOOR_H;
|
|
1573
1369
|
for (const [x, y] of [[tw.x0 - 0.2, tw.y1 + 0.2], [tw.x1 + 0.2, tw.y1 + 0.2], [tw.x1 + 0.2, tw.y0 - 0.2]]) {
|
|
1574
1370
|
const a = this.P(x, y, 0.3); const b = this.P(x, y, top);
|
|
@@ -1578,27 +1374,16 @@ export class CityScene {
|
|
|
1578
1374
|
const p = [this.P(tw.x0 - 0.2, tw.y1 + 0.2, z), this.P(tw.x1 + 0.2, tw.y1 + 0.2, z), this.P(tw.x1 + 0.2, tw.y0 - 0.2, z)];
|
|
1579
1375
|
ctx.beginPath(); ctx.moveTo(p[0][0], p[0][1]); ctx.lineTo(p[1][0], p[1][1]); ctx.lineTo(p[2][0], p[2][1]); ctx.stroke();
|
|
1580
1376
|
}
|
|
1581
|
-
// the crane
|
|
1582
1377
|
const cz = top + 1.4;
|
|
1583
1378
|
const mast0 = this.P(tw.x0 + 0.4, tw.y0 + 0.4, topZ); const mast1 = this.P(tw.x0 + 0.4, tw.y0 + 0.4, cz);
|
|
1584
|
-
ctx.strokeStyle =
|
|
1379
|
+
ctx.strokeStyle = pal.metal; ctx.lineWidth = Math.max(1, this.cam.A * 0.04);
|
|
1585
1380
|
ctx.beginPath(); ctx.moveTo(mast0[0], mast0[1]); ctx.lineTo(mast1[0], mast1[1]); ctx.stroke();
|
|
1586
|
-
const
|
|
1587
|
-
const jib = this.P(tw.x0 + 0.4 + Math.cos(swing) * 4, tw.y0 + 0.4 + Math.sin(swing) * 4, cz);
|
|
1381
|
+
const jib = this.P(tw.x0 + 4.4, tw.y0 + 0.4, cz);
|
|
1588
1382
|
ctx.beginPath(); ctx.moveTo(mast1[0], mast1[1]); ctx.lineTo(jib[0], jib[1]); ctx.stroke();
|
|
1589
|
-
ctx.strokeStyle = 'rgba(36,22,12,.7)'; ctx.lineWidth = 1;
|
|
1590
|
-
const hook = [jib[0], jib[1] + this.cam.A * 1.4];
|
|
1591
|
-
ctx.beginPath(); ctx.moveTo(jib[0], jib[1]); ctx.lineTo(hook[0], hook[1]); ctx.stroke();
|
|
1592
|
-
ctx.fillStyle = '#FFD072'; ctx.fillRect(hook[0] - this.cam.A * 0.2, hook[1], this.cam.A * 0.4, this.cam.A * 0.25);
|
|
1593
|
-
if (Math.random() < 0.25) { const p = this.P(rnd(tw.x0, tw.x1), tw.y1 + 0.2, topZ); this.spawn({ kind: 'puff', x: p[0], y: p[1], vx: rnd(-14, 14), vy: rnd(-20, -6), life: rnd(0.6, 1), size: rnd(4, 9) * this.cam.A / 30 }); }
|
|
1594
1383
|
}
|
|
1595
|
-
// the GPU core on the roof
|
|
1384
|
+
// the GPU core on the roof
|
|
1596
1385
|
const coreOn = build >= 1 || born < -50;
|
|
1597
|
-
if (coreOn)
|
|
1598
|
-
this.box((tw.x0 + tw.x1) / 2 - 0.7, (tw.y0 + tw.y1) / 2 - 0.7, topZ, 1.4, 1.4, 0.25, '#4A3A2B', '#3A2F25', '#2A2420');
|
|
1599
|
-
this.drawCore(m, (tw.x0 + tw.x1) / 2, (tw.y0 + tw.y1) / 2, topZ + 0.05, mm, col, offline);
|
|
1600
|
-
if (born > 3.5 && born < 3.9 && !m.flashed && !this.reduced()) { m.flashed = true; const [cx, cy] = m.coreAt; for (let i = 0; i < 18; i++) this.spawn({ kind: 'spark', x: cx + rnd(-30, 30), y: cy + rnd(-30, 20), vx: rnd(-50, 50), vy: rnd(-70, -10), g: 40, life: rnd(0.6, 1.2), size: rnd(2, 4.5), color: pick(['#7FE3FF', '#FFFFFF', col]) }); this.sound('level'); }
|
|
1601
|
-
}
|
|
1386
|
+
if (coreOn) this.drawCore(m, (tw.x0 + tw.x1) / 2, (tw.y0 + tw.y1) / 2, topZ, mm, col, offline);
|
|
1602
1387
|
// hit box for the machine panel
|
|
1603
1388
|
const pts = [this.P(tw.x0 - 0.3, tw.y1 + 0.3, 0), this.P(tw.x1 + 0.3, tw.y1 + 0.3, 0), this.P(tw.x1 + 0.3, tw.y0 - 0.3, 0), this.P(tw.x0, tw.y0, H + 1.6)];
|
|
1604
1389
|
const xs = pts.map((p) => p[0]); const ys = pts.map((p) => p[1]);
|
|
@@ -1606,31 +1391,41 @@ export class CityScene {
|
|
|
1606
1391
|
void city;
|
|
1607
1392
|
}
|
|
1608
1393
|
|
|
1609
|
-
|
|
1610
|
-
|
|
1394
|
+
/**
|
|
1395
|
+
* The GPU core of a machine: a hexagon prism on the roof. Its top lights while a turn or a job
|
|
1396
|
+
* runs here, and the load ring around it is the measured GPU use (no measurement, no ring).
|
|
1397
|
+
*/
|
|
1611
1398
|
drawCore(holder, x, y, z, mm, col, offline) {
|
|
1612
1399
|
const ctx = this.ctx;
|
|
1613
|
-
const
|
|
1614
|
-
const
|
|
1615
|
-
const
|
|
1616
|
-
const
|
|
1400
|
+
const T = artTokens();
|
|
1401
|
+
const pal = this.pal;
|
|
1402
|
+
const live = mm.live || {};
|
|
1403
|
+
const util = live.util == null ? null : clamp(live.util);
|
|
1404
|
+
const busy = (live.jobs || 0) + (live.slotsBusy || 0) > 0;
|
|
1405
|
+
const glow = clamp(holder.glow || 0);
|
|
1406
|
+
const top = offline ? pal.capSide : busy || glow > 0.05 ? mixHex(pal.cap, T.accent, 0.35 + glow * 0.3) : pal.cap;
|
|
1407
|
+
this.hexPrism(x, y, z, 0.62, 0.32, top, pal.capSide, shade(pal.capSide, -0.2));
|
|
1408
|
+
const c = this.P(x, y, z + 0.32);
|
|
1617
1409
|
const R = this.cam.A * 0.62;
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
ctx.
|
|
1622
|
-
ctx.
|
|
1623
|
-
ctx.
|
|
1624
|
-
ctx.beginPath(); hexScreen(ctx, 0, 0, R);
|
|
1625
|
-
const cg = ctx.createLinearGradient(0, -R, 0, R);
|
|
1626
|
-
cg.addColorStop(0, offline ? '#8A8A8A' : '#CFF6FF'); cg.addColorStop(1, offline ? '#555555' : mixHex('#4FB6E0', col, 0.25));
|
|
1627
|
-
ctx.fillStyle = cg; ctx.fill();
|
|
1628
|
-
ctx.strokeStyle = 'rgba(20,40,60,.7)'; ctx.lineWidth = 1.2; ctx.stroke();
|
|
1629
|
-
ctx.fillStyle = 'rgba(255,255,255,.55)'; ctx.beginPath(); hexScreen(ctx, -R * 0.2, -R * 0.25, R * 0.3); ctx.fill();
|
|
1410
|
+
// the hexagon inlay on top
|
|
1411
|
+
ctx.save();
|
|
1412
|
+
ctx.translate(c[0], c[1]); ctx.scale(1, 0.5);
|
|
1413
|
+
ctx.beginPath(); hexScreen(ctx, 0, 0, R * 0.55);
|
|
1414
|
+
ctx.strokeStyle = offline ? alpha(T.text, 0.15) : alpha(busy ? T.accent : T.text, busy ? 0.9 : 0.3); ctx.lineWidth = 1.2;
|
|
1415
|
+
ctx.stroke();
|
|
1630
1416
|
ctx.restore();
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1417
|
+
// the load ring: a track and the measured share, flat on the roof
|
|
1418
|
+
if (util != null && !offline) {
|
|
1419
|
+
ctx.lineCap = 'round';
|
|
1420
|
+
ctx.strokeStyle = alpha(T.text, 0.12); ctx.lineWidth = Math.max(1.5, this.cam.A * 0.05);
|
|
1421
|
+
ctx.beginPath(); ctx.ellipse(c[0], c[1], R * 1.35, R * 0.68, 0, 0, 6.28); ctx.stroke();
|
|
1422
|
+
ctx.strokeStyle = util > 0.9 ? T.warn : T.accent;
|
|
1423
|
+
ctx.beginPath(); ctx.ellipse(c[0], c[1], R * 1.35, R * 0.68, 0, -Math.PI / 2, -Math.PI / 2 + Math.PI * 2 * Math.max(0.02, util)); ctx.stroke();
|
|
1424
|
+
ctx.lineCap = 'butt';
|
|
1425
|
+
}
|
|
1426
|
+
if (busy && !offline) (this.lamps ||= []).push([c[0], c[1], 1.2, rgb(T.accent).join(',')]);
|
|
1427
|
+
holder.coreAt = [c[0], c[1], R];
|
|
1428
|
+
void col;
|
|
1634
1429
|
}
|
|
1635
1430
|
|
|
1636
1431
|
/* ---------- bridges ---------- */
|
|
@@ -1641,94 +1436,149 @@ export class CityScene {
|
|
|
1641
1436
|
if (ext <= 0) return;
|
|
1642
1437
|
if (!this.visible(Math.min(br.a.x, br.b.x) - 1, Math.min(br.a.y, br.b.y) - 1, Math.max(br.a.x, br.b.x) + 1, Math.max(br.a.y, br.b.y) + 1, 4, -1)) return;
|
|
1643
1438
|
const ctx = this.ctx;
|
|
1439
|
+
const T = pal.T;
|
|
1644
1440
|
const n = 26;
|
|
1645
|
-
const px = -br.uy * 0.
|
|
1441
|
+
const px = -br.uy * 0.6; const py = br.ux * 0.6;
|
|
1646
1442
|
const segs = Math.max(1, Math.round(n * ext));
|
|
1647
1443
|
const pt = (u, side, dz = 0) => { const p = bridgePoint(br, u); return this.P(p.x + px * side, p.y + py * side, p.z + dz); };
|
|
1648
|
-
// the side of the deck that faces the viewer
|
|
1649
1444
|
const front = (px + py) > 0 ? 1 : -1;
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
//
|
|
1656
|
-
ctx.strokeStyle = pal.rail; ctx.lineWidth =
|
|
1657
|
-
ctx.beginPath();
|
|
1658
|
-
for (let i = 0; i <= segs; i++) { const p = pt(i / n, front, -0.28 - Math.sin(Math.PI * i / n) * 0.6); if (i) ctx.lineTo(p[0], p[1]); else ctx.moveTo(p[0], p[1]); }
|
|
1659
|
-
ctx.stroke();
|
|
1660
|
-
// railings and posts
|
|
1661
|
-
const glow = clamp(m.glow);
|
|
1662
|
-
const borrowing = borrowTo(city, m.id);
|
|
1445
|
+
// a precise steel deck: one fascia, one plate
|
|
1446
|
+
const fascia = []; const plate = [];
|
|
1447
|
+
for (let i = 0; i <= segs; i++) { fascia.push(pt(i / n, front, 0)); plate.push(pt(i / n, -front, 0)); }
|
|
1448
|
+
this.poly([...fascia, ...fascia.slice().reverse().map((p) => [p[0], p[1] + Math.max(2, this.cam.A * 0.16)])], pal.deckSide);
|
|
1449
|
+
this.poly([...fascia, ...plate.slice().reverse()], pal.deck);
|
|
1450
|
+
// hairline rails and sparse posts
|
|
1451
|
+
ctx.strokeStyle = pal.rail; ctx.lineWidth = 1;
|
|
1663
1452
|
for (const side of [-1, 1]) {
|
|
1664
|
-
ctx.strokeStyle = pal.rail; ctx.lineWidth = Math.max(1, this.cam.A * 0.05);
|
|
1665
|
-
for (let i = 0; i <= segs; i += 2) { const a = pt(i / n, side); const b = pt(i / n, side, 0.55); ctx.beginPath(); ctx.moveTo(a[0], a[1]); ctx.lineTo(b[0], b[1]); ctx.stroke(); }
|
|
1666
1453
|
ctx.beginPath();
|
|
1667
|
-
for (let i = 0; i <= segs; i++) { const p = pt(i / n, side, 0.
|
|
1454
|
+
for (let i = 0; i <= segs; i++) { const p = pt(i / n, side, 0.45); if (i) ctx.lineTo(p[0], p[1]); else ctx.moveTo(p[0], p[1]); }
|
|
1668
1455
|
ctx.stroke();
|
|
1456
|
+
for (let i = 0; i <= segs; i += 4) { const a = pt(i / n, side); const b = pt(i / n, side, 0.45); ctx.beginPath(); ctx.moveTo(a[0], a[1]); ctx.lineTo(b[0], b[1]); ctx.stroke(); }
|
|
1669
1457
|
}
|
|
1670
|
-
// the
|
|
1458
|
+
// the data line along the deck
|
|
1671
1459
|
const cablePts = [];
|
|
1672
|
-
for (let i = 0; i <= segs; i++) cablePts.push(pt(i / n, 0, 0.
|
|
1460
|
+
for (let i = 0; i <= segs; i++) cablePts.push(pt(i / n, 0, 0.02));
|
|
1461
|
+
const glow = clamp(m.glow);
|
|
1462
|
+
const borrowing = borrowTo(city, m.id);
|
|
1673
1463
|
ctx.lineCap = 'round';
|
|
1674
|
-
ctx.strokeStyle = alpha(
|
|
1675
|
-
ctx.lineWidth = Math.max(1.2, this.cam.A * 0.06);
|
|
1464
|
+
ctx.strokeStyle = alpha(T.text, 0.12); ctx.lineWidth = 1;
|
|
1676
1465
|
ctx.beginPath(); cablePts.forEach((p, i) => (i ? ctx.lineTo(p[0], p[1]) : ctx.moveTo(p[0], p[1]))); ctx.stroke();
|
|
1677
|
-
|
|
1466
|
+
// a borrowed GPU: a clean glowing link line
|
|
1467
|
+
if (borrowing || glow > 0.02) {
|
|
1678
1468
|
ctx.save();
|
|
1679
1469
|
ctx.globalCompositeOperation = 'lighter';
|
|
1680
|
-
const g = Math.max(glow, borrowing ? 0.
|
|
1681
|
-
ctx.strokeStyle = borrowing ?
|
|
1682
|
-
ctx.lineWidth = Math.max(
|
|
1683
|
-
ctx.shadowColor = borrowing ?
|
|
1470
|
+
const g = Math.max(glow, borrowing ? 0.6 : 0);
|
|
1471
|
+
ctx.strokeStyle = alpha(borrowing ? T.link : T.accent, 0.55 * g);
|
|
1472
|
+
ctx.lineWidth = Math.max(1.5, this.cam.A * 0.07);
|
|
1473
|
+
ctx.shadowColor = borrowing ? T.link : T.accent; ctx.shadowBlur = 8 * g;
|
|
1684
1474
|
ctx.beginPath(); cablePts.forEach((p, i) => (i ? ctx.lineTo(p[0], p[1]) : ctx.moveTo(p[0], p[1]))); ctx.stroke();
|
|
1685
|
-
if (borrowing && !this.reduced()) {
|
|
1686
|
-
ctx.setLineDash([this.cam.A * 0.4, this.cam.A * 0.6]);
|
|
1687
|
-
ctx.lineDashOffset = -this.now * this.cam.A * 3;
|
|
1688
|
-
ctx.strokeStyle = 'rgba(220,250,255,.9)'; ctx.lineWidth = Math.max(1.5, this.cam.A * 0.08); ctx.shadowBlur = 0;
|
|
1689
|
-
ctx.beginPath(); cablePts.forEach((p, i) => (i ? ctx.lineTo(p[0], p[1]) : ctx.moveTo(p[0], p[1]))); ctx.stroke();
|
|
1690
|
-
ctx.setLineDash([]);
|
|
1691
|
-
}
|
|
1692
1475
|
ctx.restore();
|
|
1693
1476
|
}
|
|
1694
1477
|
ctx.lineCap = 'butt';
|
|
1695
|
-
// lanterns
|
|
1696
|
-
for (const u of [0.15, 0.5, 0.85]) {
|
|
1697
|
-
if (u > ext) continue;
|
|
1698
|
-
const p = pt(u, front, 0.8);
|
|
1699
|
-
const on = this.pal.night > 0.25 || glow > 0.1 || borrowing;
|
|
1700
|
-
ctx.fillStyle = on ? (borrowing ? '#BFF3FF' : '#FFE3A1') : '#C9B48A';
|
|
1701
|
-
ctx.beginPath(); hexScreen(ctx, p[0], p[1], Math.max(2.5, this.cam.A * 0.13)); ctx.fill();
|
|
1702
|
-
ctx.strokeStyle = 'rgba(36,22,12,.6)'; ctx.lineWidth = 1; ctx.stroke();
|
|
1703
|
-
if (on) (this.lamps ||= []).push([p[0], p[1], borrowing ? 1.6 : 1.3, borrowing ? '127,227,255' : null]);
|
|
1704
|
-
}
|
|
1705
1478
|
m.cable = cablePts;
|
|
1479
|
+
// a job streams tokens over this bridge: a steady stream of data particles (it stops when the tokens stop)
|
|
1480
|
+
const jb = m.m?.bridge;
|
|
1481
|
+
if (jb?.live && !this.reduced() && cablePts.length > 1) {
|
|
1482
|
+
ctx.save();
|
|
1483
|
+
ctx.globalCompositeOperation = 'lighter';
|
|
1484
|
+
const count = 9;
|
|
1485
|
+
for (let i = 0; i < count; i++) {
|
|
1486
|
+
const u = ((this.now * 0.35 + i / count) % 1);
|
|
1487
|
+
const q0 = bridgePoint(br, u * ext); const q = this.P(q0.x, q0.y, q0.z + 0.04);
|
|
1488
|
+
ctx.fillStyle = alpha(T.link, 0.9 * Math.sin(Math.PI * u));
|
|
1489
|
+
ctx.beginPath(); ctx.arc(q[0], q[1], Math.max(1.5, this.cam.A * 0.06), 0, 6.28); ctx.fill();
|
|
1490
|
+
}
|
|
1491
|
+
ctx.restore();
|
|
1492
|
+
}
|
|
1493
|
+
// a failed job: a broken segment in the middle of the deck, with the reason; a click opens the job
|
|
1494
|
+
if (jb?.failed && ext >= 1) {
|
|
1495
|
+
const a = pt(0.44, 0, 0.02); const b = pt(0.56, 0, 0.02);
|
|
1496
|
+
this.poly([pt(0.46, -1.05), pt(0.54, -1.05), pt(0.54, 1.05), pt(0.46, 1.05)], pal.void1);
|
|
1497
|
+
const c0 = pt(0.47, -1); const c1 = pt(0.53, 1); const c2 = pt(0.47, 1); const c3 = pt(0.53, -1);
|
|
1498
|
+
ctx.strokeStyle = T.bad; ctx.lineWidth = Math.max(1.2, this.cam.A * 0.04);
|
|
1499
|
+
ctx.beginPath(); ctx.moveTo(c0[0], c0[1]); ctx.lineTo(c1[0], c1[1]); ctx.moveTo(c2[0], c2[1]); ctx.lineTo(c3[0], c3[1]); ctx.stroke();
|
|
1500
|
+
const mid = pt(0.5, 0, 1.2);
|
|
1501
|
+
const text = this.t(`city.job.err.${jb.failed.code}`);
|
|
1502
|
+
drawPill(ctx, mid[0], mid[1], text, T.bad, clamp(this.cam.A * 0.4, 10, 12));
|
|
1503
|
+
const r = Math.max(26, this.cam.A * 1.2);
|
|
1504
|
+
(this.bridgeHits ||= []).push({ jobId: jb.failed.id, x: Math.min(a[0], b[0]) - r / 2, y: Math.min(a[1], b[1], mid[1]) - r / 2, w: Math.abs(a[0] - b[0]) + r, h: Math.abs(a[1] - mid[1]) + r });
|
|
1505
|
+
}
|
|
1506
|
+
}
|
|
1507
|
+
|
|
1508
|
+
/** The pipeline order on the corridor floor: hairline chevrons from each back room to the next. */
|
|
1509
|
+
drawPipeline(c) {
|
|
1510
|
+
const A = this.cam.A;
|
|
1511
|
+
if (A < 13 || this.focus?.kind === 'machine') return;
|
|
1512
|
+
const order = (c.pipeline || []).filter((r) => ROOMS[r]?.row === 'back');
|
|
1513
|
+
const ctx = this.ctx;
|
|
1514
|
+
ctx.save();
|
|
1515
|
+
ctx.strokeStyle = alpha(artTokens().text, 0.3); ctx.lineWidth = 1; ctx.lineCap = 'round'; ctx.lineJoin = 'round';
|
|
1516
|
+
for (let i = 0; i < order.length - 1; i++) {
|
|
1517
|
+
const a = ROOMS[order[i]]; const b = ROOMS[order[i + 1]];
|
|
1518
|
+
const x0 = a.x0 + 2; const x1 = b.x0 + 2;
|
|
1519
|
+
const dir = Math.sign(x1 - x0) || 1;
|
|
1520
|
+
const y = CORRIDOR_Y - 0.15;
|
|
1521
|
+
for (let x = x0 + dir * 0.9; dir > 0 ? x < x1 - 0.6 : x > x1 + 0.6; x += dir * 0.8) {
|
|
1522
|
+
const p = this.P(x, y, 0.31); const q = this.P(x - dir * 0.18, y - 0.14, 0.31); const r = this.P(x - dir * 0.18, y + 0.14, 0.31);
|
|
1523
|
+
ctx.beginPath(); ctx.moveTo(q[0], q[1]); ctx.lineTo(p[0], p[1]); ctx.lineTo(r[0], r[1]); ctx.stroke();
|
|
1524
|
+
}
|
|
1525
|
+
}
|
|
1526
|
+
ctx.restore();
|
|
1527
|
+
}
|
|
1528
|
+
|
|
1529
|
+
/** A task that a check sent back: an arc from that room to the work room, while it waits or works there. */
|
|
1530
|
+
drawLoops(c) {
|
|
1531
|
+
const A = this.cam.A;
|
|
1532
|
+
if (A < 9 || !c.loops?.length) return;
|
|
1533
|
+
const ctx = this.ctx;
|
|
1534
|
+
const T = artTokens();
|
|
1535
|
+
const seen = new Map();
|
|
1536
|
+
for (const l of c.loops) {
|
|
1537
|
+
const a = ROOMS[l.from]; const b = ROOMS[l.to];
|
|
1538
|
+
if (!a || !b) continue;
|
|
1539
|
+
const k = `${l.from}>${l.to}`;
|
|
1540
|
+
const lane = seen.get(k) || 0; seen.set(k, lane + 1);
|
|
1541
|
+
const za = a.row === 'back' ? WALL + 0.9 : 2.2; const zb = b.row === 'back' ? WALL + 0.9 : 2.2;
|
|
1542
|
+
const ca = roomCenter(l.from); const cb = roomCenter(l.to);
|
|
1543
|
+
const p0 = this.P(ca.x, a.y0 + 1.2, za); const p1 = this.P(cb.x, b.y0 + 1.2, zb);
|
|
1544
|
+
const lift = A * (2.2 + lane * 0.7);
|
|
1545
|
+
const mx = (p0[0] + p1[0]) / 2; const my = Math.min(p0[1], p1[1]) - lift;
|
|
1546
|
+
ctx.save();
|
|
1547
|
+
ctx.strokeStyle = alpha(T.bad, 0.85); ctx.lineWidth = Math.max(1.2, A * 0.04); ctx.lineCap = 'round';
|
|
1548
|
+
if (!this.reduced()) { ctx.setLineDash([A * 0.3, A * 0.22]); ctx.lineDashOffset = this.now * A * 0.8; }
|
|
1549
|
+
ctx.beginPath(); ctx.moveTo(p0[0], p0[1]); ctx.quadraticCurveTo(mx, my, p1[0], p1[1]); ctx.stroke();
|
|
1550
|
+
ctx.setLineDash([]);
|
|
1551
|
+
// the arrow head at the work room
|
|
1552
|
+
const tx = p1[0] - mx; const ty = p1[1] - my; const len = Math.hypot(tx, ty) || 1;
|
|
1553
|
+
const ux = tx / len; const uy = ty / len; const s = Math.max(5, A * 0.24);
|
|
1554
|
+
ctx.fillStyle = T.bad;
|
|
1555
|
+
ctx.beginPath(); ctx.moveTo(p1[0], p1[1]); ctx.lineTo(p1[0] - ux * s - uy * s * 0.5, p1[1] - uy * s + ux * s * 0.5); ctx.lineTo(p1[0] - ux * s + uy * s * 0.5, p1[1] - uy * s - ux * s * 0.5); ctx.closePath(); ctx.fill();
|
|
1556
|
+
ctx.restore();
|
|
1557
|
+
if (A >= 12) drawPill(ctx, mx, (Math.min(p0[1], p1[1]) + my) / 2 + lift * 0.25, this.t('city.fx.loop', { n: l.n, max: l.max || 3 }), T.bad, clamp(A * 0.4, 10, 12));
|
|
1558
|
+
}
|
|
1706
1559
|
}
|
|
1707
1560
|
|
|
1561
|
+
/** One data packet per task or GPU turn crossing a bridge, with a short trail. */
|
|
1708
1562
|
drawCouriers() {
|
|
1709
1563
|
const ctx = this.ctx;
|
|
1710
1564
|
for (const cr of this.couriers) {
|
|
1711
1565
|
const br = cr.m.bridge;
|
|
1712
1566
|
const u0 = clamp((this.now - cr.t0) / cr.dur);
|
|
1713
1567
|
const e = easeInOut(u0);
|
|
1714
|
-
// home side: from the plaza onto the bridge; friend side: from the tower
|
|
1715
1568
|
const u = cr.dir > 0 ? e : 1 - e;
|
|
1716
1569
|
const p0 = bridgePoint(br, u);
|
|
1717
|
-
const p = this.P(p0.x, p0.y, p0.z + 0.
|
|
1570
|
+
const p = this.P(p0.x, p0.y, p0.z + 0.08);
|
|
1718
1571
|
ctx.save();
|
|
1719
1572
|
ctx.globalCompositeOperation = 'lighter';
|
|
1720
|
-
for (let i = 1; i <=
|
|
1721
|
-
const uu = clamp(u - cr.dir * i * 0.
|
|
1722
|
-
const q0 = bridgePoint(br, uu); const q = this.P(q0.x, q0.y, q0.z + 0.
|
|
1723
|
-
ctx.fillStyle = alpha(cr.color, 0.
|
|
1724
|
-
ctx.beginPath(); ctx.arc(q[0], q[1], Math.max(2, this.cam.A * 0.
|
|
1573
|
+
for (let i = 1; i <= 5; i++) {
|
|
1574
|
+
const uu = clamp(u - cr.dir * i * 0.012);
|
|
1575
|
+
const q0 = bridgePoint(br, uu); const q = this.P(q0.x, q0.y, q0.z + 0.08);
|
|
1576
|
+
ctx.fillStyle = alpha(cr.color, 0.4 * (1 - i / 6));
|
|
1577
|
+
ctx.beginPath(); ctx.arc(q[0], q[1], Math.max(1.2, this.cam.A * 0.05) * (1 - i / 8), 0, 6.28); ctx.fill();
|
|
1725
1578
|
}
|
|
1726
|
-
const g = ctx.createRadialGradient(p[0], p[1], 1, p[0], p[1], this.cam.A * 0.8);
|
|
1727
|
-
g.addColorStop(0, alpha(cr.color, 0.9)); g.addColorStop(1, alpha(cr.color, 0));
|
|
1728
|
-
ctx.fillStyle = g; ctx.fillRect(p[0] - this.cam.A, p[1] - this.cam.A, this.cam.A * 2, this.cam.A * 2);
|
|
1729
1579
|
ctx.restore();
|
|
1730
|
-
if (cr.kind === 'task') drawNoteIcon(ctx, p[0], p[1] - this.cam.A * 0.
|
|
1731
|
-
else { ctx.fillStyle =
|
|
1580
|
+
if (cr.kind === 'task') drawNoteIcon(ctx, p[0], p[1] - this.cam.A * 0.2, Math.max(10, this.cam.A * 0.42), null, cr.color);
|
|
1581
|
+
else { ctx.fillStyle = cr.color; ctx.beginPath(); hexScreen(ctx, p[0], p[1], Math.max(2.5, this.cam.A * 0.1)); ctx.fill(); }
|
|
1732
1582
|
}
|
|
1733
1583
|
}
|
|
1734
1584
|
|
|
@@ -1738,64 +1588,52 @@ export class CityScene {
|
|
|
1738
1588
|
const now = this.now;
|
|
1739
1589
|
const reduced = this.reduced();
|
|
1740
1590
|
const k = this.k;
|
|
1741
|
-
|
|
1591
|
+
const T = artTokens();
|
|
1742
1592
|
const m = a.mode;
|
|
1593
|
+
let hover = 0; let wingAmp = 0.1; let wingRate = 16;
|
|
1743
1594
|
if (!reduced) {
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
}
|
|
1751
|
-
case 'working': bob = Math.sin(now * 16 + a.ph) * 0.018; wingRate = 26; break;
|
|
1752
|
-
case 'thinking': bob = Math.sin(now * 3 + a.ph) * 0.05; break;
|
|
1753
|
-
case 'waiting': { const beat = (now * 2.2 + a.ph) % 1; bob = beat < 0.2 ? -Math.sin((beat / 0.2) * Math.PI) * 0.05 : 0; wingRate = 14; wingAmp = 0.18; break; }
|
|
1754
|
-
case 'reviewing': bob = Math.sin(now * 2 + a.ph) * 0.03; tilt = Math.sin(now * 1.2) * 0.05; break;
|
|
1755
|
-
case 'testing': bob = Math.sin(now * 5 + a.ph) * 0.03; break;
|
|
1756
|
-
case 'borrow': bob = Math.sin(now * 3 + a.ph) * 0.08; wingRate = 34; wingAmp = 0.42; break;
|
|
1757
|
-
case 'sleep': bob = Math.sin(now * 1.1 + a.ph) * 0.012; tilt = 0.24; eyes = true; wingRate = 0; wingAmp = 0; break;
|
|
1758
|
-
default: bob = Math.sin(now * 2.2 + a.ph) * 0.05;
|
|
1759
|
-
}
|
|
1760
|
-
const sq = now - a.squashAt;
|
|
1761
|
-
if (sq < 0.5) { const d = Math.exp(-sq * 9) * Math.cos(sq * 22) * 0.16; sy *= 1 - d; sx *= 1 + d * 0.8; }
|
|
1762
|
-
} else if (m === 'sleep') { tilt = 0.18; eyes = true; wingAmp = 0; } else { wingRate = 0; wingAmp = 0.2; }
|
|
1763
|
-
if (now >= a.blinkAt && now < a.blinkAt + 0.13) eyes = true;
|
|
1764
|
-
const p = this.P(a.pos.x, a.pos.y, a.pos.z + (a.place.kind === 'room' && !a.path.length ? 0.3 : 0) + bob);
|
|
1595
|
+
if (m === 'walk') { wingAmp = 0.22; wingRate = 28; hover = 0.04; }
|
|
1596
|
+
else if (m === 'borrow') { wingAmp = 0.16; wingRate = 22; hover = Math.sin(now * 1.6 + a.ph) * 0.03; }
|
|
1597
|
+
else if (m === 'sleep') { wingAmp = 0; }
|
|
1598
|
+
else hover = Math.sin(now * 1.5 + a.ph) * 0.015;
|
|
1599
|
+
} else wingAmp = 0;
|
|
1600
|
+
const p = this.P(a.pos.x, a.pos.y, a.pos.z + (a.place.kind === 'room' && !a.path.length ? 0.3 : 0) + hover);
|
|
1765
1601
|
a.sx = p[0]; a.sy = p[1];
|
|
1766
|
-
//
|
|
1602
|
+
// the status ring on the ground under the unit
|
|
1767
1603
|
const groundZ = a.path.length && a.path[0].bridge ? bridgeGroundZ(a) : (a.place.kind === 'room' && roomAt(a.pos.x, a.pos.y) ? 0.3 : a.pos.z > 2 ? this.towerHeight(this.machines.get(a.place.machine) || {}) : 0);
|
|
1768
1604
|
const sp = this.P(a.pos.x, a.pos.y, Math.min(groundZ, a.pos.z));
|
|
1769
|
-
|
|
1770
|
-
|
|
1605
|
+
const sc = statusColor(m === 'walk' ? (a.ag.taskId ? 'working' : 'idle') : m, T);
|
|
1606
|
+
const sleep = m === 'sleep';
|
|
1607
|
+
const pulsing = m === 'thinking' && !reduced;
|
|
1608
|
+
ctx.save();
|
|
1609
|
+
ctx.globalAlpha = a.alpha * (sleep ? 0.5 : pulsing ? 0.55 + 0.35 * (0.5 + 0.5 * Math.sin(now * 3.4 + a.ph)) : 0.9);
|
|
1610
|
+
ctx.fillStyle = 'rgba(0,0,0,.25)';
|
|
1611
|
+
ctx.beginPath(); ctx.ellipse(sp[0], sp[1], 14 * k, 6 * k, 0, 0, 6.28); ctx.fill();
|
|
1612
|
+
ctx.strokeStyle = sc; ctx.lineWidth = Math.max(1, k * 1.8);
|
|
1613
|
+
if (sleep) ctx.setLineDash([3, 3]);
|
|
1614
|
+
ctx.beginPath(); ctx.ellipse(sp[0], sp[1], 17 * k, 7.5 * k, 0, 0, 6.28); ctx.stroke();
|
|
1615
|
+
ctx.restore();
|
|
1771
1616
|
const img = this.sprite(a.ag);
|
|
1772
1617
|
ctx.save();
|
|
1773
1618
|
ctx.globalAlpha = a.alpha;
|
|
1774
1619
|
ctx.translate(p[0], p[1]);
|
|
1775
|
-
|
|
1776
|
-
ctx.
|
|
1777
|
-
|
|
1778
|
-
ctx.
|
|
1779
|
-
const
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
ctx.save(); ctx.translate((wx + dir * -6) * k, 30 * k); ctx.rotate(dir * (0.56 - flap));
|
|
1783
|
-
ctx.beginPath(); ctx.ellipse(dir * 7 * k, -4 * k, 10.5 * k, 6 * k * (1 - Math.abs(flap) * 0.35), 0, 0, 6.28); ctx.fill(); ctx.stroke();
|
|
1620
|
+
// anchor: SVG point (32, 44) sits on the world point
|
|
1621
|
+
ctx.translate(-32 * k, -44 * k);
|
|
1622
|
+
const flap = wingAmp ? Math.sin(now * wingRate + a.ph) * wingAmp : 0;
|
|
1623
|
+
ctx.fillStyle = alpha(T.text, 0.12); ctx.strokeStyle = alpha(T.text, 0.42); ctx.lineWidth = Math.max(0.6, k);
|
|
1624
|
+
for (const [wx, dir] of [[19, -1], [45, 1]]) {
|
|
1625
|
+
ctx.save(); ctx.translate(wx * k, 27 * k); ctx.rotate(dir * (0.42 - flap));
|
|
1626
|
+
ctx.beginPath(); ctx.ellipse(dir * 4 * k, -2 * k, 11 * k, 5.4 * k, 0, 0, 6.28); ctx.fill(); ctx.stroke();
|
|
1784
1627
|
ctx.restore();
|
|
1785
1628
|
}
|
|
1786
1629
|
if (img) ctx.drawImage(img, -4 * k, -2 * k, 72 * k, 76 * k);
|
|
1787
|
-
else { ctx.fillStyle = a.ag.color; ctx.beginPath(); ctx.arc(32 * k,
|
|
1788
|
-
if (eyes) {
|
|
1789
|
-
ctx.fillStyle = '#FCC041'; ctx.strokeStyle = OUT; ctx.lineWidth = Math.max(0.8, 1.3 * k); ctx.lineCap = 'round';
|
|
1790
|
-
for (const ex of [25.6, 38.4]) { ctx.beginPath(); ctx.ellipse(ex * k, 31.6 * k, 4.3 * k, 5.1 * k, 0, 0, 6.28); ctx.fill(); ctx.beginPath(); ctx.moveTo((ex - 3) * k, 32 * k); ctx.quadraticCurveTo(ex * k, 34.8 * k, (ex + 3) * k, 32 * k); ctx.stroke(); }
|
|
1791
|
-
ctx.lineCap = 'butt';
|
|
1792
|
-
}
|
|
1630
|
+
else { ctx.fillStyle = tone(a.ag.color || T.accent); ctx.beginPath(); ctx.arc(32 * k, 40 * k, 14 * k, 0, 6.28); ctx.fill(); }
|
|
1793
1631
|
ctx.restore();
|
|
1794
|
-
// a task
|
|
1632
|
+
// a task card in its hands while it walks to a new room; a compute packet on the way to a roof
|
|
1795
1633
|
const task = a.ag.taskId && this.getCity().tasks[a.ag.taskId];
|
|
1796
|
-
if (a.mode === 'walk' && task && a.place.kind === 'room') drawNoteIcon(ctx, p[0], p[1] +
|
|
1797
|
-
else if (a.mode === 'walk' && a.place.kind === 'roof') drawParcel(ctx, p[0], p[1] +
|
|
1798
|
-
this.hits.push({ id: a.id, x: p[0] - 26 * k, y: p[1] -
|
|
1634
|
+
if (a.mode === 'walk' && task && a.place.kind === 'room') drawNoteIcon(ctx, p[0], p[1] + 18 * k, 15 * k * 1.2, null, tone(a.ag.color || T.accent));
|
|
1635
|
+
else if (a.mode === 'walk' && a.place.kind === 'roof') drawParcel(ctx, p[0], p[1] + 18 * k, 14 * k, T.link);
|
|
1636
|
+
this.hits.push({ id: a.id, x: p[0] - 26 * k, y: p[1] - 40 * k, w: 52 * k, h: 70 * k });
|
|
1799
1637
|
}
|
|
1800
1638
|
|
|
1801
1639
|
sprite(ag) {
|
|
@@ -1820,42 +1658,37 @@ export class CityScene {
|
|
|
1820
1658
|
const ctx = this.ctx;
|
|
1821
1659
|
const lamps = this.lamps || []; this.lamps = [];
|
|
1822
1660
|
const wins = this.windowLights || []; this.windowLights = [];
|
|
1823
|
-
const
|
|
1661
|
+
const screens = this.screens || []; this.screens = [];
|
|
1824
1662
|
ctx.save();
|
|
1825
1663
|
ctx.globalCompositeOperation = 'lighter';
|
|
1826
1664
|
const al = clamp((pal.night - 0.2) * 0.5);
|
|
1665
|
+
for (const [x, y, s = 1, rgbs] of lamps) {
|
|
1666
|
+
const strength = rgbs ? 0.18 : al * 0.35;
|
|
1667
|
+
if (strength <= 0) continue;
|
|
1668
|
+
const r = this.cam.A * 1.1 * s;
|
|
1669
|
+
const c = rgbs || rgb(pal.T.accent2).join(',');
|
|
1670
|
+
const g = ctx.createRadialGradient(x, y, 1, x, y, r);
|
|
1671
|
+
g.addColorStop(0, `rgba(${c},${strength})`); g.addColorStop(1, `rgba(${c},0)`);
|
|
1672
|
+
ctx.fillStyle = g; ctx.fillRect(x - r, y - r, r * 2, r * 2);
|
|
1673
|
+
}
|
|
1827
1674
|
if (al > 0) {
|
|
1828
|
-
for (const [x, y, s = 1, rgbs] of lamps) {
|
|
1829
|
-
const r = this.cam.A * 1.4 * s;
|
|
1830
|
-
const g = ctx.createRadialGradient(x, y + this.cam.A * 0.2, 1, x, y + this.cam.A * 0.2, r);
|
|
1831
|
-
g.addColorStop(0, `rgba(${rgbs || '255,190,90'},${al * 0.8})`); g.addColorStop(1, `rgba(${rgbs || '255,190,90'},0)`);
|
|
1832
|
-
ctx.fillStyle = g; ctx.fillRect(x - r, y - r, r * 2, r * 2.2);
|
|
1833
|
-
}
|
|
1834
1675
|
for (const [x, y] of wins) {
|
|
1835
|
-
const r = this.cam.A * 0.
|
|
1676
|
+
const r = this.cam.A * 0.7;
|
|
1677
|
+
const [r0, g0, b0] = rgb(pal.T.accent2);
|
|
1836
1678
|
const g = ctx.createRadialGradient(x, y, 1, x, y, r);
|
|
1837
|
-
g.addColorStop(0, `rgba(
|
|
1679
|
+
g.addColorStop(0, `rgba(${r0},${g0},${b0},${al * 0.18})`); g.addColorStop(1, `rgba(${r0},${g0},${b0},0)`);
|
|
1838
1680
|
ctx.fillStyle = g; ctx.fillRect(x - r, y - r, r * 2, r * 2);
|
|
1839
1681
|
}
|
|
1840
1682
|
}
|
|
1841
|
-
|
|
1842
|
-
|
|
1683
|
+
// screens throw a faint light on busy units
|
|
1684
|
+
for (const [x, y, col] of screens) {
|
|
1685
|
+
const r = this.cam.A * 0.6;
|
|
1686
|
+
const [r0, g0, b0] = rgb(col);
|
|
1843
1687
|
const g = ctx.createRadialGradient(x, y, 1, x, y, r);
|
|
1844
|
-
g.addColorStop(0, `rgba(
|
|
1688
|
+
g.addColorStop(0, `rgba(${r0},${g0},${b0},${0.08 + pal.night * 0.06})`); g.addColorStop(1, `rgba(${r0},${g0},${b0},0)`);
|
|
1845
1689
|
ctx.fillStyle = g; ctx.fillRect(x - r, y - r, r * 2, r * 2);
|
|
1846
1690
|
}
|
|
1847
|
-
// screens glow on busy bees
|
|
1848
|
-
for (const a of this.actors.values()) {
|
|
1849
|
-
if (!['working', 'testing', 'reviewing', 'thinking'].includes(a.mode) || a.sx < -100) continue;
|
|
1850
|
-
const r = this.cam.A * 0.7;
|
|
1851
|
-
const [r0, g0, b0] = rgb(a.ag.color);
|
|
1852
|
-
const g = ctx.createRadialGradient(a.sx, a.sy + this.cam.A * 0.3, 1, a.sx, a.sy + this.cam.A * 0.3, r);
|
|
1853
|
-
g.addColorStop(0, `rgba(${r0},${g0},${b0},${0.14 + pal.night * 0.14})`); g.addColorStop(1, `rgba(${r0},${g0},${b0},0)`);
|
|
1854
|
-
ctx.fillStyle = g; ctx.fillRect(a.sx - r, a.sy - r * 0.6, r * 2, r * 2);
|
|
1855
|
-
}
|
|
1856
1691
|
ctx.restore();
|
|
1857
|
-
// a soft night wash over everything outside the light
|
|
1858
|
-
if (pal.night > 0.4) { ctx.fillStyle = `rgba(10,14,32,${(pal.night - 0.4) * 0.18})`; ctx.fillRect(0, 0, this.w, this.h); }
|
|
1859
1692
|
}
|
|
1860
1693
|
|
|
1861
1694
|
drawFocus() {
|
|
@@ -1872,7 +1705,7 @@ export class CityScene {
|
|
|
1872
1705
|
ctx.moveTo(pts[0][0], pts[0][1]);
|
|
1873
1706
|
for (let i = pts.length - 1; i > 0; i--) ctx.lineTo(pts[i][0], pts[i][1]);
|
|
1874
1707
|
ctx.closePath();
|
|
1875
|
-
ctx.fillStyle =
|
|
1708
|
+
ctx.fillStyle = alpha(this.pal.T.bg, 0.55);
|
|
1876
1709
|
ctx.fill('evenodd');
|
|
1877
1710
|
ctx.restore();
|
|
1878
1711
|
}
|
|
@@ -1881,9 +1714,9 @@ export class CityScene {
|
|
|
1881
1714
|
const ctx = this.ctx;
|
|
1882
1715
|
const now = this.now;
|
|
1883
1716
|
const k = this.k;
|
|
1884
|
-
const reduced = this.reduced();
|
|
1885
1717
|
const A = this.cam.A;
|
|
1886
|
-
|
|
1718
|
+
const T = pal.T;
|
|
1719
|
+
// room labels over the rooms when zoomed out
|
|
1887
1720
|
if (A >= 10 && A < 44 && !(this.focus?.kind === 'room')) {
|
|
1888
1721
|
for (const key of ROOM_KINDS) {
|
|
1889
1722
|
const r = ROOMS[key];
|
|
@@ -1891,99 +1724,78 @@ export class CityScene {
|
|
|
1891
1724
|
const z = r.row === 'back' ? WALL + 1.1 : 2.1;
|
|
1892
1725
|
const p = this.P(cn.x, r.row === 'back' ? r.y0 + 0.4 : r.y0 + 0.6, z);
|
|
1893
1726
|
const n = [...this.notes.values()].filter((x) => x.room === key && !x.gone && x.t.status !== 'done').length;
|
|
1894
|
-
|
|
1895
|
-
drawRoomPill(ctx, p[0], p[1], label, ROOM_COLOR[key], n, clamp(A * 0.42, 10, 13.5), this.highlightRoom(key));
|
|
1727
|
+
drawRoomPill(ctx, p[0], p[1], this.t(`city.room.${key}`), roomColor(key), n, clamp(A * 0.42, 10, 12.5), this.highlightRoom(key));
|
|
1896
1728
|
}
|
|
1897
1729
|
}
|
|
1898
|
-
// machine signs
|
|
1730
|
+
// machine signs, with the measured load when there is one
|
|
1899
1731
|
for (const m of this.machines.values()) {
|
|
1900
1732
|
const born = now - m.born;
|
|
1901
1733
|
if (born < 3 && born > -50) continue;
|
|
1902
1734
|
const tw = towerOf(m.center);
|
|
1903
|
-
const p = this.P((tw.x0 + tw.x1) / 2, (tw.y0 + tw.y1) / 2, this.towerHeight(m) + 2.
|
|
1904
|
-
const drop = reduced || born < -50 ? 1 :
|
|
1735
|
+
const p = this.P((tw.x0 + tw.x1) / 2, (tw.y0 + tw.y1) / 2, this.towerHeight(m) + 2.0);
|
|
1736
|
+
const drop = this.reduced() || born < -50 ? 1 : easeOut(clamp((born - 3) / 0.25));
|
|
1905
1737
|
ctx.globalAlpha = clamp(drop);
|
|
1906
|
-
|
|
1738
|
+
const util = m.m?.live?.util;
|
|
1739
|
+
drawMachineSign(ctx, p[0], p[1] - (1 - drop) * 8, m.m?.name || m.id, tone(m.m?.color || T.ok), m.m?.online === false ? this.t('city.machine.offline') : util != null ? `${Math.round(util * 100)}%` : null, clamp(A * 0.45, 11, 13), this.highlight?.kind === 'machine' && this.highlight.id === m.id, m.m?.online === false);
|
|
1907
1740
|
ctx.globalAlpha = 1;
|
|
1908
1741
|
}
|
|
1909
1742
|
// your building sign
|
|
1910
1743
|
{
|
|
1911
|
-
const p = this.P(-1.6, -1.4, 5.
|
|
1912
|
-
|
|
1744
|
+
const p = this.P(-1.6, -1.4, 5.0);
|
|
1745
|
+
const self = c.machines[c.selfId] || {};
|
|
1746
|
+
const util = self.live?.util;
|
|
1747
|
+
drawMachineSign(ctx, p[0], p[1], self.name || this.t('city.machine.you'), T.accent, util != null ? `${Math.round(util * 100)}%` : null, clamp(A * 0.45, 11, 13), this.highlight?.kind === 'machine' && this.highlight.id === c.selfId, false);
|
|
1913
1748
|
}
|
|
1914
|
-
//
|
|
1749
|
+
// agents: the compact info tag, expanded on hover or selection; bubbles
|
|
1915
1750
|
for (const a of this.actors.values()) {
|
|
1916
1751
|
if (a.sx < -100) continue;
|
|
1917
|
-
const headY = a.sy -
|
|
1918
|
-
const ix = a.sx + 22 * k; const iy = headY - 6 * k;
|
|
1919
|
-
const sz = clamp(A * 0.62, 12, 26);
|
|
1752
|
+
const headY = a.sy - 40 * k;
|
|
1920
1753
|
ctx.globalAlpha = a.alpha;
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
else if (a.mode === 'borrow') drawPill(ctx, a.sx, headY - sz * 0.9 + wob, this.t('city.fx.borrowing'), '#7FE3FF', clamp(A * 0.4, 10, 12));
|
|
1929
|
-
}
|
|
1930
|
-
if (A >= 17 || this.highlight?.id === a.id) {
|
|
1931
|
-
const fs = clamp(A * 0.38, 9.5, 12.5);
|
|
1932
|
-
drawNameTag(ctx, a.sx, a.sy + 30 * k, a.ag.name, a.ag.level, a.ag.color, this.highlight?.id === a.id || this.dropTarget?.id === a.id, fs);
|
|
1933
|
-
}
|
|
1934
|
-
if (this.highlight?.id === a.id || this.dropTarget?.id === a.id) {
|
|
1935
|
-
ctx.strokeStyle = 'rgba(255,208,114,.95)'; ctx.lineWidth = 2; ctx.setLineDash([4, 4]);
|
|
1936
|
-
ctx.beginPath(); ctx.ellipse(a.sx, a.sy + 28 * k, 26 * k, 10 * k, 0, 0, 6.28); ctx.stroke(); ctx.setLineDash([]);
|
|
1754
|
+
const on = this.highlight?.id === a.id || this.dropTarget?.id === a.id;
|
|
1755
|
+
if (A >= 15 && a.mode === 'borrow') drawPill(ctx, a.sx, headY - 2, this.t('city.fx.borrowing'), T.link, clamp(A * 0.4, 10, 12));
|
|
1756
|
+
if (A >= 17 || on) {
|
|
1757
|
+
const fs = clamp(A * 0.38, 10, 12);
|
|
1758
|
+
const task = a.ag.taskId && c.tasks?.[a.ag.taskId];
|
|
1759
|
+
drawNameTag(ctx, a.sx, a.sy + 24 * k, a.ag.name, a.ag.level, a.ag.color, on, fs,
|
|
1760
|
+
{ status: statusColor(a.mode === 'walk' ? (a.ag.taskId ? 'working' : 'idle') : a.mode, T), role: a.ag.role, task: task?.title || '' });
|
|
1937
1761
|
}
|
|
1938
1762
|
if (a.bubble && A >= 20) {
|
|
1939
1763
|
const age = now - a.bubble.at;
|
|
1940
|
-
ctx.globalAlpha = Math.min(clamp(age / 0.2), clamp((a.bubble.until - now) / 0.
|
|
1941
|
-
drawBubble(ctx, a.sx, headY
|
|
1764
|
+
ctx.globalAlpha = Math.min(clamp(age / 0.2), clamp((a.bubble.until - now) / 0.25)) * a.alpha;
|
|
1765
|
+
drawBubble(ctx, a.sx, headY, a.bubble.text, clamp(A * 0.4, 10.5, 12.5), this.w, a.ag.color);
|
|
1942
1766
|
}
|
|
1943
1767
|
ctx.globalAlpha = 1;
|
|
1944
1768
|
}
|
|
1945
|
-
// flying
|
|
1769
|
+
// cards flying between boards
|
|
1946
1770
|
for (const n of this.notes.values()) {
|
|
1947
1771
|
if (!n.fly) continue;
|
|
1948
1772
|
const u = clamp((now - n.fly.t0) / 0.9);
|
|
1949
1773
|
if (u >= 1) { n.fly = null; continue; }
|
|
1950
1774
|
const to = this.notePos(n);
|
|
1951
1775
|
const e = easeInOut(u);
|
|
1952
|
-
const x = lerp(n.fly.from.x, to.x, e); const y = lerp(n.fly.from.y, to.y, e); const z = lerp(n.fly.from.z, to.z, e) + Math.sin(Math.PI * u) *
|
|
1776
|
+
const x = lerp(n.fly.from.x, to.x, e); const y = lerp(n.fly.from.y, to.y, e); const z = lerp(n.fly.from.z, to.z, e) + Math.sin(Math.PI * u) * 1.6;
|
|
1953
1777
|
const p = this.P(x, y, z);
|
|
1954
|
-
drawNoteIcon(ctx, p[0], p[1], Math.max(10, A * 0.
|
|
1778
|
+
drawNoteIcon(ctx, p[0], p[1], Math.max(10, A * 0.5), null, n.t.status === 'done' ? T.ok : tone(this.actors.get(n.t.assignee)?.ag.color || T.accent));
|
|
1955
1779
|
}
|
|
1956
|
-
void pal;
|
|
1957
1780
|
}
|
|
1958
1781
|
|
|
1959
1782
|
drawParticles() {
|
|
1960
1783
|
const ctx = this.ctx;
|
|
1784
|
+
const T = artTokens();
|
|
1961
1785
|
for (const p of this.parts) {
|
|
1962
|
-
const
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
break;
|
|
1976
|
-
}
|
|
1977
|
-
case 'puff': ctx.fillStyle = 'rgba(242,233,218,.55)'; ctx.beginPath(); ctx.arc(p.x, p.y, p.size * (1 + p.age * 1.5), 0, 6.28); ctx.fill(); break;
|
|
1978
|
-
case 'label': {
|
|
1979
|
-
ctx.font = `700 ${clamp(this.cam.A * 0.42, 10, 13)}px ${FONT}`;
|
|
1980
|
-
const tw = ctx.measureText(p.text).width;
|
|
1981
|
-
ctx.fillStyle = 'rgba(20,16,12,.85)'; roundRect(ctx, p.x - tw / 2 - 7, p.y - 13, tw + 14, 20, 10); ctx.fill();
|
|
1982
|
-
ctx.fillStyle = p.color; ctx.textAlign = 'center'; ctx.fillText(p.text, p.x, p.y + 1.5); ctx.textAlign = 'left';
|
|
1983
|
-
break;
|
|
1984
|
-
}
|
|
1985
|
-
case 'jarpop': ctx.globalAlpha = clamp(life * 2); iconJar(ctx, p.x, p.y, clamp(this.cam.A * 0.6, 12, 22)); break;
|
|
1986
|
-
default: break;
|
|
1786
|
+
const a = this.actors.get(p.id);
|
|
1787
|
+
if (!a || a.sx < -100) continue;
|
|
1788
|
+
const u = p.age / p.max;
|
|
1789
|
+
if (p.kind === 'pulse') {
|
|
1790
|
+
const e = easeOut(u);
|
|
1791
|
+
const groundY = a.sy + 24 * this.k;
|
|
1792
|
+
ctx.globalAlpha = (1 - e) * 0.85 * a.alpha;
|
|
1793
|
+
ctx.strokeStyle = T.ok; ctx.lineWidth = 1.5;
|
|
1794
|
+
ctx.beginPath(); ctx.ellipse(a.sx, groundY, (17 + e * 12) * this.k, (7.5 + e * 5) * this.k, 0, 0, 6.28); ctx.stroke();
|
|
1795
|
+
} else if (p.kind === 'check') {
|
|
1796
|
+
const fade = u < 0.15 ? u / 0.15 : u > 0.8 ? (1 - u) / 0.2 : 1;
|
|
1797
|
+
ctx.globalAlpha = clamp(fade) * a.alpha;
|
|
1798
|
+
iconCheck(ctx, a.sx + 20 * this.k, a.sy - 34 * this.k - Math.min(u, 0.3) * 8, clamp(this.cam.A * 0.42, 12, 18));
|
|
1987
1799
|
}
|
|
1988
1800
|
}
|
|
1989
1801
|
ctx.globalAlpha = 1;
|
|
@@ -1995,39 +1807,43 @@ function borrowTo(c, machineId) { return !!c && Object.values(c.borrows || {}).s
|
|
|
1995
1807
|
|
|
1996
1808
|
function bridgeGroundZ(a) { return Math.max(0, a.pos.z - WALK_Z); }
|
|
1997
1809
|
|
|
1810
|
+
/** A room label chip: a hexagon dot in the room color, the name, the open count in mono. */
|
|
1998
1811
|
function drawRoomPill(ctx, x, y, text, color, count, fs, on) {
|
|
1999
|
-
|
|
1812
|
+
const T = artTokens();
|
|
1813
|
+
ctx.font = `500 ${fs}px ${FONT}`;
|
|
2000
1814
|
const tw = ctx.measureText(text).width;
|
|
2001
|
-
|
|
2002
|
-
const
|
|
2003
|
-
const
|
|
2004
|
-
|
|
2005
|
-
ctx.fillStyle = on ?
|
|
2006
|
-
ctx.strokeStyle = on ?
|
|
2007
|
-
ctx.fillStyle = color; ctx.beginPath(); hexScreen(ctx, x0 +
|
|
2008
|
-
ctx.
|
|
1815
|
+
ctx.font = `500 ${fs * 0.88}px ${MONO}`;
|
|
1816
|
+
const cw = count ? ctx.measureText(String(count)).width + 10 : 0;
|
|
1817
|
+
const w = tw + 24 + cw; const h = fs + 9;
|
|
1818
|
+
const x0 = Math.round(x - w / 2); const y0 = Math.round(y - h / 2);
|
|
1819
|
+
ctx.fillStyle = alpha(T.panel, on ? 0.96 : 0.84); roundRect(ctx, x0, y0, w, h, 4); ctx.fill();
|
|
1820
|
+
ctx.strokeStyle = on ? alpha(T.accent, 0.8) : alpha(T.text, 0.1); ctx.lineWidth = 1; ctx.stroke();
|
|
1821
|
+
ctx.fillStyle = color; ctx.beginPath(); hexScreen(ctx, x0 + 10, y, fs * 0.3); ctx.fill();
|
|
1822
|
+
ctx.font = `500 ${fs}px ${FONT}`;
|
|
1823
|
+
ctx.fillStyle = T.text; ctx.fillText(text, x0 + 18, y + fs * 0.36);
|
|
2009
1824
|
if (count) {
|
|
2010
|
-
ctx.
|
|
2011
|
-
ctx.fillStyle =
|
|
2012
|
-
ctx.fillText(String(count), x0 + w -
|
|
1825
|
+
ctx.font = `500 ${fs * 0.88}px ${MONO}`;
|
|
1826
|
+
ctx.fillStyle = T.accent; ctx.textAlign = 'right';
|
|
1827
|
+
ctx.fillText(String(count), x0 + w - 7, y + fs * 0.34); ctx.textAlign = 'left';
|
|
2013
1828
|
}
|
|
2014
1829
|
}
|
|
2015
1830
|
|
|
2016
|
-
|
|
2017
|
-
|
|
1831
|
+
/** A machine name sign: a status dot, the name and one small metric (the measured load) or the offline state. */
|
|
1832
|
+
function drawMachineSign(ctx, x, y, text, color, sub, fs, on, offline) {
|
|
1833
|
+
const T = artTokens();
|
|
1834
|
+
ctx.font = `600 ${fs}px ${FONT}`;
|
|
2018
1835
|
const tw = ctx.measureText(text).width;
|
|
2019
|
-
ctx.font = `
|
|
1836
|
+
ctx.font = `500 ${fs * 0.86}px ${MONO}`;
|
|
2020
1837
|
const sw = sub ? ctx.measureText(sub).width + 10 : 0;
|
|
2021
|
-
const w = tw +
|
|
2022
|
-
const x0 = x - w / 2;
|
|
2023
|
-
ctx.strokeStyle =
|
|
2024
|
-
ctx.beginPath(); ctx.moveTo(x,
|
|
2025
|
-
ctx.fillStyle =
|
|
2026
|
-
ctx.
|
|
2027
|
-
ctx.
|
|
2028
|
-
ctx.fillStyle =
|
|
2029
|
-
ctx.fillStyle =
|
|
2030
|
-
if (sub) { ctx.fillStyle = '#E57B6E'; ctx.font = `600 ${fs * 0.8}px ${FONT}`; ctx.fillText(sub, x0 + 30 + tw, y + fs * 0.3); }
|
|
1838
|
+
const w = tw + 26 + sw; const h = fs + 11;
|
|
1839
|
+
const x0 = Math.round(x - w / 2); const y0 = Math.round(y - h / 2);
|
|
1840
|
+
ctx.strokeStyle = alpha(T.text, 0.18); ctx.lineWidth = 1;
|
|
1841
|
+
ctx.beginPath(); ctx.moveTo(x, y0 + h); ctx.lineTo(x, y0 + h + 8); ctx.stroke();
|
|
1842
|
+
ctx.fillStyle = alpha(T.panel, on ? 0.97 : 0.88); roundRect(ctx, x0, y0, w, h, 4); ctx.fill();
|
|
1843
|
+
ctx.strokeStyle = on ? alpha(T.accent, 0.8) : alpha(T.text, 0.12); ctx.stroke();
|
|
1844
|
+
ctx.fillStyle = offline ? T.faint : color; ctx.beginPath(); ctx.arc(x0 + 10, y, 3, 0, 6.28); ctx.fill();
|
|
1845
|
+
ctx.fillStyle = T.text; ctx.font = `600 ${fs}px ${FONT}`; ctx.fillText(text, x0 + 18, y + fs * 0.36);
|
|
1846
|
+
if (sub) { ctx.fillStyle = offline ? T.bad : T.muted; ctx.font = `500 ${fs * 0.86}px ${MONO}`; ctx.fillText(sub, x0 + 26 + tw, y + fs * 0.32); }
|
|
2031
1847
|
}
|
|
2032
1848
|
|
|
2033
1849
|
export { WALL, ROOMS, CORRIDOR_Y };
|