oh shit i forgot to commit... uhh i added state icons

This commit is contained in:
tresabhi committed 2026-05-31 14:45:20 -05:00
1 parent 477b9a9630
commit 6aa14d2faf
22 files changed
+93 -63

No files matched your search

+2 -1
View File
@@ -7,6 +7,7 @@
"oodle", "oodle",
"blitzkit", "blitzkit",
"webp", "webp",
"hocs" "hocs",
"cooldown"
] ]
} }
Binary file not shown.

After

Width:  |  Height:  |  Size: 849 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 760 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 940 B

@@ -41,8 +41,8 @@
} }
.content { .content {
--cell-width: 3rem; --cell-width: 2rem;
--toy-span: 5; --toy-span: 6;
display: grid; display: grid;
grid-auto-rows: var(--cell-width); grid-auto-rows: var(--cell-width);
@@ -71,14 +71,14 @@
.bar-wrapper { .bar-wrapper {
flex: 1; flex: 1;
height: var(--space-2); height: var(--space-1);
background-color: var(--gray-3); background-color: var(--gray-3);
border-radius: var(--radius-max); border-radius: var(--radius-max);
overflow: hidden; overflow: hidden;
.bar { .bar {
background-color: green; background-color: var(--jade-9);
width: 75%; width: 75%;
height: 100%; height: 100%;
} }
@@ -13,13 +13,25 @@
} }
} }
.state { .states {
display: flex; display: flex;
flex-wrap: wrap; flex-direction: column;
gap: var(--space-3); gap: var(--space-2);
.toggle { .group {
font-size: 2em; display: flex;
flex-wrap: wrap;
gap: var(--space-2);
.state {
font-size: 1.25em;
&[data-selected="true"] {
img {
filter: sepia(1) saturate(10);
}
}
}
} }
} }
@@ -84,22 +84,28 @@ function State() {
</IconButton> </IconButton>
</div> </div>
<div className={styles.state}> <div className={styles.states}>
{vehicleStatusKeys.map((key) => ( {vehicleStatusKeys.map((group, index) => (
<IconButton <div key={index} className={styles.group}>
key={key} {group.map((key) => (
radius="1" <IconButton
className={styles.toggle} key={key}
color={status[key] ? undefined : "gray"} radius="1"
variant={status[key] ? "surface" : "soft"} className={styles.state}
onClick={() => { data-selected={status[key]}
Tankopedia.mutate((draft) => { color={status[key] ? "amber" : "gray"}
draft.protagonist.status[key] = !draft.protagonist.status[key]; variant={status[key] ? "surface" : "soft"}
}); onClick={() => {
}} Tankopedia.mutate((draft) => {
> draft.protagonist.status[key] =
<img src={`/media/status/${key}.svg`} /> !draft.protagonist.status[key];
</IconButton> });
}}
>
<img src={`/media/status/${key}.png`} />
</IconButton>
))}
</div>
))} ))}
</div> </div>
</div> </div>
@@ -1,6 +1,5 @@
import { OrbitControls } from "@react-three/drei"; import { OrbitControls } from "@react-three/drei";
import { Canvas, useLoader } from "@react-three/fiber"; import { useLoader } from "@react-three/fiber";
import { FogExp2 } from "three";
import { GLTFLoader } from "three-stdlib"; import { GLTFLoader } from "three-stdlib";
import styles from "./index.module.css"; import styles from "./index.module.css";
@@ -8,14 +7,14 @@ export function TankopediaSandbox() {
return ( return (
<div className={styles.wrapper}> <div className={styles.wrapper}>
<div className={styles.sandbox}> <div className={styles.sandbox}>
<Canvas {/*<Canvas
scene={{ fog: new FogExp2("black", 0.05) }} scene={{ fog: new FogExp2("black", 0.05) }}
shadows shadows
className={styles.canvas} className={styles.canvas}
frameloop="demand" frameloop="demand"
> >
{!import.meta.env.SSR && <Content />} {!import.meta.env.SSR && <Content />}
</Canvas> </Canvas>*/}
</div> </div>
</div> </div>
); );
@@ -24,10 +23,9 @@ export function TankopediaSandbox() {
function Content() { function Content() {
const gltf = useLoader(GLTFLoader, "/amogos.glb"); const gltf = useLoader(GLTFLoader, "/amogos.glb");
gltf.scene.traverse(child => gltf.scene.traverse((child) => {
{
child.castShadow = true; child.castShadow = true;
}) });
return ( return (
<> <>
@@ -2,10 +2,10 @@
import "@radix-ui/colors/violet-dark.css"; import "@radix-ui/colors/violet-dark.css";
import { api } from "../../../../api/dynamic"; import { api } from "../../../../api/dynamic";
import { mixStaticPaths } from "../../../../astro/mixStaticPaths"; import { mixStaticPaths } from "../../../../astro/mixStaticPaths";
import ColorScale from "../../../../components/ColorScale.astro";
import BaseLayout from "../../../../layouts/BaseLayout.astro"; import BaseLayout from "../../../../layouts/BaseLayout.astro";
import { getStaticPaths as _getStaticPaths } from "../index.astro"; import { getStaticPaths as _getStaticPaths } from "../index.astro";
import { Page } from "./_index"; import { Page } from "./_index";
import ColorScale from "../../../../components/ColorScale.astro";
export const getStaticPaths = mixStaticPaths(_getStaticPaths, async () => { export const getStaticPaths = mixStaticPaths(_getStaticPaths, async () => {
const { list } = await api.tankList(); const { list } = await api.tankList();
@@ -21,5 +21,8 @@ const { id, locale } = Astro.props;
<BaseLayout {locale} accent="violet"> <BaseLayout {locale} accent="violet">
<ColorScale color="red" /> <ColorScale color="red" />
<ColorScale color="jade" />
<ColorScale color="amber" />
<Page {locale} {id} client:load /> <Page {locale} {id} client:load />
</BaseLayout> </BaseLayout>
@@ -242,12 +242,12 @@ export const characteristics = {
const maxSpeed = characteristic("speed_forward") as number; const maxSpeed = characteristic("speed_forward") as number;
return ( return (
(state.isGunDamaged ? gunDamaged : 1) * (state.status.gun_damaged ? gunDamaged : 1) *
(base + (base +
(state.speed / maxSpeed) * movement + (state.speed / maxSpeed) * movement +
(state.isHullTraversing ? vehicleRotation : 0) + (state.status.hull_traversing ? vehicleRotation : 0) +
(state.isTurretTraversing ? turretRotation : 0) + (state.status.turret_traversing ? turretRotation : 0) +
(state.isShooting ? afterShot : 0)) (state.status.shooting ? afterShot : 0))
); );
}, },
@@ -376,7 +376,7 @@ export const characteristics = {
100 * 100 *
base * base *
(1 + moving * state.speed) * (1 + moving * state.speed) *
(state.isShooting ? shooting : 1) (state.status.shooting ? shooting : 1)
); );
}, },
@@ -409,7 +409,7 @@ export const characteristics = {
}, },
id({ state }) { id({ state }) {
return state.id; return state.id.split(".").at(-1)!;
}, },
slug({ tank }) { slug({ tank }) {
@@ -103,8 +103,13 @@ export const characteristicsOrder: CharacteristicsGroup[] = [
{ name: "module_damage", units: "hp" }, { name: "module_damage", units: "hp" },
{ name: "clip_size" }, { name: "clip_size" },
{ name: "intra_clip", decimals: 2, units: "s" }, { name: "intra_clip", decimals: 2, units: "s" },
// { name: "burst_size" }, // TODO: implement burst size
// { name: 'intra_burst', decimals: 2, units: "s" }, // TODO: implement intra burst
// TODO: investigate ATTRIBUTE_NAME_SHELLS_SLOTS
// TODO: investigate ATTRIBUTE_NAME_RELOAD_SPEED_SCALE
// TODO: investigate ATTRIBUTE_NAME_AVERAGE_THICKNESS
{ toy: "ricochet" }, // { toy: "ricochet" },
{ name: "penetration", units: "mm" }, { name: "penetration", units: "mm" },
{ name: "caliber", units: "mm" }, { name: "caliber", units: "mm" },
{ name: "normalization", units: "deg" }, { name: "normalization", units: "deg" },
@@ -114,29 +119,33 @@ export const characteristicsOrder: CharacteristicsGroup[] = [
{ name: "shell_range", units: "m" }, { name: "shell_range", units: "m" },
{ name: "shell_capacity" }, { name: "shell_capacity" },
{ toy: "aim_time" }, // { toy: "aim_time" },
{ name: "aim_time", decimals: 1, units: "s" }, { name: "aim_time", decimals: 1, units: "s" },
{ name: "dispersion", decimals: 3, units: "m" }, { name: "dispersion", decimals: 3, units: "m" },
// { name: "dispersion_angle", decimals: 3, units: "m" }, // TODO: implement dispersion angle
{ toy: "flexibility" }, // { toy: "flexibility" },
{ name: "gun_depression", decimals: 0, units: "deg" }, { name: "gun_depression", decimals: 0, units: "deg" },
{ name: "gun_elevation", decimals: 0, units: "deg" }, { name: "gun_elevation", decimals: 0, units: "deg" },
// { name: "gun_yaw_range", decimals: 0, units: "deg" }, // TODO: implement gun yaw range
], ],
}, },
{ {
group: "maneuverability", group: "maneuverability",
order: [ order: [
{ toy: "traverse" }, // { toy: "traverse" },
{ name: "speed_forward", units: "km_h" }, { name: "speed_forward", units: "km_h" },
{ name: "speed_backward", units: "km_h" }, { name: "speed_backward", units: "km_h" },
{ name: "engine_power", units: "bhp" }, { name: "engine_power", units: "bhp" },
// { name: "brake_force", units: "N" }, // TODO: implement brake force
{ name: "weight", decimals: 1, units: "t" }, { name: "weight", decimals: 1, units: "t" },
{ name: "terrain_coefficient" }, { name: "terrain_coefficient" },
{ name: "power_to_weight", decimals: 1, units: "bhp_t" }, { name: "power_to_weight", decimals: 1, units: "bhp_t" },
{ name: "hull_traverse_speed", units: "deg_s" }, { name: "hull_traverse_speed", units: "deg_s" },
{ name: "turret_traverse_speed", units: "deg_s" }, { name: "turret_traverse_speed", units: "deg_s" },
// { name: "gun_traverse_speed", units: "deg_s" }, // TODO: implement gun traverse speed
], ],
}, },
{ {
@@ -144,13 +153,18 @@ export const characteristicsOrder: CharacteristicsGroup[] = [
order: [ order: [
{ name: "health", units: "hp" }, { name: "health", units: "hp" },
{ name: "fire_chance", units: "%" }, { name: "fire_chance", units: "%" },
// { name: "fire_health_burn", units: "hp_s" }, // TODO: implement fire health burn
// { name: "ramming_resistance", units: "%" }, // TODO: implement ramming resistance
{ toy: "view_range" }, // { toy: "view_range" },
{ name: "view_range", units: "m" }, { name: "view_range", units: "m" },
{ name: "camouflage", decimals: 0, units: "%" }, { name: "camouflage", decimals: 0, units: "%" },
// TODO: implement width // { name: "consumable_cooldown", decimals: 0, units: "%" }, // TODO: implement consumable cooldown
// { name: "width", units: "m" }, // { name: "consumable_duration", decimals: 0, units: "s" }, // TODO: implement consumable duration
// { name: "consumable_reload", decimals: 0, units: "s" }, // TODO: implement consumable reload
// { name: "width", units: "m" }, // TODO: implement width
{ name: "height", units: "m" }, { name: "height", units: "m" },
{ name: "length", units: "m" }, { name: "length", units: "m" },
{ name: "volume", units: "m" }, { name: "volume", units: "m" },
+12 -16
View File
@@ -21,23 +21,19 @@ export interface TankState {
} }
export const vehicleStatusKeys = [ export const vehicleStatusKeys = [
"commander_dead", ["commander_dead", "gunner_dead", "driver_dead", "loader_dead"],
"gunner_dead",
"driver_dead",
"loader_dead",
"fuel_tank_damaged", [
"engine_damaged", "fuel_tank_damaged",
"chassis_damaged", "engine_damaged",
"viewport_damaged", "chassis_damaged",
"ammo_bay_damaged", "viewport_damaged",
"gun_damaged", "ammo_bay_damaged",
"turret_damaged", "gun_damaged",
"turret_damaged",
],
"caught_on_fire", ["caught_on_fire", "shooting", "turret_traversing", "hull_traversing"],
"shooting",
"turret_traversing",
"hull_traversing",
] as const; ] as const;
export type VehicleStatusKey = (typeof vehicleStatusKeys)[number]; export type VehicleStatusKey = (typeof vehicleStatusKeys)[number][number];