diff --git a/.gitattributes b/.gitattributes index 2947087..96e8718 100644 --- a/.gitattributes +++ b/.gitattributes @@ -4,3 +4,4 @@ *.png binary *.jpg binary *.hmod binary +*.patch -text diff --git a/docs/INSTALL.md b/docs/INSTALL.md index e021e14..13bb86c 100644 --- a/docs/INSTALL.md +++ b/docs/INSTALL.md @@ -82,6 +82,10 @@ python3 tools/airdef.py play # или: python3 tools/airdef.py play --world " ## 3. В игре +- Обновление из исходников: `git pull`, затем снова `all` (Windows: `py tools\airdef.py all`). Форк и упаковщик мода + пересоберутся сами, если патчи изменились. +- Windows: нужна видеокарта с Vulkan. Экспорт фильмов (`/airdef replay export`) требует `ffmpeg` в PATH или `HORIZON_FFMPEG`. +- Шейдеры уровня шейдерпаков: `/airdef shader hd`. Для слабой видеокарты перед запуском: `$env:HORIZON_HD_SCALE="0.67"` (PowerShell). - Создай мир с читами (или включи их через «Открыть для сети»): мод выдаёт пульты и взрывы командами. - `/airdef give` — пульты, **N** — командный пункт (роли ПВО), **K** — монитор комплекса, `/airdef wave mix 20` — налёт. Подробнее — README. diff --git a/tools/airdef.py b/tools/airdef.py index b46bd90..257650c 100644 --- a/tools/airdef.py +++ b/tools/airdef.py @@ -71,7 +71,8 @@ def fork(): stamp = fork_stamp(commit, patches) stamp_file = FORK / ".git" / "airdef-stamp" if not (FORK / ".git").exists(): - run(["git", "clone", "--filter=blob:none", UPSTREAM, FORK]) + # Без CRLF на Windows: патчи накладываются на файлы как в апстриме. + run(["git", "clone", "-c", "core.autocrlf=false", "--filter=blob:none", UPSTREAM, FORK]) branch = subprocess.run(["git", "-C", FORK, "branch", "--show-current"], capture_output=True, text=True).stdout.strip() if branch == "airdef" and stamp_file.exists() and stamp_file.read_text().strip() == stamp: print("horizon/: ветка airdef на нужных коммите и патчах") @@ -110,11 +111,16 @@ def built_game() -> Path: def mod(): tool = shutil.which("cargo-horizon-mod") or Path.home() / ".cargo" / "bin" / ("cargo-horizon-mod" + EXE) - if not Path(tool).exists(): - if not (FORK / "Cargo.toml").exists(): - fork() + if not (FORK / "Cargo.toml").exists(): + fork() + # Упаковщик должен быть от этого форка: старый не знает новых уровней API. + stamp_file = FORK / ".git" / "airdef-packer-stamp" + commit = (ROOT / "HORIZON_COMMIT").read_text().strip() + stamp = fork_stamp(commit, sorted((ROOT / "horizon-patches").glob("*.patch"))) + if not Path(tool).exists() or not stamp_file.exists() or stamp_file.read_text().strip() != stamp: # Without trial runs (wasmtime): building a mod needs only packing, a fraction of the compile. - run([cargo(), "install", "--locked", "--no-default-features", "--path", FORK / "crates" / "cargo-horizon-mod"]) + run([cargo(), "install", "--locked", "--force", "--no-default-features", "--path", FORK / "crates" / "cargo-horizon-mod"]) + stamp_file.write_text(stamp + "\n") run([cargo(), "horizon-mod", "build"], cwd=ROOT / "airdef-mod")