mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-12-05 15:52:55 +01:00
fix: remove shot when swithcing shells
This commit is contained in:
1 parent
01e7353ef4
commit
1b9cf8b604
3 files changed
+17
-2
No files matched your search
@@ -56,17 +56,26 @@ export default function Page({ params }: { params: { id: string } }) {
|
||||
function handleKeyDown(event: KeyboardEvent) {
|
||||
if (document.activeElement instanceof HTMLInputElement) return;
|
||||
|
||||
function wipeShot() {
|
||||
mutateTankopediaTemporary((draft) => {
|
||||
draft.shot = undefined;
|
||||
});
|
||||
}
|
||||
|
||||
if (event.key === '1') {
|
||||
wipeShot();
|
||||
mutateDuel((draft) => {
|
||||
draft.antagonist!.shell = draft.antagonist!.gun.shells[0];
|
||||
});
|
||||
} else if (event.key === '2') {
|
||||
wipeShot();
|
||||
mutateDuel((draft) => {
|
||||
if (draft.antagonist!.gun.shells[1]) {
|
||||
draft.antagonist!.shell = draft.antagonist!.gun.shells[1];
|
||||
}
|
||||
});
|
||||
} else if (event.key === '3') {
|
||||
wipeShot();
|
||||
mutateDuel((draft) => {
|
||||
if (draft.antagonist!.gun.shells[2]) {
|
||||
draft.antagonist!.shell = draft.antagonist!.gun.shells[2];
|
||||
|
||||
Reference in new issue
Block a user