diff --git a/42.20/mod.info b/42.20/mod.info index 11a41eb..10f8d99 100644 --- a/42.20/mod.info +++ b/42.20/mod.info @@ -1,8 +1,13 @@ name=Knox Buildworks - Viewpoint Compatibility -id=KnoxBuildworksViewpointCrates -author=Local compatibility patch +id=hrsys_knoxbuildworksviewpoint +poster=../common/media/textures/preview.png + +description=3D military crate models for Knox Buildworks in Project Viewpoint. +author=Riggs0 +category=building +icon=../common/media/textures/preview.png +url=https://hudsonriggs.systems modversion=2.1.0 -description=Green, gray-green (#626763) and white military crates. Gray crates use retextured green crate meshes. +versionMin=42.20.0 require=KnoxBuildworks,Viewpoint,PZVoxelStudioViewpoint loadAfter=KnoxBuildworks,PZVoxelStudioViewpoint,Viewpoint -versionMin=42.0 diff --git a/README.md b/README.md index e53bc45..586f612 100644 --- a/README.md +++ b/README.md @@ -16,14 +16,14 @@ KnoxBuildWorksViewpoint/ docs/ Detailed notes and mesh preview ``` -The mod ID remains **KnoxBuildworksViewpointCrates**. Enable it after Knox Buildworks, Project Viewpoint and PZVoxelStudioViewpoint. Fully restart Zomboid after updates. +The mod ID is **hrsys_knoxbuildworksviewpoint**. Enable it after Knox Buildworks, Project Viewpoint and PZVoxelStudioViewpoint. Existing saves or server configurations using the earlier ID `KnoxBuildworksViewpointCrates` need to enable the new ID. Fully restart Zomboid after updates. ## Link the repository After moving aside the previous copied folder at `Zomboid/mods/KnoxBuildworksViewpointCrates`, run in PowerShell with symbolic-link support: ```powershell -New-Item -ItemType SymbolicLink -Path "$env:USERPROFILE\Zomboid\mods\KnoxBuildworksViewpointCrates" -Target "$env:USERPROFILE\Git\KnoxBuildWorksViewpoint" +New-Item -ItemType SymbolicLink -Path "$env:USERPROFILE\Zomboid\mods\hrsys_knoxbuildworksviewpoint" -Target "$env:USERPROFILE\Git\KnoxBuildWorksViewpoint" ``` The game then reads `common` and `42.20` directly from this checkout. Use one copy of this mod ID in the mods folder. The migration did not replace your existing local installation or create the link. diff --git a/common/media/lua/client/ZZ_KnoxViewpointCrates.lua b/common/media/lua/client/ZZ_KnoxViewpointCrates.lua index 3f72165..103a23b 100644 --- a/common/media/lua/client/ZZ_KnoxViewpointCrates.lua +++ b/common/media/lua/client/ZZ_KnoxViewpointCrates.lua @@ -4,7 +4,7 @@ local warned = false local function register() if registered or not Viewpoint or not Viewpoint.ModelPacks then return end local ok, result = pcall(Viewpoint.ModelPacks.register, - "KnoxBuildworksViewpointCrates", "media/knox-viewpoint-crates.properties") + "hrsys_knoxbuildworksviewpoint", "media/knox-viewpoint-crates.properties") if ok and result then registered = true print("[Knox Viewpoint Crates] Registered 18 reviewed compatibility sprite bindings.") diff --git a/common/media/textures/preview.png b/common/media/textures/preview.png new file mode 100644 index 0000000..912bc28 Binary files /dev/null and b/common/media/textures/preview.png differ diff --git a/docs/COMPATIBILITY.md b/docs/COMPATIBILITY.md index 99afcf0..f12914b 100644 --- a/docs/COMPATIBILITY.md +++ b/docs/COMPATIBILITY.md @@ -1,8 +1,8 @@ # Knox Buildworks - Viewpoint Compatibility -The matcher and the updated patch are installed locally. Enable **Knox Buildworks - Viewpoint Compatibility** after Knox Buildworks, Project Viewpoint and 6244 models for Viewpoint. It retains the original patch's mod ID, `KnoxBuildworksViewpointCrates`, so an already-enabled crate patch does not require a second mod entry. Fully restart the game after this update. +Enable **Knox Buildworks - Viewpoint Compatibility** after Knox Buildworks, Project Viewpoint and 6244 models for Viewpoint. The mod ID is `hrsys_knoxbuildworksviewpoint`. Existing saves or server configurations using the earlier ID `KnoxBuildworksViewpointCrates` need to enable the new ID. Fully restart the game after this update. -Installed folder: `C:\Users\Hudson\Zomboid\mods\KnoxBuildworksViewpointCrates`. +Suggested mods link: `C:\Users\Hudson\Zomboid\mods\hrsys_knoxbuildworksviewpoint`, pointing at the repository root. ## What it actually matches @@ -22,33 +22,33 @@ The installed authored model pack already binds 2,821 distinct sprite names refe **216 buildables have parts with no accepted compatible authored model (561 sprite references).** I reviewed their families, metadata, candidate matches and relevant sprite contact sheets. They include specialized wall/door trims, curtains/open states, particular window shapes, signage and multi-tile railing parts. Assigning similar furniture, signs with different artwork, or a complete model to each small section would produce incorrect objects. Their existing native rendering is retained. Faithful additional replacements require suitable model assets or new mesh/texture work; the script does not claim that these gaps are fixed. -- `matching-reports/unmatched.md`: the focused list of remaining buildables and reasons. -- `matching-reports/results.md`: complete readable matching/native-rendering results. -- `matching-reports/applied-matches.json`: every applied source-to-target assignment. -- `matching-reports/sprite-decisions.json`: evidence, native routes and candidate shortlists per sprite. -- `matching-reports/buildable-coverage.json`: all catalogue entries with their referenced sprites/statuses. -- `reviewed-matches.json`: editable manual assignments, white adaptation rules, stack variants and review decisions. +- `reports/unmatched.md`: the focused list of remaining buildables and reasons. +- `reports/results.md`: complete readable matching/native-rendering results. +- `reports/applied-matches.json`: every applied source-to-target assignment. +- `reports/sprite-decisions.json`: evidence, native routes and candidate shortlists per sprite. +- `reports/buildable-coverage.json`: all catalogue entries with their referenced sprites/statuses. +- `tools/reviewed-matches.json`: editable manual assignments, white adaptation rules, stack variants and review decisions. ## Run the matcher -From this folder in PowerShell: +From the repository root in PowerShell: ```powershell -.\Match-KnoxViewpoint.ps1 -Install +.\tools\Match-KnoxViewpoint.ps1 ``` -The launcher uses the Python bundled with Codex on this computer. Elsewhere, pass `-PythonExecutable` with Python 3.10+ and Pillow installed. Pass `-WorkshopRoot` and `-GameDirectory` if Steam uses a different library. Without `-Install`, it only builds the output folder and reports. +The launcher uses the Python bundled with Codex on this computer. Elsewhere, pass `-PythonExecutable` with Python 3.10+ and Pillow installed. Pass `-WorkshopRoot` and `-GameDirectory` if Steam uses a different library. The default output is the repository root (`common` and `42.20`); reports go in `reports/`. Use a normal rebuild when the repository is symlinked into the mods folder. -`Build-KnoxViewpointPatch.ps1` is now a compatibility launcher for the expanded matcher. Run the matcher again after Workshop updates. It reads the source author's actual manifest registration order, checks that reviewed crate targets/sources still identify crates, and copies only the selected OBJ files and their material/texture dependencies. Source Workshop files are untouched. +`tools/Build-KnoxViewpointPatch.ps1` is now a compatibility launcher for the expanded matcher. Run the matcher again after Workshop updates. It reads the source author's actual manifest registration order, checks that reviewed crate targets/sources still identify crates, and copies only the selected OBJ files and their material/texture dependencies. Source Workshop files are untouched. -Add a reviewed assignment under `matches` in `reviewed-matches.json` using an existing source sprite, evidence, and expected source/target CustomName. A regular assignment reuses the source model and transform; `adaptation: white-crate` additionally creates a white texture atlas. A `tint` value such as `#626763` retints a green atlas while preserving relative luminance and alpha. Reviewed choices take precedence over automatic aliases. Candidate shortlists are suggestions, not approved assignments. Rebuild after editing. +Add a reviewed assignment under `matches` in `tools/reviewed-matches.json` using an existing source sprite, evidence, and expected source/target CustomName. A regular assignment reuses the source model and transform; `adaptation: white-crate` additionally creates a white texture atlas. A `tint` value such as `#626763` retints a green atlas while preserving relative luminance and alpha. Reviewed choices take precedence over automatic aliases. Candidate shortlists are suggestions, not approved assignments. Rebuild after editing. ## Validation and limits - Matcher regression tests cover the crate/sign numbering collision, real aliases, properties-only tile blocks, variant IDs, capitalized/hyphenated sprite names, native routes, manifest precedence, review suggestions and white adaptation/source preservation. - Installed Viewpoint Java parsers accept all 18 bindings, meshes, materials and texture references with zero manifest errors. - Zomboid's Kahlua compiler and mocked boot/start registration/retry checks pass. -- `crate-model-preview.png` is an offline mesh preview, not an in-game screenshot. +- `docs/crate-model-preview.png` is an offline mesh preview, not an in-game screenshot. - In-game appearance has not been visually tested. Check green, gray and white crates in both orientations and in stacks after restarting. Existing crates should pick up their bindings when loaded. Colored paint finishes may remain neutral white in Viewpoint. This patch changes rendering bindings only. It does not rewrite save objects, sprite names, recipes, inventory or container contents/capacity. Disable this patch to remove its bindings while keeping the original construction mods enabled. The bundled asset copies are for this private local build; sour_kisel owns the source models and textures. diff --git a/mod.info b/mod.info index 11a41eb..3b8454d 100644 --- a/mod.info +++ b/mod.info @@ -1,8 +1,13 @@ name=Knox Buildworks - Viewpoint Compatibility -id=KnoxBuildworksViewpointCrates -author=Local compatibility patch +id=hrsys_knoxbuildworksviewpoint +poster=common/media/textures/preview.png + +description=3D military crate models for Knox Buildworks in Project Viewpoint. +author=Riggs0 +category=building +versionMin=42.20.0 +url=https://hudsonriggs.systems modversion=2.1.0 -description=Green, gray-green (#626763) and white military crates. Gray crates use retextured green crate meshes. +icon=common/media/textures/preview.png require=KnoxBuildworks,Viewpoint,PZVoxelStudioViewpoint loadAfter=KnoxBuildworks,PZVoxelStudioViewpoint,Viewpoint -versionMin=42.0 diff --git a/preview.png b/preview.png new file mode 100644 index 0000000..912bc28 Binary files /dev/null and b/preview.png differ diff --git a/previewfs.png b/previewfs.png new file mode 100644 index 0000000..9b8b3d0 Binary files /dev/null and b/previewfs.png differ diff --git a/tools/Match-KnoxViewpoint.py b/tools/Match-KnoxViewpoint.py index 5502dd6..cb8a33b 100644 --- a/tools/Match-KnoxViewpoint.py +++ b/tools/Match-KnoxViewpoint.py @@ -15,7 +15,7 @@ import struct from pathlib import Path from PIL import Image -MOD_ID = 'KnoxBuildworksViewpointCrates' # Retain the ID of the previously installed patch. +MOD_ID = 'hrsys_knoxbuildworksviewpoint' HERE = Path(__file__).resolve().parent REPO_ROOT = HERE.parent VERSION_FOLDER = '42.20' @@ -377,6 +377,20 @@ def copy_asset(source_root, binding, media, white=False, tint=None): shutil.copy2(texture,texture_out) return target.relative_to(media).as_posix(), tag +def mod_info(versioned=False): + prefix='../' if versioned else '' + art=f'{prefix}common/media/textures/preview.png' + lines=['name=Knox Buildworks - Viewpoint Compatibility',f'id={MOD_ID}',f'poster={art}','', + 'description=3D military crate models for Knox Buildworks in Project Viewpoint.', + 'author=Riggs0','category=building'] + if versioned: + lines += [f'icon={art}','url=https://hudsonriggs.systems','modversion=2.1.0','versionMin=42.20.0'] + else: + lines += ['versionMin=42.20.0','url=https://hudsonriggs.systems','modversion=2.1.0',f'icon={art}'] + lines += ['require=KnoxBuildworks,Viewpoint,PZVoxelStudioViewpoint', + 'loadAfter=KnoxBuildworks,PZVoxelStudioViewpoint,Viewpoint',''] + return '\n'.join(lines) + def build_pack(output, source_root, bindings, assignments): media=output/'common/media' media.mkdir(parents=True,exist_ok=True) @@ -395,19 +409,24 @@ def build_pack(output, source_root, bindings, assignments): _,*transform=binding['value'].split(',') lines.append(f"bind.{target}={models[key]},{','.join(transform)}") (media/'knox-viewpoint-crates.properties').write_text('\n'.join(lines)+'\n',encoding='utf-8') - info='\n'.join(['name=Knox Buildworks - Viewpoint Compatibility',f'id={MOD_ID}','author=Local compatibility patch', - 'modversion=2.1.0','description=Green, gray-green (#626763) and white military crates. Gray crates use retextured green crate meshes.', - 'require=KnoxBuildworks,Viewpoint,PZVoxelStudioViewpoint','loadAfter=KnoxBuildworks,PZVoxelStudioViewpoint,Viewpoint','versionMin=42.0','']) (output/VERSION_FOLDER).mkdir(parents=True,exist_ok=True) - (output/VERSION_FOLDER/'mod.info').write_text(info,encoding='utf-8') - (output/'mod.info').write_text(info,encoding='utf-8') + (output/VERSION_FOLDER/'mod.info').write_text(mod_info(versioned=True),encoding='utf-8') + (output/'mod.info').write_text(mod_info(),encoding='utf-8') + # Keep the published preview and mod-list art consistent on future rebuilds. + preview=output/'preview.png' + if not preview.exists(): + preview=REPO_ROOT/'preview.png' + if preview.exists(): + art=media/'textures/preview.png' + art.parent.mkdir(parents=True,exist_ok=True) + shutil.copy2(preview,art) lua='''-- Render bindings only. No recipe, object, inventory or save changes. local registered = false local warned = false local function register() if registered or not Viewpoint or not Viewpoint.ModelPacks then return end local ok, result = pcall(Viewpoint.ModelPacks.register, - "KnoxBuildworksViewpointCrates", "media/knox-viewpoint-crates.properties") + "%MOD_ID%", "media/knox-viewpoint-crates.properties") if ok and result then registered = true print("[Knox Viewpoint Crates] Registered %COUNT% reviewed compatibility sprite bindings.") @@ -419,7 +438,7 @@ end Events.OnGameBoot.Add(register) Events.OnGameStart.Add(register) register() -'''.replace('%COUNT%',str(len(assignments))) +'''.replace('%MOD_ID%',MOD_ID).replace('%COUNT%',str(len(assignments))) (media/'lua/client').mkdir(parents=True,exist_ok=True) (media/'lua/client/ZZ_KnoxViewpointCrates.lua').write_text(lua,encoding='utf-8') return len(models)