mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-12-01 05:43:22 +01:00
Fix: Legendary camouflage parts, materials, names and attachments
Fixes a batch of legendary camouflage problems in the Tankopedia viewer, adds three missing unique camouflages and lets attachments be shown together with a camouflage.
## Camouflage parts (state switchers)
- Camouflages now choose which tank pieces show the same way the game does. Each switcher's load-time scenario script runs at export time (checks for attached camouflage items, or compares the camouflage preset), along with its state-switch actions. This replaces the old guess from part names (new `core/blitzkit/switcherStates.ts`).
- Fixes missing roof MGs, fenders and fuel tanks (IS-3 Bear, Obj. 140 Terror, IS-7, IS-4, FV215b 183, AMX 50 B, KV-1S) and default parts mixed into camouflages (Pershing Speedfire, Forest Witch Fullmetal, Waffenträger Goldstreifen).
- Switchers inside camouflage parts now show one state instead of all of them stacked (Obj. Kust double net, Goldstreifen stowage, Tiger II cat).
- States are matched by original node names, because the GLTF loader renames duplicates.
- Camouflage part meshes with no LODs (`lodIndex -1`) are kept, which restores the Tiger II cat body and missing pieces on about 11 other camouflages.
## Materials
- `AlphaBlend` materials export as transparent. `AlphaBlendAdditive` materials export as additive and are applied in `jsxTree`, and unlit `Textured` materials export as unlit (IS-8 Raroh flames, dinosaur holograms, and glass and screens on a few base tanks).
- Camouflage part materials that share a name with the tank's material no longer replace the tank's camouflage material (Bisonte C45 Unbreakable).
## Names
- With a legendary camouflage selected, the title shows the tank's in-battle name ("GuP Type 95 Ha-Go", "KV-1 Warrior", "Shinobi").
- Camouflages without a name in the game files yet show "Unreleased" in orange instead of their raw string key, and no longer crash the tank names list.
## Attachments
- Attachments (`kind: customization`) are listed in their own group under the camouflages and can be turned on together with a camouflage. They load the same way as camouflages and fade with the same transition.
## Other
- Liberté, You Rock! and Ozzie (single-tank camouflages that only set a preset through `override`) are now available.
- Mastery gun mark meshes (`custom_gun_marks_*`) are no longer drawn (Helsing, HWT20 FalconFire and two camouflage guns).
## Not included
- Pixel Wave, Digital Trace and Forest Shadow are tiled pattern camouflages, which the viewer can't render yet.
- FV301 Corbie's drone position and the dinosaur heads' glow depend on camouflage animations and emissive materials, which are separate PRs.
Fixes #417
Fixes #419
Fixes #421
This commit is contained in:
1 parent
091607b0a8
commit
0f299335d6
18 files changed
+559
-113
No files matched your search
@@ -18,7 +18,11 @@ async function loadSkin(path: string) {
|
||||
const materials: Material[] = await gltf.parser.getDependencies("material");
|
||||
const skin = {
|
||||
scene: gltf.scene,
|
||||
materials: new Map(materials.map((material) => [material.name, material])),
|
||||
materials: new Map(
|
||||
materials
|
||||
.filter((material) => material.userData.camouflage)
|
||||
.map((material) => [material.name, material]),
|
||||
),
|
||||
};
|
||||
|
||||
loadedSkins.set(path, skin);
|
||||
@@ -30,9 +34,16 @@ function skinPath(id: number, skin: number) {
|
||||
return alias("models_legendary", `/${id}/skins/${skin}.glb`);
|
||||
}
|
||||
|
||||
export function useSkin(id: number) {
|
||||
const requestedSkin = Tankopedia.use((state) => state.requestedSkin);
|
||||
const skin = Tankopedia.use((state) => state.skin);
|
||||
// attachments load the same way as camouflages and can be shown with one
|
||||
const slots = {
|
||||
skin: { requested: "requestedSkin", loaded: "loadedSkin" },
|
||||
attachment: { requested: "requestedAttachment", loaded: "loadedAttachment" },
|
||||
} as const;
|
||||
|
||||
export function useSkin(id: number, slot: keyof typeof slots = "skin") {
|
||||
const { requested, loaded } = slots[slot];
|
||||
const requestedSkin = Tankopedia.use((state) => state[requested]);
|
||||
const skin = Tankopedia.use((state) => state[slot]);
|
||||
|
||||
useEffect(() => {
|
||||
const path =
|
||||
@@ -41,7 +52,7 @@ export function useSkin(id: number) {
|
||||
|
||||
if (path === undefined || loadedSkins.has(path)) {
|
||||
Tankopedia.mutate((draft) => {
|
||||
draft.loadedSkin = requestedSkin;
|
||||
draft[loaded] = requestedSkin;
|
||||
});
|
||||
return;
|
||||
}
|
||||
@@ -62,8 +73,8 @@ export function useSkin(id: number) {
|
||||
|
||||
settled = true;
|
||||
Tankopedia.mutate((draft) => {
|
||||
draft.loadedSkin = requestedSkin;
|
||||
draft.skin = requestedSkin;
|
||||
draft[loaded] = requestedSkin;
|
||||
draft[slot] = requestedSkin;
|
||||
draft.revealed = true;
|
||||
});
|
||||
});
|
||||
@@ -76,7 +87,7 @@ export function useSkin(id: number) {
|
||||
draft.revealed = true;
|
||||
});
|
||||
};
|
||||
}, [id, requestedSkin]);
|
||||
}, [id, slot, requestedSkin]);
|
||||
|
||||
return skin === undefined ? undefined : loadedSkins.get(skinPath(id, skin));
|
||||
}
|
||||
Reference in new issue
Block a user