mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-12-01 22:02:45 +01:00
feat: simplified duel state
This commit is contained in:
1 parent
7314f1d9b1
commit
66016dedf0
13 files changed
+276
-246
No files matched your search
@@ -6,16 +6,17 @@ import { modelTransformEvent } from '../../../../../core/blitzkrieg/modelTransfo
|
||||
import mutateTankopedia, {
|
||||
useTankopedia,
|
||||
} from '../../../../../stores/tankopedia';
|
||||
import { Duel } from '../page';
|
||||
|
||||
export function RotationInputs() {
|
||||
interface RotationInputsProps {
|
||||
duel: Duel;
|
||||
}
|
||||
|
||||
export function RotationInputs({ duel: { protagonist } }: RotationInputsProps) {
|
||||
const physical = useTankopedia((state) => state.model.physical);
|
||||
const awaitedModelDefinitions = use(modelDefinitions);
|
||||
const turretYawInput = useRef<HTMLInputElement>(null);
|
||||
const gunPitchInput = useRef<HTMLInputElement>(null);
|
||||
const protagonist = useTankopedia((state) => {
|
||||
if (!state.areTanksAssigned) return;
|
||||
return state.protagonist;
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
turretYawInput.current!.value = `${-Math.round(
|
||||
@@ -28,8 +29,6 @@ export function RotationInputs() {
|
||||
)}`;
|
||||
}, [physical.pitch]);
|
||||
|
||||
if (!protagonist) return null;
|
||||
|
||||
const tankModelDefinition = awaitedModelDefinitions[protagonist.tank.id];
|
||||
const turretModelDefinition =
|
||||
tankModelDefinition.turrets[protagonist.turret.id];
|
||||
|
||||
Reference in new issue
Block a user