feat: stop working on ranking since a lot of tanks are broken

This commit is contained in:
TrèsAbhi committed 2025-12-26 19:37:52 -06:00
1 parent 385d165512
commit a86ac0619a
3 files changed
+38 -12

No files matched your search

@@ -4,17 +4,23 @@ import { renderCharacteristic } from "../core/tankopedia/renderCharacteristic";
interface Props {
characteristic: CharacteristicOutput;
others: CharacteristicOutput[];
config: CharacteristicRenderConfig;
}
export function TankopediaCharacteristic({ characteristic, config }: Props) {
export function TankopediaCharacteristic({
characteristic,
others,
config,
}: Props) {
if (characteristic === null) return null;
const rendered = renderCharacteristic(characteristic, config);
return (
<p>
{config.name}: {rendered} {config.units && `${config.units}`} (1 / 1)
{config.name}: {rendered} {config.units && `${config.units}`} (1 /{" "}
{others.length})
</p>
);
}
@@ -254,7 +254,7 @@ export const characteristics = {
);
},
gun_depression({ parameters }) {
gun_depression({ parameters, tank }) {
return -radToDeg(
applyPitchYawLimits(
-Math.PI / 2,
@@ -18,17 +18,36 @@ export function Page({ id }: { id: string }) {
}
function Content({ id }: { id: string }) {
const { tank, compensation } = useAwait(() => api.tank(id), `tank-${id}`);
const tank = useAwait(() => api.tank(id), `tank-${id}`);
const tankList = useAwait(() => api.tankList(), "tank-list");
const otherTanks = useAwait(() => api.tanks(), "tanks");
Tankopedia.useInitialization(tank!);
Tankopedia.useInitialization(tank.tank!);
const protagonist = Tankopedia.use((state) => state.protagonist);
const compare = Tankopedia.use((state) => state.compare);
const { characteristics, parameters } = useMemo(
() => computeCharacteristics(id, tank!, compensation!, protagonist),
const characteristics = useMemo(
() =>
computeCharacteristics(id, tank.tank!, tank.compensation!, protagonist),
[protagonist]
);
// const otherCharacteristics = useMemo(
// () =>
// tankList.list
// .filter((tank) => tank.id !== id)
// .map(({ id }) => {
// const state = { ...protagonist };
// const tank = otherTanks.tanks[id];
// return computeCharacteristics(
// id,
// tank.tank!,
// tank.compensation!,
// state
// );
// }),
// [protagonist]
// );
return (
<>
@@ -37,7 +56,7 @@ function Content({ id }: { id: string }) {
<br />
<div style={{ display: "flex", flexWrap: "wrap" }}>
{times(tank!.upgrade_stages.length + 1, (index) => (
{times(tank.tank!.upgrade_stages.length + 1, (index) => (
<button
key={index}
onClick={() => {
@@ -54,7 +73,7 @@ function Content({ id }: { id: string }) {
<br />
<div style={{ display: "flex", flexWrap: "wrap" }}>
{parameters.shells_upgrades.map((shell) => (
{characteristics.parameters.shells_upgrades.map((shell) => (
<button
key={shell.shell_id}
onClick={() => {
@@ -72,11 +91,11 @@ function Content({ id }: { id: string }) {
<br />
<div>
<span>speed (0 - {characteristics.speed_forward})</span>
<span>speed (0 - {characteristics.characteristics.speed_forward})</span>
<input
type="range"
min={0}
max={characteristics.speed_forward as number}
max={characteristics.characteristics.speed_forward as number}
value={protagonist.speed}
onChange={(event) => {
Tankopedia.mutate((draft) => {
@@ -214,7 +233,8 @@ function Content({ id }: { id: string }) {
) : (
<TankopediaCharacteristic
key={`characteristic-${config.name}`}
characteristic={characteristics[config.name]}
characteristic={characteristics.characteristics[config.name]}
others={[]}
config={config}
/>
)