feat: ea and cs

This commit is contained in:
TrèsAbhi committed 2024-01-21 22:11:01 -06:00
1 parent a0c9895122
commit 9488602f5b
17 files changed
+134 -43

No files matched your search

@@ -16,6 +16,7 @@ import { Loader } from '../../../../components/Loader';
import { Duel } from '../../page';
import { Controls } from '../Control';
import { Lighting } from '../Lighting';
import { QuickEquipments } from '../QuickEquipments';
import { RotationInputs } from '../RotationInputs';
import { SceneProps } from '../SceneProps';
import { Options } from './components/Options';
@@ -69,8 +70,8 @@ export function TankSandbox({ duel }: TankSandboxProps) {
);
modelTransformEvent.emit({ pitch, yaw });
draft.model.physical.pitch = pitch;
draft.model.physical.yaw = yaw;
draft.model.pose.pitch = pitch;
draft.model.pose.yaw = yaw;
});
break;
@@ -86,8 +87,8 @@ export function TankSandbox({ duel }: TankSandboxProps) {
);
modelTransformEvent.emit({ pitch, yaw });
draft.model.physical.pitch = pitch;
draft.model.physical.yaw = yaw;
draft.model.pose.pitch = pitch;
draft.model.pose.yaw = yaw;
});
break;
@@ -111,13 +112,12 @@ export function TankSandbox({ duel }: TankSandboxProps) {
if (!duel.protagonist) return void 0;
mutateTankopediaTemporary((draft) => {
[draft.model.physical.pitch, draft.model.physical.yaw] =
applyPitchYawLimits(
draft.model.physical.pitch,
draft.model.physical.yaw,
gunModelDefinition.pitch,
turretModelDefinition.yaw,
);
[draft.model.pose.pitch, draft.model.pose.yaw] = applyPitchYawLimits(
draft.model.pose.pitch,
draft.model.pose.yaw,
gunModelDefinition.pitch,
turretModelDefinition.yaw,
);
});
}, [duel.protagonist.gun, duel.protagonist.turret]);
@@ -183,6 +183,7 @@ export function TankSandbox({ duel }: TankSandboxProps) {
<Options canvas={canvasWrapper} isFullScreen={isFullScreen} />
<RotationInputs duel={duel} />
<QuickEquipments />
</Flex>
</Theme>
</Card>
@@ -86,7 +86,7 @@ export function ArmorHighlighting({ duel }: ArmorHighlightingProps) {
turretContainer.current?.rotation.copy(turretRotation);
}
handleModelTransform(useTankopediaTemporary.getState().model.physical);
handleModelTransform(useTankopediaTemporary.getState().model.pose);
modelTransformEvent.on(handleModelTransform);
return () => {
@@ -94,7 +94,7 @@ export const ExternalModuleMask = memo<ExternalModuleMaskProps>(({ duel }) => {
turretContainer.current?.rotation.copy(turretRotation);
}
handleModelTransform(useTankopediaTemporary.getState().model.physical);
handleModelTransform(useTankopediaTemporary.getState().model.pose);
modelTransformEvent.on(handleModelTransform);
return () => {
@@ -100,7 +100,7 @@ export const SpacedArmorDepth = memo<SpacedArmorDepthProps>(({ duel }) => {
turretContainer.current?.rotation.copy(turretRotation);
}
handleModelTransform(useTankopediaTemporary.getState().model.physical);
handleModelTransform(useTankopediaTemporary.getState().model.pose);
modelTransformEvent.on(handleModelTransform);
return () => {
@@ -38,7 +38,7 @@ export const TankModel = memo(({ duel: { protagonist } }: TankModelProps) => {
>(undefined);
const canvas = useThree((state) => state.gl.domElement);
const physical = useTankopediaTemporary((state) => state.model.physical);
const physical = useTankopediaTemporary((state) => state.model.pose);
const hullContainer = useRef<Group>(null);
const turretContainer = useRef<Group>(null);
const gunContainer = useRef<Group>(null);
@@ -220,8 +220,8 @@ export const TankModel = memo(({ duel: { protagonist } }: TankModelProps) => {
function handlePointerUp() {
mutateTankopediaTemporary((state) => {
state.model.visual.controlsEnabled = true;
state.model.physical.pitch = normalizeAnglePI(pitch);
state.model.physical.yaw = normalizeAnglePI(yaw);
state.model.pose.pitch = normalizeAnglePI(pitch);
state.model.pose.yaw = normalizeAnglePI(yaw);
});
window.removeEventListener('pointermove', handlePointerMove);
window.removeEventListener('pointerup', handlePointerUp);
@@ -283,8 +283,8 @@ export const TankModel = memo(({ duel: { protagonist } }: TankModelProps) => {
function handlePointerUp() {
mutateTankopediaTemporary((state) => {
state.model.visual.controlsEnabled = true;
state.model.physical.pitch = normalizeAnglePI(pitch);
state.model.physical.yaw = normalizeAnglePI(yaw);
state.model.pose.pitch = normalizeAnglePI(pitch);
state.model.pose.yaw = normalizeAnglePI(yaw);
});
window.removeEventListener('pointermove', handlePointerMove);
window.removeEventListener('pointerup', handlePointerUp);