mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
feat: stop working on ranking since a lot of tanks are broken
This commit is contained in:
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 {
|
interface Props {
|
||||||
characteristic: CharacteristicOutput;
|
characteristic: CharacteristicOutput;
|
||||||
|
others: CharacteristicOutput[];
|
||||||
config: CharacteristicRenderConfig;
|
config: CharacteristicRenderConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function TankopediaCharacteristic({ characteristic, config }: Props) {
|
export function TankopediaCharacteristic({
|
||||||
|
characteristic,
|
||||||
|
others,
|
||||||
|
config,
|
||||||
|
}: Props) {
|
||||||
if (characteristic === null) return null;
|
if (characteristic === null) return null;
|
||||||
|
|
||||||
const rendered = renderCharacteristic(characteristic, config);
|
const rendered = renderCharacteristic(characteristic, config);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<p>
|
<p>
|
||||||
{config.name}: {rendered} {config.units && `${config.units}`} (1 / 1)
|
{config.name}: {rendered} {config.units && `${config.units}`} (1 /{" "}
|
||||||
|
{others.length})
|
||||||
</p>
|
</p>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -254,7 +254,7 @@ export const characteristics = {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
gun_depression({ parameters }) {
|
gun_depression({ parameters, tank }) {
|
||||||
return -radToDeg(
|
return -radToDeg(
|
||||||
applyPitchYawLimits(
|
applyPitchYawLimits(
|
||||||
-Math.PI / 2,
|
-Math.PI / 2,
|
||||||
|
|||||||
@@ -18,17 +18,36 @@ export function Page({ id }: { id: string }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function Content({ 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");
|
const otherTanks = useAwait(() => api.tanks(), "tanks");
|
||||||
|
|
||||||
Tankopedia.useInitialization(tank!);
|
Tankopedia.useInitialization(tank.tank!);
|
||||||
|
|
||||||
const protagonist = Tankopedia.use((state) => state.protagonist);
|
const protagonist = Tankopedia.use((state) => state.protagonist);
|
||||||
const compare = Tankopedia.use((state) => state.compare);
|
const compare = Tankopedia.use((state) => state.compare);
|
||||||
const { characteristics, parameters } = useMemo(
|
const characteristics = useMemo(
|
||||||
() => computeCharacteristics(id, tank!, compensation!, protagonist),
|
() =>
|
||||||
|
computeCharacteristics(id, tank.tank!, tank.compensation!, protagonist),
|
||||||
[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 (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -37,7 +56,7 @@ function Content({ id }: { id: string }) {
|
|||||||
<br />
|
<br />
|
||||||
|
|
||||||
<div style={{ display: "flex", flexWrap: "wrap" }}>
|
<div style={{ display: "flex", flexWrap: "wrap" }}>
|
||||||
{times(tank!.upgrade_stages.length + 1, (index) => (
|
{times(tank.tank!.upgrade_stages.length + 1, (index) => (
|
||||||
<button
|
<button
|
||||||
key={index}
|
key={index}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
@@ -54,7 +73,7 @@ function Content({ id }: { id: string }) {
|
|||||||
<br />
|
<br />
|
||||||
|
|
||||||
<div style={{ display: "flex", flexWrap: "wrap" }}>
|
<div style={{ display: "flex", flexWrap: "wrap" }}>
|
||||||
{parameters.shells_upgrades.map((shell) => (
|
{characteristics.parameters.shells_upgrades.map((shell) => (
|
||||||
<button
|
<button
|
||||||
key={shell.shell_id}
|
key={shell.shell_id}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
@@ -72,11 +91,11 @@ function Content({ id }: { id: string }) {
|
|||||||
<br />
|
<br />
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<span>speed (0 - {characteristics.speed_forward})</span>
|
<span>speed (0 - {characteristics.characteristics.speed_forward})</span>
|
||||||
<input
|
<input
|
||||||
type="range"
|
type="range"
|
||||||
min={0}
|
min={0}
|
||||||
max={characteristics.speed_forward as number}
|
max={characteristics.characteristics.speed_forward as number}
|
||||||
value={protagonist.speed}
|
value={protagonist.speed}
|
||||||
onChange={(event) => {
|
onChange={(event) => {
|
||||||
Tankopedia.mutate((draft) => {
|
Tankopedia.mutate((draft) => {
|
||||||
@@ -214,7 +233,8 @@ function Content({ id }: { id: string }) {
|
|||||||
) : (
|
) : (
|
||||||
<TankopediaCharacteristic
|
<TankopediaCharacteristic
|
||||||
key={`characteristic-${config.name}`}
|
key={`characteristic-${config.name}`}
|
||||||
characteristic={characteristics[config.name]}
|
characteristic={characteristics.characteristics[config.name]}
|
||||||
|
others={[]}
|
||||||
config={config}
|
config={config}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in new issue
Block a user