Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c525feb465 |
@@ -1,8 +1,6 @@
|
||||
# На каждый пуш: только мод (.hmod, один для всех ОС) и релиз build-<номер> с ним.
|
||||
# Раннер живёт на одной машине с Gitea и другими сервисами (2 ядра, 4 ГБ): сборка мода лёгкая —
|
||||
# один поток компиляции, низший приоритет, без системных пакетов и без кэша target.
|
||||
# Диск у раннера тоже общий с базой Gitea: 23.11.2026, дойдя до тестов, джоба уронила базу до конца прогона.
|
||||
# Поэтому один закреплённый тулчейн вместо stable поверх него и без каталогов target тестов к моменту сборки мода.
|
||||
# Игра-форк здесь не собирается: только по тегу версии (release.yml, Windows) и вручную (game.yml Linux, desktop.yml macOS).
|
||||
name: build
|
||||
|
||||
@@ -24,19 +22,9 @@ jobs:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
# Не начинать, когда места мало: иначе сборка займёт диск до конца, а база Gitea на нём падает.
|
||||
- name: Ресурсы раннера
|
||||
run: |
|
||||
df -h / | tail -1
|
||||
free -m | sed -n '1,2p'
|
||||
FREE=$(df --output=avail -BM / | tail -1 | tr -dc 0-9)
|
||||
if [ "$FREE" -lt 4000 ]; then echo "::error::на сервере свободно ${FREE} МБ, нужно хотя бы 4000"; exit 1; fi
|
||||
# Только закреплённый тулчейн из rust-toolchain.toml: stable ставился раньше и лежал мёртвым грузом.
|
||||
- name: Rust
|
||||
run: |
|
||||
CHANNEL=$(sed -n 's/^channel = "\(.*\)"$/\1/p' rust-toolchain.toml)
|
||||
if [ -z "$CHANNEL" ]; then echo "::error::rust-toolchain.toml: не прочитан channel"; exit 1; fi
|
||||
curl -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain "$CHANNEL" --target wasm32-unknown-unknown
|
||||
curl -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --target wasm32-unknown-unknown
|
||||
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
|
||||
# Без actions/cache: кэш-сервер раннера из контейнеров задач недоступен — восстановление
|
||||
# падало по таймауту, а сохранение вешало «Complete job» на пару минут. Инструмент собирается заново.
|
||||
@@ -44,28 +32,23 @@ jobs:
|
||||
run: nice -n 19 python3 tools/airdef.py fork
|
||||
- name: Проверка закреплённого checkout
|
||||
run: python3 -m unittest discover -s tools -p test_engine_checkout.py
|
||||
# Системный Python образа — externally managed (PEP 668): без --break-system-packages pip отказывает,
|
||||
# и тесты со сборкой ниже вообще не запускаются. Контейнер задачи одноразовый, так что --user безопасен.
|
||||
- name: Проверка generated assets
|
||||
run: |
|
||||
python3 -m pip install --user --break-system-packages -r tools/requirements.txt
|
||||
python3 -m pip install --user -r tools/requirements.txt
|
||||
python3 tools/gen_catalog.py --check
|
||||
python3 -m unittest discover -s tools -p test_sound_catalog.py
|
||||
python3 tools/gen_models.py --check
|
||||
python3 -m unittest discover -s tools -p test_model_bounds.py
|
||||
# После тестов их каталог target не нужен (модуль собирается под wasm заново), а на диске его место.
|
||||
- name: Тесты ядра без SDK
|
||||
working-directory: airdef-core
|
||||
run: |
|
||||
HOST=$(rustc -vV | sed -n 's/^host: //p')
|
||||
nice -n 19 cargo test --target "$HOST"
|
||||
rm -rf target
|
||||
- name: Тесты мода
|
||||
working-directory: airdef-mod
|
||||
run: |
|
||||
HOST=$(rustc -vV | sed -n 's/^host: //p')
|
||||
nice -n 19 cargo test --target "$HOST"
|
||||
rm -rf target
|
||||
- name: Мод
|
||||
run: nice -n 19 python3 tools/airdef.py mod
|
||||
- name: Релиз
|
||||
|
||||
@@ -2,7 +2,6 @@ run-home/
|
||||
.horizon-cache/
|
||||
airdef-mod/target/
|
||||
airdef-core/target/
|
||||
tools/rt-probe/target/
|
||||
__pycache__/
|
||||
/out/
|
||||
.DS_Store
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
# AirDef Project Rules
|
||||
|
||||
- Active gameplay worktree is `/Users/chexit/Documents/zcode/airdef/gameplay/village-defense` (do NOT edit `/Users/chexit/Documents/zcode/airdef/airdef`).
|
||||
- After completing and verifying any task that modifies code or docs, **always commit and push directly to `origin/kimi-work`** (`git push origin HEAD:kimi-work`) without asking the user first.
|
||||
- If the `horizon/` engine submodule was modified, commit and push it to `ssh://git@gitea.maoniao.team:2222/chexit/horizon-airdef.git` (`HEAD:refs/heads/kimi-work`) first, then include the updated `horizon` gitlink in the main commit to `origin/kimi-work`.
|
||||
- Stage only the relevant project files explicitly — never stage untracked build artifacts such as `tools/model-preview/{Cargo.lock,target/}` or untracked `target/` directories inside `horizon/`.
|
||||
@@ -60,44 +60,27 @@ CI: `.gitea/workflows/build.yml` на каждый пуш собирает то
|
||||
| Развернуть Patriot / Гепард / Панцирь-С1 / С-400 / С-500 | ставит комплекс на блок под прицелом, носом по взгляду |
|
||||
| Свернуть ПВО | убирает ближайший комплекс у точки под прицелом |
|
||||
|
||||
**Меню AirDef:** клавиша **N** или `/airdef menu`. В разделе «Классы целей» можно включить или выключить
|
||||
классы для каждого типа комплекса и сбросить их по умолчанию. В меню также открываются командный пункт,
|
||||
налёты, повторы и настройки.
|
||||
**Командный пункт:** клавиша **N** или `/airdef menu`. В нём список комплексов: выбери комплекс и включай или выключай классы целей
|
||||
(дроны, реактивные дроны, крылатые, сверхзвуковые, баллистика), есть сброс по умолчанию. Там же кнопки «Командный
|
||||
пункт» (сетка), «Налёт…» и «Огонь, ремонт, эффекты…» (огонь ПВО, ремонт всех, эффекты, разрушения).
|
||||
|
||||
**Налёт (меню N → «Налёт: состав и запуск…»):** на первой странице состав — клик по типу листает число
|
||||
(0, 1, 2, 3, 4, 6, 8, 10, 15, 20, 30, 40); на второй — готовый вариант («Рой Шахедов», «Массированный удар»,
|
||||
«Баллистика», «Гиперзвук», «Орешник с прикрытием», «Подавление ПВО»), откуда (один сектор, два, со всех сторон,
|
||||
волнами по типам), дальность старта, цели и **ПУСК**. Цели:
|
||||
- *только объекты* — всё летит по отмеченным объектам (или по игроку, если их нет);
|
||||
- *объекты и ПВО* — часть ударных аппаратов бьёт по случайным комплексам. Баллистика летит по отмеченным объектам;
|
||||
- *объекты и ПВО* — треть ударных средств бьёт по случайным комплексам;
|
||||
- *умный противник* — планировщик использует наблюдённые контакты и последние известные позиции комплексов: ведёт дроны и крылатые ракеты
|
||||
маршрутами в обход зон поражения, низко, за рельефом и через мёртвые зоны; «Герберы» прилетают на 15 с раньше,
|
||||
чтобы оттянуть ракеты. На технику вместе с наблюдёнными РЛС выделяется до четверти большого налёта.
|
||||
Баллистика и остальная ударная группа идут по отмеченным объектам. В режиме волн группы прибывают с интервалами.
|
||||
чтобы оттянуть ракеты; «Ланцеты» идут по Гепардам и Панцирям, Х-22/Циркон и часть баллистики — по дальнобойным
|
||||
комплексам; на наблюдённые РЛС дальнего обнаружения выделяются 2–3 быстрых ударника (Х-22, Циркон, Искандер, Кинжал, затем Х-101,
|
||||
Герань-3, Ланцет, Шахед; не больше четверти налёта); всё остальное стартует со сдвигом так, чтобы прилететь одновременно.
|
||||
|
||||
После налёта приходит отчёт: сколько сбито и прорвалось, ракет ПВО потрачено, комплексов потеряно, урон объектам.
|
||||
|
||||
**Оборона деревни** доступна из меню N или через `/airdef scenario village normal`
|
||||
(`easy` и `hard` меняют бюджет и состав волн). Встаньте в деревне и выберите сложность.
|
||||
Если целей ещё нет, мод отметит три точки по высотам местности рядом с игроком.
|
||||
Можно заранее отметить ровно три целых объекта самостоятельно. По порядку отметок это штаб, лазарет и укрытие.
|
||||
|
||||
Расставьте технику и выберите «Начать оборону» или `/airdef scenario village start`.
|
||||
Стоимость техники показывает `/airdef scenario village prices`. Через пять секунд начинается первая из трёх волн.
|
||||
В паузах по 30 секунд можно тратить остаток бюджета. Боезапас, урон и запас складов сохраняются между волнами.
|
||||
Для победы нужны уцелевший штаб и минимум 65 баллов. Целые объекты дают 50, 30 и 20 баллов соответственно,
|
||||
повреждённые дают долю от этих значений. При потере всех трёх объектов сценарий заканчивается досрочно.
|
||||
Сценарий можно остановить командой `/airdef scenario village stop`.
|
||||
Она оставляет расстановку и уже начатый налёт в мире.
|
||||
|
||||
**Разбор прорывов** доступен из меню деревни, из меню повторов или командой `/airdef breaches [страница]`.
|
||||
В истории текущего сеанса остаются последние 128 попаданий. Видны время первого замера РЛС, число запущенных
|
||||
перехватчиков и состояние ближайших комплексов в момент перед ударом. После перезахода часть данных по
|
||||
уже летящим аппаратам может быть неизвестна.
|
||||
|
||||
**Обнаружение.** РЛС видит цель не дальше, чем позволяют:
|
||||
- её размер: дальность растёт как корень четвёртой степени из ЭПР — Х-101 и Ланцет видно примерно вдвое ближе, чем Х-22;
|
||||
- радиогоризонт: низколетящие цели обнаруживаются ближе, чем цели на большой высоте;
|
||||
- радиогоризонт: низколетящую цель видно поздно (Шахед на 25 м — с ~250 м, баллистику — издалека);
|
||||
- рельеф и лес: за холмом цель не видна (каждый комплекс строит свой горизонт по 48 лучам; рельеф известен в
|
||||
прогруженных чанках);
|
||||
- вблизи (24 м) видно всё.
|
||||
@@ -113,7 +96,7 @@ CI: `.gitea/workflows/build.yml` на каждый пуш собирает то
|
||||
|
||||
**Сеть ПВО.** Единицы обмениваются измеренными треками в пределах игровой связи; повреждение связи
|
||||
сокращает её дальность. Можно поставить несколько С-400/С-500 без собственной РЛС и общие радары
|
||||
поиска, сопровождения и мачтового обзора — отдельными пультами (`/airdef give` выдаёт `deploy_radar_search`, `deploy_radar_track`, `deploy_radar_height`) или командой `/airdef deploy radar_search|radar_track|radar_height`.
|
||||
поиска, сопровождения и мачтового обзора: N → «Разместить элементы батареи…».
|
||||
Поисковый радар даёт подсказку; огневой должен сам измерить цель, прежде чем разрешить пуск.
|
||||
Старая сборная конфигурация сохранена. [Команды, источники и ограничения](docs/BATTERIES-AND-COLD-LAUNCH.md).
|
||||
P1-SUN также использует чужие данные. Пушкам (Гепард,
|
||||
@@ -124,13 +107,10 @@ P1-SUN также использует чужие данные. Пушкам (Г
|
||||
не заменяет обязательное собственное сопровождение. Выключение не стирает старые сведения противника:
|
||||
он продолжает использовать последнюю наблюдённую позицию, а пуски и РЭБ могут снова раскрыть технику.
|
||||
|
||||
**Логистика.** Боекомплект конечный с момента размещения техники. Комплекс с пустым боекомплектом показывает
|
||||
«ЖДЁТ БК». В 60 блоках от склада он перезаряжается прямо с него, а
|
||||
**Логистика.** Пока нет ни одного склада, магазины пополняются сами, как раньше. Как только поставлен склад,
|
||||
боекомплект считается: комплекс без ракет пишет «ЖДЁТ БК»; в 60 м от склада он перезаряжается прямо с него, а
|
||||
дальние обслуживают **ТЗМ**: заправляются на складе (2 перезарядки), сами едут к ждущим комплексам, ближайшим
|
||||
первым, и возвращаются. ТЗМ ищет проезд с любой стороны получателя. Если объезда нет, машина может
|
||||
уложить короткий мост или пандус из булыжника и расчистить до двух слоёв мягкого грунта. Строительство
|
||||
требует разрешения на команды изменения мира. Запас склада — 30 перезарядок, он виден в сводке.
|
||||
Склад и ТЗМ детонируют всем грузом.
|
||||
первым, и возвращаются. Запас склада — 30 перезарядок, он виден в сводке. Склад и ТЗМ детонируют всем грузом.
|
||||
|
||||
Ударная **RM48U у С-400** — отдельный условный игровой боеприпас, который делит четыре ячейки
|
||||
с ракетами ПВО. `/airdef ground-stock <склад> <количество>` задаёт конечный начальный запас
|
||||
@@ -155,9 +135,8 @@ sandbox-сценария, `/airdef ground-load <С-400>` загружает од
|
||||
|
||||
**Умный противник учится.** Он запоминает, откуда его налёты сбивали, а откуда они прорывались, и следующий
|
||||
налёт ведёт с лучшего направления; помнит комплексы, выдавшие себя пуском, и станции РЭБ, и во время налёта
|
||||
может перенацелить часть ещё не взлетевших аппаратов. Удары по технике занимают до четверти большого
|
||||
налёта. Баллистика на всех этапах сохраняет отмеченный объект. Если цель-комплекс уничтожена, выделенные
|
||||
на удар по технике аппараты могут выбрать другой известный комплекс. Маршруты к новым целям достраиваются по бюджету планировщика в следующих тиках:
|
||||
перенацеливает ещё не взлетевшие Ланцеты и Шахеды на них; если цель-комплекс уничтожен, дроны идут к
|
||||
следующему известному. Маршруты к новым целям достраиваются по бюджету планировщика в следующих тиках:
|
||||
необработанное задание не теряется, старый безопасный участок остаётся до готовности нового, а дрон без
|
||||
маршрута летит прямо только до ближайшего бюджета. Дроны под обстрелом прижимаются к земле.
|
||||
|
||||
@@ -179,7 +158,7 @@ API мода `render.set-lights` (до 512, плавно интерполиру
|
||||
Это относится к ракетам ПВО, RM48U, крылатым, сверхзвуковым и баллистическим средствам;
|
||||
дым пожаров и слабая дымка винтовых дронов остались прежними.
|
||||
|
||||
**Сетка камер** после сбития ещё 3,5 с держит камеру на сбитой цели, и комплекс в это время не пропадает из сетки.
|
||||
**Сетка J** после сбития ещё 3,5 с держит камеру на сбитой цели, и комплекс в это время не пропадает из сетки.
|
||||
|
||||
**Повреждения.** Взрыв рядом с комплексом повреждает его: он хуже поворачивается, хуже видит и попадает,
|
||||
дымит, ниже 35% горит. Уничтоженный остаётся горящим остовом, его боекомплект детонирует: чем больше ракет
|
||||
@@ -198,39 +177,10 @@ API мода `render.set-lights` (до 512, плавно интерполиру
|
||||
- камера комплекса: настоящий вид мира из точки комплекса (второй рендер форка), с зумом на цель — тепловизор
|
||||
при сопровождении, в поиске днём цвет, ночью ПНВ; рамка захвата, дальность, высота, скорость и пеленг.
|
||||
|
||||
**Командный пункт ПВО:** клавиша **J** или строка «Командный пункт» в меню **N** открывает прокручиваемый список
|
||||
всей развёрнутой техники. Кнопка фильтра перебирает роли и состояния. Для поиска по названию или номеру используйте
|
||||
`/airdef post Панцирь` или `/airdef post 12`. Нажатие на строку открывает карточку. В ней видны текущая причина,
|
||||
отметка и её источник. Из карточки можно открыть карту, камеру, историю решений и закрепить технику.
|
||||
История показывает отказы на проверке, фактические выстрелы и известные исходы с отметкой, которая была у комплекса
|
||||
на тот момент. По записи завершившегося налёта можно открыть соответствующий кадр повтора.
|
||||
История живёт вместе с повторами текущей игровой сессии. В ней доступны последние 128 записей выбранного комплекса.
|
||||
Та же карточка доступна с выбранного маркера на карте **M** и по **I** при открытом мониторе **K**.
|
||||
В мире от первого лица наведите прицел на видимую часть техники на расстоянии до 24 блоков и нажмите **I**.
|
||||
Если между прицелом и моделью есть блок, карточка по наведению не откроется.
|
||||
|
||||
**Веб-пульт для планшета:** живая карта, карточки техники, архив налётов и запуск сценариев с отдельным доступом
|
||||
оператора. Запуск на ПК командой `python3 tools/airdef.py web`. [Подключение планшета и режимы доступа](docs/WEB-PANEL.md).
|
||||
|
||||
**Сетка камер** открывается отдельной кнопкой в списке или командой `/airdef grid`. В ней до восьми живых
|
||||
камер со статусом, РЛС, прочностью и боекомплектом. Камеры подбираются по активности каждые две секунды.
|
||||
Закреплённый комплекс получает приоритет, а при отсутствии закрепления приоритет у выбранного на мониторе K.
|
||||
|
||||
**Тактическая карта:** клавиша **M** открывает общую карту. Цели обозначены крупными отметками с классом,
|
||||
курсом и измеренной траекторией; наведение мыши показывает дистанцию, тип, состояние трека и перехват.
|
||||
По умолчанию доступны только данные сети РЛС. **T** переключает явно подписанный режим «Истина» для
|
||||
песочницы: в нём белые рамки показывают даже незамеченные аппараты, а жёлтый пунктир — их цель и будущий
|
||||
маршрут. Этот режим не меняет боевую логику.
|
||||
|
||||
**Обзор целей поверх мира:** удерживай **C** — вокруг видимых целей появляются квадратные метки с краткой
|
||||
строкой: класс, который оценили РЛС (неопознанная цель — «?», без утечки типа), и дистанция; устаревший
|
||||
трек-прогноз оранжевый и помечен возрастом. Свои перехватчики — маленькие жёлтые квадраты. Это данные сети
|
||||
РЛС, как на радаре и карте; в режиме «Истина» (`/airdef truth on`, T на карте) добавляются белые рамки
|
||||
реальных дронов с их настоящим типом — отдельно от сетевых оценок, чтобы видеть расхождение. Отпустил
|
||||
клавишу — метки исчезли. Метки достаются ближайшим из видимых целей: цель за камерой или за краем
|
||||
экрана бюджет кадра не тратит, а заголовок показывает, сколько целей в кадре, сколько за кадром и сколько
|
||||
не поместилось в бюджет. Метки проектируются через камеру последнего отрисованного кадра (`render.project`,
|
||||
API 31 форка) и следуют за взглядом покадрово; поверх повтора, сетки камер, монитора K и карты M обзор не рисуется.
|
||||
**Командный пункт ПВО (сетка):** клавиша **J** (или `/airdef grid`, или кнопка в меню N) — на весь экран сетка
|
||||
до 8 комплексов: у каждого состояние, РЛС, живая камера, прочность и боекомплект. Если комплексов больше, показываются
|
||||
самые занятые (стреляют, держат захват, сопровождают, горят), раз в 2 секунды; комплекс с монитора K — всегда.
|
||||
Повторное J закрывает.
|
||||
|
||||
**Повторы.** Каждый налёт записывается сам: с первой цели в небе до момента, когда небо 5 с чисто
|
||||
(хранятся 3 последних). Меню N → «Повторы…» или клавиша **R**:
|
||||
@@ -240,12 +190,7 @@ API 31 форка) и следуют за взглядом покадрово;
|
||||
целью, потом за перехватчиком (или смотрит из пушки, со стороны на прилёт), в момент сбития время замедляется;
|
||||
- **полный повтор** — весь налёт, камера-режиссёр сама выбирает, за чем следить; колесо — перемотка, стрелки — скорость;
|
||||
- **лучшие моменты** — нарезка до 8 самых интересных событий (перехват баллистики и гиперзвука, поражения
|
||||
объектов, потерянные комплексы, разделение «Орешника») с титрами и замедлением; колесо листает моменты;
|
||||
- **цепочки боя** — меню N → «Повторы…» → «Цепочки боя»: по каждому контакту короткая строка
|
||||
«отметка → передача → захват → пуск → исход» с записанными шагами и их временем. Можно отобрать
|
||||
цепочки по комплексу, прорывы и контакты без записи пуска. В длинном списке можно листать страницы.
|
||||
Нажатие на строку открывает клип исхода или карту налёта на моменте пуска или отметки.
|
||||
Текстовый список открывается командой `/airdef chains [номер батареи]`.
|
||||
объектов, потерянные комплексы, разделение «Орешника») с титрами и замедлением; колесо листает моменты.
|
||||
|
||||
Повтор идёт на весь экран с леттербоксом; звук слышен так, как его слышала бы камера. Управление (подсказка
|
||||
показывается в начале, после нажатия и на паузе): **← →** — перемотка на 5 с (в нарезке — соседний момент),
|
||||
@@ -255,7 +200,7 @@ API 31 форка) и следуют за взглядом покадрово;
|
||||
Чтобы в повторах и камерах комплексов была видна земля далеко от игрока, мод включает дальний ландшафт
|
||||
(48 чанков, упрощённый); выключается в меню N → «Огонь, ремонт, эффекты…» → «Дальний ландшафт».
|
||||
|
||||
Клавиши N, K, J, I, R, U и C (обзор целей, удержание) можно переназначить в «Настройки → Моды».
|
||||
Клавиши N, K, J, R и U можно переназначить в «Настройки → Моды».
|
||||
|
||||
Команды:
|
||||
- `/airdef wave <тип> [кол-во] [дальность]` — налёт на ближайшую цель. Дальность старта — от 60 до 4000 блоков (в меню: 200–4000); землю для площадок, которой нет в загруженных чанках, игра подгружает сама (API 22, `render.load-chunks`, пока идёт поиск), а где подгрузить нельзя (сервер) или нет пригодного места, дроны всё равно стартуют: «за картой», с высоты полёта на заказанной дальности, без площадки. Типы: `shahed`, `geran3`, `lancet`, `gerbera`, `kh101`, `kalibr`, `kh22`, `zircon`, `iskander`, `kinzhal`, `oreshnik` и `mix` (комбинированный удар двумя секторами: «Герберы», шахеды, Герани-3, Х-101, «Калибры», Х-22, Циркон, «Искандер», «Кинжал», при 30+ — «Орешник»);
|
||||
@@ -265,24 +210,12 @@ API 31 форка) и следуют за взглядом покадрово;
|
||||
- `/airdef import` — перенести в текущий мир комплексы и цели из старой версии мода (до 0.2.x они были общими для всех миров);
|
||||
- `/airdef raid` — налёт, настроенный в меню; `/airdef target here` — отметить объект под ногами; `/airdef repair` — ремонт;
|
||||
- `/airdef lastchance <on|off>` — «последний шанс»: комплекс стреляет и по классу вне ролей, если цель вот-вот попадёт (по умолчанию вкл; сохраняется);
|
||||
- `/airdef sites` — известные пусковые площадки (ПУ). РЛС с прямой видимостью может заметить сам пуск и получить неточную позицию; несколько наблюдённых пусков уточняют её. Обнаруженный позже дрон даёт только слабое предположение об обратном курсе: скрытые координаты площадки и время невидимого старта не используются. Повторные треки одного полёта не создают ложную точность. Налёт тем же способом и с той же дальностью (в пределах 200 блоков) приходит с тех же сторон, что и прошлый, поэтому площадки стоят там же, где раньше; место площадки, которое РЛС успела определить, запоминается, и следующая площадка там же известна сразу — по ней можно бить до первого пуска.
|
||||
- `/airdef sites` — известные пусковые площадки (ПУ). РЛС с прямой видимостью может заметить сам пуск и получить неточную позицию; несколько наблюдённых пусков уточняют её. Обнаруженный позже дрон даёт только слабое предположение об обратном курсе: скрытые координаты площадки и время невидимого старта не используются. Повторные треки одного полёта не создают ложную точность.
|
||||
- `/airdef strike <номер ПУ>` — ручной удар по разведанной площадке из готового физического С-400 с отдельно загруженной RM48U (игровой профиль, #118). Четыре ячейки делятся с боезапасом ПВО; приказ резервирует носитель и ячейку, открывает крышку и списывает одну ударную ракету при выбросе. Выбирается готовый комплекс с наибольшим остатком RM48U, затем ближайший к цели. Есть открытие ТПК, выброс, отложенное включение двигателя и разгон, ограниченная игровая траектория, столкновения и запись пуска. Несуществующее «ПВО площадки» не перехватывает ракету по броску вероятности.
|
||||
- `/airdef ground-stock <номер склада> <количество>` — задать остаток RM48U для sandbox-сценария (по умолчанию 0). `/airdef ground-load <номер С-400>` загружает одну ракету у склада либо заказывает ТЗМ; `ground-unload` возвращает её у склада либо заказывает вывоз; `ground-cancel` отменяет ожидающую заявку. Доставка и обратный вывоз через ТЗМ реализованы, запас и груз сохраняются. [Пошаговый пример](docs/GROUND-STRIKES.md). Совместимость профиля основана на [публикации ГУР](https://gur.gov.ua/content/warsanctions-hur-mo-rozkryvaie-budovu-komponentnu-bazu-ta-pidpryiemstva-kooperatsii-z-vyrobnytstva-udarnykh-raket-rm48u.html); это сообщение ведомства, не независимая сертификация. Дальность, форма полёта и оформление условны для Minecraft.
|
||||
- `/airdef deploy s400` и `s500` ставят только пусковые без своей РЛС (сборные С-400/С-500 с собственной РЛС убраны; в старых сохранениях они загружаются пусковыми); `radar_search`, `radar_track`, `radar_height` — три разные игровые РЛС с устойчивыми профилями в каталоге, каждая со своей моделью антенны (широкий экран, зеркало, мачтовая головка); универсальная `radar` — прежний экран на шасси, оптический пост `optical` — своя поворотная головка на посту. Они также выдаются отдельными пультами (`/airdef give`) и ставятся на блок как обычные пульты. `/airdef battery` показывает состав, профиль, цикл, продукты измерения и связь; `/airdef battery <номер> integrated|launcher` меняет конфигурацию (для С-400/С-500 доступна только `launcher`). Профиль РЛС задаётся при размещении и не переключается на ходу: `radar <номер> on|off` сохраняется. Обзорная станция даёт редкие грубые отметки и область поиска; мачтовая уточняет низкие контакты над рельефом; сопровождения ищет локально, ведёт ограниченное число точных треков и только её собственное подтверждённое измерение разрешает пуск. Сеть передаёт источник, возраст и качество, но повторная пересылка не освежает измерение. Старые роли РЛС при загрузке сопоставляются с профилями. [Устройство игровой батареи и пуска](docs/BATTERIES-AND-COLD-LAUNCH.md).
|
||||
- `/airdef deploy s400_launcher` и `s500_launcher` — отдельные пусковые без своей РЛС; `radar_search`, `radar_track`, `radar_height` — обзорная, сопровождающая и мачтовая игровые РЛС. Они также доступны через меню N → «Разместить элементы батареи…». `/airdef battery` показывает состав и связь; `/airdef battery <номер> integrated|launcher` меняет конфигурацию, `/airdef radar <номер> multi|search|engagement|height` — роль отдельной РЛС. Обзорная РЛС передаёт подсказки; станция сопровождения должна сама получить свежее измерение, чтобы разрешить пуск. Старые С-400/С-500 сохраняют упрощённую сборную конфигурацию. [Устройство игровой батареи и пуска](docs/BATTERIES-AND-COLD-LAUNCH.md).
|
||||
- `/airdef roles` — показать, по каким классам целей работает каждый комплекс; `/airdef roles <patriot|gepard|pantsir|s400|s500|all> <классы|default>` — задать (классы через запятую: `drone`, `jet`, `cruise`, `supersonic`, `ballistic` или `all`), например `/airdef roles s400 cruise,ballistic`;
|
||||
- `/airdef doctrine` — доктрины комплексов (#47; в меню N: «Доктрины…»): `/airdef doctrine <номер|all> reserve <K>` — держать K ракет для срочных целей (баллистика или до удара меньше 12 с); `salvo eco|normal|heavy` — сколько перехватчиков на цель (только базовые / как обычно / на один больше); `sector <центр°> <полуширина°>` или `sector off` — сектор ответственности (0° — север); `guard <объект№>[,<№>]` или `guard off` — стрелять только по тому, что идёт на охраняемые объекты (отметка: `/airdef target here`). По умолчанию ограничений нет; последний шанс сильнее доктрины; `/airdef why <номер>` называет, какая настройка остановила или разрешила пуск; сохраняется с миром и сценариями. Карта охраны и пробелов в ней — вместе с картой (#48).
|
||||
- `/airdef why <номер>` — почему комплекс стреляет или нет. Сразу под строкой состояния — одна typed-причина:
|
||||
«есть только обзор», «ждёт сопровождения», «каналы заняты», «нет боезапаса» или «готов к пуску», вместе с возрастом и
|
||||
источником отметки (своя РЛС или сеть, РЛС №N). «Есть только обзор» — на картине лишь поисковая или
|
||||
сетевая отметка, своё подтверждённое измерение пуск не разрешает; «ждёт сопровождения» — своя РЛС ещё
|
||||
уточняет контакт или пусковая ждёт огневой трек поддерживающей РЛС; «каналы заняты» — все каналы
|
||||
сопровождения заняты другими контактами; «нет боезапаса» — нет ракет и снарядов или идёт перезарядка.
|
||||
`/airdef why <номер> source` переводит монитор K на станцию, которая поставила отметку. Подробные
|
||||
проверки (роли, доктрина, дальность, наведение) идут ниже и не расходятся с этой причиной. В обычном
|
||||
HUD — только картина самой батареи: класс по оценке, без истинного типа и скрытых данных.
|
||||
- `/airdef chains [номер батареи]` — короткие цепочки последнего налёта: «отметка → передача → захват →
|
||||
пуск → исход» с временем шагов; без номера — все батареи. Строка кликабельна в меню N → «Повторы…» →
|
||||
«Цепочки боя» и открывает кадр повтора.
|
||||
- `/airdef deploy <patriot|gepard|pantsir|s400|s500>` — поставить комплекс в 8 блоках перед собой;
|
||||
- `/airdef hold on|off` — запретить или разрешить ПВО огонь, удобно для съёмки ударов;
|
||||
- `/airdef damage on|off` — разрушать ли ландшафт взрывами (через TNT, нужны читы);
|
||||
@@ -290,23 +223,10 @@ API 31 форка) и следуют за взглядом покадрово;
|
||||
- `/airdef clear` — убрать дроны и ракеты;
|
||||
- `/airdef targets clear` — снять все цели;
|
||||
- `/airdef stats` — сводка.
|
||||
- `/airdef recon` — debug/послебоевой разбор разведки противника (#135): отметки его картины best-first с причиной приоритета (`свежесть×4 + качество×3 + наблюдаемая роль`), фазы вылетов и дроны, нацеленные на отметку. То же — страница «Разведка противника (разбор)» в меню N. Всеведущая картина противника в обычный HUD не выводится.
|
||||
|
||||
Интерфейс:
|
||||
- **сверху справа — сводка:** тревога, цели по типам, ближайшая угроза (дальность, высота, скорость), перехватчики в воздухе, по каждому комплексу боезапас или перезарядка, его текущая цель и число сбитых, итоговый счёт; если сеть держит разведчиков противника — их число и фаза вылета (разведка/донесение/завершение);
|
||||
- **снизу справа — радар на 500 м** со сканирующим лучом. Отметки гаснут после прохода луча. Красное — цели: форма значка различает дрон, самолёт, крылатую, сверхзвуковую и баллистическую ракету, хвост показывает курс, а близкие отметки объединяются с числом; жёлтое — ракеты, синее — ПВО с кругами дальности, крест — цели удара. Разведчик противника в картине сети — жёлтый полый ромб с подписью «разведчик».
|
||||
|
||||
**Разведка противника (#135).** Налёт с целью «умный противник» перед ударом высылает небольшой бюджет
|
||||
невооружённых разведчиков: они физически проходят игровые зоны вокруг отмеченных целей и передают домой
|
||||
только область, грубую категорию, канал (пролёт/излучение/РЭБ/пуск) и возраст — не точную точку, тип,
|
||||
прочность и боезапас. Сбитый до донесения разведчик ничего не передаёт; уже переданное противник помнит
|
||||
между налётами, а скрытый переезд или выключение не переписывают старую отметку. На карте сети разведчик —
|
||||
узнаваемый жёлтый ромб с подписью «разведчик» (в sandbox-режиме `/airdef truth on` — янтарная метка и
|
||||
счётчик отметок), в сводке и на карте видна фаза вылета: разведка → донесение → завершение. Что противник
|
||||
запомнил и почему выбирает цель, показывает `/airdef recon` и страница «Разведка противника (разбор)» в меню
|
||||
N (есть и в «Повторы…»): отметки best-first с разбором приоритета (свежесть, качество, наблюдаемая роль) и
|
||||
дроны, нацеленные на отметку. Это явный debug/послебоевой разбор — всеведущая картина противника в обычный
|
||||
HUD не выводится. Простые пресеты налёта фазу разведки не получают.
|
||||
- **сверху справа — сводка:** тревога, цели по типам, ближайшая угроза (дальность, высота, скорость), перехватчики в воздухе, по каждому комплексу боезапас или перезарядка, его текущая цель и число сбитых, итоговый счёт;
|
||||
- **снизу справа — радар на 500 м** со сканирующим лучом. Отметки гаснут после прохода луча. Красное — цели (с хвостом по курсу), жёлтое — ракеты, синее — ПВО с кругами дальности, крест — цели удара.
|
||||
|
||||
Комплексы ПВО и цели сохраняются между сессиями.
|
||||
|
||||
@@ -332,22 +252,20 @@ HUD не выводится. Простые пресеты налёта фазу
|
||||
|
||||
| ПВО | Вооружение | Дальность |
|
||||
|---|---|---|
|
||||
| Patriot | 4 × PAC-3, пусковая разворачивается на цель | 10–950 |
|
||||
| Гепард | 2 × 35 мм, башня и стволы со слежением и упреждением, 160 очередей | 180 (слежение с 260) |
|
||||
| Панцирь-С1 | 12 × 57Э6 и 2 × 30 мм; модуль поворачивается, пакеты и стволы поднимаются | ракеты 25–330, пушки 125 |
|
||||
| С-400 | 4 × 48Н6, вертикальный холодный старт, РЛС обзора на прицепе | 30–1300 |
|
||||
| С-500 | 2 × 77Н6, холодный старт, самые быстрые ракеты | 40–1850 |
|
||||
| Patriot | 4 × PAC-3, пусковая разворачивается на цель | 10–450 |
|
||||
| Гепард | 2 × 35 мм, башня и стволы со слежением и упреждением, 160 очередей | 135 (слежение с 195) |
|
||||
| Панцирь-С1 | 12 × 57Э6 и 2 × 30 мм; модуль поворачивается, пакеты и стволы поднимаются | ракеты 25–225, пушки 90 |
|
||||
| С-400 | 4 × 48Н6, вертикальный холодный старт, РЛС обзора на прицепе | 30–720 |
|
||||
| С-500 | 2 × 77Н6, холодный старт, самые быстрые ракеты | 40–1050 |
|
||||
| IRIS-T SLM | 8 ракет, вертикальный пуск, быстрые и манёвренные | 15–600 |
|
||||
| NASAMS | 6 × AMRAAM, наводимая пусковая на прицепе | 10–450 |
|
||||
| Бук-М2 | 4 × 9М317 на направляющих, башня с РЛС подсвета | 20–675 |
|
||||
| Тор-М2 | 8 × 9М338 вертикально из башни, быстрая реакция против дронов | 8–350 |
|
||||
| Тор-М2 | 8 × 9М338 вертикально из башни, быстрая реакция против дронов | 8–240 |
|
||||
| P1-SUN | 8 дронов-перехватчиков против Шахедов и Герань; своей РЛС нет — стреляет по данным сети | 5–675 |
|
||||
|
||||
Обслуживающая техника (тоже пультами или `/airdef deploy <ключ>`): **РЛС дальнего обнаружения** (`radar`,
|
||||
базовая дальность обзора 3800 блоков до поправок на класс цели, высоту и рельеф), **склад боеприпасов** (`depot`), **ТЗМ** (`tzm`),
|
||||
**станция РЭБ** (`ew`), **прожектор** (`light`), **оптический пост** (`optical`: пассивно уточняет широкий класс
|
||||
контакта по прямой видимости и передаёт уточнение в класс уже известного сетевого трека — без своего трека,
|
||||
свежести и права на пуск; не излучает и не ведёт огневой трек). Новые комплексы: `irist`, `nasams`, `buk`, `tor`, `p1sun`.
|
||||
видит на 2,5 км с высокой мачты, хуже прячутся за рельефом), **склад боеприпасов** (`depot`), **ТЗМ** (`tzm`),
|
||||
**станция РЭБ** (`ew`), **прожектор** (`light`). Новые комплексы: `irist`, `nasams`, `buk`, `tor`, `p1sun`.
|
||||
|
||||
**Согласование огня.** Комплексы делят цели между собой: на обычную цель идёт одна ракета, на баллистическую две; чем ближе цель к своей точке попадания,
|
||||
тем больше перехватчиков разрешено на неё сразу (за ~12 с до удара ещё один, за ~5 с — ещё один). Комплекс, у которого кончились ракеты
|
||||
@@ -364,8 +282,8 @@ HUD не выводится. Простые пресеты налёта фазу
|
||||
нарастает плавно, но холодного выброса нет; электрический P1-SUN не получает ракетную струю.
|
||||
|
||||
**Последний шанс** (`/airdef lastchance on|off`, по умолчанию вкл). Комплекс стреляет и по классу целей вне своих ролей
|
||||
(С-400, С-500 и Patriot по умолчанию не бьют дроны), если цель долетит до своей точки меньше чем за 6 с, на ней ещё нет
|
||||
ничьего перехватчика и готовый комплекс меньшей дальности не успевает её обстрелять. Комплексу с пустыми ролями (огонь запрещён) это не касается. `/airdef why` пишет «последний шанс».
|
||||
(С-400, С-500 и Patriot по умолчанию не бьют дроны), если цель долетит до своей точки меньше чем за 10 с и на ней ещё нет
|
||||
ничьего перехватчика. Комплексу с пустыми ролями (огонь запрещён) это не касается. `/airdef why` пишет «последний шанс».
|
||||
|
||||
**Дальний пуск по РЛС.** С-400, С-500 и Patriot могут стрелять дальше своей дальности (до 1,6×) по цели, которую держит
|
||||
свежим треком РЛС дальнего обнаружения в радиусе связи: не чаще раза в 15 с, при не менее чем половине боезапаса, только по
|
||||
|
||||
@@ -9,7 +9,5 @@ glam = "0.30"
|
||||
|
||||
[features]
|
||||
test-fixtures = []
|
||||
# Counts the events the by-time journal readers hand out (the `replay_bench` example).
|
||||
bench-counters = []
|
||||
|
||||
[workspace]
|
||||
|
||||
@@ -144,9 +144,7 @@ fn two_maximum_menu_raids_with_answered_flat_terrain() {
|
||||
let mut second = false;
|
||||
let mut overlap = false;
|
||||
let mut peak = 0;
|
||||
// Two maximum menu raids can keep the last supersonic contact in the air past
|
||||
// 5000 ticks under the radar profiles; the recording closes once the sky is clear.
|
||||
for now in 1..=8000 {
|
||||
for now in 1..=5000 {
|
||||
if !second && !sim.planning() {
|
||||
overlap = !sim.queue.is_empty() || sim.drones.iter().any(|d| d.alive());
|
||||
assert_eq!(sim.order_raid(&order, &targets, &mut out), expected);
|
||||
|
||||
Generated
-197
@@ -2,22 +2,13 @@
|
||||
# It is not intended for manual editing.
|
||||
version = 4
|
||||
|
||||
[[package]]
|
||||
name = "adler2"
|
||||
version = "2.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa"
|
||||
|
||||
[[package]]
|
||||
name = "airdef"
|
||||
version = "0.2.0"
|
||||
dependencies = [
|
||||
"airdef-core",
|
||||
"glam",
|
||||
"horizon-assets",
|
||||
"horizon-mod-sdk",
|
||||
"horizon-mods",
|
||||
"serde_json",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -33,75 +24,18 @@ version = "1.0.104"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470"
|
||||
|
||||
[[package]]
|
||||
name = "arbitrary"
|
||||
version = "1.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3bc62ac97cc33321f50863d514c3bc38a453947a8f9e781137e47c7401020aed"
|
||||
dependencies = [
|
||||
"derive_arbitrary",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "2.13.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06"
|
||||
|
||||
[[package]]
|
||||
name = "bumpalo"
|
||||
version = "3.20.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "87a0cf66fd1eb2fb7b822cb78370d82303750809bc6ba855f3f58e517d3238db"
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "1.0.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600"
|
||||
|
||||
[[package]]
|
||||
name = "crc32fast"
|
||||
version = "1.5.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2b929dd2a135771f40afabd1073f85eed59c800b7c61901e5c254270497dad64"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-utils"
|
||||
version = "0.8.23"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a31eee39dddec8330830986fcd7625edb5a24ec90ea038215273bbc3adb08ac6"
|
||||
|
||||
[[package]]
|
||||
name = "derive_arbitrary"
|
||||
version = "1.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1b034bd7d5f032402a2479444dcc6f74e36a03f31854d41680fb240ef682a1ac"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 3.0.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "equivalent"
|
||||
version = "1.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "00d174d5400e5e8fd687ad1049e2f578285fa914201b1af7e8b112a4546bd826"
|
||||
|
||||
[[package]]
|
||||
name = "flate2"
|
||||
version = "1.1.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "626d4928326b646e70f65ed36fc7cf9f206bdb68a0019ee7c6b4709da4e084c4"
|
||||
dependencies = [
|
||||
"crc32fast",
|
||||
"miniz_oxide",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "foldhash"
|
||||
version = "0.2.0"
|
||||
@@ -129,22 +63,6 @@ version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
||||
|
||||
[[package]]
|
||||
name = "horizon-assets"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"horizon-core",
|
||||
"serde",
|
||||
"serde_json",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "horizon-core"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"libm",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "horizon-mod-sdk"
|
||||
version = "0.1.0"
|
||||
@@ -152,17 +70,6 @@ dependencies = [
|
||||
"wit-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "horizon-mods"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"log",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"toml",
|
||||
"zip",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "id-arena"
|
||||
version = "2.3.0"
|
||||
@@ -193,12 +100,6 @@ version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2"
|
||||
|
||||
[[package]]
|
||||
name = "libm"
|
||||
version = "0.2.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981"
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.34"
|
||||
@@ -211,16 +112,6 @@ version = "2.8.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
|
||||
|
||||
[[package]]
|
||||
name = "miniz_oxide"
|
||||
version = "0.9.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b63fbc4a50860e98e7b2aa7804ded1db5cbc3aff9193adaff57a6931bf7c4b4c"
|
||||
dependencies = [
|
||||
"adler2",
|
||||
"simd-adler32",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "prettyplease"
|
||||
version = "0.2.37"
|
||||
@@ -262,7 +153,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba"
|
||||
dependencies = [
|
||||
"serde_core",
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -298,21 +188,6 @@ dependencies = [
|
||||
"zmij",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_spanned"
|
||||
version = "1.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9c187e0a369471c550af028cba56d4f4fa2a489ad28151ae95a4d340a2a8b782"
|
||||
dependencies = [
|
||||
"serde_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "simd-adler32"
|
||||
version = "0.3.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3a219298ac11a56ea9a6d2120044824d6f01aeb034955e7af7bc16858527deea"
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.119"
|
||||
@@ -335,45 +210,6 @@ dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml"
|
||||
version = "1.2.2+spec-1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5426cb1b964690d913f6c5c1a1ae0b42f428ec506bb4d452876d7a209c9bca3b"
|
||||
dependencies = [
|
||||
"indexmap",
|
||||
"serde_core",
|
||||
"serde_spanned",
|
||||
"toml_datetime",
|
||||
"toml_parser",
|
||||
"toml_writer",
|
||||
"winnow",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml_datetime"
|
||||
version = "1.1.3+spec-1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "173f25c883cd2176a2d8212155638c0a60d484a9d84546d270866f40f56b6e49"
|
||||
dependencies = [
|
||||
"serde_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml_parser"
|
||||
version = "1.1.6+spec-1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e6769c452d71ba30696c6b37770c439a9cc9110f47f7d5cdbeda79840ef5ea31"
|
||||
dependencies = [
|
||||
"winnow",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml_writer"
|
||||
version = "1.2.0+spec-1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "009dbb7700f11c55ef83aebbe4c0e9cf1f1ac0844bd8d6f00dc38f302026e13a"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.27"
|
||||
@@ -414,12 +250,6 @@ dependencies = [
|
||||
"semver",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winnow"
|
||||
version = "1.0.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8c3b93199df0ab874cdf0c6a94f0a0dc3423fe41f1cafb62b8bd7b1deb277aef"
|
||||
|
||||
[[package]]
|
||||
name = "wit-bindgen"
|
||||
version = "0.60.0"
|
||||
@@ -509,35 +339,8 @@ dependencies = [
|
||||
"wasmparser",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zip"
|
||||
version = "2.6.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1dcb24d0152526ae49b9b96c1dcf71850ca1e0b882e4e28ed898a93c41334744"
|
||||
dependencies = [
|
||||
"arbitrary",
|
||||
"crc32fast",
|
||||
"crossbeam-utils",
|
||||
"flate2",
|
||||
"indexmap",
|
||||
"memchr",
|
||||
"zopfli",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zmij"
|
||||
version = "1.0.23"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b"
|
||||
|
||||
[[package]]
|
||||
name = "zopfli"
|
||||
version = "0.8.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "aaf7fc5d30c28483d93805c4a5e12b05bbb52407fa67c5f8bd552374cd01fb11"
|
||||
dependencies = [
|
||||
"bumpalo",
|
||||
"crc32fast",
|
||||
"log",
|
||||
"simd-adler32",
|
||||
]
|
||||
|
||||
@@ -8,24 +8,13 @@ description = "AirDef: long-range drones and air defence for the AirDef fork of
|
||||
[lib]
|
||||
crate-type = ["cdylib", "rlib"]
|
||||
|
||||
[features]
|
||||
# Counts the events the by-time readers hand out (the `replay_bench` example); off in the mod build.
|
||||
bench-counters = ["airdef-core/bench-counters"]
|
||||
|
||||
[dependencies]
|
||||
airdef-core = { path = "../airdef-core" }
|
||||
horizon-mod-sdk = { path = "../horizon/crates/horizon-mod-sdk" }
|
||||
glam = "0.30"
|
||||
serde_json = "1"
|
||||
|
||||
[build-dependencies]
|
||||
horizon-assets = { path = "../horizon/crates/horizon-assets" }
|
||||
|
||||
[dev-dependencies]
|
||||
airdef-core = { path = "../airdef-core", features = ["test-fixtures"] }
|
||||
# The host's own block tracer, so the saturation replica answers render rays exactly as the
|
||||
# WASM test host does (no runtime: just `world_query`).
|
||||
horizon-mods = { path = "../horizon/crates/horizon-mods", default-features = false }
|
||||
|
||||
[profile.release]
|
||||
opt-level = "s"
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"variants": {
|
||||
"": {
|
||||
"model": "airdef:block/optical_head"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"variants": {
|
||||
"": {
|
||||
"model": "airdef:block/optical_post"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"variants": {
|
||||
"": {
|
||||
"model": "airdef:block/optical_post_burnt"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"variants": {
|
||||
"": {
|
||||
"model": "airdef:block/radar_dish"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"variants": {
|
||||
"": {
|
||||
"model": "airdef:block/radar_height_head"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"variants": {
|
||||
"": {
|
||||
"model": "airdef:block/radar_search_array"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"variants": {
|
||||
"": {
|
||||
"model": "airdef:block/radar_trailer_burnt"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"model": {
|
||||
"type": "minecraft:model",
|
||||
"model": "airdef:item/deploy_optical"
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"model": {
|
||||
"type": "minecraft:model",
|
||||
"model": "airdef:item/deploy_radar_height"
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"model": {
|
||||
"type": "minecraft:model",
|
||||
"model": "airdef:item/deploy_radar_search"
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"model": {
|
||||
"type": "minecraft:model",
|
||||
"model": "airdef:item/deploy_radar_track"
|
||||
}
|
||||
}
|
||||
@@ -34,11 +34,6 @@
|
||||
"block.airdef.radar_mast": "Радиомачта (секция высоты)",
|
||||
"block.airdef.radar_trailer": "Прицеп РЛС",
|
||||
"block.airdef.radar_panel": "РЛС обзора",
|
||||
"block.airdef.radar_search_array": "Антенна РЛС обзора",
|
||||
"block.airdef.radar_dish": "Зеркало РЛС сопровождения",
|
||||
"block.airdef.radar_height_head": "Головка мачтовой РЛС",
|
||||
"block.airdef.optical_head": "Головка оптического поста",
|
||||
"block.airdef.optical_post": "Основание оптического поста",
|
||||
"block.airdef.m57e6": "57Э6",
|
||||
"block.airdef.m48n6": "48Н6",
|
||||
"block.airdef.rm48u": "RM48U (игровой профиль)",
|
||||
@@ -97,22 +92,19 @@
|
||||
"block.airdef.tor_turret_burnt": "Башня Тора (остов)",
|
||||
"block.airdef.p1sun_launcher_burnt": "Пусковая P1-SUN (остов)",
|
||||
"block.airdef.radar_truck_burnt": "Шасси РЛС (остов)",
|
||||
"block.airdef.radar_trailer_burnt": "Прицеп РЛС (остов)",
|
||||
"block.airdef.optical_post_burnt": "Основание оптического поста (остов)",
|
||||
"block.airdef.depot_burnt": "Склад боеприпасов (остов)",
|
||||
"block.airdef.tzm_truck_burnt": "Транспортно-заряжающая машина (остов)",
|
||||
"block.airdef.ew_truck_burnt": "Станция РЭБ (остов)",
|
||||
"block.airdef.searchlight_burnt": "Прожектор (остов)",
|
||||
"block.airdef.searchlight_head_burnt": "Голова прожектора (остов)",
|
||||
"item.airdef.designator": "Целеуказатель",
|
||||
"item.airdef.deploy_radar_search": "Развернуть РЛС обзора",
|
||||
"item.airdef.deploy_radar_track": "Развернуть РЛС сопровождения",
|
||||
"item.airdef.deploy_radar_height": "Развернуть мачтовую РЛС",
|
||||
"item.airdef.mover": "Пульт перемещения",
|
||||
"item.airdef.flare_gun": "Осветительная ракета",
|
||||
"item.airdef.remover": "Свернуть ПВО",
|
||||
"item.airdef.launch_shahed": "Пуск: Шахед-136",
|
||||
"item.airdef.launch_geran3": "Пуск: Герань-3",
|
||||
"item.airdef.deploy_patriot": "Развернуть Patriot",
|
||||
"item.airdef.deploy_gepard": "Развернуть Гепард",
|
||||
"item.airdef.deploy_pantsir": "Развернуть Панцирь-С1",
|
||||
"item.airdef.deploy_s400": "Развернуть С-400",
|
||||
"item.airdef.deploy_s500": "Развернуть С-500",
|
||||
"item.airdef.launch_lancet": "Пуск: Ланцет-3",
|
||||
"item.airdef.launch_kh101": "Пуск: Х-101",
|
||||
"item.airdef.launch_kalibr": "Пуск: Калибр",
|
||||
@@ -121,11 +113,6 @@
|
||||
"item.airdef.launch_iskander": "Пуск: Искандер-М",
|
||||
"item.airdef.launch_kinzhal": "Пуск: Кинжал",
|
||||
"item.airdef.launch_oreshnik": "Пуск: Орешник",
|
||||
"item.airdef.deploy_patriot": "Развернуть Patriot",
|
||||
"item.airdef.deploy_gepard": "Развернуть Гепард",
|
||||
"item.airdef.deploy_pantsir": "Развернуть Панцирь-С1",
|
||||
"item.airdef.deploy_s400": "Развернуть С-400 (пусковая)",
|
||||
"item.airdef.deploy_s500": "Развернуть С-500 (пусковая)",
|
||||
"item.airdef.deploy_irist": "Развернуть IRIS-T SLM",
|
||||
"item.airdef.deploy_nasams": "Развернуть NASAMS",
|
||||
"item.airdef.deploy_buk": "Развернуть Бук-М2",
|
||||
@@ -136,7 +123,9 @@
|
||||
"item.airdef.deploy_tzm": "Развернуть ТЗМ",
|
||||
"item.airdef.deploy_ew": "Развернуть станцию РЭБ",
|
||||
"item.airdef.deploy_light": "Развернуть прожектор",
|
||||
"item.airdef.deploy_optical": "Развернуть оптический пост",
|
||||
"item.airdef.mover": "Пульт перемещения",
|
||||
"item.airdef.flare_gun": "Осветительная ракета",
|
||||
"item.airdef.remover": "Свернуть ПВО",
|
||||
"item.airdef.cam_shahed": "Шахед-136",
|
||||
"item.airdef.cam_geran3": "Герань-3",
|
||||
"item.airdef.cam_lancet": "Ланцет-3",
|
||||
|
||||
@@ -34,11 +34,6 @@
|
||||
"block.airdef.radar_mast": "Радиомачта (секция высоты)",
|
||||
"block.airdef.radar_trailer": "Прицеп РЛС",
|
||||
"block.airdef.radar_panel": "РЛС обзора",
|
||||
"block.airdef.radar_search_array": "Антенна РЛС обзора",
|
||||
"block.airdef.radar_dish": "Зеркало РЛС сопровождения",
|
||||
"block.airdef.radar_height_head": "Головка мачтовой РЛС",
|
||||
"block.airdef.optical_head": "Головка оптического поста",
|
||||
"block.airdef.optical_post": "Основание оптического поста",
|
||||
"block.airdef.m57e6": "57Э6",
|
||||
"block.airdef.m48n6": "48Н6",
|
||||
"block.airdef.rm48u": "RM48U (игровой профиль)",
|
||||
@@ -97,22 +92,19 @@
|
||||
"block.airdef.tor_turret_burnt": "Башня Тора (остов)",
|
||||
"block.airdef.p1sun_launcher_burnt": "Пусковая P1-SUN (остов)",
|
||||
"block.airdef.radar_truck_burnt": "Шасси РЛС (остов)",
|
||||
"block.airdef.radar_trailer_burnt": "Прицеп РЛС (остов)",
|
||||
"block.airdef.optical_post_burnt": "Основание оптического поста (остов)",
|
||||
"block.airdef.depot_burnt": "Склад боеприпасов (остов)",
|
||||
"block.airdef.tzm_truck_burnt": "Транспортно-заряжающая машина (остов)",
|
||||
"block.airdef.ew_truck_burnt": "Станция РЭБ (остов)",
|
||||
"block.airdef.searchlight_burnt": "Прожектор (остов)",
|
||||
"block.airdef.searchlight_head_burnt": "Голова прожектора (остов)",
|
||||
"item.airdef.designator": "Целеуказатель",
|
||||
"item.airdef.deploy_radar_search": "Развернуть РЛС обзора",
|
||||
"item.airdef.deploy_radar_track": "Развернуть РЛС сопровождения",
|
||||
"item.airdef.deploy_radar_height": "Развернуть мачтовую РЛС",
|
||||
"item.airdef.mover": "Пульт перемещения",
|
||||
"item.airdef.flare_gun": "Осветительная ракета",
|
||||
"item.airdef.remover": "Свернуть ПВО",
|
||||
"item.airdef.launch_shahed": "Пуск: Шахед-136",
|
||||
"item.airdef.launch_geran3": "Пуск: Герань-3",
|
||||
"item.airdef.deploy_patriot": "Развернуть Patriot",
|
||||
"item.airdef.deploy_gepard": "Развернуть Гепард",
|
||||
"item.airdef.deploy_pantsir": "Развернуть Панцирь-С1",
|
||||
"item.airdef.deploy_s400": "Развернуть С-400",
|
||||
"item.airdef.deploy_s500": "Развернуть С-500",
|
||||
"item.airdef.launch_lancet": "Пуск: Ланцет-3",
|
||||
"item.airdef.launch_kh101": "Пуск: Х-101",
|
||||
"item.airdef.launch_kalibr": "Пуск: Калибр",
|
||||
@@ -121,11 +113,6 @@
|
||||
"item.airdef.launch_iskander": "Пуск: Искандер-М",
|
||||
"item.airdef.launch_kinzhal": "Пуск: Кинжал",
|
||||
"item.airdef.launch_oreshnik": "Пуск: Орешник",
|
||||
"item.airdef.deploy_patriot": "Развернуть Patriot",
|
||||
"item.airdef.deploy_gepard": "Развернуть Гепард",
|
||||
"item.airdef.deploy_pantsir": "Развернуть Панцирь-С1",
|
||||
"item.airdef.deploy_s400": "Развернуть С-400 (пусковая)",
|
||||
"item.airdef.deploy_s500": "Развернуть С-500 (пусковая)",
|
||||
"item.airdef.deploy_irist": "Развернуть IRIS-T SLM",
|
||||
"item.airdef.deploy_nasams": "Развернуть NASAMS",
|
||||
"item.airdef.deploy_buk": "Развернуть Бук-М2",
|
||||
@@ -136,7 +123,9 @@
|
||||
"item.airdef.deploy_tzm": "Развернуть ТЗМ",
|
||||
"item.airdef.deploy_ew": "Развернуть станцию РЭБ",
|
||||
"item.airdef.deploy_light": "Развернуть прожектор",
|
||||
"item.airdef.deploy_optical": "Развернуть оптический пост",
|
||||
"item.airdef.mover": "Пульт перемещения",
|
||||
"item.airdef.flare_gun": "Осветительная ракета",
|
||||
"item.airdef.remover": "Свернуть ПВО",
|
||||
"item.airdef.cam_shahed": "Шахед-136",
|
||||
"item.airdef.cam_geran3": "Герань-3",
|
||||
"item.airdef.cam_lancet": "Ланцет-3",
|
||||
|
||||
@@ -1,487 +0,0 @@
|
||||
{
|
||||
"ambientocclusion": false,
|
||||
"textures": {
|
||||
"dark_metal": "airdef:block/dark_metal",
|
||||
"ru_khaki": "airdef:block/ru_khaki",
|
||||
"glass_cab": "airdef:block/glass_cab",
|
||||
"particle": "airdef:block/dark_metal"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"from": [
|
||||
4.0,
|
||||
-6.0,
|
||||
4.0
|
||||
],
|
||||
"to": [
|
||||
12.0,
|
||||
-1.0,
|
||||
12.0
|
||||
],
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
8.0,
|
||||
5.0
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
},
|
||||
"south": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
8.0,
|
||||
5.0
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
},
|
||||
"east": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
8.0,
|
||||
5.0
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
},
|
||||
"west": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
8.0,
|
||||
5.0
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
},
|
||||
"up": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
8.0,
|
||||
8.0
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
},
|
||||
"down": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
8.0,
|
||||
8.0
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [
|
||||
2.5,
|
||||
-1.0,
|
||||
6.5
|
||||
],
|
||||
"to": [
|
||||
5.5,
|
||||
6.0,
|
||||
9.5
|
||||
],
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
3.0,
|
||||
7.0
|
||||
],
|
||||
"texture": "#ru_khaki"
|
||||
},
|
||||
"south": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
3.0,
|
||||
7.0
|
||||
],
|
||||
"texture": "#ru_khaki"
|
||||
},
|
||||
"east": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
3.0,
|
||||
7.0
|
||||
],
|
||||
"texture": "#ru_khaki"
|
||||
},
|
||||
"west": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
3.0,
|
||||
7.0
|
||||
],
|
||||
"texture": "#ru_khaki"
|
||||
},
|
||||
"up": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
3.0,
|
||||
3.0
|
||||
],
|
||||
"texture": "#ru_khaki"
|
||||
},
|
||||
"down": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
3.0,
|
||||
3.0
|
||||
],
|
||||
"texture": "#ru_khaki"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [
|
||||
10.5,
|
||||
-1.0,
|
||||
6.5
|
||||
],
|
||||
"to": [
|
||||
13.5,
|
||||
6.0,
|
||||
9.5
|
||||
],
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
3.0,
|
||||
7.0
|
||||
],
|
||||
"texture": "#ru_khaki"
|
||||
},
|
||||
"south": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
3.0,
|
||||
7.0
|
||||
],
|
||||
"texture": "#ru_khaki"
|
||||
},
|
||||
"east": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
3.0,
|
||||
7.0
|
||||
],
|
||||
"texture": "#ru_khaki"
|
||||
},
|
||||
"west": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
3.0,
|
||||
7.0
|
||||
],
|
||||
"texture": "#ru_khaki"
|
||||
},
|
||||
"up": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
3.0,
|
||||
3.0
|
||||
],
|
||||
"texture": "#ru_khaki"
|
||||
},
|
||||
"down": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
3.0,
|
||||
3.0
|
||||
],
|
||||
"texture": "#ru_khaki"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [
|
||||
3.0,
|
||||
-1.0,
|
||||
-6.0
|
||||
],
|
||||
"to": [
|
||||
13.0,
|
||||
7.0,
|
||||
7.0
|
||||
],
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
10.0,
|
||||
8.0
|
||||
],
|
||||
"texture": "#ru_khaki"
|
||||
},
|
||||
"south": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
10.0,
|
||||
8.0
|
||||
],
|
||||
"texture": "#ru_khaki"
|
||||
},
|
||||
"east": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
13.0,
|
||||
8.0
|
||||
],
|
||||
"texture": "#ru_khaki"
|
||||
},
|
||||
"west": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
13.0,
|
||||
8.0
|
||||
],
|
||||
"texture": "#ru_khaki"
|
||||
},
|
||||
"up": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
10.0,
|
||||
13.0
|
||||
],
|
||||
"texture": "#ru_khaki"
|
||||
},
|
||||
"down": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
10.0,
|
||||
13.0
|
||||
],
|
||||
"texture": "#ru_khaki"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [
|
||||
5.0,
|
||||
1.0,
|
||||
-7.5
|
||||
],
|
||||
"to": [
|
||||
11.0,
|
||||
5.0,
|
||||
-6.0
|
||||
],
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
6.0,
|
||||
4.0
|
||||
],
|
||||
"texture": "#glass_cab"
|
||||
},
|
||||
"south": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
6.0,
|
||||
4.0
|
||||
],
|
||||
"texture": "#glass_cab"
|
||||
},
|
||||
"east": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
1.5,
|
||||
4.0
|
||||
],
|
||||
"texture": "#glass_cab"
|
||||
},
|
||||
"west": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
1.5,
|
||||
4.0
|
||||
],
|
||||
"texture": "#glass_cab"
|
||||
},
|
||||
"up": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
6.0,
|
||||
1.5
|
||||
],
|
||||
"texture": "#glass_cab"
|
||||
},
|
||||
"down": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
6.0,
|
||||
1.5
|
||||
],
|
||||
"texture": "#glass_cab"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [
|
||||
9.0,
|
||||
7.0,
|
||||
-4.0
|
||||
],
|
||||
"to": [
|
||||
12.0,
|
||||
10.0,
|
||||
3.0
|
||||
],
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
3.0,
|
||||
3.0
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
},
|
||||
"south": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
3.0,
|
||||
3.0
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
},
|
||||
"east": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
7.0,
|
||||
3.0
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
},
|
||||
"west": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
7.0,
|
||||
3.0
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
},
|
||||
"up": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
3.0,
|
||||
7.0
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
},
|
||||
"down": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
3.0,
|
||||
7.0
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [
|
||||
10.0,
|
||||
7.5,
|
||||
-5.0
|
||||
],
|
||||
"to": [
|
||||
11.0,
|
||||
9.5,
|
||||
-4.0
|
||||
],
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
1.0,
|
||||
2.0
|
||||
],
|
||||
"texture": "#glass_cab"
|
||||
},
|
||||
"south": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
1.0,
|
||||
2.0
|
||||
],
|
||||
"texture": "#glass_cab"
|
||||
},
|
||||
"east": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
1.0,
|
||||
2.0
|
||||
],
|
||||
"texture": "#glass_cab"
|
||||
},
|
||||
"west": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
1.0,
|
||||
2.0
|
||||
],
|
||||
"texture": "#glass_cab"
|
||||
},
|
||||
"up": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
1.0,
|
||||
1.0
|
||||
],
|
||||
"texture": "#glass_cab"
|
||||
},
|
||||
"down": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
1.0,
|
||||
1.0
|
||||
],
|
||||
"texture": "#glass_cab"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,216 +0,0 @@
|
||||
{
|
||||
"ambientocclusion": false,
|
||||
"textures": {
|
||||
"concrete": "airdef:block/concrete",
|
||||
"ru_khaki": "airdef:block/ru_khaki",
|
||||
"metal": "airdef:block/metal",
|
||||
"crate": "airdef:block/crate",
|
||||
"particle": "airdef:block/concrete"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"from": [
|
||||
-6.0,
|
||||
0.0,
|
||||
-6.0
|
||||
],
|
||||
"to": [
|
||||
22.0,
|
||||
2.0,
|
||||
22.0
|
||||
],
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
16,
|
||||
2.0
|
||||
],
|
||||
"texture": "#concrete"
|
||||
},
|
||||
"south": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
16,
|
||||
2.0
|
||||
],
|
||||
"texture": "#concrete"
|
||||
},
|
||||
"east": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
16,
|
||||
2.0
|
||||
],
|
||||
"texture": "#concrete"
|
||||
},
|
||||
"west": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
16,
|
||||
2.0
|
||||
],
|
||||
"texture": "#concrete"
|
||||
},
|
||||
"up": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
16,
|
||||
16
|
||||
],
|
||||
"texture": "#concrete"
|
||||
},
|
||||
"down": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
16,
|
||||
16
|
||||
],
|
||||
"texture": "#concrete"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [
|
||||
1.0,
|
||||
2.0,
|
||||
1.0
|
||||
],
|
||||
"to": [
|
||||
15.0,
|
||||
9.0,
|
||||
15.0
|
||||
],
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
14.0,
|
||||
7.0
|
||||
],
|
||||
"texture": "#ru_khaki"
|
||||
},
|
||||
"south": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
14.0,
|
||||
7.0
|
||||
],
|
||||
"texture": "#ru_khaki"
|
||||
},
|
||||
"east": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
14.0,
|
||||
7.0
|
||||
],
|
||||
"texture": "#metal"
|
||||
},
|
||||
"west": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
14.0,
|
||||
7.0
|
||||
],
|
||||
"texture": "#ru_khaki"
|
||||
},
|
||||
"up": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
14.0,
|
||||
14.0
|
||||
],
|
||||
"texture": "#ru_khaki"
|
||||
},
|
||||
"down": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
14.0,
|
||||
14.0
|
||||
],
|
||||
"texture": "#ru_khaki"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [
|
||||
-4.0,
|
||||
2.0,
|
||||
-2.0
|
||||
],
|
||||
"to": [
|
||||
1.0,
|
||||
7.0,
|
||||
4.0
|
||||
],
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
5.0,
|
||||
5.0
|
||||
],
|
||||
"texture": "#crate"
|
||||
},
|
||||
"south": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
5.0,
|
||||
5.0
|
||||
],
|
||||
"texture": "#crate"
|
||||
},
|
||||
"east": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
6.0,
|
||||
5.0
|
||||
],
|
||||
"texture": "#crate"
|
||||
},
|
||||
"west": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
6.0,
|
||||
5.0
|
||||
],
|
||||
"texture": "#crate"
|
||||
},
|
||||
"up": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
5.0,
|
||||
6.0
|
||||
],
|
||||
"texture": "#crate"
|
||||
},
|
||||
"down": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
5.0,
|
||||
6.0
|
||||
],
|
||||
"texture": "#crate"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,216 +0,0 @@
|
||||
{
|
||||
"ambientocclusion": false,
|
||||
"textures": {
|
||||
"concrete_b": "airdef:block/concrete_b",
|
||||
"ru_khaki_b": "airdef:block/ru_khaki_b",
|
||||
"metal_b": "airdef:block/metal_b",
|
||||
"crate_b": "airdef:block/crate_b",
|
||||
"particle": "airdef:block/concrete_b"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"from": [
|
||||
-6.0,
|
||||
0.0,
|
||||
-6.0
|
||||
],
|
||||
"to": [
|
||||
22.0,
|
||||
2.0,
|
||||
22.0
|
||||
],
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
16,
|
||||
2.0
|
||||
],
|
||||
"texture": "#concrete_b"
|
||||
},
|
||||
"south": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
16,
|
||||
2.0
|
||||
],
|
||||
"texture": "#concrete_b"
|
||||
},
|
||||
"east": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
16,
|
||||
2.0
|
||||
],
|
||||
"texture": "#concrete_b"
|
||||
},
|
||||
"west": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
16,
|
||||
2.0
|
||||
],
|
||||
"texture": "#concrete_b"
|
||||
},
|
||||
"up": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
16,
|
||||
16
|
||||
],
|
||||
"texture": "#concrete_b"
|
||||
},
|
||||
"down": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
16,
|
||||
16
|
||||
],
|
||||
"texture": "#concrete_b"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [
|
||||
1.0,
|
||||
2.0,
|
||||
1.0
|
||||
],
|
||||
"to": [
|
||||
15.0,
|
||||
9.0,
|
||||
15.0
|
||||
],
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
14.0,
|
||||
7.0
|
||||
],
|
||||
"texture": "#ru_khaki_b"
|
||||
},
|
||||
"south": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
14.0,
|
||||
7.0
|
||||
],
|
||||
"texture": "#ru_khaki_b"
|
||||
},
|
||||
"east": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
14.0,
|
||||
7.0
|
||||
],
|
||||
"texture": "#metal_b"
|
||||
},
|
||||
"west": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
14.0,
|
||||
7.0
|
||||
],
|
||||
"texture": "#ru_khaki_b"
|
||||
},
|
||||
"up": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
14.0,
|
||||
14.0
|
||||
],
|
||||
"texture": "#ru_khaki_b"
|
||||
},
|
||||
"down": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
14.0,
|
||||
14.0
|
||||
],
|
||||
"texture": "#ru_khaki_b"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [
|
||||
-4.0,
|
||||
2.0,
|
||||
-2.0
|
||||
],
|
||||
"to": [
|
||||
1.0,
|
||||
7.0,
|
||||
4.0
|
||||
],
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
5.0,
|
||||
5.0
|
||||
],
|
||||
"texture": "#crate_b"
|
||||
},
|
||||
"south": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
5.0,
|
||||
5.0
|
||||
],
|
||||
"texture": "#crate_b"
|
||||
},
|
||||
"east": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
6.0,
|
||||
5.0
|
||||
],
|
||||
"texture": "#crate_b"
|
||||
},
|
||||
"west": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
6.0,
|
||||
5.0
|
||||
],
|
||||
"texture": "#crate_b"
|
||||
},
|
||||
"up": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
5.0,
|
||||
6.0
|
||||
],
|
||||
"texture": "#crate_b"
|
||||
},
|
||||
"down": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
5.0,
|
||||
6.0
|
||||
],
|
||||
"texture": "#crate_b"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,555 +0,0 @@
|
||||
{
|
||||
"ambientocclusion": false,
|
||||
"textures": {
|
||||
"bare_dish": "airdef:block/bare_dish",
|
||||
"dark_metal": "airdef:block/dark_metal",
|
||||
"metal": "airdef:block/metal",
|
||||
"particle": "airdef:block/bare_dish"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"from": [
|
||||
-8.0,
|
||||
-6.0,
|
||||
8.0
|
||||
],
|
||||
"to": [
|
||||
24.0,
|
||||
20.0,
|
||||
10.0
|
||||
],
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
16,
|
||||
16
|
||||
],
|
||||
"texture": "#bare_dish"
|
||||
},
|
||||
"south": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
16,
|
||||
16
|
||||
],
|
||||
"texture": "#bare_dish"
|
||||
},
|
||||
"east": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
2.0,
|
||||
16
|
||||
],
|
||||
"texture": "#bare_dish"
|
||||
},
|
||||
"west": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
2.0,
|
||||
16
|
||||
],
|
||||
"texture": "#bare_dish"
|
||||
},
|
||||
"up": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
16,
|
||||
2.0
|
||||
],
|
||||
"texture": "#bare_dish"
|
||||
},
|
||||
"down": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
16,
|
||||
2.0
|
||||
],
|
||||
"texture": "#bare_dish"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [
|
||||
-4.0,
|
||||
-2.0,
|
||||
10.0
|
||||
],
|
||||
"to": [
|
||||
16.0,
|
||||
16.0,
|
||||
12.0
|
||||
],
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
16,
|
||||
16
|
||||
],
|
||||
"texture": "#bare_dish"
|
||||
},
|
||||
"south": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
16,
|
||||
16
|
||||
],
|
||||
"texture": "#bare_dish"
|
||||
},
|
||||
"east": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
2.0,
|
||||
16
|
||||
],
|
||||
"texture": "#bare_dish"
|
||||
},
|
||||
"west": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
2.0,
|
||||
16
|
||||
],
|
||||
"texture": "#bare_dish"
|
||||
},
|
||||
"up": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
16,
|
||||
2.0
|
||||
],
|
||||
"texture": "#bare_dish"
|
||||
},
|
||||
"down": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
16,
|
||||
2.0
|
||||
],
|
||||
"texture": "#bare_dish"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [
|
||||
0.0,
|
||||
2.0,
|
||||
12.0
|
||||
],
|
||||
"to": [
|
||||
12.0,
|
||||
12.0,
|
||||
14.0
|
||||
],
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
12.0,
|
||||
10.0
|
||||
],
|
||||
"texture": "#bare_dish"
|
||||
},
|
||||
"south": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
12.0,
|
||||
10.0
|
||||
],
|
||||
"texture": "#bare_dish"
|
||||
},
|
||||
"east": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
2.0,
|
||||
10.0
|
||||
],
|
||||
"texture": "#bare_dish"
|
||||
},
|
||||
"west": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
2.0,
|
||||
10.0
|
||||
],
|
||||
"texture": "#bare_dish"
|
||||
},
|
||||
"up": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
12.0,
|
||||
2.0
|
||||
],
|
||||
"texture": "#bare_dish"
|
||||
},
|
||||
"down": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
12.0,
|
||||
2.0
|
||||
],
|
||||
"texture": "#bare_dish"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [
|
||||
-8.5,
|
||||
-6.5,
|
||||
10.0
|
||||
],
|
||||
"to": [
|
||||
24.5,
|
||||
20.5,
|
||||
11.0
|
||||
],
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
16,
|
||||
16
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
},
|
||||
"south": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
16,
|
||||
16
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
},
|
||||
"east": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
1.0,
|
||||
16
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
},
|
||||
"west": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
1.0,
|
||||
16
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
},
|
||||
"up": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
16,
|
||||
1.0
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
},
|
||||
"down": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
16,
|
||||
1.0
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [
|
||||
3.0,
|
||||
-3.0,
|
||||
14.0
|
||||
],
|
||||
"to": [
|
||||
13.0,
|
||||
3.0,
|
||||
17.0
|
||||
],
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
10.0,
|
||||
6.0
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
},
|
||||
"south": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
10.0,
|
||||
6.0
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
},
|
||||
"east": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
3.0,
|
||||
6.0
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
},
|
||||
"west": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
3.0,
|
||||
6.0
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
},
|
||||
"up": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
10.0,
|
||||
3.0
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
},
|
||||
"down": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
10.0,
|
||||
3.0
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [
|
||||
7.0,
|
||||
6.0,
|
||||
2.0
|
||||
],
|
||||
"to": [
|
||||
9.0,
|
||||
8.0,
|
||||
9.0
|
||||
],
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
2.0,
|
||||
2.0
|
||||
],
|
||||
"texture": "#metal"
|
||||
},
|
||||
"south": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
2.0,
|
||||
2.0
|
||||
],
|
||||
"texture": "#metal"
|
||||
},
|
||||
"east": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
7.0,
|
||||
2.0
|
||||
],
|
||||
"texture": "#metal"
|
||||
},
|
||||
"west": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
7.0,
|
||||
2.0
|
||||
],
|
||||
"texture": "#metal"
|
||||
},
|
||||
"up": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
2.0,
|
||||
7.0
|
||||
],
|
||||
"texture": "#metal"
|
||||
},
|
||||
"down": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
2.0,
|
||||
7.0
|
||||
],
|
||||
"texture": "#metal"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [
|
||||
5.5,
|
||||
4.5,
|
||||
-2.0
|
||||
],
|
||||
"to": [
|
||||
10.5,
|
||||
9.5,
|
||||
2.0
|
||||
],
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
5.0,
|
||||
5.0
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
},
|
||||
"south": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
5.0,
|
||||
5.0
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
},
|
||||
"east": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
4.0,
|
||||
5.0
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
},
|
||||
"west": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
4.0,
|
||||
5.0
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
},
|
||||
"up": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
5.0,
|
||||
4.0
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
},
|
||||
"down": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
5.0,
|
||||
4.0
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [
|
||||
6.5,
|
||||
-10.0,
|
||||
6.5
|
||||
],
|
||||
"to": [
|
||||
9.5,
|
||||
-3.0,
|
||||
9.5
|
||||
],
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
3.0,
|
||||
7.0
|
||||
],
|
||||
"texture": "#metal"
|
||||
},
|
||||
"south": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
3.0,
|
||||
7.0
|
||||
],
|
||||
"texture": "#metal"
|
||||
},
|
||||
"east": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
3.0,
|
||||
7.0
|
||||
],
|
||||
"texture": "#metal"
|
||||
},
|
||||
"west": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
3.0,
|
||||
7.0
|
||||
],
|
||||
"texture": "#metal"
|
||||
},
|
||||
"up": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
3.0,
|
||||
3.0
|
||||
],
|
||||
"texture": "#metal"
|
||||
},
|
||||
"down": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
3.0,
|
||||
3.0
|
||||
],
|
||||
"texture": "#metal"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,351 +0,0 @@
|
||||
{
|
||||
"ambientocclusion": false,
|
||||
"textures": {
|
||||
"radar_face": "airdef:block/radar_face",
|
||||
"dark_metal": "airdef:block/dark_metal",
|
||||
"metal": "airdef:block/metal",
|
||||
"particle": "airdef:block/radar_face"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"from": [
|
||||
1.0,
|
||||
-2.0,
|
||||
5.0
|
||||
],
|
||||
"to": [
|
||||
15.0,
|
||||
14.0,
|
||||
7.0
|
||||
],
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
14.0,
|
||||
16
|
||||
],
|
||||
"texture": "#radar_face"
|
||||
},
|
||||
"south": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
14.0,
|
||||
16
|
||||
],
|
||||
"texture": "#radar_face"
|
||||
},
|
||||
"east": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
2.0,
|
||||
16
|
||||
],
|
||||
"texture": "#radar_face"
|
||||
},
|
||||
"west": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
2.0,
|
||||
16
|
||||
],
|
||||
"texture": "#radar_face"
|
||||
},
|
||||
"up": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
14.0,
|
||||
2.0
|
||||
],
|
||||
"texture": "#radar_face"
|
||||
},
|
||||
"down": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
14.0,
|
||||
2.0
|
||||
],
|
||||
"texture": "#radar_face"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [
|
||||
1.0,
|
||||
-2.0,
|
||||
9.0
|
||||
],
|
||||
"to": [
|
||||
15.0,
|
||||
14.0,
|
||||
11.0
|
||||
],
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
14.0,
|
||||
16
|
||||
],
|
||||
"texture": "#radar_face"
|
||||
},
|
||||
"south": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
14.0,
|
||||
16
|
||||
],
|
||||
"texture": "#radar_face"
|
||||
},
|
||||
"east": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
2.0,
|
||||
16
|
||||
],
|
||||
"texture": "#radar_face"
|
||||
},
|
||||
"west": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
2.0,
|
||||
16
|
||||
],
|
||||
"texture": "#radar_face"
|
||||
},
|
||||
"up": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
14.0,
|
||||
2.0
|
||||
],
|
||||
"texture": "#radar_face"
|
||||
},
|
||||
"down": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
14.0,
|
||||
2.0
|
||||
],
|
||||
"texture": "#radar_face"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [
|
||||
0.5,
|
||||
-2.5,
|
||||
7.0
|
||||
],
|
||||
"to": [
|
||||
15.5,
|
||||
14.5,
|
||||
9.0
|
||||
],
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
15.0,
|
||||
16
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
},
|
||||
"south": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
15.0,
|
||||
16
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
},
|
||||
"east": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
2.0,
|
||||
16
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
},
|
||||
"west": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
2.0,
|
||||
16
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
},
|
||||
"up": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
15.0,
|
||||
2.0
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
},
|
||||
"down": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
15.0,
|
||||
2.0
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [
|
||||
6.0,
|
||||
-8.0,
|
||||
6.0
|
||||
],
|
||||
"to": [
|
||||
10.0,
|
||||
-2.0,
|
||||
10.0
|
||||
],
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
4.0,
|
||||
6.0
|
||||
],
|
||||
"texture": "#metal"
|
||||
},
|
||||
"south": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
4.0,
|
||||
6.0
|
||||
],
|
||||
"texture": "#metal"
|
||||
},
|
||||
"east": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
4.0,
|
||||
6.0
|
||||
],
|
||||
"texture": "#metal"
|
||||
},
|
||||
"west": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
4.0,
|
||||
6.0
|
||||
],
|
||||
"texture": "#metal"
|
||||
},
|
||||
"up": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
4.0,
|
||||
4.0
|
||||
],
|
||||
"texture": "#metal"
|
||||
},
|
||||
"down": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
4.0,
|
||||
4.0
|
||||
],
|
||||
"texture": "#metal"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [
|
||||
2.0,
|
||||
14.0,
|
||||
7.0
|
||||
],
|
||||
"to": [
|
||||
14.0,
|
||||
16.0,
|
||||
9.0
|
||||
],
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
12.0,
|
||||
2.0
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
},
|
||||
"south": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
12.0,
|
||||
2.0
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
},
|
||||
"east": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
2.0,
|
||||
2.0
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
},
|
||||
"west": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
2.0,
|
||||
2.0
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
},
|
||||
"up": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
12.0,
|
||||
2.0
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
},
|
||||
"down": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
12.0,
|
||||
2.0
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,641 +0,0 @@
|
||||
{
|
||||
"ambientocclusion": false,
|
||||
"textures": {
|
||||
"radar_face": "airdef:block/radar_face",
|
||||
"dark_metal": "airdef:block/dark_metal",
|
||||
"metal": "airdef:block/metal",
|
||||
"particle": "airdef:block/radar_face"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"from": [
|
||||
-6.0,
|
||||
0.0,
|
||||
7.0
|
||||
],
|
||||
"to": [
|
||||
22.0,
|
||||
30.0,
|
||||
9.0
|
||||
],
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
16,
|
||||
16
|
||||
],
|
||||
"texture": "#radar_face"
|
||||
},
|
||||
"south": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
16,
|
||||
16
|
||||
],
|
||||
"texture": "#radar_face"
|
||||
},
|
||||
"east": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
2.0,
|
||||
16
|
||||
],
|
||||
"texture": "#radar_face"
|
||||
},
|
||||
"west": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
2.0,
|
||||
16
|
||||
],
|
||||
"texture": "#radar_face"
|
||||
},
|
||||
"up": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
16,
|
||||
2.0
|
||||
],
|
||||
"texture": "#radar_face"
|
||||
},
|
||||
"down": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
16,
|
||||
2.0
|
||||
],
|
||||
"texture": "#radar_face"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [
|
||||
-16.0,
|
||||
0.0,
|
||||
7.0
|
||||
],
|
||||
"to": [
|
||||
-6.0,
|
||||
30.0,
|
||||
9.0
|
||||
],
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
10.0,
|
||||
16
|
||||
],
|
||||
"texture": "#radar_face"
|
||||
},
|
||||
"south": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
10.0,
|
||||
16
|
||||
],
|
||||
"texture": "#radar_face"
|
||||
},
|
||||
"east": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
2.0,
|
||||
16
|
||||
],
|
||||
"texture": "#radar_face"
|
||||
},
|
||||
"west": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
2.0,
|
||||
16
|
||||
],
|
||||
"texture": "#radar_face"
|
||||
},
|
||||
"up": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
10.0,
|
||||
2.0
|
||||
],
|
||||
"texture": "#radar_face"
|
||||
},
|
||||
"down": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
10.0,
|
||||
2.0
|
||||
],
|
||||
"texture": "#radar_face"
|
||||
}
|
||||
},
|
||||
"rotation": {
|
||||
"angle": -22.5,
|
||||
"axis": "y",
|
||||
"origin": [
|
||||
-11.0,
|
||||
15.0,
|
||||
8.0
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [
|
||||
22.0,
|
||||
0.0,
|
||||
7.0
|
||||
],
|
||||
"to": [
|
||||
32.0,
|
||||
30.0,
|
||||
9.0
|
||||
],
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
10.0,
|
||||
16
|
||||
],
|
||||
"texture": "#radar_face"
|
||||
},
|
||||
"south": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
10.0,
|
||||
16
|
||||
],
|
||||
"texture": "#radar_face"
|
||||
},
|
||||
"east": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
2.0,
|
||||
16
|
||||
],
|
||||
"texture": "#radar_face"
|
||||
},
|
||||
"west": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
2.0,
|
||||
16
|
||||
],
|
||||
"texture": "#radar_face"
|
||||
},
|
||||
"up": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
10.0,
|
||||
2.0
|
||||
],
|
||||
"texture": "#radar_face"
|
||||
},
|
||||
"down": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
10.0,
|
||||
2.0
|
||||
],
|
||||
"texture": "#radar_face"
|
||||
}
|
||||
},
|
||||
"rotation": {
|
||||
"angle": 22.5,
|
||||
"axis": "y",
|
||||
"origin": [
|
||||
27.0,
|
||||
15.0,
|
||||
8.0
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [
|
||||
-6.5,
|
||||
-0.5,
|
||||
9.0
|
||||
],
|
||||
"to": [
|
||||
22.5,
|
||||
30.5,
|
||||
10.0
|
||||
],
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
16,
|
||||
16
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
},
|
||||
"south": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
16,
|
||||
16
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
},
|
||||
"east": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
1.0,
|
||||
16
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
},
|
||||
"west": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
1.0,
|
||||
16
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
},
|
||||
"up": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
16,
|
||||
1.0
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
},
|
||||
"down": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
16,
|
||||
1.0
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [
|
||||
-6.0,
|
||||
30.0,
|
||||
6.0
|
||||
],
|
||||
"to": [
|
||||
22.0,
|
||||
32.0,
|
||||
10.0
|
||||
],
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
16,
|
||||
2.0
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
},
|
||||
"south": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
16,
|
||||
2.0
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
},
|
||||
"east": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
4.0,
|
||||
2.0
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
},
|
||||
"west": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
4.0,
|
||||
2.0
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
},
|
||||
"up": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
16,
|
||||
4.0
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
},
|
||||
"down": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
16,
|
||||
4.0
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [
|
||||
-10.0,
|
||||
13.0,
|
||||
9.0
|
||||
],
|
||||
"to": [
|
||||
-6.0,
|
||||
17.0,
|
||||
13.0
|
||||
],
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
4.0,
|
||||
4.0
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
},
|
||||
"south": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
4.0,
|
||||
4.0
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
},
|
||||
"east": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
4.0,
|
||||
4.0
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
},
|
||||
"west": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
4.0,
|
||||
4.0
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
},
|
||||
"up": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
4.0,
|
||||
4.0
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
},
|
||||
"down": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
4.0,
|
||||
4.0
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [
|
||||
22.0,
|
||||
13.0,
|
||||
9.0
|
||||
],
|
||||
"to": [
|
||||
26.0,
|
||||
17.0,
|
||||
13.0
|
||||
],
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
4.0,
|
||||
4.0
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
},
|
||||
"south": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
4.0,
|
||||
4.0
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
},
|
||||
"east": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
4.0,
|
||||
4.0
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
},
|
||||
"west": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
4.0,
|
||||
4.0
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
},
|
||||
"up": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
4.0,
|
||||
4.0
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
},
|
||||
"down": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
4.0,
|
||||
4.0
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [
|
||||
4.0,
|
||||
-4.0,
|
||||
4.0
|
||||
],
|
||||
"to": [
|
||||
12.0,
|
||||
2.0,
|
||||
12.0
|
||||
],
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
8.0,
|
||||
6.0
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
},
|
||||
"south": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
8.0,
|
||||
6.0
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
},
|
||||
"east": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
8.0,
|
||||
6.0
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
},
|
||||
"west": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
8.0,
|
||||
6.0
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
},
|
||||
"up": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
8.0,
|
||||
8.0
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
},
|
||||
"down": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
8.0,
|
||||
8.0
|
||||
],
|
||||
"texture": "#dark_metal"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [
|
||||
6.5,
|
||||
-10.0,
|
||||
6.5
|
||||
],
|
||||
"to": [
|
||||
9.5,
|
||||
-4.0,
|
||||
9.5
|
||||
],
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
3.0,
|
||||
6.0
|
||||
],
|
||||
"texture": "#metal"
|
||||
},
|
||||
"south": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
3.0,
|
||||
6.0
|
||||
],
|
||||
"texture": "#metal"
|
||||
},
|
||||
"east": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
3.0,
|
||||
6.0
|
||||
],
|
||||
"texture": "#metal"
|
||||
},
|
||||
"west": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
3.0,
|
||||
6.0
|
||||
],
|
||||
"texture": "#metal"
|
||||
},
|
||||
"up": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
3.0,
|
||||
3.0
|
||||
],
|
||||
"texture": "#metal"
|
||||
},
|
||||
"down": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
3.0,
|
||||
3.0
|
||||
],
|
||||
"texture": "#metal"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,798 +0,0 @@
|
||||
{
|
||||
"ambientocclusion": false,
|
||||
"textures": {
|
||||
"ru_khaki_s21_b": "airdef:block/ru_khaki_s21_b",
|
||||
"ru_khaki_s22_b": "airdef:block/ru_khaki_s22_b",
|
||||
"dark_metal_b": "airdef:block/dark_metal_b",
|
||||
"ru_khaki_b": "airdef:block/ru_khaki_b",
|
||||
"tire_b": "airdef:block/tire_b",
|
||||
"hub_b": "airdef:block/hub_b",
|
||||
"particle": "airdef:block/ru_khaki_s21_b"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"from": [
|
||||
-6.0,
|
||||
5.0,
|
||||
-12.0
|
||||
],
|
||||
"to": [
|
||||
22.0,
|
||||
10.0,
|
||||
26.0
|
||||
],
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
16,
|
||||
5.0
|
||||
],
|
||||
"texture": "#ru_khaki_s21_b"
|
||||
},
|
||||
"south": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
16,
|
||||
5.0
|
||||
],
|
||||
"texture": "#ru_khaki_s21_b"
|
||||
},
|
||||
"east": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
16,
|
||||
5.0
|
||||
],
|
||||
"texture": "#ru_khaki_s21_b"
|
||||
},
|
||||
"west": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
16,
|
||||
5.0
|
||||
],
|
||||
"texture": "#ru_khaki_s21_b"
|
||||
},
|
||||
"up": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
16,
|
||||
16
|
||||
],
|
||||
"texture": "#ru_khaki_s22_b"
|
||||
},
|
||||
"down": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
16,
|
||||
16
|
||||
],
|
||||
"texture": "#ru_khaki_s22_b"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [
|
||||
2.0,
|
||||
10.0,
|
||||
2.0
|
||||
],
|
||||
"to": [
|
||||
14.0,
|
||||
16.0,
|
||||
14.0
|
||||
],
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
12.0,
|
||||
6.0
|
||||
],
|
||||
"texture": "#dark_metal_b"
|
||||
},
|
||||
"south": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
12.0,
|
||||
6.0
|
||||
],
|
||||
"texture": "#dark_metal_b"
|
||||
},
|
||||
"east": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
12.0,
|
||||
6.0
|
||||
],
|
||||
"texture": "#dark_metal_b"
|
||||
},
|
||||
"west": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
12.0,
|
||||
6.0
|
||||
],
|
||||
"texture": "#dark_metal_b"
|
||||
},
|
||||
"up": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
12.0,
|
||||
12.0
|
||||
],
|
||||
"texture": "#dark_metal_b"
|
||||
},
|
||||
"down": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
12.0,
|
||||
12.0
|
||||
],
|
||||
"texture": "#dark_metal_b"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [
|
||||
-5.0,
|
||||
10.0,
|
||||
16.0
|
||||
],
|
||||
"to": [
|
||||
21.0,
|
||||
18.0,
|
||||
26.0
|
||||
],
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
16,
|
||||
8.0
|
||||
],
|
||||
"texture": "#ru_khaki_s21_b"
|
||||
},
|
||||
"south": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
16,
|
||||
8.0
|
||||
],
|
||||
"texture": "#ru_khaki_s21_b"
|
||||
},
|
||||
"east": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
10.0,
|
||||
8.0
|
||||
],
|
||||
"texture": "#ru_khaki_b"
|
||||
},
|
||||
"west": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
10.0,
|
||||
8.0
|
||||
],
|
||||
"texture": "#ru_khaki_b"
|
||||
},
|
||||
"up": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
16,
|
||||
10.0
|
||||
],
|
||||
"texture": "#ru_khaki_s21_b"
|
||||
},
|
||||
"down": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
16,
|
||||
10.0
|
||||
],
|
||||
"texture": "#ru_khaki_s21_b"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [
|
||||
-9.0,
|
||||
0.3424499999999995,
|
||||
-9.65755
|
||||
],
|
||||
"to": [
|
||||
-5.5,
|
||||
8.65755,
|
||||
-1.3424499999999995
|
||||
],
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
3.5,
|
||||
8.315100000000001
|
||||
],
|
||||
"texture": "#tire_b"
|
||||
},
|
||||
"south": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
3.5,
|
||||
8.315100000000001
|
||||
],
|
||||
"texture": "#tire_b"
|
||||
},
|
||||
"east": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
8.315100000000001,
|
||||
8.315100000000001
|
||||
],
|
||||
"texture": "#hub_b"
|
||||
},
|
||||
"west": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
8.315100000000001,
|
||||
8.315100000000001
|
||||
],
|
||||
"texture": "#hub_b"
|
||||
},
|
||||
"up": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
3.5,
|
||||
8.315100000000001
|
||||
],
|
||||
"texture": "#tire_b"
|
||||
},
|
||||
"down": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
3.5,
|
||||
8.315100000000001
|
||||
],
|
||||
"texture": "#tire_b"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [
|
||||
21.5,
|
||||
0.3424499999999995,
|
||||
-9.65755
|
||||
],
|
||||
"to": [
|
||||
25.0,
|
||||
8.65755,
|
||||
-1.3424499999999995
|
||||
],
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
3.5,
|
||||
8.315100000000001
|
||||
],
|
||||
"texture": "#tire_b"
|
||||
},
|
||||
"south": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
3.5,
|
||||
8.315100000000001
|
||||
],
|
||||
"texture": "#tire_b"
|
||||
},
|
||||
"east": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
8.315100000000001,
|
||||
8.315100000000001
|
||||
],
|
||||
"texture": "#hub_b"
|
||||
},
|
||||
"west": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
8.315100000000001,
|
||||
8.315100000000001
|
||||
],
|
||||
"texture": "#hub_b"
|
||||
},
|
||||
"up": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
3.5,
|
||||
8.315100000000001
|
||||
],
|
||||
"texture": "#tire_b"
|
||||
},
|
||||
"down": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
3.5,
|
||||
8.315100000000001
|
||||
],
|
||||
"texture": "#tire_b"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [
|
||||
-8.97,
|
||||
0.3424499999999995,
|
||||
-9.65755
|
||||
],
|
||||
"to": [
|
||||
-5.53,
|
||||
8.65755,
|
||||
-1.3424499999999995
|
||||
],
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
3.4400000000000004,
|
||||
8.315100000000001
|
||||
],
|
||||
"texture": "#tire_b"
|
||||
},
|
||||
"south": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
3.4400000000000004,
|
||||
8.315100000000001
|
||||
],
|
||||
"texture": "#tire_b"
|
||||
},
|
||||
"east": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
8.315100000000001,
|
||||
8.315100000000001
|
||||
],
|
||||
"texture": "#hub_b"
|
||||
},
|
||||
"west": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
8.315100000000001,
|
||||
8.315100000000001
|
||||
],
|
||||
"texture": "#hub_b"
|
||||
},
|
||||
"up": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
3.4400000000000004,
|
||||
8.315100000000001
|
||||
],
|
||||
"texture": "#tire_b"
|
||||
},
|
||||
"down": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
3.4400000000000004,
|
||||
8.315100000000001
|
||||
],
|
||||
"texture": "#tire_b"
|
||||
}
|
||||
},
|
||||
"rotation": {
|
||||
"angle": 45,
|
||||
"axis": "x",
|
||||
"origin": [
|
||||
-7.25,
|
||||
4.5,
|
||||
-5.5
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [
|
||||
21.53,
|
||||
0.3424499999999995,
|
||||
-9.65755
|
||||
],
|
||||
"to": [
|
||||
24.97,
|
||||
8.65755,
|
||||
-1.3424499999999995
|
||||
],
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
3.4399999999999977,
|
||||
8.315100000000001
|
||||
],
|
||||
"texture": "#tire_b"
|
||||
},
|
||||
"south": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
3.4399999999999977,
|
||||
8.315100000000001
|
||||
],
|
||||
"texture": "#tire_b"
|
||||
},
|
||||
"east": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
8.315100000000001,
|
||||
8.315100000000001
|
||||
],
|
||||
"texture": "#hub_b"
|
||||
},
|
||||
"west": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
8.315100000000001,
|
||||
8.315100000000001
|
||||
],
|
||||
"texture": "#hub_b"
|
||||
},
|
||||
"up": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
3.4399999999999977,
|
||||
8.315100000000001
|
||||
],
|
||||
"texture": "#tire_b"
|
||||
},
|
||||
"down": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
3.4399999999999977,
|
||||
8.315100000000001
|
||||
],
|
||||
"texture": "#tire_b"
|
||||
}
|
||||
},
|
||||
"rotation": {
|
||||
"angle": 45,
|
||||
"axis": "x",
|
||||
"origin": [
|
||||
23.25,
|
||||
4.5,
|
||||
-5.5
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [
|
||||
-9.0,
|
||||
0.3424499999999995,
|
||||
16.34245
|
||||
],
|
||||
"to": [
|
||||
-5.5,
|
||||
8.65755,
|
||||
24.65755
|
||||
],
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
3.5,
|
||||
8.315100000000001
|
||||
],
|
||||
"texture": "#tire_b"
|
||||
},
|
||||
"south": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
3.5,
|
||||
8.315100000000001
|
||||
],
|
||||
"texture": "#tire_b"
|
||||
},
|
||||
"east": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
8.315100000000001,
|
||||
8.315100000000001
|
||||
],
|
||||
"texture": "#hub_b"
|
||||
},
|
||||
"west": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
8.315100000000001,
|
||||
8.315100000000001
|
||||
],
|
||||
"texture": "#hub_b"
|
||||
},
|
||||
"up": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
3.5,
|
||||
8.315100000000001
|
||||
],
|
||||
"texture": "#tire_b"
|
||||
},
|
||||
"down": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
3.5,
|
||||
8.315100000000001
|
||||
],
|
||||
"texture": "#tire_b"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [
|
||||
21.5,
|
||||
0.3424499999999995,
|
||||
16.34245
|
||||
],
|
||||
"to": [
|
||||
25.0,
|
||||
8.65755,
|
||||
24.65755
|
||||
],
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
3.5,
|
||||
8.315100000000001
|
||||
],
|
||||
"texture": "#tire_b"
|
||||
},
|
||||
"south": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
3.5,
|
||||
8.315100000000001
|
||||
],
|
||||
"texture": "#tire_b"
|
||||
},
|
||||
"east": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
8.315100000000001,
|
||||
8.315100000000001
|
||||
],
|
||||
"texture": "#hub_b"
|
||||
},
|
||||
"west": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
8.315100000000001,
|
||||
8.315100000000001
|
||||
],
|
||||
"texture": "#hub_b"
|
||||
},
|
||||
"up": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
3.5,
|
||||
8.315100000000001
|
||||
],
|
||||
"texture": "#tire_b"
|
||||
},
|
||||
"down": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
3.5,
|
||||
8.315100000000001
|
||||
],
|
||||
"texture": "#tire_b"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [
|
||||
-8.97,
|
||||
0.3424499999999995,
|
||||
16.34245
|
||||
],
|
||||
"to": [
|
||||
-5.53,
|
||||
8.65755,
|
||||
24.65755
|
||||
],
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
3.4400000000000004,
|
||||
8.315100000000001
|
||||
],
|
||||
"texture": "#tire_b"
|
||||
},
|
||||
"south": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
3.4400000000000004,
|
||||
8.315100000000001
|
||||
],
|
||||
"texture": "#tire_b"
|
||||
},
|
||||
"east": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
8.315100000000001,
|
||||
8.315100000000001
|
||||
],
|
||||
"texture": "#hub_b"
|
||||
},
|
||||
"west": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
8.315100000000001,
|
||||
8.315100000000001
|
||||
],
|
||||
"texture": "#hub_b"
|
||||
},
|
||||
"up": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
3.4400000000000004,
|
||||
8.315100000000001
|
||||
],
|
||||
"texture": "#tire_b"
|
||||
},
|
||||
"down": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
3.4400000000000004,
|
||||
8.315100000000001
|
||||
],
|
||||
"texture": "#tire_b"
|
||||
}
|
||||
},
|
||||
"rotation": {
|
||||
"angle": 45,
|
||||
"axis": "x",
|
||||
"origin": [
|
||||
-7.25,
|
||||
4.5,
|
||||
20.5
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [
|
||||
21.53,
|
||||
0.3424499999999995,
|
||||
16.34245
|
||||
],
|
||||
"to": [
|
||||
24.97,
|
||||
8.65755,
|
||||
24.65755
|
||||
],
|
||||
"faces": {
|
||||
"north": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
3.4399999999999977,
|
||||
8.315100000000001
|
||||
],
|
||||
"texture": "#tire_b"
|
||||
},
|
||||
"south": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
3.4399999999999977,
|
||||
8.315100000000001
|
||||
],
|
||||
"texture": "#tire_b"
|
||||
},
|
||||
"east": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
8.315100000000001,
|
||||
8.315100000000001
|
||||
],
|
||||
"texture": "#hub_b"
|
||||
},
|
||||
"west": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
8.315100000000001,
|
||||
8.315100000000001
|
||||
],
|
||||
"texture": "#hub_b"
|
||||
},
|
||||
"up": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
3.4399999999999977,
|
||||
8.315100000000001
|
||||
],
|
||||
"texture": "#tire_b"
|
||||
},
|
||||
"down": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
3.4399999999999977,
|
||||
8.315100000000001
|
||||
],
|
||||
"texture": "#tire_b"
|
||||
}
|
||||
},
|
||||
"rotation": {
|
||||
"angle": 45,
|
||||
"axis": "x",
|
||||
"origin": [
|
||||
23.25,
|
||||
4.5,
|
||||
20.5
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"parent": "minecraft:item/generated",
|
||||
"textures": {
|
||||
"layer0": "airdef:item/deploy_radar"
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"parent": "minecraft:item/generated",
|
||||
"textures": {
|
||||
"layer0": "airdef:item/deploy_radar"
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"parent": "minecraft:item/generated",
|
||||
"textures": {
|
||||
"layer0": "airdef:item/deploy_radar"
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"parent": "minecraft:item/generated",
|
||||
"textures": {
|
||||
"layer0": "airdef:item/deploy_radar"
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,65 +0,0 @@
|
||||
use horizon_assets::{
|
||||
bake::{BlockModelTransform, bake_block_model},
|
||||
model::CuboidModel,
|
||||
resolve::ModelLibrary,
|
||||
};
|
||||
use std::{collections::BTreeMap, env, fmt::Write, fs, path::PathBuf};
|
||||
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let models = PathBuf::from("assets/airdef/models/block");
|
||||
println!("cargo:rerun-if-changed={}", models.display());
|
||||
let output = PathBuf::from(env::var_os("OUT_DIR").expect("Cargo sets OUT_DIR"));
|
||||
let mut decoded = BTreeMap::new();
|
||||
for entry in fs::read_dir(models)? {
|
||||
let path = entry?.path();
|
||||
if path.extension().is_some_and(|ext| ext == "json") {
|
||||
let name = path
|
||||
.file_stem()
|
||||
.and_then(|s| s.to_str())
|
||||
.expect("UTF-8 model name");
|
||||
let model = CuboidModel::from_json(&fs::read_to_string(&path)?)
|
||||
.unwrap_or_else(|e| panic!("{}: {e}", path.display()));
|
||||
decoded.insert(format!("airdef:block/{name}"), model);
|
||||
}
|
||||
}
|
||||
|
||||
// Use the same cuboid baker as the client so element rotations, omitted faces and
|
||||
// model coordinates match. Include only positions, with offsets for the local AABBs.
|
||||
let names: Vec<_> = decoded.keys().cloned().collect();
|
||||
let library = ModelLibrary::new(decoded)?;
|
||||
let transform = BlockModelTransform::new([0; 3], false);
|
||||
let mut bytes = Vec::new();
|
||||
let mut table = String::from("&[\n");
|
||||
for name in names {
|
||||
let model = library.resolve(&name)?;
|
||||
let faces = bake_block_model(&model, transform)?;
|
||||
if faces.is_empty() {
|
||||
continue;
|
||||
}
|
||||
let start = bytes.len();
|
||||
let mut min = [f32::INFINITY; 3];
|
||||
let mut max = [f32::NEG_INFINITY; 3];
|
||||
for face in faces {
|
||||
for position in face.positions {
|
||||
for (i, coordinate) in position.into_iter().enumerate() {
|
||||
let centred = coordinate - 0.5;
|
||||
min[i] = min[i].min(centred);
|
||||
max[i] = max[i].max(centred);
|
||||
bytes.extend_from_slice(¢red.to_le_bytes());
|
||||
}
|
||||
}
|
||||
}
|
||||
let id = name.replace(":block/", ":");
|
||||
let extent = std::array::from_fn::<_, 3, _>(|i| min[i].abs().max(max[i].abs()));
|
||||
let radius = extent.iter().map(|value| value * value).sum::<f32>().sqrt();
|
||||
writeln!(
|
||||
table,
|
||||
" ({id:?}, Mesh {{ min: {min:?}, max: {max:?}, radius: {radius:?}, start: {start}, end: {} }}),",
|
||||
bytes.len()
|
||||
)?;
|
||||
}
|
||||
table.push_str("]\n");
|
||||
fs::write(output.join("inspect-meshes.rs"), table)?;
|
||||
fs::write(output.join("inspect-faces.bin"), bytes)?;
|
||||
Ok(())
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"template": "minecraft:stone",
|
||||
"item": false
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"template": "minecraft:stone",
|
||||
"item": false
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"template": "minecraft:stone",
|
||||
"item": false
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"template": "minecraft:stone",
|
||||
"item": false
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"template": "minecraft:stone",
|
||||
"item": false
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"template": "minecraft:stone",
|
||||
"item": false
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"template": "minecraft:stone",
|
||||
"item": false
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"template": "minecraft:stick",
|
||||
"max_stack_size": 1
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"template": "minecraft:stick",
|
||||
"max_stack_size": 1
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"template": "minecraft:stick",
|
||||
"max_stack_size": 1
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"template": "minecraft:stick",
|
||||
"max_stack_size": 1
|
||||
}
|
||||
@@ -1,261 +0,0 @@
|
||||
//! Replay hot-path benchmark (#150): a 10-minute raid with its journals almost full.
|
||||
//!
|
||||
//! Plays the recording the ways a player does — ordinary playback, reverse seeks, a pause and
|
||||
//! an MP4 export (the director's film) — and reports the CPU per frame (p50/p95/p99) and the
|
||||
//! events the by-time readers handed out. Run it with the counters built in:
|
||||
//!
|
||||
//! cargo run --release --example replay_bench --features bench-counters
|
||||
//!
|
||||
//! Without `bench-counters` the scanned-events numbers read 0. Native timings compare runs on
|
||||
//! one machine; they say nothing about the WASM build or the GPU.
|
||||
use airdef::film::{Film, Which};
|
||||
use airdef::replay::{Control, Mode, Player};
|
||||
use airdef::sim::record::{Event, EventKind, Recording, SceneEvent, SceneJournal, SceneKind, StrikeResult, What};
|
||||
use airdef::sim::{DroneKind, Ground, MissileKind, Out, SamKind, Sim};
|
||||
use glam::DVec3;
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
/// The longest recording, ticks (10 minutes at 20 a second).
|
||||
const TICKS: u32 = 12_000;
|
||||
/// The event journal's cap, and the scene journal's (`MAX_SCENE_EVENTS`), nearly reached.
|
||||
const EVENTS: usize = 64_000;
|
||||
const SCENE: usize = 65_000;
|
||||
/// Frames measured per mode (20 a second, half a minute of playback; a film frame is 0.05 s).
|
||||
const FRAMES: usize = 600;
|
||||
const LISTENER: DVec3 = DVec3::new(0.0, 70.0, 0.0);
|
||||
|
||||
/// A 10-minute raid's recording: 200 flights, a nearly full event journal and scene journal,
|
||||
/// the objects, systems, tracks and the fires — the journal a busy raid leaves.
|
||||
fn recording() -> Recording {
|
||||
let mut rec = Recording::blank(TICKS);
|
||||
rec.number = 1;
|
||||
rec.len = TICKS;
|
||||
rec.origin = DVec3::ZERO;
|
||||
rec.sams = (0..8).map(|i| (10 + i, SamKind::S400, DVec3::new(i as f64 * 120.0, 64.0, 400.0))).collect();
|
||||
rec.objects = (0..8).map(|i| DVec3::new(i as f64 * 90.0, 70.0, 0.0)).collect();
|
||||
// 200 flights, each a few hundred ticks of the raid (a point every 2 ticks): the map and
|
||||
// the ghosts draw them, the sounds read their launches.
|
||||
for k in 0..200u32 {
|
||||
let first = k * 55 % (TICKS - 700);
|
||||
let last = first + 600;
|
||||
let what = match k % 4 {
|
||||
0 => What::Drone(DroneKind::Geran3),
|
||||
1 => What::Drone(DroneKind::Shahed),
|
||||
2 => What::Missile(MissileKind::M48n6, 10 + k % 8),
|
||||
_ => What::Strike,
|
||||
};
|
||||
rec.straight(1000 + k, what, first, last, DVec3::new(-2000.0, 100.0, k as f64 * 5.0), DVec3::new(500.0, 70.0, k as f64 * 5.0));
|
||||
}
|
||||
// The events: interceptions, hits, losses and splits spread through the raid.
|
||||
rec.events = (0..EVENTS)
|
||||
.map(|i| {
|
||||
let at = (i as u64 * u64::from(TICKS) / EVENTS as u64) as u32;
|
||||
let drone = 1000 + (i as u32 * 7 % 200);
|
||||
let pos = DVec3::new((i % 40) as f64 * 10.0, 95.0, (i % 17) as f64 * 12.0);
|
||||
let kind = match i % 10 {
|
||||
0 | 1 => EventKind::Kill { drone, kind: DroneKind::Geran3, sam: 10, sam_kind: SamKind::S400, sam_index: 0, missile: None, outcome: Default::default() },
|
||||
2 | 3 => EventKind::Hit { drone, kind: DroneKind::Geran3, power: (i % 5) as u32, object: Some(i % 8), sam: None },
|
||||
4 | 5 => EventKind::Crash { drone, kind: DroneKind::Geran3, power: (i % 5) as u32 },
|
||||
6 => EventKind::SamLost { sam: 10 + (i % 8) as u32, kind: SamKind::S400, index: i % 8 },
|
||||
7 => EventKind::Split { drone },
|
||||
_ => EventKind::Strike { site: 1, result: StrikeResult::Destroyed },
|
||||
};
|
||||
Event { at, pos, kind }
|
||||
})
|
||||
.collect();
|
||||
// The scene journal: launches and ignitions (the exact sounds), track changes and fires.
|
||||
let mut scene = SceneJournal::default();
|
||||
for i in 0..SCENE {
|
||||
let at = (i as u64 * u64::from(TICKS) / SCENE as u64) as u32;
|
||||
let missile = 5000 + (i as u32 % 300);
|
||||
let pos = DVec3::new((i % 30) as f64 * 8.0, 66.0, 300.0);
|
||||
let kind = match i % 100 {
|
||||
// Fires are a small share of a raid's transitions (hundreds over ten minutes).
|
||||
0 => SceneKind::FireStarted { fire: (i / 100) as u32, age: 0, life: 4000, size: 1.0, quiet: false, shown: true, water: Some(false) },
|
||||
1 => SceneKind::FireEnded { fire: (i / 100) as u32 },
|
||||
2 | 3 => SceneKind::MissileLaunch { missile, sam: 10, target: 2000, kind: MissileKind::M48n6, sound: "airdef:launch.s400", pitch: 1.0 },
|
||||
4 | 5 => SceneKind::MotorIgnition { missile, kind: MissileKind::M48n6, sound: Some("airdef:launch.s400") },
|
||||
6 => SceneKind::MotorBurnout { missile, kind: MissileKind::M48n6 },
|
||||
7 => SceneKind::MotorEnergyLost { missile, kind: MissileKind::M48n6, speed: 4.0 },
|
||||
8 | 9 => SceneKind::TrackAcquired { sam: 10, target: 2000 + (i as u32 % 200), ever_own: true },
|
||||
_ => SceneKind::TrackLost { sam: 10, target: 2000 + (i as u32 % 200) },
|
||||
};
|
||||
scene.fixture_push(SceneEvent { at, pos, kind });
|
||||
}
|
||||
rec.scene = Some(scene);
|
||||
rec.close();
|
||||
rec
|
||||
}
|
||||
|
||||
/// Answers the ground queries the replays make with a flat 70-block land, as the game would.
|
||||
fn settle(ground: &mut Ground, now: u64) {
|
||||
let wanted = ground.take_wanted();
|
||||
if !wanted.is_empty() {
|
||||
ground.answer(wanted.into_iter().map(|(x, z)| (x, z, 70)).collect(), now);
|
||||
}
|
||||
}
|
||||
|
||||
fn percentile(sorted: &[Duration], p: f64) -> f64 {
|
||||
if sorted.is_empty() {
|
||||
return 0.0;
|
||||
}
|
||||
let i = (((sorted.len() - 1) as f64) * p).round() as usize;
|
||||
sorted[i].as_secs_f64() * 1e6
|
||||
}
|
||||
|
||||
struct Measured {
|
||||
mode: &'static str,
|
||||
frames: usize,
|
||||
scanned: u64,
|
||||
cpu: Vec<Duration>,
|
||||
}
|
||||
|
||||
impl Measured {
|
||||
fn cpu_p(&self, p: f64) -> f64 {
|
||||
let mut sorted = self.cpu.clone();
|
||||
sorted.sort_unstable();
|
||||
percentile(&sorted, p)
|
||||
}
|
||||
fn json(&self, rec: &Recording, sim: &Sim) -> String {
|
||||
let events_bytes = rec.events.capacity() * std::mem::size_of::<Event>();
|
||||
let scene_events = rec.scene.as_ref().map_or(0, |s| s.events().len());
|
||||
let scene_bytes = scene_events * std::mem::size_of::<SceneEvent>();
|
||||
let index_bytes: usize = sim.replays.iter().map(Recording::index_bytes).sum();
|
||||
format!(
|
||||
"{{\"mode\":\"{}\",\"frames\":{},\"journal_events\":{},\"journal_scene\":{},\
|
||||
\"scanned_events\":{},\"scanned_per_frame\":{:.1},\"full_pass_events\":{},\
|
||||
\"p50_us\":{:.1},\"p95_us\":{:.1},\"p99_us\":{:.1},\"max_us\":{:.1},\
|
||||
\"events_bytes\":{},\"scene_bytes\":{},\"index_bytes\":{}}}",
|
||||
self.mode,
|
||||
self.frames,
|
||||
rec.events.len(),
|
||||
scene_events,
|
||||
self.scanned,
|
||||
self.scanned as f64 / self.frames.max(1) as f64,
|
||||
// One whole-journal pass per frame: what the readers did before the ranges (#150).
|
||||
(rec.events.len() + scene_events) as u64 * self.frames as u64,
|
||||
self.cpu_p(0.50),
|
||||
self.cpu_p(0.95),
|
||||
self.cpu_p(0.99),
|
||||
self.cpu.iter().copied().max().unwrap_or_default().as_secs_f64() * 1e6,
|
||||
events_bytes,
|
||||
scene_bytes,
|
||||
index_bytes,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/// Steps the replay's clock to `t` the way the wheel does (5 s a press), so the seek resets the
|
||||
/// sound cursor and the shot as a player's would.
|
||||
fn seek_to(p: &mut Player, rec: &Recording, t: f64) {
|
||||
for _ in 0..((t.max(0.0) / 100.0) as usize) {
|
||||
p.control(Control::Forward, rec);
|
||||
}
|
||||
}
|
||||
|
||||
fn sim_with(rec: Recording) -> (Sim, u64) {
|
||||
let mut sim = Sim::new(1);
|
||||
sim.replays.push(rec);
|
||||
(sim, 1)
|
||||
}
|
||||
|
||||
/// Ordinary playback from a moment near the end of the raid, time running at ×2.
|
||||
fn playback() -> Measured {
|
||||
let (sim, mut tick) = sim_with(recording());
|
||||
let rec = &sim.replays[0];
|
||||
let mut p = Player::new(1, Mode::Full, &sim);
|
||||
seek_to(&mut p, rec, rec.len as f64 - 1_200.0);
|
||||
let mut ground = Ground::default();
|
||||
let mut out = Out::default();
|
||||
let _ = airdef::sim::record::scanned_events();
|
||||
let mut cpu = Vec::with_capacity(FRAMES);
|
||||
for _ in 0..FRAMES {
|
||||
let started = Instant::now();
|
||||
p.tick(&sim, &mut ground, LISTENER, &mut out);
|
||||
settle(&mut ground, tick);
|
||||
tick += 1;
|
||||
cpu.push(started.elapsed());
|
||||
out = Out::default();
|
||||
}
|
||||
Measured { mode: "playback", frames: FRAMES, scanned: airdef::sim::record::scanned_events(), cpu }
|
||||
}
|
||||
|
||||
/// Reverse seeks: five seconds back every frame, then a frame of playback.
|
||||
fn reverse_seek() -> Measured {
|
||||
let (sim, mut tick) = sim_with(recording());
|
||||
let rec = &sim.replays[0];
|
||||
let mut p = Player::new(1, Mode::Full, &sim);
|
||||
seek_to(&mut p, rec, rec.len as f64 - 200.0);
|
||||
let mut ground = Ground::default();
|
||||
let mut out = Out::default();
|
||||
let _ = airdef::sim::record::scanned_events();
|
||||
let mut cpu = Vec::with_capacity(FRAMES);
|
||||
for _ in 0..FRAMES {
|
||||
let started = Instant::now();
|
||||
p.control(Control::Back, rec);
|
||||
p.tick(&sim, &mut ground, LISTENER, &mut out);
|
||||
settle(&mut ground, tick);
|
||||
tick += 1;
|
||||
cpu.push(started.elapsed());
|
||||
out = Out::default();
|
||||
}
|
||||
Measured { mode: "reverse_seek", frames: FRAMES, scanned: airdef::sim::record::scanned_events(), cpu }
|
||||
}
|
||||
|
||||
/// A pause held while frames keep coming (the HUD and the ghosts stay, nothing sounds).
|
||||
fn paused() -> Measured {
|
||||
let (sim, mut tick) = sim_with(recording());
|
||||
let rec = &sim.replays[0];
|
||||
let mut p = Player::new(1, Mode::Full, &sim);
|
||||
seek_to(&mut p, rec, rec.len as f64 * 0.75);
|
||||
p.control(Control::Pause, rec);
|
||||
let mut ground = Ground::default();
|
||||
let mut out = Out::default();
|
||||
let _ = airdef::sim::record::scanned_events();
|
||||
let mut cpu = Vec::with_capacity(FRAMES);
|
||||
for _ in 0..FRAMES {
|
||||
let started = Instant::now();
|
||||
p.tick(&sim, &mut ground, LISTENER, &mut out);
|
||||
settle(&mut ground, tick);
|
||||
tick += 1;
|
||||
cpu.push(started.elapsed());
|
||||
out = Out::default();
|
||||
}
|
||||
Measured { mode: "pause", frames: FRAMES, scanned: airdef::sim::record::scanned_events(), cpu }
|
||||
}
|
||||
|
||||
/// An MP4 export: the director's film, its frames prepared and drawn as the game records them.
|
||||
fn mp4() -> Measured {
|
||||
let (sim, mut tick) = sim_with(recording());
|
||||
let rec = &sim.replays[0];
|
||||
let film = Film::build(rec, Which::Best).expect("the raid has moments to film");
|
||||
let mut p = Player::new(1, Mode::Film(Box::new(film)), &sim);
|
||||
p.wait = true;
|
||||
p.clean = true;
|
||||
let mut ground = Ground::default();
|
||||
let mut out = Out::default();
|
||||
let _ = airdef::sim::record::scanned_events();
|
||||
let mut cpu = Vec::with_capacity(FRAMES);
|
||||
for _ in 0..FRAMES {
|
||||
let started = Instant::now();
|
||||
p.tick(&sim, &mut ground, LISTENER, &mut out);
|
||||
settle(&mut ground, tick);
|
||||
tick += 1;
|
||||
cpu.push(started.elapsed());
|
||||
out = Out::default();
|
||||
}
|
||||
Measured { mode: "mp4", frames: FRAMES, scanned: airdef::sim::record::scanned_events(), cpu }
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
let (playback, reverse_seek, paused, mp4) = (playback(), reverse_seek(), paused(), mp4());
|
||||
let (sim, _) = sim_with(recording());
|
||||
let rec = &sim.replays[0];
|
||||
if !airdef::sim::record::scan_counters() {
|
||||
eprintln!("replay_bench: scanned events read 0; rerun with --features bench-counters");
|
||||
}
|
||||
let rows = [playback.json(rec, &sim), reverse_seek.json(rec, &sim), paused.json(rec, &sim), mp4.json(rec, &sim)];
|
||||
println!("[");
|
||||
println!("{}", rows.join(",\n"));
|
||||
println!("]");
|
||||
}
|
||||
@@ -72,9 +72,6 @@ pub struct Scenario {
|
||||
pub ew: bool,
|
||||
/// Ticks a truck on a job may stand still before it counts as stuck.
|
||||
pub stuck_after: u64,
|
||||
/// The smart enemy runs the legacy picks (#149's comparison runner): separate hint lists,
|
||||
/// the lifetime bearing tally, no mark pricing and no refresh of the unreleased portion.
|
||||
pub legacy: bool,
|
||||
}
|
||||
|
||||
impl Scenario {
|
||||
@@ -90,7 +87,6 @@ impl Scenario {
|
||||
stop_at_end: true,
|
||||
ew: false,
|
||||
stuck_after: 600,
|
||||
legacy: false,
|
||||
}
|
||||
}
|
||||
pub fn unit(&mut self, kind: SamKind, x: f64, z: f64) -> &mut Unit {
|
||||
@@ -142,18 +138,6 @@ pub struct Report {
|
||||
pub intents: String,
|
||||
/// The most aim switches one drone went through.
|
||||
pub switches_max: u16,
|
||||
/// Smart drones seen over the run (#149's comparison).
|
||||
pub smart_seen: u32,
|
||||
/// The share of them whose last aim was a live public hint when last seen (#149).
|
||||
pub useful_share: f64,
|
||||
/// Distinct aim units over the smart drones seen, per drone (#149).
|
||||
pub diversity: f64,
|
||||
/// The share of smart drones switched twice or more (#149's jitter).
|
||||
pub jittery_share: f64,
|
||||
/// The bearing picker's last typed reason (#149).
|
||||
pub bearing_reason: String,
|
||||
/// Aims the bounded refresh re-chose (#149).
|
||||
pub refresh_applied: u32,
|
||||
}
|
||||
|
||||
/// The last intent every smart drone of the run was seen carrying, as `name:count`.
|
||||
@@ -162,7 +146,7 @@ fn intent_counts(seen: &HashMap<u32, &'static str>) -> String {
|
||||
for name in seen.values() {
|
||||
*counts.entry(*name).or_insert(0usize) += 1;
|
||||
}
|
||||
["plan", "sead", "react", "replace", "refresh"].iter().map(|k| format!("{k}:{}", counts.get(*k).copied().unwrap_or(0))).collect::<Vec<_>>().join(",")
|
||||
["plan", "sead", "react", "replace"].iter().map(|k| format!("{k}:{}", counts.get(*k).copied().unwrap_or(0))).collect::<Vec<_>>().join(",")
|
||||
}
|
||||
|
||||
fn finite(v: DVec3) -> bool {
|
||||
@@ -170,14 +154,7 @@ fn finite(v: DVec3) -> bool {
|
||||
}
|
||||
|
||||
pub fn run(sc: &Scenario) -> Report {
|
||||
run_with_hook(sc, &mut |_, _| {})
|
||||
}
|
||||
|
||||
/// The same, with a hook called after every tick (#149's comparison runner): a scenario may
|
||||
/// change the defence between waves or shoot a recon flight down before its report.
|
||||
pub fn run_with_hook(sc: &Scenario, hook: &mut dyn FnMut(u64, &mut Sim)) -> Report {
|
||||
let mut sim = Sim::new(sc.seed);
|
||||
sim.smart_legacy = sc.legacy;
|
||||
sim.damage = false; // explosions would change the land the height function describes
|
||||
for u in &sc.units {
|
||||
let id = sim.id();
|
||||
@@ -206,8 +183,6 @@ pub fn run_with_hook(sc: &Scenario, hook: &mut dyn FnMut(u64, &mut Sim)) -> Repo
|
||||
let mut standing: HashMap<u32, (DVec3, u64)> = HashMap::new();
|
||||
// drone id -> the last structured intent it carried (#127).
|
||||
let mut intents_seen: HashMap<u32, &'static str> = HashMap::new();
|
||||
// drone id -> (last aim unit, whether the picture held it live then, switches) (#149).
|
||||
let mut decisions: HashMap<u32, (u32, bool, u16)> = HashMap::new();
|
||||
let mut out = Out::default();
|
||||
for now in 1..=sc.ticks {
|
||||
// Raids come in order: one is ordered once the previous one has been sent.
|
||||
@@ -230,7 +205,6 @@ pub fn run_with_hook(sc: &Scenario, hook: &mut dyn FnMut(u64, &mut Sim)) -> Repo
|
||||
ground.world.serve(&sc.terrain, sections, now);
|
||||
let dt = t.elapsed();
|
||||
times.push(dt);
|
||||
hook(now, &mut sim);
|
||||
if planning {
|
||||
r.planning += dt;
|
||||
r.planning_ticks += 1;
|
||||
@@ -246,8 +220,6 @@ pub fn run_with_hook(sc: &Scenario, hook: &mut dyn FnMut(u64, &mut Sim)) -> Repo
|
||||
for d in sim.drones.iter().chain(sim.queue.iter().map(|(_, d)| d)) {
|
||||
if d.alive() && d.smart() {
|
||||
intents_seen.insert(d.id, d.intent().name());
|
||||
let unit = d.aim_unit();
|
||||
decisions.insert(d.id, (unit, unit != 0 && sim.known_live(unit), d.aim_switches()));
|
||||
}
|
||||
}
|
||||
// The air section a save would take, sampled when the sky is fullest (writing it every tick
|
||||
@@ -299,18 +271,6 @@ pub fn run_with_hook(sc: &Scenario, hook: &mut dyn FnMut(u64, &mut Sim)) -> Repo
|
||||
r.raids_ended = ended.iter().filter(|o| **o).count();
|
||||
r.all_ended = r.raids_ended == sc.raids.len();
|
||||
r.intents = intent_counts(&intents_seen);
|
||||
r.smart_seen = decisions.len() as u32;
|
||||
if !decisions.is_empty() {
|
||||
let n = decisions.len() as f64;
|
||||
r.useful_share = decisions.values().filter(|(_, live, _)| *live).count() as f64 / n;
|
||||
let mut units: Vec<u32> = decisions.values().map(|(u, _, _)| *u).collect();
|
||||
units.sort_unstable();
|
||||
units.dedup();
|
||||
r.diversity = units.len() as f64 / n;
|
||||
r.jittery_share = decisions.values().filter(|(_, _, s)| *s >= 2).count() as f64 / n;
|
||||
}
|
||||
r.bearing_reason = sim.bearing_report().reason.name().to_string();
|
||||
r.refresh_applied = sim.refresh_applied();
|
||||
r.tick_total = times.iter().sum();
|
||||
times.sort();
|
||||
if !times.is_empty() {
|
||||
|
||||
@@ -1,187 +0,0 @@
|
||||
//! Smart v2 comparison runner (#149): the simple mode, the current (legacy) Smart and the
|
||||
//! candidate, on fixed seeds and one scenario set — open map, hills, a configuration changed
|
||||
//! between waves, and a recon flight shot down before its report.
|
||||
//!
|
||||
//! It prints one JSON array of rows: the share of useful decisions (a smart drone whose last
|
||||
//! aim was a live public hint), the diversity of aims, the reasons (intents) on the review,
|
||||
//! the share of jittery drones (two switches or more), the bearing picker's typed reason, the
|
||||
//! refresh count, and the CPU/worst-job figures. The goal is interesting counterplay and clear
|
||||
//! mistakes, not a maximised hit count — read the reasons and the jitter beside the losses.
|
||||
//!
|
||||
//! cargo run --release --example smart_bench
|
||||
#[path = "sim_run/harness.rs"]
|
||||
mod harness;
|
||||
|
||||
use airdef::sim::{Aim, Approach, DroneKind, Sam, SamKind, Sim};
|
||||
use glam::DVec3;
|
||||
use harness::{Report, Scenario, Terrain};
|
||||
|
||||
#[derive(Clone, Copy, PartialEq)]
|
||||
enum Mode {
|
||||
Simple,
|
||||
Current,
|
||||
Candidate,
|
||||
}
|
||||
|
||||
impl Mode {
|
||||
fn name(self) -> &'static str {
|
||||
match self {
|
||||
Mode::Simple => "simple",
|
||||
Mode::Current => "current",
|
||||
Mode::Candidate => "candidate",
|
||||
}
|
||||
}
|
||||
fn apply(self, sc: &mut Scenario) {
|
||||
sc.legacy = self == Mode::Current;
|
||||
let aim = match self {
|
||||
Mode::Simple => Aim::ObjectsAndSams,
|
||||
_ => Aim::Smart,
|
||||
};
|
||||
for raid in &mut sc.raids {
|
||||
raid.aim = aim;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn esc(s: &str) -> String {
|
||||
s.chars().flat_map(|c| match c {
|
||||
'"' => "\\\"".chars().collect::<Vec<_>>(),
|
||||
'\\' => "\\\\".chars().collect::<Vec<_>>(),
|
||||
c => vec![c],
|
||||
}).collect()
|
||||
}
|
||||
|
||||
fn row(sc: &str, mode: Mode, r: &Report) -> String {
|
||||
format!(
|
||||
"{{\"scenario\":\"{}\",\"mode\":\"{}\",\"seed\":{},\"ticks\":{},\"all_ended\":{},\"launched\":{},\"kills\":{},\"hits\":{},\"fired\":{},\"sams_lost\":{},\"smart_seen\":{},\"useful_share\":{:.3},\"diversity\":{:.3},\"jittery_share\":{:.3},\"intents\":\"{}\",\"bearing_reason\":\"{}\",\"refresh_applied\":{},\"switches_max\":{},\"retargets_max\":{},\"tick_p95_ms\":{:.3},\"tick_max_ms\":{:.3},\"planning_ms\":{:.1},\"air_bytes\":{}}}",
|
||||
esc(sc),
|
||||
mode.name(),
|
||||
r.seed,
|
||||
r.ticks_run,
|
||||
r.all_ended,
|
||||
r.launched,
|
||||
r.kills,
|
||||
r.hits,
|
||||
r.fired,
|
||||
r.sams_lost,
|
||||
r.smart_seen,
|
||||
r.useful_share,
|
||||
r.diversity,
|
||||
r.jittery_share,
|
||||
esc(&r.intents),
|
||||
esc(&r.bearing_reason),
|
||||
r.refresh_applied,
|
||||
r.switches_max,
|
||||
r.retargets_max,
|
||||
r.tick_p95.as_secs_f64() * 1000.0,
|
||||
r.tick_max.as_secs_f64() * 1000.0,
|
||||
r.planning.as_secs_f64() * 1000.0,
|
||||
r.air_bytes,
|
||||
)
|
||||
}
|
||||
|
||||
/// An open map: a ring of systems on flat land, one combined strike.
|
||||
fn open() -> Scenario {
|
||||
let mut sc = Scenario::new("open");
|
||||
sc.terrain = Terrain::Flat(70);
|
||||
for i in 0..18 {
|
||||
let a = i as f64 * 2.399_963;
|
||||
let r = 120.0 + (i as f64 / 18.0) * 320.0;
|
||||
let kind = [SamKind::Radar, SamKind::S400, SamKind::Pantsir, SamKind::Ew, SamKind::Tor][i % 5];
|
||||
sc.unit(kind, a.sin() * r, a.cos() * r).heading = a;
|
||||
}
|
||||
sc.raids.push(harness::RaidSpec {
|
||||
kinds: vec![(DroneKind::Gerbera, 6), (DroneKind::Shahed, 10), (DroneKind::Kh101, 3), (DroneKind::Kh22, 2), (DroneKind::Lancet, 3)],
|
||||
approach: Approach::AllSides,
|
||||
aim: Aim::Smart,
|
||||
dist: 500.0,
|
||||
at: 1,
|
||||
});
|
||||
sc.ticks = 20 * 60 * 6;
|
||||
sc
|
||||
}
|
||||
|
||||
/// Hills: the standard big smart scenario's terrain and force.
|
||||
fn hills() -> Scenario {
|
||||
let mut sc = harness::big_smart();
|
||||
sc.name = "hills".into();
|
||||
sc.ticks = 20 * 60 * 6;
|
||||
sc
|
||||
}
|
||||
|
||||
/// Two waves with the defence changed between them: a radar moves unobserved, the EW stations
|
||||
/// switch on, and a fresh battery appears. The second wave's picture must earn what it knows.
|
||||
fn config_change() -> Scenario {
|
||||
let mut sc = open();
|
||||
sc.name = "config-change".into();
|
||||
sc.raids.push(harness::RaidSpec {
|
||||
kinds: vec![(DroneKind::Shahed, 8), (DroneKind::Geran3, 4), (DroneKind::Kh22, 2), (DroneKind::Iskander, 2)],
|
||||
approach: Approach::TwoSectors,
|
||||
aim: Aim::Smart,
|
||||
dist: 600.0,
|
||||
at: 4200,
|
||||
});
|
||||
sc.ticks = 20 * 60 * 10;
|
||||
sc
|
||||
}
|
||||
|
||||
/// A recon flight shot down before its report: the strike must fly on the picture it had, and
|
||||
/// the bounded refresh must never hold the raid waiting for a report that will not come.
|
||||
fn recon_lost() -> Scenario {
|
||||
let mut sc = open();
|
||||
sc.name = "recon-lost".into();
|
||||
sc.ticks = 20 * 60 * 6;
|
||||
sc
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
let seeds = [1u64, 7, 42];
|
||||
let scenarios: [(&str, fn() -> Scenario); 4] = [("open", open), ("hills", hills), ("config-change", config_change), ("recon-lost", recon_lost)];
|
||||
let modes = [Mode::Simple, Mode::Current, Mode::Candidate];
|
||||
let mut rows = Vec::new();
|
||||
for (name, make) in scenarios {
|
||||
for mode in modes {
|
||||
for &seed in &seeds {
|
||||
let r = run(mode, name, make, seed);
|
||||
rows.push(row(name, mode, &r));
|
||||
eprintln!("{name} {} seed {seed}: useful {:.2} diversity {:.2} jitter {:.2} kills {} hits {} reasons {} bearing {} refresh {}", mode.name(), r.useful_share, r.diversity, r.jittery_share, r.kills, r.hits, r.intents, r.bearing_reason, r.refresh_applied);
|
||||
}
|
||||
}
|
||||
}
|
||||
println!("[{}]", rows.join(",\n"));
|
||||
}
|
||||
|
||||
fn run(mode: Mode, name: &str, make: fn() -> Scenario, seed: u64) -> Report {
|
||||
let mut sc = make();
|
||||
sc.seed = seed;
|
||||
mode.apply(&mut sc);
|
||||
match name {
|
||||
"config-change" => {
|
||||
let mut changed = false;
|
||||
harness::run_with_hook(&sc, &mut |now, sim: &mut Sim| {
|
||||
if !changed && now >= 3600 && !sim.planning() {
|
||||
changed = true;
|
||||
if let Some(radar) = sim.sams.iter_mut().find(|s| s.kind == SamKind::Radar) {
|
||||
radar.pos += DVec3::new(300.0, 0.0, -200.0);
|
||||
}
|
||||
let id = sim.id();
|
||||
sim.sams.push(Sam::new(id, SamKind::Pantsir, DVec3::new(-200.0, 70.0, 250.0), 0.0));
|
||||
sim.set_ew(true);
|
||||
}
|
||||
})
|
||||
}
|
||||
"recon-lost" => {
|
||||
let mut killed = false;
|
||||
harness::run_with_hook(&sc, &mut |now, sim: &mut Sim| {
|
||||
if !killed && now >= 120 {
|
||||
let recon: Vec<u32> = sim.drones.iter().filter(|d| sim.is_recon_drone(d.id)).map(|d| d.id).collect();
|
||||
if !recon.is_empty() {
|
||||
sim.drones.retain(|d| !recon.contains(&d.id));
|
||||
killed = true;
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
_ => harness::run(&sc),
|
||||
}
|
||||
}
|
||||
@@ -46,9 +46,6 @@ dc55ec1579702d9d48c01e5268dfae7097d0ece87d85b1a469222134f962f4b1 assets/airdef/
|
||||
f05bb84135b39bc469fadbc4f144e0f69d203b1887396a0b20adac59e549c1ed assets/airdef/blockstates/nasams_launcher_burnt.json
|
||||
9fa63fdb0fe84521f00326dad6955af6adb3dea1093f42404e6e07770cd9bcf5 assets/airdef/blockstates/nasams_trailer.json
|
||||
640b83fc5b43f6fce1d13106016e9b14c0150603035a6d9b19ad6f0598511959 assets/airdef/blockstates/nasams_trailer_burnt.json
|
||||
c5a66987d06e5ed3e854d82e8763d91a1f623bb5e2f01ca2dfba8fa9c07f8b93 assets/airdef/blockstates/optical_head.json
|
||||
43eb7af63a5f9af8661cdc9a2ec7975a39f3918246f34a528d6ac7a72ac05246 assets/airdef/blockstates/optical_post.json
|
||||
e20e544e03280bcfa70f9c935f587c11e4435ffd59de29b10258403cab3c1fea assets/airdef/blockstates/optical_post_burnt.json
|
||||
446bd55fb9bacd7828c6a7028595de64e26cc5cbe3ef4280713c3d9f1cdf850e assets/airdef/blockstates/p1sun.json
|
||||
9e2e00e75afb10c38684b1994688ea11bcc2faace46ff551967e1e05ae08ec85 assets/airdef/blockstates/p1sun_launcher.json
|
||||
02f9474f5f459e33096931887b71b515d957b7a1be14ccb81a0bba36af551ec9 assets/airdef/blockstates/p1sun_launcher_burnt.json
|
||||
@@ -66,14 +63,10 @@ c3b0b6f1d9b7da434c95f2794b97b9e2c05c62ccbce9f0884df071e4ec28a468 assets/airdef/
|
||||
3ecae997dc4fe1939848fc60347979c02075396a164b31dec3995a2e907a8447 assets/airdef/blockstates/patriot_trailer.json
|
||||
31fecc6476129990a7d368f6d7cdb954b13e777b28d1396a68168770024112ce assets/airdef/blockstates/patriot_trailer_burnt.json
|
||||
183d0b2ae9c24c94c3d83f2819e1167b5e2d134cc7889e0e3bda12aa784c7baa assets/airdef/blockstates/patriot_truck.json
|
||||
3e7ce4d164ac8b2694bf4716b2b5222f555c2db3660f514d62213466b2266d8f assets/airdef/blockstates/radar_dish.json
|
||||
bc6918e6d76436d10c64397c402a5c8283d2e7dff7653b329aa5155664b0b425 assets/airdef/blockstates/radar_height_head.json
|
||||
421b5be0a4c80e892850f4a77d5ebb386e04153201be63241c7edc11659d03de assets/airdef/blockstates/radar_mast.json
|
||||
fcc6bbe526baf5551923e2a69cdf09f506cdfd96669e1fffbea643401dd2a1de assets/airdef/blockstates/radar_mast_burnt.json
|
||||
37714e19e555cc50a9f195e1a8845a28c9985c27ed38b577c0813f4629b66fcb assets/airdef/blockstates/radar_panel.json
|
||||
a8f3af5c8996779eeab1e115079a4d7fc0dc128571235ece075018de2c94a53b assets/airdef/blockstates/radar_search_array.json
|
||||
95fe14b9d3e30597f5505aa93f31c3357cebea6117596bd9f5a5bc840ab22415 assets/airdef/blockstates/radar_trailer.json
|
||||
15bd34f426c401eb28eefa60aba5797b5edf62373f1505ac5b9d5aaa7cf6086b assets/airdef/blockstates/radar_trailer_burnt.json
|
||||
a95a1b8731d6bedda7d8b352ff3c448ea8be691b0ead01f14acab39234590c45 assets/airdef/blockstates/radar_truck.json
|
||||
332e6f39c40063ca690064e13a1a256ef215fc2bb96985b842d9dda58abee2eb assets/airdef/blockstates/radar_truck_burnt.json
|
||||
67b93302bea867248b6fa0109a4b5af2065e5c857d4a5c7e088bc9849fe624de assets/airdef/blockstates/reentry.json
|
||||
@@ -121,14 +114,10 @@ b50fe5804cbbe10df992ebbc7e095a32ce8b73fc35159fa19889640681e408e9 assets/airdef/
|
||||
0c9c5ee3fc87e2dc6d716bdb0bb5f30d3b265268bfd5083462b4861a8da65f0f assets/airdef/items/deploy_irist.json
|
||||
09e46a6c4b59f66c24060ac627e6a287bf6797c7b1e32a9ec6c9d9662fdc3de3 assets/airdef/items/deploy_light.json
|
||||
6983561b3558aee16662aa83d2d9af760fb6236cc7dbe79ba20802f8a2ff15b9 assets/airdef/items/deploy_nasams.json
|
||||
e39c555ff197ed6c7c8fdfab924b7a609b5d111a905ca599a75a7b1270448fcc assets/airdef/items/deploy_optical.json
|
||||
d8ac6a9258e2fc2e0791bbce18a3a07a72e471fbc72b6be7b5ca545c53f8d633 assets/airdef/items/deploy_p1sun.json
|
||||
e2353c70f6e5053864ab2fdf51df886d72c03e5c34db84fef8f3fff9c84a7ae4 assets/airdef/items/deploy_pantsir.json
|
||||
68dd9b1382b2dd6ad23d0f507a8cfcdcfa18ef5c4203e69c61f6ade9cfbf238e assets/airdef/items/deploy_patriot.json
|
||||
d93b6bf77de4aed1f1955e76353661729f06445788ad7a6654ed6af1a67fc48d assets/airdef/items/deploy_radar.json
|
||||
84306c42dd25300f1cef69c83e3211ccc921fa606046157295a4ca3e3d568a0a assets/airdef/items/deploy_radar_height.json
|
||||
28f6b71116bdc911e70d2382807c86edff40adae44acd256f798360dc60bd572 assets/airdef/items/deploy_radar_search.json
|
||||
0e470cfa2a13383fadb74336c5333449f4079659d9d83596dcfcf2d592521a4c assets/airdef/items/deploy_radar_track.json
|
||||
0b9445f3b54a9e958da0b9bd4243a41d85fc8f12b5c4e56bbc070edb8f1bf618 assets/airdef/items/deploy_s400.json
|
||||
dd7478f447d87dcad42e1a7e6dcb5fae555c832e933a3722022d0e10e2de011e assets/airdef/items/deploy_s500.json
|
||||
14e9a20dcddee5a6262ef624783900576dac2bd16e5079e731cf6115f13c76ec assets/airdef/items/deploy_tor.json
|
||||
@@ -147,8 +136,8 @@ b4d98a938486d49db28c6c7a608ca3b6ab0c9c3eac266ecf12c7dd931cc28f93 assets/airdef/
|
||||
489799dcb5b441e9d4be8bfb3d73a6ebd5fdf2b5ee614b62f38b85bb2fbfad75 assets/airdef/items/launch_zircon.json
|
||||
6b6da5887aa8d9bc987b2c181c243bc2afdd5846a869818f699b59204e559929 assets/airdef/items/mover.json
|
||||
177f7535e4c52ed975d6f737c2b2acb7741b7a928955c8899aced85211443bbf assets/airdef/items/remover.json
|
||||
a73610d97f325b0e735d8bfcdea2e46e3ac1b2f8497fdb4c8cca0ed07e4a7375 assets/airdef/lang/en_us.json
|
||||
a73610d97f325b0e735d8bfcdea2e46e3ac1b2f8497fdb4c8cca0ed07e4a7375 assets/airdef/lang/ru_ru.json
|
||||
cede33ba58f61891a8afe42e1f4311cb293ca93f4d7eb3a57636caff17317a4d assets/airdef/lang/en_us.json
|
||||
cede33ba58f61891a8afe42e1f4311cb293ca93f4d7eb3a57636caff17317a4d assets/airdef/lang/ru_ru.json
|
||||
b9b5b5bec33a77e944552c225ee2f526ab9820fa8fca4b3ccf311f2a325925ee assets/airdef/models/block/amraam_missile.json
|
||||
c54e6b24ab69e9d9a2dbbbc63fe2ac60fa37735bf644500ddd5c3de0b91908cf assets/airdef/models/block/barge.json
|
||||
a4198ff647de5866919f9b82a3d53e6486fc56cc9f175f7907951d063a6f4526 assets/airdef/models/block/beam.json
|
||||
@@ -197,9 +186,6 @@ ea7c9af888f1285502b2ca51114f226573311be6fb90b8d449b9f75cfbb6b885 assets/airdef/
|
||||
94c8beaf3226c86d5ad018a31846286b451eaa96073e07be4465c9de3583ef61 assets/airdef/models/block/nasams_launcher_burnt.json
|
||||
99d3a530ca47536443db0e2c8a8f9236d68f67b6c78a5313c44dd80fb6edbde0 assets/airdef/models/block/nasams_trailer.json
|
||||
ab0d875ad069ccd241f3c75fd32ecbe3507cfe740aa072a3a75955c489629ec6 assets/airdef/models/block/nasams_trailer_burnt.json
|
||||
83382b0ebd95ca2d00befd51ebec70793d34121638adfe3814f9d1e971564b05 assets/airdef/models/block/optical_head.json
|
||||
204d6b6e21955fc5405953fb657633fd12f09e59deb810b70a4cfa97cb147367 assets/airdef/models/block/optical_post.json
|
||||
d78a5308097ac94f77ae4d5fbbd15601c1a08dc8f0b3fb8a119d325c331d1a0d assets/airdef/models/block/optical_post_burnt.json
|
||||
ce9f0dc61bd07cfcb3be5cadf12df0d2ef1b3167aa2260bc4b42414dc3825b58 assets/airdef/models/block/p1sun.json
|
||||
b5346ab109ffb8c259592574b091a47bd396de34b0fe96e684b672316cee6b86 assets/airdef/models/block/p1sun_launcher.json
|
||||
4457a527977ad5c7d381991ca1c9d304cac0b7074f632a04328e836bfd83f784 assets/airdef/models/block/p1sun_launcher_burnt.json
|
||||
@@ -217,14 +203,10 @@ d01efdcfafa92243e745aea7870269c07a0224c9010010e2dbed720ced1662c5 assets/airdef/
|
||||
548bc63e46d96e5110598e39269851c48f750164981a433f75971b0229c268df assets/airdef/models/block/patriot_trailer.json
|
||||
190726b64bef4baadb0bc2a00147069685ef148100c8935402e09c3bef66e65b assets/airdef/models/block/patriot_trailer_burnt.json
|
||||
6f027b020e4066f673c376e289cc627846a084e5733d62744fe78ab23013fb08 assets/airdef/models/block/patriot_truck.json
|
||||
540c2b501f7fe0979ef87ceb826e899a69423cf1f7ba3c0d5542761a4064810c assets/airdef/models/block/radar_dish.json
|
||||
132bfe2b948d5503a43a236535fe1f28f76dc1463a257a64174922f5aabbd84b assets/airdef/models/block/radar_height_head.json
|
||||
8070d24b511ac733d73f5961762e6f5995379814f33f54c56c1a45d1dd7ff28a assets/airdef/models/block/radar_mast.json
|
||||
7343f6085138f974d581706cc135e582040a46069c215e95ba14ad31dc1a8d63 assets/airdef/models/block/radar_mast_burnt.json
|
||||
e5733ece9b976998c9c6a6c968b17cada868b62d9e2a7bc67e1272e333e35399 assets/airdef/models/block/radar_panel.json
|
||||
f17bf8fb0680532a69e2b7faa83a96901c4525010823c16ad99b5ab0cdbd2c2e assets/airdef/models/block/radar_search_array.json
|
||||
b0ae344fbad3b982e7821cd1b26f9922e2a5713b38107521ddc5a5b2abd9e39c assets/airdef/models/block/radar_trailer.json
|
||||
a2005780753e8e8a51180abee788b4e46f9aab07a9dbab8acc3bfa1bc79160e7 assets/airdef/models/block/radar_trailer_burnt.json
|
||||
5545094620c27fae6b3d97a71f3d68ee8e0b49804a1dcd61b79ca847277e3b61 assets/airdef/models/block/radar_truck.json
|
||||
5c756abfb412b31076cd84d8735ad4e41ca26c8d5896e3795aaddb976aefbd1c assets/airdef/models/block/radar_truck_burnt.json
|
||||
f102765390762d45954b26405b6acdde845df7f0a319bac53d25508e768957b5 assets/airdef/models/block/reentry.json
|
||||
@@ -272,14 +254,10 @@ a5d0450da8d6757b9b45f86e6b36977894dd9e3e1278c3668b99a8acab36f399 assets/airdef/
|
||||
e80ee81085241b9712e024bbef73ef744ef5493eebb88770f4912d8aae138fe6 assets/airdef/models/item/deploy_irist.json
|
||||
637b9bfe426ee50045f8fcbfd4f25dfbc1d819ce36dedbd60abdac63c274f088 assets/airdef/models/item/deploy_light.json
|
||||
3398844e90203f97ee73e35619684c775d1856c8ca3399b5ed682786170d9327 assets/airdef/models/item/deploy_nasams.json
|
||||
332f9de8c88658a562748fc7a6de7ec37847273ac0cd0733e23c0dff4b44418c assets/airdef/models/item/deploy_optical.json
|
||||
76019c05d070cf1141cdf95b744b3d6198ab99469dba1f88a6903de1de303bde assets/airdef/models/item/deploy_p1sun.json
|
||||
8b1af688bc83be5a8065673bca7054deee86ca425f0bfd1fb4ffb491844e90bf assets/airdef/models/item/deploy_pantsir.json
|
||||
d0091d809816350c648e532a90ae59a3c5c9b94f837b2a46b5695e7f985a00f9 assets/airdef/models/item/deploy_patriot.json
|
||||
332f9de8c88658a562748fc7a6de7ec37847273ac0cd0733e23c0dff4b44418c assets/airdef/models/item/deploy_radar.json
|
||||
332f9de8c88658a562748fc7a6de7ec37847273ac0cd0733e23c0dff4b44418c assets/airdef/models/item/deploy_radar_height.json
|
||||
332f9de8c88658a562748fc7a6de7ec37847273ac0cd0733e23c0dff4b44418c assets/airdef/models/item/deploy_radar_search.json
|
||||
332f9de8c88658a562748fc7a6de7ec37847273ac0cd0733e23c0dff4b44418c assets/airdef/models/item/deploy_radar_track.json
|
||||
9ee1dfa7d2c2587c85a8f73554962a02a06f1969a9a56c56110162dd93db7301 assets/airdef/models/item/deploy_s400.json
|
||||
55f1dae5cd7f0126533825c9da3ed3ee316e74d4be8f9bb217a3ebc6f827d24d assets/airdef/models/item/deploy_s500.json
|
||||
aca5ea765ca0d84ed12444bf433c024b57d6ea9b9b7cf06449dfbd6892a66ae6 assets/airdef/models/item/deploy_tor.json
|
||||
@@ -521,9 +499,6 @@ cc0877f40434365b45b03429222926aa0cf135e504017311be53263fd27c5f8f data/airdef/ho
|
||||
cc0877f40434365b45b03429222926aa0cf135e504017311be53263fd27c5f8f data/airdef/horizon/block/nasams_launcher_burnt.json
|
||||
cc0877f40434365b45b03429222926aa0cf135e504017311be53263fd27c5f8f data/airdef/horizon/block/nasams_trailer.json
|
||||
cc0877f40434365b45b03429222926aa0cf135e504017311be53263fd27c5f8f data/airdef/horizon/block/nasams_trailer_burnt.json
|
||||
cc0877f40434365b45b03429222926aa0cf135e504017311be53263fd27c5f8f data/airdef/horizon/block/optical_head.json
|
||||
cc0877f40434365b45b03429222926aa0cf135e504017311be53263fd27c5f8f data/airdef/horizon/block/optical_post.json
|
||||
cc0877f40434365b45b03429222926aa0cf135e504017311be53263fd27c5f8f data/airdef/horizon/block/optical_post_burnt.json
|
||||
cc0877f40434365b45b03429222926aa0cf135e504017311be53263fd27c5f8f data/airdef/horizon/block/p1sun.json
|
||||
cc0877f40434365b45b03429222926aa0cf135e504017311be53263fd27c5f8f data/airdef/horizon/block/p1sun_launcher.json
|
||||
cc0877f40434365b45b03429222926aa0cf135e504017311be53263fd27c5f8f data/airdef/horizon/block/p1sun_launcher_burnt.json
|
||||
@@ -541,14 +516,10 @@ cc0877f40434365b45b03429222926aa0cf135e504017311be53263fd27c5f8f data/airdef/ho
|
||||
cc0877f40434365b45b03429222926aa0cf135e504017311be53263fd27c5f8f data/airdef/horizon/block/patriot_trailer.json
|
||||
cc0877f40434365b45b03429222926aa0cf135e504017311be53263fd27c5f8f data/airdef/horizon/block/patriot_trailer_burnt.json
|
||||
cc0877f40434365b45b03429222926aa0cf135e504017311be53263fd27c5f8f data/airdef/horizon/block/patriot_truck.json
|
||||
cc0877f40434365b45b03429222926aa0cf135e504017311be53263fd27c5f8f data/airdef/horizon/block/radar_dish.json
|
||||
cc0877f40434365b45b03429222926aa0cf135e504017311be53263fd27c5f8f data/airdef/horizon/block/radar_height_head.json
|
||||
cc0877f40434365b45b03429222926aa0cf135e504017311be53263fd27c5f8f data/airdef/horizon/block/radar_mast.json
|
||||
cc0877f40434365b45b03429222926aa0cf135e504017311be53263fd27c5f8f data/airdef/horizon/block/radar_mast_burnt.json
|
||||
cc0877f40434365b45b03429222926aa0cf135e504017311be53263fd27c5f8f data/airdef/horizon/block/radar_panel.json
|
||||
cc0877f40434365b45b03429222926aa0cf135e504017311be53263fd27c5f8f data/airdef/horizon/block/radar_search_array.json
|
||||
cc0877f40434365b45b03429222926aa0cf135e504017311be53263fd27c5f8f data/airdef/horizon/block/radar_trailer.json
|
||||
cc0877f40434365b45b03429222926aa0cf135e504017311be53263fd27c5f8f data/airdef/horizon/block/radar_trailer_burnt.json
|
||||
cc0877f40434365b45b03429222926aa0cf135e504017311be53263fd27c5f8f data/airdef/horizon/block/radar_truck.json
|
||||
cc0877f40434365b45b03429222926aa0cf135e504017311be53263fd27c5f8f data/airdef/horizon/block/radar_truck_burnt.json
|
||||
cc0877f40434365b45b03429222926aa0cf135e504017311be53263fd27c5f8f data/airdef/horizon/block/reentry.json
|
||||
@@ -596,14 +567,10 @@ cc0877f40434365b45b03429222926aa0cf135e504017311be53263fd27c5f8f data/airdef/ho
|
||||
2a3912a7c9d5bb8025b1ac16a1a1d6b5eff0360bb3184e810d319e498255bf97 data/airdef/horizon/item/deploy_irist.json
|
||||
2a3912a7c9d5bb8025b1ac16a1a1d6b5eff0360bb3184e810d319e498255bf97 data/airdef/horizon/item/deploy_light.json
|
||||
2a3912a7c9d5bb8025b1ac16a1a1d6b5eff0360bb3184e810d319e498255bf97 data/airdef/horizon/item/deploy_nasams.json
|
||||
2a3912a7c9d5bb8025b1ac16a1a1d6b5eff0360bb3184e810d319e498255bf97 data/airdef/horizon/item/deploy_optical.json
|
||||
2a3912a7c9d5bb8025b1ac16a1a1d6b5eff0360bb3184e810d319e498255bf97 data/airdef/horizon/item/deploy_p1sun.json
|
||||
2a3912a7c9d5bb8025b1ac16a1a1d6b5eff0360bb3184e810d319e498255bf97 data/airdef/horizon/item/deploy_pantsir.json
|
||||
2a3912a7c9d5bb8025b1ac16a1a1d6b5eff0360bb3184e810d319e498255bf97 data/airdef/horizon/item/deploy_patriot.json
|
||||
2a3912a7c9d5bb8025b1ac16a1a1d6b5eff0360bb3184e810d319e498255bf97 data/airdef/horizon/item/deploy_radar.json
|
||||
2a3912a7c9d5bb8025b1ac16a1a1d6b5eff0360bb3184e810d319e498255bf97 data/airdef/horizon/item/deploy_radar_height.json
|
||||
2a3912a7c9d5bb8025b1ac16a1a1d6b5eff0360bb3184e810d319e498255bf97 data/airdef/horizon/item/deploy_radar_search.json
|
||||
2a3912a7c9d5bb8025b1ac16a1a1d6b5eff0360bb3184e810d319e498255bf97 data/airdef/horizon/item/deploy_radar_track.json
|
||||
2a3912a7c9d5bb8025b1ac16a1a1d6b5eff0360bb3184e810d319e498255bf97 data/airdef/horizon/item/deploy_s400.json
|
||||
2a3912a7c9d5bb8025b1ac16a1a1d6b5eff0360bb3184e810d319e498255bf97 data/airdef/horizon/item/deploy_s500.json
|
||||
2a3912a7c9d5bb8025b1ac16a1a1d6b5eff0360bb3184e810d319e498255bf97 data/airdef/horizon/item/deploy_tor.json
|
||||
@@ -622,4 +589,4 @@ cc0877f40434365b45b03429222926aa0cf135e504017311be53263fd27c5f8f data/airdef/ho
|
||||
2a3912a7c9d5bb8025b1ac16a1a1d6b5eff0360bb3184e810d319e498255bf97 data/airdef/horizon/item/launch_zircon.json
|
||||
2a3912a7c9d5bb8025b1ac16a1a1d6b5eff0360bb3184e810d319e498255bf97 data/airdef/horizon/item/mover.json
|
||||
2a3912a7c9d5bb8025b1ac16a1a1d6b5eff0360bb3184e810d319e498255bf97 data/airdef/horizon/item/remover.json
|
||||
0ca03bd3e7d8c5ffe89c01c9637d672ebe4706ec993e59c373fed2e09ad540a2 src/sim/generated_bounds.rs
|
||||
5e0c0090b5aaded5b86b245cb30bcd0cbaa82f632a362d490d79bcf2794e25fd src/sim/generated_bounds.rs
|
||||
|
||||
@@ -209,33 +209,26 @@ fn post(uv: vec2<f32>, pixel: vec2<f32>) -> vec4<f32> {
|
||||
let on_screen = radius / max(length(centre), 1.0);
|
||||
let steps = i32(clamp(on_screen * 40.0, 6.0, 14.0));
|
||||
let ds = (t1 - t0) / f32(steps);
|
||||
// At zero fade every step's density is zero: absorb is 0, so the march adds no light and
|
||||
// leaves the transmittance alone. Skip it (the HD smoke path fades out by k = 0.28) instead
|
||||
// of sampling the noise and shading a volume that cannot be seen.
|
||||
if fade > 0.0 {
|
||||
for (var s = 0; s < steps; s++) {
|
||||
if trans < 0.02 { break; }
|
||||
let p = dir * (t0 + (f32(s) + 0.5) * ds);
|
||||
let local = (p - centre) / radius;
|
||||
let r = length(local);
|
||||
let n = fbm(local * 2.4 + seed + vec3<f32>(0.0, -age * 0.06, age * 0.02));
|
||||
let shape = smoothstep(1.0, 0.25, r + (n - 0.5) * 1.1);
|
||||
if shape <= 0.0 { continue; }
|
||||
let density = shape * (1.2 + n * 2.0) * fade;
|
||||
let absorb = 1.0 - exp(-density * ds * 1.4 / max(radius * 0.25, 0.5));
|
||||
// Hot inside, soot outside; smoke lit from above by the sky.
|
||||
let core = heat * (1.0 - r) * (0.6 + n);
|
||||
let smoke = vec3<f32>(0.10, 0.095, 0.09) * (0.5 + 0.8 * sun * (0.5 + local.y * 0.5));
|
||||
let c = mix(smoke, fire(core * 1.6), clamp(core * 2.2, 0.0, 1.0));
|
||||
lit += trans * absorb * c;
|
||||
trans *= 1.0 - absorb;
|
||||
}
|
||||
}
|
||||
// Light thrown round by the fire (zero once its heat is spent).
|
||||
if heat > 0.0 {
|
||||
let d = length(centre);
|
||||
glow += vec3<f32>(1.0, 0.5, 0.15) * heat * heat * size * 0.05 / (1.0 + d * 0.03);
|
||||
for (var s = 0; s < steps; s++) {
|
||||
if trans < 0.02 { break; }
|
||||
let p = dir * (t0 + (f32(s) + 0.5) * ds);
|
||||
let local = (p - centre) / radius;
|
||||
let r = length(local);
|
||||
let n = fbm(local * 2.4 + seed + vec3<f32>(0.0, -age * 0.06, age * 0.02));
|
||||
let shape = smoothstep(1.0, 0.25, r + (n - 0.5) * 1.1);
|
||||
if shape <= 0.0 { continue; }
|
||||
let density = shape * (1.2 + n * 2.0) * fade;
|
||||
let absorb = 1.0 - exp(-density * ds * 1.4 / max(radius * 0.25, 0.5));
|
||||
// Hot inside, soot outside; smoke lit from above by the sky.
|
||||
let core = heat * (1.0 - r) * (0.6 + n);
|
||||
let smoke = vec3<f32>(0.10, 0.095, 0.09) * (0.5 + 0.8 * sun * (0.5 + local.y * 0.5));
|
||||
let c = mix(smoke, fire(core * 1.6), clamp(core * 2.2, 0.0, 1.0));
|
||||
lit += trans * absorb * c;
|
||||
trans *= 1.0 - absorb;
|
||||
}
|
||||
// Light thrown round by the fire.
|
||||
let d = length(centre);
|
||||
glow += vec3<f32>(1.0, 0.5, 0.15) * heat * heat * size * 0.05 / (1.0 + d * 0.03);
|
||||
}
|
||||
color = color * trans + lit;
|
||||
|
||||
|
||||
+17
-287
@@ -1,34 +1,22 @@
|
||||
//! Player-facing labels for battery configuration and status.
|
||||
use crate::sim::battery::{BatteryStatus, RadarProfile, SamMode};
|
||||
use crate::sim::{AmmoKind, Sam, SamKind, SupplyStatus, SupplySummary};
|
||||
//! Player-facing labels for battery configuration snapshots.
|
||||
use crate::sim::battery::{BatteryStatus, RadarRole, SamMode};
|
||||
|
||||
/// One profile's functions in a line the player can read.
|
||||
pub fn radar_profile_line(profile: RadarProfile) -> String {
|
||||
let channels = if profile.channels == 0 { "без каналов уточнения".to_string() } else { format!("каналы {}", profile.channels) };
|
||||
format!(
|
||||
"{} [{}]: {}, оборот {:.1} с, {}, локальный поиск {}; развёртывание: {}",
|
||||
profile.name,
|
||||
profile.id,
|
||||
profile.products_text(),
|
||||
profile.cycle as f64 / 20.0,
|
||||
channels,
|
||||
if profile.local >= 1.0 { "во всей дальности".to_string() } else { format!("{:.0}% дальности", profile.local * 100.0) },
|
||||
profile.deployment,
|
||||
)
|
||||
pub fn radar_role_name(role: RadarRole) -> &'static str {
|
||||
match role {
|
||||
RadarRole::Multifunction => "многофункциональная",
|
||||
RadarRole::Search => "обзорная",
|
||||
RadarRole::Engagement => "сопровождения",
|
||||
RadarRole::Height => "мачтовая",
|
||||
}
|
||||
}
|
||||
|
||||
pub fn status(status: BatteryStatus) -> String {
|
||||
match status {
|
||||
BatteryStatus::Radar { index, role, emitting, operational } => {
|
||||
let profile = role.profile();
|
||||
format!(
|
||||
"№{} РЛС: {}; излучение {}, {}",
|
||||
index + 1,
|
||||
radar_profile_line(profile),
|
||||
if emitting { "вкл" } else { "выкл" },
|
||||
if operational { "работает" } else { "нет связи или РЛС не работает" }
|
||||
)
|
||||
}
|
||||
BatteryStatus::Radar { index, role, emitting, operational } => format!(
|
||||
"№{} РЛС: {}, излучение {}, {}", index + 1, radar_role_name(role),
|
||||
if emitting { "вкл" } else { "выкл" },
|
||||
if operational { "работает" } else { "нет связи или РЛС не работает" }
|
||||
),
|
||||
BatteryStatus::Launcher { index, kind, mode, linked } => format!(
|
||||
"№{} {}: {}{}", index + 1, kind.name(), mode.key(),
|
||||
if mode == SamMode::LauncherOnly {
|
||||
@@ -38,275 +26,17 @@ pub fn status(status: BatteryStatus) -> String {
|
||||
}
|
||||
}
|
||||
|
||||
/// One system's line in the summary panel and on the map.
|
||||
pub fn sam_status(sam: &Sam, now: u64) -> String {
|
||||
let spec = sam.kind.spec();
|
||||
let mut text = spec.name.to_string();
|
||||
if !sam.alive() {
|
||||
return text + " УНИЧТОЖЕН";
|
||||
}
|
||||
if sam.moving() {
|
||||
return text + " " + &sam.state.name().to_lowercase();
|
||||
}
|
||||
match sam.kind {
|
||||
SamKind::Depot => {
|
||||
let kinds = sam.ammo_stock.non_zero().count();
|
||||
return format!("{text}: {} БК ({} видов), RM48U {}, снятых ПВО {}", sam.ammo_stock.total(), kinds, sam.ground_stock, sam.air_48n6_stock);
|
||||
}
|
||||
SamKind::Tzm => {
|
||||
let carried: Vec<_> = sam.ammo_stock.non_zero().map(|(k, n)| format!("{}×{n}", k.short_name())).collect();
|
||||
let cargo_detail = if carried.is_empty() { String::new() } else { format!(" ({})", carried.join(", ")) };
|
||||
return format!(
|
||||
"{text}: на борту {}/{}{cargo_detail}, RM48U {}, снятых ПВО {}{}",
|
||||
sam.ammo_stock.total(),
|
||||
crate::sim::TRUCK_CAPACITY,
|
||||
sam.ground_stock,
|
||||
sam.air_48n6_stock,
|
||||
if sam.return_cargo { ", везёт RM48U на склад" } else if sam.job().is_some() { ", в пути" } else { "" }
|
||||
);
|
||||
}
|
||||
SamKind::Ew => {
|
||||
let state = if sam.ew_on { "ГЛУШИТ" } else if sam.ew_lock { "остывает" } else { "готова" };
|
||||
return format!("{text}: {state}, нагрев {:.0}%", sam.heat * 100.0);
|
||||
}
|
||||
SamKind::Radar => {
|
||||
let broken = if sam.comps.whole() { String::new() } else { format!(" [{}]", crate::why_view::worst(&sam.comps, sam.kind)) };
|
||||
let profile = sam.radar_profile();
|
||||
let channels = if profile.channels == 0 {
|
||||
"без уточнения".to_string()
|
||||
} else {
|
||||
format!("каналы {}/{}", sam.own_channels_used(now), profile.channels)
|
||||
};
|
||||
return format!("{text} «{}»: {}; целей {}{broken}, {channels}", profile.name, profile.products_text(), sam.own.len());
|
||||
}
|
||||
SamKind::Light => return format!("{text}{}", if sam.target.is_some() { ": в луче цель" } else { "" }),
|
||||
SamKind::Optical => {
|
||||
let mut t = format!("{text}: {}", sam.optical.status_text());
|
||||
if sam.health < 1.0 {
|
||||
t += &format!(" ({:.0}%)", sam.health * 100.0);
|
||||
}
|
||||
if !sam.comps.whole() {
|
||||
t += &format!(" [{}]", crate::why_view::worst(&sam.comps, sam.kind));
|
||||
}
|
||||
return t;
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
if let Some(cell) = sam.preparing_cell() {
|
||||
text += &format!(" · открытие ТПК №{}", cell + 1);
|
||||
}
|
||||
if sam.empty && sam.missiles == 0 {
|
||||
text += " ЖДЁТ БК";
|
||||
}
|
||||
if sam.health < 1.0 {
|
||||
text += &format!(" ({:.0}%)", sam.health * 100.0);
|
||||
}
|
||||
if !sam.comps.whole() {
|
||||
text += &format!(" [{}]", crate::why_view::worst(&sam.comps, sam.kind));
|
||||
}
|
||||
if sam.reloading > 0 {
|
||||
text += &format!(" перезарядка {}с", sam.reloading.div_ceil(20));
|
||||
} else {
|
||||
if let Some(magazine) = sam.kind.missile_magazine() {
|
||||
if sam.kind.supports_rm48u() {
|
||||
text += &format!(" ПВО {} · RM48U {} / {} ячеек", sam.missiles, sam.ground_rounds, sam.cells());
|
||||
if sam.ground_return { text += " · ожидает вывоза RM48U"; }
|
||||
} else {
|
||||
text += &format!(" ракеты {}/{}", sam.missiles, magazine);
|
||||
}
|
||||
}
|
||||
if sam.kind.has_gun() {
|
||||
text += &format!(" очереди {}", sam.bursts);
|
||||
}
|
||||
}
|
||||
text
|
||||
}
|
||||
|
||||
/// Human-readable resupply / reload reason for one unit card or status command.
|
||||
pub fn supply_line(status: &SupplyStatus) -> String {
|
||||
match status {
|
||||
SupplyStatus::Reloading { ticks_left } => format!("Перезарядка: {} с", ticks_left.div_ceil(20)),
|
||||
SupplyStatus::TruckEnRoute { truck_num, eta_ticks, rm48u: true, returning: true, .. } => {
|
||||
format!("ТЗМ №{truck_num} едет забрать RM48U (~{} с)", eta_ticks.div_ceil(20))
|
||||
}
|
||||
SupplyStatus::TruckEnRoute { truck_num, eta_ticks, rm48u: true, returning: false, .. } => {
|
||||
format!("ТЗМ №{truck_num} везёт RM48U (~{} с)", eta_ticks.div_ceil(20))
|
||||
}
|
||||
SupplyStatus::TruckEnRoute { truck_num, eta_ticks, rm48u: false, .. } => {
|
||||
format!("ТЗМ №{truck_num} везёт БК (~{} с)", eta_ticks.div_ceil(20))
|
||||
}
|
||||
SupplyStatus::TruckFetching { truck_num, depot_num, eta_ticks, rm48u: true, .. } => {
|
||||
format!("ТЗМ №{truck_num} едет на склад №{depot_num} за RM48U (~{} с)", eta_ticks.div_ceil(20))
|
||||
}
|
||||
SupplyStatus::TruckFetching { truck_num, depot_num, eta_ticks, rm48u: false, .. } => {
|
||||
format!("ТЗМ №{truck_num} едет на склад №{depot_num} за БК (~{} с)", eta_ticks.div_ceil(20))
|
||||
}
|
||||
SupplyStatus::NoRm48uStock => "Ждёт RM48U: на складах и в ТЗМ нет ударных ракет".to_string(),
|
||||
SupplyStatus::OutOfStock { missing } => {
|
||||
let names: Vec<_> = missing.into_iter().flatten().map(|k| k.short_name()).collect();
|
||||
format!("Ждёт БК ({}): нет на складах и в ТЗМ", names.join(", "))
|
||||
}
|
||||
SupplyStatus::NoTruck { rm48u } => {
|
||||
format!("Ждёт {}: нет исправной ТЗМ", if *rm48u { "RM48U" } else { "БК" })
|
||||
}
|
||||
SupplyStatus::RouteBlocked { rm48u } => {
|
||||
format!("Ждёт {}: ТЗМ не может проехать", if *rm48u { "RM48U" } else { "БК" })
|
||||
}
|
||||
SupplyStatus::WaitingForTruck { rm48u: true, returning: true } => "Ожидает свободную ТЗМ для вывоза RM48U".to_string(),
|
||||
SupplyStatus::WaitingForTruck { rm48u: true, returning: false } => "Ожидает свободную ТЗМ для доставки RM48U".to_string(),
|
||||
SupplyStatus::WaitingForTruck { rm48u: false, .. } => "Ожидает свободную ТЗМ".to_string(),
|
||||
}
|
||||
}
|
||||
|
||||
/// Multi-line aggregate summary of depot & truck stocks for `/airdef stocks`.
|
||||
pub fn stock_summary_lines(summary: &SupplySummary) -> Vec<String> {
|
||||
let mut lines = vec![
|
||||
format!(
|
||||
"Склады: {} · ТЗМ: {} (занято {}) · ждут БК: {}, RM48U: {}, перезарядка: {}",
|
||||
summary.depots_alive, summary.trucks_alive, summary.trucks_busy, summary.waiting_ammo, summary.waiting_rm48u, summary.reloading
|
||||
),
|
||||
format!(
|
||||
"RM48U: на складах {}, в ТЗМ {}, в ПУ {}",
|
||||
summary.rm48u_depot, summary.rm48u_truck, summary.rm48u_loaded
|
||||
),
|
||||
];
|
||||
let entries: Vec<String> = AmmoKind::ALL
|
||||
.into_iter()
|
||||
.filter_map(|k| {
|
||||
let d = summary.depot_ammo[k.index()];
|
||||
let t = summary.truck_ammo[k.index()];
|
||||
(d + t > 0).then(|| format!("{} {} ({}+{})", k.short_name(), d + t, d, t))
|
||||
})
|
||||
.collect();
|
||||
if entries.is_empty() {
|
||||
lines.push("БК ПВО на складах и в ТЗМ исчерпан".to_string());
|
||||
} else {
|
||||
for chunk in entries.chunks(3) {
|
||||
lines.push(chunk.join(" · "));
|
||||
}
|
||||
}
|
||||
lines
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::sim::battery::RadarRole;
|
||||
use crate::sim::{Part, Sam, SamKind, SamState};
|
||||
use glam::DVec3;
|
||||
|
||||
#[test]
|
||||
fn renders_system_status_in_existing_format() {
|
||||
let mut s400 = Sam::new(1, SamKind::S400, DVec3::ZERO, 0.0);
|
||||
s400.missiles = 1;
|
||||
s400.ground_rounds = 2;
|
||||
assert_eq!(sam_status(&s400, 0), "С-400 ПВО 1 · RM48U 2 / 4 ячеек");
|
||||
s400.ground_return = true;
|
||||
assert_eq!(sam_status(&s400, 0), "С-400 ПВО 1 · RM48U 2 / 4 ячеек · ожидает вывоза RM48U");
|
||||
|
||||
let mut pantsir = Sam::new(2, SamKind::Pantsir, DVec3::ZERO, 0.0);
|
||||
pantsir.missiles = 7;
|
||||
pantsir.bursts = 100;
|
||||
assert_eq!(sam_status(&pantsir, 0), "Панцирь-С1 ракеты 7/12 очереди 100");
|
||||
|
||||
let mut worn = Sam::new(3, SamKind::Patriot, DVec3::ZERO, 0.0);
|
||||
worn.health = 0.5;
|
||||
worn.comps.0[Part::Sensor as usize] = 0.4;
|
||||
worn.reloading = 21;
|
||||
assert_eq!(sam_status(&worn, 0), "Patriot (50%) [РЛС 40%] перезарядка 2с");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn renders_special_system_lines_in_existing_format() {
|
||||
let mut radar = Sam::new(4, SamKind::Radar, DVec3::ZERO, 0.0);
|
||||
radar.own.push(7);
|
||||
radar.comps.0[Part::Sensor as usize] = 0.0;
|
||||
assert_eq!(sam_status(&radar, 0), "РЛС дальнего обнаружения «многофункциональная»: обзор, уточнение, пуск; целей 1 [РЛС отказ], каналы 0/3");
|
||||
|
||||
let mut depot = Sam::new(5, SamKind::Depot, DVec3::ZERO, 0.0);
|
||||
depot.clear_ammo();
|
||||
depot.set_ammo(crate::sim::AmmoKind::S400Missile, 2);
|
||||
depot.ground_stock = 3;
|
||||
depot.air_48n6_stock = 1;
|
||||
assert_eq!(sam_status(&depot, 0), "Склад боеприпасов: 2 БК (1 видов), RM48U 3, снятых ПВО 1");
|
||||
|
||||
let mut tzm = Sam::new(6, SamKind::Tzm, DVec3::ZERO, 0.0);
|
||||
tzm.set_ammo(crate::sim::AmmoKind::TorMissile, 1);
|
||||
tzm.return_cargo = true;
|
||||
assert_eq!(sam_status(&tzm, 0), "ТЗМ: на борту 1/2 (Тор×1), RM48U 0, снятых ПВО 0, везёт RM48U на склад");
|
||||
|
||||
let mut ew = Sam::new(7, SamKind::Ew, DVec3::ZERO, 0.0);
|
||||
ew.ew_on = true;
|
||||
ew.heat = 0.5;
|
||||
assert_eq!(sam_status(&ew, 0), "Станция РЭБ: ГЛУШИТ, нагрев 50%");
|
||||
|
||||
let mut light = Sam::new(8, SamKind::Light, DVec3::ZERO, 0.0);
|
||||
light.target = Some(1);
|
||||
assert_eq!(sam_status(&light, 0), "Прожектор: в луче цель");
|
||||
|
||||
let optical = Sam::new(9, SamKind::Optical, DVec3::ZERO, 0.0);
|
||||
assert_eq!(sam_status(&optical, 0), "Оптический пост: ищет");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn renders_moving_and_destroyed_systems_in_existing_format() {
|
||||
let mut moving = Sam::new(9, SamKind::S400, DVec3::ZERO, 0.0);
|
||||
moving.state = SamState::Moving;
|
||||
assert_eq!(sam_status(&moving, 0), "С-400 на марше");
|
||||
|
||||
let mut dead = Sam::new(10, SamKind::S400, DVec3::ZERO, 0.0);
|
||||
dead.health = 0.0;
|
||||
assert_eq!(sam_status(&dead, 0), "С-400 УНИЧТОЖЕН");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn profiles_explain_their_different_functions() {
|
||||
for role in [RadarRole::Search, RadarRole::Height, RadarRole::Engagement, RadarRole::Multifunction] {
|
||||
let text = radar_profile_line(role.profile());
|
||||
assert!(text.contains(role.profile().id));
|
||||
assert!(text.contains(&format!("оборот {:.1} с", role.profile().cycle as f64 / 20.0)));
|
||||
}
|
||||
assert!(radar_profile_line(RadarRole::Search.profile()).contains("без каналов"));
|
||||
assert!(radar_profile_line(RadarRole::Engagement.profile()).contains("каналы 2"));
|
||||
assert!(radar_profile_line(RadarRole::Height.profile()).contains("уточнение"));
|
||||
}
|
||||
use crate::sim::SamKind;
|
||||
|
||||
#[test]
|
||||
fn renders_battery_status_in_existing_format() {
|
||||
assert_eq!(
|
||||
status(BatteryStatus::Radar { index: 0, role: RadarRole::Search, emitting: false, operational: false }),
|
||||
"№1 РЛС: дальнего обзора [radar_search]: обзор, оборот 8.5 с, без каналов уточнения, локальный поиск во всей дальности; развёртывание: крупная стационарная антенна; излучение выкл, нет связи или РЛС не работает"
|
||||
);
|
||||
assert_eq!(
|
||||
status(BatteryStatus::Radar { index: 1, role: RadarRole::Engagement, emitting: true, operational: true }),
|
||||
"№2 РЛС: сопровождения [radar_track]: обзор, уточнение, пуск, оборот 3.5 с, каналы 2, локальный поиск 12% дальности; развёртывание: мобильная панель; излучение вкл, работает"
|
||||
);
|
||||
assert_eq!(status(BatteryStatus::Radar { index: 0, role: RadarRole::Search, emitting: false, operational: false }), "№1 РЛС: обзорная, излучение выкл, нет связи или РЛС не работает");
|
||||
assert_eq!(status(BatteryStatus::Radar { index: 1, role: RadarRole::Engagement, emitting: true, operational: true }), "№2 РЛС: сопровождения, излучение вкл, работает");
|
||||
assert_eq!(status(BatteryStatus::Launcher { index: 2, kind: SamKind::S400, mode: SamMode::LauncherOnly, linked: true }), "№3 С-400: launcher, РЛС связана");
|
||||
assert_eq!(status(BatteryStatus::Launcher { index: 3, kind: SamKind::S500, mode: SamMode::LauncherOnly, linked: false }), "№4 С-500: launcher, нет связанной РЛС сопровождения");
|
||||
assert_eq!(status(BatteryStatus::Launcher { index: 4, kind: SamKind::S400, mode: SamMode::Integrated, linked: false }), "№5 С-400: integrated");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn formats_supply_status_and_stock_summary() {
|
||||
assert_eq!(supply_line(&SupplyStatus::Reloading { ticks_left: 41 }), "Перезарядка: 3 с");
|
||||
assert_eq!(
|
||||
supply_line(&SupplyStatus::TruckEnRoute { truck_num: 2, truck_id: 9, eta_ticks: 100, rm48u: false, returning: false }),
|
||||
"ТЗМ №2 везёт БК (~5 с)"
|
||||
);
|
||||
assert_eq!(
|
||||
supply_line(&SupplyStatus::TruckFetching { truck_num: 1, truck_id: 8, depot_num: 3, eta_ticks: 240, rm48u: true }),
|
||||
"ТЗМ №1 едет на склад №3 за RM48U (~12 с)"
|
||||
);
|
||||
assert_eq!(
|
||||
supply_line(&SupplyStatus::OutOfStock { missing: [Some(AmmoKind::PantsirMissile), Some(AmmoKind::PantsirGun)] }),
|
||||
"Ждёт БК (Панцирь рак, Панцирь пуш): нет на складах и в ТЗМ"
|
||||
);
|
||||
let mut sum = SupplySummary { depots_alive: 1, trucks_alive: 1, trucks_busy: 1, waiting_ammo: 1, waiting_rm48u: 0, reloading: 0, rm48u_depot: 2, rm48u_truck: 1, rm48u_loaded: 1, ..Default::default() };
|
||||
sum.depot_ammo[AmmoKind::S400Missile.index()] = 4;
|
||||
sum.truck_ammo[AmmoKind::S400Missile.index()] = 1;
|
||||
let lines = stock_summary_lines(&sum);
|
||||
assert!(lines[0].contains("Склады: 1 · ТЗМ: 1 (занято 1)"));
|
||||
assert!(lines[1].contains("RM48U: на складах 2, в ТЗМ 1, в ПУ 1"));
|
||||
assert!(lines[2].contains("С-400 5 (4+1)"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,7 +95,6 @@ pub fn diagnostics() -> String {
|
||||
let lights = render::point_lights_status();
|
||||
let sources = render::sound_sources_status();
|
||||
let cameras = render::camera_status();
|
||||
let dlss = render::dlss_status();
|
||||
let smoke_reason = match smoke.reason {
|
||||
render::SmokeReason::AwaitingFrame => "awaiting-frame",
|
||||
render::SmokeReason::Disabled => "disabled",
|
||||
@@ -103,7 +102,7 @@ pub fn diagnostics() -> String {
|
||||
render::SmokeReason::Ready => "ready",
|
||||
};
|
||||
[
|
||||
"Возможности движка (API 33; подготовка не означает готовый GPU-кадр, слышимый звук или файл):".into(),
|
||||
"Возможности движка (API 30; подготовка не означает готовый GPU-кадр, слышимый звук или файл):".into(),
|
||||
line(
|
||||
"Дым",
|
||||
smoke.generation,
|
||||
@@ -150,10 +149,6 @@ pub fn diagnostics() -> String {
|
||||
capture.prepared,
|
||||
reason(capture.reason),
|
||||
),
|
||||
format!(
|
||||
"DLSS: устройство={}, включено={} (выкл — родной TAAU; вкл без устройства — при следующем запуске)",
|
||||
dlss.available, dlss.enabled
|
||||
),
|
||||
]
|
||||
.join("\n")
|
||||
}
|
||||
|
||||
+10
-48
@@ -14,7 +14,7 @@ fn on_off() -> Value {
|
||||
/// `/airdef ...` as `lib.rs` accepts it.
|
||||
pub fn tree() -> Tree {
|
||||
let wave_kinds: Vec<&str> = DroneKind::ALL.iter().map(|k| k.spec().key).chain(["mix"]).collect();
|
||||
let deploy_kinds: Vec<&str> = SamKind::ALL.iter().map(|k| k.key()).chain(crate::sim::catalog::VARIANTS.iter().map(|v| v.id)).collect();
|
||||
let deploy_kinds: Vec<&str> = SamKind::ALL.iter().map(|k| k.key()).chain(["s400_launcher", "s500_launcher", "radar_search", "radar_track", "radar_height"]).collect();
|
||||
let armed: Vec<&str> = SamKind::ARMED.iter().map(|k| k.key()).chain(["all"]).collect();
|
||||
let toggle = |word: &str| Node::lit(word).then(Node::arg("on/off", on_off()).runs());
|
||||
Tree::new("airdef").runs().with([
|
||||
@@ -56,18 +56,10 @@ pub fn tree() -> Tree {
|
||||
),
|
||||
Node::lit("list").runs(),
|
||||
Node::lit("delete").then(Node::arg("имя", Value::names(SCENARIOS)).runs()),
|
||||
Node::lit("village").runs().then(
|
||||
Node::arg("режим", Value::choice(["easy", "normal", "hard", "start", "status", "prices", "stop"])).runs(),
|
||||
),
|
||||
]),
|
||||
Node::lit("breaches").runs().then(Node::arg("страница", Value::int_from(1)).runs()),
|
||||
Node::lit("why").runs().then(
|
||||
Node::arg("номер", Value::int_from(1)).runs().then(Node::lit("source").runs()),
|
||||
),
|
||||
Node::lit("chains").runs().then(Node::arg("батарея", Value::int_from(1)).runs()),
|
||||
Node::lit("why").runs().then(Node::arg("номер", Value::int_from(1)).runs()),
|
||||
Node::lit("raid").runs(),
|
||||
Node::lit("sites").runs(),
|
||||
Node::lit("stocks").runs(),
|
||||
Node::lit("ground-stock").then(Node::arg("склад", Value::int_from(1)).then(Node::arg("количество", Value::int_from(0)).runs())),
|
||||
Node::lit("ground-cancel").then(Node::arg("комплекс", Value::int_from(1)).runs()),
|
||||
Node::lit("ground-unload").then(Node::arg("комплекс", Value::int_from(1)).runs()),
|
||||
@@ -81,7 +73,7 @@ pub fn tree() -> Tree {
|
||||
Node::lit("target").then(Node::lit("here").runs()),
|
||||
Node::lit("give").runs(),
|
||||
Node::lit("battery").runs().then(Node::arg("номер", Value::int_from(1)).then(Node::arg("режим", Value::choice(["integrated", "launcher"])).runs())),
|
||||
Node::lit("radar").then(Node::arg("номер", Value::int_from(1)).then(Node::arg("режим", Value::Word(vec!["on".into(), "off".into()])).runs())),
|
||||
Node::lit("radar").then(Node::arg("номер", Value::int_from(1)).then(Node::arg("роль", Value::choice(["on", "off", "multi", "search", "engagement", "height"])).runs())),
|
||||
Node::lit("deploy").then(Node::arg("комплекс", Value::choice(deploy_kinds)).runs()),
|
||||
Node::lit("wave").then(
|
||||
Node::arg("тип", Value::choice(wave_kinds)).runs().then(
|
||||
@@ -95,7 +87,6 @@ pub fn tree() -> Tree {
|
||||
Node::lit("shader").then(Node::arg("режим", Value::choice(["on", "off", "hd"])).runs()),
|
||||
toggle("hold"),
|
||||
toggle("lastchance"),
|
||||
toggle("autostrike"),
|
||||
Node::lit("roles").runs().then(
|
||||
Node::arg("комплекс", Value::choice(armed)).then(
|
||||
Node::arg(
|
||||
@@ -115,21 +106,6 @@ pub fn tree() -> Tree {
|
||||
Node::lit("guard").with([Node::lit("off").runs(), Node::arg("объекты", Value::word()).runs()]),
|
||||
Node::lit("reset").runs(),
|
||||
])),
|
||||
Node::lit("recon").runs(),
|
||||
Node::lit("post").runs().then(Node::arg("поиск", Value::word()).runs()),
|
||||
Node::lit("panel").with([
|
||||
Node::lit("snapshot").then(Node::arg("запрос", Value::word()).then(
|
||||
Node::arg("ракурс", Value::choice(["public", "debug"])).then(Node::arg("позиция", Value::word()).runs())
|
||||
)),
|
||||
Node::lit("launch").then(Node::arg("запрос", Value::word()).then(
|
||||
Node::arg("сессия", Value::word()).then(Node::arg("сценарий", Value::word()).runs())
|
||||
)),
|
||||
Node::lit("action").then(Node::arg("запрос", Value::word()).then(
|
||||
Node::arg("сессия", Value::word()).then(Node::arg("действие", Value::choice(["autostrike", "strike"])).then(
|
||||
Node::arg("значение", Value::word()).runs()
|
||||
))
|
||||
)),
|
||||
]),
|
||||
Node::lit("stats").runs(),
|
||||
])
|
||||
}
|
||||
@@ -186,15 +162,14 @@ mod tests {
|
||||
#[test]
|
||||
fn every_branch_of_the_handler_parses() {
|
||||
for line in [
|
||||
"", "menu", "capabilities", "monitor", "grid", "post", "post Панцирь", "post 82", "give", "raid", "repair", "import", "flare", "clear", "stats", "recon", "roles",
|
||||
"", "menu", "capabilities", "monitor", "grid", "give", "raid", "repair", "import", "flare", "clear", "stats", "roles",
|
||||
"replay", "replay map", "replay full", "replay reel", "replay film", "replay film best", "replay film all",
|
||||
"replay film 3", "replay export", "replay export mine", "replay export best", "replay export all", "replay export 3",
|
||||
"replay export mine all fps=30 size=1280x720 crf=18 sec=12.5 noaudio", "replay export fps=60", "replay stop",
|
||||
"scenario save a", "scenario save a fresh", "scenario load a", "scenario load a force", "scenario list",
|
||||
"scenario delete a", "scenario village", "scenario village hard", "scenario village start",
|
||||
"breaches", "breaches 2", "why", "why 2", "why 2 source", "chains", "chains 2", "ew on", "ew off", "move 4", "target here", "targets clear",
|
||||
"sites", "strike 3", "battery", "battery 1 launcher", "battery 1 integrated", "radar 2 on", "radar 2 off", "radar 2 engagement", "radar 2 search", "deploy radar_search", "deploy radar_track", "deploy radar_height", "deploy patriot", "deploy light", "deploy s400", "wave mix", "wave shahed", "wave shahed 20", "wave kh101 80 800", "wave shahed 20 4000",
|
||||
"wave oreshnik 1 60", "damage on", "damage off", "truth on", "shader hd", "shader off", "shader on", "hold on", "lastchance on", "lastchance off", "autostrike on", "autostrike off",
|
||||
"scenario delete a", "why", "why 2", "ew on", "ew off", "move 4", "target here", "targets clear",
|
||||
"sites", "strike 3", "battery", "battery 1 launcher", "battery 1 integrated", "radar 2 on", "radar 2 off", "radar 2 engagement", "radar 2 search", "deploy s400_launcher", "deploy s500_launcher", "deploy radar_search", "deploy radar_track", "deploy radar_height", "deploy patriot", "deploy light", "deploy s400", "wave mix", "wave shahed", "wave shahed 20", "wave kh101 80 800", "wave shahed 20 4000",
|
||||
"wave oreshnik 1 60", "damage on", "damage off", "truth on", "shader hd", "shader off", "shader on", "hold on", "lastchance on", "lastchance off",
|
||||
"roles all default", "doctrine", "doctrine 1 reserve 4", "doctrine all salvo eco", "doctrine 2 sector 90 45", "doctrine 2 sector off", "doctrine 1 guard 1,2", "doctrine 1 reset", "roles patriot drone,jet", "roles pantsir all", "roles tor ballistic",
|
||||
] {
|
||||
ok(line);
|
||||
@@ -266,15 +241,14 @@ mod tests {
|
||||
fn completion_offers_the_next_word_only() {
|
||||
let top = complete("", &[]);
|
||||
for w in ["menu", "monitor", "grid", "replay", "scenario", "why", "raid", "repair", "import", "ew", "flare", "move",
|
||||
"target", "give", "deploy", "wave", "clear", "targets", "damage", "truth", "shader", "hold", "lastchance", "autostrike", "roles", "doctrine", "stats", "recon", "sites", "stocks", "strike", "ground-stock", "ground-load", "ground-unload", "ground-cancel", "chains"] {
|
||||
"target", "give", "deploy", "wave", "clear", "targets", "damage", "truth", "shader", "hold", "lastchance", "roles", "doctrine", "stats", "sites", "strike", "ground-stock", "ground-load", "ground-unload", "ground-cancel"] {
|
||||
assert!(top.contains(&w.to_string()), "{w} in {top:?}");
|
||||
}
|
||||
assert!(top.contains(&"post".to_string()));
|
||||
assert_eq!(top.len(), 42);
|
||||
assert_eq!(top.len(), 35);
|
||||
assert_eq!(complete("rep", &[]), ["repair", "replay"]);
|
||||
assert_eq!(complete("replay ", &[]), ["export", "film", "full", "map", "reel", "stop"]);
|
||||
assert_eq!(complete("replay film ", &[]), ["all", "best"]);
|
||||
assert_eq!(complete("scenario ", &[]), ["delete", "list", "load", "save", "village"]);
|
||||
assert_eq!(complete("scenario ", &[]), ["delete", "list", "load", "save"]);
|
||||
assert_eq!(complete("wave ", &[]).len(), 14);
|
||||
assert!(complete("wave s", &[]).contains(&"shahed".to_string()));
|
||||
assert_eq!(complete("shader ", &[]), ["hd", "off", "on"]);
|
||||
@@ -284,18 +258,6 @@ mod tests {
|
||||
assert!(complete("wave nothing ", &[]).is_empty());
|
||||
}
|
||||
|
||||
/// A station's profile is fixed at deployment: completion offers only emission, while an
|
||||
/// old role word still reaches the handler's explanation instead of a bare parse error.
|
||||
#[test]
|
||||
fn radar_completion_offers_emission_only() {
|
||||
let words = complete("radar 1 ", &[]);
|
||||
assert_eq!(words.len(), 2, "{words:?}");
|
||||
assert!(words.contains(&"on".to_string()) && words.contains(&"off".to_string()));
|
||||
for old in ["multi", "search", "engagement", "height"] {
|
||||
assert!(tree().parse(&format!("radar 1 {old}")).is_ok(), "`{old}` should reach the handler");
|
||||
}
|
||||
}
|
||||
|
||||
/// The names follow the data: after a save the new name is offered, after a delete it is gone.
|
||||
#[test]
|
||||
fn scenario_names_follow_a_save_and_a_delete() {
|
||||
|
||||
@@ -1,229 +0,0 @@
|
||||
//! Picking nearby AirDef models against the same block ray the client uses for its crosshair.
|
||||
use crate::sim::Model;
|
||||
use glam::{DVec3, Vec3};
|
||||
use horizon_mod_sdk::render::{FillShape, Point, Rect, Shape, TextShape};
|
||||
|
||||
pub const REACH: f32 = 24.0;
|
||||
const FACE_BYTES: usize = 4 * 3 * size_of::<f32>();
|
||||
const FACES: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/inspect-faces.bin"));
|
||||
const MESHES: &[(&str, Mesh)] = include!(concat!(env!("OUT_DIR"), "/inspect-meshes.rs"));
|
||||
|
||||
struct Mesh {
|
||||
min: [f32; 3],
|
||||
max: [f32; 3],
|
||||
radius: f32,
|
||||
start: usize,
|
||||
end: usize,
|
||||
}
|
||||
|
||||
pub struct Ray {
|
||||
origin: DVec3,
|
||||
direction: DVec3,
|
||||
limit: f64,
|
||||
}
|
||||
|
||||
impl Ray {
|
||||
pub fn from_view(eye: DVec3, direction: DVec3, terrain: Option<DVec3>) -> Self {
|
||||
let mut origin = eye;
|
||||
let mut limit = f64::from(REACH);
|
||||
if let Some(point) = terrain {
|
||||
let horizontal = DVec3::new(direction.x, 0.0, direction.z);
|
||||
let distance = if horizontal.length_squared() > 1e-8 {
|
||||
// Feet and eye share X/Z. Recover the actual eye height from the host
|
||||
// ray when it hit a block (the eye lowers while crouching or swimming).
|
||||
let t = (point - eye).dot(horizontal) / horizontal.length_squared();
|
||||
origin.y = point.y - direction.y * t;
|
||||
t
|
||||
} else {
|
||||
(point - eye).dot(direction)
|
||||
};
|
||||
limit = distance.clamp(0.0, limit);
|
||||
}
|
||||
Self {
|
||||
origin,
|
||||
direction,
|
||||
limit,
|
||||
}
|
||||
}
|
||||
|
||||
fn hits_bounds(&self, min: DVec3, max: DVec3) -> bool {
|
||||
let (mut near, mut far) = (0.0f64, self.limit);
|
||||
for i in 0..3 {
|
||||
if self.direction[i].abs() < 1e-10 {
|
||||
if self.origin[i] < min[i] || self.origin[i] > max[i] {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
let a = (min[i] - self.origin[i]) / self.direction[i];
|
||||
let b = (max[i] - self.origin[i]) / self.direction[i];
|
||||
near = near.max(a.min(b));
|
||||
far = far.min(a.max(b));
|
||||
if near > far {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
near < self.limit
|
||||
}
|
||||
|
||||
fn triangle(&self, a: DVec3, b: DVec3, c: DVec3) -> Option<f64> {
|
||||
let ab = b - a;
|
||||
let ac = c - a;
|
||||
let p = self.direction.cross(ac);
|
||||
let determinant = ab.dot(p);
|
||||
if determinant.abs() < 1e-10 {
|
||||
return None;
|
||||
}
|
||||
let t = self.origin - a;
|
||||
let u = t.dot(p) / determinant;
|
||||
let q = t.cross(ab);
|
||||
let v = self.direction.dot(q) / determinant;
|
||||
let distance = ac.dot(q) / determinant;
|
||||
(u >= 0.0 && v >= 0.0 && u + v <= 1.0 && distance >= 0.0 && distance < self.limit)
|
||||
.then_some(distance)
|
||||
}
|
||||
}
|
||||
|
||||
/// Return the object that owns the closest visible face, including its rotated moving parts.
|
||||
pub fn pick(
|
||||
mut ray: Ray,
|
||||
models: &[Model],
|
||||
mut is_unit_model: impl FnMut(&Model) -> bool,
|
||||
) -> Option<u32> {
|
||||
let mut picked = None;
|
||||
for model in models {
|
||||
if model.glow || model.scale <= 0.0 {
|
||||
continue;
|
||||
}
|
||||
let Ok(i) = MESHES.binary_search_by_key(&model.name, |(name, _)| *name) else {
|
||||
continue;
|
||||
};
|
||||
let mesh = &MESHES[i].1;
|
||||
let scale = f64::from(model.scale);
|
||||
let reach = ray.limit + scale * f64::from(mesh.radius);
|
||||
if model.at.distance_squared(ray.origin) > reach * reach || !is_unit_model(model) {
|
||||
continue;
|
||||
}
|
||||
let unrotate = model.rotation.conjugate();
|
||||
let mut local = Ray {
|
||||
origin: unrotate * (ray.origin - model.at) / scale,
|
||||
direction: unrotate * ray.direction / scale,
|
||||
limit: ray.limit,
|
||||
};
|
||||
if !local.hits_bounds(
|
||||
Vec3::from_array(mesh.min).as_dvec3(),
|
||||
Vec3::from_array(mesh.max).as_dvec3(),
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
for face in FACES[mesh.start..mesh.end].chunks_exact(FACE_BYTES) {
|
||||
let [a, b, c, d] = std::array::from_fn(|vertex| {
|
||||
DVec3::from_array(std::array::from_fn(|axis| {
|
||||
let start = (vertex * 3 + axis) * size_of::<f32>();
|
||||
let value = f32::from_le_bytes(
|
||||
face[start..start + size_of::<f32>()].try_into().unwrap(),
|
||||
);
|
||||
f64::from(value)
|
||||
}))
|
||||
});
|
||||
if let Some(hit) = local.triangle(a, b, c).or_else(|| local.triangle(a, c, d)) {
|
||||
local.limit = hit;
|
||||
picked = Some(model.object_id());
|
||||
}
|
||||
}
|
||||
ray.limit = local.limit;
|
||||
}
|
||||
picked
|
||||
}
|
||||
|
||||
pub fn hint(size: (f32, f32), text_width: f32, label: String) -> [Shape; 2] {
|
||||
let (x, y) = (size.0 / 2.0, size.1 / 2.0 + 14.0);
|
||||
[
|
||||
Shape::Fill(FillShape {
|
||||
rect: Rect {
|
||||
x: x - text_width / 2.0 - 4.0,
|
||||
y: y - 2.0,
|
||||
w: text_width + 8.0,
|
||||
h: 12.0,
|
||||
},
|
||||
color: 0xA0101518,
|
||||
}),
|
||||
Shape::Text(TextShape {
|
||||
text: label,
|
||||
at: Point { x, y },
|
||||
color: 0xFFF0F4FA,
|
||||
centered: true,
|
||||
shadow: true,
|
||||
}),
|
||||
]
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use glam::DQuat;
|
||||
|
||||
fn radar(id: u32, at: DVec3) -> Model {
|
||||
Model {
|
||||
id,
|
||||
name: "airdef:radar_truck",
|
||||
at,
|
||||
rotation: DQuat::from_rotation_y(0.4),
|
||||
scale: 1.0,
|
||||
glow: false,
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn takes_the_closest_model_face_only_in_front_of_the_terrain() {
|
||||
let eye = DVec3::new(0.0, 0.25, 0.0);
|
||||
let models = [radar(16, 10.0 * DVec3::Z), radar(33, 6.0 * DVec3::Z)];
|
||||
assert_eq!(
|
||||
pick(Ray::from_view(eye, DVec3::Z, None), &models, |_| true),
|
||||
Some(32)
|
||||
);
|
||||
let wall = Some(DVec3::new(0.0, 0.25, 3.0));
|
||||
assert_eq!(
|
||||
pick(Ray::from_view(eye, DVec3::Z, wall), &models, |_| true),
|
||||
None
|
||||
);
|
||||
let wall_between_units = Some(DVec3::new(0.0, 0.25, 8.0));
|
||||
assert_eq!(
|
||||
pick(
|
||||
Ray::from_view(eye, DVec3::Z, wall_between_units),
|
||||
&models,
|
||||
|_| true
|
||||
),
|
||||
Some(32)
|
||||
);
|
||||
assert_eq!(
|
||||
pick(Ray::from_view(eye, DVec3::Z, None), &models, |m| m.id == 16),
|
||||
Some(16)
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_higher_visible_part_is_pickable_above_a_wall() {
|
||||
let body = radar(16, 8.0 * DVec3::Z);
|
||||
let antenna = Model {
|
||||
name: "airdef:radar_panel",
|
||||
..radar(18, DVec3::new(0.0, 1.8, 8.0))
|
||||
};
|
||||
let low_eye = DVec3::new(0.0, 0.25, 0.0);
|
||||
let wall = Some(DVec3::new(0.0, 0.25, 3.0));
|
||||
let high_eye = DVec3::new(0.0, 1.8, 0.0);
|
||||
assert_eq!(
|
||||
pick(Ray::from_view(high_eye, DVec3::Z, None), &[body], |_| true),
|
||||
None
|
||||
);
|
||||
let models = [radar(16, 8.0 * DVec3::Z), antenna];
|
||||
assert_eq!(
|
||||
pick(Ray::from_view(low_eye, DVec3::Z, wall), &models, |_| true),
|
||||
None
|
||||
);
|
||||
assert_eq!(
|
||||
pick(Ray::from_view(high_eye, DVec3::Z, None), &models, |_| true),
|
||||
Some(16)
|
||||
);
|
||||
}
|
||||
}
|
||||
+10
-126
@@ -31,9 +31,6 @@ pub struct SamRec {
|
||||
pub air_48n6_stock: u32,
|
||||
pub mode: sim::battery::SamMode,
|
||||
pub radar_role: sim::battery::RadarRole,
|
||||
/// The stable profile ID when the file names one (new saves); old files
|
||||
/// have only the role key, which migrates to the matching profile.
|
||||
pub radar_profile: Option<sim::battery::RadarProfile>,
|
||||
pub spent_cells: u8,
|
||||
pub radar_on: bool,
|
||||
}
|
||||
@@ -44,20 +41,14 @@ pub struct Layout {
|
||||
pub targets: Vec<(DVec3, f64)>,
|
||||
pub damage: Option<bool>,
|
||||
pub last_chance: Option<bool>,
|
||||
pub auto_strike: Option<bool>,
|
||||
pub seed: Option<u64>,
|
||||
pub wave: Option<Vec<String>>,
|
||||
pub far: Option<bool>,
|
||||
pub acoustics: Option<bool>,
|
||||
/// The player's DLSS request; absent in older saves (the engine's own
|
||||
/// default applies: on where supported).
|
||||
pub dlss: Option<bool>,
|
||||
pub effects: Option<(bool, bool)>,
|
||||
pub roles: Vec<(SamKind, u8)>,
|
||||
/// Fire doctrines by the system's place in the file (#47).
|
||||
pub doctrines: Vec<(usize, sim::doctrine::Doctrine)>,
|
||||
/// Typed depot/TZM ammunition stocks by the unit's place in the file.
|
||||
pub stocks: Vec<(usize, sim::AmmoStock)>,
|
||||
/// Strike missiles in stock and ticks towards the next (#101).
|
||||
pub strikes: Option<(u32, u32)>,
|
||||
}
|
||||
@@ -136,9 +127,7 @@ impl Layout {
|
||||
None => break,
|
||||
}
|
||||
}
|
||||
let supports_ground = kind.supports_rm48u();
|
||||
let shared_cells = if supports_ground { kind.missile_magazine().unwrap_or(0) } else { 0 };
|
||||
let ground_rounds = l.num(22, "заряжено RM48U", 0.0, COUNT)?.unwrap_or(0.0) as u32;
|
||||
let ground_rounds = l.num(22, "заряжено RM48U", 0.0, 4.0)?.unwrap_or(0.0) as u32;
|
||||
let ground_stock = l.num(23, "запас RM48U", 0.0, COUNT)?.unwrap_or(0.0) as u32;
|
||||
let air_48n6_stock = l.num(24, "снятый боезапас ПВО", 0.0, COUNT)?.unwrap_or(0.0) as u32;
|
||||
let mode = match l.w.get(25) {
|
||||
@@ -154,36 +143,24 @@ impl Layout {
|
||||
Some(v) => v.parse::<u8>().map_err(|_| l.bad("пустые контейнеры", "нужно целое число 0..255"))?,
|
||||
};
|
||||
let ground_request = l.num(28, "заявка RM48U", 0.0, 1.0)?.unwrap_or(0.0) == 1.0;
|
||||
if ground_request && !supports_ground { return Err(l.bad("заявка RM48U", "нужен совместимый профиль")); }
|
||||
if ground_request && kind != SamKind::S400 { return Err(l.bad("заявка RM48U", "нужен С-400")); }
|
||||
let radar_on = l.flag(29, "излучение РЛС")?.unwrap_or(true);
|
||||
let ground_return = l.flag(30, "заявка на вывоз RM48U")?.unwrap_or(false);
|
||||
let return_cargo = l.flag(31, "возвращаемый груз RM48U")?.unwrap_or(false);
|
||||
let radar_profile = match l.w.get(32) {
|
||||
None => None,
|
||||
Some(v) => Some(sim::battery::RadarProfile::from_id(v).ok_or_else(|| l.bad("профиль РЛС", "radar_multi, radar_search, radar_track или radar_height"))?),
|
||||
};
|
||||
if (ground_return && (!supports_ground || ground_request || ground_rounds == 0)) || (return_cargo && (kind != SamKind::Tzm || ground_stock == 0)) { return Err(l.bad("возврат RM48U", "несовместимое состояние")); }
|
||||
if (ground_return && (kind != SamKind::S400 || ground_request || ground_rounds == 0)) || (return_cargo && (kind != SamKind::Tzm || ground_stock == 0)) { return Err(l.bad("возврат RM48U", "несовместимое состояние")); }
|
||||
if radar_role != sim::battery::RadarRole::Multifunction && kind != SamKind::Radar {
|
||||
return Err(l.bad("роль РЛС", "роль поддерживается только отдельной РЛС"));
|
||||
}
|
||||
if let Some(profile) = radar_profile {
|
||||
if kind != SamKind::Radar { return Err(l.bad("профиль РЛС", "профиль поддерживается только отдельной РЛС")); }
|
||||
if profile.role() != radar_role { return Err(l.bad("профиль РЛС", "профиль и роль не совпадают")); }
|
||||
if mode == sim::battery::SamMode::LauncherOnly && !matches!(kind, SamKind::S400 | SamKind::S500) {
|
||||
return Err(l.bad("режим", "пусковая поддерживается только С-400 и С-500"));
|
||||
}
|
||||
// An old line has only the role: it migrates to the matching profile.
|
||||
let radar_profile = radar_profile.or((kind == SamKind::Radar).then(|| sim::battery::RadarProfile::of(radar_role)));
|
||||
// The С-400 and С-500 are separate launchers only now: a system saved with its own radar keeps its place as one.
|
||||
let mode = if sim::catalog::has_separate_launcher(kind) { sim::battery::SamMode::LauncherOnly } else { mode };
|
||||
if mode == sim::battery::SamMode::LauncherOnly && !sim::catalog::has_separate_launcher(kind) {
|
||||
return Err(l.bad("режим", "отдельная пусковая для этого типа недоступна"));
|
||||
}
|
||||
if (!supports_ground && ground_rounds != 0) || (!matches!(kind, SamKind::Depot | SamKind::Tzm) && (ground_stock != 0 || air_48n6_stock != 0)) {
|
||||
if (kind != SamKind::S400 && ground_rounds != 0) || (!matches!(kind, SamKind::Depot | SamKind::Tzm) && (ground_stock != 0 || air_48n6_stock != 0)) {
|
||||
return Err(l.bad("боезапас", "несовместимый тип техники"));
|
||||
}
|
||||
if supports_ground && ammo.map_or(0, |(missiles, ..)| missiles) + ground_rounds > shared_cells {
|
||||
return Err(l.bad("боезапас", &format!("больше {shared_cells} ячеек")));
|
||||
if let Some((m, _, _, _)) = ammo && m + ground_rounds > 4 && kind == SamKind::S400 {
|
||||
return Err(l.bad("боезапас", "больше четырёх ячеек"));
|
||||
}
|
||||
out.sams.push(SamRec { kind, pos, heading, roles, health, cargo, ammo, dest, comps, ground_rounds, ground_stock, air_48n6_stock, mode, radar_role, radar_profile, spent_cells, ground_request, radar_on, ground_return, return_cargo });
|
||||
out.sams.push(SamRec { kind, pos, heading, roles, health, cargo, ammo, dest, comps, ground_rounds, ground_stock, air_48n6_stock, mode, radar_role, spent_cells, ground_request, radar_on, ground_return, return_cargo });
|
||||
}
|
||||
"target" => {
|
||||
if out.targets.len() >= MAX_UNITS {
|
||||
@@ -195,11 +172,9 @@ impl Layout {
|
||||
}
|
||||
"damage" => out.damage = l.flag(1, "значение")?,
|
||||
"lastchance" => out.last_chance = l.flag(1, "значение")?,
|
||||
"autostrike" => out.auto_strike = l.flag(1, "значение")?,
|
||||
"strikes" => out.strikes = Some((l.need(1, "запас", 0.0, COUNT)? as u32, l.num(2, "до следующей", 0.0, COUNT)?.map_or(0, |v| v as u32))),
|
||||
"far" => out.far = l.flag(1, "значение")?,
|
||||
"acoustics" => out.acoustics = l.flag(1, "значение")?,
|
||||
"dlss" => out.dlss = l.flag(1, "значение")?,
|
||||
"effects" => out.effects = Some((l.flag(1, "шейдер")?.unwrap_or(true), l.flag(2, "HD")?.unwrap_or(false))),
|
||||
"seed" => {
|
||||
let v = l.w.get(1).ok_or_else(|| l.bad("значение", "строка оборвана"))?;
|
||||
@@ -219,37 +194,6 @@ impl Layout {
|
||||
let guards = (0..n).map(|k| l.xyz(7 + 3 * k, "охраняемый объект")).collect::<Result<Vec<_>, _>>()?;
|
||||
out.doctrines.push((at, sim::doctrine::Doctrine { guards, sector, reserve, salvo }));
|
||||
}
|
||||
"stock" => {
|
||||
let at = l.need(1, "склад или ТЗМ", 0.0, MAX_UNITS as f64)? as usize;
|
||||
let target = out.sams.get(at).ok_or_else(|| l.bad("склад или ТЗМ", "нет такой строки техники"))?;
|
||||
if !matches!(target.kind, SamKind::Depot | SamKind::Tzm) {
|
||||
return Err(l.bad("склад или ТЗМ", "боезапас склада поддерживается только для склада и ТЗМ"));
|
||||
}
|
||||
let mut stock = sim::AmmoStock::default();
|
||||
let mut seen = [false; sim::AmmoKind::COUNT];
|
||||
if l.w.get(2).is_none() {
|
||||
return Err(l.bad("состав", "строка оборвана"));
|
||||
}
|
||||
if l.w.get(2) != Some(&"-") {
|
||||
for item in &l.w[2..] {
|
||||
let (k, v) = item.split_once('=').ok_or_else(|| l.bad("состав", &format!("«{item}»: нужен вид=число")))?;
|
||||
let kind = sim::AmmoKind::from_key(k).ok_or_else(|| l.bad("состав", &format!("неизвестный вид БК «{k}»")))?;
|
||||
if seen[kind.index()] {
|
||||
return Err(l.bad("состав", &format!("повтор вида БК «{k}»")));
|
||||
}
|
||||
seen[kind.index()] = true;
|
||||
let count: f64 = v.parse().map_err(|_| l.bad("состав", &format!("«{v}» не число")))?;
|
||||
if !count.is_finite() || count < 0.0 || count > COUNT || count.fract() != 0.0 {
|
||||
return Err(l.bad("состав", &format!("недопустимое количество «{v}»")));
|
||||
}
|
||||
stock.set(kind, count as u32);
|
||||
}
|
||||
}
|
||||
if target.kind == SamKind::Tzm && stock.total() > sim::TRUCK_CAPACITY {
|
||||
return Err(l.bad("состав", &format!("груз ТЗМ больше {}", sim::TRUCK_CAPACITY)));
|
||||
}
|
||||
out.stocks.push((at, stock));
|
||||
}
|
||||
"roles" => {
|
||||
let kind = l.kind(1)?;
|
||||
out.roles.push((kind, l.need(2, "роли", 0.0, 255.0)? as u8));
|
||||
@@ -268,10 +212,7 @@ mod tests {
|
||||
#[test]
|
||||
fn battery_modes_load_and_old_layouts_default() {
|
||||
let old = Layout::parse("sam s400 0 70 0 0").unwrap();
|
||||
// The С-400 is a separate launcher now: a system saved with its own radar keeps its place as one.
|
||||
assert_eq!(old.sams[0].mode, sim::battery::SamMode::LauncherOnly);
|
||||
let patriot = Layout::parse("sam patriot 0 70 0 0").unwrap();
|
||||
assert_eq!(patriot.sams[0].mode, sim::battery::SamMode::Integrated);
|
||||
assert_eq!(old.sams[0].mode, sim::battery::SamMode::Integrated);
|
||||
assert!(old.sams[0].radar_on);
|
||||
assert_eq!(old.sams[0].radar_role, sim::battery::RadarRole::Multifunction);
|
||||
let data = "sam s400 0 70 0 0 30 1 0 4 0 0 0 - - - 1 1 1 1 1 1 0 0 0 launcher multi 5\nsam radar 1 70 0 0 0 1 0 0 0 0 0 - - - 1 1 1 1 1 1 0 0 0 integrated engagement";
|
||||
@@ -279,7 +220,6 @@ mod tests {
|
||||
assert_eq!(l.sams[0].mode, sim::battery::SamMode::LauncherOnly);
|
||||
assert_eq!(l.sams[0].spent_cells, 5);
|
||||
assert_eq!(l.sams[1].radar_role, sim::battery::RadarRole::Engagement);
|
||||
assert_eq!(l.sams[1].radar_profile, Some(sim::battery::RadarProfile::ENGAGEMENT), "an old role-only line migrates");
|
||||
assert!(!Layout::parse(&data.replace("launcher multi 5", "launcher multi 5 0 false")).unwrap().sams[0].radar_on);
|
||||
assert!(Layout::parse(&data.replace("launcher multi 5", "launcher multi 5 0 nope")).is_err());
|
||||
assert!(Layout::parse(&data.replace("engagement", "invalid")).is_err());
|
||||
@@ -290,13 +230,6 @@ mod tests {
|
||||
SamKind::Patriot.key()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn an_optical_post_loads_by_its_catalog_key() {
|
||||
let l = Layout::parse("sam optical 10 70 20 0.5\n").unwrap();
|
||||
assert_eq!(l.sams[0].kind, SamKind::Optical);
|
||||
assert_eq!(l.sams[0].mode, sim::battery::SamMode::Integrated);
|
||||
}
|
||||
|
||||
// #86: the issue's file, and the other ways a saved state can be wrong: refused whole, with the line
|
||||
#[test]
|
||||
fn a_damaged_state_is_refused_as_a_whole_with_its_line_and_field() {
|
||||
@@ -325,36 +258,6 @@ mod tests {
|
||||
assert!(Layout::parse(&many).is_err(), "no limit on the number of objects");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_dlss_request_round_trips_and_old_saves_keep_the_engine_default() {
|
||||
assert_eq!(Layout::parse("dlss false\n").unwrap().dlss, Some(false));
|
||||
assert_eq!(Layout::parse("dlss true\n").unwrap().dlss, Some(true));
|
||||
assert!(Layout::parse("dlss maybe\n").is_err());
|
||||
// Older saves have no line: the engine's own default (on) applies.
|
||||
assert_eq!(Layout::parse("damage true\n").unwrap().dlss, None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn radar_profile_ids_round_trip_and_old_roles_map_to_them() {
|
||||
let old = "sam radar 1 70 0 0 0 1 0 0 0 0 0 - - - 1 1 1 1 1 1 0 0 0 integrated search";
|
||||
let l = Layout::parse(old).unwrap();
|
||||
assert_eq!(l.sams[0].radar_role, sim::battery::RadarRole::Search);
|
||||
assert_eq!(l.sams[0].radar_profile, Some(sim::battery::RadarProfile::SEARCH));
|
||||
let new = "sam radar 1 70 0 0 0 1 0 0 0 0 0 - - - 1 1 1 1 1 1 0 0 0 integrated engagement 0 0 true false false radar_track";
|
||||
let l = Layout::parse(new).unwrap();
|
||||
assert_eq!(l.sams[0].radar_profile, Some(sim::battery::RadarProfile::ENGAGEMENT));
|
||||
assert_eq!(l.sams[0].radar_role, sim::battery::RadarRole::Engagement);
|
||||
assert_eq!(
|
||||
Layout::parse("sam radar 1 70 0 0 0 1 0 0 0 0 0 - - - 1 1 1 1 1 1 0 0 0 integrated multi 0 0 true false false radar_multi").unwrap().sams[0].radar_profile,
|
||||
Some(sim::battery::RadarProfile::MULTI)
|
||||
);
|
||||
// A profile and the legacy role must agree; a profile on a non-radar is refused.
|
||||
assert!(Layout::parse(&new.replace("engagement 0", "search 0")).is_err());
|
||||
assert!(Layout::parse(&new.replace("sam radar", "sam s400").replace("engagement", "multi")).is_err());
|
||||
assert!(Layout::parse(&new.replace("radar_track", "radar_unknown")).is_err());
|
||||
assert_eq!(sim::battery::RadarProfile::from_id("multi"), Some(sim::battery::RadarProfile::MULTI));
|
||||
}
|
||||
|
||||
// #86: files made by older builds (no ammunition, no parts, no destination marks) and unknown lines still load
|
||||
#[test]
|
||||
fn older_valid_saves_still_load() {
|
||||
@@ -409,24 +312,5 @@ mod tests {
|
||||
assert!(crate::layout::Layout::parse("doctrine 0 eco 1 - - 2 1 2 3\n").is_err(), "guards cut short");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn autostrike_and_typed_stocks_parse_and_validate() {
|
||||
let text = "sam depot 0 70 0 0\nsam tzm 10 70 0 0\nautostrike true\nstock 0 s400=3 pantsir_gun=4\nstock 1 tor=1\n";
|
||||
let l = Layout::parse(text).unwrap();
|
||||
assert_eq!(l.auto_strike, Some(true));
|
||||
assert_eq!(l.stocks.len(), 2);
|
||||
assert_eq!(l.stocks[0].1.get(sim::AmmoKind::S400Missile), 3);
|
||||
assert_eq!(l.stocks[0].1.get(sim::AmmoKind::PantsirGun), 4);
|
||||
assert_eq!(l.stocks[1].1.get(sim::AmmoKind::TorMissile), 1);
|
||||
|
||||
let empty = Layout::parse("sam depot 0 70 0 0\nstock 0 -\nautostrike false\n").unwrap();
|
||||
assert_eq!(empty.auto_strike, Some(false));
|
||||
assert!(empty.stocks[0].1.is_empty());
|
||||
|
||||
assert!(Layout::parse("sam s400 0 70 0 0\nstock 0 s400=1\n").is_err());
|
||||
assert!(Layout::parse("sam depot 0 70 0 0\nstock 0 unknown=1\n").is_err());
|
||||
assert!(Layout::parse("sam depot 0 70 0 0\nstock 0 s400=1 s400=2\n").is_err());
|
||||
assert!(Layout::parse("sam tzm 0 70 0 0\nstock 0 s400=3\n").is_err());
|
||||
assert!(Layout::parse("autostrike maybe\n").is_err());
|
||||
}
|
||||
}
|
||||
|
||||
+503
-720
File diff suppressed because it is too large
Load Diff
+86
-745
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+26
-84
@@ -1,9 +1,9 @@
|
||||
//! The air-defence monitor: a system's state, its radar's picture round it
|
||||
//! and its camera (a real view of the world from the system, the game
|
||||
//! renders it) locked on its target. K shows one system at a time. The
|
||||
//! command post can also open a grid of up to eight cameras.
|
||||
//! renders it) locked on its target. K shows one system at a time, J all of
|
||||
//! them in a grid.
|
||||
use crate::panel::distance;
|
||||
use crate::sim::{ClassEst, OpticalState, Sam, SamKind, SamState, Sim, heading_of, roles_text};
|
||||
use crate::sim::{Sam, SamState, Sim, heading_of, roles_text};
|
||||
use glam::DVec3;
|
||||
use horizon_mod_sdk::render::{self, CameraView, FillShape, Point, QuadShape, Rect, Shape, TextShape, ViewShape};
|
||||
|
||||
@@ -21,7 +21,7 @@ fn quad(a: (f32, f32), b: (f32, f32), c: (f32, f32), d: (f32, f32), color: u32)
|
||||
}
|
||||
|
||||
/// `t` cut to `w` GUI pixels, with an ellipsis.
|
||||
pub(crate) fn fit(t: String, w: f32) -> String {
|
||||
fn fit(t: String, w: f32) -> String {
|
||||
if render::text_width(&t) <= w {
|
||||
return t;
|
||||
}
|
||||
@@ -91,23 +91,12 @@ fn cell(sim: &Sim, index: usize, x: f32, y: f32, w: f32, h: f32, s: &mut Vec<Sha
|
||||
s.push(fill(x, y, w, h, 0xC0080C0A));
|
||||
s.push(fill(x, y, w, 12.0, 0xE0142018));
|
||||
let state = sam.state;
|
||||
let optical = sam.kind == SamKind::Optical;
|
||||
let lock = matches!(state, SamState::Lock | SamState::Launch | SamState::Fire);
|
||||
let blink = lock && (tick / 4) % 2 == 0;
|
||||
let label = if optical { sam.optical.state().name() } else { state.name() };
|
||||
let color = if optical {
|
||||
match sam.optical.state() {
|
||||
OpticalState::Observing => 0xFF60FF80,
|
||||
OpticalState::Holding => 0xFF9FE0FF,
|
||||
OpticalState::NoSight => 0xFFFFA040,
|
||||
OpticalState::Searching => 0xFFE0E0E0,
|
||||
}
|
||||
} else {
|
||||
state.color()
|
||||
};
|
||||
let label = state.name();
|
||||
let lw = render::text_width(label);
|
||||
s.push(text(fit(format!("№{} {}", index + 1, spec.name), w - lw - 12.0), x + 3.0, y + 2.0, 0xFF9FE0FF));
|
||||
s.push(text(label, x + w - 3.0 - lw, y + 2.0, argb(color, if blink { 0x80 } else { 0xFF })));
|
||||
s.push(text(label, x + w - 3.0 - lw, y + 2.0, argb(state.color(), if blink { 0x80 } else { 0xFF })));
|
||||
|
||||
// The radar, at the left: round the system, north up.
|
||||
let rr = ((h - 28.0) / 2.0).min(w * 0.2).max(10.0);
|
||||
@@ -125,13 +114,9 @@ fn cell(sim: &Sim, index: usize, x: f32, y: f32, w: f32, h: f32, s: &mut Vec<Sha
|
||||
}
|
||||
// A system that only fires (no radar) has no reach: a radar's sensor
|
||||
// range stands in, and nothing is divided by zero.
|
||||
let reach = if optical {
|
||||
crate::sim::OPTICAL_RANGE
|
||||
} else {
|
||||
match sam.kind.range() {
|
||||
r if r > 0.0 => r,
|
||||
_ => spec.sensor,
|
||||
}
|
||||
let reach = match sam.kind.range() {
|
||||
r if r > 0.0 => r,
|
||||
_ => spec.sensor,
|
||||
};
|
||||
let scale = if reach > 0.0 { rr as f64 / (reach * 1.25) } else { 0.0 };
|
||||
// The beam is the radar's real one: targets are measured as it passes them.
|
||||
@@ -161,17 +146,13 @@ fn cell(sim: &Sim, index: usize, x: f32, y: f32, w: f32, h: f32, s: &mut Vec<Sha
|
||||
seen += 1;
|
||||
let k = scale as f32;
|
||||
let (bx, by) = (rx + rel.x as f32 * k, ry + rel.z as f32 * k);
|
||||
// By the class the track was estimated (#133): the unknown are candidates too, shown in
|
||||
// their own colour — the explicit policy — never the target's own class. No roles means
|
||||
// holding fire, and that greys out the unknown as well.
|
||||
let allowed = sam.roles & d.kind.spec().class.bit() != 0;
|
||||
let color = if Some(d.id) == target.map(|t| t.id) {
|
||||
0xFFFFE040
|
||||
} else if !tr.class.in_roles(sam.roles) {
|
||||
0xFF808080
|
||||
} else if tr.class == ClassEst::Unknown {
|
||||
0xFFFFA040
|
||||
} else {
|
||||
} else if allowed {
|
||||
0xFFFF4040
|
||||
} else {
|
||||
0xFF808080
|
||||
};
|
||||
if tr.forecast(tick) {
|
||||
s.push(fill(bx - 1.5, by - 1.5, 3.0, 1.0, color));
|
||||
@@ -183,30 +164,14 @@ fn cell(sim: &Sim, index: usize, x: f32, y: f32, w: f32, h: f32, s: &mut Vec<Sha
|
||||
}
|
||||
}
|
||||
s.push(fill(rx - 1.5, ry - 1.5, 3.0, 3.0, 0xFF40A0FF));
|
||||
let radar_text = if optical {
|
||||
format!("ОПТИКА · {}", sam.optical.state().name())
|
||||
} else if spec.sensor <= 0.0 {
|
||||
let radar_text = if spec.sensor <= 0.0 {
|
||||
format!("сеть · {seen}")
|
||||
} else if radar_up {
|
||||
let profile = sam.radar_profile();
|
||||
let channels = if profile.channels == 0 { String::new() } else { format!(" · {}/{}", sam.own_channels_used(tick), profile.channels) };
|
||||
format!("{} · {} · {}{channels}", profile.name, distance(reach), seen)
|
||||
format!("РЛС {} · {}", distance(reach), seen)
|
||||
} else {
|
||||
"РЛС ОТКАЗ".to_string()
|
||||
};
|
||||
let radar_color = if optical {
|
||||
match sam.optical.state() {
|
||||
OpticalState::Observing => 0xFF60FF80,
|
||||
OpticalState::Holding => 0xFF9FE0FF,
|
||||
OpticalState::NoSight => 0xFFFFA040,
|
||||
OpticalState::Searching => 0xFFB0B0B0,
|
||||
}
|
||||
} else if spec.sensor > 0.0 && !radar_up {
|
||||
0xFFFF5040
|
||||
} else {
|
||||
0xFF80FF90
|
||||
};
|
||||
s.push(text(fit(radar_text, rr * 2.0 + 4.0), x + 4.0, y + h - 10.0, radar_color));
|
||||
s.push(text(fit(radar_text, rr * 2.0 + 4.0), x + 4.0, y + h - 10.0, if spec.sensor > 0.0 && !radar_up { 0xFFFF5040 } else { 0xFF80FF90 }));
|
||||
|
||||
// Its health under the radar: a bar, red when it is low.
|
||||
if sam.alive() && sam.health < 1.0 {
|
||||
@@ -244,7 +209,7 @@ fn cell(sim: &Sim, index: usize, x: f32, y: f32, w: f32, h: f32, s: &mut Vec<Sha
|
||||
// Worn or failed parts, over the picture: orange, red when one has failed.
|
||||
if !sam.comps.whole() {
|
||||
let failed = crate::sim::Part::ALL.iter().any(|p| sam.part_state(*p) == crate::sim::PartState::Failed);
|
||||
s.push(text(fit(crate::why_view::parts(&sam.comps, sam.kind), cw * 0.55), cx + 3.0, cy + 3.0, if failed { 0xFFFF4040 } else { 0xFFFFB030 }));
|
||||
s.push(text(fit(sam.parts_text(), cw * 0.55), cx + 3.0, cy + 3.0, if failed { 0xFFFF4040 } else { 0xFFFFB030 }));
|
||||
}
|
||||
// Crosshair.
|
||||
s.push(fill(cx + cw / 2.0 - 0.5, cy + 3.0, 1.0, ch * 0.18, 0x90FFFFFF));
|
||||
@@ -252,21 +217,6 @@ fn cell(sim: &Sim, index: usize, x: f32, y: f32, w: f32, h: f32, s: &mut Vec<Sha
|
||||
s.push(fill(cx + 3.0, cy + ch / 2.0 - 0.5, cw * 0.18, 1.0, 0x90FFFFFF));
|
||||
s.push(fill(cx + cw * 0.82 - 3.0, cy + ch / 2.0 - 0.5, cw * 0.18, 1.0, 0x90FFFFFF));
|
||||
match target {
|
||||
Some(_) if optical => {
|
||||
// The optical post's picture: its own class observation, never the true model name.
|
||||
let (color, info) = match sam.optical.state() {
|
||||
OpticalState::Observing => (0xFF60FF80, sam.optical.status_text()),
|
||||
OpticalState::Holding => (0xFF9FE0FF, sam.optical.status_text()),
|
||||
OpticalState::NoSight => (0xFFFFA040, sam.optical.status_text()),
|
||||
OpticalState::Searching => (0xFFB0B0B0, sam.optical.status_text()),
|
||||
};
|
||||
let (bw, bh) = (cw * 0.3, ch * 0.34);
|
||||
brackets(s, cx + cw / 2.0 - bw / 2.0, cy + ch / 2.0 - bh / 2.0, bw, bh, 6.0, color);
|
||||
if ch > 50.0 {
|
||||
s.push(text(fit(info.clone(), cw - 6.0), cx + 3.0, cy + ch - 20.0, color));
|
||||
}
|
||||
s.push(text(fit(info, cw - 6.0), cx + 3.0, cy + ch - 10.0, 0xFFC0FFC0));
|
||||
}
|
||||
Some(t) => {
|
||||
let color = if lock { if blink { 0xFFFF3030 } else { 0xFFFF8080 } } else { 0xFFFFE060 };
|
||||
let (bw, bh) = (cw * 0.3, ch * 0.34);
|
||||
@@ -283,12 +233,9 @@ fn cell(sim: &Sim, index: usize, x: f32, y: f32, w: f32, h: f32, s: &mut Vec<Sha
|
||||
let rel = at - sam.pos;
|
||||
let bearing = (heading_of(rel).to_degrees() + 180.0).rem_euclid(360.0);
|
||||
if ch > 50.0 {
|
||||
// What the system knows it by: the estimated class; the sandbox's truth names the model.
|
||||
let name = if sim.truth { t.kind.spec().name.to_string() } else { track.map_or_else(|| "тип не определён".into(), |tr| tr.class.name()) };
|
||||
s.push(text(fit(name, cw - 6.0), cx + 3.0, cy + ch - 20.0, 0xFFFFFFFF));
|
||||
s.push(text(fit(t.kind.spec().name.into(), cw - 6.0), cx + 3.0, cy + ch - 20.0, 0xFFFFFFFF));
|
||||
}
|
||||
// The speed its own measurements showed, never the target's own figures.
|
||||
let mut info = format!("{} в{:.0} {:.0}км/ч", distance(rel.length()), at.y - sam.pos.y, track.map_or(0.0, |tr| tr.vel.length()) * 72.0);
|
||||
let mut info = format!("{} в{:.0} {:.0}км/ч", distance(rel.length()), at.y - sam.pos.y, t.vel.length() * 72.0);
|
||||
if let Some(tr) = track {
|
||||
if tr.forecast(tick) {
|
||||
info += &format!(" прогноз {:.1}с", tr.age(tick) as f64 / 20.0);
|
||||
@@ -301,24 +248,19 @@ fn cell(sim: &Sim, index: usize, x: f32, y: f32, w: f32, h: f32, s: &mut Vec<Sha
|
||||
}
|
||||
s.push(text(fit(info, cw - 6.0), cx + 3.0, cy + ch - 10.0, 0xFFC0FFC0));
|
||||
}
|
||||
None if optical => s.push(text(fit(sam.optical.status_text(), cw - 6.0), cx + 3.0, cy + ch - 10.0, 0xFFB0B0B0)),
|
||||
None => s.push(text("ПОИСК", cx + 3.0, cy + ch - 10.0, 0xFF80FF90)),
|
||||
}
|
||||
|
||||
// What it carries and does.
|
||||
let mut line = String::new();
|
||||
if optical {
|
||||
line = sam.optical.status_text();
|
||||
} else {
|
||||
if !matches!(sam.kind, SamKind::Gepard) {
|
||||
line += &format!("Р{} ", sam.missiles);
|
||||
if sam.kind.supports_rm48u() { line += &format!("У{} ", sam.ground_rounds); }
|
||||
}
|
||||
if crate::sim::catalog::unit(sam.kind).has_gun() {
|
||||
line += &format!("Оч{} ", sam.bursts);
|
||||
}
|
||||
line += &format!("сб.{} [{}]", sam.kills, roles_text(sam.roles));
|
||||
if !matches!(sam.kind, crate::sim::SamKind::Gepard) {
|
||||
line += &format!("Р{} ", sam.missiles);
|
||||
if sam.kind == crate::sim::SamKind::S400 { line += &format!("У{} ", sam.ground_rounds); }
|
||||
}
|
||||
if crate::sim::catalog::unit(sam.kind).has_gun() {
|
||||
line += &format!("Оч{} ", sam.bursts);
|
||||
}
|
||||
line += &format!("сб.{} [{}]", sam.kills, roles_text(sam.roles));
|
||||
s.push(text(fit(line, cw), cx, y + h - 10.0, 0xFF9FE0FF));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,448 +0,0 @@
|
||||
//! The world overlay (#132): while the player holds the overlay key, square markers over the
|
||||
//! targets they can see, each with a short line — the class the radars estimated (#133) and the
|
||||
//! distance. The picture is the network's, as the radar and the map read it; the sandbox's truth
|
||||
//! mode adds white markers of the real drones, labelled with their actual type, apart from the
|
||||
//! network's. The player's own interceptors wear small yellow squares, as the radar shows them.
|
||||
//! Letting the key go hides everything. The markers are projected through the camera the last
|
||||
//! drawn frame used (`render.project`, API 31), so they sit on the world as it is drawn.
|
||||
//! Visibility comes before the draw budget (#141): each layer projects at most a bounded number
|
||||
//! of its nearest candidates, keeps the markers of the nearest visible ones, and counts a target
|
||||
//! that leaves the frame without spending a slot.
|
||||
use crate::panel::distance;
|
||||
use crate::sim::{ClassEst, Sim, Track};
|
||||
use glam::DVec3;
|
||||
use horizon_mod_sdk::render::{FillShape, Point, Rect, Shape, TextShape};
|
||||
|
||||
/// The most markers of one picture (the network's, the truth's and the interceptors' each): a full
|
||||
/// raid still fits the HUD's 1024 shapes — a marker is four sides and a label.
|
||||
const MAX_MARKERS: usize = 64;
|
||||
/// The most candidates of one layer the frame looks at: the nearest ones by distance. The draw
|
||||
/// budget is spent on what is in frame, but the projection work stays bounded — a crowd the frame
|
||||
/// does not hold cannot buy an unbounded scan, and what the scan never reaches counts as past the
|
||||
/// budget rather than out of the frame.
|
||||
const MAX_SCAN: usize = 4 * MAX_MARKERS;
|
||||
/// A marker's side thickness, pixels.
|
||||
const LINE: f32 = 1.0;
|
||||
/// A label line's height (the HUD font with its shadow).
|
||||
const LH: f32 = 9.0;
|
||||
/// The half-size a marker clamps to, near and far.
|
||||
const HALF_MIN: f32 = 5.0;
|
||||
const HALF_MAX: f32 = 16.0;
|
||||
|
||||
const RED: u32 = 0xFF4040;
|
||||
const ORANGE: u32 = 0xFFB040;
|
||||
const WHITE: u32 = 0xFFFFFFFF;
|
||||
const GREEN: u32 = 0xFF80FF90;
|
||||
const YELLOW: u32 = 0xFFFFE070;
|
||||
/// The interceptors' own colour (the radar's missile dot).
|
||||
const MISSILE: u32 = 0xFFE060;
|
||||
/// An interceptor's marker half-size: small, it is not a target.
|
||||
const MISSILE_HALF: f32 = 3.0;
|
||||
|
||||
fn pt(x: f32, y: f32) -> Point {
|
||||
Point { x, y }
|
||||
}
|
||||
|
||||
fn text(t: String, x: f32, y: f32, color: u32, centered: bool) -> Shape {
|
||||
Shape::Text(TextShape { text: t, at: pt(x, y), color, centered, shadow: true })
|
||||
}
|
||||
|
||||
/// 0xAARRGGBB with this alpha (0..1).
|
||||
fn alpha(rgb: u32, a: f64) -> u32 {
|
||||
((a.clamp(0.0, 1.0) * 255.0) as u32) << 24 | (rgb & 0xFFFFFF)
|
||||
}
|
||||
|
||||
/// A square outline around a screen point: four thin fills, the world's marker.
|
||||
fn square_outline(x: f32, y: f32, half: f32, color: u32) -> Vec<Shape> {
|
||||
let (w, h) = (half * 2.0, LINE);
|
||||
vec![
|
||||
Shape::Fill(FillShape { rect: Rect { x: x - half, y: y - half, w, h }, color }),
|
||||
Shape::Fill(FillShape { rect: Rect { x: x - half, y: y + half - LINE, w, h }, color }),
|
||||
Shape::Fill(FillShape { rect: Rect { x: x - half, y: y - half, w: h, h: w }, color }),
|
||||
Shape::Fill(FillShape { rect: Rect { x: x + half - LINE, y: y - half, w: h, h: w }, color }),
|
||||
]
|
||||
}
|
||||
|
||||
/// A marker's half-size by the distance: near targets read bigger, far ones stay legible.
|
||||
fn half(dist: f64) -> f32 {
|
||||
(700.0 / dist.max(1.0)).clamp(HALF_MIN as f64, HALF_MAX as f64) as f32
|
||||
}
|
||||
|
||||
/// The short line under a network marker: the estimated class's mark (#133) and the distance to
|
||||
/// the forecast place; a forecast says how old it is. An unidentified track gets a `?`, never the
|
||||
/// target's type.
|
||||
fn track_label(t: &Track, now: u64, player: DVec3) -> String {
|
||||
let mark = match t.class {
|
||||
ClassEst::Unknown => "?",
|
||||
c => c.mark(),
|
||||
};
|
||||
let mut s = format!("{mark} {}", distance(t.est(now).distance(player)));
|
||||
if t.forecast(now) {
|
||||
s += &format!(" ~{}с", t.age(now) / 20);
|
||||
}
|
||||
s
|
||||
}
|
||||
|
||||
/// Where a marker's label sits: under the square, or over it when the bottom edge is close.
|
||||
fn label_y(y: f32, half: f32, gui_h: f32, above: bool) -> f32 {
|
||||
if above {
|
||||
if y - half - LH - 2.0 >= 0.0 { y - half - LH - 2.0 } else { y + half + 2.0 }
|
||||
} else if y + half + LH + 2.0 <= gui_h {
|
||||
y + half + 2.0
|
||||
} else {
|
||||
y - half - LH - 2.0
|
||||
}
|
||||
}
|
||||
|
||||
/// What one layer shows this frame: the markers to draw (the nearest visible candidates), how
|
||||
/// many of the scanned candidates left the frame, and how many the budgets left out.
|
||||
struct Pick<T> {
|
||||
marks: Vec<(T, Point, f32)>,
|
||||
offscreen: usize,
|
||||
capped: usize,
|
||||
}
|
||||
|
||||
/// The markers one layer gets this frame. The candidates are ordered nearest the player first and
|
||||
/// at most [`MAX_SCAN`] of them are projected; a candidate the frame does not hold (behind the
|
||||
/// camera or past an edge) is counted and its slot stays free for the next, so the nearest
|
||||
/// [`MAX_MARKERS`] visible candidates are drawn. Work stays bounded by the scan, not the picture.
|
||||
fn pick<T: Copy>(
|
||||
items: impl Iterator<Item = T>,
|
||||
at: impl Fn(T) -> DVec3,
|
||||
half_at: impl Fn(T) -> f32,
|
||||
player: DVec3,
|
||||
gui: (f32, f32),
|
||||
project: &impl Fn(DVec3) -> Option<Point>,
|
||||
) -> Pick<T> {
|
||||
let near = |a: &T, b: &T| at(*a).distance(player).total_cmp(&at(*b).distance(player));
|
||||
let mut items: Vec<T> = items.collect();
|
||||
let total = items.len();
|
||||
// Only the nearest candidates are ever projected: no sort of the whole picture is needed.
|
||||
if items.len() > MAX_SCAN {
|
||||
items.select_nth_unstable_by(MAX_SCAN, near);
|
||||
items.truncate(MAX_SCAN);
|
||||
}
|
||||
items.sort_by(near);
|
||||
let mut marks = Vec::new();
|
||||
let mut offscreen = 0usize;
|
||||
for it in items {
|
||||
if marks.len() >= MAX_MARKERS {
|
||||
break;
|
||||
}
|
||||
let h = half_at(it);
|
||||
match project(at(it)) {
|
||||
Some(p) if p.x >= h && p.x <= gui.0 - h && p.y >= h && p.y <= gui.1 - h => marks.push((it, p, h)),
|
||||
_ => offscreen += 1,
|
||||
}
|
||||
}
|
||||
Pick { capped: total - marks.len() - offscreen, marks, offscreen }
|
||||
}
|
||||
|
||||
/// The overlay's shapes for this frame. `project` is the game's `render.project` (the last drawn
|
||||
/// frame's camera); a point behind the camera projects to None, a point off the screen still
|
||||
/// projects past its edges — both are counted, not drawn. Drawn only while the key is held.
|
||||
pub fn draw(sim: &Sim, player: DVec3, gui: (f32, f32), project: impl Fn(DVec3) -> Option<Point>) -> Vec<Shape> {
|
||||
let mut s = Vec::new();
|
||||
if gui.0 <= 0.0 || gui.1 <= 0.0 {
|
||||
return s;
|
||||
}
|
||||
let pic = sim.air_picture();
|
||||
let now = pic.now;
|
||||
let truth = sim.truth && !pic.unaided;
|
||||
// The frame's counts: what got a marker and what did not — out of the frame (behind the camera
|
||||
// or past an edge) or past the budget. The header keeps the two apart (#141).
|
||||
let mut shown = 0usize;
|
||||
let mut offscreen = 0usize;
|
||||
let mut capped = 0usize;
|
||||
// The network's tracks: the nearest visible keep the markers; a target behind the camera no
|
||||
// longer spends one, so a crowd behind cannot crowd out the target in frame.
|
||||
let net = pick(pic.tracks.iter(), |t| t.est(now), |t| half(t.est(now).distance(player)), player, gui, &project);
|
||||
offscreen += net.offscreen;
|
||||
capped += net.capped;
|
||||
for (t, p, h) in net.marks {
|
||||
// Fresh: red; a forecast: orange, fading as it ages towards the track's drop (the radar's colours).
|
||||
let (color, a) = if pic.unaided {
|
||||
(RED, 1.0)
|
||||
} else if t.forecast(now) {
|
||||
(ORANGE, (1.0 - t.age(now) as f64 / t.ttl.max(1) as f64 * 0.7).max(0.3))
|
||||
} else {
|
||||
(RED, 1.0)
|
||||
};
|
||||
let color = alpha(color, a);
|
||||
s.extend(square_outline(p.x, p.y, h, color));
|
||||
s.push(text(track_label(t, now, player), p.x, label_y(p.y, h, gui.1, false), color, true));
|
||||
shown += 1;
|
||||
}
|
||||
// The truth's own markers: the real drones, even the ones no radar holds, white and labelled
|
||||
// with the actual type the network never shows. A tracked drone wears both: the network's
|
||||
// estimate under the square, the truth over it — the offset between them is the point.
|
||||
if truth {
|
||||
let real = pick(
|
||||
sim.drones.iter().filter(|d| d.alive()),
|
||||
|d| d.pos,
|
||||
|d| half(d.pos.distance(player)) + 2.0,
|
||||
player,
|
||||
gui,
|
||||
&project,
|
||||
);
|
||||
offscreen += real.offscreen;
|
||||
capped += real.capped;
|
||||
for (d, p, h) in real.marks {
|
||||
s.extend(square_outline(p.x, p.y, h, WHITE));
|
||||
let label = format!("{} {}", d.kind.spec().name, distance(d.pos.distance(player)));
|
||||
s.push(text(label, p.x, label_y(p.y, h, gui.1, true), WHITE, true));
|
||||
shown += 1;
|
||||
}
|
||||
}
|
||||
// The player's own interceptors: small yellow squares, no label — they are not targets, and
|
||||
// the network never hid them (the radar has always shown them). They keep their own budget.
|
||||
let own = pick(sim.missiles.iter(), |m| m.pos, |_| MISSILE_HALF, player, gui, &project);
|
||||
for (_, p, h) in own.marks {
|
||||
s.extend(square_outline(p.x, p.y, h, MISSILE));
|
||||
}
|
||||
// The mode, named as the map names it: the network's data by default, the sandbox's truth
|
||||
// explicitly marked. The counts say what the frame holds, what left it, and what the budget cut.
|
||||
let counts = format!("в кадре {shown}, за кадром {offscreen}, сверх бюджета {capped}");
|
||||
let head = if truth {
|
||||
format!("ОБЗОР · ИСТИНА (песочница): белые рамки — реальные дроны · {counts}")
|
||||
} else {
|
||||
format!("ОБЗОР · данные сети РЛС · {counts}")
|
||||
};
|
||||
s.push(text(head, gui.0 / 2.0, 2.0, if truth { YELLOW } else { GREEN }, true));
|
||||
s
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::sim::{DroneKind, Out, Sam, SamKind};
|
||||
|
||||
const GUI: (f32, f32) = (800.0, 600.0);
|
||||
|
||||
/// A projector as the game's: the world ahead lands on the screen, behind the camera None.
|
||||
/// Here: south (+z) is ahead, x spreads across the screen, the height lines up at 64.
|
||||
fn ahead(p: DVec3) -> Option<Point> {
|
||||
if p.z <= 0.0 {
|
||||
return None;
|
||||
}
|
||||
Some(pt(400.0 + p.x as f32, 300.0 - (p.y - 64.0) as f32))
|
||||
}
|
||||
|
||||
fn sim_with(kind: DroneKind, at: DVec3) -> Sim {
|
||||
let mut sim = Sim::new(1);
|
||||
sim.launch(kind, at, DVec3::ZERO, DVec3::new(at.x, 64.0, 5000.0), &mut Out::default());
|
||||
sim
|
||||
}
|
||||
|
||||
fn fills(shapes: &[Shape], rgb: u32) -> usize {
|
||||
shapes.iter().filter(|s| matches!(s, Shape::Fill(f) if f.color & 0xFFFFFF == rgb & 0xFFFFFF)).count()
|
||||
}
|
||||
|
||||
fn texts(shapes: &[Shape]) -> Vec<&TextShape> {
|
||||
shapes.iter().filter_map(|s| match s {
|
||||
Shape::Text(t) => Some(t),
|
||||
_ => None,
|
||||
}).collect()
|
||||
}
|
||||
|
||||
fn head(shapes: &[Shape]) -> String {
|
||||
texts(shapes).into_iter().find(|t| t.text.starts_with("ОБЗОР")).expect("no header").text.clone()
|
||||
}
|
||||
|
||||
/// `n` targets in a row right behind the camera, each nearer than anything the tests put ahead.
|
||||
fn crowd_behind(sim: &mut Sim, n: u32) {
|
||||
for i in 0..n {
|
||||
sim.launch(DroneKind::Shahed, DVec3::new(i as f64, 64.0, -50.0), DVec3::ZERO, DVec3::new(0.0, 64.0, -5000.0), &mut Out::default());
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_visible_target_gets_a_square_and_a_short_line() {
|
||||
let sim = sim_with(DroneKind::Shahed, DVec3::new(0.0, 64.0, 100.0));
|
||||
let shapes = draw(&sim, DVec3::new(0.0, 64.0, 0.0), GUI, ahead);
|
||||
// One marker: four red sides, and a label with the firm class's mark and the distance.
|
||||
assert_eq!(fills(&shapes, RED), 4, "the marker is not one square outline");
|
||||
let label = texts(&shapes).into_iter().find(|t| t.text.contains("100 м")).expect("no distance label");
|
||||
assert!(label.text.starts_with("Д "), "the firm drone class is not marked: {}", label.text);
|
||||
assert!(label.centered && label.at.y > 300.0, "the label sits under the square");
|
||||
// The header names the network's data and the counts.
|
||||
let head = texts(&shapes).into_iter().find(|t| t.text.starts_with("ОБЗОР")).unwrap();
|
||||
assert!(head.text.contains("данные сети РЛС") && head.text.contains("в кадре 1, за кадром 0"), "{}", head.text);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn behind_the_camera_and_off_screen_are_counted_not_drawn() {
|
||||
let mut sim = sim_with(DroneKind::Shahed, DVec3::new(0.0, 64.0, 100.0));
|
||||
sim.launch(DroneKind::Shahed, DVec3::new(0.0, 64.0, -100.0), DVec3::ZERO, DVec3::new(0.0, 64.0, -5000.0), &mut Out::default());
|
||||
let shapes = draw(&sim, DVec3::ZERO, GUI, ahead);
|
||||
assert_eq!(fills(&shapes, RED), 4, "the drone behind the camera drew a marker");
|
||||
let head = texts(&shapes).into_iter().find(|t| t.text.starts_with("ОБЗОР")).unwrap();
|
||||
assert!(head.text.contains("в кадре 1, за кадром 1"), "{}", head.text);
|
||||
// Off the screen's edge: still a place, but no marker.
|
||||
let shapes = draw(&sim, DVec3::ZERO, GUI, |_| Some(pt(-40.0, 300.0)));
|
||||
assert_eq!(fills(&shapes, RED), 0);
|
||||
let head = texts(&shapes).into_iter().find(|t| t.text.starts_with("ОБЗОР")).unwrap();
|
||||
assert!(head.text.contains("в кадре 0, за кадром 2"), "{}", head.text);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_label_never_leaks_the_type_of_an_unidentified_track() {
|
||||
let t = Track { id: 1, class: ClassEst::Unknown, pos: DVec3::new(0.0, 64.0, 100.0), vel: DVec3::ZERO, tick: 0, own_tick: 0, source: 0, product: crate::sim::battery::Measure::Search, quality: 40, own_product: crate::sim::battery::Measure::Search, own_quality: 0, ttl: 200, hits: 1, locked: false };
|
||||
let label = track_label(&t, 0, DVec3::ZERO);
|
||||
assert!(label.starts_with("? "), "{label}");
|
||||
assert!(!label.contains("дрон") && !label.contains("Шахед"), "{label}");
|
||||
// A probable class keeps its question mark; a firm one loses it.
|
||||
let t = Track { class: ClassEst::Probable(crate::sim::Class::Cruise), ..t };
|
||||
assert!(track_label(&t, 0, DVec3::ZERO).starts_with("К? "));
|
||||
let t = Track { class: ClassEst::Firm(crate::sim::Class::Cruise), hits: 3, ..t };
|
||||
assert!(track_label(&t, 0, DVec3::ZERO).starts_with("К "));
|
||||
// A forecast says its age.
|
||||
let label = track_label(&t, 100, DVec3::ZERO);
|
||||
assert!(label.contains("~5с"), "{label}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_truth_mode_marks_the_real_drones_apart_from_the_network() {
|
||||
let mut sim = sim_with(DroneKind::Shahed, DVec3::new(0.0, 64.0, 100.0));
|
||||
let id = sim.id();
|
||||
sim.sams.push(Sam::new(id, SamKind::Buk, DVec3::new(0.0, 64.0, 0.0), 0.0));
|
||||
// Without the truth mode: no white markers, no actual type anywhere.
|
||||
let shapes = draw(&sim, DVec3::ZERO, GUI, ahead);
|
||||
assert_eq!(fills(&shapes, WHITE), 0);
|
||||
assert!(!texts(&shapes).iter().any(|t| t.text.contains("Шахед")), "the network overlay leaked the type");
|
||||
// With it: a white square with the real type, and the header says whose picture it is.
|
||||
sim.truth = true;
|
||||
let shapes = draw(&sim, DVec3::new(0.0, 64.0, 0.0), GUI, ahead);
|
||||
assert_eq!(fills(&shapes, WHITE), 4, "the truth marker is not one white square");
|
||||
let label = texts(&shapes).into_iter().find(|t| t.text.contains("Шахед-136")).expect("no truth label");
|
||||
assert!(label.text.contains("100 м") && label.at.y < 300.0, "the truth label sits over the square: {label:?}");
|
||||
let head = texts(&shapes).into_iter().find(|t| t.text.starts_with("ОБЗОР")).unwrap();
|
||||
assert!(head.text.contains("ИСТИНА (песочница)"), "{}", head.text);
|
||||
// The truth mode with no system deployed adds nothing: the sky as it is was already shown.
|
||||
sim.sams.clear();
|
||||
let shapes = draw(&sim, DVec3::ZERO, GUI, ahead);
|
||||
assert_eq!(fills(&shapes, WHITE), 0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_full_raid_stays_inside_the_huds_shape_budget() {
|
||||
let mut sim = Sim::new(1);
|
||||
sim.raid(DroneKind::Shahed, DVec3::new(0.0, 64.0, 0.0), 80, 300.0, &mut Out::default());
|
||||
sim.truth = true;
|
||||
let shapes = draw(&sim, DVec3::ZERO, GUI, ahead);
|
||||
assert!(shapes.len() <= 1024, "the overlay overflowed the HUD: {} shapes", shapes.len());
|
||||
// The nearest markers were kept, the rest counted.
|
||||
let head = texts(&shapes).into_iter().find(|t| t.text.starts_with("ОБЗОР")).unwrap();
|
||||
assert!(head.text.contains("за кадром"), "{}", head.text);
|
||||
assert!(fills(&shapes, RED) / 4 <= MAX_MARKERS);
|
||||
}
|
||||
|
||||
/// #141: 64 targets behind the camera and one in frame. The budget used to be spent on the
|
||||
/// crowd before the visibility check, so the picture came out empty; the target in frame must
|
||||
/// keep its marker, and the crowd is out of frame, not past the budget.
|
||||
#[test]
|
||||
fn a_crowd_behind_the_camera_leaves_the_network_budget_to_the_target_in_frame() {
|
||||
let mut sim = Sim::new(1);
|
||||
crowd_behind(&mut sim, 64);
|
||||
sim.launch(DroneKind::Shahed, DVec3::new(0.0, 64.0, 100.0), DVec3::ZERO, DVec3::new(0.0, 64.0, 5000.0), &mut Out::default());
|
||||
let shapes = draw(&sim, DVec3::new(0.0, 64.0, 0.0), GUI, ahead);
|
||||
assert_eq!(fills(&shapes, RED), 4, "the target in frame got no marker");
|
||||
assert_eq!(head(&shapes), "ОБЗОР · данные сети РЛС · в кадре 1, за кадром 64, сверх бюджета 0");
|
||||
assert!(shapes.len() <= 1024, "{} shapes", shapes.len());
|
||||
}
|
||||
|
||||
/// The truth layer keeps its own budget the same way: the real drone in frame is drawn, the
|
||||
/// crowd behind the camera costs no white marker.
|
||||
#[test]
|
||||
fn a_crowd_behind_the_camera_leaves_the_truth_budget_to_the_target_in_frame() {
|
||||
let mut sim = Sim::new(1);
|
||||
let id = sim.id();
|
||||
sim.sams.push(Sam::new(id, SamKind::Buk, DVec3::new(0.0, 64.0, 0.0), 0.0));
|
||||
sim.truth = true;
|
||||
crowd_behind(&mut sim, 64);
|
||||
sim.launch(DroneKind::Shahed, DVec3::new(0.0, 64.0, 100.0), DVec3::ZERO, DVec3::new(0.0, 64.0, 5000.0), &mut Out::default());
|
||||
let shapes = draw(&sim, DVec3::new(0.0, 64.0, 0.0), GUI, ahead);
|
||||
assert_eq!(fills(&shapes, WHITE), 4, "the drone in frame got no truth marker");
|
||||
assert_eq!(fills(&shapes, RED), 0, "the network drew a track it does not hold");
|
||||
assert_eq!(head(&shapes), "ОБЗОР · ИСТИНА (песочница): белые рамки — реальные дроны · в кадре 1, за кадром 64, сверх бюджета 0");
|
||||
assert!(shapes.len() <= 1024, "{} shapes", shapes.len());
|
||||
}
|
||||
|
||||
/// The interceptors keep their own budget too: a salvo behind the camera leaves the marker
|
||||
/// to the one in frame.
|
||||
#[test]
|
||||
fn a_crowd_behind_the_camera_leaves_the_interceptor_budget_to_the_one_in_frame() {
|
||||
let mut sim = Sim::new(1);
|
||||
for i in 0..64 {
|
||||
sim.missiles.push(crate::sim::Missile::test_at(i + 1, DVec3::new(i as f64, 64.0, -50.0), 0));
|
||||
}
|
||||
sim.missiles.push(crate::sim::Missile::test_at(100, DVec3::new(0.0, 64.0, 100.0), 0));
|
||||
let shapes = draw(&sim, DVec3::new(0.0, 64.0, 0.0), GUI, ahead);
|
||||
assert_eq!(fills(&shapes, MISSILE), 4, "the interceptor in frame got no marker");
|
||||
assert!(shapes.len() <= 1024, "{} shapes", shapes.len());
|
||||
}
|
||||
|
||||
/// The header tells what really left the frame from what the draw budget cut, and the markers
|
||||
/// go to the nearest of the visible: 64 behind the camera, 65 in frame.
|
||||
#[test]
|
||||
fn the_header_separates_the_frames_edge_from_the_draw_budget() {
|
||||
let mut sim = Sim::new(1);
|
||||
crowd_behind(&mut sim, 64);
|
||||
for i in 0..65 {
|
||||
let z = 100.0 + i as f64 * 10.0;
|
||||
sim.launch(DroneKind::Shahed, DVec3::new(0.0, 64.0, z), DVec3::ZERO, DVec3::new(0.0, 64.0, 5000.0), &mut Out::default());
|
||||
}
|
||||
let shapes = draw(&sim, DVec3::new(0.0, 64.0, 0.0), GUI, ahead);
|
||||
// The 64 nearest in frame are drawn; the farthest one is past the draw budget, not out of frame.
|
||||
assert_eq!(fills(&shapes, RED), 4 * MAX_MARKERS);
|
||||
assert!(texts(&shapes).iter().any(|t| t.text.contains("100 м")), "the nearest visible lost its marker");
|
||||
assert!(!texts(&shapes).iter().any(|t| t.text.contains("740 м")), "the farthest visible took a nearer one's marker");
|
||||
assert_eq!(head(&shapes), "ОБЗОР · данные сети РЛС · в кадре 64, за кадром 64, сверх бюджета 1");
|
||||
assert!(shapes.len() <= 1024, "{} shapes", shapes.len());
|
||||
}
|
||||
|
||||
/// The projection work itself is bounded: with more candidates than the scan budget, only the
|
||||
/// nearest `MAX_SCAN` are looked at, and the rest are counted as past the budget.
|
||||
#[test]
|
||||
fn the_projection_work_is_bounded_by_the_scan_budget() {
|
||||
let mut sim = Sim::new(1);
|
||||
for i in 0..1000 {
|
||||
sim.launch(DroneKind::Shahed, DVec3::new((i % 100) as f64, 64.0, -50.0), DVec3::ZERO, DVec3::new(0.0, 64.0, -5000.0), &mut Out::default());
|
||||
}
|
||||
let calls = std::cell::Cell::new(0usize);
|
||||
let shapes = draw(&sim, DVec3::new(0.0, 64.0, 0.0), GUI, |p| {
|
||||
calls.set(calls.get() + 1);
|
||||
ahead(p)
|
||||
});
|
||||
assert_eq!(calls.get(), MAX_SCAN, "one layer projected more than its scan budget");
|
||||
assert_eq!(head(&shapes), "ОБЗОР · данные сети РЛС · в кадре 0, за кадром 256, сверх бюджета 744");
|
||||
assert!(shapes.len() <= 1024, "{} shapes", shapes.len());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn interceptors_wear_small_yellow_squares_without_labels() {
|
||||
let mut sim = sim_with(DroneKind::Shahed, DVec3::new(0.0, 64.0, 100.0));
|
||||
sim.missiles.push(crate::sim::Missile::test_at(1, DVec3::new(10.0, 70.0, 120.0), 0));
|
||||
sim.missiles.push(crate::sim::Missile::test_at(2, DVec3::new(0.0, 64.0, -50.0), 0));
|
||||
let shapes = draw(&sim, DVec3::ZERO, GUI, ahead);
|
||||
// The one ahead: four yellow sides; the one behind the camera: nothing.
|
||||
assert_eq!(fills(&shapes, MISSILE), 4);
|
||||
assert!(!texts(&shapes).iter().any(|t| t.text.contains("перехват")), "an interceptor is not a target");
|
||||
// The budget holds with a full salvo too.
|
||||
for id in 3..100 {
|
||||
sim.missiles.push(crate::sim::Missile::test_at(id, DVec3::new(id as f64, 64.0, 100.0), 0));
|
||||
}
|
||||
let shapes = draw(&sim, DVec3::ZERO, GUI, ahead);
|
||||
assert!(shapes.len() <= 1024, "{} shapes", shapes.len());
|
||||
assert!(fills(&shapes, MISSILE) / 4 <= MAX_MARKERS);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn labels_flip_over_the_square_near_the_edges() {
|
||||
// Near the bottom: the label goes over the square; near the top: under it.
|
||||
assert!(label_y(590.0, 10.0, 600.0, false) < 590.0);
|
||||
assert!(label_y(10.0, 10.0, 600.0, true) > 10.0);
|
||||
assert!(label_y(300.0, 10.0, 600.0, false) > 300.0);
|
||||
assert!(label_y(300.0, 10.0, 600.0, true) < 300.0);
|
||||
}
|
||||
}
|
||||
+12
-106
@@ -1,6 +1,6 @@
|
||||
//! The summary panel (top right): the alert, what is in the air, each
|
||||
//! air-defence system's state and the score.
|
||||
use crate::sim::{AirPicture, Class, ClassEst, Sim};
|
||||
use crate::sim::{AirPicture, DroneKind, Sim};
|
||||
use glam::DVec3;
|
||||
use horizon_mod_sdk::hud::Line;
|
||||
|
||||
@@ -31,50 +31,28 @@ pub fn summary(sim: &Sim, pic: &AirPicture, player: DVec3) -> Vec<Line> {
|
||||
} else {
|
||||
let blink = (sim.tick / 10) % 2 == 0;
|
||||
lines.push(line(format!("ВОЗДУШНАЯ ТРЕВОГА — целей: {}", pic.tracks.len()), if blink { RED } else { PINK }));
|
||||
// By the class the tracks were estimated (#133): probable and firm counted apart, the
|
||||
// unidentified named — the exact models stay in the sandbox's truth line.
|
||||
// By type, as the radars classed them.
|
||||
let mut by_type = String::new();
|
||||
for c in Class::ALL {
|
||||
let firm = pic.tracks.iter().filter(|t| t.class == ClassEst::Firm(c)).count();
|
||||
let prob = pic.tracks.iter().filter(|t| t.class == ClassEst::Probable(c)).count();
|
||||
for (n, pre) in [(firm, ""), (prob, "вер. ")] {
|
||||
if n > 0 {
|
||||
if !by_type.is_empty() {
|
||||
by_type += ", ";
|
||||
}
|
||||
by_type += &format!("{pre}{} ×{n}", c.name());
|
||||
for kind in DroneKind::ALL {
|
||||
let n = pic.tracks.iter().filter(|t| t.kind == kind).count();
|
||||
if n > 0 {
|
||||
if !by_type.is_empty() {
|
||||
by_type += ", ";
|
||||
}
|
||||
by_type += &format!("{} ×{n}", kind.spec().name);
|
||||
}
|
||||
}
|
||||
let unknown = pic.tracks.iter().filter(|t| t.class == ClassEst::Unknown).count();
|
||||
if unknown > 0 {
|
||||
if !by_type.is_empty() {
|
||||
by_type += ", ";
|
||||
}
|
||||
by_type += &format!("не опознано ×{unknown}");
|
||||
}
|
||||
lines.push(line(by_type, PINK));
|
||||
// The nearest track to the player: where it was last measured (a forecast says so, with its age).
|
||||
if let Some(t) = pic.nearest(player) {
|
||||
let e = t.est(now);
|
||||
let mark = if t.forecast(now) { format!(" ~{}с", t.age(now) / 20) } else { String::new() };
|
||||
lines.push(line(
|
||||
format!("Ближ.: {} {} выс.{:.0} {:.0}км/ч · {} кач.{}{mark}", t.class.name(), distance(e.distance(player)), e.y - player.y, kmh(t.vel), t.product.name(), t.quality),
|
||||
format!("Ближ.: {} {} выс.{:.0} {:.0}км/ч{mark}", t.kind.spec().name, distance(e.distance(player)), e.y - player.y, kmh(t.vel)),
|
||||
PINK,
|
||||
));
|
||||
}
|
||||
}
|
||||
// Recon aircraft the network tracks: their presence and the coarse phase of the flight. This is
|
||||
// what the visible aircraft are doing, not the enemy's knowledge — the marks and the reasons are
|
||||
// the debug command's and the after-action review's alone (#135).
|
||||
let recon_n = pic.tracks.iter().filter(|t| crate::sim::is_drone_id(t.id)).count();
|
||||
if recon_n > 0 {
|
||||
let mut text = format!("Разведка противника: разведчиков в воздухе {recon_n}");
|
||||
if let Some(phase) = crate::recon_view::battle_phase(&sim.enemy_picture()) {
|
||||
text += &format!(" · фаза: {phase}");
|
||||
}
|
||||
lines.push(line(text, YELLOW));
|
||||
}
|
||||
if sim.truth {
|
||||
let real = sim.drones.iter().filter(|d| d.alive()).count();
|
||||
let unseen = sim.drones.iter().filter(|d| d.alive() && pic.get(d.id).is_none()).count();
|
||||
@@ -83,12 +61,6 @@ pub fn summary(sim: &Sim, pic: &AirPicture, player: DVec3) -> Vec<Line> {
|
||||
text += ", противник планирует налёт";
|
||||
}
|
||||
lines.push(line(text, YELLOW));
|
||||
// The recon phase, in the truth only: the aircraft out and the marks the enemy holds
|
||||
// are its knowledge, not the player's (#135).
|
||||
let (out, marks) = sim.recon_status();
|
||||
if out > 0 || marks > 0 {
|
||||
lines.push(line(format!("РАЗВЕДКА ПРОТИВНИКА: в воздухе {out}, отметок в картине {marks}"), YELLOW));
|
||||
}
|
||||
}
|
||||
// The launch sites found, and the strike missiles (#101).
|
||||
if !sim.strikes.known.is_empty() || !sim.strikes.flights.is_empty() {
|
||||
@@ -105,11 +77,6 @@ pub fn summary(sim: &Sim, pic: &AirPicture, player: DVec3) -> Vec<Line> {
|
||||
let worst = sim.target_health.iter().copied().fold(100.0, f64::min);
|
||||
lines.push(line(format!("Объекты: {}", list.join(" ")), if worst < 50.0 { RED } else { GREEN }));
|
||||
}
|
||||
// The passive optical posts (#136): their own status and source, never a radar's emission.
|
||||
let optics = sim.optical_reports();
|
||||
if let Some(r) = optics.iter().find(|r| r.state == crate::sim::OpticalState::Observing).or_else(|| optics.first()) {
|
||||
lines.push(line(format!("Опт. №{}: {}", r.index, r.line()), CYAN));
|
||||
}
|
||||
let lost = sim.sams.iter().filter(|s| !s.alive()).count();
|
||||
if lost > 0 {
|
||||
lines.push(line(format!("Потеряно комплексов: {lost}"), RED));
|
||||
@@ -127,12 +94,12 @@ pub fn summary(sim: &Sim, pic: &AirPicture, player: DVec3) -> Vec<Line> {
|
||||
}
|
||||
for sam in sim.sams.iter().take(shown) {
|
||||
let mut text = if sam.kind.armed() {
|
||||
format!("{} [{}]", crate::battery_view::sam_status(sam, now), crate::sim::roles_text(sam.roles))
|
||||
format!("{} [{}]", sam.status(), crate::sim::roles_text(sam.roles))
|
||||
} else {
|
||||
crate::battery_view::sam_status(sam, now)
|
||||
sam.status()
|
||||
};
|
||||
if let Some(t) = sam.gun_target.or(sam.target).and_then(|t| pic.get(t)) {
|
||||
text += &format!(" > {} {}", t.class.name(), distance(t.est(now).distance(sam.pos)));
|
||||
text += &format!(" > {} {}", t.kind.spec().name, distance(t.est(now).distance(sam.pos)));
|
||||
}
|
||||
if sam.kills > 0 {
|
||||
text += &format!(" ({})", sam.kills);
|
||||
@@ -152,64 +119,3 @@ pub fn summary(sim: &Sim, pic: &AirPicture, player: DVec3) -> Vec<Line> {
|
||||
));
|
||||
lines
|
||||
}
|
||||
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::sim::{Aim, AirPicture, Approach, DroneKind, Out, RaidOrder, Track};
|
||||
use glam::DVec3;
|
||||
|
||||
fn track(id: u32, class: ClassEst) -> Track {
|
||||
Track { id, class, pos: DVec3::new(0.0, 120.0, 300.0), vel: DVec3::new(0.0, 0.0, -0.5), tick: 100, own_tick: 100, source: 0, product: crate::sim::battery::Measure::Search, quality: 40, own_product: crate::sim::battery::Measure::Search, own_quality: 0, ttl: 200, hits: 3, locked: false }
|
||||
}
|
||||
|
||||
// A recon aircraft the network holds is named as such, with the flight's coarse phase; the line
|
||||
// carries no mark, area or priority — the enemy's knowledge is not the HUD's (#135).
|
||||
#[test]
|
||||
fn a_tracked_recon_aircraft_shows_presence_and_phase_not_marks() {
|
||||
let mut sim = Sim::new(135);
|
||||
let object = DVec3::new(0.0, 70.0, 0.0);
|
||||
sim.targets.push(object);
|
||||
sim.target_health.push(100.0);
|
||||
let order = RaidOrder { kinds: vec![(DroneKind::Shahed, 2)], approach: Approach::Sector, dist: 300.0, aim: Aim::Smart };
|
||||
sim.order_raid(&order, &[object], &mut Out::default());
|
||||
let pic = sim.air_picture();
|
||||
assert!(pic.tracks.iter().any(|t| crate::sim::is_drone_id(t.id)), "the smart wave sent no recon to track");
|
||||
let lines = summary(&sim, &pic, DVec3::ZERO);
|
||||
let recon = lines.iter().find(|l| l.text.contains("Разведка противника")).expect("no recon line");
|
||||
assert!(recon.text.contains("разведчиков в воздухе"), "{}", recon.text);
|
||||
assert!(recon.text.contains("фаза:"), "the flight's phase was not shown: {}", recon.text);
|
||||
assert!(!recon.text.contains("приоритет") && !recon.text.contains("Отметка"), "the HUD leaked the enemy's marks: {}", recon.text);
|
||||
assert!(lines.iter().all(|l| !l.text.contains("Отметка") && !l.text.contains("приоритет")), "a mark reached the normal HUD");
|
||||
}
|
||||
|
||||
// An ordinary strike track is not a recon flight: no recon line appears.
|
||||
#[test]
|
||||
fn an_ordinary_track_is_not_called_recon() {
|
||||
let sim = Sim::new(1);
|
||||
let pic = AirPicture { now: 100, tracks: vec![track(1, ClassEst::Firm(Class::Drone))], unaided: false };
|
||||
let lines = summary(&sim, &pic, DVec3::ZERO);
|
||||
assert!(lines.iter().all(|l| !l.text.contains("Разведка противника")), "{lines:?}");
|
||||
}
|
||||
|
||||
// A recon id in the picture is enough for the presence line even without a live sortie (a flight
|
||||
// finishing its way home): the phase is then omitted, the presence stays.
|
||||
#[test]
|
||||
fn a_recon_track_without_a_sortie_still_names_the_presence() {
|
||||
let sim = Sim::new(1);
|
||||
let pic = AirPicture { now: 100, tracks: vec![track(0x3000_0001, ClassEst::Firm(Class::Drone))], unaided: false };
|
||||
let lines = summary(&sim, &pic, DVec3::ZERO);
|
||||
let recon = lines.iter().find(|l| l.text.contains("Разведка противника")).expect("no recon line");
|
||||
assert!(recon.text.contains("разведчиков в воздухе 1"), "{}", recon.text);
|
||||
assert!(!recon.text.contains("фаза:"), "a phase was invented without a sortie: {}", recon.text);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn an_empty_sky_has_no_recon_line() {
|
||||
let sim = Sim::new(1);
|
||||
let pic = AirPicture { now: 100, tracks: Vec::new(), unaided: false };
|
||||
let lines = summary(&sim, &pic, DVec3::ZERO);
|
||||
assert!(lines.iter().all(|l| !l.text.contains("Разведка противника")), "{lines:?}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,315 +0,0 @@
|
||||
//! The command post lists every deployed unit without requesting camera views.
|
||||
use crate::sim::{Part, PartState, Sam, SamKind, SamState, battery::RadarRole, decision, record::Recording};
|
||||
|
||||
/// Keep enough room under the engine's 512-row limit for large layouts.
|
||||
pub const PAGE_SIZE: usize = 200;
|
||||
|
||||
#[derive(Clone, Copy, Default, PartialEq, Eq, Debug)]
|
||||
pub enum Filter {
|
||||
#[default]
|
||||
All,
|
||||
Weapons,
|
||||
Sensors,
|
||||
Support,
|
||||
InCombat,
|
||||
NoAmmo,
|
||||
NoLink,
|
||||
Damaged,
|
||||
}
|
||||
|
||||
impl Filter {
|
||||
pub const ALL: [Self; 8] = [
|
||||
Self::All, Self::Weapons, Self::Sensors, Self::Support, Self::InCombat,
|
||||
Self::NoAmmo, Self::NoLink, Self::Damaged,
|
||||
];
|
||||
|
||||
pub fn next(self) -> Self {
|
||||
Self::ALL[(self as usize + 1) % Self::ALL.len()]
|
||||
}
|
||||
|
||||
pub fn short_label(self) -> &'static str {
|
||||
match self {
|
||||
Self::All => "Все",
|
||||
Self::Weapons => "Огневые",
|
||||
Self::Sensors => "РЛС/Опт",
|
||||
Self::Support => "Тыл",
|
||||
Self::InCombat => "В бою",
|
||||
Self::NoAmmo => "Нет БК",
|
||||
Self::NoLink => "Нет связи",
|
||||
Self::Damaged => "Повр.",
|
||||
}
|
||||
}
|
||||
|
||||
pub fn label(self) -> &'static str {
|
||||
match self {
|
||||
Self::All => "Все",
|
||||
Self::Weapons => "Огневые",
|
||||
Self::Sensors => "Наблюдение",
|
||||
Self::Support => "Поддержка",
|
||||
Self::InCombat => "В работе",
|
||||
Self::NoAmmo => "Без боезапаса",
|
||||
Self::NoLink => "Отказ связи",
|
||||
Self::Damaged => "Повреждённые",
|
||||
}
|
||||
}
|
||||
|
||||
fn matches(self, sam: &Sam) -> bool {
|
||||
let sensor = matches!(sam.kind, SamKind::Radar | SamKind::Optical);
|
||||
match self {
|
||||
Self::All => true,
|
||||
Self::Weapons => sam.kind.armed(),
|
||||
Self::Sensors => sensor,
|
||||
Self::Support => !sam.kind.armed() && !sensor,
|
||||
Self::InCombat => sam.alive() && (
|
||||
matches!(sam.state, SamState::Track | SamState::Slew | SamState::Lock | SamState::Launch | SamState::Fire)
|
||||
|| sam.ew_on
|
||||
|| (sensor && !sam.own.is_empty())
|
||||
|| (sam.kind == SamKind::Optical && sam.optical.state() == crate::sim::OpticalState::Observing)
|
||||
),
|
||||
Self::NoAmmo => sam.alive() && sam.kind.armed() && sam.missiles == 0 && sam.bursts == 0,
|
||||
Self::NoLink => sam.alive() && Part::Comms.on(sam.kind) && sam.part_state(Part::Comms) == PartState::Failed,
|
||||
Self::Damaged => sam.health < 1.0 || !sam.comps.whole(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
|
||||
pub enum From {
|
||||
World,
|
||||
Post,
|
||||
Map(u32),
|
||||
Monitor,
|
||||
Source,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
pub enum Action {
|
||||
Checks,
|
||||
Map,
|
||||
Camera,
|
||||
Source(u32),
|
||||
Pin,
|
||||
History,
|
||||
LatestDecision,
|
||||
}
|
||||
|
||||
pub enum Transition {
|
||||
Map { unit: u32, centre: bool },
|
||||
Card(u32),
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct Post {
|
||||
pub filter: Filter,
|
||||
pub query: String,
|
||||
pub page: usize,
|
||||
pub pinned: Option<u32>,
|
||||
/// IDs and actions exactly as shown in the screen, even if the sim advances before a click.
|
||||
pub shown: Vec<u32>,
|
||||
pub actions: Vec<Action>,
|
||||
pub decisions: Vec<RecordedChoice>,
|
||||
pub source_origin: Option<(u32, From)>,
|
||||
/// Let the client finish closing one screen before opening a different kind.
|
||||
pub transition: Option<(Transition, bool)>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct RecordedChoice {
|
||||
pub raid: u32,
|
||||
pub entry: decision::Entry,
|
||||
}
|
||||
|
||||
pub fn recorded_choices<'a>(recordings: impl Iterator<Item = &'a Recording> + 'a, unit: u32) -> impl Iterator<Item = RecordedChoice> + 'a {
|
||||
recordings.flat_map(move |rec| rec.decisions.entries().rev()
|
||||
.filter(move |entry| entry.unit == unit)
|
||||
.map(move |&entry| RecordedChoice { raid: rec.number, entry }))
|
||||
}
|
||||
|
||||
pub fn decision_label(outcome: decision::Outcome) -> &'static str {
|
||||
use decision::{Block as B, Outcome as O};
|
||||
match outcome {
|
||||
O::Held(B::Hold) => "Огонь запрещён",
|
||||
O::Held(B::Moving) => "Комплекс на марше",
|
||||
O::Held(B::Reload) => "Перезарядка",
|
||||
O::Held(B::Empty) => "Ожидает пополнения",
|
||||
O::Held(B::NoSelection) => "Цель не назначена",
|
||||
O::Held(B::WaitingForTerrain) => "Ожидает данных о рельефе",
|
||||
O::Held(B::Terrain) => "Траектория перекрыта",
|
||||
O::Held(B::Aim) => "Доворачивается",
|
||||
O::Held(B::Opening) => "Открывает ТПК",
|
||||
O::Held(B::BusyWithGroundShot) => "Готовит наземный пуск",
|
||||
O::Held(B::Cooldown) => "Пауза между выстрелами",
|
||||
O::Held(B::GunFault) => "Орудие недоступно",
|
||||
O::Held(B::LauncherFault) => "Пусковая недоступна",
|
||||
O::Held(B::NoLock) => "Нет свежего захвата",
|
||||
O::Held(B::Range) => "Вне дальности орудия",
|
||||
O::Burst => "Очередь выпущена",
|
||||
O::BurstMissed => "Промах очереди",
|
||||
O::BurstHit | O::Intercepted(_) => "Цель сбита",
|
||||
O::Launched(_) => "Ракета выпущена",
|
||||
O::InterceptorMissed(_) => "Промах перехватчика",
|
||||
O::InterceptorEnded(_) => "Полёт перехватчика завершён",
|
||||
}
|
||||
}
|
||||
|
||||
pub fn decision_lines(choice: RecordedChoice, rec: Option<&Recording>) -> Vec<String> {
|
||||
use decision::{Channel, Outcome};
|
||||
let entry = choice.entry;
|
||||
let channel = match entry.channel {
|
||||
Channel::Launcher => "Пусковая",
|
||||
Channel::Gun => "Орудие",
|
||||
Channel::Unit => "Комплекс",
|
||||
};
|
||||
let mut lines = vec![
|
||||
format!("Налёт №{} · {} · {channel}", choice.raid, crate::replay::clock(f64::from(entry.at))),
|
||||
format!("На тот момент · {}", decision_label(entry.outcome)),
|
||||
];
|
||||
if matches!(entry.outcome, Outcome::Held(_)) {
|
||||
lines.push("На этой проверке выстрела не было".to_owned());
|
||||
}
|
||||
if let Some(target) = entry.target {
|
||||
lines.push(format!("Трек №{target}"));
|
||||
}
|
||||
if let Some(mark) = entry.mark {
|
||||
let source = if mark.own { "своя отметка".to_owned() } else {
|
||||
rec.and_then(|rec| rec.sams.iter().position(|s| s.0 == mark.source))
|
||||
.map_or_else(|| format!("источник ID {}", mark.source), |i| format!("источник №{}", i + 1))
|
||||
};
|
||||
lines.push(format!("{source} · {:.1} с назад", f64::from(mark.age) / 20.0));
|
||||
lines.push(format!("{} · {} · качество {}", mark.product.name(), mark.class.name(), mark.quality));
|
||||
}
|
||||
if let Outcome::Launched(id) | Outcome::Intercepted(id) | Outcome::InterceptorMissed(id) | Outcome::InterceptorEnded(id) = entry.outcome {
|
||||
lines.push(format!("Перехватчик ID {id}"));
|
||||
}
|
||||
lines
|
||||
}
|
||||
|
||||
impl Post {
|
||||
pub fn matching(&self, sams: &[Sam]) -> Vec<usize> {
|
||||
let number = self.query.trim_start_matches('№').parse::<usize>().ok();
|
||||
let mut rows: Vec<_> = sams.iter().enumerate()
|
||||
.filter(|(i, sam)| self.filter.matches(sam) && (self.query.is_empty()
|
||||
|| number == Some(i + 1)
|
||||
|| sam.kind.key().contains(&self.query)
|
||||
|| sam.kind.name().to_lowercase().contains(&self.query)))
|
||||
.map(|(i, _)| i)
|
||||
.collect();
|
||||
if let Some(i) = rows.iter().position(|&i| self.pinned == Some(sams[i].id)) {
|
||||
let pinned = rows.remove(i);
|
||||
rows.insert(0, pinned);
|
||||
}
|
||||
rows
|
||||
}
|
||||
}
|
||||
|
||||
pub fn state(sam: &Sam) -> &'static str {
|
||||
if !sam.alive() {
|
||||
return "Уничтожен";
|
||||
}
|
||||
if sam.moving() {
|
||||
return sam.state.name();
|
||||
}
|
||||
match sam.kind {
|
||||
SamKind::Optical => sam.optical.state().name(),
|
||||
SamKind::Radar if !sam.radar_on => "Излучение выкл.",
|
||||
SamKind::Radar if !sam.radar_up() => "РЛС недоступна",
|
||||
SamKind::Radar if !sam.own.is_empty() => "Есть отметки",
|
||||
SamKind::Ew if sam.ew_on => "Активна",
|
||||
SamKind::Ew | SamKind::Depot | SamKind::Tzm | SamKind::Light => "На позиции",
|
||||
_ => sam.state.name(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn row(sam: &Sam, index: usize, pinned: bool) -> String {
|
||||
let name = match sam.kind {
|
||||
SamKind::Radar => match sam.radar_role {
|
||||
RadarRole::Search => "РЛС обзора",
|
||||
RadarRole::Engagement => "РЛС сопровождения",
|
||||
RadarRole::Height => "РЛС высоты",
|
||||
RadarRole::Multifunction => "РЛС",
|
||||
},
|
||||
SamKind::Depot => "Склад",
|
||||
_ => sam.kind.name(),
|
||||
};
|
||||
let status = if Filter::NoLink.matches(sam) {
|
||||
"Нет связи"
|
||||
} else if Filter::NoAmmo.matches(sam) && sam.reloading == 0 {
|
||||
"Нет БК"
|
||||
} else {
|
||||
state(sam)
|
||||
};
|
||||
let pin = if pinned { "★ " } else { "" };
|
||||
let health = if sam.alive() && Filter::Damaged.matches(sam) {
|
||||
format!(" · {:.0}%", sam.health * 100.0)
|
||||
} else {
|
||||
String::new()
|
||||
};
|
||||
format!("{pin}№{} {name} · {status}{health}", index + 1)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use glam::DVec3;
|
||||
|
||||
#[test]
|
||||
fn the_post_includes_support_and_searches_names_keys_and_shown_numbers() {
|
||||
let sams = [
|
||||
Sam::new(77, SamKind::Pantsir, DVec3::ZERO, 0.0),
|
||||
Sam::new(90, SamKind::Depot, DVec3::ZERO, 0.0),
|
||||
Sam::new(23, SamKind::Radar, DVec3::ZERO, 0.0),
|
||||
];
|
||||
let mut post = Post { pinned: Some(23), ..Post::default() };
|
||||
assert_eq!(post.matching(&sams), [2, 0, 1]);
|
||||
for (query, expected) in [("панц", 0), ("depot", 1), ("№3", 2)] {
|
||||
post.query = query.to_string();
|
||||
assert_eq!(post.matching(&sams), [expected]);
|
||||
}
|
||||
post.query.clear();
|
||||
post.filter = Filter::Support;
|
||||
assert_eq!(post.matching(&sams), [1]);
|
||||
assert_eq!(post.pinned, Some(23));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn availability_filters_distinguish_empty_worn_and_destroyed_units() {
|
||||
let mut ready = Sam::new(15, SamKind::Pantsir, DVec3::ZERO, 0.0);
|
||||
ready.missiles = 0;
|
||||
ready.bursts = 0;
|
||||
ready.comps.0[Part::Comms as usize] = 0.0;
|
||||
assert!(Filter::NoAmmo.matches(&ready));
|
||||
assert!(Filter::NoLink.matches(&ready));
|
||||
assert!(Filter::Damaged.matches(&ready));
|
||||
assert!(row(&ready, 0, true).starts_with("★ №1"));
|
||||
ready.health = 0.0;
|
||||
assert!(!Filter::NoAmmo.matches(&ready));
|
||||
assert!(!Filter::NoLink.matches(&ready));
|
||||
assert_eq!(state(&ready), "Уничтожен");
|
||||
assert!(Filter::Damaged.matches(&ready));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn historical_details_use_the_recorded_station_and_separate_a_miss_from_a_refusal() {
|
||||
let mut rec = Recording::blank(100);
|
||||
rec.sams = vec![(96, SamKind::S400, DVec3::ZERO), (48, SamKind::Radar, DVec3::X)];
|
||||
let entry = decision::Entry {
|
||||
unit: 96,
|
||||
at: 40,
|
||||
target: Some(112),
|
||||
channel: decision::Channel::Launcher,
|
||||
outcome: decision::Outcome::Held(decision::Block::Terrain),
|
||||
mark: Some(decision::Mark {
|
||||
source: 48, age: 12, own: false, quality: 62,
|
||||
product: crate::sim::battery::Measure::Search,
|
||||
class: crate::sim::ClassEst::Unknown,
|
||||
}),
|
||||
};
|
||||
let lines = decision_lines(RecordedChoice { raid: 2, entry }, Some(&rec));
|
||||
assert!(lines.iter().any(|line| line == "источник №2 · 0.6 с назад"));
|
||||
assert!(lines.iter().any(|line| line.contains("выстрела не было")));
|
||||
let missed = decision::Entry { outcome: decision::Outcome::InterceptorMissed(144), mark: None, ..entry };
|
||||
let lines = decision_lines(RecordedChoice { raid: 2, entry: missed }, None);
|
||||
assert!(lines.iter().any(|line| line.contains("Промах перехватчика")));
|
||||
assert!(!lines.iter().any(|line| line.contains("выстрела не было")));
|
||||
}
|
||||
}
|
||||
+14
-171
@@ -1,24 +1,15 @@
|
||||
//! The radar screen (bottom right): a round scope round the player, north up,
|
||||
//! with a sweeping beam; blips fade after the beam passes them. A track's blip is a shape by the
|
||||
//! class the radar measured (#132), big enough to read at a glance; close ones merge with a count.
|
||||
//! The radar screen (top left): a round scope round the player, north up,
|
||||
//! with a sweeping beam; blips fade after the beam passes them.
|
||||
use crate::panel::distance;
|
||||
use crate::sim::{Class, ClassEst, SamKind, Sim};
|
||||
use crate::sim::{SamKind, Sim};
|
||||
use glam::DVec3;
|
||||
use horizon_mod_sdk::render::{FillShape, Point, QuadShape, Rect, Shape, TextShape};
|
||||
|
||||
/// The scope's side in GUI pixels.
|
||||
pub const SIZE: f32 = 112.0;
|
||||
/// The corner box's height: the scope and its range label, plus the truth mode's own line when it shows one.
|
||||
pub fn height(truth_label: bool) -> f32 {
|
||||
SIZE + if truth_label { 22.0 } else { 12.0 }
|
||||
}
|
||||
/// Blocks from the centre to the edge.
|
||||
const RANGE: f64 = 500.0;
|
||||
const SEGMENTS: usize = 48;
|
||||
/// A track blip's half-size: the icons span about six pixels, against the old dot's three and a half.
|
||||
const BLIP: f32 = 3.0;
|
||||
/// Tracks this close on the scope merge into one blip with their number.
|
||||
const MERGE_R: f32 = 4.5;
|
||||
|
||||
fn pt(x: f32, y: f32) -> Point {
|
||||
Point { x, y }
|
||||
@@ -41,34 +32,6 @@ fn alpha(rgb: u32, a: f64) -> u32 {
|
||||
((a.clamp(0.0, 1.0) * 255.0) as u32) << 24 | (rgb & 0xFFFFFF)
|
||||
}
|
||||
|
||||
/// A track's blip: a shape by the estimated class, pointing along the measured course.
|
||||
/// Drones are triangles, jets darts, cruise squares, supersonic diamonds, ballistic octagons;
|
||||
/// an unidentified track gets a question mark instead of leaking the target's type (#133).
|
||||
fn blip(class: ClassEst, x: f32, y: f32, color: u32, vel: DVec3) -> Vec<Shape> {
|
||||
let h = DVec3::new(vel.x, 0.0, vel.z).normalize_or_zero();
|
||||
let (hx, hy) = if h == DVec3::ZERO { (0.0, -1.0) } else { (h.x as f32, h.z as f32) };
|
||||
let (px, py) = (-hy, hx);
|
||||
let r = BLIP;
|
||||
let at = |along: f32, side: f32| pt(x + hx * along + px * side, y + hy * along + py * side);
|
||||
match class.class() {
|
||||
Some(Class::Drone) => vec![quad(at(r * 1.2, 0.0), at(-r * 0.8, r * 0.9), at(-r * 0.8, -r * 0.9), at(-r * 0.8, -r * 0.9), color)],
|
||||
Some(Class::Jet) => vec![quad(at(r * 1.3, 0.0), at(-r * 0.9, r * 0.9), at(-r * 0.3, 0.0), at(-r * 0.9, -r * 0.9), color)],
|
||||
Some(Class::Cruise) => vec![square(x, y, 2.6, color)],
|
||||
Some(Class::Supersonic) => vec![quad(pt(x, y - 3.2), pt(x + 3.2, y), pt(x, y + 3.2), pt(x - 3.2, y), color)],
|
||||
Some(Class::Ballistic) => vec![square(x, y, 2.3, color), quad(pt(x, y - r), pt(x + r, y), pt(x, y + r), pt(x - r, y), color)],
|
||||
None => vec![square(x, y, 2.4, color), text("?".into(), x, y - 3.0, 0xFF200808, true)],
|
||||
}
|
||||
}
|
||||
|
||||
/// Keeps a blip's centre far enough inside the disc that the whole icon stays on the scope: the longest point
|
||||
/// of any class's icon is 1.3 × a half-size out.
|
||||
fn inside(x: f32, y: f32, cx: f32, cy: f32, r: f32) -> (f32, f32) {
|
||||
let (dx, dy) = (x - cx, y - cy);
|
||||
let d = dx.hypot(dy);
|
||||
let max = r - BLIP * 1.4 - 0.5;
|
||||
if d > max && d > 0.0 { (cx + dx / d * max, cy + dy / d * max) } else { (x, y) }
|
||||
}
|
||||
|
||||
pub fn draw(sim: &Sim, player: DVec3, yaw: f32) -> Vec<Shape> {
|
||||
let mut s = Vec::new();
|
||||
let r = SIZE / 2.0 - 2.0;
|
||||
@@ -180,169 +143,49 @@ pub fn draw(sim: &Sim, player: DVec3, yaw: f32) -> Vec<Shape> {
|
||||
s.push(square(x, y, 1.5, 0xFFFFFFA0));
|
||||
}
|
||||
}
|
||||
// The player is below target blips: a close target must not disappear under the white arrow.
|
||||
// Minecraft's yaw 0 looks south (+z, down the scope).
|
||||
let face = yaw.to_radians();
|
||||
let tip = |a: f32, l: f32| pt(cx - (face + a).sin() * l, cy + (face + a).cos() * l);
|
||||
s.push(quad(tip(0.0, 6.0), tip(2.5, 4.0), pt(cx, cy), tip(-2.5, 4.0), 0xFFFFFFFF));
|
||||
let mut far = 0;
|
||||
// The air picture is what the systems' radars hold, as they last measured it (a track older than a second
|
||||
// is a forecast, dimmer); with no system deployed, the sky as it is. Nothing else is read (#93).
|
||||
let pic = sim.air_picture();
|
||||
let now = pic.now;
|
||||
// (x, y, class, colour, brightness, velocity) of every track on the scope, its icon kept inside the disc.
|
||||
let mut marks: Vec<(f32, f32, ClassEst, u32, f64, DVec3)> = Vec::new();
|
||||
for t in &pic.tracks {
|
||||
let (pos, vel) = (t.est(now), t.vel);
|
||||
match scope(pos) {
|
||||
Some((x, y, bearing)) => {
|
||||
// Fresh: bright and red; a forecast: orange, fading as it ages towards the track's drop.
|
||||
// The product is visible: a coarse search plot is amber, a refinement yellow, a fire plot red.
|
||||
let fresh_color = match t.product {
|
||||
crate::sim::battery::Measure::Search => 0xFFB060,
|
||||
crate::sim::battery::Measure::Refine => 0xFFE070,
|
||||
crate::sim::battery::Measure::Fire => 0xFF4040,
|
||||
};
|
||||
let (a, color) = if pic.unaided {
|
||||
(fade(bearing), 0xFF4040)
|
||||
} else if t.forecast(now) {
|
||||
((1.0 - t.age(now) as f64 / t.ttl.max(1) as f64 * 0.7).max(0.3), 0xFFB040)
|
||||
} else {
|
||||
(1.0, fresh_color)
|
||||
(1.0, 0xFF4040)
|
||||
};
|
||||
let (x, y) = inside(x, y, cx, cy, r);
|
||||
marks.push((x, y, t.class, color, a, vel));
|
||||
s.push(square(x, y, 1.8, alpha(color, a)));
|
||||
// Its heading, a short tail.
|
||||
let v = vel.normalize_or_zero();
|
||||
s.push(quad(pt(x, y), pt(x + 0.6, y), pt(x - v.x as f32 * 6.0 + 0.6, y - v.z as f32 * 6.0), pt(x - v.x as f32 * 6.0, y - v.z as f32 * 6.0), alpha(color, a * 0.6)));
|
||||
}
|
||||
None => far += 1,
|
||||
}
|
||||
}
|
||||
// A tight raid reads as one blip with its number, not a pile of icons.
|
||||
let pos: Vec<(f32, f32)> = marks.iter().map(|m| (m.0, m.1)).collect();
|
||||
for grp in crate::map::group(&pos, MERGE_R) {
|
||||
let (x, y, class, color, a, vel) = marks[grp[0]];
|
||||
s.extend(blip(class, x, y, alpha(color, a), vel));
|
||||
// Its heading, a short tail, kept on the disc too.
|
||||
let v = vel.normalize_or_zero();
|
||||
let (ex, ey) = inside(x - v.x as f32 * 7.0, y - v.z as f32 * 7.0, cx, cy, r);
|
||||
s.push(quad(pt(x, y), pt(x + 1.0, y), pt(ex + 1.0, ey), pt(ex, ey), alpha(color, a * 0.6)));
|
||||
if grp.len() > 1 {
|
||||
s.push(text(format!("×{}", grp.len()), x + 4.0, y - 9.0, alpha(color, a), false));
|
||||
}
|
||||
}
|
||||
// The true places, when the sandbox asks for them: a white dot beside the track, to see how far the picture is off.
|
||||
if sim.truth && !pic.unaided {
|
||||
for d in sim.drones.iter().filter(|d| d.alive()) {
|
||||
if let Some((x, y, _)) = scope(d.pos) {
|
||||
let (x, y) = inside(x, y, cx, cy, r);
|
||||
s.push(square(x, y, 1.3, 0xFFFFFFFF));
|
||||
s.push(square(x, y, 0.8, 0xFFFFFFFF));
|
||||
}
|
||||
}
|
||||
}
|
||||
// The player: a white arrow the way they look.
|
||||
// Minecraft's yaw 0 looks south (+z, down the scope).
|
||||
let face = yaw.to_radians();
|
||||
let tip = |a: f32, l: f32| pt(cx - (face + a).sin() * l, cy + (face + a).cos() * l);
|
||||
s.push(quad(tip(0.0, 6.0), tip(2.5, 4.0), pt(cx, cy), tip(-2.5, 4.0), 0xFFFFFFFF));
|
||||
// Labels.
|
||||
s.push(text(format!("РЛС · {}", distance(RANGE)), cx, SIZE + 2.0, 0xFF80FF90, true));
|
||||
if sim.truth && !pic.unaided {
|
||||
s.push(text("ИСТИНА · песочница".into(), cx, SIZE + 12.0, 0xFFFFE070, true));
|
||||
}
|
||||
s.push(text("С".into(), cx, 3.0, 0xFF80FF90, true));
|
||||
if far > 0 {
|
||||
s.push(text(format!("+{far} за пределом"), cx, SIZE - 14.0, 0xFFFF8080, true));
|
||||
}
|
||||
s
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::sim::{DroneKind, Out, Sam};
|
||||
|
||||
#[test]
|
||||
fn target_blips_are_drawn_over_the_player_arrow() {
|
||||
let mut sim = Sim::new(1);
|
||||
sim.launch(DroneKind::Shahed, DVec3::new(0.0, 64.0, -10.0), DVec3::ZERO, DVec3::ZERO, &mut Out::default());
|
||||
let shapes = draw(&sim, DVec3::ZERO, 0.0);
|
||||
let arrow = shapes.iter().rposition(|s| matches!(s, Shape::Quad(q) if q.color == 0xFFFFFFFF)).unwrap();
|
||||
// The Shahed's blip is a red triangle (a quad with a repeated corner), drawn after the arrow.
|
||||
let target = shapes.iter().rposition(|s| matches!(s, Shape::Quad(q) if q.color == 0xFFFF4040)).unwrap();
|
||||
assert!(target > arrow, "the player arrow covers the target blip");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn every_class_has_its_own_blip_shape() {
|
||||
let vel = DVec3::new(0.5, 0.0, 0.0);
|
||||
let shapes: Vec<Vec<Shape>> = Class::ALL.iter().map(|c| blip(ClassEst::Firm(*c), 50.0, 50.0, 0xFFFF4040, vel)).collect();
|
||||
for (i, a) in shapes.iter().enumerate() {
|
||||
assert!(!a.is_empty());
|
||||
for b in &shapes[i + 1..] {
|
||||
assert_ne!(format!("{a:?}"), format!("{b:?}"), "two classes share one icon");
|
||||
}
|
||||
}
|
||||
// A courseless track (a ballistic one straight overhead) still draws, pointing north.
|
||||
assert!(!blip(ClassEst::Firm(Class::Ballistic), 50.0, 50.0, 0xFFFF4040, DVec3::Y).is_empty());
|
||||
assert!(blip(ClassEst::Unknown, 50.0, 50.0, 0xFFFF4040, vel).iter().any(|s| matches!(s, Shape::Text(t) if t.text == "?")));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn blips_stay_inside_the_scope() {
|
||||
let mut sim = Sim::new(1);
|
||||
// One track near the rim on every bearing, one of each class among them, one just beyond it.
|
||||
for k in 0..8 {
|
||||
let a = k as f64 / 8.0 * std::f64::consts::TAU;
|
||||
sim.launch(DroneKind::Shahed, DVec3::new(a.sin() * 495.0, 64.0, a.cos() * 495.0), DVec3::ZERO, DVec3::ZERO, &mut Out::default());
|
||||
}
|
||||
for (k, kind) in [DroneKind::Geran3, DroneKind::Kh101, DroneKind::Kh22, DroneKind::Kinzhal].into_iter().enumerate() {
|
||||
let a = (k as f64 + 0.5) / 4.0 * std::f64::consts::TAU;
|
||||
sim.launch(kind, DVec3::new(a.sin() * 490.0, 64.0, a.cos() * 490.0), DVec3::ZERO, DVec3::ZERO, &mut Out::default());
|
||||
}
|
||||
sim.launch(DroneKind::Shahed, DVec3::new(0.0, 64.0, -700.0), DVec3::ZERO, DVec3::ZERO, &mut Out::default());
|
||||
let shapes = draw(&sim, DVec3::ZERO, 0.0);
|
||||
let (cx, cy, r) = (SIZE / 2.0, SIZE / 2.0, SIZE / 2.0 - 2.0);
|
||||
let mut blips = 0;
|
||||
for s in &shapes {
|
||||
let corners = match s {
|
||||
Shape::Quad(q) if q.color & 0xFFFFFF == 0xFF4040 => vec![q.corners.0, q.corners.1, q.corners.2, q.corners.3],
|
||||
Shape::Fill(f) if f.color & 0xFFFFFF == 0xFF4040 => vec![pt(f.rect.x, f.rect.y), pt(f.rect.x + f.rect.w, f.rect.y), pt(f.rect.x, f.rect.y + f.rect.h), pt(f.rect.x + f.rect.w, f.rect.y + f.rect.h)],
|
||||
_ => continue,
|
||||
};
|
||||
blips += 1;
|
||||
for p in corners {
|
||||
assert!((p.x - cx).hypot(p.y - cy) <= r + 0.01, "a blip corner leaves the disc: {p:?}");
|
||||
}
|
||||
}
|
||||
assert!(blips >= 8, "the rim tracks were not drawn");
|
||||
assert!(shapes.iter().any(|s| matches!(s, Shape::Text(t) if t.text.contains("за пределом"))), "the track beyond the range is counted");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_tight_raid_merges_into_one_blip_with_a_count() {
|
||||
let mut sim = Sim::new(1);
|
||||
for k in 0..3 {
|
||||
sim.launch(DroneKind::Shahed, DVec3::new(100.0 + k as f64, 64.0, -100.0), DVec3::ZERO, DVec3::ZERO, &mut Out::default());
|
||||
}
|
||||
let shapes = draw(&sim, DVec3::ZERO, 0.0);
|
||||
assert!(shapes.iter().any(|s| matches!(s, Shape::Text(t) if t.text == "×3")), "the merged blip has no count");
|
||||
let triangles = shapes
|
||||
.iter()
|
||||
.filter(|s| matches!(s, Shape::Quad(q) if q.color & 0xFFFFFF == 0xFF4040 && q.corners.2.x == q.corners.3.x && q.corners.2.y == q.corners.3.y))
|
||||
.count();
|
||||
assert_eq!(triangles, 1, "three close tracks drew three icons");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_truth_mode_is_labelled_on_the_scope() {
|
||||
let mut sim = Sim::new(1);
|
||||
let id = sim.id();
|
||||
sim.sams.push(Sam::new(id, SamKind::Buk, DVec3::new(0.0, 64.0, 0.0), 0.0));
|
||||
sim.launch(DroneKind::Shahed, DVec3::new(0.0, 64.0, -100.0), DVec3::ZERO, DVec3::ZERO, &mut Out::default());
|
||||
let plain = draw(&sim, DVec3::ZERO, 0.0);
|
||||
assert!(!plain.iter().any(|s| matches!(s, Shape::Text(t) if t.text.contains("ИСТИНА"))));
|
||||
sim.truth = true;
|
||||
let shapes = draw(&sim, DVec3::ZERO, 0.0);
|
||||
let label = shapes.iter().find_map(|s| match s {
|
||||
Shape::Text(t) if t.text.contains("ИСТИНА") && t.text.contains("песочница") => Some(t),
|
||||
_ => None,
|
||||
}).expect("the truth mode is not marked");
|
||||
// The corner box is sized to hold the label: a line of the HUD font is 9 pixels with its shadow.
|
||||
assert!(label.at.y + 9.0 <= height(true), "the truth label falls outside the corner box");
|
||||
assert!(height(true) > height(false));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,302 +0,0 @@
|
||||
//! Text for the enemy's reconnaissance (#135): the readable phase of a recon flight and the
|
||||
//! reason a mark outranks another. It reads only the diagnostic report types (`EnemyPictureReport`,
|
||||
//! `ReconReport`, `ReconSortieReport`) — an area, a public category, a channel, an age and a quality,
|
||||
//! never a true place, `SamKind`, health, magazine, link or real id. The full picture is for the
|
||||
//! explicit debug command and the after-action review; the battle HUD takes only the coarse phase
|
||||
//! of aircraft the player's own network already tracks.
|
||||
use crate::sim::{Category, Confidence, EnemyPictureReport, Quality, ReconReport, ReconSortieReport, priority_parts};
|
||||
|
||||
/// The public category a look reported, in the panel's words.
|
||||
pub fn category_name(key: &str) -> &'static str {
|
||||
match key {
|
||||
"radar" => "РЛС",
|
||||
"launcher" => "пусковая",
|
||||
"gun" => "пушка",
|
||||
"ew" => "РЭБ",
|
||||
"support" => "тыл",
|
||||
_ => "не определено",
|
||||
}
|
||||
}
|
||||
|
||||
/// A radar's role, public only once a refined look told it.
|
||||
pub fn role_name(key: &str) -> &'static str {
|
||||
match key {
|
||||
"multi" => "многофункциональная",
|
||||
"search" => "обзорная",
|
||||
"engagement" => "наведения",
|
||||
"height" => "высотомер",
|
||||
_ => "не определена",
|
||||
}
|
||||
}
|
||||
|
||||
/// The channel that showed the unit.
|
||||
pub fn source_name(key: &str) -> &'static str {
|
||||
match key {
|
||||
"emission" => "излучение",
|
||||
"jamming" => "РЭБ",
|
||||
"launch" => "пуск",
|
||||
_ => "пролёт",
|
||||
}
|
||||
}
|
||||
|
||||
/// How well the area is known.
|
||||
pub fn quality_name(key: &str) -> &'static str {
|
||||
match key {
|
||||
"refined" => "уточнённая",
|
||||
_ => "грубая",
|
||||
}
|
||||
}
|
||||
|
||||
/// The trust the picture puts in a mark of this age.
|
||||
pub fn confidence_name(confidence: Confidence) -> &'static str {
|
||||
match confidence {
|
||||
Confidence::Confirmed => "подтверждена",
|
||||
Confidence::Probable => "вероятна",
|
||||
Confidence::Doubtful => "сомнительна",
|
||||
}
|
||||
}
|
||||
|
||||
/// The phase of a sortie, as the timeline and the battle UI read it.
|
||||
pub fn phase_name(phase: &str) -> &'static str {
|
||||
match phase {
|
||||
"reporting" => "донесение",
|
||||
"done" => "завершение",
|
||||
"looking" => "осмотр",
|
||||
_ => "разведка",
|
||||
}
|
||||
}
|
||||
|
||||
/// Why a smart drone's aim is what it is, in words.
|
||||
pub fn intent_name(intent: &str) -> &'static str {
|
||||
match intent {
|
||||
"sead" => "подавление ПВО",
|
||||
"react" => "реакция",
|
||||
"replace" => "замена",
|
||||
_ => "план",
|
||||
}
|
||||
}
|
||||
|
||||
/// One mark in a line: its area's category and role, the channel, the quality, the trust, the age
|
||||
/// and the priority the planner prices it at.
|
||||
pub fn mark_line(m: &ReconReport) -> String {
|
||||
let role = m.role.map(|k| format!(" ({})", role_name(k))).unwrap_or_default();
|
||||
let mut line = format!(
|
||||
"Отметка {}: {}{} · {} · {} · {} · {} с назад · приоритет {}",
|
||||
m.id,
|
||||
category_name(m.category),
|
||||
role,
|
||||
source_name(m.source),
|
||||
quality_name(m.quality),
|
||||
confidence_name(m.confidence),
|
||||
m.age / 20,
|
||||
m.priority
|
||||
);
|
||||
if m.launches != 0 {
|
||||
line.push_str(&format!(" · замечено пусков {}", m.launches));
|
||||
}
|
||||
line
|
||||
}
|
||||
|
||||
/// Why the mark has the priority it does: the observed role, the freshness and the quality, each
|
||||
/// with the weight the planner gives it, summing to the priority. The unit's true importance is not
|
||||
/// in it — only what the look reported.
|
||||
pub fn mark_reason(m: &ReconReport) -> String {
|
||||
let category = Category::from_key(m.category).unwrap_or(Category::Unknown);
|
||||
let quality = Quality::from_key(m.quality).unwrap_or(Quality::Coarse);
|
||||
let role = m.role.and_then(crate::sim::battery::RadarRole::from_key);
|
||||
let (freshness, quality_w, role_w) = priority_parts(m.confidence, quality, category, role);
|
||||
let role_txt = match m.role {
|
||||
Some(key) => format!("роль «{}»", role_name(key)),
|
||||
None => format!("категория «{}»", category_name(m.category)),
|
||||
};
|
||||
format!(
|
||||
"приоритет {} = свежесть {}×4 + качество {}×3 + роль {}: {} {}, {}",
|
||||
m.priority,
|
||||
freshness,
|
||||
quality_w,
|
||||
role_w,
|
||||
confidence_name(m.confidence),
|
||||
quality_name(m.quality),
|
||||
role_txt
|
||||
)
|
||||
}
|
||||
|
||||
/// One sortie in a line: its phase, the zones left and when its pending report is due.
|
||||
pub fn sortie_line(s: &ReconSortieReport) -> String {
|
||||
let mut text = format!("Разведчик {}: {}", s.drone, phase_name(s.phase));
|
||||
if s.zones_left > 0 {
|
||||
text += &format!(" · зон осталось {}", s.zones_left);
|
||||
}
|
||||
if let Some(due) = s.report_in {
|
||||
text += &format!(" · донесение через {} с", due / 20);
|
||||
}
|
||||
text
|
||||
}
|
||||
|
||||
/// The coarse phase of the recon flight for the battle UI: a report going home now, else aircraft
|
||||
/// still looking, else the flight finishing. `None` when no sortie is out. It says nothing of what
|
||||
/// the enemy learned — only what its visible aircraft are doing.
|
||||
pub fn battle_phase(pic: &EnemyPictureReport) -> Option<&'static str> {
|
||||
if pic.recon_sorties.iter().any(|s| s.phase == "reporting") {
|
||||
Some("донесение")
|
||||
} else if pic.recon_sorties.iter().any(|s| s.phase == "outbound" || s.phase == "looking") {
|
||||
Some("разведка")
|
||||
} else if !pic.recon_sorties.is_empty() {
|
||||
Some("завершение")
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
/// The whole picture for the debug command and the after-action review: the sorties and their
|
||||
/// phases, then the marks best-first with the reason each outranks the rest, then the drones aimed
|
||||
/// at a mark. Explicitly the enemy's belief, not the truth; never the normal HUD.
|
||||
pub fn picture_lines(pic: &EnemyPictureReport) -> Vec<String> {
|
||||
let mut lines = Vec::new();
|
||||
if pic.recon.is_empty() && pic.recon_sorties.is_empty() {
|
||||
lines.push("Разведки не было: противник не высылал разведчиков и ничего не запомнил.".into());
|
||||
return lines;
|
||||
}
|
||||
lines.push(format!(
|
||||
"Картина противника (debug/разбор): отметок {}, разведчиков в воздухе {}",
|
||||
pic.recon.len(),
|
||||
pic.recon_sorties.len()
|
||||
));
|
||||
for s in &pic.recon_sorties {
|
||||
lines.push(sortie_line(s));
|
||||
}
|
||||
let mut marks: Vec<&ReconReport> = pic.recon.iter().collect();
|
||||
marks.sort_by(|a, b| b.priority.cmp(&a.priority).then(a.id.cmp(&b.id)));
|
||||
for m in marks {
|
||||
lines.push(mark_line(m));
|
||||
lines.push(format!(" ↳ {}", mark_reason(m)));
|
||||
}
|
||||
for a in pic.aims.iter().filter(|a| a.recon) {
|
||||
lines.push(format!(
|
||||
"Дрон {} целится в отметку {} (приоритет {}, {})",
|
||||
a.drone,
|
||||
a.unit,
|
||||
a.priority.unwrap_or(0),
|
||||
intent_name(a.intent)
|
||||
));
|
||||
}
|
||||
lines
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::sim::{AimReport, BearingReport, Confidence, EnemyPictureReport, ReconReport, ReconSortieReport};
|
||||
use glam::DVec3;
|
||||
|
||||
fn mark(id: u32, category: &'static str, role: Option<&'static str>, quality: &'static str, confidence: Confidence, age: u64) -> ReconReport {
|
||||
let cat = Category::from_key(category).unwrap();
|
||||
let qual = Quality::from_key(quality).unwrap();
|
||||
let role_enum = role.and_then(crate::sim::battery::RadarRole::from_key);
|
||||
let (f, q, r) = priority_parts(confidence, qual, cat, role_enum);
|
||||
ReconReport { id, area: DVec3::ZERO, radius: 120.0, category, role, source: "flyby", launches: 0, age, quality, confidence, live: true, priority: f * 4 + q * 3 + r }
|
||||
}
|
||||
|
||||
fn sortie(drone: u32, phase: &'static str, zones_left: usize, report_in: Option<u64>) -> ReconSortieReport {
|
||||
ReconSortieReport { drone, phase, zones_left, report_in }
|
||||
}
|
||||
|
||||
fn picture(recon: Vec<ReconReport>, recon_sorties: Vec<ReconSortieReport>, aims: Vec<AimReport>) -> EnemyPictureReport {
|
||||
EnemyPictureReport {
|
||||
now: 1000,
|
||||
contacts: Vec::new(),
|
||||
aims,
|
||||
pending: Vec::new(),
|
||||
work_per_tick: 4,
|
||||
recon,
|
||||
recon_sorties,
|
||||
observations: Vec::new(),
|
||||
bearing: BearingReport::default(),
|
||||
refresh_waiting: false,
|
||||
refresh_applied: 0,
|
||||
}
|
||||
}
|
||||
|
||||
// The reason names all three factors with the planner's own weights, and they sum to the priority.
|
||||
#[test]
|
||||
fn the_reason_is_the_observed_role_freshness_and_quality() {
|
||||
let m = mark(0x1000_0001, "radar", Some("engagement"), "refined", Confidence::Confirmed, 100);
|
||||
let reason = mark_reason(&m);
|
||||
assert_eq!(m.priority, 4 * 4 + 2 * 3 + 3);
|
||||
assert!(reason.contains("приоритет 25 = свежесть 4×4 + качество 2×3 + роль 3"), "{reason}");
|
||||
assert!(reason.contains("подтверждена") && reason.contains("уточнённая") && reason.contains("роль «наведения»"), "{reason}");
|
||||
// A coarse, doubtful, unknown mark: every part is zero, and the reason says so.
|
||||
let weak = mark(0x1000_0002, "unknown", None, "coarse", Confidence::Doubtful, 5000);
|
||||
assert_eq!(weak.priority, 0);
|
||||
let weak_reason = mark_reason(&weak);
|
||||
assert!(weak_reason.contains("свежесть 0×4 + качество 0×3 + роль 0"), "{weak_reason}");
|
||||
assert!(weak_reason.contains("сомнительна") && weak_reason.contains("категория «не определено»"), "{weak_reason}");
|
||||
}
|
||||
|
||||
// A fresh modest mark can outrank a stale big one: the reason reflects the age, not the truth.
|
||||
#[test]
|
||||
fn a_fresh_modest_mark_outranks_a_stale_big_one() {
|
||||
let stale_big = mark(0x1000_0001, "radar", Some("engagement"), "refined", Confidence::Doubtful, 5000);
|
||||
let fresh_modest = mark(0x1000_0002, "gun", None, "coarse", Confidence::Confirmed, 100);
|
||||
assert!(fresh_modest.priority > stale_big.priority, "{} vs {}", fresh_modest.priority, stale_big.priority);
|
||||
let fresh_id = fresh_modest.id;
|
||||
let lines = picture_lines(&picture(vec![stale_big, fresh_modest], Vec::new(), Vec::new()));
|
||||
let first = lines.iter().position(|l| l.starts_with("Отметка")).unwrap();
|
||||
assert!(lines[first].contains(&format!("Отметка {fresh_id}")), "the fresh modest mark did not lead: {lines:?}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_phase_reads_recon_report_and_done() {
|
||||
assert_eq!(phase_name("outbound"), "разведка");
|
||||
assert_eq!(phase_name("reporting"), "донесение");
|
||||
assert_eq!(phase_name("done"), "завершение");
|
||||
let reporting = picture(Vec::new(), vec![sortie(0x3000_0001, "reporting", 0, Some(40)), sortie(0x3000_0002, "outbound", 2, None)], Vec::new());
|
||||
assert_eq!(battle_phase(&reporting), Some("донесение"));
|
||||
let looking = picture(Vec::new(), vec![sortie(0x3000_0001, "outbound", 2, None)], Vec::new());
|
||||
assert_eq!(battle_phase(&looking), Some("разведка"));
|
||||
let done = picture(Vec::new(), vec![sortie(0x3000_0001, "done", 0, None)], Vec::new());
|
||||
assert_eq!(battle_phase(&done), Some("завершение"));
|
||||
assert_eq!(battle_phase(&picture(Vec::new(), Vec::new(), Vec::new())), None);
|
||||
assert!(sortie_line(&sortie(0x3000_0001, "reporting", 1, Some(40))).contains("донесение через 2 с"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn an_empty_picture_says_there_was_no_recon() {
|
||||
let lines = picture_lines(&picture(Vec::new(), Vec::new(), Vec::new()));
|
||||
assert_eq!(lines.len(), 1);
|
||||
assert!(lines[0].contains("Разведки не было"), "{lines:?}");
|
||||
}
|
||||
|
||||
// The review shows the marks with their reasons and the drones aimed at them; the ids are the
|
||||
// synthetic ones, and nothing of the unit's truth (kind, health, exact place) is in the report.
|
||||
#[test]
|
||||
fn the_review_lists_marks_reasons_and_recon_aims() {
|
||||
let m = mark(0x1000_0001, "launcher", None, "coarse", Confidence::Probable, 1000);
|
||||
let mid = m.id;
|
||||
let aim = AimReport { drone: 7, unit: mid, intent: "sead", since: 900, switches: 0, confidence: Some(Confidence::Probable), recon: true, priority: Some(m.priority) };
|
||||
let unit_aim = AimReport { drone: 8, unit: 3, intent: "plan", since: 900, switches: 0, confidence: Some(Confidence::Confirmed), recon: false, priority: None };
|
||||
let lines = picture_lines(&picture(vec![m], vec![sortie(0x3000_0001, "outbound", 1, None)], vec![aim, unit_aim]));
|
||||
assert!(lines.iter().any(|l| l.contains(&format!("Отметка {mid}")) && l.contains("пусковая")), "{lines:?}");
|
||||
assert!(lines.iter().any(|l| l.contains("↳") && l.contains("приоритет")), "{lines:?}");
|
||||
assert!(lines.iter().any(|l| l.contains("Дрон 7 целится в отметку") && l.contains("подавление ПВО")), "{lines:?}");
|
||||
// A unit contact's aim is not a recon aim: it is not listed here.
|
||||
assert!(!lines.iter().any(|l| l.contains("Дрон 8")), "{lines:?}");
|
||||
// No true unit id leaks: the mark id is synthetic, far above any real unit's.
|
||||
assert!(mid >= 0x1000_0000);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn every_public_name_is_translated() {
|
||||
for key in ["unknown", "radar", "launcher", "gun", "ew", "support"] {
|
||||
assert_ne!(category_name(key), key, "{key}");
|
||||
}
|
||||
for key in ["multi", "search", "engagement", "height"] {
|
||||
assert_ne!(role_name(key), key, "{key}");
|
||||
}
|
||||
for key in ["flyby", "emission", "jamming", "launch"] {
|
||||
assert_ne!(source_name(key), key, "{key}");
|
||||
}
|
||||
assert_ne!(quality_name("coarse"), "coarse");
|
||||
assert_ne!(quality_name("refined"), "refined");
|
||||
}
|
||||
}
|
||||
+31
-327
@@ -9,7 +9,7 @@ use crate::sim::catalog::sound;
|
||||
use crate::film::{self, Film};
|
||||
use crate::panel::distance;
|
||||
use crate::sim::Ground;
|
||||
use crate::sim::record::{Chain, ChainOutcome, ChainStepKind, EventKind, Recording, STEP, StrikeResult, What};
|
||||
use crate::sim::record::{EventKind, Recording, STEP, StrikeResult, What};
|
||||
use std::cell::Cell;
|
||||
use crate::sim::{Class, DroneKind, Out, Sim};
|
||||
use glam::DVec3;
|
||||
@@ -124,7 +124,7 @@ fn line(a: (f32, f32), b: (f32, f32), w: f32, color: u32) -> Shape {
|
||||
let p = |x: f32, y: f32| Point { x, y };
|
||||
Shape::Quad(QuadShape { corners: (p(a.0 + nx, a.1 + ny), p(b.0 + nx, b.1 + ny), p(b.0 - nx, b.1 - ny), p(a.0 - nx, a.1 - ny)), color })
|
||||
}
|
||||
pub(crate) fn clock(ticks: f64) -> String {
|
||||
fn clock(ticks: f64) -> String {
|
||||
let s = (ticks / 20.0).max(0.0);
|
||||
format!("{:02}:{:04.1}", (s / 60.0) as u32, s % 60.0)
|
||||
}
|
||||
@@ -187,121 +187,6 @@ pub fn row(rec: &Recording, i: usize) -> String {
|
||||
format!("{} {what}", clock(e.at as f64))
|
||||
}
|
||||
|
||||
/// A row of the after-action chain list and where a click on it opens a replay.
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct ChainRow {
|
||||
pub text: String,
|
||||
/// The recorded event to clip (the outcome), when there is one.
|
||||
pub event: Option<usize>,
|
||||
/// Otherwise the recording's tick to open the map at (the launch, else the mark).
|
||||
pub at: f64,
|
||||
}
|
||||
|
||||
/// The short chains of a raid: отметка → передача → захват → пуск → исход, filtered by a
|
||||
/// battery's id when asked. The list is the recording's measured transitions, not a guess.
|
||||
pub fn chain_rows(rec: &Recording, battery: Option<u32>) -> Vec<ChainRow> {
|
||||
chain_page(rec, battery, ChainFilter::All, 0, usize::MAX).rows
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Default, PartialEq, Eq)]
|
||||
pub(crate) enum ChainFilter {
|
||||
#[default]
|
||||
All,
|
||||
NoLaunch,
|
||||
Breach,
|
||||
}
|
||||
|
||||
impl ChainFilter {
|
||||
pub fn next(self) -> Self {
|
||||
match self {
|
||||
Self::All => Self::NoLaunch,
|
||||
Self::NoLaunch => Self::Breach,
|
||||
Self::Breach => Self::All,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn label(self) -> &'static str {
|
||||
match self {
|
||||
Self::All => "Все цепочки",
|
||||
Self::NoLaunch => "Без записи пуска",
|
||||
Self::Breach => "Прорывы",
|
||||
}
|
||||
}
|
||||
|
||||
fn matches(self, chain: &Chain) -> bool {
|
||||
match self {
|
||||
Self::All => true,
|
||||
Self::NoLaunch => chain.missed(),
|
||||
Self::Breach => chain.outcome == ChainOutcome::Hit,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
pub(crate) struct ChainPage {
|
||||
pub rows: Vec<ChainRow>,
|
||||
pub total: usize,
|
||||
pub index: usize,
|
||||
}
|
||||
|
||||
pub(crate) fn chain_page(rec: &Recording, battery: Option<u32>, filter: ChainFilter, page: usize, size: usize) -> ChainPage {
|
||||
let mut chains = rec.chains(battery);
|
||||
chains.retain(|chain| filter.matches(chain));
|
||||
let total = chains.len();
|
||||
let index = page.min(total.div_ceil(size).saturating_sub(1));
|
||||
let rows = chains.iter().skip(index * size).take(size).map(|chain| ChainRow {
|
||||
text: chain_row(rec, chain),
|
||||
event: chain.outcome_event(),
|
||||
at: chain_jump_at(chain),
|
||||
}).collect();
|
||||
ChainPage { rows, total, index }
|
||||
}
|
||||
|
||||
/// Where a chain opens in a replay when its outcome has no recorded event.
|
||||
fn chain_jump_at(chain: &Chain) -> f64 {
|
||||
chain
|
||||
.step(ChainStepKind::Launch)
|
||||
.or_else(|| chain.step(ChainStepKind::Mark))
|
||||
.map_or(0.0, |s| s.at as f64)
|
||||
}
|
||||
|
||||
fn chain_step_name(chain: &Chain, kind: ChainStepKind, own: bool) -> &'static str {
|
||||
match kind {
|
||||
ChainStepKind::Mark => "отметка",
|
||||
ChainStepKind::Handoff if own => "передача (своя РЛС)",
|
||||
ChainStepKind::Handoff => "передача (сеть)",
|
||||
ChainStepKind::Lock => "захват",
|
||||
ChainStepKind::Launch => "пуск",
|
||||
ChainStepKind::Outcome => match chain.outcome {
|
||||
ChainOutcome::Destroyed => "сбит",
|
||||
ChainOutcome::Hit => "прорыв",
|
||||
ChainOutcome::Lost => "потерян",
|
||||
ChainOutcome::Unfinished => "без исхода",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
/// One chain as a line: the battery, its contact, and the four or five measured steps.
|
||||
pub fn chain_row(rec: &Recording, chain: &Chain) -> String {
|
||||
let index = rec.sams.iter().position(|s| s.0 == chain.sam).map(|i| i + 1);
|
||||
let kind = rec.sam(chain.sam).map_or("ПВО", |(kind, _)| kind.name());
|
||||
let target = rec
|
||||
.track(chain.target)
|
||||
.and_then(|t| match t.what {
|
||||
What::Drone(kind) => Some(kind.spec().name),
|
||||
_ => None,
|
||||
})
|
||||
.unwrap_or("цель");
|
||||
let steps: Vec<String> = chain.steps.iter().map(|s| format!("{} {}", chain_step_name(chain, s.kind, s.own), clock(s.at as f64))).collect();
|
||||
let battery = index.map_or_else(|| format!("№? {kind}"), |i| format!("№{i} {kind}"));
|
||||
format!(
|
||||
"{} {battery} → «{target}»: {}{}",
|
||||
clock(chain.marked_at() as f64),
|
||||
steps.join(" → "),
|
||||
if chain.missed() { " · пуск не записан" } else { "" },
|
||||
)
|
||||
}
|
||||
|
||||
/// How worth watching an event is: the reel takes the best.
|
||||
pub fn interest(rec: &Recording, i: usize) -> f64 {
|
||||
let e = &rec.events[i];
|
||||
@@ -414,16 +299,6 @@ impl Player {
|
||||
}
|
||||
}
|
||||
|
||||
/// Opens the replay at a recording tick (a chain's launch or mark), holding that frame.
|
||||
pub fn seek(&mut self, rec: &Recording, at: f64) {
|
||||
self.t = at.clamp(0.0, rec.len as f64);
|
||||
self.heard = self.t;
|
||||
self.shot = (usize::MAX, 0);
|
||||
self.fade = 0;
|
||||
self.card = 0;
|
||||
self.paused = true;
|
||||
}
|
||||
|
||||
/// The wheel: scrubs the map and the full replay, skips clips.
|
||||
pub fn wheel(&mut self, steps: f32, rec: &Recording) {
|
||||
let c = if steps > 0.0 { Control::Back } else { Control::Forward };
|
||||
@@ -650,7 +525,7 @@ impl Player {
|
||||
/// Sounds as the camera hears them: moved so the player stands where the camera is.
|
||||
fn sounds(&mut self, rec: &Recording, listener: DVec3, out: &mut Out) {
|
||||
let heard = |p: DVec3| listener + (p - self.eye);
|
||||
for (_, e) in rec.events_between(self.heard, self.t) {
|
||||
for e in rec.events.iter().filter(|e| (self.heard..self.t).contains(&(e.at as f64))) {
|
||||
let event = match e.kind {
|
||||
EventKind::Kill { kind, outcome, .. } => crate::sim::outcome::look(kind, outcome).3,
|
||||
EventKind::Hit { power, .. } | EventKind::Crash { power, .. } => [sound::BLAST_AIR, sound::BLAST_MEDIUM, sound::BLAST_BIG, sound::BLAST_HEAVY, sound::BLAST_HUGE][(power as usize).min(4)],
|
||||
@@ -671,7 +546,7 @@ impl Player {
|
||||
}
|
||||
// New recordings carry the exact launch and ignition sounds and their actual positions.
|
||||
if let Some(scene) = &rec.scene {
|
||||
for e in scene.events_between(self.heard, self.t) {
|
||||
for e in scene.events().iter().filter(|e| (self.heard..self.t).contains(&(e.at as f64))) {
|
||||
match e.kind {
|
||||
crate::sim::record::SceneKind::MissileLaunch { sound, pitch, .. } => out.sound(sound, heard(e.pos), 1.0, pitch),
|
||||
crate::sim::record::SceneKind::MotorIgnition { sound: Some(sound), .. } => out.sound(sound, heard(e.pos), 1.0, 1.0),
|
||||
@@ -898,9 +773,9 @@ impl Player {
|
||||
// The full replay follows what comes next: the next event within 6 s, else the drone
|
||||
// nearest its target.
|
||||
Mode::Full => rec
|
||||
.events_between(self.t - 30.0, self.t + 120.0)
|
||||
.next()
|
||||
.map(|(i, _)| i)
|
||||
.events
|
||||
.iter()
|
||||
.position(|e| (self.t - 30.0..self.t + 120.0).contains(&(e.at as f64)))
|
||||
.or(if self.shot.0 != usize::MAX && (rec.events[self.shot.0].at as f64) > self.t - 60.0 { Some(self.shot.0) } else { None }),
|
||||
Mode::Map | Mode::Film(_) => None,
|
||||
};
|
||||
@@ -1098,11 +973,11 @@ impl Player {
|
||||
What::Missile(..) => (0x90FFD040, 0xFFFFE070),
|
||||
What::Strike | What::StrikeCarrier(_) => (0x90FFA040, 0xFFFFC060),
|
||||
};
|
||||
let upto = ((self.t - tr.first as f64) / tr.step() as f64).floor();
|
||||
let upto = ((self.t - tr.first as f64) / STEP as f64).floor();
|
||||
if upto < 0.0 {
|
||||
continue;
|
||||
}
|
||||
let last = ((tr.last() - tr.first) / tr.step()) as f64;
|
||||
let last = ((tr.last() - tr.first) / STEP) as f64;
|
||||
let count = upto.min(last) as usize + 1;
|
||||
if count < 2 {
|
||||
continue;
|
||||
@@ -1124,13 +999,29 @@ impl Player {
|
||||
s.push(fill(prev.0 - 1.5, prev.1 - 1.5, 3.0, 3.0, head));
|
||||
}
|
||||
}
|
||||
// Events so far, in their order. The header's counts come from the recording's prefix
|
||||
// index, not from walking the journal again; past the shape cap nothing drawn here
|
||||
// survives `truncate`.
|
||||
s.extend(event_marks(rec, self.t, &at, &inside, 1024usize.saturating_sub(s.len())));
|
||||
// Events so far.
|
||||
for e in rec.events.iter().filter(|e| (e.at as f64) <= self.t) {
|
||||
let (x, y) = at(e.pos);
|
||||
if !inside((x, y)) {
|
||||
continue;
|
||||
}
|
||||
match e.kind {
|
||||
EventKind::Kill { .. } => {
|
||||
s.push(line((x - 2.5, y - 2.5), (x + 2.5, y + 2.5), 1.2, 0xFFFFE040));
|
||||
s.push(line((x + 2.5, y - 2.5), (x - 2.5, y + 2.5), 1.2, 0xFFFFE040));
|
||||
}
|
||||
EventKind::Hit { power, .. } | EventKind::Crash { power, .. } => {
|
||||
let r = 2.0 + power as f32;
|
||||
s.push(fill(x - r, y - r, r * 2.0, r * 2.0, 0xB0FF3020));
|
||||
}
|
||||
EventKind::SamLost { .. } => s.push(fill(x - 4.0, y - 4.0, 8.0, 8.0, 0xFF200000)),
|
||||
EventKind::Split { .. } => s.push(fill(x - 2.0, y - 2.0, 4.0, 4.0, 0xFFFF9020)),
|
||||
EventKind::Strike { .. } => s.push(fill(x - 3.0, y - 3.0, 6.0, 6.0, 0xFFFFA040)),
|
||||
}
|
||||
}
|
||||
// Header, legend, time line.
|
||||
let kills = rec.kills_until(self.t);
|
||||
let hits = rec.hits_until(self.t);
|
||||
let kills = rec.events.iter().filter(|e| (e.at as f64) <= self.t && matches!(e.kind, EventKind::Kill { .. })).count();
|
||||
let hits = rec.events.iter().filter(|e| (e.at as f64) <= self.t && matches!(e.kind, EventKind::Hit { .. })).count();
|
||||
let state = if self.paused { "ПАУЗА".to_string() } else { format!("×{}", self.speed) };
|
||||
s.push(text(format!("КАРТА НАЛЁТА №{} · {} / {} {state} · сбито {kills} · прилётов {hits}", rec.number, clock(self.t), clock(rec.len as f64)), 8.0, 6.0, 0xFF9FE0FF, false));
|
||||
let legend = "красный: цели · серый: ложные · жёлтый: перехватчики · x сбит · квадрат: прилёт";
|
||||
@@ -1149,10 +1040,6 @@ impl Player {
|
||||
s.push(fill(tx, ty, tw, 3.0, 0x60FFFFFF));
|
||||
let len = rec.len.max(1) as f32;
|
||||
for e in &rec.events {
|
||||
// The line is cut at 1024 shapes: past that, a mark would not be kept.
|
||||
if s.len() >= 1024 {
|
||||
break;
|
||||
}
|
||||
let x = tx + tw * e.at as f32 / len;
|
||||
let c = match e.kind {
|
||||
EventKind::Kill { .. } => 0xFFFFE040,
|
||||
@@ -1170,42 +1057,6 @@ impl Player {
|
||||
}
|
||||
}
|
||||
|
||||
/// The marks of the events up to `t` on the raid map, in the order they happened: a kill as a
|
||||
/// cross, a hit as a square, a lost system as a dark square, a split and a strike as dots. Reads
|
||||
/// the journal by time (`events_until`) and stops at `room` shapes, the rest of the map's cap.
|
||||
fn event_marks(
|
||||
rec: &Recording,
|
||||
t: f64,
|
||||
at: &impl Fn(DVec3) -> (f32, f32),
|
||||
inside: &impl Fn((f32, f32)) -> bool,
|
||||
room: usize,
|
||||
) -> Vec<Shape> {
|
||||
let mut s = Vec::new();
|
||||
for (_, e) in rec.events_until(t) {
|
||||
if s.len() >= room {
|
||||
break;
|
||||
}
|
||||
let (x, y) = at(e.pos);
|
||||
if !inside((x, y)) {
|
||||
continue;
|
||||
}
|
||||
match e.kind {
|
||||
EventKind::Kill { .. } => {
|
||||
s.push(line((x - 2.5, y - 2.5), (x + 2.5, y + 2.5), 1.2, 0xFFFFE040));
|
||||
s.push(line((x + 2.5, y - 2.5), (x - 2.5, y + 2.5), 1.2, 0xFFFFE040));
|
||||
}
|
||||
EventKind::Hit { power, .. } | EventKind::Crash { power, .. } => {
|
||||
let r = 2.0 + power as f32;
|
||||
s.push(fill(x - r, y - r, r * 2.0, r * 2.0, 0xB0FF3020));
|
||||
}
|
||||
EventKind::SamLost { .. } => s.push(fill(x - 4.0, y - 4.0, 8.0, 8.0, 0xFF200000)),
|
||||
EventKind::Split { .. } => s.push(fill(x - 2.0, y - 2.0, 4.0, 4.0, 0xFFFF9020)),
|
||||
EventKind::Strike { .. } => s.push(fill(x - 3.0, y - 3.0, 6.0, 6.0, 0xFFFFA040)),
|
||||
}
|
||||
}
|
||||
s
|
||||
}
|
||||
|
||||
/// The ground the map shows, as [lo x, lo z, hi x, hi z]: everything that
|
||||
/// flew (not the ballistic falls), with the systems and objects, or round the
|
||||
/// origin when nothing did.
|
||||
@@ -1251,69 +1102,6 @@ impl Player {
|
||||
mod surface_tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn a_chain_row_lists_the_measured_steps_and_opens_its_frame() {
|
||||
use crate::sim::record::{Event, SceneEvent, SceneJournal, SceneKind};
|
||||
use crate::sim::outcome::Outcome;
|
||||
use crate::sim::MissileKind;
|
||||
let mut rec = Recording::blank(300);
|
||||
rec.sams = vec![(10, crate::sim::SamKind::Pantsir, DVec3::ZERO)];
|
||||
rec.straight(7, What::Drone(DroneKind::Shahed), 0, 200, DVec3::new(0.0, 80.0, 0.0), DVec3::new(200.0, 80.0, 0.0));
|
||||
let mut scene = SceneJournal::default();
|
||||
let at = |at: u32, kind| SceneEvent { at, pos: DVec3::ZERO, kind };
|
||||
scene.fixture_push(at(20, SceneKind::TrackAcquired { sam: 10, target: 7, ever_own: false }));
|
||||
scene.fixture_push(at(30, SceneKind::TrackSource { sam: 10, target: 7, ever_own: true }));
|
||||
scene.fixture_push(at(40, SceneKind::TrackLock { sam: 10, target: 7, locked: true }));
|
||||
scene.fixture_push(at(50, SceneKind::MissileLaunch { missile: 500, sam: 10, target: 7, kind: MissileKind::M57e6, sound: "airdef:launch.pantsir", pitch: 1.0 }));
|
||||
rec.scene = Some(scene);
|
||||
rec.events.push(Event {
|
||||
at: 90,
|
||||
pos: DVec3::ZERO,
|
||||
kind: EventKind::Kill { drone: 7, kind: DroneKind::Shahed, sam: 10, sam_kind: crate::sim::SamKind::Pantsir, sam_index: 0, missile: Some(500), outcome: Outcome::DisabledFalling },
|
||||
});
|
||||
let rows = chain_rows(&rec, None);
|
||||
assert_eq!(rows.len(), 1);
|
||||
for step in ["отметка", "передача", "захват", "пуск", "сбит"] {
|
||||
assert!(rows[0].text.contains(step), "the chain row misses {step}: {}", rows[0].text);
|
||||
}
|
||||
assert_eq!(rows[0].event, Some(0));
|
||||
assert!(chain_rows(&rec, Some(10)).len() == 1);
|
||||
assert!(chain_rows(&rec, Some(11)).is_empty());
|
||||
// A chain with no recorded outcome opens its launch frame on the map, held still.
|
||||
let mut player = Player::new(1, Mode::Map, &Sim::new(1));
|
||||
player.seek(&rec, rows[0].at);
|
||||
assert!(player.paused);
|
||||
assert!((player.time() - rows[0].at).abs() < 1e-9);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pages_and_filters_keep_the_original_replay_jump() {
|
||||
use crate::sim::record::{Event, SceneEvent, SceneJournal, SceneKind};
|
||||
let mut rec = Recording::blank(300);
|
||||
let mut scene = SceneJournal::default();
|
||||
for target in 1..=4 {
|
||||
scene.fixture_push(SceneEvent {
|
||||
at: target * 20,
|
||||
pos: DVec3::ZERO,
|
||||
kind: SceneKind::TrackAcquired { sam: 10, target, ever_own: true },
|
||||
});
|
||||
}
|
||||
rec.scene = Some(scene);
|
||||
rec.events.push(Event {
|
||||
at: 100,
|
||||
pos: DVec3::ZERO,
|
||||
kind: EventKind::Hit { drone: 3, kind: DroneKind::Shahed, power: 1, object: Some(0), sam: None },
|
||||
});
|
||||
let page = chain_page(&rec, Some(10), ChainFilter::NoLaunch, 1, 2);
|
||||
assert_eq!((page.index, page.total, page.rows.len()), (1, 4, 2));
|
||||
assert_eq!((page.rows[0].event, page.rows[0].at), (Some(0), 60.0));
|
||||
assert_eq!((page.rows[1].event, page.rows[1].at), (None, 80.0));
|
||||
let page = chain_page(&rec, Some(10), ChainFilter::Breach, 9, 2);
|
||||
assert_eq!((page.index, page.total, page.rows.len()), (0, 1, 1));
|
||||
assert_eq!(page.rows[0].event, Some(0));
|
||||
assert!(chain_page(&rec, Some(11), ChainFilter::All, 1, 2).rows.is_empty());
|
||||
}
|
||||
|
||||
/// A gun standing on the sea floor films from above the water, not from under it.
|
||||
#[test]
|
||||
fn the_gun_camera_is_lifted_above_the_water() {
|
||||
@@ -1538,90 +1326,6 @@ mod engine_tests {
|
||||
assert!(host.0.is_empty());
|
||||
}
|
||||
|
||||
// #150: the sounds of a window are exactly the events it holds: the same set, order and
|
||||
// names after any seek, forward or back, empty or spanning ties.
|
||||
#[test]
|
||||
fn event_sounds_are_exactly_the_events_of_the_window_after_any_seek() {
|
||||
use crate::sim::catalog::sound;
|
||||
use crate::sim::record::{Event, EventKind};
|
||||
let mut rec = Recording::blank(1000);
|
||||
rec.events = [10u32, 10, 25, 40, 40, 40, 75, 130]
|
||||
.into_iter()
|
||||
.enumerate()
|
||||
.map(|(i, at)| Event {
|
||||
at,
|
||||
pos: DVec3::new(i as f64, 80.0, 0.0),
|
||||
kind: EventKind::Crash { drone: 1, kind: DroneKind::Geran3, power: (i % 5) as u32 },
|
||||
})
|
||||
.collect();
|
||||
let names = |lo: f64, hi: f64| -> Vec<&'static str> {
|
||||
rec.events
|
||||
.iter()
|
||||
.filter(|e| (lo..hi).contains(&(e.at as f64)))
|
||||
.map(|e| match e.kind {
|
||||
EventKind::Crash { power, .. } => [sound::BLAST_AIR, sound::BLAST_MEDIUM, sound::BLAST_BIG, sound::BLAST_HEAVY, sound::BLAST_HUGE][(power as usize).min(4)],
|
||||
_ => unreachable!(),
|
||||
})
|
||||
.collect()
|
||||
};
|
||||
let mut p = player(&rec);
|
||||
let mut out = Out::default();
|
||||
for &(heard, t) in &[(0.0, 11.0), (10.0, 10.0), (11.0, 25.0), (10.0, 40.0), (25.0, 40.5), (40.0, 41.0), (40.0, 75.0), (75.0, 130.5), (130.0, 0.0), (41.0, 25.0), (10.5, 40.0)] {
|
||||
out.sounds.clear();
|
||||
p.heard = heard;
|
||||
p.t = t;
|
||||
p.sounds(&rec, DVec3::ZERO, &mut out);
|
||||
let got: Vec<&'static str> = out.sounds.iter().map(|s| s.0).collect();
|
||||
assert_eq!(got, names(heard, t), "{heard}..{t}");
|
||||
}
|
||||
}
|
||||
|
||||
// #150: the map draws every event up to now, in its order, and reads only that far.
|
||||
#[test]
|
||||
fn the_map_marks_the_events_up_to_now_in_their_order() {
|
||||
use crate::sim::record::{Event, EventKind, StrikeResult};
|
||||
let ev = |at, kind| Event { at, pos: DVec3::new(at as f64, 0.0, 0.0), kind };
|
||||
let mut rec = Recording::blank(1000);
|
||||
rec.events = vec![
|
||||
ev(100, EventKind::Kill { drone: 1, kind: DroneKind::Geran3, sam: 1, sam_kind: crate::sim::SamKind::S400, sam_index: 0, missile: None, outcome: Default::default() }),
|
||||
ev(200, EventKind::Hit { drone: 1, kind: DroneKind::Geran3, power: 2, object: None, sam: None }),
|
||||
ev(300, EventKind::Crash { drone: 1, kind: DroneKind::Geran3, power: 1 }),
|
||||
ev(400, EventKind::SamLost { sam: 1, kind: crate::sim::SamKind::S400, index: 0 }),
|
||||
ev(500, EventKind::Split { drone: 1 }),
|
||||
ev(600, EventKind::Strike { site: 1, result: StrikeResult::Stunned }),
|
||||
ev(900, EventKind::Kill { drone: 1, kind: DroneKind::Geran3, sam: 1, sam_kind: crate::sim::SamKind::S400, sam_index: 0, missile: None, outcome: Default::default() }),
|
||||
];
|
||||
rec.close();
|
||||
let at = |p: DVec3| (p.x as f32, 0.0);
|
||||
let all = |_: (f32, f32)| true;
|
||||
let colors = |shapes: Vec<Shape>| shapes
|
||||
.iter()
|
||||
.map(|s| match s {
|
||||
Shape::Fill(f) => f.color,
|
||||
Shape::Quad(q) => q.color,
|
||||
_ => 0,
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
// The kill's cross, then the hit, the crash, the lost system and the split: the earlier
|
||||
// events only, in their order.
|
||||
assert_eq!(
|
||||
colors(event_marks(&rec, 500.0, &at, &all, usize::MAX)),
|
||||
vec![0xFFFFE040, 0xFFFFE040, 0xB0FF3020, 0xB0FF3020, 0xFF200000, 0xFFFF9020]
|
||||
);
|
||||
assert_eq!(
|
||||
colors(event_marks(&rec, 600.0, &at, &all, usize::MAX)),
|
||||
vec![0xFFFFE040, 0xFFFFE040, 0xB0FF3020, 0xB0FF3020, 0xFF200000, 0xFFFF9020, 0xFFFFA040]
|
||||
);
|
||||
// The map's shape cap stops the reading; nothing past it would be kept anyway.
|
||||
assert_eq!(event_marks(&rec, 600.0, &at, &all, 3).len(), 3);
|
||||
// What lies outside the map is skipped, the rest keeps its order.
|
||||
let left = |(x, _): (f32, f32)| x < 250.0;
|
||||
assert_eq!(
|
||||
colors(event_marks(&rec, 600.0, &at, &left, usize::MAX)),
|
||||
vec![0xFFFFE040, 0xFFFFE040, 0xB0FF3020]
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_fast_replay_is_silent() {
|
||||
let rec = recording();
|
||||
|
||||
@@ -67,20 +67,16 @@ impl AirDef {
|
||||
}
|
||||
// Everything of the last layout goes: its systems with their jobs and targets, the sky,
|
||||
// the cook-offs to come; ids are made anew with the new systems.
|
||||
self.village = None;
|
||||
self.sim.clear();
|
||||
self.sim.clear_breakthroughs();
|
||||
self.sim.sams.clear();
|
||||
self.sim.targets.clear();
|
||||
self.sim.target_health.clear();
|
||||
self.sim.roles.clear();
|
||||
self.sim.last_chance = true;
|
||||
self.sim.auto_strike = false;
|
||||
self.sim.kills = 0;
|
||||
self.sim.hits = 0;
|
||||
self.sim.launched = 0;
|
||||
self.monitor = None;
|
||||
self.post = crate::post::Post::default();
|
||||
self.grid_ids.clear();
|
||||
self.moving = None;
|
||||
self.pending.clear();
|
||||
@@ -112,9 +108,6 @@ impl AirDef {
|
||||
))
|
||||
}
|
||||
["load", name, flags @ ..] => {
|
||||
if self.village_active() {
|
||||
return Err("Чтобы загрузить другой сценарий, остановите «Оборону деревни»".into());
|
||||
}
|
||||
let name = valid(name)?;
|
||||
let bytes = storage::get(&key(&name)).ok_or(format!("Нет сценария «{name}» (/airdef scenario list)"))?;
|
||||
self.apply_scenario(&String::from_utf8_lossy(&bytes), flags.contains(&"force"))?;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user