mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-22 19:19:52 +02:00
feat: some armor rules
This commit is contained in:
1 parent
6239a72bce
commit
8e6d2b9873
7 files changed
+205
-13
No files matched your search
@@ -22,8 +22,12 @@ export function TankArmor() {
|
||||
if (!state.areTanksAssigned) return;
|
||||
return state.protagonist;
|
||||
});
|
||||
const antagonist = useTankopedia((state) => {
|
||||
if (!state.areTanksAssigned) return;
|
||||
return state.antagonist;
|
||||
});
|
||||
|
||||
if (!protagonist) return null;
|
||||
if (!protagonist || !antagonist) return null;
|
||||
|
||||
const gltf = useLoader(
|
||||
GLTFLoader,
|
||||
@@ -80,15 +84,25 @@ export function TankArmor() {
|
||||
<group rotation={[-Math.PI / 2, 0, model.hullYaw]}>
|
||||
{nodes.map((node) => {
|
||||
const isHull = node.name.startsWith('hull_');
|
||||
const armorId = parseInt(node.name.match(/.+_armor_(\d+)/)![1]);
|
||||
const isVisible = isHull;
|
||||
const thickness = tankModelDefinition.armor.thickness[armorId] ?? 0;
|
||||
|
||||
if (!isVisible) return null;
|
||||
return (
|
||||
<ArmorMesh key={node.uuid} geometry={(node as Mesh).geometry} />
|
||||
<ArmorMesh
|
||||
key={node.uuid}
|
||||
geometry={(node as Mesh).geometry}
|
||||
thickness={thickness}
|
||||
penetration={100}
|
||||
ricochet={antagonist.shell.ricochet * (Math.PI / 180)}
|
||||
caliber={antagonist.shell.caliber}
|
||||
normalization={antagonist.shell.normalization}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
|
||||
<group position={turretPosition} rotation={turretRotation}>
|
||||
{/* <group position={turretPosition} rotation={turretRotation}>
|
||||
{nodes.map((node) => {
|
||||
const isCurrentTurret = node.name.startsWith(
|
||||
`turret_${turretModelDefinition.model
|
||||
@@ -133,7 +147,7 @@ export function TankArmor() {
|
||||
);
|
||||
})}
|
||||
</group>
|
||||
</group>
|
||||
</group> */}
|
||||
</group>
|
||||
</HeadsUpDisplay>
|
||||
);
|
||||
|
||||
@@ -132,6 +132,8 @@ export function VersusBar() {
|
||||
tank.turrets.at(-1)!;
|
||||
draft.antagonist.gun =
|
||||
draft.antagonist.turret.guns.at(-1)!;
|
||||
draft.antagonist.shell =
|
||||
draft.antagonist.gun.shells[0];
|
||||
});
|
||||
setVersusTankSearchResults([]);
|
||||
versusTankSearchInput.current!.value = '';
|
||||
@@ -176,6 +178,8 @@ export function VersusBar() {
|
||||
draft.antagonist.turret = turret;
|
||||
draft.antagonist.gun =
|
||||
turret.guns.at(-1)!;
|
||||
draft.antagonist.shell =
|
||||
draft.antagonist.gun.shells[0];
|
||||
});
|
||||
}}
|
||||
selected={antagonist.turret.id === turret.id}
|
||||
@@ -210,6 +214,7 @@ export function VersusBar() {
|
||||
mutateTankopedia((draft) => {
|
||||
if (!draft.areTanksAssigned) return;
|
||||
draft.antagonist.gun = gun;
|
||||
draft.antagonist.shell = gun.shells[0];
|
||||
});
|
||||
}}
|
||||
selected={antagonist.gun.id === gun.id}
|
||||
|
||||
@@ -33,7 +33,10 @@ export default function Page({ params }: { params: { id: string } }) {
|
||||
draft.protagonist.tank = awaitedTankDefinitions[id];
|
||||
draft.protagonist.turret = draft.protagonist.tank.turrets.at(-1)!;
|
||||
draft.protagonist.gun = draft.protagonist.turret.guns.at(-1)!;
|
||||
draft.antagonist = draft.protagonist;
|
||||
draft.antagonist = {
|
||||
...draft.protagonist,
|
||||
shell: draft.protagonist.gun.shells[0],
|
||||
};
|
||||
});
|
||||
|
||||
return () => {
|
||||
|
||||
Reference in new issue
Block a user