mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-11-17 19:04:15 +01:00
Compare commits
37
Commits
cde6904513
...
v1.27.17
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1558b69931 | ||
|
|
a560a3d3ae | ||
|
|
b620110d0f | ||
|
|
23ea72bf40 | ||
|
|
aaee0b7965 | ||
|
|
347523f9e7 | ||
|
|
3205630a0f | ||
|
|
8446e3fbbd | ||
|
|
6d25a97fc8 | ||
|
|
bdbfce0e18 | ||
|
|
8033e8f7cc | ||
|
|
f98c801d6c | ||
|
|
339663adaf | ||
|
|
2b15357dee | ||
|
|
1e05717daf | ||
|
|
c20f8c5040 | ||
|
|
f22f4eeccd | ||
|
|
79c450798c | ||
|
|
d247e67690 | ||
|
|
69b2035cfc | ||
|
|
62fed63310 | ||
|
|
7c29046390 | ||
|
|
b65c3c1d93 | ||
|
|
87f5d8fe8f | ||
|
|
54c7b6b476 | ||
|
|
7bdaf9ca93 | ||
|
|
525b9377cc | ||
|
|
94cba0c9ba | ||
|
|
4ddf77fc7f | ||
|
|
ae6dc259dc | ||
|
|
c2e95f6ef6 | ||
|
|
868812e578 | ||
|
|
b5064f9e8b | ||
|
|
a0eb0d54f0 | ||
|
|
e47b1315a9 | ||
|
|
60025365c4 | ||
|
|
1e7acc2775 |
No files matched your search
@@ -29,6 +29,8 @@ env:
|
|||||||
PUBLIC_DISCORD_SERVER_ID: ${{ secrets.PUBLIC_DISCORD_SERVER_ID }}
|
PUBLIC_DISCORD_SERVER_ID: ${{ secrets.PUBLIC_DISCORD_SERVER_ID }}
|
||||||
PUBLIC_ASSET_BASE: ${{ secrets.PUBLIC_ASSET_BASE }}
|
PUBLIC_ASSET_BASE: ${{ secrets.PUBLIC_ASSET_BASE }}
|
||||||
PUBLIC_BRANCH: ${{ secrets.PUBLIC_BRANCH }}
|
PUBLIC_BRANCH: ${{ secrets.PUBLIC_BRANCH }}
|
||||||
|
PUBLIC_GUIDE_WEBSITE: ${{ secrets.PUBLIC_GUIDE_WEBSITE }}
|
||||||
|
SERVICING: ${{ secrets.SERVICING }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# BlitzKit 1.27.14
|
# BlitzKit 1.27.14
|
||||||
|
|
||||||
This is the 14th patch for `1.12`, making it the new longest lasting version beating the previous record of `1.15.13`!
|
This is the 14th patch for `1.27`, making it the new longest lasting version beating the previous record of `1.15.13`!
|
||||||
|
|
||||||
## Fixes
|
## Fixes
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
# BlitzKit 1.27.16
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- Added links to GuidesBlitz to Tankopedia to aid users understand tanks beyond just numbers and stats
|
||||||
|
- Added a gun depression and yaw visualizer
|
||||||
|
|
||||||
|
## Changes
|
||||||
|
|
||||||
|
- Made the colors of the advanced highlighting mode more subtle
|
||||||
|
- Made the Tankopedia stat lines more condensed
|
||||||
|
- You can now scroll the page even with your cursor on the Tankopedia sandbox
|
||||||
|
|
||||||
|
## Fixes
|
||||||
|
|
||||||
|
- Fixed a bug where the range of increased gun depression was incorrectly doubled
|
||||||
|
- Removed an unintended space before the "x" in the "Gun damaged" stat
|
||||||
|
- Fixed an issue causing the 3D renderer to render frames even when off screen
|
||||||
|
- Fixed a differential issue causing excessive rerendering of the stat lines
|
||||||
|
- Images no longer exceed the width of the device in the docs
|
||||||
|
- Assault shells no longer scale the module damage with distance
|
||||||
|
|
||||||
|
## Technical Changes
|
||||||
|
|
||||||
|
- Removed all code relating to the canceled "Shooting Range" mode
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
# BlitzKit 1.27.17
|
||||||
|
|
||||||
|
This update was released early for the website. Today, it'll be officially announced and released for the bot
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- Added the shell reload visualizer to aid people in getting a feel for how long shell reloads really are
|
||||||
|
- Added lines of stats for the burst shells
|
||||||
|
|
||||||
|
## Changes
|
||||||
|
|
||||||
|
- Removed the redundant word "Shell" from "Shell reload" and "Shell reloads"
|
||||||
|
- Removed the penetration over distance slider
|
||||||
|
|
||||||
|
## Fixes
|
||||||
|
|
||||||
|
- Fixed the DPM of tanks with burst shells like the ATAC
|
||||||
|
- The DPM will still be different from the game due to a bug in World of Tanks Blitz; I am trying to get Wargaming to fix it; trust BlitzKit!
|
||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "blitzkit",
|
"name": "blitzkit",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "1.27.15",
|
"version": "1.27.17",
|
||||||
"description": "🎉 Tools for everything World of Tanks Blitz",
|
"description": "🎉 Tools for everything World of Tanks Blitz",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"types": "./types.d.ts",
|
"types": "./types.d.ts",
|
||||||
|
|||||||
@@ -197,15 +197,10 @@ export const researchCommand = new Promise<CommandRegistry>((resolve) => {
|
|||||||
|
|
||||||
turret.guns.forEach((gun) => {
|
turret.guns.forEach((gun) => {
|
||||||
if (
|
if (
|
||||||
gun.gun_type!.value.base.research_cost !== undefined &&
|
gun.research_cost !== undefined &&
|
||||||
typeof gun.gun_type!.value.base.research_cost
|
typeof gun.research_cost.research_cost_type!.value === 'number'
|
||||||
.research_cost_type!.value === 'number'
|
|
||||||
) {
|
) {
|
||||||
gunXps.set(
|
gunXps.set(gun.id, gun.research_cost.research_cost_type!.value);
|
||||||
gun.gun_type!.value.base.id,
|
|
||||||
gun.gun_type!.value.base.research_cost.research_cost_type!
|
|
||||||
.value,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import {
|
import {
|
||||||
GunDefinition,
|
GunDefinition,
|
||||||
GunDefinitionAutoReloaderProperties,
|
GunDefinitionAutoReloader,
|
||||||
ShellDefinition,
|
ShellDefinition,
|
||||||
} from '../protos';
|
} from '../protos';
|
||||||
|
|
||||||
@@ -15,34 +15,46 @@ export function resolveDpm(
|
|||||||
let dps: number;
|
let dps: number;
|
||||||
|
|
||||||
if (gun.gun_type!.$case === 'regular') {
|
if (gun.gun_type!.$case === 'regular') {
|
||||||
dps = alpha / (reloadCoefficient * gun.gun_type!.value.extension.reload);
|
dps = alpha / (reloadCoefficient * gun.gun_type!.value.reload);
|
||||||
} else if (gun.gun_type!.$case === 'auto_loader') {
|
} else if (gun.gun_type!.$case === 'auto_loader') {
|
||||||
dps =
|
const damage = alpha * gun.gun_type!.value.shell_count;
|
||||||
(alpha * gun.gun_type!.value.extension.shell_count) /
|
let time = gun.gun_type!.value.clip_reload * reloadCoefficient;
|
||||||
(gun.gun_type!.value.extension.clip_reload * reloadCoefficient +
|
|
||||||
(gun.gun_type!.value.extension.shell_count - 1) *
|
|
||||||
gun.gun_type!.value.extension.intra_clip *
|
|
||||||
intraClipCoefficient);
|
|
||||||
} else {
|
|
||||||
const mostOptimalShell =
|
|
||||||
gun.gun_type!.value.extension.shell_reloads.reduce<null | {
|
|
||||||
index: number;
|
|
||||||
reload: number;
|
|
||||||
}>((current, reloadRaw, index) => {
|
|
||||||
const reload =
|
|
||||||
reloadRaw * reloadCoefficient +
|
|
||||||
(index > 0
|
|
||||||
? (
|
|
||||||
gun.gun_type!.value
|
|
||||||
.extension as GunDefinitionAutoReloaderProperties
|
|
||||||
).intra_clip * intraClipCoefficient
|
|
||||||
: 0);
|
|
||||||
|
|
||||||
if (current === null || reload < current.reload) {
|
if (gun.burst) {
|
||||||
return { index, reload };
|
time +=
|
||||||
}
|
(gun.gun_type!.value.shell_count / gun.burst.count - 1) *
|
||||||
return current;
|
gun.gun_type!.value.intra_clip *
|
||||||
}, null)!;
|
intraClipCoefficient;
|
||||||
|
|
||||||
|
time +=
|
||||||
|
(gun.gun_type!.value.shell_count / gun.burst.count) *
|
||||||
|
(gun.burst.count - 1) *
|
||||||
|
gun.burst.interval;
|
||||||
|
} else {
|
||||||
|
time +=
|
||||||
|
(gun.gun_type!.value.shell_count - 1) *
|
||||||
|
gun.gun_type!.value.intra_clip *
|
||||||
|
intraClipCoefficient;
|
||||||
|
}
|
||||||
|
|
||||||
|
dps = damage / time;
|
||||||
|
} else {
|
||||||
|
const mostOptimalShell = gun.gun_type!.value.shell_reloads.reduce<null | {
|
||||||
|
index: number;
|
||||||
|
reload: number;
|
||||||
|
}>((current, reloadRaw, index) => {
|
||||||
|
const reload =
|
||||||
|
reloadRaw * reloadCoefficient +
|
||||||
|
(index > 0
|
||||||
|
? (gun.gun_type!.value as GunDefinitionAutoReloader).intra_clip *
|
||||||
|
intraClipCoefficient
|
||||||
|
: 0);
|
||||||
|
|
||||||
|
if (current === null || reload < current.reload) {
|
||||||
|
return { index, reload };
|
||||||
|
}
|
||||||
|
return current;
|
||||||
|
}, null)!;
|
||||||
|
|
||||||
dps = alpha / mostOptimalShell?.reload;
|
dps = alpha / mostOptimalShell?.reload;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ export function uniqueGuns(turrets: TurretDefinition[]) {
|
|||||||
|
|
||||||
forEachRight(turrets, (turret) => {
|
forEachRight(turrets, (turret) => {
|
||||||
forEachRight(turret.guns, (gun) => {
|
forEachRight(turret.guns, (gun) => {
|
||||||
if (!gunIds.has(gun.gun_type!.value.base.id)) {
|
if (!gunIds.has(gun.id)) {
|
||||||
gunIds.add(gun.gun_type!.value.base.id);
|
gunIds.add(gun.id);
|
||||||
guns.push({ turret, gun });
|
guns.push({ turret, gun });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -108,58 +108,47 @@ message GunDefinition {
|
|||||||
GunDefinitionAutoLoader auto_loader = 2;
|
GunDefinitionAutoLoader auto_loader = 2;
|
||||||
GunDefinitionAutoReloader auto_reloader = 3;
|
GunDefinitionAutoReloader auto_reloader = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
required uint32 id = 4;
|
||||||
|
required float rotation_speed = 5;
|
||||||
|
optional ResearchCost research_cost = 6;
|
||||||
|
required uint32 weight = 7;
|
||||||
|
required I18nString name = 8;
|
||||||
|
required uint32 tier = 9;
|
||||||
|
repeated ShellDefinition shells = 10;
|
||||||
|
required float camouflage_loss = 11;
|
||||||
|
required float aim_time = 12;
|
||||||
|
required float dispersion_base = 13;
|
||||||
|
required float dispersion_traverse = 14;
|
||||||
|
required float dispersion_shot = 15;
|
||||||
|
required float dispersion_damaged = 16;
|
||||||
|
repeated Unlock unlocks = 17;
|
||||||
|
required uint32 shell_capacity = 18;
|
||||||
|
optional AssaultRanges assault_ranges = 19;
|
||||||
|
optional Burst burst = 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
message GunDefinitionRegular {
|
message GunDefinitionRegular {
|
||||||
required GunDefinitionBase base = 1;
|
|
||||||
required GunDefinitionRegularProperties extension = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
message GunDefinitionRegularProperties {
|
|
||||||
required float reload = 1;
|
required float reload = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
message GunDefinitionAutoLoader {
|
message GunDefinitionAutoLoader {
|
||||||
required GunDefinitionBase base = 1;
|
|
||||||
required GunDefinitionAutoLoaderProperties extension = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
message GunDefinitionAutoLoaderProperties {
|
|
||||||
required float clip_reload = 1;
|
required float clip_reload = 1;
|
||||||
required float intra_clip = 2;
|
required float intra_clip = 2;
|
||||||
required float shell_count = 3;
|
required float shell_count = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
message GunDefinitionAutoReloader {
|
message Burst {
|
||||||
required GunDefinitionBase base = 1;
|
required uint32 count = 1;
|
||||||
required GunDefinitionAutoReloaderProperties extension = 2;
|
required float interval = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
message GunDefinitionAutoReloaderProperties {
|
message GunDefinitionAutoReloader {
|
||||||
repeated float shell_reloads = 1;
|
repeated float shell_reloads = 1;
|
||||||
required float intra_clip = 2;
|
required float intra_clip = 2;
|
||||||
required float shell_count = 3;
|
required float shell_count = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
message GunDefinitionBase {
|
|
||||||
required uint32 id = 1;
|
|
||||||
required float rotation_speed = 2;
|
|
||||||
optional ResearchCost research_cost = 3;
|
|
||||||
required uint32 weight = 4;
|
|
||||||
required I18nString name = 5;
|
|
||||||
required uint32 tier = 6;
|
|
||||||
repeated ShellDefinition shells = 7;
|
|
||||||
required float camouflage_loss = 8;
|
|
||||||
required float aim_time = 9;
|
|
||||||
required float dispersion_base = 10;
|
|
||||||
required float dispersion_traverse = 11;
|
|
||||||
required float dispersion_shot = 12;
|
|
||||||
required float dispersion_damaged = 13;
|
|
||||||
repeated Unlock unlocks = 14;
|
|
||||||
required uint32 shell_capacity = 15;
|
|
||||||
optional AssaultRanges assault_ranges = 16;
|
|
||||||
}
|
|
||||||
|
|
||||||
message AssaultRanges {
|
message AssaultRanges {
|
||||||
repeated AssaultRange ranges = 1;
|
repeated AssaultRange ranges = 1;
|
||||||
repeated ShellType types = 2;
|
repeated ShellType types = 2;
|
||||||
|
|||||||
File diff suppressed because it is too large.
Load diff
@@ -918,8 +918,8 @@
|
|||||||
"flexibility": {
|
"flexibility": {
|
||||||
"yaw": "Yaw",
|
"yaw": "Yaw",
|
||||||
"pitch": "Pitch",
|
"pitch": "Pitch",
|
||||||
"depression": "Depression",
|
"min": "Min",
|
||||||
"elevation": "Elevation"
|
"max": "Max"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -1096,8 +1096,8 @@
|
|||||||
"dpmEffective": "Effective at 60s",
|
"dpmEffective": "Effective at 60s",
|
||||||
"shells": "Shells",
|
"shells": "Shells",
|
||||||
"mostOptimalShellIndex": "Most optimal shell",
|
"mostOptimalShellIndex": "Most optimal shell",
|
||||||
"shellReloads": "Shell reloads",
|
"shellReloads": "Reloads",
|
||||||
"shellReload": "Shell reload",
|
"shellReload": "Reload",
|
||||||
"intraClip": "Intra-clip",
|
"intraClip": "Intra-clip",
|
||||||
"caliber": "Caliber",
|
"caliber": "Caliber",
|
||||||
"penetration": "Penetration",
|
"penetration": "Penetration",
|
||||||
@@ -1155,7 +1155,9 @@
|
|||||||
"shellRange": "Shell range",
|
"shellRange": "Shell range",
|
||||||
"shellCapacity": "Shell capacity",
|
"shellCapacity": "Shell capacity",
|
||||||
"gunType": "Gun type",
|
"gunType": "Gun type",
|
||||||
"penetrationAt250m": "Penetration at 250m"
|
"penetrationAt250m": "Penetration at 250m",
|
||||||
|
"burstShells": "Burst shell count",
|
||||||
|
"burstInterShell": "Burst inter-shell"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -810,6 +810,12 @@
|
|||||||
"percentage": "%s1%",
|
"percentage": "%s1%",
|
||||||
"ghost_factory": "Ghost Factory",
|
"ghost_factory": "Ghost Factory",
|
||||||
"dead_rail": "Dead Rail"
|
"dead_rail": "Dead Rail"
|
||||||
|
},
|
||||||
|
"flexibility": {
|
||||||
|
"yaw": "Yaw",
|
||||||
|
"pitch": "Pitch",
|
||||||
|
"min": "Min",
|
||||||
|
"max": "Max"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"sandbox": {
|
"sandbox": {
|
||||||
@@ -912,7 +918,6 @@
|
|||||||
},
|
},
|
||||||
"review": {
|
"review": {
|
||||||
"title": "Vídeos de reseña",
|
"title": "Vídeos de reseña",
|
||||||
"disclaimer": "BlitzKit no respalda ningún vídeo de reseñas.",
|
|
||||||
"join": "Aplica para el programa de YouTube de %s1"
|
"join": "Aplica para el programa de YouTube de %s1"
|
||||||
},
|
},
|
||||||
"configuration": {
|
"configuration": {
|
||||||
@@ -973,8 +978,8 @@
|
|||||||
"dpmEffective": "Effective at 60s",
|
"dpmEffective": "Effective at 60s",
|
||||||
"shells": "Proyectiles",
|
"shells": "Proyectiles",
|
||||||
"mostOptimalShellIndex": "Proyectil más óptimo",
|
"mostOptimalShellIndex": "Proyectil más óptimo",
|
||||||
"shellReloads": "Tiempos de recarga",
|
"shellReloads": "Reloads",
|
||||||
"shellReload": "Tiempo de recarga",
|
"shellReload": "Recarga",
|
||||||
"intraClip": "Intra-clip",
|
"intraClip": "Intra-clip",
|
||||||
"caliber": "Calibre",
|
"caliber": "Calibre",
|
||||||
"penetration": "Penetración",
|
"penetration": "Penetración",
|
||||||
@@ -1032,7 +1037,9 @@
|
|||||||
"shellRange": "Rango del proyectil",
|
"shellRange": "Rango del proyectil",
|
||||||
"shellCapacity": "Capacidad de proyectiles",
|
"shellCapacity": "Capacidad de proyectiles",
|
||||||
"gunType": "Tipo de cañón",
|
"gunType": "Tipo de cañón",
|
||||||
"penetrationAt250m": "Penetración a 250 m"
|
"penetrationAt250m": "Penetración a 250 m",
|
||||||
|
"burstShells": "Burst shell count",
|
||||||
|
"burstInterShell": "Burst inter-shell"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"firepower": {
|
"firepower": {
|
||||||
|
|||||||
@@ -810,6 +810,12 @@
|
|||||||
"percentage": "%s1%",
|
"percentage": "%s1%",
|
||||||
"ghost_factory": "Ghost Factory",
|
"ghost_factory": "Ghost Factory",
|
||||||
"dead_rail": "Dead Rail"
|
"dead_rail": "Dead Rail"
|
||||||
|
},
|
||||||
|
"flexibility": {
|
||||||
|
"yaw": "Yaw",
|
||||||
|
"pitch": "Pitch",
|
||||||
|
"min": "Min",
|
||||||
|
"max": "Max"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"sandbox": {
|
"sandbox": {
|
||||||
@@ -912,7 +918,6 @@
|
|||||||
},
|
},
|
||||||
"review": {
|
"review": {
|
||||||
"title": "Review videos",
|
"title": "Review videos",
|
||||||
"disclaimer": "BlitzKit does not endorse any review videos.",
|
|
||||||
"join": "Apply to %s1 YouTuber program"
|
"join": "Apply to %s1 YouTuber program"
|
||||||
},
|
},
|
||||||
"configuration": {
|
"configuration": {
|
||||||
@@ -973,8 +978,8 @@
|
|||||||
"dpmEffective": "Effective at 60s",
|
"dpmEffective": "Effective at 60s",
|
||||||
"shells": "Shells",
|
"shells": "Shells",
|
||||||
"mostOptimalShellIndex": "Most optimal shell",
|
"mostOptimalShellIndex": "Most optimal shell",
|
||||||
"shellReloads": "Shell reloads",
|
"shellReloads": "Reloads",
|
||||||
"shellReload": "Shell reload",
|
"shellReload": "Reload",
|
||||||
"intraClip": "Intra-clip",
|
"intraClip": "Intra-clip",
|
||||||
"caliber": "Caliber",
|
"caliber": "Caliber",
|
||||||
"penetration": "Penetration",
|
"penetration": "Penetration",
|
||||||
@@ -1032,7 +1037,9 @@
|
|||||||
"shellRange": "Shell range",
|
"shellRange": "Shell range",
|
||||||
"shellCapacity": "Shell capacity",
|
"shellCapacity": "Shell capacity",
|
||||||
"gunType": "Gun type",
|
"gunType": "Gun type",
|
||||||
"penetrationAt250m": "Penetration at 250m"
|
"penetrationAt250m": "Penetration at 250m",
|
||||||
|
"burstShells": "Burst shell count",
|
||||||
|
"burstInterShell": "Burst inter-shell"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"firepower": {
|
"firepower": {
|
||||||
|
|||||||
@@ -810,6 +810,12 @@
|
|||||||
"percentage": "%s1%",
|
"percentage": "%s1%",
|
||||||
"ghost_factory": "Ghost Factory",
|
"ghost_factory": "Ghost Factory",
|
||||||
"dead_rail": "Dead Rail"
|
"dead_rail": "Dead Rail"
|
||||||
|
},
|
||||||
|
"flexibility": {
|
||||||
|
"yaw": "Yaw",
|
||||||
|
"pitch": "Pitch",
|
||||||
|
"min": "Min",
|
||||||
|
"max": "Max"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"sandbox": {
|
"sandbox": {
|
||||||
@@ -912,7 +918,6 @@
|
|||||||
},
|
},
|
||||||
"review": {
|
"review": {
|
||||||
"title": "Review videos",
|
"title": "Review videos",
|
||||||
"disclaimer": "BlitzKitはいかなるレビュー動画も後援していません。",
|
|
||||||
"join": "%s1 YouTuberプログラムに応募する"
|
"join": "%s1 YouTuberプログラムに応募する"
|
||||||
},
|
},
|
||||||
"configuration": {
|
"configuration": {
|
||||||
@@ -973,7 +978,7 @@
|
|||||||
"dpmEffective": "60秒での有効値",
|
"dpmEffective": "60秒での有効値",
|
||||||
"shells": "砲弾",
|
"shells": "砲弾",
|
||||||
"mostOptimalShellIndex": "最適な弾数",
|
"mostOptimalShellIndex": "最適な弾数",
|
||||||
"shellReloads": "自動装填時間",
|
"shellReloads": "Reloads",
|
||||||
"shellReload": "装填時間",
|
"shellReload": "装填時間",
|
||||||
"intraClip": "砲弾再装填時間",
|
"intraClip": "砲弾再装填時間",
|
||||||
"caliber": "口径",
|
"caliber": "口径",
|
||||||
@@ -1032,7 +1037,9 @@
|
|||||||
"shellRange": "射程",
|
"shellRange": "射程",
|
||||||
"shellCapacity": "総弾数",
|
"shellCapacity": "総弾数",
|
||||||
"gunType": "主砲タイプ",
|
"gunType": "主砲タイプ",
|
||||||
"penetrationAt250m": "250m での貫通力"
|
"penetrationAt250m": "250m での貫通力",
|
||||||
|
"burstShells": "Burst shell count",
|
||||||
|
"burstInterShell": "Burst inter-shell"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"firepower": {
|
"firepower": {
|
||||||
|
|||||||
@@ -810,6 +810,12 @@
|
|||||||
"percentage": "%s1%",
|
"percentage": "%s1%",
|
||||||
"ghost_factory": "Ghost Factory",
|
"ghost_factory": "Ghost Factory",
|
||||||
"dead_rail": "Dead Rail"
|
"dead_rail": "Dead Rail"
|
||||||
|
},
|
||||||
|
"flexibility": {
|
||||||
|
"yaw": "Yaw",
|
||||||
|
"pitch": "Pitch",
|
||||||
|
"min": "Min",
|
||||||
|
"max": "Max"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"sandbox": {
|
"sandbox": {
|
||||||
@@ -912,7 +918,6 @@
|
|||||||
},
|
},
|
||||||
"review": {
|
"review": {
|
||||||
"title": "Review videos",
|
"title": "Review videos",
|
||||||
"disclaimer": "BlitzKit does not endorse any review videos.",
|
|
||||||
"join": "Apply to %s1 YouTuber program"
|
"join": "Apply to %s1 YouTuber program"
|
||||||
},
|
},
|
||||||
"configuration": {
|
"configuration": {
|
||||||
@@ -973,8 +978,8 @@
|
|||||||
"dpmEffective": "Effective at 60s",
|
"dpmEffective": "Effective at 60s",
|
||||||
"shells": "Shells",
|
"shells": "Shells",
|
||||||
"mostOptimalShellIndex": "Most optimal shell",
|
"mostOptimalShellIndex": "Most optimal shell",
|
||||||
"shellReloads": "Shell reloads",
|
"shellReloads": "Reloads",
|
||||||
"shellReload": "Shell reload",
|
"shellReload": "Reload",
|
||||||
"intraClip": "Intra-clip",
|
"intraClip": "Intra-clip",
|
||||||
"caliber": "Caliber",
|
"caliber": "Caliber",
|
||||||
"penetration": "Penetration",
|
"penetration": "Penetration",
|
||||||
@@ -1032,7 +1037,9 @@
|
|||||||
"shellRange": "Shell range",
|
"shellRange": "Shell range",
|
||||||
"shellCapacity": "Shell capacity",
|
"shellCapacity": "Shell capacity",
|
||||||
"gunType": "Gun type",
|
"gunType": "Gun type",
|
||||||
"penetrationAt250m": "Penetration at 250m"
|
"penetrationAt250m": "Penetration at 250m",
|
||||||
|
"burstShells": "Burst shell count",
|
||||||
|
"burstInterShell": "Burst inter-shell"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"firepower": {
|
"firepower": {
|
||||||
|
|||||||
@@ -810,6 +810,12 @@
|
|||||||
"percentage": "%s1%",
|
"percentage": "%s1%",
|
||||||
"ghost_factory": "Ghost Factory",
|
"ghost_factory": "Ghost Factory",
|
||||||
"dead_rail": "Dead Rail"
|
"dead_rail": "Dead Rail"
|
||||||
|
},
|
||||||
|
"flexibility": {
|
||||||
|
"yaw": "Yaw",
|
||||||
|
"pitch": "Pitch",
|
||||||
|
"min": "Min",
|
||||||
|
"max": "Max"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"sandbox": {
|
"sandbox": {
|
||||||
@@ -912,7 +918,6 @@
|
|||||||
},
|
},
|
||||||
"review": {
|
"review": {
|
||||||
"title": "Vídeos de análise",
|
"title": "Vídeos de análise",
|
||||||
"disclaimer": "BlitzKit não aprova nenhum vídeo de análise.",
|
|
||||||
"join": "Candidate-se para %s1 um programa YouTuber"
|
"join": "Candidate-se para %s1 um programa YouTuber"
|
||||||
},
|
},
|
||||||
"configuration": {
|
"configuration": {
|
||||||
@@ -973,8 +978,8 @@
|
|||||||
"dpmEffective": "Efetivo aos 60s",
|
"dpmEffective": "Efetivo aos 60s",
|
||||||
"shells": "Projéteis",
|
"shells": "Projéteis",
|
||||||
"mostOptimalShellIndex": "Projétil mais ideal",
|
"mostOptimalShellIndex": "Projétil mais ideal",
|
||||||
"shellReloads": "Recarga de projétil",
|
"shellReloads": "Reloads",
|
||||||
"shellReload": "Recarregamento de projétil",
|
"shellReload": "Recarga",
|
||||||
"intraClip": "Intra-clipe",
|
"intraClip": "Intra-clipe",
|
||||||
"caliber": "Calibre",
|
"caliber": "Calibre",
|
||||||
"penetration": "Penetração",
|
"penetration": "Penetração",
|
||||||
@@ -1032,7 +1037,9 @@
|
|||||||
"shellRange": "Alcance de projétil",
|
"shellRange": "Alcance de projétil",
|
||||||
"shellCapacity": "Capacidade de projéteis",
|
"shellCapacity": "Capacidade de projéteis",
|
||||||
"gunType": "Tipo de arma",
|
"gunType": "Tipo de arma",
|
||||||
"penetrationAt250m": "Penetração à 250m"
|
"penetrationAt250m": "Penetração à 250m",
|
||||||
|
"burstShells": "Burst shell count",
|
||||||
|
"burstInterShell": "Burst inter-shell"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"firepower": {
|
"firepower": {
|
||||||
|
|||||||
@@ -788,7 +788,7 @@
|
|||||||
"tank_seo_description": "%s1 броня, статистика, оборудование, снабжение и многое другое. %s2 УВМ, %s3hp альфа, %s4mm пробитие, %s5км/ч лучшая скорость, %s6hp здоровье.",
|
"tank_seo_description": "%s1 броня, статистика, оборудование, снабжение и многое другое. %s2 УВМ, %s3hp альфа, %s4mm пробитие, %s5км/ч лучшая скорость, %s6hp здоровье.",
|
||||||
"visualizers": {
|
"visualizers": {
|
||||||
"assault": {
|
"assault": {
|
||||||
"title": "Assault shells"
|
"title": "Штурмовые снаряды"
|
||||||
},
|
},
|
||||||
"rotator": {
|
"rotator": {
|
||||||
"hull": "Корпус",
|
"hull": "Корпус",
|
||||||
@@ -810,6 +810,12 @@
|
|||||||
"percentage": "%s1%",
|
"percentage": "%s1%",
|
||||||
"ghost_factory": "Промзона",
|
"ghost_factory": "Промзона",
|
||||||
"dead_rail": "Эшелон"
|
"dead_rail": "Эшелон"
|
||||||
|
},
|
||||||
|
"flexibility": {
|
||||||
|
"yaw": "Отклонение",
|
||||||
|
"pitch": "Наклон",
|
||||||
|
"min": "Вниз",
|
||||||
|
"max": "Вверх"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"sandbox": {
|
"sandbox": {
|
||||||
@@ -912,7 +918,6 @@
|
|||||||
},
|
},
|
||||||
"review": {
|
"review": {
|
||||||
"title": "Видеообзоры",
|
"title": "Видеообзоры",
|
||||||
"disclaimer": "BlitzKit не несёт ответственности за видеообзоры.",
|
|
||||||
"join": "Предложить ютубера для программы %s1"
|
"join": "Предложить ютубера для программы %s1"
|
||||||
},
|
},
|
||||||
"configuration": {
|
"configuration": {
|
||||||
@@ -973,13 +978,13 @@
|
|||||||
"dpmEffective": "Эффективность за 60с",
|
"dpmEffective": "Эффективность за 60с",
|
||||||
"shells": "Снарядов в барабане",
|
"shells": "Снарядов в барабане",
|
||||||
"mostOptimalShellIndex": "Самый эффективный снаряд",
|
"mostOptimalShellIndex": "Самый эффективный снаряд",
|
||||||
"shellReloads": "Перезарядка снарядов",
|
"shellReloads": "Reloads",
|
||||||
"shellReload": "Перезарядка",
|
"shellReload": "Перезарядка",
|
||||||
"intraClip": "Между снарядами",
|
"intraClip": "Между снарядами",
|
||||||
"caliber": "Калибр",
|
"caliber": "Калибр",
|
||||||
"penetration": "Пробитие",
|
"penetration": "Пробитие",
|
||||||
"damage": "Урон",
|
"damage": "Урон",
|
||||||
"damageWithoutAssault": "Damage without assault shells",
|
"damageWithoutAssault": "Урон без штурмовых снарядов",
|
||||||
"clipDamage": "Урон с барабана",
|
"clipDamage": "Урон с барабана",
|
||||||
"moduleDamage": "Урон по модулям",
|
"moduleDamage": "Урон по модулям",
|
||||||
"explosionRadius": "Разлет осколков",
|
"explosionRadius": "Разлет осколков",
|
||||||
@@ -1032,7 +1037,9 @@
|
|||||||
"shellRange": "Дальность снаряда",
|
"shellRange": "Дальность снаряда",
|
||||||
"shellCapacity": "Боезапас",
|
"shellCapacity": "Боезапас",
|
||||||
"gunType": "Тип орудия",
|
"gunType": "Тип орудия",
|
||||||
"penetrationAt250m": "Пробитие на 250м"
|
"penetrationAt250m": "Пробитие на 250м",
|
||||||
|
"burstShells": "Burst shell count",
|
||||||
|
"burstInterShell": "Burst inter-shell"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"firepower": {
|
"firepower": {
|
||||||
|
|||||||
@@ -531,16 +531,16 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"rating_leaderboard": {
|
"rating_leaderboard": {
|
||||||
"name": "rating-leaderboard",
|
"name": "таблиця рейтингу",
|
||||||
"description": "Rating battles statistics",
|
"description": "Статистика рейтингових боїв",
|
||||||
"subcommands": {
|
"subcommands": {
|
||||||
"neighbors": {
|
"neighbors": {
|
||||||
"name": "neighbors",
|
"name": "neighbors",
|
||||||
"description": "Neighboring players on the leaderboard"
|
"description": "Neighboring players on the leaderboard"
|
||||||
},
|
},
|
||||||
"league": {
|
"league": {
|
||||||
"name": "league",
|
"name": "ліга",
|
||||||
"description": "Top players of a league"
|
"description": "Найкращий гравець ліги"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"options": {
|
"options": {
|
||||||
@@ -549,8 +549,8 @@
|
|||||||
"description": ""
|
"description": ""
|
||||||
},
|
},
|
||||||
"season": {
|
"season": {
|
||||||
"name": "season",
|
"name": "сезон",
|
||||||
"description": "Season number (default: current)",
|
"description": "Базова інформація про гравця",
|
||||||
"choices": {
|
"choices": {
|
||||||
"current": "%s1 (current)"
|
"current": "%s1 (current)"
|
||||||
}
|
}
|
||||||
@@ -578,14 +578,14 @@
|
|||||||
"description": "Коротка статистика за період"
|
"description": "Коротка статистика за період"
|
||||||
},
|
},
|
||||||
"owned_tanks": {
|
"owned_tanks": {
|
||||||
"name": "owned-tanks",
|
"name": "отримані танки",
|
||||||
"description": "Shows all own tanks in a tier",
|
"description": "Показує всі ваші танки даного рівня",
|
||||||
"body": {
|
"body": {
|
||||||
"title": "# %s1's owned tier %s2 tanks\n\n"
|
"title": "# %s1's owned tier %s2 tanks\n\n"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"permissions": {
|
"permissions": {
|
||||||
"name": "permissions",
|
"name": "дозволи",
|
||||||
"description": "Checks wether the bot has the required permissions to function",
|
"description": "Checks wether the bot has the required permissions to function",
|
||||||
"body": {
|
"body": {
|
||||||
"title": "# Permissions\n\n%s1",
|
"title": "# Permissions\n\n%s1",
|
||||||
@@ -615,7 +615,7 @@
|
|||||||
},
|
},
|
||||||
"player_info": {
|
"player_info": {
|
||||||
"name": "player-info",
|
"name": "player-info",
|
||||||
"description": "Basic information about a player",
|
"description": "Базова інформація про гравця",
|
||||||
"body": {
|
"body": {
|
||||||
"title": "%s1's information",
|
"title": "%s1's information",
|
||||||
"nickname": "Нік",
|
"nickname": "Нік",
|
||||||
@@ -635,7 +635,7 @@
|
|||||||
"description": "Today's rating statistics"
|
"description": "Today's rating statistics"
|
||||||
},
|
},
|
||||||
"season": {
|
"season": {
|
||||||
"name": "season",
|
"name": "сезон",
|
||||||
"description": "This season's rating statistics"
|
"description": "This season's rating statistics"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -810,6 +810,12 @@
|
|||||||
"percentage": "%s1%",
|
"percentage": "%s1%",
|
||||||
"ghost_factory": "Ghost Factory",
|
"ghost_factory": "Ghost Factory",
|
||||||
"dead_rail": "Dead Rail"
|
"dead_rail": "Dead Rail"
|
||||||
|
},
|
||||||
|
"flexibility": {
|
||||||
|
"yaw": "Yaw",
|
||||||
|
"pitch": "Pitch",
|
||||||
|
"min": "Min",
|
||||||
|
"max": "Max"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"sandbox": {
|
"sandbox": {
|
||||||
@@ -912,7 +918,6 @@
|
|||||||
},
|
},
|
||||||
"review": {
|
"review": {
|
||||||
"title": "Review videos",
|
"title": "Review videos",
|
||||||
"disclaimer": "BlitzKit does not endorse any review videos.",
|
|
||||||
"join": "Apply to %s1 YouTuber program"
|
"join": "Apply to %s1 YouTuber program"
|
||||||
},
|
},
|
||||||
"configuration": {
|
"configuration": {
|
||||||
@@ -973,8 +978,8 @@
|
|||||||
"dpmEffective": "Effective at 60s",
|
"dpmEffective": "Effective at 60s",
|
||||||
"shells": "Снаряди",
|
"shells": "Снаряди",
|
||||||
"mostOptimalShellIndex": "Most optimal shell",
|
"mostOptimalShellIndex": "Most optimal shell",
|
||||||
"shellReloads": "Shell reloads",
|
"shellReloads": "Reloads",
|
||||||
"shellReload": "Shell reload",
|
"shellReload": "Час перезаряджання",
|
||||||
"intraClip": "Intra-clip",
|
"intraClip": "Intra-clip",
|
||||||
"caliber": "Калібр",
|
"caliber": "Калібр",
|
||||||
"penetration": "Бронепробиття",
|
"penetration": "Бронепробиття",
|
||||||
@@ -1032,7 +1037,9 @@
|
|||||||
"shellRange": "Shell range",
|
"shellRange": "Shell range",
|
||||||
"shellCapacity": "Shell capacity",
|
"shellCapacity": "Shell capacity",
|
||||||
"gunType": "Тип гармати",
|
"gunType": "Тип гармати",
|
||||||
"penetrationAt250m": "Penetration at 250m"
|
"penetrationAt250m": "Penetration at 250m",
|
||||||
|
"burstShells": "Burst shell count",
|
||||||
|
"burstInterShell": "Burst inter-shell"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"firepower": {
|
"firepower": {
|
||||||
|
|||||||
@@ -810,6 +810,12 @@
|
|||||||
"percentage": "%s1%",
|
"percentage": "%s1%",
|
||||||
"ghost_factory": "幽灵工厂",
|
"ghost_factory": "幽灵工厂",
|
||||||
"dead_rail": "死亡铁道"
|
"dead_rail": "死亡铁道"
|
||||||
|
},
|
||||||
|
"flexibility": {
|
||||||
|
"yaw": "Yaw",
|
||||||
|
"pitch": "Pitch",
|
||||||
|
"min": "Min",
|
||||||
|
"max": "Max"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"sandbox": {
|
"sandbox": {
|
||||||
@@ -912,7 +918,6 @@
|
|||||||
},
|
},
|
||||||
"review": {
|
"review": {
|
||||||
"title": "回顾影片",
|
"title": "回顾影片",
|
||||||
"disclaimer": "BlitzKit 不支援任何影片回顾。",
|
|
||||||
"join": "应用到 %s1 YouTuber程序"
|
"join": "应用到 %s1 YouTuber程序"
|
||||||
},
|
},
|
||||||
"configuration": {
|
"configuration": {
|
||||||
@@ -973,8 +978,8 @@
|
|||||||
"dpmEffective": "60秒内生效",
|
"dpmEffective": "60秒内生效",
|
||||||
"shells": "炮弹 ",
|
"shells": "炮弹 ",
|
||||||
"mostOptimalShellIndex": "最优炮弹",
|
"mostOptimalShellIndex": "最优炮弹",
|
||||||
"shellReloads": "弹匣装填",
|
"shellReloads": "Reloads",
|
||||||
"shellReload": "炮弹装填",
|
"shellReload": "装填时间",
|
||||||
"intraClip": "炮弹装填",
|
"intraClip": "炮弹装填",
|
||||||
"caliber": "口径",
|
"caliber": "口径",
|
||||||
"penetration": "穿深",
|
"penetration": "穿深",
|
||||||
@@ -1032,7 +1037,9 @@
|
|||||||
"shellRange": "射程",
|
"shellRange": "射程",
|
||||||
"shellCapacity": "携弹量",
|
"shellCapacity": "携弹量",
|
||||||
"gunType": "炮管类型",
|
"gunType": "炮管类型",
|
||||||
"penetrationAt250m": "两百五十米处的穿透力"
|
"penetrationAt250m": "两百五十米处的穿透力",
|
||||||
|
"burstShells": "Burst shell count",
|
||||||
|
"burstInterShell": "Burst inter-shell"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"firepower": {
|
"firepower": {
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import {
|
|||||||
EquipmentSlot,
|
EquipmentSlot,
|
||||||
GameDefinitions,
|
GameDefinitions,
|
||||||
GunDefinition,
|
GunDefinition,
|
||||||
GunDefinitionBase,
|
|
||||||
I18nString,
|
I18nString,
|
||||||
MapDefinitions,
|
MapDefinitions,
|
||||||
ModelDefinitions,
|
ModelDefinitions,
|
||||||
@@ -274,6 +273,7 @@ interface VehicleDefinitions {
|
|||||||
pumpGunMode?: boolean;
|
pumpGunMode?: boolean;
|
||||||
pumpGunReloadTimes?: string;
|
pumpGunReloadTimes?: string;
|
||||||
clip?: { count: number; rate: number };
|
clip?: { count: number; rate: number };
|
||||||
|
burst?: { count: number; rate: number };
|
||||||
models: { undamaged: string };
|
models: { undamaged: string };
|
||||||
extras?: {
|
extras?: {
|
||||||
trayShell?: {
|
trayShell?: {
|
||||||
@@ -1304,7 +1304,7 @@ export async function definitions() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const base = {
|
tankDefinitions.tanks[tankId].turrets[turretIndex].guns.push({
|
||||||
id: gunId,
|
id: gunId,
|
||||||
weight: gunListEntry.weight,
|
weight: gunListEntry.weight,
|
||||||
rotation_speed: gunListEntry.rotationSpeed,
|
rotation_speed: gunListEntry.rotationSpeed,
|
||||||
@@ -1324,41 +1324,38 @@ export async function definitions() {
|
|||||||
unlocks: resolveUnlocks(gun.unlocks),
|
unlocks: resolveUnlocks(gun.unlocks),
|
||||||
shell_capacity: gun.maxAmmo ?? gunListEntry.maxAmmo,
|
shell_capacity: gun.maxAmmo ?? gunListEntry.maxAmmo,
|
||||||
assault_ranges,
|
assault_ranges,
|
||||||
} satisfies GunDefinitionBase;
|
burst:
|
||||||
|
gun.burst && gun.burst.count > 1
|
||||||
tankDefinitions.tanks[tankId].turrets[turretIndex].guns.push({
|
? {
|
||||||
|
count: gun.burst.count,
|
||||||
|
interval: 60 / gun.burst.rate,
|
||||||
|
}
|
||||||
|
: undefined,
|
||||||
gun_type:
|
gun_type:
|
||||||
gunType === 'regular'
|
gunType === 'regular'
|
||||||
? {
|
? {
|
||||||
$case: 'regular',
|
$case: 'regular',
|
||||||
value: {
|
value: {
|
||||||
base,
|
reload: gun.reloadTime,
|
||||||
extension: { reload: gun.reloadTime },
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
: gunType === 'autoReloader'
|
: gunType === 'autoReloader'
|
||||||
? {
|
? {
|
||||||
$case: 'auto_reloader',
|
$case: 'auto_reloader',
|
||||||
value: {
|
value: {
|
||||||
base,
|
intra_clip: 60 / gun.clip!.rate,
|
||||||
extension: {
|
shell_count: gunClipCount,
|
||||||
intra_clip: 60 / gun.clip!.rate,
|
shell_reloads: gun
|
||||||
shell_count: gunClipCount,
|
.pumpGunReloadTimes!.split(' ')
|
||||||
shell_reloads: gun
|
.map(Number),
|
||||||
.pumpGunReloadTimes!.split(' ')
|
|
||||||
.map(Number),
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
: {
|
: {
|
||||||
$case: 'auto_loader',
|
$case: 'auto_loader',
|
||||||
value: {
|
value: {
|
||||||
base,
|
intra_clip: 60 / gun.clip!.rate,
|
||||||
extension: {
|
clip_reload: gun.reloadTime,
|
||||||
intra_clip: 60 / gun.clip!.rate,
|
shell_count: gunClipCount,
|
||||||
clip_reload: gun.reloadTime,
|
|
||||||
shell_count: gunClipCount,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
} satisfies GunDefinition);
|
} satisfies GunDefinition);
|
||||||
@@ -1407,7 +1404,7 @@ export async function definitions() {
|
|||||||
|
|
||||||
tankDefinitions.tanks[tankId].turrets[turretIndex].guns[
|
tankDefinitions.tanks[tankId].turrets[turretIndex].guns[
|
||||||
gunIndex
|
gunIndex
|
||||||
].gun_type!.value.base!.shells.push({
|
].shells.push({
|
||||||
id: shellId,
|
id: shellId,
|
||||||
name: shellName,
|
name: shellName,
|
||||||
velocity: gunShellEntry.speed,
|
velocity: gunShellEntry.speed,
|
||||||
@@ -1495,9 +1492,7 @@ export async function definitions() {
|
|||||||
turret.research_cost = turretXps.get(turret.id);
|
turret.research_cost = turretXps.get(turret.id);
|
||||||
|
|
||||||
Object.values(turret.guns).forEach((gunRaw) => {
|
Object.values(turret.guns).forEach((gunRaw) => {
|
||||||
gunRaw.gun_type!.value.base!.research_cost = gunXps.get(
|
gunRaw.research_cost = gunXps.get(gunRaw.id);
|
||||||
gunRaw.gun_type!.value.base!.id,
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -100,8 +100,7 @@ export function ArmorPlateDisplay() {
|
|||||||
const { protagonist } = duelStore.getState();
|
const { protagonist } = duelStore.getState();
|
||||||
const tank = draft.model;
|
const tank = draft.model;
|
||||||
const turret = tank.turrets[protagonist.turret.id];
|
const turret = tank.turrets[protagonist.turret.id];
|
||||||
const gun =
|
const gun = turret.guns[protagonist.gun.id];
|
||||||
turret.guns[protagonist.gun.gun_type!.value.base.id];
|
|
||||||
const track = tank.tracks[protagonist.track.id];
|
const track = tank.tracks[protagonist.track.id];
|
||||||
|
|
||||||
if (highlightArmor.name.startsWith('hull_')) {
|
if (highlightArmor.name.startsWith('hull_')) {
|
||||||
@@ -154,12 +153,8 @@ export function ArmorPlateDisplay() {
|
|||||||
const turret = tank.turrets[protagonist.turret.id];
|
const turret = tank.turrets[protagonist.turret.id];
|
||||||
const initialTurret =
|
const initialTurret =
|
||||||
initialTank.turrets[protagonist.turret.id];
|
initialTank.turrets[protagonist.turret.id];
|
||||||
const gun =
|
const gun = turret.guns[protagonist.gun.id];
|
||||||
turret.guns[protagonist.gun.gun_type!.value.base.id];
|
const initialGun = initialTurret.guns[protagonist.gun.id];
|
||||||
const initialGun =
|
|
||||||
initialTurret.guns[
|
|
||||||
protagonist.gun.gun_type!.value.base.id
|
|
||||||
];
|
|
||||||
const track = tank.tracks[protagonist.track.id];
|
const track = tank.tracks[protagonist.track.id];
|
||||||
const initialTrack =
|
const initialTrack =
|
||||||
initialTank.tracks[protagonist.track.id];
|
initialTank.tracks[protagonist.track.id];
|
||||||
|
|||||||
@@ -24,8 +24,7 @@ export const PrimaryArmorScene = memo(() => {
|
|||||||
const tankModelDefinition = useTankModelDefinition();
|
const tankModelDefinition = useTankModelDefinition();
|
||||||
const trackModelDefinition = tankModelDefinition.tracks[track.id];
|
const trackModelDefinition = tankModelDefinition.tracks[track.id];
|
||||||
const turretModelDefinition = tankModelDefinition.turrets[turret.id];
|
const turretModelDefinition = tankModelDefinition.turrets[turret.id];
|
||||||
const gunModelDefinition =
|
const gunModelDefinition = turretModelDefinition.guns[gun.id];
|
||||||
turretModelDefinition.guns[gun.gun_type!.value.base.id];
|
|
||||||
const hullOrigin = correctZYTuple(trackModelDefinition.origin);
|
const hullOrigin = correctZYTuple(trackModelDefinition.origin);
|
||||||
const turretOrigin = correctZYTuple(tankModelDefinition.turret_origin);
|
const turretOrigin = correctZYTuple(tankModelDefinition.turret_origin);
|
||||||
const gunOrigin = correctZYTuple(turretModelDefinition.gun_origin);
|
const gunOrigin = correctZYTuple(turretModelDefinition.gun_origin);
|
||||||
|
|||||||
@@ -36,8 +36,7 @@ export const SpacedArmorScene = memo<SpacedArmorSceneProps>(({ scene }) => {
|
|||||||
const tankModelDefinition = useTankModelDefinition();
|
const tankModelDefinition = useTankModelDefinition();
|
||||||
const trackModelDefinition = tankModelDefinition.tracks[track.id];
|
const trackModelDefinition = tankModelDefinition.tracks[track.id];
|
||||||
const turretModelDefinition = tankModelDefinition.turrets[turret.id];
|
const turretModelDefinition = tankModelDefinition.turrets[turret.id];
|
||||||
const gunModelDefinition =
|
const gunModelDefinition = turretModelDefinition.guns[gun.id];
|
||||||
turretModelDefinition.guns[gun.gun_type!.value.base.id];
|
|
||||||
const hullOrigin = correctZYTuple(trackModelDefinition.origin);
|
const hullOrigin = correctZYTuple(trackModelDefinition.origin);
|
||||||
const turretOrigin = correctZYTuple(tankModelDefinition.turret_origin);
|
const turretOrigin = correctZYTuple(tankModelDefinition.turret_origin);
|
||||||
const gunOrigin = correctZYTuple(turretModelDefinition.gun_origin);
|
const gunOrigin = correctZYTuple(turretModelDefinition.gun_origin);
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import { normalizeAngleRad } from '@blitzkit/core';
|
|
||||||
import { useThree, type ThreeEvent } from '@react-three/fiber';
|
import { useThree, type ThreeEvent } from '@react-three/fiber';
|
||||||
import { memo, useRef } from 'react';
|
import { memo, useRef } from 'react';
|
||||||
import { Group, Plane, Vector2, Vector3 } from 'three';
|
import { Group, Plane, Vector2, Vector3 } from 'three';
|
||||||
@@ -43,8 +42,7 @@ export const StaticArmor = memo<ArmorSceneProps>(({ thicknessRange }) => {
|
|||||||
const tankModelDefinition = useTankModelDefinition();
|
const tankModelDefinition = useTankModelDefinition();
|
||||||
const trackModelDefinition = tankModelDefinition.tracks[track.id];
|
const trackModelDefinition = tankModelDefinition.tracks[track.id];
|
||||||
const turretModelDefinition = tankModelDefinition.turrets[turret.id];
|
const turretModelDefinition = tankModelDefinition.turrets[turret.id];
|
||||||
const gunModelDefinition =
|
const gunModelDefinition = turretModelDefinition.guns[gun.id];
|
||||||
turretModelDefinition.guns[gun.gun_type!.value.base.id];
|
|
||||||
const hullOrigin = correctZYTuple(trackModelDefinition.origin);
|
const hullOrigin = correctZYTuple(trackModelDefinition.origin);
|
||||||
const turretOrigin = correctZYTuple(tankModelDefinition.turret_origin);
|
const turretOrigin = correctZYTuple(tankModelDefinition.turret_origin);
|
||||||
const gunOrigin = correctZYTuple(turretModelDefinition.gun_origin);
|
const gunOrigin = correctZYTuple(turretModelDefinition.gun_origin);
|
||||||
@@ -153,15 +151,11 @@ export const StaticArmor = memo<ArmorSceneProps>(({ thicknessRange }) => {
|
|||||||
|
|
||||||
const position = new Vector2();
|
const position = new Vector2();
|
||||||
const delta = new Vector2();
|
const delta = new Vector2();
|
||||||
let pitch = 0;
|
|
||||||
let yaw = 0;
|
|
||||||
|
|
||||||
function onPointerDown(event: ThreeEvent<PointerEvent>) {
|
function onPointerDown(event: ThreeEvent<PointerEvent>) {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
|
||||||
position.set(event.clientX, event.clientY);
|
position.set(event.clientX, event.clientY);
|
||||||
yaw = protagonist.yaw;
|
|
||||||
pitch = protagonist.pitch;
|
|
||||||
|
|
||||||
mutateTankopediaEphemeral((draft) => {
|
mutateTankopediaEphemeral((draft) => {
|
||||||
draft.controlsEnabled = false;
|
draft.controlsEnabled = false;
|
||||||
@@ -190,9 +184,10 @@ export const StaticArmor = memo<ArmorSceneProps>(({ thicknessRange }) => {
|
|||||||
delta.set(event.clientX, event.clientY).sub(position);
|
delta.set(event.clientX, event.clientY).sub(position);
|
||||||
position.set(event.clientX, event.clientY);
|
position.set(event.clientX, event.clientY);
|
||||||
|
|
||||||
[pitch, yaw] = applyPitchYawLimits(
|
const [pitch, yaw] = applyPitchYawLimits(
|
||||||
pitch,
|
modelTransformEvent.last!.pitch,
|
||||||
yaw + delta.x * (Math.PI / boundingRect.width),
|
modelTransformEvent.last!.yaw +
|
||||||
|
delta.x * (Math.PI / boundingRect.width),
|
||||||
gunModelDefinition.pitch,
|
gunModelDefinition.pitch,
|
||||||
turretModelDefinition.yaw,
|
turretModelDefinition.yaw,
|
||||||
hasImprovedVerticalStabilizer,
|
hasImprovedVerticalStabilizer,
|
||||||
@@ -201,10 +196,6 @@ export const StaticArmor = memo<ArmorSceneProps>(({ thicknessRange }) => {
|
|||||||
modelTransformEvent.dispatch({ pitch, yaw });
|
modelTransformEvent.dispatch({ pitch, yaw });
|
||||||
}
|
}
|
||||||
function handlePointerUp() {
|
function handlePointerUp() {
|
||||||
mutateDuel((draft) => {
|
|
||||||
draft.protagonist.pitch = normalizeAngleRad(pitch);
|
|
||||||
draft.protagonist.yaw = normalizeAngleRad(yaw);
|
|
||||||
});
|
|
||||||
mutateTankopediaEphemeral((draft) => {
|
mutateTankopediaEphemeral((draft) => {
|
||||||
draft.controlsEnabled = true;
|
draft.controlsEnabled = true;
|
||||||
});
|
});
|
||||||
@@ -253,8 +244,6 @@ export const StaticArmor = memo<ArmorSceneProps>(({ thicknessRange }) => {
|
|||||||
|
|
||||||
const position = new Vector2();
|
const position = new Vector2();
|
||||||
const delta = new Vector2();
|
const delta = new Vector2();
|
||||||
let pitch = 0;
|
|
||||||
let yaw = 0;
|
|
||||||
|
|
||||||
function onPointerDown(event: ThreeEvent<PointerEvent>) {
|
function onPointerDown(event: ThreeEvent<PointerEvent>) {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
@@ -268,8 +257,6 @@ export const StaticArmor = memo<ArmorSceneProps>(({ thicknessRange }) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
position.set(event.clientX, event.clientY);
|
position.set(event.clientX, event.clientY);
|
||||||
pitch = protagonist.pitch;
|
|
||||||
yaw = protagonist.yaw;
|
|
||||||
|
|
||||||
window.addEventListener('pointermove', handlePointerMove);
|
window.addEventListener('pointermove', handlePointerMove);
|
||||||
window.addEventListener('pointerup', handlePointerUp);
|
window.addEventListener('pointerup', handlePointerUp);
|
||||||
@@ -290,9 +277,11 @@ export const StaticArmor = memo<ArmorSceneProps>(({ thicknessRange }) => {
|
|||||||
delta.set(event.clientX, event.clientY).sub(position);
|
delta.set(event.clientX, event.clientY).sub(position);
|
||||||
position.set(event.clientX, event.clientY);
|
position.set(event.clientX, event.clientY);
|
||||||
|
|
||||||
[pitch, yaw] = applyPitchYawLimits(
|
const [pitch, yaw] = applyPitchYawLimits(
|
||||||
pitch - delta.y * (Math.PI / boundingRect.height),
|
modelTransformEvent.last!.pitch -
|
||||||
yaw + delta.x * (Math.PI / boundingRect.width),
|
delta.y * (Math.PI / boundingRect.height),
|
||||||
|
modelTransformEvent.last!.yaw +
|
||||||
|
delta.x * (Math.PI / boundingRect.width),
|
||||||
gunModelDefinition.pitch,
|
gunModelDefinition.pitch,
|
||||||
turretModelDefinition.yaw,
|
turretModelDefinition.yaw,
|
||||||
hasImprovedVerticalStabilizer,
|
hasImprovedVerticalStabilizer,
|
||||||
@@ -304,10 +293,6 @@ export const StaticArmor = memo<ArmorSceneProps>(({ thicknessRange }) => {
|
|||||||
mutateTankopediaEphemeral((draft) => {
|
mutateTankopediaEphemeral((draft) => {
|
||||||
draft.controlsEnabled = true;
|
draft.controlsEnabled = true;
|
||||||
});
|
});
|
||||||
mutateDuel((draft) => {
|
|
||||||
draft.protagonist.pitch = normalizeAngleRad(pitch);
|
|
||||||
draft.protagonist.yaw = normalizeAngleRad(yaw);
|
|
||||||
});
|
|
||||||
window.removeEventListener('pointermove', handlePointerMove);
|
window.removeEventListener('pointermove', handlePointerMove);
|
||||||
window.removeEventListener('pointerup', handlePointerUp);
|
window.removeEventListener('pointerup', handlePointerUp);
|
||||||
}
|
}
|
||||||
@@ -341,8 +326,6 @@ export const StaticArmor = memo<ArmorSceneProps>(({ thicknessRange }) => {
|
|||||||
|
|
||||||
const position = new Vector2();
|
const position = new Vector2();
|
||||||
const delta = new Vector2();
|
const delta = new Vector2();
|
||||||
let pitch = 0;
|
|
||||||
let yaw = 0;
|
|
||||||
|
|
||||||
function onPointerDown(event: ThreeEvent<PointerEvent>) {
|
function onPointerDown(event: ThreeEvent<PointerEvent>) {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
@@ -356,9 +339,6 @@ export const StaticArmor = memo<ArmorSceneProps>(({ thicknessRange }) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
position.set(event.clientX, event.clientY);
|
position.set(event.clientX, event.clientY);
|
||||||
pitch = protagonist.pitch;
|
|
||||||
yaw = protagonist.yaw;
|
|
||||||
|
|
||||||
window.addEventListener('pointermove', handlePointerMove);
|
window.addEventListener('pointermove', handlePointerMove);
|
||||||
window.addEventListener('pointerup', handlePointerUp);
|
window.addEventListener('pointerup', handlePointerUp);
|
||||||
}
|
}
|
||||||
@@ -378,9 +358,11 @@ export const StaticArmor = memo<ArmorSceneProps>(({ thicknessRange }) => {
|
|||||||
delta.set(event.clientX, event.clientY).sub(position);
|
delta.set(event.clientX, event.clientY).sub(position);
|
||||||
position.set(event.clientX, event.clientY);
|
position.set(event.clientX, event.clientY);
|
||||||
|
|
||||||
[pitch, yaw] = applyPitchYawLimits(
|
const [pitch, yaw] = applyPitchYawLimits(
|
||||||
pitch - delta.y * (Math.PI / boundingRect.height),
|
modelTransformEvent.last!.pitch -
|
||||||
yaw + delta.x * (Math.PI / boundingRect.width),
|
delta.y * (Math.PI / boundingRect.height),
|
||||||
|
modelTransformEvent.last!.yaw +
|
||||||
|
delta.x * (Math.PI / boundingRect.width),
|
||||||
gunModelDefinition.pitch,
|
gunModelDefinition.pitch,
|
||||||
turretModelDefinition.yaw,
|
turretModelDefinition.yaw,
|
||||||
hasImprovedVerticalStabilizer,
|
hasImprovedVerticalStabilizer,
|
||||||
@@ -392,10 +374,7 @@ export const StaticArmor = memo<ArmorSceneProps>(({ thicknessRange }) => {
|
|||||||
mutateTankopediaEphemeral((draft) => {
|
mutateTankopediaEphemeral((draft) => {
|
||||||
draft.controlsEnabled = true;
|
draft.controlsEnabled = true;
|
||||||
});
|
});
|
||||||
mutateDuel((draft) => {
|
|
||||||
draft.protagonist.pitch = normalizeAngleRad(pitch);
|
|
||||||
draft.protagonist.yaw = normalizeAngleRad(yaw);
|
|
||||||
});
|
|
||||||
window.removeEventListener('pointermove', handlePointerMove);
|
window.removeEventListener('pointermove', handlePointerMove);
|
||||||
window.removeEventListener('pointerup', handlePointerUp);
|
window.removeEventListener('pointerup', handlePointerUp);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { I_HAT, J_HAT } from '@blitzkit/core';
|
import { I_HAT, J_HAT } from '@blitzkit/core';
|
||||||
import { type MeshProps, useThree } from '@react-three/fiber';
|
import { type MeshProps, useThree } from '@react-three/fiber';
|
||||||
import { clamp } from 'lodash-es';
|
import { clamp } from 'lodash-es';
|
||||||
|
import type { QuicklimeEvent } from 'quicklime';
|
||||||
import { useEffect, useMemo } from 'react';
|
import { useEffect, useMemo } from 'react';
|
||||||
import {
|
import {
|
||||||
Box3,
|
Box3,
|
||||||
@@ -186,16 +187,18 @@ export function StaticArmorSceneComponent({
|
|||||||
const distanceToBarrel = clip.distanceToPoint(barrelOrigin);
|
const distanceToBarrel = clip.distanceToPoint(barrelOrigin);
|
||||||
const point = new Vector3();
|
const point = new Vector3();
|
||||||
|
|
||||||
function handleModelTransform(data: ModelTransformEventData) {
|
function handleModelTransform(
|
||||||
|
event: QuicklimeEvent<ModelTransformEventData>,
|
||||||
|
) {
|
||||||
clip.normal
|
clip.normal
|
||||||
.set(0, 0, -1)
|
.set(0, 0, -1)
|
||||||
.applyAxisAngle(I_HAT, data.pitch)
|
.applyAxisAngle(I_HAT, event.data.pitch)
|
||||||
.applyAxisAngle(J_HAT, data.yaw ?? 0);
|
.applyAxisAngle(J_HAT, event.data.yaw);
|
||||||
clip.constant = 0;
|
clip.constant = 0;
|
||||||
|
|
||||||
point
|
point
|
||||||
.copy(gunOrigin)
|
.copy(gunOrigin)
|
||||||
.applyAxisAngle(J_HAT, data.yaw ?? 0)
|
.applyAxisAngle(J_HAT, event.data.yaw)
|
||||||
.add(clip.normal.multiplyScalar(-distanceToBarrel))
|
.add(clip.normal.multiplyScalar(-distanceToBarrel))
|
||||||
.add(neckOrigin);
|
.add(neckOrigin);
|
||||||
clip.normal.normalize();
|
clip.normal.normalize();
|
||||||
|
|||||||
@@ -33,43 +33,35 @@ export function Body({ stats }: BodyProps) {
|
|||||||
<StickyColumnHeaderCell key={key} top={137}>
|
<StickyColumnHeaderCell key={key} top={137}>
|
||||||
<Flex justify="center">
|
<Flex justify="center">
|
||||||
<Flex>
|
<Flex>
|
||||||
{gun.gun_type!.value.base.shells.map(
|
{gun.shells.map((thisShell, shellIndex) => (
|
||||||
(thisShell, shellIndex) => (
|
<IconButton
|
||||||
<IconButton
|
color={thisShell.id === shell.id ? undefined : 'gray'}
|
||||||
color={thisShell.id === shell.id ? undefined : 'gray'}
|
variant="soft"
|
||||||
variant="soft"
|
key={thisShell.id}
|
||||||
key={thisShell.id}
|
style={{
|
||||||
style={{
|
borderTopLeftRadius: shellIndex === 0 ? undefined : 0,
|
||||||
borderTopLeftRadius: shellIndex === 0 ? undefined : 0,
|
borderBottomLeftRadius:
|
||||||
borderBottomLeftRadius:
|
shellIndex === 0 ? undefined : 0,
|
||||||
shellIndex === 0 ? undefined : 0,
|
borderTopRightRadius:
|
||||||
borderTopRightRadius:
|
shellIndex === gun.shells.length - 1 ? undefined : 0,
|
||||||
shellIndex ===
|
borderBottomRightRadius:
|
||||||
gun.gun_type!.value.base.shells.length - 1
|
shellIndex === gun.shells.length - 1 ? undefined : 0,
|
||||||
? undefined
|
marginLeft: shellIndex === 0 ? 0 : -1,
|
||||||
: 0,
|
}}
|
||||||
borderBottomRightRadius:
|
onClick={() => {
|
||||||
shellIndex ===
|
mutateCompareEphemeral((draft) => {
|
||||||
gun.gun_type!.value.base.shells.length - 1
|
draft.members[index].shell = thisShell;
|
||||||
? undefined
|
});
|
||||||
: 0,
|
}}
|
||||||
marginLeft: shellIndex === 0 ? 0 : -1,
|
>
|
||||||
}}
|
<img
|
||||||
onClick={() => {
|
alt={unwrap(thisShell.name)}
|
||||||
mutateCompareEphemeral((draft) => {
|
width={16}
|
||||||
draft.members[index].shell = thisShell;
|
height={16}
|
||||||
});
|
src={asset(`icons/shells/${thisShell.icon}.webp`)}
|
||||||
}}
|
/>
|
||||||
>
|
</IconButton>
|
||||||
<img
|
))}
|
||||||
alt={unwrap(thisShell.name)}
|
|
||||||
width={16}
|
|
||||||
height={16}
|
|
||||||
src={asset(`icons/shells/${thisShell.icon}.webp`)}
|
|
||||||
/>
|
|
||||||
</IconButton>
|
|
||||||
),
|
|
||||||
)}
|
|
||||||
</Flex>
|
</Flex>
|
||||||
</Flex>
|
</Flex>
|
||||||
</StickyColumnHeaderCell>
|
</StickyColumnHeaderCell>
|
||||||
|
|||||||
@@ -250,8 +250,7 @@ export function CompareTable({ stats }: CompareTableProps) {
|
|||||||
|
|
||||||
member.turret = member.tank.turrets[0];
|
member.turret = member.tank.turrets[0];
|
||||||
member.gun = member.turret.guns[0];
|
member.gun = member.turret.guns[0];
|
||||||
member.shell =
|
member.shell = member.gun.shells[0];
|
||||||
member.gun.gun_type!.value.base.shells[0];
|
|
||||||
member.engine = member.tank.engines[0];
|
member.engine = member.tank.engines[0];
|
||||||
member.track = member.tank.tracks[0];
|
member.track = member.tank.tracks[0];
|
||||||
});
|
});
|
||||||
@@ -267,8 +266,7 @@ export function CompareTable({ stats }: CompareTableProps) {
|
|||||||
|
|
||||||
member.turret = member.tank.turrets.at(-1)!;
|
member.turret = member.tank.turrets.at(-1)!;
|
||||||
member.gun = member.turret.guns.at(-1)!;
|
member.gun = member.turret.guns.at(-1)!;
|
||||||
member.shell =
|
member.shell = member.gun.shells[0];
|
||||||
member.gun.gun_type!.value.base.shells[0];
|
|
||||||
member.engine = member.tank.engines.at(-1)!;
|
member.engine = member.tank.engines.at(-1)!;
|
||||||
member.track = member.tank.tracks.at(-1)!;
|
member.track = member.tank.tracks.at(-1)!;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,10 +1,15 @@
|
|||||||
import { Link, Table } from '@radix-ui/themes';
|
import { Link, Table } from '@radix-ui/themes';
|
||||||
import MarkdownToJSX from 'markdown-to-jsx';
|
import MarkdownToJSX from 'markdown-to-jsx';
|
||||||
|
import type { ComponentProps } from 'react';
|
||||||
|
|
||||||
interface MarkdownProps {
|
interface MarkdownProps {
|
||||||
children: string;
|
children: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function Image(props: ComponentProps<'img'>) {
|
||||||
|
return <img style={{ maxWidth: '100%' }} {...props} />;
|
||||||
|
}
|
||||||
|
|
||||||
export function Markdown({ children }: MarkdownProps) {
|
export function Markdown({ children }: MarkdownProps) {
|
||||||
return (
|
return (
|
||||||
<MarkdownToJSX
|
<MarkdownToJSX
|
||||||
@@ -17,6 +22,7 @@ export function Markdown({ children }: MarkdownProps) {
|
|||||||
tr: { component: Table.Row },
|
tr: { component: Table.Row },
|
||||||
th: { component: Table.ColumnHeaderCell },
|
th: { component: Table.ColumnHeaderCell },
|
||||||
td: { component: Table.Cell },
|
td: { component: Table.Cell },
|
||||||
|
img: { component: Image },
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ export function ModuleManager({
|
|||||||
const draft = { ...modules };
|
const draft = { ...modules };
|
||||||
draft.turret = turret;
|
draft.turret = turret;
|
||||||
draft.gun = draft.turret.guns.at(-1)!;
|
draft.gun = draft.turret.guns.at(-1)!;
|
||||||
draft.shell = draft.gun.gun_type!.value.base.shells[0];
|
draft.shell = draft.gun.shells[0];
|
||||||
|
|
||||||
onChange?.(draft);
|
onChange?.(draft);
|
||||||
setTurretMenuOpen(false);
|
setTurretMenuOpen(false);
|
||||||
@@ -83,9 +83,7 @@ export function ModuleManager({
|
|||||||
|
|
||||||
<ModuleButton
|
<ModuleButton
|
||||||
module="gun"
|
module="gun"
|
||||||
discriminator={
|
discriminator={TIER_ROMAN_NUMERALS[modules.gun.tier]}
|
||||||
TIER_ROMAN_NUMERALS[modules.gun.gun_type!.value.base.tier]
|
|
||||||
}
|
|
||||||
onClick={() => setGunMenuOpen(true)}
|
onClick={() => setGunMenuOpen(true)}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@@ -95,18 +93,16 @@ export function ModuleManager({
|
|||||||
</DropdownMenu.Trigger>
|
</DropdownMenu.Trigger>
|
||||||
|
|
||||||
<DropdownMenu.Content>
|
<DropdownMenu.Content>
|
||||||
<DropdownMenu.RadioGroup
|
<DropdownMenu.RadioGroup value={`${modules.gun.id}`}>
|
||||||
value={`${modules.gun.gun_type!.value.base.id}`}
|
|
||||||
>
|
|
||||||
{[...modules.turret.guns].reverse().map((gun) => {
|
{[...modules.turret.guns].reverse().map((gun) => {
|
||||||
return (
|
return (
|
||||||
<DropdownMenu.RadioItem
|
<DropdownMenu.RadioItem
|
||||||
key={gun.gun_type!.value.base.id}
|
key={gun.id}
|
||||||
value={`${gun.gun_type!.value.base.id}`}
|
value={`${gun.id}`}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
const draft = { ...modules };
|
const draft = { ...modules };
|
||||||
draft.gun = gun;
|
draft.gun = gun;
|
||||||
draft.shell = draft.gun.gun_type!.value.base.shells[0];
|
draft.shell = draft.gun.shells[0];
|
||||||
|
|
||||||
onChange?.(draft);
|
onChange?.(draft);
|
||||||
setGunMenuOpen(false);
|
setGunMenuOpen(false);
|
||||||
@@ -115,11 +111,9 @@ export function ModuleManager({
|
|||||||
<ModuleButton
|
<ModuleButton
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
module="gun"
|
module="gun"
|
||||||
discriminator={
|
discriminator={TIER_ROMAN_NUMERALS[gun.tier]}
|
||||||
TIER_ROMAN_NUMERALS[gun.gun_type!.value.base.tier]
|
|
||||||
}
|
|
||||||
/>{' '}
|
/>{' '}
|
||||||
{unwrap(gun.gun_type!.value.base.name)}
|
{unwrap(gun.name)}
|
||||||
</DropdownMenu.RadioItem>
|
</DropdownMenu.RadioItem>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
---
|
||||||
|
import { Heading, Link, Text } from '@radix-ui/themes';
|
||||||
|
import { PageWrapper } from './PageWrapper';
|
||||||
|
---
|
||||||
|
|
||||||
|
<PageWrapper align="center" justify="center" gap="0">
|
||||||
|
<Heading>BlitzKit down for servicing</Heading>
|
||||||
|
<Text color="gray">
|
||||||
|
<Link color="blue" href="https://discord.gg/nDt7AjGJQH">
|
||||||
|
Join the official Discord server
|
||||||
|
</Link>
|
||||||
|
for updates.
|
||||||
|
</Text>
|
||||||
|
</PageWrapper>
|
||||||
@@ -25,19 +25,18 @@ export function TankSearchCard({ tank, onSelect }: TankSearchCardProps) {
|
|||||||
|
|
||||||
const turret = tank.turrets.at(-1)!;
|
const turret = tank.turrets.at(-1)!;
|
||||||
const gun = turret.guns.at(-1)!;
|
const gun = turret.guns.at(-1)!;
|
||||||
const shell0 = gun.gun_type!.value.base.shells[0];
|
const shell0 = gun.shells[0];
|
||||||
const shell1 = gun.gun_type!.value.base.shells[1];
|
const shell1 = gun.shells[1];
|
||||||
const shell2 = gun.gun_type!.value.base.shells[2];
|
const shell2 = gun.shells[2];
|
||||||
const tracks = tank.tracks.at(-1)!;
|
const tracks = tank.tracks.at(-1)!;
|
||||||
const engine = tank.engines.at(-1)!;
|
const engine = tank.engines.at(-1)!;
|
||||||
const tankModelDefinition = modelDefinitions.models[tank.id];
|
const tankModelDefinition = modelDefinitions.models[tank.id];
|
||||||
const turretModelDefinition = tankModelDefinition.turrets[turret.id];
|
const turretModelDefinition = tankModelDefinition.turrets[turret.id];
|
||||||
const gunModelDefinition =
|
const gunModelDefinition = turretModelDefinition.guns[gun.id];
|
||||||
turretModelDefinition.guns[gun.gun_type!.value.base.id];
|
|
||||||
|
|
||||||
switch (tankopediaSort.by) {
|
switch (tankopediaSort.by) {
|
||||||
case 'fire.aimTime':
|
case 'fire.aimTime':
|
||||||
return gun.gun_type!.value.base.aim_time.toFixed(2);
|
return gun.aim_time.toFixed(2);
|
||||||
case 'fire.caliber':
|
case 'fire.caliber':
|
||||||
return shell0.caliber.toFixed(0);
|
return shell0.caliber.toFixed(0);
|
||||||
case 'fire.damage':
|
case 'fire.damage':
|
||||||
@@ -47,7 +46,7 @@ export function TankSearchCard({ tank, onSelect }: TankSearchCardProps) {
|
|||||||
case 'fire.dispersionMoving':
|
case 'fire.dispersionMoving':
|
||||||
return tracks.dispersion_move.toFixed(3);
|
return tracks.dispersion_move.toFixed(3);
|
||||||
case 'fire.dispersionStill':
|
case 'fire.dispersionStill':
|
||||||
return gun.gun_type!.value.base.dispersion_base.toFixed(3);
|
return gun.dispersion_base.toFixed(3);
|
||||||
case 'fire.dpm':
|
case 'fire.dpm':
|
||||||
return resolveDpm(gun, shell0).toFixed(0);
|
return resolveDpm(gun, shell0).toFixed(0);
|
||||||
case 'fire.dpmPremium':
|
case 'fire.dpmPremium':
|
||||||
@@ -63,7 +62,7 @@ export function TankSearchCard({ tank, onSelect }: TankSearchCardProps) {
|
|||||||
case 'fire.shellVelocity':
|
case 'fire.shellVelocity':
|
||||||
return shell0.velocity.toFixed(0);
|
return shell0.velocity.toFixed(0);
|
||||||
case 'fire.shellCapacity':
|
case 'fire.shellCapacity':
|
||||||
return gun.gun_type!.value.base.shell_capacity.toFixed(0);
|
return gun.shell_capacity.toFixed(0);
|
||||||
case 'fire.shellRange':
|
case 'fire.shellRange':
|
||||||
return shell0.range.toFixed(0);
|
return shell0.range.toFixed(0);
|
||||||
case 'fire.gunDepression':
|
case 'fire.gunDepression':
|
||||||
@@ -89,7 +88,7 @@ export function TankSearchCard({ tank, onSelect }: TankSearchCardProps) {
|
|||||||
engine.weight +
|
engine.weight +
|
||||||
tracks.weight +
|
tracks.weight +
|
||||||
turret.weight +
|
turret.weight +
|
||||||
gun.gun_type!.value.base.weight)
|
gun.weight)
|
||||||
).toFixed(1);
|
).toFixed(1);
|
||||||
case 'maneuverability.weight':
|
case 'maneuverability.weight':
|
||||||
return (
|
return (
|
||||||
@@ -97,7 +96,7 @@ export function TankSearchCard({ tank, onSelect }: TankSearchCardProps) {
|
|||||||
engine.weight +
|
engine.weight +
|
||||||
tracks.weight +
|
tracks.weight +
|
||||||
turret.weight +
|
turret.weight +
|
||||||
gun.gun_type!.value.base.weight) /
|
gun.weight) /
|
||||||
1000
|
1000
|
||||||
).toFixed(1);
|
).toFixed(1);
|
||||||
case 'maneuverability.traverseSpeed':
|
case 'maneuverability.traverseSpeed':
|
||||||
@@ -111,11 +110,7 @@ export function TankSearchCard({ tank, onSelect }: TankSearchCardProps) {
|
|||||||
case 'survivability.camouflageMoving':
|
case 'survivability.camouflageMoving':
|
||||||
return (tank.camouflage_moving * 100).toFixed(0);
|
return (tank.camouflage_moving * 100).toFixed(0);
|
||||||
case 'survivability.camouflageShooting':
|
case 'survivability.camouflageShooting':
|
||||||
return (
|
return (tank.camouflage_still * gun.camouflage_loss * 100).toFixed(0);
|
||||||
tank.camouflage_still *
|
|
||||||
gun.gun_type!.value.base.camouflage_loss *
|
|
||||||
100
|
|
||||||
).toFixed(0);
|
|
||||||
case 'survivability.volume': {
|
case 'survivability.volume': {
|
||||||
const dimensions = normalizeBoundingBox(
|
const dimensions = normalizeBoundingBox(
|
||||||
unionBoundingBox(
|
unionBoundingBox(
|
||||||
|
|||||||
@@ -104,11 +104,9 @@ export const TankSearch = memo<TankSearchProps>(
|
|||||||
sorted = filtered.sort(
|
sorted = filtered.sort(
|
||||||
(a, b) =>
|
(a, b) =>
|
||||||
a.camouflage_still *
|
a.camouflage_still *
|
||||||
a.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base
|
a.turrets.at(-1)!.guns.at(-1)!.camouflage_loss -
|
||||||
.camouflage_loss -
|
|
||||||
b.camouflage_still *
|
b.camouflage_still *
|
||||||
b.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base
|
b.turrets.at(-1)!.guns.at(-1)!.camouflage_loss,
|
||||||
.camouflage_loss,
|
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -171,11 +169,11 @@ export const TankSearch = memo<TankSearchProps>(
|
|||||||
(a, b) =>
|
(a, b) =>
|
||||||
resolveDpm(
|
resolveDpm(
|
||||||
a.turrets.at(-1)!.guns.at(-1)!,
|
a.turrets.at(-1)!.guns.at(-1)!,
|
||||||
a.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base.shells[0],
|
a.turrets.at(-1)!.guns.at(-1)!.shells[0],
|
||||||
) -
|
) -
|
||||||
resolveDpm(
|
resolveDpm(
|
||||||
b.turrets.at(-1)!.guns.at(-1)!,
|
b.turrets.at(-1)!.guns.at(-1)!,
|
||||||
b.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base.shells[0],
|
b.turrets.at(-1)!.guns.at(-1)!.shells[0],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
@@ -183,18 +181,16 @@ export const TankSearch = memo<TankSearchProps>(
|
|||||||
case 'fire.dpmPremium':
|
case 'fire.dpmPremium':
|
||||||
sorted = filtered.sort(
|
sorted = filtered.sort(
|
||||||
(a, b) =>
|
(a, b) =>
|
||||||
(a.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base.shells[1]
|
(a.turrets.at(-1)!.guns.at(-1)!.shells[1]
|
||||||
? resolveDpm(
|
? resolveDpm(
|
||||||
a.turrets.at(-1)!.guns.at(-1)!,
|
a.turrets.at(-1)!.guns.at(-1)!,
|
||||||
a.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base
|
a.turrets.at(-1)!.guns.at(-1)!.shells[1],
|
||||||
.shells[1],
|
|
||||||
)
|
)
|
||||||
: 0) -
|
: 0) -
|
||||||
(b.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base.shells[1]
|
(b.turrets.at(-1)!.guns.at(-1)!.shells[1]
|
||||||
? resolveDpm(
|
? resolveDpm(
|
||||||
b.turrets.at(-1)!.guns.at(-1)!,
|
b.turrets.at(-1)!.guns.at(-1)!,
|
||||||
b.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base
|
b.turrets.at(-1)!.guns.at(-1)!.shells[1],
|
||||||
.shells[1],
|
|
||||||
)
|
)
|
||||||
: 0),
|
: 0),
|
||||||
);
|
);
|
||||||
@@ -211,108 +207,92 @@ export const TankSearch = memo<TankSearchProps>(
|
|||||||
case 'fire.caliber':
|
case 'fire.caliber':
|
||||||
sorted = filtered.sort(
|
sorted = filtered.sort(
|
||||||
(a, b) =>
|
(a, b) =>
|
||||||
a.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base.shells[0]
|
a.turrets.at(-1)!.guns.at(-1)!.shells[0].caliber -
|
||||||
.caliber -
|
b.turrets.at(-1)!.guns.at(-1)!.shells[0].caliber,
|
||||||
b.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base.shells[0]
|
|
||||||
.caliber,
|
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'fire.standardPenetration':
|
case 'fire.standardPenetration':
|
||||||
sorted = filtered.sort(
|
sorted = filtered.sort(
|
||||||
(a, b) =>
|
(a, b) =>
|
||||||
a.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base.shells[0]
|
a.turrets.at(-1)!.guns.at(-1)!.shells[0].penetration.near -
|
||||||
.penetration.near -
|
b.turrets.at(-1)!.guns.at(-1)!.shells[0].penetration.near,
|
||||||
b.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base.shells[0]
|
|
||||||
.penetration.near,
|
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'fire.premiumPenetration':
|
case 'fire.premiumPenetration':
|
||||||
sorted = filtered.sort(
|
sorted = filtered.sort(
|
||||||
(a, b) =>
|
(a, b) =>
|
||||||
(a.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base.shells[1]
|
(a.turrets.at(-1)!.guns.at(-1)!.shells[1]?.penetration.near ??
|
||||||
?.penetration.near ?? 0) -
|
0) -
|
||||||
(b.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base.shells[1]
|
(b.turrets.at(-1)!.guns.at(-1)!.shells[1]?.penetration.near ??
|
||||||
?.penetration.near ?? 0),
|
0),
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'fire.tertiaryPenetration':
|
case 'fire.tertiaryPenetration':
|
||||||
sorted = filtered.sort(
|
sorted = filtered.sort(
|
||||||
(a, b) =>
|
(a, b) =>
|
||||||
(a.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base.shells[2]
|
(a.turrets.at(-1)!.guns.at(-1)!.shells[2]?.penetration.near ??
|
||||||
?.penetration.near ?? 0) -
|
0) -
|
||||||
(b.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base.shells[2]
|
(b.turrets.at(-1)!.guns.at(-1)!.shells[2]?.penetration.near ??
|
||||||
?.penetration.near ?? 0),
|
0),
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'fire.damage':
|
case 'fire.damage':
|
||||||
sorted = filtered.sort(
|
sorted = filtered.sort(
|
||||||
(a, b) =>
|
(a, b) =>
|
||||||
a.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base.shells[0]
|
a.turrets.at(-1)!.guns.at(-1)!.shells[0].armor_damage -
|
||||||
.armor_damage -
|
b.turrets.at(-1)!.guns.at(-1)!.shells[0].armor_damage,
|
||||||
b.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base.shells[0]
|
|
||||||
.armor_damage,
|
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'fire.moduleDamage':
|
case 'fire.moduleDamage':
|
||||||
sorted = filtered.sort(
|
sorted = filtered.sort(
|
||||||
(a, b) =>
|
(a, b) =>
|
||||||
a.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base.shells[0]
|
a.turrets.at(-1)!.guns.at(-1)!.shells[0].module_damage -
|
||||||
.module_damage -
|
b.turrets.at(-1)!.guns.at(-1)!.shells[0].module_damage,
|
||||||
b.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base.shells[0]
|
|
||||||
.module_damage,
|
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'fire.shellVelocity':
|
case 'fire.shellVelocity':
|
||||||
sorted = filtered.sort(
|
sorted = filtered.sort(
|
||||||
(a, b) =>
|
(a, b) =>
|
||||||
a.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base.shells[0]
|
a.turrets.at(-1)!.guns.at(-1)!.shells[0].velocity -
|
||||||
.velocity -
|
b.turrets.at(-1)!.guns.at(-1)!.shells[0].velocity,
|
||||||
b.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base.shells[0]
|
|
||||||
.velocity,
|
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'fire.shellRange':
|
case 'fire.shellRange':
|
||||||
sorted = filtered.sort(
|
sorted = filtered.sort(
|
||||||
(a, b) =>
|
(a, b) =>
|
||||||
a.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base.shells[0]
|
a.turrets.at(-1)!.guns.at(-1)!.shells[0].range -
|
||||||
.range -
|
b.turrets.at(-1)!.guns.at(-1)!.shells[0].range,
|
||||||
b.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base.shells[0]
|
|
||||||
.range,
|
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'fire.shellCapacity':
|
case 'fire.shellCapacity':
|
||||||
sorted = filtered.sort(
|
sorted = filtered.sort(
|
||||||
(a, b) =>
|
(a, b) =>
|
||||||
a.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base
|
a.turrets.at(-1)!.guns.at(-1)!.shell_capacity -
|
||||||
.shell_capacity -
|
b.turrets.at(-1)!.guns.at(-1)!.shell_capacity,
|
||||||
b.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base
|
|
||||||
.shell_capacity,
|
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'fire.aimTime':
|
case 'fire.aimTime':
|
||||||
sorted = filtered.sort(
|
sorted = filtered.sort(
|
||||||
(a, b) =>
|
(a, b) =>
|
||||||
a.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base.aim_time -
|
a.turrets.at(-1)!.guns.at(-1)!.aim_time -
|
||||||
b.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base.aim_time,
|
b.turrets.at(-1)!.guns.at(-1)!.aim_time,
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'fire.dispersionStill':
|
case 'fire.dispersionStill':
|
||||||
sorted = filtered.sort(
|
sorted = filtered.sort(
|
||||||
(a, b) =>
|
(a, b) =>
|
||||||
a.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base
|
a.turrets.at(-1)!.guns.at(-1)!.dispersion_base -
|
||||||
.dispersion_base -
|
b.turrets.at(-1)!.guns.at(-1)!.dispersion_base,
|
||||||
b.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base
|
|
||||||
.dispersion_base,
|
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -328,13 +308,11 @@ export const TankSearch = memo<TankSearchProps>(
|
|||||||
sorted = filtered.sort(
|
sorted = filtered.sort(
|
||||||
(a, b) =>
|
(a, b) =>
|
||||||
modelDefinitions.models[a.id].turrets[a.turrets.at(-1)!.id]
|
modelDefinitions.models[a.id].turrets[a.turrets.at(-1)!.id]
|
||||||
.guns[a.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base.id]
|
.guns[a.turrets.at(-1)!.guns.at(-1)!.id].pitch.max +
|
||||||
.pitch.max +
|
|
||||||
(modelDefinitions.models[a.id].initial_turret_rotation?.pitch ??
|
(modelDefinitions.models[a.id].initial_turret_rotation?.pitch ??
|
||||||
0) -
|
0) -
|
||||||
modelDefinitions.models[b.id].turrets[b.turrets.at(-1)!.id]
|
modelDefinitions.models[b.id].turrets[b.turrets.at(-1)!.id]
|
||||||
.guns[b.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base.id]
|
.guns[b.turrets.at(-1)!.guns.at(-1)!.id].pitch.max -
|
||||||
.pitch.max -
|
|
||||||
(modelDefinitions.models[b.id].initial_turret_rotation?.pitch ??
|
(modelDefinitions.models[b.id].initial_turret_rotation?.pitch ??
|
||||||
0),
|
0),
|
||||||
);
|
);
|
||||||
@@ -344,13 +322,11 @@ export const TankSearch = memo<TankSearchProps>(
|
|||||||
sorted = filtered.sort(
|
sorted = filtered.sort(
|
||||||
(a, b) =>
|
(a, b) =>
|
||||||
modelDefinitions.models[b.id].turrets[b.turrets.at(-1)!.id]
|
modelDefinitions.models[b.id].turrets[b.turrets.at(-1)!.id]
|
||||||
.guns[b.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base.id]
|
.guns[b.turrets.at(-1)!.guns.at(-1)!.id].pitch.min +
|
||||||
.pitch.min +
|
|
||||||
(modelDefinitions.models[b.id].initial_turret_rotation?.pitch ??
|
(modelDefinitions.models[b.id].initial_turret_rotation?.pitch ??
|
||||||
0) -
|
0) -
|
||||||
modelDefinitions.models[a.id].turrets[a.turrets.at(-1)!.id]
|
modelDefinitions.models[a.id].turrets[a.turrets.at(-1)!.id]
|
||||||
.guns[a.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base.id]
|
.guns[a.turrets.at(-1)!.guns.at(-1)!.id].pitch.min -
|
||||||
.pitch.min -
|
|
||||||
(modelDefinitions.models[a.id].initial_turret_rotation?.pitch ??
|
(modelDefinitions.models[a.id].initial_turret_rotation?.pitch ??
|
||||||
0),
|
0),
|
||||||
);
|
);
|
||||||
@@ -382,14 +358,13 @@ export const TankSearch = memo<TankSearchProps>(
|
|||||||
a.engines.at(-1)!.weight +
|
a.engines.at(-1)!.weight +
|
||||||
a.tracks.at(-1)!.weight +
|
a.tracks.at(-1)!.weight +
|
||||||
a.turrets.at(-1)!.weight +
|
a.turrets.at(-1)!.weight +
|
||||||
a.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base
|
a.turrets.at(-1)!.guns.at(-1)!.weight) -
|
||||||
.weight) -
|
|
||||||
b.engines.at(-1)!.power /
|
b.engines.at(-1)!.power /
|
||||||
(b.weight +
|
(b.weight +
|
||||||
b.engines.at(-1)!.weight +
|
b.engines.at(-1)!.weight +
|
||||||
b.tracks.at(-1)!.weight +
|
b.tracks.at(-1)!.weight +
|
||||||
b.turrets.at(-1)!.weight +
|
b.turrets.at(-1)!.weight +
|
||||||
b.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base.weight),
|
b.turrets.at(-1)!.guns.at(-1)!.weight),
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -400,12 +375,12 @@ export const TankSearch = memo<TankSearchProps>(
|
|||||||
a.engines.at(-1)!.weight +
|
a.engines.at(-1)!.weight +
|
||||||
a.tracks.at(-1)!.weight +
|
a.tracks.at(-1)!.weight +
|
||||||
a.turrets.at(-1)!.weight +
|
a.turrets.at(-1)!.weight +
|
||||||
a.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base.weight -
|
a.turrets.at(-1)!.guns.at(-1)!.weight -
|
||||||
(b.weight +
|
(b.weight +
|
||||||
b.engines.at(-1)!.weight +
|
b.engines.at(-1)!.weight +
|
||||||
b.tracks.at(-1)!.weight +
|
b.tracks.at(-1)!.weight +
|
||||||
b.turrets.at(-1)!.weight +
|
b.turrets.at(-1)!.weight +
|
||||||
b.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base.weight),
|
b.turrets.at(-1)!.guns.at(-1)!.weight),
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
+10
-92
@@ -5,18 +5,9 @@ import {
|
|||||||
resolvePenetrationCoefficient,
|
resolvePenetrationCoefficient,
|
||||||
} from '@blitzkit/core';
|
} from '@blitzkit/core';
|
||||||
import { literals } from '@blitzkit/i18n';
|
import { literals } from '@blitzkit/i18n';
|
||||||
import {
|
import { Flex, Heading, IconButton, Tooltip } from '@radix-ui/themes';
|
||||||
Flex,
|
|
||||||
Heading,
|
|
||||||
IconButton,
|
|
||||||
Slider,
|
|
||||||
Text,
|
|
||||||
TextField,
|
|
||||||
Tooltip,
|
|
||||||
} from '@radix-ui/themes';
|
|
||||||
import { debounce } from 'lodash-es';
|
import { debounce } from 'lodash-es';
|
||||||
import { useEffect, useRef, useState } from 'react';
|
import { useEffect, useRef, useState } from 'react';
|
||||||
import { lerp } from 'three/src/math/MathUtils.js';
|
|
||||||
import { useEquipment } from '../../../../../../hooks/useEquipment';
|
import { useEquipment } from '../../../../../../hooks/useEquipment';
|
||||||
import { useLocale } from '../../../../../../hooks/useLocale';
|
import { useLocale } from '../../../../../../hooks/useLocale';
|
||||||
import { useTankModelDefinition } from '../../../../../../hooks/useTankModelDefinition';
|
import { useTankModelDefinition } from '../../../../../../hooks/useTankModelDefinition';
|
||||||
@@ -41,7 +32,9 @@ export function Firepower({
|
|||||||
const setPenetrationDistanceDebounced = debounce((value: number) => {
|
const setPenetrationDistanceDebounced = debounce((value: number) => {
|
||||||
setPenetrationDistance(value);
|
setPenetrationDistance(value);
|
||||||
}, 500);
|
}, 500);
|
||||||
const { gun, shell, turret } = Duel.use((state) => state.protagonist);
|
const turret = Duel.use((state) => state.protagonist.turret);
|
||||||
|
const gun = Duel.use((state) => state.protagonist.gun);
|
||||||
|
const shell = Duel.use((state) => state.protagonist.shell);
|
||||||
const penetrationDistanceInput = useRef<HTMLInputElement>(null);
|
const penetrationDistanceInput = useRef<HTMLInputElement>(null);
|
||||||
const hasSupercharger = useEquipment(107);
|
const hasSupercharger = useEquipment(107);
|
||||||
const hasCalibratedShells = useEquipment(103);
|
const hasCalibratedShells = useEquipment(103);
|
||||||
@@ -55,8 +48,7 @@ export function Firepower({
|
|||||||
]);
|
]);
|
||||||
const tankModelDefinition = useTankModelDefinition();
|
const tankModelDefinition = useTankModelDefinition();
|
||||||
const turretModelDefinition = tankModelDefinition.turrets[turret.id];
|
const turretModelDefinition = tankModelDefinition.turrets[turret.id];
|
||||||
const gunModelDefinition =
|
const gunModelDefinition = turretModelDefinition.guns[gun.id];
|
||||||
turretModelDefinition.guns[gun.gun_type!.value.base.id];
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (penetrationDistanceInput.current) {
|
if (penetrationDistanceInput.current) {
|
||||||
@@ -72,7 +64,7 @@ export function Firepower({
|
|||||||
</Heading>
|
</Heading>
|
||||||
|
|
||||||
<Flex>
|
<Flex>
|
||||||
{gun.gun_type!.value.base.shells.map((thisShell, shellIndex) => {
|
{gun.shells.map((thisShell, shellIndex) => {
|
||||||
const selected = thisShell.id === shell.id;
|
const selected = thisShell.id === shell.id;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -85,13 +77,9 @@ export function Firepower({
|
|||||||
borderTopLeftRadius: shellIndex === 0 ? undefined : 0,
|
borderTopLeftRadius: shellIndex === 0 ? undefined : 0,
|
||||||
borderBottomLeftRadius: shellIndex === 0 ? undefined : 0,
|
borderBottomLeftRadius: shellIndex === 0 ? undefined : 0,
|
||||||
borderTopRightRadius:
|
borderTopRightRadius:
|
||||||
shellIndex === gun.gun_type!.value.base.shells.length - 1
|
shellIndex === gun.shells.length - 1 ? undefined : 0,
|
||||||
? undefined
|
|
||||||
: 0,
|
|
||||||
borderBottomRightRadius:
|
borderBottomRightRadius:
|
||||||
shellIndex === gun.gun_type!.value.base.shells.length - 1
|
shellIndex === gun.shells.length - 1 ? undefined : 0,
|
||||||
? undefined
|
|
||||||
: 0,
|
|
||||||
marginLeft: shellIndex === 0 ? 0 : -1,
|
marginLeft: shellIndex === 0 ? 0 : -1,
|
||||||
}}
|
}}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
@@ -126,11 +114,8 @@ export function Firepower({
|
|||||||
<InfoWithDelta stats={stats} decimals={0} value="moduleDamage" />
|
<InfoWithDelta stats={stats} decimals={0} value="moduleDamage" />
|
||||||
<InfoWithDelta stats={stats} decimals={0} value="penetration" />
|
<InfoWithDelta stats={stats} decimals={0} value="penetration" />
|
||||||
|
|
||||||
{gun.gun_type!.value.base.assault_ranges?.types.includes(shell.type) && (
|
{gun.assault_ranges?.types.includes(shell.type) && (
|
||||||
<AssaultRangesVisualizer
|
<AssaultRangesVisualizer stats={stats} ranges={gun.assault_ranges} />
|
||||||
stats={stats}
|
|
||||||
ranges={gun.gun_type!.value.base.assault_ranges}
|
|
||||||
/>
|
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{gun.gun_type!.$case === 'auto_reloader' && (
|
{gun.gun_type!.$case === 'auto_reloader' && (
|
||||||
@@ -193,73 +178,6 @@ export function Firepower({
|
|||||||
)}
|
)}
|
||||||
<ReloadVisualizer stats={stats} />
|
<ReloadVisualizer stats={stats} />
|
||||||
|
|
||||||
{typeof shell.penetration !== 'number' && (
|
|
||||||
<>
|
|
||||||
<InfoWithDelta
|
|
||||||
stats={stats}
|
|
||||||
indent
|
|
||||||
decimals={0}
|
|
||||||
name={literals(
|
|
||||||
strings.website.tools.tankopedia.characteristics.values
|
|
||||||
.at_distance,
|
|
||||||
[`${penetrationDistance}`],
|
|
||||||
)}
|
|
||||||
noRanking
|
|
||||||
value={() =>
|
|
||||||
lerp(
|
|
||||||
shell.penetration.near,
|
|
||||||
shell.penetration.far,
|
|
||||||
(penetrationDistance * penetrationLossOverDistanceCoefficient) /
|
|
||||||
500,
|
|
||||||
) * penetrationCoefficient
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<Flex align="center" gap="2" style={{ paddingLeft: 24 }}>
|
|
||||||
<Text color="gray">
|
|
||||||
{
|
|
||||||
strings.website.tools.tankopedia.characteristics.values
|
|
||||||
.at_distance_slider_label
|
|
||||||
}
|
|
||||||
</Text>
|
|
||||||
<Slider
|
|
||||||
variant="classic"
|
|
||||||
key={penetrationDistance}
|
|
||||||
min={0}
|
|
||||||
max={500}
|
|
||||||
style={{ flex: 1 }}
|
|
||||||
defaultValue={[penetrationDistance]}
|
|
||||||
onValueChange={([value]) => {
|
|
||||||
setPenetrationDistanceDebounced(value);
|
|
||||||
|
|
||||||
if (!penetrationDistanceInput.current) return;
|
|
||||||
|
|
||||||
penetrationDistanceInput.current.value = value.toString();
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<TextField.Root
|
|
||||||
variant="classic"
|
|
||||||
style={{ width: 64 }}
|
|
||||||
ref={penetrationDistanceInput}
|
|
||||||
defaultValue={penetrationDistance}
|
|
||||||
onBlur={() => {
|
|
||||||
setPenetrationDistance(
|
|
||||||
Math.min(
|
|
||||||
parseInt(penetrationDistanceInput.current!.value),
|
|
||||||
500,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}}
|
|
||||||
onKeyDown={(event) => {
|
|
||||||
if (event.key === 'Enter') {
|
|
||||||
event.currentTarget.blur();
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<TextField.Slot side="right">m</TextField.Slot>
|
|
||||||
</TextField.Root>
|
|
||||||
</Flex>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
{isExplosive(shell.type) && (
|
{isExplosive(shell.type) && (
|
||||||
<InfoWithDelta
|
<InfoWithDelta
|
||||||
stats={stats}
|
stats={stats}
|
||||||
|
|||||||
+23
-9
@@ -1,23 +1,34 @@
|
|||||||
import type { QuicklimeEvent } from 'quicklime';
|
import type { QuicklimeEvent } from 'quicklime';
|
||||||
import { useEffect, useRef } from 'react';
|
import { useEffect, useRef } from 'react';
|
||||||
import type { Group } from 'three';
|
import type { Group } from 'three';
|
||||||
|
import { awaitableModelDefinitions } from '../../../../../../../../core/awaitables/modelDefinitions';
|
||||||
import {
|
import {
|
||||||
modelTransformEvent,
|
modelTransformEvent,
|
||||||
type ModelTransformEventData,
|
type ModelTransformEventData,
|
||||||
} from '../../../../../../../../core/blitzkit/modelTransform';
|
} from '../../../../../../../../core/blitzkit/modelTransform';
|
||||||
|
import { Duel } from '../../../../../../../../stores/duel';
|
||||||
import { ModelChunk } from './ModelChunk';
|
import { ModelChunk } from './ModelChunk';
|
||||||
|
|
||||||
|
const modelDefinitions = await awaitableModelDefinitions;
|
||||||
|
|
||||||
export function CanvasContent() {
|
export function CanvasContent() {
|
||||||
const hull = useRef<Group>(null);
|
const hullWrapper = useRef<Group>(null);
|
||||||
const gun = useRef<Group>(null);
|
const gunWrapper = useRef<Group>(null);
|
||||||
|
|
||||||
|
const tank = Duel.use((state) => state.protagonist.tank);
|
||||||
|
const turret = Duel.use((state) => state.protagonist.turret);
|
||||||
|
|
||||||
|
const tankModel = modelDefinitions.models[tank.id];
|
||||||
|
const turretModel = tankModel.turrets[turret.id];
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
function handleModelTransformEvent(
|
function handleModelTransformEvent(
|
||||||
event: QuicklimeEvent<ModelTransformEventData>,
|
event: QuicklimeEvent<ModelTransformEventData>,
|
||||||
) {
|
) {
|
||||||
if (!gun.current) return;
|
if (!gunWrapper.current || !hullWrapper.current) return;
|
||||||
|
|
||||||
gun.current.rotation.x = event.data.pitch;
|
gunWrapper.current.rotation.x = event.data.pitch;
|
||||||
|
if (event.data.yaw) hullWrapper.current.rotation.y = event.data.yaw;
|
||||||
}
|
}
|
||||||
|
|
||||||
modelTransformEvent.on(handleModelTransformEvent);
|
modelTransformEvent.on(handleModelTransformEvent);
|
||||||
@@ -26,15 +37,18 @@ export function CanvasContent() {
|
|||||||
modelTransformEvent.off(handleModelTransformEvent);
|
modelTransformEvent.off(handleModelTransformEvent);
|
||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<group ref={hull}>
|
<group ref={hullWrapper} position={[0, 0, turretModel.gun_origin.z]}>
|
||||||
<ModelChunk />
|
<group position={[0, 0, -turretModel.gun_origin.z]}>
|
||||||
|
<ModelChunk only="body" />
|
||||||
|
</group>
|
||||||
</group>
|
</group>
|
||||||
|
|
||||||
<group ref={gun}>
|
<ModelChunk only="turret" />
|
||||||
<ModelChunk onlyGun />
|
|
||||||
|
<group ref={gunWrapper}>
|
||||||
|
<ModelChunk only="gun" />
|
||||||
</group>
|
</group>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
-343
@@ -1,343 +0,0 @@
|
|||||||
import { literals } from '@blitzkit/i18n';
|
|
||||||
import { Box } from '@radix-ui/themes';
|
|
||||||
import { useRef, useState } from 'react';
|
|
||||||
import { clamp, degToRad, radToDeg } from 'three/src/math/MathUtils.js';
|
|
||||||
import { awaitableModelDefinitions } from '../../../../../../../../core/awaitables/modelDefinitions';
|
|
||||||
import {
|
|
||||||
DEFAULT_PITCH_TRANSITION,
|
|
||||||
applyPitchYawLimits,
|
|
||||||
} from '../../../../../../../../core/blitz/applyPitchYawLimits';
|
|
||||||
import { hasEquipment } from '../../../../../../../../core/blitzkit/hasEquipment';
|
|
||||||
import { modelTransformEvent } from '../../../../../../../../core/blitzkit/modelTransform';
|
|
||||||
import { Var } from '../../../../../../../../core/radix/var';
|
|
||||||
import { useLocale } from '../../../../../../../../hooks/useLocale';
|
|
||||||
import { Duel } from '../../../../../../../../stores/duel';
|
|
||||||
import { VisualizerCard } from '../../VisualizerCard';
|
|
||||||
import { VisualizerCornerStat } from '../../VisualizerCornerStat';
|
|
||||||
|
|
||||||
const ANGLE_COEFFICIENT = 1 / 10;
|
|
||||||
|
|
||||||
const modelDefinition = await awaitableModelDefinitions;
|
|
||||||
|
|
||||||
function mag(x: number) {
|
|
||||||
return (1 / Math.PI) * Math.atan(ANGLE_COEFFICIENT * x) + 1 / 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
function magInverse(y: number): number {
|
|
||||||
return (1 / ANGLE_COEFFICIENT) * Math.tan(Math.PI * y - Math.PI / 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
function c(thetaDeg: number, m = 1) {
|
|
||||||
const theta = thetaDeg * (Math.PI / 180);
|
|
||||||
return `${m * Math.cos(theta)} ${-m * Math.sin(theta)}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function FlexibilityCard() {
|
|
||||||
const { strings } = useLocale();
|
|
||||||
|
|
||||||
const [yaw, setYaw] = useState(0);
|
|
||||||
const [pitch, setPitch] = useState(0);
|
|
||||||
const [minPitch, setMinPitch] = useState(0);
|
|
||||||
const [maxPitch, setMaxPitch] = useState(0);
|
|
||||||
|
|
||||||
const container = useRef<HTMLDivElement>(null);
|
|
||||||
const highlighter = useRef<HTMLDivElement>(null);
|
|
||||||
const pointer = useRef<HTMLDivElement>(null);
|
|
||||||
|
|
||||||
const duelStore = Duel.useStore();
|
|
||||||
const tank = Duel.use((state) => state.protagonist.tank);
|
|
||||||
const turret = Duel.use((state) => state.protagonist.turret);
|
|
||||||
const gun = Duel.use((state) => state.protagonist.gun);
|
|
||||||
|
|
||||||
const tankModel = modelDefinition.models[tank.id];
|
|
||||||
const turretModel = tankModel.turrets[turret.id];
|
|
||||||
const gunModel = turretModel.guns[gun.gun_type!.value.base.id];
|
|
||||||
|
|
||||||
const p = gunModel.pitch;
|
|
||||||
const y = turretModel.yaw;
|
|
||||||
const f = p.front;
|
|
||||||
const b = p.back;
|
|
||||||
const t = gunModel.pitch.transition ?? DEFAULT_PITCH_TRANSITION;
|
|
||||||
|
|
||||||
let d = '';
|
|
||||||
|
|
||||||
// right
|
|
||||||
const mo = mag(p.max);
|
|
||||||
if (y) {
|
|
||||||
d += `M 0 0`;
|
|
||||||
d += `L ${c(90 - y.max, mo)}`;
|
|
||||||
} else if (b) {
|
|
||||||
d += `M ${c(-90 + b.range / 2 + t, mo)}`;
|
|
||||||
} else {
|
|
||||||
d += `M ${c(-90, mo)}`;
|
|
||||||
}
|
|
||||||
if (f) {
|
|
||||||
d += `A ${mo} ${mo} 0 0 0 ${c(90 - f.range / 2 - t, mo)}`;
|
|
||||||
} else {
|
|
||||||
d += `A ${mo} ${mo} 0 0 0 ${c(90, mo)}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
// front
|
|
||||||
if (f) {
|
|
||||||
const m = mag(f.max);
|
|
||||||
d += `L ${c(90 - f.range / 2, m)}`;
|
|
||||||
d += `A ${m} ${m} 0 0 0 ${c(90 + f.range / 2, m)}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
// left
|
|
||||||
if (f) {
|
|
||||||
d += `L ${c(90 + f.range / 2 + t, mo)}`;
|
|
||||||
} else {
|
|
||||||
d += `L ${c(90, mo)}`;
|
|
||||||
}
|
|
||||||
if (y) {
|
|
||||||
d += `A ${mo} ${mo} 0 0 0 ${c(90 - y.min, mo)}`;
|
|
||||||
} else if (b) {
|
|
||||||
d += `A ${mo} ${mo} 0 0 0 ${c(-90 - b.range / 2 - t, mo)}`;
|
|
||||||
} else {
|
|
||||||
d += `A ${mo} ${mo} 0 0 0 ${c(-90, mo)}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
// back
|
|
||||||
if (!y && b) {
|
|
||||||
const m = mag(b.max);
|
|
||||||
d += `L ${c(-90 - b.range / 2, m)}`;
|
|
||||||
d += `A ${m} ${m} 0 0 0 ${c(-90 + b.range / 2, m)}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
d += `Z`;
|
|
||||||
|
|
||||||
// right
|
|
||||||
const mi = mag(p.min);
|
|
||||||
if (y) {
|
|
||||||
d += `M 0 0`;
|
|
||||||
d += `L ${c(90 - y.max, mi)}`;
|
|
||||||
} else if (b) {
|
|
||||||
d += `M ${c(-90 + b.range / 2 + t, mi)}`;
|
|
||||||
} else {
|
|
||||||
d += `M ${c(-90, mi)}`;
|
|
||||||
}
|
|
||||||
if (f) {
|
|
||||||
d += `A ${mi} ${mi} 0 0 0 ${c(90 - f.range / 2 - t, mi)}`;
|
|
||||||
} else {
|
|
||||||
d += `A ${mi} ${mi} 0 0 0 ${c(90, mi)}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
// front
|
|
||||||
if (f) {
|
|
||||||
const m = mag(f.min);
|
|
||||||
d += `L ${c(90 - f.range / 2, m)}`;
|
|
||||||
d += `A ${m} ${m} 0 0 0 ${c(90 + f.range / 2, m)}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
// left
|
|
||||||
if (f) {
|
|
||||||
d += `L ${c(90 + f.range / 2 + t, mi)}`;
|
|
||||||
} else {
|
|
||||||
d += `L ${c(90, mi)}`;
|
|
||||||
}
|
|
||||||
if (y) {
|
|
||||||
d += `A ${mi} ${mi} 0 0 0 ${c(90 - y.min, mi)}`;
|
|
||||||
} else if (b) {
|
|
||||||
d += `A ${mi} ${mi} 0 0 0 ${c(-90 - b.range / 2 - t, mi)}`;
|
|
||||||
} else {
|
|
||||||
d += `A ${mi} ${mi} 0 0 0 ${c(-90, mi)}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
// back
|
|
||||||
if (!y && b) {
|
|
||||||
const m = mag(b.min);
|
|
||||||
d += `L ${c(-90 - b.range / 2, m)}`;
|
|
||||||
d += `A ${m} ${m} 0 0 0 ${c(-90 + b.range / 2, m)}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
d += `Z`;
|
|
||||||
|
|
||||||
const r = mag(radToDeg(-pitch));
|
|
||||||
const dotX = r * Math.sin(yaw);
|
|
||||||
const dotY = r * Math.cos(yaw);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<VisualizerCard
|
|
||||||
ref={container}
|
|
||||||
onPointerMove={(event) => {
|
|
||||||
if (!container.current || !highlighter.current || !pointer.current)
|
|
||||||
return;
|
|
||||||
|
|
||||||
const rect = container.current.getBoundingClientRect();
|
|
||||||
const u = event.clientX - rect.left - rect.width / 2;
|
|
||||||
const v = event.clientY - rect.top - rect.height / 2;
|
|
||||||
let yaw = Math.atan2(u, -v);
|
|
||||||
|
|
||||||
const {
|
|
||||||
equipmentMatrix,
|
|
||||||
tank: { equipment_preset },
|
|
||||||
} = duelStore.getState().protagonist;
|
|
||||||
const hasImprovedVerticalStabilizer = hasEquipment(
|
|
||||||
122,
|
|
||||||
equipment_preset,
|
|
||||||
equipmentMatrix,
|
|
||||||
);
|
|
||||||
const hasDownImprovedVerticalStabilizer = hasEquipment(
|
|
||||||
124,
|
|
||||||
equipment_preset,
|
|
||||||
equipmentMatrix,
|
|
||||||
);
|
|
||||||
|
|
||||||
const min = applyPitchYawLimits(
|
|
||||||
-Math.PI,
|
|
||||||
yaw,
|
|
||||||
p,
|
|
||||||
y,
|
|
||||||
hasImprovedVerticalStabilizer,
|
|
||||||
hasDownImprovedVerticalStabilizer,
|
|
||||||
);
|
|
||||||
const max = applyPitchYawLimits(
|
|
||||||
Math.PI,
|
|
||||||
yaw,
|
|
||||||
p,
|
|
||||||
y,
|
|
||||||
hasImprovedVerticalStabilizer,
|
|
||||||
hasDownImprovedVerticalStabilizer,
|
|
||||||
);
|
|
||||||
|
|
||||||
yaw = min[1];
|
|
||||||
let t = 2 * Math.sqrt((u / rect.width) ** 2 + (v / rect.height) ** 2);
|
|
||||||
t = clamp(t, 0, 1);
|
|
||||||
let pitch = degToRad(magInverse(-t));
|
|
||||||
pitch = clamp(pitch, min[0], max[0]);
|
|
||||||
|
|
||||||
setPitch(pitch);
|
|
||||||
setYaw(yaw);
|
|
||||||
setMinPitch(min[0]);
|
|
||||||
setMaxPitch(max[0]);
|
|
||||||
|
|
||||||
modelTransformEvent.dispatch({ pitch, yaw });
|
|
||||||
}}
|
|
||||||
mb="0"
|
|
||||||
>
|
|
||||||
<Box
|
|
||||||
ref={highlighter}
|
|
||||||
position="absolute"
|
|
||||||
top="0"
|
|
||||||
left="0"
|
|
||||||
width="100%"
|
|
||||||
height="100%"
|
|
||||||
style={{
|
|
||||||
borderRadius: Var('radius-2'),
|
|
||||||
overflow: 'hidden',
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Box
|
|
||||||
width="100%"
|
|
||||||
height="100%"
|
|
||||||
style={{
|
|
||||||
opacity: 2 ** -3,
|
|
||||||
backgroundImage: `url(/assets/images/tankopedia/visualizers/ricochet/armor-hash.png)`,
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</Box>
|
|
||||||
|
|
||||||
<svg
|
|
||||||
style={{
|
|
||||||
position: 'absolute',
|
|
||||||
top: 0,
|
|
||||||
left: 0,
|
|
||||||
width: 'calc(100%)',
|
|
||||||
height: 'calc(100%)',
|
|
||||||
}}
|
|
||||||
viewBox="-1 -1 2 2"
|
|
||||||
>
|
|
||||||
<path
|
|
||||||
fillRule="evenodd"
|
|
||||||
fill="var(--gray-5)"
|
|
||||||
stroke="var(--gray-8)"
|
|
||||||
strokeWidth="1px"
|
|
||||||
vectorEffect="non-scaling-stroke"
|
|
||||||
d={d}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<path
|
|
||||||
stroke="var(--gray-11)"
|
|
||||||
fill="transparent"
|
|
||||||
strokeWidth="1px"
|
|
||||||
strokeDasharray="0.5rem 0.5rem"
|
|
||||||
vectorEffect="non-scaling-stroke"
|
|
||||||
d={`
|
|
||||||
M 0.5 0
|
|
||||||
A 0.5 0.5 0 1 1 -0.5 0
|
|
||||||
A 0.5 0.5 0 1 1 0.5 0
|
|
||||||
Z
|
|
||||||
`}
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
|
|
||||||
<Box
|
|
||||||
ref={pointer}
|
|
||||||
position="absolute"
|
|
||||||
top="50%"
|
|
||||||
left="50%"
|
|
||||||
width="0"
|
|
||||||
height="0"
|
|
||||||
style={{
|
|
||||||
transform: `translate(-50%, -50%) rotate(${yaw + Math.PI}rad)`,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Box
|
|
||||||
width="1pt"
|
|
||||||
height="14rem"
|
|
||||||
style={{
|
|
||||||
borderRadius: Var('radius-1'),
|
|
||||||
background: `linear-gradient(${Var('gray-a11')}, ${Var('gray-a6')})`,
|
|
||||||
transform: 'translateX(-50%)',
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</Box>
|
|
||||||
|
|
||||||
<Box
|
|
||||||
position="absolute"
|
|
||||||
left={`${50 * (dotX + 1)}%`}
|
|
||||||
bottom={`${50 * (dotY + 1)}%`}
|
|
||||||
width="0.25rem"
|
|
||||||
height="0.25rem"
|
|
||||||
style={{
|
|
||||||
borderRadius: '50%',
|
|
||||||
backgroundColor: Var('gray-12'),
|
|
||||||
transform: 'translate(-50%, 50%)',
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<VisualizerCornerStat
|
|
||||||
label={
|
|
||||||
strings.website.tools.tankopedia.visualizers.flexibility.elevation
|
|
||||||
}
|
|
||||||
value={literals(strings.common.units.deg, [
|
|
||||||
radToDeg(maxPitch).toFixed(0),
|
|
||||||
])}
|
|
||||||
side="top-left"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<VisualizerCornerStat
|
|
||||||
label={
|
|
||||||
strings.website.tools.tankopedia.visualizers.flexibility.depression
|
|
||||||
}
|
|
||||||
value={literals(strings.common.units.deg, [
|
|
||||||
radToDeg(-minPitch).toFixed(0),
|
|
||||||
])}
|
|
||||||
side="top-right"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<VisualizerCornerStat
|
|
||||||
label={strings.website.tools.tankopedia.visualizers.flexibility.pitch}
|
|
||||||
value={literals(strings.common.units.deg, [radToDeg(pitch).toFixed(0)])}
|
|
||||||
side="bottom-left"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<VisualizerCornerStat
|
|
||||||
label={strings.website.tools.tankopedia.visualizers.flexibility.yaw}
|
|
||||||
value={literals(strings.common.units.deg, [radToDeg(yaw).toFixed(0)])}
|
|
||||||
side="bottom-right"
|
|
||||||
/>
|
|
||||||
</VisualizerCard>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
+62
-29
@@ -7,27 +7,51 @@ import { Duel } from '../../../../../../../../stores/duel';
|
|||||||
|
|
||||||
const modelDefinitions = await awaitableModelDefinitions;
|
const modelDefinitions = await awaitableModelDefinitions;
|
||||||
|
|
||||||
const surfaceMaterial = new MeshBasicMaterial({
|
const surfaceMaterial: Record<Props['only'], MeshBasicMaterial> = {
|
||||||
color: mauveDark.mauve6,
|
gun: new MeshBasicMaterial({
|
||||||
toneMapped: false,
|
color: mauveDark.mauve8,
|
||||||
});
|
toneMapped: false,
|
||||||
const outlineMaterial = new LineBasicMaterial({
|
}),
|
||||||
color: mauveDark.mauve8,
|
turret: new MeshBasicMaterial({
|
||||||
toneMapped: false,
|
color: mauveDark.mauve6,
|
||||||
});
|
toneMapped: false,
|
||||||
|
}),
|
||||||
|
body: new MeshBasicMaterial({
|
||||||
|
color: mauveDark.mauve6,
|
||||||
|
toneMapped: false,
|
||||||
|
transparent: true,
|
||||||
|
opacity: 0.5,
|
||||||
|
}),
|
||||||
|
};
|
||||||
|
const outlineMaterial: Record<Props['only'], LineBasicMaterial> = {
|
||||||
|
gun: new LineBasicMaterial({
|
||||||
|
color: mauveDark.mauve11,
|
||||||
|
toneMapped: false,
|
||||||
|
}),
|
||||||
|
turret: new LineBasicMaterial({
|
||||||
|
color: mauveDark.mauve8,
|
||||||
|
toneMapped: false,
|
||||||
|
}),
|
||||||
|
body: new LineBasicMaterial({
|
||||||
|
color: mauveDark.mauve8,
|
||||||
|
toneMapped: false,
|
||||||
|
transparent: true,
|
||||||
|
opacity: 0.5,
|
||||||
|
}),
|
||||||
|
};
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
onlyGun?: boolean;
|
only: 'gun' | 'turret' | 'body';
|
||||||
}
|
}
|
||||||
|
|
||||||
export function ModelChunk({ onlyGun = false }: Props) {
|
export function ModelChunk({ only }: Props) {
|
||||||
const tank = Duel.use((state) => state.protagonist.tank);
|
const tank = Duel.use((state) => state.protagonist.tank);
|
||||||
const turret = Duel.use((state) => state.protagonist.turret);
|
const turret = Duel.use((state) => state.protagonist.turret);
|
||||||
const gun = Duel.use((state) => state.protagonist.gun);
|
const gun = Duel.use((state) => state.protagonist.gun);
|
||||||
|
|
||||||
const tankModel = modelDefinitions.models[tank.id];
|
const tankModel = modelDefinitions.models[tank.id];
|
||||||
const turretModel = tankModel.turrets[turret.id];
|
const turretModel = tankModel.turrets[turret.id];
|
||||||
const gunModel = turretModel.guns[gun.gun_type!.value.base.id];
|
const gunModel = turretModel.guns[gun.id];
|
||||||
|
|
||||||
const originZ = tankModel.turret_origin.z + turretModel.gun_origin.z;
|
const originZ = tankModel.turret_origin.z + turretModel.gun_origin.z;
|
||||||
const originY = tankModel.turret_origin.y + turretModel.gun_origin.y;
|
const originY = tankModel.turret_origin.y + turretModel.gun_origin.y;
|
||||||
@@ -43,29 +67,38 @@ export function ModelChunk({ onlyGun = false }: Props) {
|
|||||||
`gun_${gunModel.model_id.toString().padStart(2, '0')}_mask`;
|
`gun_${gunModel.model_id.toString().padStart(2, '0')}_mask`;
|
||||||
const isCurrentGun =
|
const isCurrentGun =
|
||||||
node.name === `gun_${gunModel.model_id.toString().padStart(2, '0')}`;
|
node.name === `gun_${gunModel.model_id.toString().padStart(2, '0')}`;
|
||||||
const isVisible = isCurrentGun || isCurrentMantlet;
|
const isGun = isCurrentGun || isCurrentMantlet;
|
||||||
const isHull = node.name === 'hull';
|
|
||||||
const isWheel = node.name.startsWith('chassis_wheel_');
|
|
||||||
const isTrack = node.name.startsWith('chassis_track_');
|
|
||||||
const isCurrentTurret =
|
const isCurrentTurret =
|
||||||
node.name ===
|
node.name ===
|
||||||
`turret_${turretModel.model_id.toString().padStart(2, '0')}`;
|
`turret_${turretModel.model_id.toString().padStart(2, '0')}`;
|
||||||
const isAnythingElse = isHull || isWheel || isTrack || isCurrentTurret;
|
const isTurret = isCurrentTurret;
|
||||||
|
|
||||||
if ((onlyGun && isVisible) || (!onlyGun && isAnythingElse)) {
|
const isHull = node.name === 'hull';
|
||||||
return jsxTree(node, {
|
const isWheel = node.name.startsWith('chassis_wheel_');
|
||||||
mesh(mesh, props, key) {
|
const isTrack = node.name.startsWith('chassis_track_');
|
||||||
return (
|
const isBody = isHull || isWheel || isTrack;
|
||||||
<>
|
|
||||||
<mesh key={key} {...props} material={surfaceMaterial} />
|
if (
|
||||||
<lineSegments material={outlineMaterial}>
|
(only === 'gun' && !isGun) ||
|
||||||
<edgesGeometry args={[mesh.geometry, 29]} />
|
(only === 'turret' && !isTurret) ||
|
||||||
</lineSegments>
|
(only === 'body' && !isBody)
|
||||||
</>
|
) {
|
||||||
);
|
return null;
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return jsxTree(node, {
|
||||||
|
mesh(mesh, props, key) {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<mesh key={key} {...props} material={surfaceMaterial[only]} />
|
||||||
|
<lineSegments material={outlineMaterial[only]}>
|
||||||
|
<edgesGeometry args={[mesh.geometry, 29]} />
|
||||||
|
</lineSegments>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
});
|
||||||
})}
|
})}
|
||||||
</group>
|
</group>
|
||||||
);
|
);
|
||||||
|
|||||||
+371
-4
@@ -1,18 +1,179 @@
|
|||||||
|
import { literals } from '@blitzkit/i18n';
|
||||||
import { Box, Card, Flex } from '@radix-ui/themes';
|
import { Box, Card, Flex } from '@radix-ui/themes';
|
||||||
|
import { clamp } from 'lodash-es';
|
||||||
|
import { useRef, useState } from 'react';
|
||||||
|
import { degToRad, radToDeg } from 'three/src/math/MathUtils.js';
|
||||||
|
import { awaitableModelDefinitions } from '../../../../../../../core/awaitables/modelDefinitions';
|
||||||
|
import {
|
||||||
|
DEFAULT_PITCH_TRANSITION,
|
||||||
|
applyPitchYawLimits,
|
||||||
|
} from '../../../../../../../core/blitz/applyPitchYawLimits';
|
||||||
|
import { hasEquipment } from '../../../../../../../core/blitzkit/hasEquipment';
|
||||||
|
import { modelTransformEvent } from '../../../../../../../core/blitzkit/modelTransform';
|
||||||
import { Var } from '../../../../../../../core/radix/var';
|
import { Var } from '../../../../../../../core/radix/var';
|
||||||
|
import { useLocale } from '../../../../../../../hooks/useLocale';
|
||||||
|
import { Duel } from '../../../../../../../stores/duel';
|
||||||
import type { MaybeSkeletonComponentProps } from '../../../../../../../types/maybeSkeletonComponentProps';
|
import type { MaybeSkeletonComponentProps } from '../../../../../../../types/maybeSkeletonComponentProps';
|
||||||
|
import { VisualizerCard } from '../VisualizerCard';
|
||||||
|
import { VisualizerCornerStat } from '../VisualizerCornerStat';
|
||||||
import { FlexibilityCanvas } from './components/FlexibilityCanvas';
|
import { FlexibilityCanvas } from './components/FlexibilityCanvas';
|
||||||
import { FlexibilityCard } from './components/FlexibilityCard';
|
|
||||||
|
const ANGLE_COEFFICIENT = 1 / 10;
|
||||||
|
|
||||||
|
const modelDefinition = await awaitableModelDefinitions;
|
||||||
|
|
||||||
|
function mag(x: number) {
|
||||||
|
return (1 / Math.PI) * Math.atan(ANGLE_COEFFICIENT * x) + 1 / 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
function magInverse(y: number): number {
|
||||||
|
return (1 / ANGLE_COEFFICIENT) * Math.tan(Math.PI * y - Math.PI / 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
function c(thetaDeg: number, m = 1) {
|
||||||
|
const theta = thetaDeg * (Math.PI / 180);
|
||||||
|
return `${m * Math.cos(theta)} ${-m * Math.sin(theta)}`;
|
||||||
|
}
|
||||||
|
|
||||||
export function GunFlexibilityVisualizer({
|
export function GunFlexibilityVisualizer({
|
||||||
skeleton,
|
skeleton,
|
||||||
}: MaybeSkeletonComponentProps) {
|
}: MaybeSkeletonComponentProps) {
|
||||||
|
const { strings } = useLocale();
|
||||||
|
|
||||||
|
const duelStore = Duel.useStore();
|
||||||
|
const tank = Duel.use((state) => state.protagonist.tank);
|
||||||
|
const turret = Duel.use((state) => state.protagonist.turret);
|
||||||
|
const gun = Duel.use((state) => state.protagonist.gun);
|
||||||
|
|
||||||
|
const tankModel = modelDefinition.models[tank.id];
|
||||||
|
const turretModel = tankModel.turrets[turret.id];
|
||||||
|
const gunModel = turretModel.guns[gun.id];
|
||||||
|
|
||||||
|
const [yaw, setYaw] = useState(0);
|
||||||
|
const [pitch, setPitch] = useState(0);
|
||||||
|
const [minPitch, setMinPitch] = useState(
|
||||||
|
-degToRad(gunModel.pitch.front?.max ?? gunModel.pitch.max),
|
||||||
|
);
|
||||||
|
const [maxPitch, setMaxPitch] = useState(
|
||||||
|
-degToRad(gunModel.pitch.front?.min ?? gunModel.pitch.min),
|
||||||
|
);
|
||||||
|
|
||||||
|
const container = useRef<HTMLDivElement>(null);
|
||||||
|
const highlighter = useRef<HTMLDivElement>(null);
|
||||||
|
const pointer = useRef<HTMLDivElement>(null);
|
||||||
|
|
||||||
|
const p = gunModel.pitch;
|
||||||
|
const y = turretModel.yaw;
|
||||||
|
const f = p.front;
|
||||||
|
const b = p.back;
|
||||||
|
const t = gunModel.pitch.transition ?? DEFAULT_PITCH_TRANSITION;
|
||||||
|
|
||||||
|
let d = '';
|
||||||
|
|
||||||
|
// right
|
||||||
|
const mo = mag(p.max);
|
||||||
|
if (y) {
|
||||||
|
d += `M 0 0`;
|
||||||
|
d += `L ${c(90 - y.max, mo)}`;
|
||||||
|
} else if (b) {
|
||||||
|
d += `M ${c(-90 + b.range / 2 + t, mo)}`;
|
||||||
|
} else {
|
||||||
|
d += `M ${c(-90, mo)}`;
|
||||||
|
}
|
||||||
|
if (f) {
|
||||||
|
d += `A ${mo} ${mo} 0 0 0 ${c(90 - f.range / 2 - t, mo)}`;
|
||||||
|
} else {
|
||||||
|
d += `A ${mo} ${mo} 0 0 0 ${c(90, mo)}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
// front
|
||||||
|
if (f) {
|
||||||
|
const m = mag(f.max);
|
||||||
|
d += `L ${c(90 - f.range / 2, m)}`;
|
||||||
|
d += `A ${m} ${m} 0 0 0 ${c(90 + f.range / 2, m)}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
// left
|
||||||
|
if (f) {
|
||||||
|
d += `L ${c(90 + f.range / 2 + t, mo)}`;
|
||||||
|
} else {
|
||||||
|
d += `L ${c(90, mo)}`;
|
||||||
|
}
|
||||||
|
if (y) {
|
||||||
|
d += `A ${mo} ${mo} 0 0 0 ${c(90 - y.min, mo)}`;
|
||||||
|
} else if (b) {
|
||||||
|
d += `A ${mo} ${mo} 0 0 0 ${c(-90 - b.range / 2 - t, mo)}`;
|
||||||
|
} else {
|
||||||
|
d += `A ${mo} ${mo} 0 0 0 ${c(-90, mo)}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
// back
|
||||||
|
if (!y && b) {
|
||||||
|
const m = mag(b.max);
|
||||||
|
d += `L ${c(-90 - b.range / 2, m)}`;
|
||||||
|
d += `A ${m} ${m} 0 0 0 ${c(-90 + b.range / 2, m)}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
d += `Z`;
|
||||||
|
|
||||||
|
// right
|
||||||
|
const mi = mag(p.min);
|
||||||
|
if (y) {
|
||||||
|
d += `M 0 0`;
|
||||||
|
d += `L ${c(90 - y.max, mi)}`;
|
||||||
|
} else if (b) {
|
||||||
|
d += `M ${c(-90 + b.range / 2 + t, mi)}`;
|
||||||
|
} else {
|
||||||
|
d += `M ${c(-90, mi)}`;
|
||||||
|
}
|
||||||
|
if (f) {
|
||||||
|
d += `A ${mi} ${mi} 0 0 0 ${c(90 - f.range / 2 - t, mi)}`;
|
||||||
|
} else {
|
||||||
|
d += `A ${mi} ${mi} 0 0 0 ${c(90, mi)}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
// front
|
||||||
|
if (f) {
|
||||||
|
const m = mag(f.min);
|
||||||
|
d += `L ${c(90 - f.range / 2, m)}`;
|
||||||
|
d += `A ${m} ${m} 0 0 0 ${c(90 + f.range / 2, m)}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
// left
|
||||||
|
if (f) {
|
||||||
|
d += `L ${c(90 + f.range / 2 + t, mi)}`;
|
||||||
|
} else {
|
||||||
|
d += `L ${c(90, mi)}`;
|
||||||
|
}
|
||||||
|
if (y) {
|
||||||
|
d += `A ${mi} ${mi} 0 0 0 ${c(90 - y.min, mi)}`;
|
||||||
|
} else if (b) {
|
||||||
|
d += `A ${mi} ${mi} 0 0 0 ${c(-90 - b.range / 2 - t, mi)}`;
|
||||||
|
} else {
|
||||||
|
d += `A ${mi} ${mi} 0 0 0 ${c(-90, mi)}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
// back
|
||||||
|
if (!y && b) {
|
||||||
|
const m = mag(b.min);
|
||||||
|
d += `L ${c(-90 - b.range / 2, m)}`;
|
||||||
|
d += `A ${m} ${m} 0 0 0 ${c(-90 + b.range / 2, m)}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
d += `Z`;
|
||||||
|
|
||||||
|
const r = mag(radToDeg(-pitch));
|
||||||
|
const dotX = r * Math.sin(yaw);
|
||||||
|
const dotY = r * Math.cos(yaw);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Flex direction="column-reverse" gap="0">
|
<Flex direction="column-reverse" gap="0">
|
||||||
<Box mt="-4" px="2">
|
<Box mt="-3" px="2">
|
||||||
<Card variant="classic" style={{ height: '10rem' }}>
|
<Card variant="classic" style={{ height: '10rem' }}>
|
||||||
<Box
|
<Box
|
||||||
style={{ backgroundColor: Var('gray-1') }}
|
style={{
|
||||||
|
background: 'linear-gradient(var(--gray-1), var(--gray-3))',
|
||||||
|
}}
|
||||||
position="absolute"
|
position="absolute"
|
||||||
width="100%"
|
width="100%"
|
||||||
height="100%"
|
height="100%"
|
||||||
@@ -20,11 +181,217 @@ export function GunFlexibilityVisualizer({
|
|||||||
left="0"
|
left="0"
|
||||||
>
|
>
|
||||||
{!skeleton && <FlexibilityCanvas />}
|
{!skeleton && <FlexibilityCanvas />}
|
||||||
|
|
||||||
|
<Box
|
||||||
|
position="absolute"
|
||||||
|
width="100%"
|
||||||
|
height="100%"
|
||||||
|
top="0"
|
||||||
|
left="33%"
|
||||||
|
style={{
|
||||||
|
background: `conic-gradient(
|
||||||
|
at 0 50%,
|
||||||
|
|
||||||
|
transparent,
|
||||||
|
transparent ${Math.PI / 2 - maxPitch}rad,
|
||||||
|
|
||||||
|
${Var('cyan-a4')} ${Math.PI / 2 - maxPitch}rad,
|
||||||
|
${Var('jade-a4')} ${Math.PI / 2 - minPitch}rad,
|
||||||
|
|
||||||
|
transparent ${Math.PI / 2 - minPitch}rad,
|
||||||
|
transparent 180deg
|
||||||
|
)`,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
</Card>
|
</Card>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
<FlexibilityCard />
|
<VisualizerCard
|
||||||
|
ref={container}
|
||||||
|
style={{ touchAction: 'none' }}
|
||||||
|
onPointerMove={(event) => {
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
|
if (!container.current || !highlighter.current || !pointer.current)
|
||||||
|
return;
|
||||||
|
|
||||||
|
const rect = container.current.getBoundingClientRect();
|
||||||
|
const u = event.clientX - rect.left - rect.width / 2;
|
||||||
|
const v = event.clientY - rect.top - rect.height / 2;
|
||||||
|
let yaw = Math.atan2(u, -v);
|
||||||
|
|
||||||
|
const {
|
||||||
|
equipmentMatrix,
|
||||||
|
tank: { equipment_preset },
|
||||||
|
} = duelStore.getState().protagonist;
|
||||||
|
const hasImprovedVerticalStabilizer = hasEquipment(
|
||||||
|
122,
|
||||||
|
equipment_preset,
|
||||||
|
equipmentMatrix,
|
||||||
|
);
|
||||||
|
const hasDownImprovedVerticalStabilizer = hasEquipment(
|
||||||
|
124,
|
||||||
|
equipment_preset,
|
||||||
|
equipmentMatrix,
|
||||||
|
);
|
||||||
|
|
||||||
|
const min = applyPitchYawLimits(
|
||||||
|
-Math.PI,
|
||||||
|
yaw,
|
||||||
|
p,
|
||||||
|
y,
|
||||||
|
hasImprovedVerticalStabilizer,
|
||||||
|
hasDownImprovedVerticalStabilizer,
|
||||||
|
);
|
||||||
|
const max = applyPitchYawLimits(
|
||||||
|
Math.PI,
|
||||||
|
yaw,
|
||||||
|
p,
|
||||||
|
y,
|
||||||
|
hasImprovedVerticalStabilizer,
|
||||||
|
hasDownImprovedVerticalStabilizer,
|
||||||
|
);
|
||||||
|
|
||||||
|
yaw = min[1];
|
||||||
|
let t = 2 * Math.sqrt((u / rect.width) ** 2 + (v / rect.height) ** 2);
|
||||||
|
t = clamp(t, 0, 1);
|
||||||
|
let pitch = degToRad(magInverse(-t));
|
||||||
|
pitch = clamp(pitch, min[0], max[0]);
|
||||||
|
|
||||||
|
setPitch(pitch);
|
||||||
|
setYaw(yaw);
|
||||||
|
setMinPitch(min[0]);
|
||||||
|
setMaxPitch(max[0]);
|
||||||
|
|
||||||
|
modelTransformEvent.dispatch({ pitch, yaw });
|
||||||
|
}}
|
||||||
|
mb="0"
|
||||||
|
>
|
||||||
|
<Box
|
||||||
|
ref={highlighter}
|
||||||
|
position="absolute"
|
||||||
|
top="0"
|
||||||
|
left="0"
|
||||||
|
width="100%"
|
||||||
|
height="100%"
|
||||||
|
style={{
|
||||||
|
borderRadius: Var('radius-2'),
|
||||||
|
overflow: 'hidden',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Box
|
||||||
|
width="100%"
|
||||||
|
height="100%"
|
||||||
|
style={{
|
||||||
|
opacity: 2 ** -3,
|
||||||
|
backgroundImage: `url(/assets/images/tankopedia/visualizers/ricochet/armor-hash.png)`,
|
||||||
|
boxShadow: 'inset 0 0 4rem 1rem black',
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Box>
|
||||||
|
|
||||||
|
<svg
|
||||||
|
style={{
|
||||||
|
position: 'absolute',
|
||||||
|
top: 0,
|
||||||
|
left: 0,
|
||||||
|
width: 'calc(100%)',
|
||||||
|
height: 'calc(100%)',
|
||||||
|
}}
|
||||||
|
viewBox="-1 -1 2 2"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
fillRule="evenodd"
|
||||||
|
fill="var(--gray-5)"
|
||||||
|
stroke="var(--gray-8)"
|
||||||
|
strokeWidth="1px"
|
||||||
|
vectorEffect="non-scaling-stroke"
|
||||||
|
d={d}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<path
|
||||||
|
stroke="var(--gray-10)"
|
||||||
|
fill="transparent"
|
||||||
|
strokeWidth="1px"
|
||||||
|
strokeDasharray="0.5rem 0.5rem"
|
||||||
|
vectorEffect="non-scaling-stroke"
|
||||||
|
d={`
|
||||||
|
M 0.5 0
|
||||||
|
A 0.5 0.5 0 1 1 -0.5 0
|
||||||
|
A 0.5 0.5 0 1 1 0.5 0
|
||||||
|
Z
|
||||||
|
`}
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
|
||||||
|
<Box
|
||||||
|
ref={pointer}
|
||||||
|
position="absolute"
|
||||||
|
top="50%"
|
||||||
|
left="50%"
|
||||||
|
width="0"
|
||||||
|
height="0"
|
||||||
|
style={{
|
||||||
|
transform: `translate(-50%, -50%) rotate(${yaw + Math.PI}rad)`,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Box
|
||||||
|
width="1pt"
|
||||||
|
height="14rem"
|
||||||
|
style={{
|
||||||
|
borderRadius: Var('radius-1'),
|
||||||
|
background: `linear-gradient(${Var('gray-a11')}, ${Var('gray-a6')})`,
|
||||||
|
boxShadow:
|
||||||
|
'var(--white-a12) -0.25rem 0 1rem, var(--black-a12) 0.25rem 0 1rem',
|
||||||
|
transform: 'translateX(-50%)',
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Box>
|
||||||
|
|
||||||
|
<Box
|
||||||
|
position="absolute"
|
||||||
|
left={`${50 * (dotX + 1)}%`}
|
||||||
|
bottom={`${50 * (dotY + 1)}%`}
|
||||||
|
width="0.25rem"
|
||||||
|
height="0.25rem"
|
||||||
|
style={{
|
||||||
|
borderRadius: '50%',
|
||||||
|
backgroundColor: Var('gray-12'),
|
||||||
|
transform: 'translate(-50%, 50%)',
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<VisualizerCornerStat
|
||||||
|
label={strings.website.tools.tankopedia.visualizers.flexibility.max}
|
||||||
|
value={literals(strings.common.units.deg, [
|
||||||
|
radToDeg(maxPitch).toFixed(0),
|
||||||
|
])}
|
||||||
|
side="bottom-left"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<VisualizerCornerStat
|
||||||
|
label={strings.website.tools.tankopedia.visualizers.flexibility.min}
|
||||||
|
value={literals(strings.common.units.deg, [
|
||||||
|
radToDeg(minPitch).toFixed(0),
|
||||||
|
])}
|
||||||
|
side="bottom-right"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<VisualizerCornerStat
|
||||||
|
label={strings.website.tools.tankopedia.visualizers.flexibility.pitch}
|
||||||
|
value={literals(strings.common.units.deg, [
|
||||||
|
radToDeg(pitch).toFixed(0),
|
||||||
|
])}
|
||||||
|
side="top-left"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<VisualizerCornerStat
|
||||||
|
label={strings.website.tools.tankopedia.visualizers.flexibility.yaw}
|
||||||
|
value={literals(strings.common.units.deg, [radToDeg(yaw).toFixed(0)])}
|
||||||
|
side="top-right"
|
||||||
|
/>
|
||||||
|
</VisualizerCard>
|
||||||
</Flex>
|
</Flex>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
+139
-140
@@ -1,7 +1,7 @@
|
|||||||
import { createDefaultSkills } from '@blitzkit/core';
|
import { createDefaultSkills } from '@blitzkit/core';
|
||||||
import { Flex, Progress, Text } from '@radix-ui/themes';
|
import { Flex, Progress, Text } from '@radix-ui/themes';
|
||||||
import { clamp } from 'lodash-es';
|
import { clamp } from 'lodash-es';
|
||||||
import { useMemo, type ComponentProps, type ReactNode } from 'react';
|
import { memo, useMemo, type ComponentProps, type ReactNode } from 'react';
|
||||||
import { awaitableEquipmentDefinitions } from '../../../../../../core/awaitables/equipmentDefinitions';
|
import { awaitableEquipmentDefinitions } from '../../../../../../core/awaitables/equipmentDefinitions';
|
||||||
import { awaitableModelDefinitions } from '../../../../../../core/awaitables/modelDefinitions';
|
import { awaitableModelDefinitions } from '../../../../../../core/awaitables/modelDefinitions';
|
||||||
import { awaitableProvisionDefinitions } from '../../../../../../core/awaitables/provisionDefinitions';
|
import { awaitableProvisionDefinitions } from '../../../../../../core/awaitables/provisionDefinitions';
|
||||||
@@ -48,148 +48,147 @@ const [
|
|||||||
awaitableSkillDefinitions,
|
awaitableSkillDefinitions,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
export function InfoWithDelta({
|
export const InfoWithDelta = memo<InfoWithDeltaProps>(
|
||||||
stats,
|
({ stats, indent, noRanking, deltaType, ...props }) => {
|
||||||
indent,
|
const { strings } = useLocale();
|
||||||
noRanking,
|
const relativeAgainst = TankopediaEphemeral.use(
|
||||||
deltaType,
|
(state) => state.relativeAgainst,
|
||||||
...props
|
);
|
||||||
}: InfoWithDeltaProps) {
|
const uhWhatDoICallThisVariable =
|
||||||
const { strings } = useLocale();
|
|
||||||
const relativeAgainst = TankopediaEphemeral.use(
|
|
||||||
(state) => state.relativeAgainst,
|
|
||||||
);
|
|
||||||
const uhWhatDoICallThisVariable =
|
|
||||||
typeof props.value === 'function'
|
|
||||||
? props.value(stats)!
|
|
||||||
: (stats[props.value] as number);
|
|
||||||
const delta = useDelta(uhWhatDoICallThisVariable);
|
|
||||||
const protagonistTank = Duel.use((state) => state.protagonist.tank);
|
|
||||||
const shellIndex = Duel.use((state) =>
|
|
||||||
state.protagonist.gun.gun_type!.value.base.shells.indexOf(
|
|
||||||
state.protagonist.shell,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
const equipmentMatrix = Duel.use(
|
|
||||||
(state) => state.protagonist.equipmentMatrix,
|
|
||||||
);
|
|
||||||
const others = useMemo(() => {
|
|
||||||
const defaultSkills = createDefaultSkills(skillDefinitions);
|
|
||||||
|
|
||||||
return Object.values(tankDefinitions.tanks)
|
|
||||||
.filter(
|
|
||||||
(tank) =>
|
|
||||||
(relativeAgainst === TankopediaRelativeAgainst.Class &&
|
|
||||||
tank.tier === protagonistTank.tier &&
|
|
||||||
tank.class === protagonistTank.class) ||
|
|
||||||
(relativeAgainst === TankopediaRelativeAgainst.Tier &&
|
|
||||||
tank.tier === protagonistTank.tier) ||
|
|
||||||
relativeAgainst === TankopediaRelativeAgainst.All,
|
|
||||||
)
|
|
||||||
.map((tank) => {
|
|
||||||
const thisTankModel = modelDefinitions.models[tank.id];
|
|
||||||
const member = tankToDuelMember(
|
|
||||||
tank,
|
|
||||||
thisTankModel,
|
|
||||||
provisionDefinitions,
|
|
||||||
);
|
|
||||||
|
|
||||||
if (member.gun.gun_type!.value.base.shells[shellIndex] === undefined) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
return tankCharacteristics(
|
|
||||||
{
|
|
||||||
applyDynamicArmor: false,
|
|
||||||
applyReactiveArmor: false,
|
|
||||||
applySpallLiner: false,
|
|
||||||
camouflage: member.camouflage,
|
|
||||||
consumables: member.consumables,
|
|
||||||
crewSkills: defaultSkills,
|
|
||||||
provisions: member.provisions,
|
|
||||||
engine: member.engine,
|
|
||||||
gun: member.gun,
|
|
||||||
equipmentMatrix: equipmentMatrix,
|
|
||||||
shell: member.gun.gun_type!.value.base.shells[shellIndex],
|
|
||||||
stockEngine: tank.engines[0],
|
|
||||||
stockGun: tank.turrets[0].guns[0],
|
|
||||||
stockTrack: tank.tracks[0],
|
|
||||||
stockTurret: tank.turrets[0],
|
|
||||||
tank,
|
|
||||||
track: member.track,
|
|
||||||
turret: member.turret,
|
|
||||||
assaultDistance: member.assaultDistance,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
equipmentDefinitions,
|
|
||||||
provisionDefinitions,
|
|
||||||
tankModelDefinition: modelDefinitions.models[tank.id],
|
|
||||||
},
|
|
||||||
);
|
|
||||||
})
|
|
||||||
.filter((tank) => {
|
|
||||||
if (tank === undefined) return false;
|
|
||||||
|
|
||||||
const othersValue =
|
|
||||||
typeof props.value === 'function'
|
|
||||||
? props.value(tank)!
|
|
||||||
: (tank[props.value] as number);
|
|
||||||
|
|
||||||
return othersValue !== undefined;
|
|
||||||
}) as TankCharacteristics[];
|
|
||||||
}, [relativeAgainst, shellIndex, equipmentMatrix]);
|
|
||||||
const betterTanks = others.filter((tank) => {
|
|
||||||
const othersValue =
|
|
||||||
typeof props.value === 'function'
|
typeof props.value === 'function'
|
||||||
? props.value(tank)!
|
? props.value(stats)!
|
||||||
: (tank[props.value] as number);
|
: (stats[props.value] as number);
|
||||||
|
const delta = useDelta(uhWhatDoICallThisVariable);
|
||||||
|
const protagonistTank = Duel.use((state) => state.protagonist.tank);
|
||||||
|
const shellIndex = Duel.use((state) =>
|
||||||
|
state.protagonist.gun.shells.indexOf(state.protagonist.shell),
|
||||||
|
);
|
||||||
|
const equipmentMatrix = Duel.use(
|
||||||
|
(state) => state.protagonist.equipmentMatrix,
|
||||||
|
);
|
||||||
|
const others = useMemo(() => {
|
||||||
|
const defaultSkills = createDefaultSkills(skillDefinitions);
|
||||||
|
|
||||||
if (othersValue === undefined) return false;
|
return Object.values(tankDefinitions.tanks)
|
||||||
return deltaType === 'lowerIsBetter'
|
.filter(
|
||||||
? othersValue < uhWhatDoICallThisVariable
|
(tank) =>
|
||||||
: othersValue > uhWhatDoICallThisVariable;
|
(relativeAgainst === TankopediaRelativeAgainst.Class &&
|
||||||
});
|
tank.tier === protagonistTank.tier &&
|
||||||
const goodness = (others.length - betterTanks.length) / others.length;
|
tank.class === protagonistTank.class) ||
|
||||||
let color: ComponentProps<typeof Progress>['color'];
|
(relativeAgainst === TankopediaRelativeAgainst.Tier &&
|
||||||
|
tank.tier === protagonistTank.tier) ||
|
||||||
|
relativeAgainst === TankopediaRelativeAgainst.All,
|
||||||
|
)
|
||||||
|
.map((tank) => {
|
||||||
|
const thisTankModel = modelDefinitions.models[tank.id];
|
||||||
|
const member = tankToDuelMember(
|
||||||
|
tank,
|
||||||
|
thisTankModel,
|
||||||
|
provisionDefinitions,
|
||||||
|
);
|
||||||
|
|
||||||
if (goodness <= 0.25) color = 'red';
|
if (member.gun.shells[shellIndex] === undefined) {
|
||||||
else if (goodness <= 0.5) color = 'orange';
|
return undefined;
|
||||||
else if (goodness <= 0.75) color = 'yellow';
|
}
|
||||||
else color = 'green';
|
|
||||||
|
|
||||||
return (
|
return tankCharacteristics(
|
||||||
<Flex direction="column">
|
{
|
||||||
<Info
|
applyDynamicArmor: false,
|
||||||
deltaType={deltaType}
|
applyReactiveArmor: false,
|
||||||
indent={indent}
|
applySpallLiner: false,
|
||||||
name={
|
camouflage: member.camouflage,
|
||||||
'name' in props
|
consumables: member.consumables,
|
||||||
? props.name
|
crewSkills: defaultSkills,
|
||||||
: strings.website.tools.tankopedia.characteristics.values[
|
provisions: member.provisions,
|
||||||
props.value
|
engine: member.engine,
|
||||||
]
|
gun: member.gun,
|
||||||
}
|
equipmentMatrix: equipmentMatrix,
|
||||||
delta={delta}
|
shell: member.gun.shells[shellIndex],
|
||||||
{...props}
|
stockEngine: tank.engines[0],
|
||||||
>
|
stockGun: tank.turrets[0].guns[0],
|
||||||
{uhWhatDoICallThisVariable}
|
stockTrack: tank.tracks[0],
|
||||||
</Info>
|
stockTurret: tank.turrets[0],
|
||||||
|
tank,
|
||||||
|
track: member.track,
|
||||||
|
turret: member.turret,
|
||||||
|
assaultDistance: member.assaultDistance,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
equipmentDefinitions,
|
||||||
|
provisionDefinitions,
|
||||||
|
tankModelDefinition: modelDefinitions.models[tank.id],
|
||||||
|
},
|
||||||
|
);
|
||||||
|
})
|
||||||
|
.filter((tank) => {
|
||||||
|
if (tank === undefined) return false;
|
||||||
|
|
||||||
{!noRanking && (
|
const othersValue =
|
||||||
<Flex pl={indent ? '2' : '0'} align="center" gap="2">
|
typeof props.value === 'function'
|
||||||
<Progress
|
? props.value(tank)!
|
||||||
variant="soft"
|
: (tank[props.value] as number);
|
||||||
size="1"
|
|
||||||
value={goodness * 100}
|
|
||||||
color={color}
|
|
||||||
style={{ height: '0.125rem', opacity: 0.5 }}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<Text color="gray" size="1">
|
return othersValue !== undefined;
|
||||||
{clamp(betterTanks.length + 1, 1, others.length)} / {others.length}
|
}) as TankCharacteristics[];
|
||||||
</Text>
|
}, [relativeAgainst, shellIndex, equipmentMatrix]);
|
||||||
</Flex>
|
const betterTanks = others.filter((tank) => {
|
||||||
)}
|
const othersValue =
|
||||||
</Flex>
|
typeof props.value === 'function'
|
||||||
);
|
? props.value(tank)!
|
||||||
}
|
: (tank[props.value] as number);
|
||||||
|
|
||||||
|
if (othersValue === undefined) return false;
|
||||||
|
return deltaType === 'lowerIsBetter'
|
||||||
|
? othersValue < uhWhatDoICallThisVariable
|
||||||
|
: othersValue > uhWhatDoICallThisVariable;
|
||||||
|
});
|
||||||
|
const goodness = (others.length - betterTanks.length) / others.length;
|
||||||
|
let color: ComponentProps<typeof Progress>['color'];
|
||||||
|
|
||||||
|
if (goodness <= 0.25) color = 'red';
|
||||||
|
else if (goodness <= 0.5) color = 'orange';
|
||||||
|
else if (goodness <= 0.75) color = 'yellow';
|
||||||
|
else color = 'green';
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Flex direction="column">
|
||||||
|
<Info
|
||||||
|
deltaType={deltaType}
|
||||||
|
indent={indent}
|
||||||
|
name={
|
||||||
|
'name' in props
|
||||||
|
? props.name
|
||||||
|
: strings.website.tools.tankopedia.characteristics.values[
|
||||||
|
props.value
|
||||||
|
]
|
||||||
|
}
|
||||||
|
delta={delta}
|
||||||
|
{...props}
|
||||||
|
>
|
||||||
|
{uhWhatDoICallThisVariable}
|
||||||
|
</Info>
|
||||||
|
|
||||||
|
{!noRanking && (
|
||||||
|
<Flex pl={indent ? '2' : '0'} align="center" gap="2">
|
||||||
|
<Progress
|
||||||
|
variant="soft"
|
||||||
|
size="1"
|
||||||
|
value={goodness * 100}
|
||||||
|
color={color}
|
||||||
|
style={{ height: '0.125rem', opacity: 0.5 }}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Text color="gray" size="1">
|
||||||
|
{clamp(betterTanks.length + 1, 1, others.length)} /{' '}
|
||||||
|
{others.length}
|
||||||
|
</Text>
|
||||||
|
</Flex>
|
||||||
|
)}
|
||||||
|
</Flex>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
|
||||||
|
(a, b) =>
|
||||||
|
(typeof a.value === 'function' ? a.value(a.stats) : a.stats[a.value]) ===
|
||||||
|
(typeof b.value === 'function' ? b.value(b.stats) : b.stats[b.value]),
|
||||||
|
);
|
||||||
+1
-3
@@ -40,7 +40,7 @@ export function Shell({ index, stats }: ShellProps & StatsAcceptorProps) {
|
|||||||
<Box
|
<Box
|
||||||
left="50%"
|
left="50%"
|
||||||
position="absolute"
|
position="absolute"
|
||||||
ml="calc(25% + 2.5rem)"
|
ml="40%"
|
||||||
width="1.25rem"
|
width="1.25rem"
|
||||||
height="1.25rem"
|
height="1.25rem"
|
||||||
style={{
|
style={{
|
||||||
@@ -70,11 +70,9 @@ export function Shell({ index, stats }: ShellProps & StatsAcceptorProps) {
|
|||||||
overflow: 'hidden',
|
overflow: 'hidden',
|
||||||
maskImage:
|
maskImage:
|
||||||
'url(/assets/images/tankopedia/visualizers/reload/shell.png)',
|
'url(/assets/images/tankopedia/visualizers/reload/shell.png)',
|
||||||
// maskComposite: 'exclude',
|
|
||||||
maskSize: 'contain',
|
maskSize: 'contain',
|
||||||
maskRepeat: 'no-repeat',
|
maskRepeat: 'no-repeat',
|
||||||
maskPosition: 'center',
|
maskPosition: 'center',
|
||||||
// background: 'red',
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Box
|
<Box
|
||||||
|
|||||||
+21
@@ -0,0 +1,21 @@
|
|||||||
|
#reload-visualizer-flash {
|
||||||
|
background: transparent;
|
||||||
|
transition-duration: 200ms;
|
||||||
|
}
|
||||||
|
|
||||||
|
#reload-visualizer-flash.go {
|
||||||
|
background: var(--white-a3);
|
||||||
|
transition: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.reload {
|
||||||
|
width: 65%;
|
||||||
|
height: 65%;
|
||||||
|
transition-duration: 200ms;
|
||||||
|
}
|
||||||
|
|
||||||
|
.reload.go {
|
||||||
|
width: 70%;
|
||||||
|
height: 70%;
|
||||||
|
transition: none;
|
||||||
|
}
|
||||||
+121
-51
@@ -1,13 +1,15 @@
|
|||||||
import { type Datum, type Serie } from '@nivo/line';
|
import { Box, Code } from '@radix-ui/themes';
|
||||||
import { Box } from '@radix-ui/themes';
|
|
||||||
import { times } from 'lodash-es';
|
import { times } from 'lodash-es';
|
||||||
import { Quicklime, type QuicklimeCallback } from 'quicklime';
|
import { Quicklime, type QuicklimeCallback } from 'quicklime';
|
||||||
import { useEffect, useRef } from 'react';
|
import { useCallback, useEffect, useRef } from 'react';
|
||||||
import { Var } from '../../../../../../../core/radix/var';
|
import { Var } from '../../../../../../../core/radix/var';
|
||||||
import type { StatsAcceptorProps } from '../TraverseVisualizer';
|
import type { StatsAcceptorProps } from '../TraverseVisualizer';
|
||||||
import { VisualizerCard } from '../VisualizerCard';
|
import { VisualizerCard } from '../VisualizerCard';
|
||||||
import { Shell } from './components/Shell';
|
import { Shell } from './components/Shell';
|
||||||
import { Target } from './components/Target';
|
import { Target } from './components/Target';
|
||||||
|
import './index.css';
|
||||||
|
|
||||||
|
const PRECISION = 2;
|
||||||
|
|
||||||
export interface ReloadUpdateData {
|
export interface ReloadUpdateData {
|
||||||
reload: number;
|
reload: number;
|
||||||
@@ -16,29 +18,29 @@ export interface ReloadUpdateData {
|
|||||||
|
|
||||||
export const reloadUpdate = new Quicklime<ReloadUpdateData>();
|
export const reloadUpdate = new Quicklime<ReloadUpdateData>();
|
||||||
|
|
||||||
const T = 60;
|
|
||||||
|
|
||||||
export function ReloadVisualizer({ stats }: StatsAcceptorProps) {
|
export function ReloadVisualizer({ stats }: StatsAcceptorProps) {
|
||||||
const reloadCircle = useRef<HTMLDivElement>(null);
|
const reloadCircle = useRef<HTMLDivElement>(null);
|
||||||
const reloadCore = useRef<HTMLDivElement>(null);
|
const reloadCore = useRef<HTMLDivElement>(null);
|
||||||
const reloadGlow = useRef<HTMLDivElement>(null);
|
const reloadGlow = useRef<HTMLDivElement>(null);
|
||||||
|
const totalTime = useRef<HTMLSpanElement>(null);
|
||||||
|
const progressTime = useRef<HTMLSpanElement>(null);
|
||||||
|
const flash = useRef<HTMLDivElement>(null);
|
||||||
|
|
||||||
/**
|
|
||||||
* 3-shell gun example:
|
|
||||||
*
|
|
||||||
* 0-1: clip reload
|
|
||||||
* ~~~: shell shot
|
|
||||||
* 1-2: intra-clip
|
|
||||||
* ~~~: shell shot
|
|
||||||
* 2-3: intra-clip
|
|
||||||
* ~~~: shell shot & reset to 0
|
|
||||||
*
|
|
||||||
* intra-clip time = intraClip * (n - 1)
|
|
||||||
*/
|
|
||||||
const state = useRef(0);
|
const state = useRef(0);
|
||||||
const dpm = useRef(0);
|
|
||||||
const shotPool = useRef(new Set<number>());
|
const shoot = useCallback(() => {
|
||||||
const data = useRef<Serie[]>([{ id: 'value', data: [] }]);
|
flash.current?.classList.add('go');
|
||||||
|
reloadCircle.current?.classList.add('go');
|
||||||
|
reloadGlow.current?.classList.add('go');
|
||||||
|
|
||||||
|
void flash.current?.offsetWidth;
|
||||||
|
void reloadCircle.current?.offsetWidth;
|
||||||
|
void reloadGlow.current?.offsetWidth;
|
||||||
|
|
||||||
|
flash.current?.classList.remove('go');
|
||||||
|
reloadCircle.current?.classList.remove('go');
|
||||||
|
reloadGlow.current?.classList.remove('go');
|
||||||
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
let cancel = false;
|
let cancel = false;
|
||||||
@@ -46,37 +48,76 @@ export function ReloadVisualizer({ stats }: StatsAcceptorProps) {
|
|||||||
let lastState = state.current;
|
let lastState = state.current;
|
||||||
const shellArray = new Array(stats.shells);
|
const shellArray = new Array(stats.shells);
|
||||||
|
|
||||||
function shoot() {
|
|
||||||
shotPool.current.add(Date.now() / 1000);
|
|
||||||
dpm.current += stats.damage;
|
|
||||||
}
|
|
||||||
|
|
||||||
function frame() {
|
function frame() {
|
||||||
|
if (!totalTime.current || !progressTime.current) return;
|
||||||
|
|
||||||
|
const reloadThreshold = stats.shellReloads
|
||||||
|
? stats.shellReloads.length
|
||||||
|
: 1;
|
||||||
const now = Date.now() / 1000;
|
const now = Date.now() / 1000;
|
||||||
const dt = now - lastT;
|
const dt = now - lastT;
|
||||||
let reload;
|
let reload;
|
||||||
let shells;
|
let shells;
|
||||||
|
|
||||||
shotPool.current.forEach((t) => {
|
if (state.current < reloadThreshold) {
|
||||||
if (now - t > 60) shotPool.current.delete(t);
|
const shellReload =
|
||||||
});
|
reloadThreshold === 1
|
||||||
|
? stats.shellReload!
|
||||||
|
: stats.shellReloads![Math.floor(state.current)];
|
||||||
|
|
||||||
dpm.current = shotPool.current.size * stats.damage;
|
state.current = Math.min(
|
||||||
|
reloadThreshold,
|
||||||
if (state.current < 1) {
|
state.current + dt / shellReload,
|
||||||
state.current = Math.min(1, state.current + dt / stats.shellReload!);
|
);
|
||||||
reload = state.current;
|
reload = state.current % 1;
|
||||||
shells = shellArray.fill(reload);
|
shells = shellArray.fill(reload);
|
||||||
|
|
||||||
if (state.current >= 1) shoot();
|
if (reloadThreshold > 1) {
|
||||||
} else if (state.current < stats.shells) {
|
shells = shells.map((_, index) =>
|
||||||
|
Math.max(0, state.current - shellArray.length + index + 1),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
totalTime.current.innerHTML = shellReload.toFixed(PRECISION);
|
||||||
|
progressTime.current.innerHTML = ((1 - reload) * shellReload).toFixed(
|
||||||
|
PRECISION,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (state.current >= reloadThreshold) shoot();
|
||||||
|
} else if (state.current < stats.shells + reloadThreshold - 1) {
|
||||||
|
let interval;
|
||||||
|
|
||||||
|
if (
|
||||||
|
stats.burstShells === 1 ||
|
||||||
|
Math.floor(state.current) % stats.burstShells === 0
|
||||||
|
) {
|
||||||
|
interval = stats.intraClip!;
|
||||||
|
} else {
|
||||||
|
interval = stats.burstInterShell!;
|
||||||
|
}
|
||||||
|
|
||||||
state.current = Math.min(
|
state.current = Math.min(
|
||||||
stats.shells,
|
stats.shells + reloadThreshold,
|
||||||
state.current + dt / stats.intraClip!,
|
state.current + dt / interval,
|
||||||
);
|
);
|
||||||
shells = times(stats.shells, (index) => index > state.current - 1);
|
|
||||||
reload = state.current % 1;
|
reload = state.current % 1;
|
||||||
|
|
||||||
|
if (reloadThreshold > 1) {
|
||||||
|
shells = shellArray.map((_, index) =>
|
||||||
|
Math.max(
|
||||||
|
0,
|
||||||
|
Math.floor(index + 1 + reloadThreshold - state.current),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
shells = times(stats.shells, (index) => index > state.current - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
totalTime.current.innerHTML = interval.toFixed(PRECISION);
|
||||||
|
progressTime.current.innerHTML = ((1 - reload) * interval).toFixed(
|
||||||
|
PRECISION,
|
||||||
|
);
|
||||||
|
|
||||||
if (lastState % 1 > state.current % 1) shoot();
|
if (lastState % 1 > state.current % 1) shoot();
|
||||||
} else {
|
} else {
|
||||||
state.current = 0;
|
state.current = 0;
|
||||||
@@ -90,15 +131,6 @@ export function ReloadVisualizer({ stats }: StatsAcceptorProps) {
|
|||||||
|
|
||||||
lastT = now;
|
lastT = now;
|
||||||
lastState = state.current;
|
lastState = state.current;
|
||||||
|
|
||||||
(data.current[0].data as Datum[]).push({
|
|
||||||
x: now,
|
|
||||||
y: dpm.current / (stats.dpm + stats.damage),
|
|
||||||
});
|
|
||||||
(data.current[0].data as Datum[]).splice(
|
|
||||||
0,
|
|
||||||
data.current[0].data.findIndex((d) => now - (d.x as number) < T),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
frame();
|
frame();
|
||||||
@@ -151,8 +183,6 @@ export function ReloadVisualizer({ stats }: StatsAcceptorProps) {
|
|||||||
position="absolute"
|
position="absolute"
|
||||||
top="50%"
|
top="50%"
|
||||||
left="50%"
|
left="50%"
|
||||||
width="12rem"
|
|
||||||
height="12rem"
|
|
||||||
className="reload"
|
className="reload"
|
||||||
ref={reloadGlow}
|
ref={reloadGlow}
|
||||||
style={{
|
style={{
|
||||||
@@ -167,8 +197,6 @@ export function ReloadVisualizer({ stats }: StatsAcceptorProps) {
|
|||||||
position="absolute"
|
position="absolute"
|
||||||
top="50%"
|
top="50%"
|
||||||
left="50%"
|
left="50%"
|
||||||
width="12rem"
|
|
||||||
height="12rem"
|
|
||||||
className="reload"
|
className="reload"
|
||||||
ref={reloadCircle}
|
ref={reloadCircle}
|
||||||
style={{
|
style={{
|
||||||
@@ -216,10 +244,52 @@ export function ReloadVisualizer({ stats }: StatsAcceptorProps) {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<Code
|
||||||
|
ref={progressTime}
|
||||||
|
size="1"
|
||||||
|
variant="ghost"
|
||||||
|
weight="bold"
|
||||||
|
color="gray"
|
||||||
|
highContrast
|
||||||
|
style={{
|
||||||
|
position: 'absolute',
|
||||||
|
top: '50%',
|
||||||
|
right: 'calc(50% + var(--space-8))',
|
||||||
|
transform: 'translateX(50%)',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
0.00
|
||||||
|
</Code>
|
||||||
|
<Code
|
||||||
|
ref={totalTime}
|
||||||
|
size="1"
|
||||||
|
variant="ghost"
|
||||||
|
weight="bold"
|
||||||
|
color="gray"
|
||||||
|
style={{
|
||||||
|
position: 'absolute',
|
||||||
|
top: '50%',
|
||||||
|
left: 'calc(50% + var(--space-8))',
|
||||||
|
transform: 'translateX(-50%)',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
0.00
|
||||||
|
</Code>
|
||||||
|
|
||||||
{stats.shells > 1 &&
|
{stats.shells > 1 &&
|
||||||
times(stats.shells, (index) => (
|
times(stats.shells, (index) => (
|
||||||
<Shell stats={stats} index={index} key={index} />
|
<Shell stats={stats} index={index} key={index} />
|
||||||
))}
|
))}
|
||||||
|
|
||||||
|
<Box
|
||||||
|
id="reload-visualizer-flash"
|
||||||
|
ref={flash}
|
||||||
|
position="absolute"
|
||||||
|
top="0"
|
||||||
|
left="0"
|
||||||
|
width="100%"
|
||||||
|
height="100%"
|
||||||
|
/>
|
||||||
</VisualizerCard>
|
</VisualizerCard>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
+2
-4
@@ -11,7 +11,7 @@ export function ShellSwitcher() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Flex>
|
<Flex>
|
||||||
{gun.gun_type!.value.base.shells.map((thisShell, shellIndex) => {
|
{gun.shells.map((thisShell, shellIndex) => {
|
||||||
const selected = thisShell.id === shell.id;
|
const selected = thisShell.id === shell.id;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -26,9 +26,7 @@ export function ShellSwitcher() {
|
|||||||
borderBottomLeftRadius: shellIndex === 0 ? '50%' : 0,
|
borderBottomLeftRadius: shellIndex === 0 ? '50%' : 0,
|
||||||
borderTopRightRadius: 0,
|
borderTopRightRadius: 0,
|
||||||
borderBottomRightRadius:
|
borderBottomRightRadius:
|
||||||
shellIndex === gun.gun_type!.value.base.shells.length - 1
|
shellIndex === gun.shells.length - 1 ? '50%' : 0,
|
||||||
? '50%'
|
|
||||||
: 0,
|
|
||||||
marginLeft: shellIndex === 0 ? 0 : -1,
|
marginLeft: shellIndex === 0 ? 0 : -1,
|
||||||
}}
|
}}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
|||||||
+12
-12
@@ -3,6 +3,7 @@ import { useEffect } from 'react';
|
|||||||
import { awaitableEquipmentDefinitions } from '../../../../../core/awaitables/equipmentDefinitions';
|
import { awaitableEquipmentDefinitions } from '../../../../../core/awaitables/equipmentDefinitions';
|
||||||
import { awaitableProvisionDefinitions } from '../../../../../core/awaitables/provisionDefinitions';
|
import { awaitableProvisionDefinitions } from '../../../../../core/awaitables/provisionDefinitions';
|
||||||
import { applyPitchYawLimits } from '../../../../../core/blitz/applyPitchYawLimits';
|
import { applyPitchYawLimits } from '../../../../../core/blitz/applyPitchYawLimits';
|
||||||
|
import { modelTransformEvent } from '../../../../../core/blitzkit/modelTransform';
|
||||||
import { tankCharacteristics } from '../../../../../core/blitzkit/tankCharacteristics';
|
import { tankCharacteristics } from '../../../../../core/blitzkit/tankCharacteristics';
|
||||||
import { useEquipment } from '../../../../../hooks/useEquipment';
|
import { useEquipment } from '../../../../../hooks/useEquipment';
|
||||||
import { useTankModelDefinition } from '../../../../../hooks/useTankModelDefinition';
|
import { useTankModelDefinition } from '../../../../../hooks/useTankModelDefinition';
|
||||||
@@ -40,8 +41,7 @@ export function Characteristics({ skeleton }: MaybeSkeletonComponentProps) {
|
|||||||
const stockGun = stockTurret.guns[0];
|
const stockGun = stockTurret.guns[0];
|
||||||
const tankModelDefinition = useTankModelDefinition();
|
const tankModelDefinition = useTankModelDefinition();
|
||||||
const turretModelDefinition = tankModelDefinition.turrets[turret.id];
|
const turretModelDefinition = tankModelDefinition.turrets[turret.id];
|
||||||
const gunModelDefinition =
|
const gunModelDefinition = turretModelDefinition.guns[gun.id];
|
||||||
turretModelDefinition.guns[gun.gun_type!.value.base.id];
|
|
||||||
const stats = tankCharacteristics(
|
const stats = tankCharacteristics(
|
||||||
{
|
{
|
||||||
tank,
|
tank,
|
||||||
@@ -75,16 +75,16 @@ export function Characteristics({ skeleton }: MaybeSkeletonComponentProps) {
|
|||||||
const hasDownImprovedVerticalStabilizer = useEquipment(124);
|
const hasDownImprovedVerticalStabilizer = useEquipment(124);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
mutateDuel((draft) => {
|
const [pitch, yaw] = applyPitchYawLimits(
|
||||||
[draft.protagonist.pitch, draft.protagonist.yaw] = applyPitchYawLimits(
|
modelTransformEvent.last!.pitch,
|
||||||
draft.protagonist.pitch,
|
modelTransformEvent.last!.yaw,
|
||||||
draft.protagonist.yaw,
|
gunModelDefinition.pitch,
|
||||||
gunModelDefinition.pitch,
|
turretModelDefinition.yaw,
|
||||||
turretModelDefinition.yaw,
|
hasImprovedVerticalStabilizer,
|
||||||
hasImprovedVerticalStabilizer,
|
hasDownImprovedVerticalStabilizer,
|
||||||
hasDownImprovedVerticalStabilizer,
|
);
|
||||||
);
|
|
||||||
});
|
modelTransformEvent.dispatch({ pitch, yaw });
|
||||||
}, [hasImprovedVerticalStabilizer, hasDownImprovedVerticalStabilizer]);
|
}, [hasImprovedVerticalStabilizer, hasDownImprovedVerticalStabilizer]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
+15
-26
@@ -33,7 +33,7 @@ type ModuleDefinition =
|
|||||||
|
|
||||||
function extractModule(raw: ModuleDefinition | TankDefinition) {
|
function extractModule(raw: ModuleDefinition | TankDefinition) {
|
||||||
if ('gun_type' in raw) {
|
if ('gun_type' in raw) {
|
||||||
return raw.gun_type!.value.base;
|
return raw;
|
||||||
} else
|
} else
|
||||||
return raw as Exclude<ModuleDefinition | TankDefinition, GunDefinition>;
|
return raw as Exclude<ModuleDefinition | TankDefinition, GunDefinition>;
|
||||||
}
|
}
|
||||||
@@ -179,37 +179,31 @@ export function Modules() {
|
|||||||
|
|
||||||
if (
|
if (
|
||||||
!draft.protagonist.turret.guns.some(
|
!draft.protagonist.turret.guns.some(
|
||||||
(gun) =>
|
(gun) => gun.id === draft.protagonist.gun.id,
|
||||||
gun.gun_type!.value.base.id ===
|
|
||||||
draft.protagonist.gun.gun_type!.value.base.id,
|
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
draft.protagonist.gun = draft.protagonist.turret.guns.at(-1)!;
|
draft.protagonist.gun = draft.protagonist.turret.guns.at(-1)!;
|
||||||
draft.protagonist.shell =
|
draft.protagonist.shell = draft.protagonist.gun.shells[0];
|
||||||
draft.protagonist.gun.gun_type!.value.base.shells[0];
|
|
||||||
}
|
}
|
||||||
} else if (unlock.type === ModuleType.GUN) {
|
} else if (unlock.type === ModuleType.GUN) {
|
||||||
const gunInTurret = draft.protagonist.turret.guns.find(
|
const gunInTurret = draft.protagonist.turret.guns.find(
|
||||||
(gun) => gun.gun_type!.value.base.id === unlock.id,
|
(gun) => gun.id === unlock.id,
|
||||||
);
|
);
|
||||||
if (gunInTurret) {
|
if (gunInTurret) {
|
||||||
draft.protagonist.gun = gunInTurret;
|
draft.protagonist.gun = gunInTurret;
|
||||||
draft.protagonist.shell = gunInTurret.gun_type!.value.base.shells[0];
|
draft.protagonist.shell = gunInTurret.shells[0];
|
||||||
} else {
|
} else {
|
||||||
// TODO: warn somehow?
|
// TODO: warn somehow?
|
||||||
const suitableTurret = draft.protagonist.tank.turrets.find((turret) =>
|
const suitableTurret = draft.protagonist.tank.turrets.find((turret) =>
|
||||||
turret.guns.some(
|
turret.guns.some((gun) => gun.id === unlock.id),
|
||||||
(gun) => gun.gun_type!.value.base.id === unlock.id,
|
|
||||||
),
|
|
||||||
)!;
|
)!;
|
||||||
const gunInSuitableTurret = suitableTurret.guns.find(
|
const gunInSuitableTurret = suitableTurret.guns.find(
|
||||||
(gun) => gun.gun_type!.value.base.id === unlock.id,
|
(gun) => gun.id === unlock.id,
|
||||||
)!;
|
)!;
|
||||||
|
|
||||||
draft.protagonist.turret = suitableTurret;
|
draft.protagonist.turret = suitableTurret;
|
||||||
draft.protagonist.gun = gunInSuitableTurret;
|
draft.protagonist.gun = gunInSuitableTurret;
|
||||||
draft.protagonist.shell =
|
draft.protagonist.shell = gunInSuitableTurret.shells[0];
|
||||||
gunInSuitableTurret.gun_type!.value.base.shells[0];
|
|
||||||
}
|
}
|
||||||
} else if (unlock.type === ModuleType.ENGINE) {
|
} else if (unlock.type === ModuleType.ENGINE) {
|
||||||
draft.protagonist.engine = draft.protagonist.tank.engines.find(
|
draft.protagonist.engine = draft.protagonist.tank.engines.find(
|
||||||
@@ -241,11 +235,9 @@ export function Modules() {
|
|||||||
} else if (unlock.type === ModuleType.GUN) {
|
} else if (unlock.type === ModuleType.GUN) {
|
||||||
module = tank.turrets
|
module = tank.turrets
|
||||||
.find((turret) =>
|
.find((turret) =>
|
||||||
turret.guns.some(
|
turret.guns.some((gun) => gun.id === unlock.id),
|
||||||
(gun) => gun.gun_type!.value.base.id === unlock.id,
|
|
||||||
),
|
|
||||||
)!
|
)!
|
||||||
.guns.find((gun) => gun.gun_type!.value.base.id === unlock.id)!;
|
.guns.find((gun) => gun.id === unlock.id)!;
|
||||||
} else if (unlock.type === ModuleType.VEHICLE) {
|
} else if (unlock.type === ModuleType.VEHICLE) {
|
||||||
module = tankDefinitions.tanks[unlock.id];
|
module = tankDefinitions.tanks[unlock.id];
|
||||||
}
|
}
|
||||||
@@ -308,7 +300,7 @@ export function Modules() {
|
|||||||
(unlock.type === ModuleType.TURRET
|
(unlock.type === ModuleType.TURRET
|
||||||
? turret.id
|
? turret.id
|
||||||
: unlock.type === ModuleType.GUN
|
: unlock.type === ModuleType.GUN
|
||||||
? gun.gun_type!.value.base.id
|
? gun.id
|
||||||
: unlock.type === ModuleType.ENGINE
|
: unlock.type === ModuleType.ENGINE
|
||||||
? engine.id
|
? engine.id
|
||||||
: unlock.type === ModuleType.TRACKS
|
: unlock.type === ModuleType.TRACKS
|
||||||
@@ -319,8 +311,7 @@ export function Modules() {
|
|||||||
unlock.type === ModuleType.TURRET
|
unlock.type === ModuleType.TURRET
|
||||||
? extractModule(module).id == topTurret.id
|
? extractModule(module).id == topTurret.id
|
||||||
: unlock.type === ModuleType.GUN
|
: unlock.type === ModuleType.GUN
|
||||||
? extractModule(module).id ===
|
? extractModule(module).id === topGun.id
|
||||||
topGun.gun_type!.value.base.id
|
|
||||||
: unlock.type === ModuleType.ENGINE
|
: unlock.type === ModuleType.ENGINE
|
||||||
? extractModule(module).id === topEngine.id
|
? extractModule(module).id === topEngine.id
|
||||||
: unlock.type === ModuleType.TRACKS
|
: unlock.type === ModuleType.TRACKS
|
||||||
@@ -371,8 +362,7 @@ export function Modules() {
|
|||||||
mutateDuel((draft) => {
|
mutateDuel((draft) => {
|
||||||
draft.protagonist.turret = draft.protagonist.tank.turrets[0];
|
draft.protagonist.turret = draft.protagonist.tank.turrets[0];
|
||||||
draft.protagonist.gun = draft.protagonist.turret.guns[0];
|
draft.protagonist.gun = draft.protagonist.turret.guns[0];
|
||||||
draft.protagonist.shell =
|
draft.protagonist.shell = draft.protagonist.gun.shells[0];
|
||||||
draft.protagonist.gun.gun_type!.value.base.shells[0];
|
|
||||||
draft.protagonist.engine = draft.protagonist.tank.engines[0];
|
draft.protagonist.engine = draft.protagonist.tank.engines[0];
|
||||||
draft.protagonist.track = draft.protagonist.tank.tracks[0];
|
draft.protagonist.track = draft.protagonist.tank.tracks[0];
|
||||||
});
|
});
|
||||||
@@ -387,8 +377,7 @@ export function Modules() {
|
|||||||
draft.protagonist.turret =
|
draft.protagonist.turret =
|
||||||
draft.protagonist.tank.turrets.at(-1)!;
|
draft.protagonist.tank.turrets.at(-1)!;
|
||||||
draft.protagonist.gun = draft.protagonist.turret.guns.at(-1)!;
|
draft.protagonist.gun = draft.protagonist.turret.guns.at(-1)!;
|
||||||
draft.protagonist.shell =
|
draft.protagonist.shell = draft.protagonist.gun.shells[0];
|
||||||
draft.protagonist.gun.gun_type!.value.base.shells[0];
|
|
||||||
draft.protagonist.engine =
|
draft.protagonist.engine =
|
||||||
draft.protagonist.tank.engines.at(-1)!;
|
draft.protagonist.tank.engines.at(-1)!;
|
||||||
draft.protagonist.track =
|
draft.protagonist.track =
|
||||||
@@ -427,7 +416,7 @@ export function Modules() {
|
|||||||
{tree(ModuleType.GUN, [
|
{tree(ModuleType.GUN, [
|
||||||
{
|
{
|
||||||
cost: { type: 'xp', value: 0 },
|
cost: { type: 'xp', value: 0 },
|
||||||
id: gun0.gun_type!.value.base.id,
|
id: gun0.id,
|
||||||
type: ModuleType.GUN,
|
type: ModuleType.GUN,
|
||||||
},
|
},
|
||||||
])}
|
])}
|
||||||
|
|||||||
@@ -1,51 +0,0 @@
|
|||||||
import { CaretRightIcon } from '@radix-ui/react-icons';
|
|
||||||
import { Box, Flex, Link, Text } from '@radix-ui/themes';
|
|
||||||
import { Var } from '../../../../core/radix/var';
|
|
||||||
import type { TankGuide } from '../../../../pages/[...locale]/tanks/[slug]/index.astro';
|
|
||||||
|
|
||||||
interface Props {
|
|
||||||
guide: TankGuide;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function GuidesBlitz({ guide }: Props) {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<Flex direction="column" gap="4" position="relative">
|
|
||||||
<Text size="4" weight="medium">
|
|
||||||
<Flex width="100%" justify="start" align="center" gap="2">
|
|
||||||
<img
|
|
||||||
style={{
|
|
||||||
width: '1.5em',
|
|
||||||
height: '1.5em',
|
|
||||||
objectFit: 'contain',
|
|
||||||
}}
|
|
||||||
src="https://guidesblitz.com/wp-content/uploads/2023/11/cropped-logo-1.png"
|
|
||||||
/>
|
|
||||||
GuidesBlitz
|
|
||||||
</Flex>
|
|
||||||
</Text>
|
|
||||||
|
|
||||||
<Text size="2">{guide.description}</Text>
|
|
||||||
<img style={{ width: '100%' }} src={guide.image} />
|
|
||||||
|
|
||||||
<Box
|
|
||||||
position="absolute"
|
|
||||||
bottom="0"
|
|
||||||
width="100%"
|
|
||||||
height="100%"
|
|
||||||
left="0"
|
|
||||||
style={{
|
|
||||||
background: `linear-gradient(${Var('gray-a1')}, ${Var('gray-1')})`,
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</Flex>
|
|
||||||
|
|
||||||
<Link underline="always" href={guide.url} target="_blank">
|
|
||||||
<Flex width="100%" justify="center" align="center" gap="1">
|
|
||||||
Read the full guide
|
|
||||||
<CaretRightIcon width="1em" height="1em" />
|
|
||||||
</Flex>
|
|
||||||
</Link>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
import { Flex } from '@radix-ui/themes';
|
import { CaretRightIcon } from '@radix-ui/react-icons';
|
||||||
|
import { Box, Flex, Link, Text } from '@radix-ui/themes';
|
||||||
|
import { Var } from '../../../core/radix/var';
|
||||||
import type { TankGuide } from '../../../pages/[...locale]/tanks/[slug]/index.astro';
|
import type { TankGuide } from '../../../pages/[...locale]/tanks/[slug]/index.astro';
|
||||||
import { GuidesBlitz } from './components/GuidesBlitz';
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
guide: TankGuide;
|
guide: TankGuide;
|
||||||
@@ -9,9 +10,57 @@ interface Props {
|
|||||||
export function GuideSection({ guide }: Props) {
|
export function GuideSection({ guide }: Props) {
|
||||||
return (
|
return (
|
||||||
<Flex justify="center">
|
<Flex justify="center">
|
||||||
<Flex maxWidth="35rem" direction="column" gap="4">
|
<Link
|
||||||
<GuidesBlitz guide={guide} />
|
color="gray"
|
||||||
</Flex>
|
href={guide.url}
|
||||||
|
underline="none"
|
||||||
|
highContrast
|
||||||
|
style={{
|
||||||
|
display: 'flex',
|
||||||
|
maxWidth: '35rem',
|
||||||
|
flexDirection: 'column',
|
||||||
|
gap: Var('space-4'),
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Flex maxWidth="35rem" direction="column" gap="4">
|
||||||
|
<Flex direction="column" gap="4" position="relative">
|
||||||
|
<Text size="4" weight="medium">
|
||||||
|
<Flex width="100%" justify="start" align="center" gap="2">
|
||||||
|
<img
|
||||||
|
style={{
|
||||||
|
width: '1.5em',
|
||||||
|
height: '1.5em',
|
||||||
|
objectFit: 'contain',
|
||||||
|
}}
|
||||||
|
src="https://guidesblitz.com/wp-content/uploads/2023/11/cropped-logo-1.png"
|
||||||
|
/>
|
||||||
|
GuidesBlitz
|
||||||
|
</Flex>
|
||||||
|
</Text>
|
||||||
|
|
||||||
|
<Text size="2">{guide.description}</Text>
|
||||||
|
<img style={{ width: '100%' }} src={guide.image} />
|
||||||
|
|
||||||
|
<Box
|
||||||
|
position="absolute"
|
||||||
|
bottom="0"
|
||||||
|
width="100%"
|
||||||
|
height="100%"
|
||||||
|
left="0"
|
||||||
|
style={{
|
||||||
|
background: `linear-gradient(${Var('gray-a1')}, ${Var('gray-1')})`,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Flex>
|
||||||
|
|
||||||
|
<Text color="purple">
|
||||||
|
<Flex width="100%" justify="center" align="center" gap="1">
|
||||||
|
Read the full guide
|
||||||
|
<CaretRightIcon width="1em" height="1em" />
|
||||||
|
</Flex>
|
||||||
|
</Text>
|
||||||
|
</Flex>
|
||||||
|
</Link>
|
||||||
</Flex>
|
</Flex>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
+1
-1
@@ -90,7 +90,7 @@ export function CustomShellButton() {
|
|||||||
modified.normalization = undefined;
|
modified.normalization = undefined;
|
||||||
modified.ricochet = undefined;
|
modified.ricochet = undefined;
|
||||||
modified.explosion_radius =
|
modified.explosion_radius =
|
||||||
gun.gun_type!.value.base.shells.find(
|
gun.shells.find(
|
||||||
(shell) => shell.type === ShellType.HE,
|
(shell) => shell.type === ShellType.HE,
|
||||||
)?.explosion_radius ?? 1;
|
)?.explosion_radius ?? 1;
|
||||||
break;
|
break;
|
||||||
|
|||||||
+21
-34
@@ -1,5 +1,6 @@
|
|||||||
import { HeightIcon, WidthIcon } from '@radix-ui/react-icons';
|
import { HeightIcon, WidthIcon } from '@radix-ui/react-icons';
|
||||||
import { Flex, TextField } from '@radix-ui/themes';
|
import { Flex, TextField } from '@radix-ui/themes';
|
||||||
|
import type { QuicklimeEvent } from 'quicklime';
|
||||||
import { useEffect, useRef } from 'react';
|
import { useEffect, useRef } from 'react';
|
||||||
import { degToRad, radToDeg } from 'three/src/math/MathUtils.js';
|
import { degToRad, radToDeg } from 'three/src/math/MathUtils.js';
|
||||||
import { applyPitchYawLimits } from '../../../../../../../core/blitz/applyPitchYawLimits';
|
import { applyPitchYawLimits } from '../../../../../../../core/blitz/applyPitchYawLimits';
|
||||||
@@ -20,39 +21,26 @@ export function QuickInputs() {
|
|||||||
const tankModelDefinition = useTankModelDefinition();
|
const tankModelDefinition = useTankModelDefinition();
|
||||||
const turretModelDefinition =
|
const turretModelDefinition =
|
||||||
tankModelDefinition.turrets[protagonist.turret.id];
|
tankModelDefinition.turrets[protagonist.turret.id];
|
||||||
const gunModelDefinition =
|
const gunModelDefinition = turretModelDefinition.guns[protagonist.gun.id];
|
||||||
turretModelDefinition.guns[protagonist.gun.gun_type!.value.base.id];
|
|
||||||
const initialGunPitch =
|
const initialGunPitch =
|
||||||
tankModelDefinition.initial_turret_rotation?.pitch ?? 0;
|
tankModelDefinition.initial_turret_rotation?.pitch ?? 0;
|
||||||
const hasImprovedVerticalStabilizer = useEquipment(122);
|
const hasImprovedVerticalStabilizer = useEquipment(122);
|
||||||
const hasDownImprovedVerticalStabilizer = useEquipment(124);
|
const hasDownImprovedVerticalStabilizer = useEquipment(124);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!yawInput.current) return;
|
function handleTransformEvent(
|
||||||
|
event: QuicklimeEvent<ModelTransformEventData>,
|
||||||
yawInput.current.value = radToDeg(protagonist.yaw).toFixed(1);
|
) {
|
||||||
}, [protagonist.yaw]);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (!pitchInput.current) return;
|
|
||||||
|
|
||||||
pitchInput.current.value = (
|
|
||||||
-radToDeg(protagonist.pitch) + initialGunPitch
|
|
||||||
).toFixed(1);
|
|
||||||
}, [protagonist.pitch]);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
function handleTransformEvent({ pitch, yaw }: ModelTransformEventData) {
|
|
||||||
if (!pitchInput.current || !yawInput.current) return;
|
if (!pitchInput.current || !yawInput.current) return;
|
||||||
|
|
||||||
pitchInput.current.value = (
|
pitchInput.current.value = (
|
||||||
-radToDeg(pitch) +
|
-radToDeg(event.data.pitch) +
|
||||||
(tankModelDefinition.initial_turret_rotation?.pitch ?? 0)
|
(tankModelDefinition.initial_turret_rotation?.pitch ?? 0)
|
||||||
).toFixed(1);
|
).toFixed(1);
|
||||||
|
|
||||||
if (yaw === undefined) return;
|
if (event.data.yaw === undefined) return;
|
||||||
|
|
||||||
yawInput.current.value = radToDeg(yaw).toFixed(1);
|
yawInput.current.value = radToDeg(event.data.yaw).toFixed(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
modelTransformEvent.on(handleTransformEvent);
|
modelTransformEvent.on(handleTransformEvent);
|
||||||
@@ -85,24 +73,27 @@ export function QuickInputs() {
|
|||||||
defaultValue="0.0"
|
defaultValue="0.0"
|
||||||
onBlur={() => {
|
onBlur={() => {
|
||||||
const value = Number(yawInput.current!.value);
|
const value = Number(yawInput.current!.value);
|
||||||
|
|
||||||
if (isNaN(value)) {
|
if (isNaN(value)) {
|
||||||
yawInput.current!.value = radToDeg(protagonist.yaw).toFixed(1);
|
yawInput.current!.value = radToDeg(
|
||||||
|
modelTransformEvent.last!.yaw,
|
||||||
|
).toFixed(1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const [pitch, yaw] = applyPitchYawLimits(
|
const [pitch, yaw] = applyPitchYawLimits(
|
||||||
protagonist.pitch,
|
modelTransformEvent.last!.pitch,
|
||||||
degToRad(value),
|
degToRad(value),
|
||||||
gunModelDefinition.pitch,
|
gunModelDefinition.pitch,
|
||||||
turretModelDefinition.yaw,
|
turretModelDefinition.yaw,
|
||||||
hasImprovedVerticalStabilizer,
|
hasImprovedVerticalStabilizer,
|
||||||
hasDownImprovedVerticalStabilizer,
|
hasDownImprovedVerticalStabilizer,
|
||||||
);
|
);
|
||||||
|
|
||||||
modelTransformEvent.dispatch({ pitch, yaw });
|
modelTransformEvent.dispatch({ pitch, yaw });
|
||||||
mutateDuel((state) => {
|
yawInput.current!.value = radToDeg(
|
||||||
state.protagonist.pitch = pitch;
|
modelTransformEvent.last!.yaw,
|
||||||
state.protagonist.yaw = yaw;
|
).toFixed(1);
|
||||||
});
|
|
||||||
yawInput.current!.value = radToDeg(protagonist.yaw).toFixed(1);
|
|
||||||
}}
|
}}
|
||||||
onKeyDown={(event) => {
|
onKeyDown={(event) => {
|
||||||
if (event.key === 'Enter') {
|
if (event.key === 'Enter') {
|
||||||
@@ -128,25 +119,21 @@ export function QuickInputs() {
|
|||||||
const value = Number(pitchInput.current!.value);
|
const value = Number(pitchInput.current!.value);
|
||||||
if (isNaN(value)) {
|
if (isNaN(value)) {
|
||||||
pitchInput.current!.value = (
|
pitchInput.current!.value = (
|
||||||
-radToDeg(protagonist.pitch) + initialGunPitch
|
-radToDeg(modelTransformEvent.last!.pitch) + initialGunPitch
|
||||||
).toFixed(1);
|
).toFixed(1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const [pitch, yaw] = applyPitchYawLimits(
|
const [pitch, yaw] = applyPitchYawLimits(
|
||||||
degToRad(-value + initialGunPitch),
|
degToRad(-value + initialGunPitch),
|
||||||
protagonist.yaw,
|
modelTransformEvent.last!.yaw,
|
||||||
gunModelDefinition.pitch,
|
gunModelDefinition.pitch,
|
||||||
turretModelDefinition.yaw,
|
turretModelDefinition.yaw,
|
||||||
hasImprovedVerticalStabilizer,
|
hasImprovedVerticalStabilizer,
|
||||||
hasDownImprovedVerticalStabilizer,
|
hasDownImprovedVerticalStabilizer,
|
||||||
);
|
);
|
||||||
modelTransformEvent.dispatch({ pitch, yaw });
|
modelTransformEvent.dispatch({ pitch, yaw });
|
||||||
mutateDuel((state) => {
|
|
||||||
state.protagonist.pitch = pitch;
|
|
||||||
state.protagonist.yaw = yaw;
|
|
||||||
});
|
|
||||||
pitchInput.current!.value = (
|
pitchInput.current!.value = (
|
||||||
-radToDeg(protagonist.pitch) + initialGunPitch
|
-radToDeg(modelTransformEvent.last!.pitch) + initialGunPitch
|
||||||
).toFixed(1);
|
).toFixed(1);
|
||||||
}}
|
}}
|
||||||
onKeyDown={(event) => {
|
onKeyDown={(event) => {
|
||||||
|
|||||||
+8
-15
@@ -141,7 +141,7 @@ export function Options({ thicknessRange, canvas, skeleton }: OptionsProps) {
|
|||||||
mr="2"
|
mr="2"
|
||||||
mb="1"
|
mb="1"
|
||||||
>
|
>
|
||||||
{TIER_ROMAN_NUMERALS[antagonistGun.gun_type!.value.base.tier]}
|
{TIER_ROMAN_NUMERALS[antagonistGun.tier]}
|
||||||
</Text>
|
</Text>
|
||||||
|
|
||||||
<img
|
<img
|
||||||
@@ -161,26 +161,20 @@ export function Options({ thicknessRange, canvas, skeleton }: OptionsProps) {
|
|||||||
{[...antagonistUniqueGuns].reverse().map(({ gun, turret }) => (
|
{[...antagonistUniqueGuns].reverse().map(({ gun, turret }) => (
|
||||||
<ModuleButton
|
<ModuleButton
|
||||||
module="gun"
|
module="gun"
|
||||||
key={gun.gun_type!.value.base.id}
|
key={gun.id}
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
mutateDuel((draft) => {
|
mutateDuel((draft) => {
|
||||||
draft.antagonist.turret = turret;
|
draft.antagonist.turret = turret;
|
||||||
draft.antagonist.gun = gun;
|
draft.antagonist.gun = gun;
|
||||||
draft.antagonist.shell =
|
draft.antagonist.shell = gun.shells[0];
|
||||||
gun.gun_type!.value.base.shells[0];
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
selected={
|
selected={gun.id === antagonistGun.id}
|
||||||
gun.gun_type!.value.base.id ===
|
discriminator={TIER_ROMAN_NUMERALS[gun.tier]}
|
||||||
antagonistGun.gun_type!.value.base.id
|
|
||||||
}
|
|
||||||
discriminator={
|
|
||||||
TIER_ROMAN_NUMERALS[gun.gun_type!.value.base.tier]
|
|
||||||
}
|
|
||||||
secondaryDiscriminator={
|
secondaryDiscriminator={
|
||||||
<Text style={{ fontSize: '0.75em' }}>
|
<Text style={{ fontSize: '0.75em' }}>
|
||||||
{literals(strings.common.units.mm, [
|
{literals(strings.common.units.mm, [
|
||||||
gun.gun_type!.value.base.shells[0].caliber.toFixed(0),
|
gun.shells[0].caliber.toFixed(0),
|
||||||
])}
|
])}
|
||||||
</Text>
|
</Text>
|
||||||
}
|
}
|
||||||
@@ -198,7 +192,7 @@ export function Options({ thicknessRange, canvas, skeleton }: OptionsProps) {
|
|||||||
}}
|
}}
|
||||||
overflow="hidden"
|
overflow="hidden"
|
||||||
>
|
>
|
||||||
{antagonistGun.gun_type!.value.base.shells.map((thisShell) => (
|
{antagonistGun.shells.map((thisShell) => (
|
||||||
<IconButton
|
<IconButton
|
||||||
color={
|
color={
|
||||||
thisShell.id === antagonistShell.id && !hasCustomShell
|
thisShell.id === antagonistShell.id && !hasCustomShell
|
||||||
@@ -367,8 +361,7 @@ export function Options({ thicknessRange, canvas, skeleton }: OptionsProps) {
|
|||||||
draft.antagonist.turret = tank.turrets.at(-1)!;
|
draft.antagonist.turret = tank.turrets.at(-1)!;
|
||||||
draft.antagonist.gun =
|
draft.antagonist.gun =
|
||||||
draft.antagonist.turret.guns.at(-1)!;
|
draft.antagonist.turret.guns.at(-1)!;
|
||||||
draft.antagonist.shell =
|
draft.antagonist.shell = draft.antagonist.gun.shells[0];
|
||||||
draft.antagonist.gun.gun_type!.value.base.shells[0];
|
|
||||||
});
|
});
|
||||||
setAntagonistSelectorOpen(false);
|
setAntagonistSelectorOpen(false);
|
||||||
}}
|
}}
|
||||||
|
|||||||
+3
-3
@@ -56,9 +56,7 @@ export function Controls({
|
|||||||
const antagonistTurretModelDefinition =
|
const antagonistTurretModelDefinition =
|
||||||
antagonistModelDefinition.turrets[antagonistTurret.id];
|
antagonistModelDefinition.turrets[antagonistTurret.id];
|
||||||
const protagonistGunModelDefinition =
|
const protagonistGunModelDefinition =
|
||||||
protagonistTurretModelDefinition.guns[
|
protagonistTurretModelDefinition.guns[protagonistGun.id];
|
||||||
protagonistGun.gun_type!.value.base.id
|
|
||||||
];
|
|
||||||
const protagonistHullOrigin = new Vector3(
|
const protagonistHullOrigin = new Vector3(
|
||||||
protagonistTrackModelDefinition.origin.x,
|
protagonistTrackModelDefinition.origin.x,
|
||||||
protagonistTrackModelDefinition.origin.y,
|
protagonistTrackModelDefinition.origin.y,
|
||||||
@@ -101,6 +99,8 @@ export function Controls({
|
|||||||
.copy(inspectModeInitialPosition)
|
.copy(inspectModeInitialPosition)
|
||||||
.applyAxisAngle(I_HAT, (Math.PI / 32) * Math.sin(t / 9))
|
.applyAxisAngle(I_HAT, (Math.PI / 32) * Math.sin(t / 9))
|
||||||
.applyAxisAngle(J_HAT, (-Math.PI / 16) * Math.sin(t / 7));
|
.applyAxisAngle(J_HAT, (-Math.PI / 16) * Math.sin(t / 7));
|
||||||
|
|
||||||
|
invalidate();
|
||||||
});
|
});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
+31
@@ -0,0 +1,31 @@
|
|||||||
|
import { useEffect } from 'react';
|
||||||
|
import { degToRad } from 'three/src/math/MathUtils.js';
|
||||||
|
import { awaitableModelDefinitions } from '../../../../../../core/awaitables/modelDefinitions';
|
||||||
|
import { applyPitchYawLimits } from '../../../../../../core/blitz/applyPitchYawLimits';
|
||||||
|
import { modelTransformEvent } from '../../../../../../core/blitzkit/modelTransform';
|
||||||
|
import { Duel } from '../../../../../../stores/duel';
|
||||||
|
|
||||||
|
const modelDefinitions = await awaitableModelDefinitions;
|
||||||
|
|
||||||
|
export function InitialAligner() {
|
||||||
|
const tank = Duel.use((state) => state.protagonist.tank);
|
||||||
|
const turret = Duel.use((state) => state.protagonist.turret);
|
||||||
|
const gun = Duel.use((state) => state.protagonist.gun);
|
||||||
|
|
||||||
|
const tankModel = modelDefinitions.models[tank.id];
|
||||||
|
const turretModel = tankModel.turrets[turret.id];
|
||||||
|
const gunModel = turretModel.guns[gun.id];
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const [pitch, yaw] = applyPitchYawLimits(
|
||||||
|
degToRad(8),
|
||||||
|
degToRad(25),
|
||||||
|
gunModel.pitch,
|
||||||
|
turretModel.yaw,
|
||||||
|
);
|
||||||
|
|
||||||
|
modelTransformEvent.dispatch({ pitch, yaw });
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
+7
-12
@@ -39,9 +39,6 @@ export function SceneProps() {
|
|||||||
const material = useRef<MeshStandardMaterial>(null);
|
const material = useRef<MeshStandardMaterial>(null);
|
||||||
const playground = useRef<Group>(null);
|
const playground = useRef<Group>(null);
|
||||||
|
|
||||||
let lastPitch = Duel.use((state) => state.protagonist.pitch);
|
|
||||||
let lastYaw = Duel.use((state) => state.protagonist.yaw);
|
|
||||||
const display = TankopediaEphemeral.use((state) => state.display);
|
|
||||||
const turret = Duel.use((state) => state.protagonist.turret);
|
const turret = Duel.use((state) => state.protagonist.turret);
|
||||||
const track = Duel.use((state) => state.protagonist.track);
|
const track = Duel.use((state) => state.protagonist.track);
|
||||||
const tank = Duel.use((state) => state.protagonist.tank);
|
const tank = Duel.use((state) => state.protagonist.tank);
|
||||||
@@ -52,7 +49,7 @@ export function SceneProps() {
|
|||||||
const trackModelDefinition =
|
const trackModelDefinition =
|
||||||
modelDefinitions.models[tank.id].tracks[track.id];
|
modelDefinitions.models[tank.id].tracks[track.id];
|
||||||
const gunModelDefinition =
|
const gunModelDefinition =
|
||||||
tankModelDefinition.turrets[turret.id].guns[gun.gun_type!.value.base.id];
|
tankModelDefinition.turrets[turret.id].guns[gun.id];
|
||||||
const turretModelDefinition = tankModelDefinition.turrets[turret.id];
|
const turretModelDefinition = tankModelDefinition.turrets[turret.id];
|
||||||
const hullOrigin = new Vector3(
|
const hullOrigin = new Vector3(
|
||||||
trackModelDefinition.origin.x,
|
trackModelDefinition.origin.x,
|
||||||
@@ -152,8 +149,8 @@ export function SceneProps() {
|
|||||||
|
|
||||||
const desiredPitch = Math.asin(direction.y);
|
const desiredPitch = Math.asin(direction.y);
|
||||||
const desiredYaw = Math.atan2(-direction.x, -direction.z);
|
const desiredYaw = Math.atan2(-direction.x, -direction.z);
|
||||||
const deltaPitch = desiredPitch - lastPitch;
|
const deltaPitch = desiredPitch - modelTransformEvent.last!.pitch;
|
||||||
const deltaYaw = desiredYaw - lastYaw;
|
const deltaYaw = desiredYaw - modelTransformEvent.last!.yaw;
|
||||||
const deltaAngle = Math.sqrt(deltaPitch ** 2 + deltaYaw ** 2);
|
const deltaAngle = Math.sqrt(deltaPitch ** 2 + deltaYaw ** 2);
|
||||||
const maxPossibleRotationInTime = gunRotationSpeed * deltaT;
|
const maxPossibleRotationInTime = gunRotationSpeed * deltaT;
|
||||||
const clampedDeltaAngle = Math.min(maxPossibleRotationInTime, deltaAngle);
|
const clampedDeltaAngle = Math.min(maxPossibleRotationInTime, deltaAngle);
|
||||||
@@ -163,14 +160,14 @@ export function SceneProps() {
|
|||||||
deltaAngle === 0 ? 0 : deltaYaw * (clampedDeltaAngle / deltaAngle);
|
deltaAngle === 0 ? 0 : deltaYaw * (clampedDeltaAngle / deltaAngle);
|
||||||
|
|
||||||
const [pitch, yaw] = applyPitchYawLimits(
|
const [pitch, yaw] = applyPitchYawLimits(
|
||||||
lastPitch + clampedDeltaPitch,
|
modelTransformEvent.last!.pitch + clampedDeltaPitch,
|
||||||
lastYaw + clampedDeltaYaw,
|
modelTransformEvent.last!.yaw + clampedDeltaYaw,
|
||||||
gunModelDefinition.pitch,
|
gunModelDefinition.pitch,
|
||||||
turretModelDefinition.yaw,
|
turretModelDefinition.yaw,
|
||||||
);
|
);
|
||||||
|
|
||||||
const actualDeltaPitch = pitch - lastPitch;
|
const actualDeltaPitch = pitch - modelTransformEvent.last!.pitch;
|
||||||
const actualDeltaYaw = yaw - lastYaw;
|
const actualDeltaYaw = yaw - modelTransformEvent.last!.yaw;
|
||||||
const deltaRotation = Math.abs(actualDeltaPitch) + Math.abs(actualDeltaYaw);
|
const deltaRotation = Math.abs(actualDeltaPitch) + Math.abs(actualDeltaYaw);
|
||||||
const rotationSpeed = deltaRotation / deltaT;
|
const rotationSpeed = deltaRotation / deltaT;
|
||||||
const turretTraversePenalty =
|
const turretTraversePenalty =
|
||||||
@@ -190,8 +187,6 @@ export function SceneProps() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
modelTransformEvent.dispatch({ pitch, yaw });
|
modelTransformEvent.dispatch({ pitch, yaw });
|
||||||
lastPitch = pitch;
|
|
||||||
lastYaw = yaw;
|
|
||||||
|
|
||||||
const gunDirection = new Vector3(0, 0, -1)
|
const gunDirection = new Vector3(0, 0, -1)
|
||||||
.applyAxisAngle(I_HAT, pitch)
|
.applyAxisAngle(I_HAT, pitch)
|
||||||
|
|||||||
+7
-74
@@ -1,4 +1,3 @@
|
|||||||
import { normalizeAngleRad } from '@blitzkit/core';
|
|
||||||
import { invalidate, useThree, type ThreeEvent } from '@react-three/fiber';
|
import { invalidate, useThree, type ThreeEvent } from '@react-three/fiber';
|
||||||
import { useRef } from 'react';
|
import { useRef } from 'react';
|
||||||
import { Group, Mesh, MeshStandardMaterial, Vector2 } from 'three';
|
import { Group, Mesh, MeshStandardMaterial, Vector2 } from 'three';
|
||||||
@@ -29,8 +28,7 @@ export function TankModel() {
|
|||||||
const tankModelDefinition = useTankModelDefinition();
|
const tankModelDefinition = useTankModelDefinition();
|
||||||
const turretModelDefinition =
|
const turretModelDefinition =
|
||||||
tankModelDefinition.turrets[protagonist.turret.id];
|
tankModelDefinition.turrets[protagonist.turret.id];
|
||||||
const gunModelDefinition =
|
const gunModelDefinition = turretModelDefinition.guns[protagonist.gun.id];
|
||||||
turretModelDefinition.guns[protagonist.gun.gun_type!.value.base.id];
|
|
||||||
const { gltf } = useModel(protagonist.tank.id);
|
const { gltf } = useModel(protagonist.tank.id);
|
||||||
const nodes = Object.values(gltf.nodes);
|
const nodes = Object.values(gltf.nodes);
|
||||||
|
|
||||||
@@ -110,23 +108,6 @@ export function TankModel() {
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
// group(group) {
|
|
||||||
// return {
|
|
||||||
// visible:
|
|
||||||
// group.name !== 'ST_base' &&
|
|
||||||
// group.name !== 'MR_Base2' &&
|
|
||||||
// (!group.name.includes('state_entity') ||
|
|
||||||
// (isDynamicArmorActive &&
|
|
||||||
// group.name.includes('state_entity_01')) ||
|
|
||||||
// (!isDynamicArmorActive &&
|
|
||||||
// group.name.includes('state_entity_00'))) &&
|
|
||||||
// (!group.name.includes('shields') ||
|
|
||||||
// (isDynamicArmorActive &&
|
|
||||||
// group.name.includes('shields_rev')) ||
|
|
||||||
// (!isDynamicArmorActive && group.name.endsWith('shields'))),
|
|
||||||
// };
|
|
||||||
// },
|
|
||||||
});
|
});
|
||||||
})}
|
})}
|
||||||
|
|
||||||
@@ -142,17 +123,12 @@ export function TankModel() {
|
|||||||
|
|
||||||
if (!isVisible) return null;
|
if (!isVisible) return null;
|
||||||
|
|
||||||
let pitch = 0;
|
|
||||||
let yaw = 0;
|
|
||||||
|
|
||||||
function onPointerDown(event: ThreeEvent<PointerEvent>) {
|
function onPointerDown(event: ThreeEvent<PointerEvent>) {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
|
||||||
if (!isTurret) return;
|
if (!isTurret) return;
|
||||||
|
|
||||||
position.set(event.clientX, event.clientY);
|
position.set(event.clientX, event.clientY);
|
||||||
yaw = protagonist.yaw;
|
|
||||||
pitch = protagonist.pitch;
|
|
||||||
|
|
||||||
mutateTankopediaEphemeral((draft) => {
|
mutateTankopediaEphemeral((draft) => {
|
||||||
draft.controlsEnabled = false;
|
draft.controlsEnabled = false;
|
||||||
@@ -181,9 +157,10 @@ export function TankModel() {
|
|||||||
delta.set(event.clientX, event.clientY).sub(position);
|
delta.set(event.clientX, event.clientY).sub(position);
|
||||||
position.set(event.clientX, event.clientY);
|
position.set(event.clientX, event.clientY);
|
||||||
|
|
||||||
[pitch, yaw] = applyPitchYawLimits(
|
const [pitch, yaw] = applyPitchYawLimits(
|
||||||
pitch,
|
modelTransformEvent.last!.pitch,
|
||||||
yaw + delta.x * (Math.PI / boundingRect.width),
|
modelTransformEvent.last!.yaw +
|
||||||
|
delta.x * (Math.PI / boundingRect.width),
|
||||||
gunModelDefinition.pitch,
|
gunModelDefinition.pitch,
|
||||||
turretModelDefinition.yaw,
|
turretModelDefinition.yaw,
|
||||||
hasImprovedVerticalStabilizer,
|
hasImprovedVerticalStabilizer,
|
||||||
@@ -192,10 +169,6 @@ export function TankModel() {
|
|||||||
modelTransformEvent.dispatch({ pitch, yaw });
|
modelTransformEvent.dispatch({ pitch, yaw });
|
||||||
}
|
}
|
||||||
function handlePointerUp() {
|
function handlePointerUp() {
|
||||||
mutateDuel((draft) => {
|
|
||||||
draft.protagonist.pitch = normalizeAngleRad(pitch);
|
|
||||||
draft.protagonist.yaw = normalizeAngleRad(yaw);
|
|
||||||
});
|
|
||||||
mutateTankopediaEphemeral((draft) => {
|
mutateTankopediaEphemeral((draft) => {
|
||||||
draft.controlsEnabled = true;
|
draft.controlsEnabled = true;
|
||||||
});
|
});
|
||||||
@@ -214,24 +187,6 @@ export function TankModel() {
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
// group(group) {
|
|
||||||
// return {
|
|
||||||
// visible:
|
|
||||||
// group.name !== 'ST_base' &&
|
|
||||||
// group.name !== 'MR_Base2' &&
|
|
||||||
// (!group.name.includes('state_entity') ||
|
|
||||||
// (isDynamicArmorActive &&
|
|
||||||
// group.name.includes('state_entity_01')) ||
|
|
||||||
// (!isDynamicArmorActive &&
|
|
||||||
// group.name.includes('state_entity_00'))) &&
|
|
||||||
// (!group.name.includes('shields') ||
|
|
||||||
// (isDynamicArmorActive &&
|
|
||||||
// group.name.includes('shields_rev')) ||
|
|
||||||
// (!isDynamicArmorActive &&
|
|
||||||
// group.name.endsWith('shields'))),
|
|
||||||
// };
|
|
||||||
// },
|
|
||||||
});
|
});
|
||||||
})}
|
})}
|
||||||
|
|
||||||
@@ -266,8 +221,8 @@ export function TankModel() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
position.set(event.clientX, event.clientY);
|
position.set(event.clientX, event.clientY);
|
||||||
pitch = protagonist.pitch;
|
pitch = modelTransformEvent.last!.pitch;
|
||||||
yaw = protagonist.yaw;
|
yaw = modelTransformEvent.last!.yaw;
|
||||||
|
|
||||||
window.addEventListener('pointermove', handlePointerMove);
|
window.addEventListener('pointermove', handlePointerMove);
|
||||||
window.addEventListener('pointerup', handlePointerUp);
|
window.addEventListener('pointerup', handlePointerUp);
|
||||||
@@ -302,10 +257,6 @@ export function TankModel() {
|
|||||||
mutateTankopediaEphemeral((draft) => {
|
mutateTankopediaEphemeral((draft) => {
|
||||||
draft.controlsEnabled = true;
|
draft.controlsEnabled = true;
|
||||||
});
|
});
|
||||||
mutateDuel((draft) => {
|
|
||||||
draft.protagonist.pitch = normalizeAngleRad(pitch);
|
|
||||||
draft.protagonist.yaw = normalizeAngleRad(yaw);
|
|
||||||
});
|
|
||||||
window.removeEventListener('pointermove', handlePointerMove);
|
window.removeEventListener('pointermove', handlePointerMove);
|
||||||
window.removeEventListener('pointerup', handlePointerUp);
|
window.removeEventListener('pointerup', handlePointerUp);
|
||||||
}
|
}
|
||||||
@@ -321,24 +272,6 @@ export function TankModel() {
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
// group(group) {
|
|
||||||
// return {
|
|
||||||
// visible:
|
|
||||||
// group.name !== 'ST_base' &&
|
|
||||||
// group.name !== 'MR_Base2' &&
|
|
||||||
// (!group.name.includes('state_entity') ||
|
|
||||||
// (isDynamicArmorActive &&
|
|
||||||
// group.name.includes('state_entity_01')) ||
|
|
||||||
// (!isDynamicArmorActive &&
|
|
||||||
// group.name.includes('state_entity_00'))) &&
|
|
||||||
// (!group.name.includes('shields') ||
|
|
||||||
// (isDynamicArmorActive &&
|
|
||||||
// group.name.includes('shields_rev')) ||
|
|
||||||
// (!isDynamicArmorActive &&
|
|
||||||
// group.name.endsWith('shields'))),
|
|
||||||
// };
|
|
||||||
// },
|
|
||||||
});
|
});
|
||||||
})}
|
})}
|
||||||
</group>
|
</group>
|
||||||
|
|||||||
+1
-2
@@ -31,8 +31,7 @@ export function TransitionSkeleton() {
|
|||||||
const tankModelDefinition = useTankModelDefinition();
|
const tankModelDefinition = useTankModelDefinition();
|
||||||
const turretModelDefinition =
|
const turretModelDefinition =
|
||||||
tankModelDefinition.turrets[protagonist.turret.id];
|
tankModelDefinition.turrets[protagonist.turret.id];
|
||||||
const gunModelDefinition =
|
const gunModelDefinition = turretModelDefinition.guns[protagonist.gun.id];
|
||||||
turretModelDefinition.guns[protagonist.gun.gun_type!.value.base.id];
|
|
||||||
const { gltf } = useModel(protagonist.tank.id);
|
const { gltf } = useModel(protagonist.tank.id);
|
||||||
const nodes = Object.values(gltf.nodes);
|
const nodes = Object.values(gltf.nodes);
|
||||||
const revealed = tankopediaEphemeralStore((state) => state.revealed);
|
const revealed = tankopediaEphemeralStore((state) => state.revealed);
|
||||||
|
|||||||
+38
-48
@@ -28,6 +28,7 @@ import {
|
|||||||
import { SmartCanvas } from '../../../../SmartCanvas';
|
import { SmartCanvas } from '../../../../SmartCanvas';
|
||||||
import { AutoClear } from './components/AutoClear';
|
import { AutoClear } from './components/AutoClear';
|
||||||
import { Controls } from './components/Control';
|
import { Controls } from './components/Control';
|
||||||
|
import { InitialAligner } from './components/InitialAligner';
|
||||||
import { InitialFogReveal } from './components/InitialFogReveal';
|
import { InitialFogReveal } from './components/InitialFogReveal';
|
||||||
import { Lighting } from './components/Lighting';
|
import { Lighting } from './components/Lighting';
|
||||||
import { SceneProps } from './components/SceneProps';
|
import { SceneProps } from './components/SceneProps';
|
||||||
@@ -58,8 +59,7 @@ export const TankSandbox = forwardRef<HTMLCanvasElement, TankSandboxProps>(
|
|||||||
const tankModelDefinition = useTankModelDefinition();
|
const tankModelDefinition = useTankModelDefinition();
|
||||||
const turretModelDefinition =
|
const turretModelDefinition =
|
||||||
tankModelDefinition.turrets[protagonistTurret.id];
|
tankModelDefinition.turrets[protagonistTurret.id];
|
||||||
const gunModelDefinition =
|
const gunModelDefinition = turretModelDefinition.guns[protagonistGun.id];
|
||||||
turretModelDefinition.guns[protagonistGun.gun_type!.value.base.id];
|
|
||||||
const rawDisplay = TankopediaEphemeral.use((state) => state.display);
|
const rawDisplay = TankopediaEphemeral.use((state) => state.display);
|
||||||
const [display, setDisplay] = useState(rawDisplay);
|
const [display, setDisplay] = useState(rawDisplay);
|
||||||
const hideTankModelUnderArmor = TankopediaPersistent.use(
|
const hideTankModelUnderArmor = TankopediaPersistent.use(
|
||||||
@@ -114,56 +114,44 @@ export const TankSandbox = forwardRef<HTMLCanvasElement, TankSandboxProps>(
|
|||||||
function handlePoseEvent(pose: Pose) {
|
function handlePoseEvent(pose: Pose) {
|
||||||
switch (pose) {
|
switch (pose) {
|
||||||
case Pose.HullDown: {
|
case Pose.HullDown: {
|
||||||
mutateDuel((draft) => {
|
const [pitch, yaw] = applyPitchYawLimits(
|
||||||
const [pitch, yaw] = applyPitchYawLimits(
|
-Infinity,
|
||||||
-Infinity,
|
0,
|
||||||
0,
|
gunModelDefinition.pitch,
|
||||||
gunModelDefinition.pitch,
|
turretModelDefinition.yaw,
|
||||||
turretModelDefinition.yaw,
|
hasImprovedVerticalStabilizer,
|
||||||
hasImprovedVerticalStabilizer,
|
hasDownImprovedVerticalStabilizer,
|
||||||
hasDownImprovedVerticalStabilizer,
|
);
|
||||||
);
|
|
||||||
|
|
||||||
modelTransformEvent.dispatch({ pitch, yaw });
|
modelTransformEvent.dispatch({ pitch, yaw });
|
||||||
draft.protagonist.pitch = pitch;
|
|
||||||
draft.protagonist.yaw = yaw;
|
|
||||||
});
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case Pose.FaceHug: {
|
case Pose.FaceHug: {
|
||||||
mutateDuel((draft) => {
|
const [pitch, yaw] = applyPitchYawLimits(
|
||||||
const [pitch, yaw] = applyPitchYawLimits(
|
Infinity,
|
||||||
Infinity,
|
0,
|
||||||
0,
|
gunModelDefinition.pitch,
|
||||||
gunModelDefinition.pitch,
|
turretModelDefinition.yaw,
|
||||||
turretModelDefinition.yaw,
|
hasImprovedVerticalStabilizer,
|
||||||
hasImprovedVerticalStabilizer,
|
);
|
||||||
);
|
|
||||||
|
|
||||||
modelTransformEvent.dispatch({ pitch, yaw });
|
modelTransformEvent.dispatch({ pitch, yaw });
|
||||||
draft.protagonist.pitch = pitch;
|
|
||||||
draft.protagonist.yaw = yaw;
|
|
||||||
});
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case Pose.Default:
|
case Pose.Default:
|
||||||
mutateDuel((draft) => {
|
const [pitch, yaw] = applyPitchYawLimits(
|
||||||
const [pitch, yaw] = applyPitchYawLimits(
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
gunModelDefinition.pitch,
|
||||||
gunModelDefinition.pitch,
|
turretModelDefinition.yaw,
|
||||||
turretModelDefinition.yaw,
|
hasImprovedVerticalStabilizer,
|
||||||
hasImprovedVerticalStabilizer,
|
);
|
||||||
);
|
|
||||||
|
|
||||||
modelTransformEvent.dispatch({ pitch, yaw });
|
modelTransformEvent.dispatch({ pitch, yaw });
|
||||||
draft.protagonist.pitch = pitch;
|
|
||||||
draft.protagonist.yaw = yaw;
|
|
||||||
});
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -177,15 +165,15 @@ export const TankSandbox = forwardRef<HTMLCanvasElement, TankSandboxProps>(
|
|||||||
});
|
});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
mutateDuel((draft) => {
|
const [pitch, yaw] = applyPitchYawLimits(
|
||||||
[draft.protagonist.pitch, draft.protagonist.yaw] = applyPitchYawLimits(
|
modelTransformEvent.last!.pitch,
|
||||||
draft.protagonist.pitch,
|
modelTransformEvent.last!.yaw,
|
||||||
draft.protagonist.yaw,
|
gunModelDefinition.pitch,
|
||||||
gunModelDefinition.pitch,
|
turretModelDefinition.yaw,
|
||||||
turretModelDefinition.yaw,
|
hasImprovedVerticalStabilizer,
|
||||||
hasImprovedVerticalStabilizer,
|
);
|
||||||
);
|
|
||||||
});
|
modelTransformEvent.dispatch({ pitch, yaw });
|
||||||
}, [protagonistGun, protagonistTurret]);
|
}, [protagonistGun, protagonistTurret]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -246,6 +234,8 @@ export const TankSandbox = forwardRef<HTMLCanvasElement, TankSandboxProps>(
|
|||||||
)}
|
)}
|
||||||
<Lighting display={display} />
|
<Lighting display={display} />
|
||||||
</Suspense>
|
</Suspense>
|
||||||
|
|
||||||
|
<InitialAligner />
|
||||||
</SmartCanvas>
|
</SmartCanvas>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -29,8 +29,7 @@ export function HeroSection({ skeleton }: MaybeSkeletonComponentProps) {
|
|||||||
(filtered.reduce((accumulator, thisTank) => {
|
(filtered.reduce((accumulator, thisTank) => {
|
||||||
return (
|
return (
|
||||||
accumulator +
|
accumulator +
|
||||||
thisTank.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base.shells[0]
|
thisTank.turrets.at(-1)!.guns.at(-1)!.shells[0].penetration.near
|
||||||
.penetration.near
|
|
||||||
);
|
);
|
||||||
}, 0) /
|
}, 0) /
|
||||||
filtered.length) *
|
filtered.length) *
|
||||||
@@ -51,8 +50,7 @@ export function HeroSection({ skeleton }: MaybeSkeletonComponentProps) {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
function handleKeyDown(event: KeyboardEvent) {
|
function handleKeyDown(event: KeyboardEvent) {
|
||||||
const { shells } =
|
const { shells } = duelStore.getState().antagonist.gun;
|
||||||
duelStore.getState().antagonist.gun.gun_type!.value.base;
|
|
||||||
|
|
||||||
times(3, (index) => {
|
times(3, (index) => {
|
||||||
if (event.key === `${index + 1}` && shells.length > index) {
|
if (event.key === `${index + 1}` && shells.length > index) {
|
||||||
|
|||||||
@@ -38,14 +38,15 @@ export function applyPitchYawLimits(
|
|||||||
const range = degToRad(pitchLimits.back.range);
|
const range = degToRad(pitchLimits.back.range);
|
||||||
const yawRotatedAbs = Math.abs(normalizeAngleRad(newYaw - Math.PI));
|
const yawRotatedAbs = Math.abs(normalizeAngleRad(newYaw - Math.PI));
|
||||||
|
|
||||||
if (yawRotatedAbs <= range + transition) {
|
if (yawRotatedAbs <= range / 2 + transition) {
|
||||||
if (yawRotatedAbs <= range) {
|
if (yawRotatedAbs <= range / 2) {
|
||||||
// inside range
|
// inside range
|
||||||
lowerPitch = -degToRad(pitchLimits.back.max);
|
lowerPitch = -degToRad(pitchLimits.back.max);
|
||||||
upperPitch = -degToRad(pitchLimits.back.min);
|
upperPitch = -degToRad(pitchLimits.back.min);
|
||||||
} else {
|
} else {
|
||||||
// inside transition
|
// inside transition
|
||||||
const transitionProgress = (yawRotatedAbs - range) / transition;
|
const transitionProgress = (yawRotatedAbs - range / 2) / transition;
|
||||||
|
// console.log(transitionProgress);
|
||||||
const maxInterpolatedPitch =
|
const maxInterpolatedPitch =
|
||||||
(1 - transitionProgress) * pitchLimits.back.max +
|
(1 - transitionProgress) * pitchLimits.back.max +
|
||||||
transitionProgress * pitchLimits.max;
|
transitionProgress * pitchLimits.max;
|
||||||
@@ -63,14 +64,14 @@ export function applyPitchYawLimits(
|
|||||||
const range = degToRad(pitchLimits.front.range);
|
const range = degToRad(pitchLimits.front.range);
|
||||||
const yawAbs = Math.abs(normalizeAngleRad(newYaw));
|
const yawAbs = Math.abs(normalizeAngleRad(newYaw));
|
||||||
|
|
||||||
if (yawAbs <= range + transition) {
|
if (yawAbs <= range / 2 + transition) {
|
||||||
if (yawAbs <= range) {
|
if (yawAbs <= range / 2) {
|
||||||
// inside range
|
// inside range
|
||||||
lowerPitch = -degToRad(pitchLimits.front.max);
|
lowerPitch = -degToRad(pitchLimits.front.max);
|
||||||
upperPitch = -degToRad(pitchLimits.front.min);
|
upperPitch = -degToRad(pitchLimits.front.min);
|
||||||
} else {
|
} else {
|
||||||
// inside transition
|
// inside transition
|
||||||
const transitionProgress = (yawAbs - range) / transition;
|
const transitionProgress = (yawAbs - range / 2) / transition;
|
||||||
const maxInterpolatedPitch =
|
const maxInterpolatedPitch =
|
||||||
(1 - transitionProgress) * pitchLimits.front.max +
|
(1 - transitionProgress) * pitchLimits.front.max +
|
||||||
transitionProgress * pitchLimits.max;
|
transitionProgress * pitchLimits.max;
|
||||||
|
|||||||
@@ -31,9 +31,8 @@ export function filterTank(filters: TankFilters, tank: TankDefinition) {
|
|||||||
SHELLS.every(
|
SHELLS.every(
|
||||||
(index) =>
|
(index) =>
|
||||||
filters.shells[index] === null ||
|
filters.shells[index] === null ||
|
||||||
gun.gun_type!.value.base.shells[index] === undefined ||
|
gun.shells[index] === undefined ||
|
||||||
gun.gun_type!.value.base.shells[index].type ===
|
gun.shells[index].type === filters.shells[index],
|
||||||
filters.shells[index],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
import { Quicklime } from 'quicklime';
|
import { Quicklime } from 'quicklime';
|
||||||
|
|
||||||
export interface ModelTransformEventData {
|
export interface ModelTransformEventData {
|
||||||
yaw?: number;
|
yaw: number;
|
||||||
pitch: number;
|
pitch: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const modelTransformEvent = new Quicklime<ModelTransformEventData>();
|
export const modelTransformEvent = new Quicklime<ModelTransformEventData>({
|
||||||
|
pitch: 0,
|
||||||
|
yaw: 0,
|
||||||
|
});
|
||||||
@@ -2,18 +2,16 @@ import type { GunDefinition } from '@blitzkit/core';
|
|||||||
|
|
||||||
export function resolveReload(gun: GunDefinition) {
|
export function resolveReload(gun: GunDefinition) {
|
||||||
if (gun.gun_type!.$case === 'regular') {
|
if (gun.gun_type!.$case === 'regular') {
|
||||||
return gun.gun_type!.value.extension.reload;
|
return gun.gun_type!.value.reload;
|
||||||
} else if (gun.gun_type!.$case === 'auto_loader') {
|
} else if (gun.gun_type!.$case === 'auto_loader') {
|
||||||
return (
|
return (
|
||||||
gun.gun_type!.value.extension.clip_reload +
|
gun.gun_type!.value.clip_reload +
|
||||||
(gun.gun_type!.value.extension.shell_count - 1) *
|
(gun.gun_type!.value.shell_count - 1) * gun.gun_type!.value.intra_clip
|
||||||
gun.gun_type!.value.extension.intra_clip
|
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return (
|
return (
|
||||||
gun.gun_type!.value.extension.shell_reloads.reduce((a, b) => a + b, 0) +
|
gun.gun_type!.value.shell_reloads.reduce((a, b) => a + b, 0) +
|
||||||
(gun.gun_type!.value.extension.shell_count - 1) *
|
(gun.gun_type!.value.shell_count - 1) * gun.gun_type!.value.intra_clip
|
||||||
gun.gun_type!.value.extension.intra_clip
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -80,8 +80,7 @@ export function tankCharacteristics(
|
|||||||
) {
|
) {
|
||||||
const preset = equipmentDefinitions.presets[tank.equipment_preset];
|
const preset = equipmentDefinitions.presets[tank.equipment_preset];
|
||||||
const turretModelDefinition = tankModelDefinition.turrets[turret.id];
|
const turretModelDefinition = tankModelDefinition.turrets[turret.id];
|
||||||
const gunModelDefinition =
|
const gunModelDefinition = turretModelDefinition.guns[gun.id];
|
||||||
turretModelDefinition.guns[gun.gun_type!.value.base.id];
|
|
||||||
|
|
||||||
function equipment(id: number) {
|
function equipment(id: number) {
|
||||||
return preset.slots.some((slot, index) => {
|
return preset.slots.some((slot, index) => {
|
||||||
@@ -152,6 +151,8 @@ export function tankCharacteristics(
|
|||||||
commanderMastery *
|
commanderMastery *
|
||||||
(tank.crew.some(({ type }) => type === CrewType.DRIVER) ? 1.1 : 1.05);
|
(tank.crew.some(({ type }) => type === CrewType.DRIVER) ? 1.1 : 1.05);
|
||||||
const intraClipCoefficient = coefficient([hasShellReloadBoost, -0.3]);
|
const intraClipCoefficient = coefficient([hasShellReloadBoost, -0.3]);
|
||||||
|
const burstShells = gun.burst?.count ?? 1;
|
||||||
|
const burstInterShell = gun.burst?.interval;
|
||||||
const armorDamageCoefficient =
|
const armorDamageCoefficient =
|
||||||
coefficient([hasTungsten, 0.15]) *
|
coefficient([hasTungsten, 0.15]) *
|
||||||
coefficient(
|
coefficient(
|
||||||
@@ -160,14 +161,12 @@ export function tankCharacteristics(
|
|||||||
[applySpallLiner && shell.type === ShellType.HE, -0.2],
|
[applySpallLiner && shell.type === ShellType.HE, -0.2],
|
||||||
);
|
);
|
||||||
const assaultDamageCoefficient =
|
const assaultDamageCoefficient =
|
||||||
gun.gun_type!.value.base.assault_ranges &&
|
gun.assault_ranges && gun.assault_ranges.types.includes(shell.type)
|
||||||
gun.gun_type!.value.base.assault_ranges.types.includes(shell.type)
|
? (gun.assault_ranges.ranges.find(
|
||||||
? (gun.gun_type!.value.base.assault_ranges.ranges.find(
|
|
||||||
({ distance }) => distance >= assaultDistance,
|
({ distance }) => distance >= assaultDistance,
|
||||||
)?.factor ?? 0)
|
)?.factor ?? 0)
|
||||||
: 1;
|
: 1;
|
||||||
const moduleDamageCoefficient =
|
const moduleDamageCoefficient = coefficient([hasTungsten, 0.15]);
|
||||||
coefficient([hasTungsten, 0.15]) * assaultDamageCoefficient;
|
|
||||||
const reloadCoefficient =
|
const reloadCoefficient =
|
||||||
(coefficient([hasGunRammer, -0.05]) *
|
(coefficient([hasGunRammer, -0.05]) *
|
||||||
coefficient([true, degressiveStat(loaderMastery)])) /
|
coefficient([true, degressiveStat(loaderMastery)])) /
|
||||||
@@ -323,18 +322,14 @@ export function tankCharacteristics(
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
const weightKg =
|
const weightKg =
|
||||||
tank.weight +
|
tank.weight + engine.weight + track.weight + turret.weight + gun.weight;
|
||||||
engine.weight +
|
|
||||||
track.weight +
|
|
||||||
turret.weight +
|
|
||||||
gun.gun_type!.value.base.weight;
|
|
||||||
const weightTons = weightKg / 1000;
|
const weightTons = weightKg / 1000;
|
||||||
const stockWeight =
|
const stockWeight =
|
||||||
tank.weight +
|
tank.weight +
|
||||||
stockEngine.weight +
|
stockEngine.weight +
|
||||||
stockTrack.weight +
|
stockTrack.weight +
|
||||||
stockTurret.weight +
|
stockTurret.weight +
|
||||||
stockGun.gun_type!.value.base.weight;
|
stockGun.weight;
|
||||||
const resolvedEnginePower = engine.power * enginePowerCoefficient;
|
const resolvedEnginePower = engine.power * enginePowerCoefficient;
|
||||||
const damageCoefficientWithoutAssault = armorDamageCoefficient;
|
const damageCoefficientWithoutAssault = armorDamageCoefficient;
|
||||||
const damageCoefficient =
|
const damageCoefficient =
|
||||||
@@ -349,10 +344,10 @@ export function tankCharacteristics(
|
|||||||
const intraClip =
|
const intraClip =
|
||||||
gun.gun_type?.$case === 'regular'
|
gun.gun_type?.$case === 'regular'
|
||||||
? undefined
|
? undefined
|
||||||
: gun.gun_type!.value.extension.intra_clip * intraClipCoefficient;
|
: gun.gun_type!.value.intra_clip * intraClipCoefficient;
|
||||||
const mostOptimalShellIndex =
|
const mostOptimalShellIndex =
|
||||||
gun.gun_type!.$case === 'auto_reloader'
|
gun.gun_type!.$case === 'auto_reloader'
|
||||||
? gun.gun_type!.value.extension.shell_reloads.reduce<null | {
|
? gun.gun_type!.value.shell_reloads.reduce<null | {
|
||||||
index: number;
|
index: number;
|
||||||
reload: number;
|
reload: number;
|
||||||
}>((current, reloadRaw, index) => {
|
}>((current, reloadRaw, index) => {
|
||||||
@@ -370,43 +365,34 @@ export function tankCharacteristics(
|
|||||||
const damage = shell.armor_damage * damageCoefficient;
|
const damage = shell.armor_damage * damageCoefficient;
|
||||||
const dpmEffective =
|
const dpmEffective =
|
||||||
gun.gun_type!.$case === 'auto_reloader'
|
gun.gun_type!.$case === 'auto_reloader'
|
||||||
? gun.gun_type!.value.extension.shell_reloads[0] >
|
? gun.gun_type!.value.shell_reloads[0] >
|
||||||
gun.gun_type!.value.extension.shell_reloads[1] +
|
gun.gun_type!.value.shell_reloads[1] + gun.gun_type!.value.intra_clip
|
||||||
gun.gun_type!.value.extension.intra_clip
|
|
||||||
? ((armorDamageCoefficient * shell.armor_damage) /
|
? ((armorDamageCoefficient * shell.armor_damage) /
|
||||||
(gun.gun_type!.value.extension.shell_reloads.at(-1)! *
|
(gun.gun_type!.value.shell_reloads.at(-1)! * reloadCoefficient +
|
||||||
reloadCoefficient +
|
gun.gun_type!.value.intra_clip * intraClipCoefficient)) *
|
||||||
gun.gun_type!.value.extension.intra_clip *
|
|
||||||
intraClipCoefficient)) *
|
|
||||||
(60 -
|
(60 -
|
||||||
(gun.gun_type!.value.extension.shell_reloads.slice(0, -1).length -
|
(gun.gun_type!.value.shell_reloads.slice(0, -1).length - 1) *
|
||||||
1) *
|
gun.gun_type!.value.intra_clip *
|
||||||
gun.gun_type!.value.extension.intra_clip *
|
|
||||||
intraClipCoefficient) +
|
intraClipCoefficient) +
|
||||||
armorDamageCoefficient *
|
armorDamageCoefficient *
|
||||||
shell.armor_damage *
|
shell.armor_damage *
|
||||||
gun.gun_type!.value.extension.shell_reloads.slice(0, -1).length
|
gun.gun_type!.value.shell_reloads.slice(0, -1).length
|
||||||
: ((armorDamageCoefficient * shell.armor_damage) /
|
: ((armorDamageCoefficient * shell.armor_damage) /
|
||||||
(gun.gun_type!.value.extension.shell_reloads[0] *
|
(gun.gun_type!.value.shell_reloads[0] * reloadCoefficient +
|
||||||
reloadCoefficient +
|
gun.gun_type!.value.intra_clip * intraClipCoefficient)) *
|
||||||
gun.gun_type!.value.extension.intra_clip *
|
|
||||||
intraClipCoefficient)) *
|
|
||||||
(60 -
|
(60 -
|
||||||
(gun.gun_type!.value.extension.shell_reloads.slice(1).length -
|
(gun.gun_type!.value.shell_reloads.slice(1).length - 1) *
|
||||||
1) *
|
gun.gun_type!.value.intra_clip *
|
||||||
gun.gun_type!.value.extension.intra_clip *
|
|
||||||
intraClipCoefficient) +
|
intraClipCoefficient) +
|
||||||
armorDamageCoefficient *
|
armorDamageCoefficient *
|
||||||
shell.armor_damage *
|
shell.armor_damage *
|
||||||
gun.gun_type!.value.extension.shell_reloads.slice(1).length
|
gun.gun_type!.value.shell_reloads.slice(1).length
|
||||||
: undefined;
|
: undefined;
|
||||||
const shells =
|
const shells =
|
||||||
gun.gun_type!.$case === 'regular'
|
gun.gun_type!.$case === 'regular' ? 1 : gun.gun_type!.value.shell_count;
|
||||||
? 1
|
|
||||||
: gun.gun_type!.value.extension.shell_count;
|
|
||||||
const shellReloads =
|
const shellReloads =
|
||||||
gun.gun_type!.$case === 'auto_reloader'
|
gun.gun_type!.$case === 'auto_reloader'
|
||||||
? gun.gun_type!.value.extension.shell_reloads.map(
|
? gun.gun_type!.value.shell_reloads.map(
|
||||||
(reload) => reload * reloadCoefficient,
|
(reload) => reload * reloadCoefficient,
|
||||||
)
|
)
|
||||||
: undefined;
|
: undefined;
|
||||||
@@ -414,30 +400,28 @@ export function tankCharacteristics(
|
|||||||
gun.gun_type!.$case === 'auto_reloader'
|
gun.gun_type!.$case === 'auto_reloader'
|
||||||
? undefined
|
? undefined
|
||||||
: (gun.gun_type!.$case === 'regular'
|
: (gun.gun_type!.$case === 'regular'
|
||||||
? gun.gun_type!.value.extension.reload
|
? gun.gun_type!.value.reload
|
||||||
: gun.gun_type!.value.extension.clip_reload) * reloadCoefficient;
|
: gun.gun_type!.value.clip_reload) * reloadCoefficient;
|
||||||
const caliber = shell.caliber;
|
const caliber = shell.caliber;
|
||||||
const penetration = shell.penetration.near * penetrationCoefficient;
|
const penetration = shell.penetration.near * penetrationCoefficient;
|
||||||
const clipDamage =
|
const clipDamage =
|
||||||
gun.gun_type!.$case === 'regular'
|
gun.gun_type!.$case === 'regular'
|
||||||
? undefined
|
? undefined
|
||||||
: gun.gun_type!.value.extension.shell_count * damage;
|
: gun.gun_type!.value.shell_count * damage;
|
||||||
const moduleDamage = shell.module_damage * moduleDamageCoefficient;
|
const moduleDamage = shell.module_damage * moduleDamageCoefficient;
|
||||||
const explosionRadius = shell.explosion_radius;
|
const explosionRadius = shell.explosion_radius;
|
||||||
const shellVelocity = shell.velocity * shellVelocityCoefficient;
|
const shellVelocity = shell.velocity * shellVelocityCoefficient;
|
||||||
const aimTime = gun.gun_type!.value.base.aim_time * aimTimeCoefficient;
|
const aimTime = gun.aim_time * aimTimeCoefficient;
|
||||||
const dispersion =
|
const dispersion = gun.dispersion_base * dispersionStillCoefficient;
|
||||||
gun.gun_type!.value.base.dispersion_base * dispersionStillCoefficient;
|
|
||||||
const dispersionMoving = track.dispersion_move * dispersionMovingCoefficient;
|
const dispersionMoving = track.dispersion_move * dispersionMovingCoefficient;
|
||||||
const dispersionHullTraversing =
|
const dispersionHullTraversing =
|
||||||
track.dispersion_traverse * dispersionHullTraverseCoefficient;
|
track.dispersion_traverse * dispersionHullTraverseCoefficient;
|
||||||
const dispersionTurretTraversing =
|
const dispersionTurretTraversing =
|
||||||
gun.gun_type!.value.base.dispersion_traverse *
|
gun.dispersion_traverse * dispersionTurretTraverseCoefficient;
|
||||||
dispersionTurretTraverseCoefficient;
|
|
||||||
const dispersionShooting =
|
const dispersionShooting =
|
||||||
gun.gun_type!.value.base.dispersion_shot * dispersionAfterShotCoefficient;
|
gun.dispersion_shot * dispersionAfterShotCoefficient;
|
||||||
const dispersionGunDamaged =
|
const dispersionGunDamaged =
|
||||||
gun.gun_type!.value.base.dispersion_damaged * dispersionDamagedCoefficient;
|
gun.dispersion_damaged * dispersionDamagedCoefficient;
|
||||||
const gunDepression =
|
const gunDepression =
|
||||||
gunModelDefinition.pitch.max +
|
gunModelDefinition.pitch.max +
|
||||||
gunDefaultPitch +
|
gunDefaultPitch +
|
||||||
@@ -479,8 +463,7 @@ export function tankCharacteristics(
|
|||||||
resolvedEnginePower / weightTons / softTerrainCoefficientRaw;
|
resolvedEnginePower / weightTons / softTerrainCoefficientRaw;
|
||||||
const weight = weightTons;
|
const weight = weightTons;
|
||||||
const turretTraverseSpeed = turret.traverse_speed * turretTraverseCoefficient;
|
const turretTraverseSpeed = turret.traverse_speed * turretTraverseCoefficient;
|
||||||
const gunTraverseSpeed =
|
const gunTraverseSpeed = gun.rotation_speed * turretTraverseCoefficient;
|
||||||
gun.gun_type!.value.base.rotation_speed * turretTraverseCoefficient;
|
|
||||||
/**
|
/**
|
||||||
* resistance_hard is used in all cases as this is the coefficient between
|
* resistance_hard is used in all cases as this is the coefficient between
|
||||||
* the absolute best coefficient and the current
|
* the absolute best coefficient and the current
|
||||||
@@ -512,14 +495,12 @@ export function tankCharacteristics(
|
|||||||
? tank.camouflage_still * camouflageCoefficientStill
|
? tank.camouflage_still * camouflageCoefficientStill
|
||||||
: tank.camouflage_moving * camouflageCoefficientMoving;
|
: tank.camouflage_moving * camouflageCoefficientMoving;
|
||||||
const camouflageShootingStill =
|
const camouflageShootingStill =
|
||||||
tank.camouflage_still *
|
tank.camouflage_still * gun.camouflage_loss * camouflageCoefficientStill;
|
||||||
gun.gun_type!.value.base.camouflage_loss *
|
|
||||||
camouflageCoefficientStill;
|
|
||||||
const camouflageShootingMoving =
|
const camouflageShootingMoving =
|
||||||
(tank.class === TankClass.LIGHT
|
(tank.class === TankClass.LIGHT
|
||||||
? tank.camouflage_still * camouflageCoefficientStill
|
? tank.camouflage_still * camouflageCoefficientStill
|
||||||
: tank.camouflage_moving * camouflageCoefficientMoving) *
|
: tank.camouflage_moving * camouflageCoefficientMoving) *
|
||||||
gun.gun_type!.value.base.camouflage_loss;
|
gun.camouflage_loss;
|
||||||
const camouflageCaughtOnFire =
|
const camouflageCaughtOnFire =
|
||||||
tank.camouflage_onFire * tank.camouflage_still * camouflageCoefficientStill;
|
tank.camouflage_onFire * tank.camouflage_still * camouflageCoefficientStill;
|
||||||
const width = size.z;
|
const width = size.z;
|
||||||
@@ -530,7 +511,7 @@ export function tankCharacteristics(
|
|||||||
const shellRicochet = isExplosive(shell.type) ? undefined : shell.ricochet;
|
const shellRicochet = isExplosive(shell.type) ? undefined : shell.ricochet;
|
||||||
const crewCount = tank.crew.length;
|
const crewCount = tank.crew.length;
|
||||||
const shellRange = shell.range;
|
const shellRange = shell.range;
|
||||||
const shellCapacity = gun.gun_type!.value.base.shell_capacity;
|
const shellCapacity = gun.shell_capacity;
|
||||||
const gunType = gun.gun_type!.$case;
|
const gunType = gun.gun_type!.$case;
|
||||||
const penetrationAt250m = shell.penetration.far;
|
const penetrationAt250m = shell.penetration.far;
|
||||||
|
|
||||||
@@ -602,6 +583,8 @@ export function tankCharacteristics(
|
|||||||
shellCapacity,
|
shellCapacity,
|
||||||
gunType,
|
gunType,
|
||||||
penetrationAt250m,
|
penetrationAt250m,
|
||||||
|
burstShells,
|
||||||
|
burstInterShell,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,10 +4,8 @@ import {
|
|||||||
type ProvisionDefinitions,
|
type ProvisionDefinitions,
|
||||||
type TankDefinition,
|
type TankDefinition,
|
||||||
} from '@blitzkit/core';
|
} from '@blitzkit/core';
|
||||||
import { degToRad } from 'three/src/math/MathUtils.js';
|
|
||||||
import type { DuelMember } from '../../stores/duel';
|
import type { DuelMember } from '../../stores/duel';
|
||||||
import { genericDefaultEquipmentMatrix } from '../../stores/duel/constants';
|
import { genericDefaultEquipmentMatrix } from '../../stores/duel/constants';
|
||||||
import { applyPitchYawLimits } from '../blitz/applyPitchYawLimits';
|
|
||||||
|
|
||||||
export function tankToDuelMember(
|
export function tankToDuelMember(
|
||||||
tank: TankDefinition,
|
tank: TankDefinition,
|
||||||
@@ -15,16 +13,7 @@ export function tankToDuelMember(
|
|||||||
provisionDefinitions: ProvisionDefinitions,
|
provisionDefinitions: ProvisionDefinitions,
|
||||||
) {
|
) {
|
||||||
const turret = tank.turrets.at(-1)!;
|
const turret = tank.turrets.at(-1)!;
|
||||||
const turretModel = model.turrets[turret.id];
|
|
||||||
const gun = turret.guns.at(-1)!;
|
const gun = turret.guns.at(-1)!;
|
||||||
const gunModel = turretModel.guns[gun.gun_type!.value.base.id];
|
|
||||||
|
|
||||||
const [pitch, yaw] = applyPitchYawLimits(
|
|
||||||
degToRad(8),
|
|
||||||
degToRad(25),
|
|
||||||
gunModel.pitch,
|
|
||||||
turretModel.yaw,
|
|
||||||
);
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
camouflage: true,
|
camouflage: true,
|
||||||
@@ -34,13 +23,10 @@ export function tankToDuelMember(
|
|||||||
provisions: createDefaultProvisions(tank, gun, provisionDefinitions),
|
provisions: createDefaultProvisions(tank, gun, provisionDefinitions),
|
||||||
engine: tank.engines.at(-1)!,
|
engine: tank.engines.at(-1)!,
|
||||||
gun,
|
gun,
|
||||||
shell: tank.turrets.at(-1)!.guns.at(-1)!.gun_type!.value.base.shells[0],
|
shell: tank.turrets.at(-1)!.guns.at(-1)!.shells[0],
|
||||||
tank,
|
tank,
|
||||||
track: tank.tracks.at(-1)!,
|
track: tank.tracks.at(-1)!,
|
||||||
yaw,
|
|
||||||
pitch,
|
|
||||||
turret,
|
turret,
|
||||||
assaultDistance:
|
assaultDistance: (gun.assault_ranges?.ranges[0].distance ?? 0) / 2,
|
||||||
(gun.gun_type!.value.base.assault_ranges?.ranges[0].distance ?? 0) / 2,
|
|
||||||
} satisfies DuelMember;
|
} satisfies DuelMember;
|
||||||
}
|
}
|
||||||
@@ -6,6 +6,7 @@ import {
|
|||||||
TurretDefinition,
|
TurretDefinition,
|
||||||
} from '@blitzkit/core';
|
} from '@blitzkit/core';
|
||||||
import { invalidate } from '@react-three/fiber';
|
import { invalidate } from '@react-three/fiber';
|
||||||
|
import type { QuicklimeEvent } from 'quicklime';
|
||||||
import { type RefObject, useEffect } from 'react';
|
import { type RefObject, useEffect } from 'react';
|
||||||
import { Euler, Group, Vector3 } from 'three';
|
import { Euler, Group, Vector3 } from 'three';
|
||||||
import { degToRad } from 'three/src/math/MathUtils.js';
|
import { degToRad } from 'three/src/math/MathUtils.js';
|
||||||
@@ -37,10 +38,15 @@ export function useTankTransform(
|
|||||||
const gunPosition = new Vector3();
|
const gunPosition = new Vector3();
|
||||||
const gunRotation = new Euler();
|
const gunRotation = new Euler();
|
||||||
|
|
||||||
function handleModelTransform(modelTransform?: ModelTransformEventData) {
|
function handleModelTransform(
|
||||||
const duel = duelStore.getState();
|
event: QuicklimeEvent<ModelTransformEventData>,
|
||||||
const yaw = modelTransform?.yaw ?? duel.protagonist.yaw;
|
) {
|
||||||
const pitch = modelTransform?.pitch ?? duel.protagonist.pitch;
|
handleModelTransformInner(event.data);
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleModelTransformInner(data?: ModelTransformEventData) {
|
||||||
|
const yaw = data?.yaw ?? modelTransformEvent.last!.yaw;
|
||||||
|
const pitch = data?.pitch ?? modelTransformEvent.last!.pitch;
|
||||||
|
|
||||||
gunPosition
|
gunPosition
|
||||||
.set(0, 0, 0)
|
.set(0, 0, 0)
|
||||||
@@ -91,24 +97,12 @@ export function useTankTransform(
|
|||||||
invalidate();
|
invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
handleModelTransform();
|
handleModelTransformInner();
|
||||||
|
|
||||||
modelTransformEvent.on(handleModelTransform);
|
modelTransformEvent.on(handleModelTransform);
|
||||||
|
|
||||||
const unsubscribes = [
|
|
||||||
duelStore.subscribe(
|
|
||||||
(state) => state.protagonist.pitch,
|
|
||||||
() => handleModelTransform(),
|
|
||||||
),
|
|
||||||
duelStore.subscribe(
|
|
||||||
(state) => state.protagonist.yaw,
|
|
||||||
() => handleModelTransform(),
|
|
||||||
),
|
|
||||||
() => modelTransformEvent.off(handleModelTransform),
|
|
||||||
];
|
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
unsubscribes.forEach((unsubscribe) => unsubscribe());
|
modelTransformEvent.off(handleModelTransform);
|
||||||
};
|
};
|
||||||
}, [track, turret]);
|
}, [track, turret]);
|
||||||
}
|
}
|
||||||
@@ -8,6 +8,7 @@ import Navbar from '../components/Navbar.astro';
|
|||||||
import Party3 from '../components/Party3.astro';
|
import Party3 from '../components/Party3.astro';
|
||||||
import './base.css';
|
import './base.css';
|
||||||
import { DEFAULT_LOCALE } from '@blitzkit/i18n';
|
import { DEFAULT_LOCALE } from '@blitzkit/i18n';
|
||||||
|
import Servicing from '../components/Servicing.astro';
|
||||||
|
|
||||||
export interface Props {
|
export interface Props {
|
||||||
noFooter?: boolean;
|
noFooter?: boolean;
|
||||||
@@ -15,6 +16,7 @@ export interface Props {
|
|||||||
integrated?: boolean;
|
integrated?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const servicing = import.meta.env.SERVICING;
|
||||||
const { noFooter, noNavbar, integrated } = Astro.props;
|
const { noFooter, noNavbar, integrated } = Astro.props;
|
||||||
const locale = Astro.params.locale ?? DEFAULT_LOCALE;
|
const locale = Astro.params.locale ?? DEFAULT_LOCALE;
|
||||||
---
|
---
|
||||||
@@ -65,7 +67,7 @@ const locale = Astro.params.locale ?? DEFAULT_LOCALE;
|
|||||||
|
|
||||||
<Checks {locale} client:only="react" />
|
<Checks {locale} client:only="react" />
|
||||||
|
|
||||||
<slot />
|
{servicing ? <Servicing /> : <slot />}
|
||||||
|
|
||||||
{!noFooter && <Footer />}
|
{!noFooter && <Footer />}
|
||||||
</Flex>
|
</Flex>
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ const url = import.meta.env.SITE + Astro.url.pathname;
|
|||||||
const icon = asset(`icons/tanks/big/${id}.webp`);
|
const icon = asset(`icons/tanks/big/${id}.webp`);
|
||||||
const turret = tank.turrets.at(-1)!;
|
const turret = tank.turrets.at(-1)!;
|
||||||
const gun = turret.guns.at(-1)!;
|
const gun = turret.guns.at(-1)!;
|
||||||
const shell = gun.gun_type!.value.base.shells[0];
|
const shell = gun.shells[0];
|
||||||
const characteristics = tankCharacteristics(
|
const characteristics = tankCharacteristics(
|
||||||
{
|
{
|
||||||
tank,
|
tank,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import type { APIContext } from 'astro';
|
import type { APIContext } from 'astro';
|
||||||
|
|
||||||
const ALLOW_ROBOTS = import.meta.env.ALLOW_ROBOTS === 'true';
|
const ALLOW_ROBOTS = import.meta.env.ALLOW_ROBOTS;
|
||||||
|
|
||||||
export async function GET({ request }: APIContext) {
|
export async function GET({ request }: APIContext) {
|
||||||
const flags: Record<string, string | null> = {
|
const flags: Record<string, string | null> = {
|
||||||
|
|||||||
@@ -33,8 +33,6 @@ export interface DuelMember {
|
|||||||
shell: ShellDefinition;
|
shell: ShellDefinition;
|
||||||
track: TrackDefinition;
|
track: TrackDefinition;
|
||||||
equipmentMatrix: EquipmentMatrix;
|
equipmentMatrix: EquipmentMatrix;
|
||||||
pitch: number;
|
|
||||||
yaw: number;
|
|
||||||
consumables: number[];
|
consumables: number[];
|
||||||
provisions: number[];
|
provisions: number[];
|
||||||
camouflage: boolean;
|
camouflage: boolean;
|
||||||
|
|||||||
Submodule submodules/blitzkit-closed updated: 89dc337d27...4fc49ba2c5.
Reference in new issue
Block a user