Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions packages/frontend/src/game/HUD/components/crosshairs/Line.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,42 @@ const crossHairDimensions = (playerState: PlayerState): LineOptions => {
length: 10,
spacing: { max: 120, min: 40 },
};
// TODO: Set up correct sizes for different weapon classes https://app.clickup.com/t/86b5vm3cc
case "Submachine Gun":
return {
length: 10,
spacing: { max: 120, min: 40 },
};
case "Shotgun":
return {
length: 10,
spacing: { max: 120, min: 40 },
};
case "Sniper Rifle":
return {
length: 10,
spacing: { max: 120, min: 40 },
};
case "Pistol":
return {
length: 10,
spacing: { max: 120, min: 40 },
};
case "Melee":
return {
length: 10,
spacing: { max: 120, min: 40 },
};
case "Rocket Launcher":
return {
length: 10,
spacing: { max: 120, min: 40 },
};
case "Special":
return {
length: 10,
spacing: { max: 120, min: 40 },
};
default:
return assertNever(weaponClass);
}
Expand Down
33 changes: 31 additions & 2 deletions packages/frontend/src/game/weapons/functions/renderWeapon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,15 @@ import { useIsAlive } from "../../player/hooks/useIsAlive";
import type { GamePlayerState } from "../../utils/geckos/geckos";

// Import Weapons Below:
import { AK47 } from "../primary/AK47/AK47";
import { Saiga } from "../primary/Saiga/Saiga";
import { AK47 } from "../weapons/primary/AK47/AK47";
import { AWP } from "../weapons/primary/AWP/AWP";
import { FiveSeven } from "../weapons/secondary/FiveSeven/FiveSeven";
import { Knife } from "../weapons/melee/Knife";
import { M203 } from "../weapons/secondary/M203/M203";
import { Nova } from "../weapons/primary/Nova/Nova";
import { RPG } from "../weapons/secondary/RPG/RPG";
import { Saiga } from "../weapons/primary/Saiga/Saiga";
import { Scorpion } from "../weapons/primary/Scorpion/Scorpion";

interface RenderWeaponProps {
playerStateRef: React.MutableRefObject<GamePlayerState>;
Expand All @@ -17,10 +24,32 @@ export const RenderWeapon: React.FC<RenderWeaponProps> = ({ playerStateRef }) =>
if (!isAlive) return null;

switch (player.currentWeapon) {
// Assault Rifles
case "AK47":
return <AK47 playerStateRef={playerStateRef} />;
case "Saiga":
return <Saiga playerStateRef={playerStateRef} />;
// SMGs
case "Scorpion":
return <Scorpion playerStateRef={playerStateRef} />;
// Shotguns
case "Nova":
return <Nova playerStateRef={playerStateRef} />;
// Sniper Rifles
case "AWP":
return <AWP playerStateRef={playerStateRef} />;
// Pistols
case "FiveSeven":
return <FiveSeven playerStateRef={playerStateRef} />;
// Rocket Launchers
case "RPG":
return <RPG playerStateRef={playerStateRef} />;
// Special Weapons
case "M203":
return <M203 playerStateRef={playerStateRef} />;
// Melee Weapons
case "Knife":
return <Knife playerStateRef={playerStateRef} />;

// TODO: Bring back assertNever https://app.clickup.com/t/86b5v1m7h
}
Expand Down
59 changes: 59 additions & 0 deletions packages/frontend/src/game/weapons/weapons/melee/Knife.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import React from "react";
import { GamePlayerState } from "../../../utils/geckos/geckos";
import { PUBLIC_PATHS } from "../../../constants/publicPaths";
import { useGLTF } from "@react-three/drei";
import { Vector3 } from "three";
import { WeaponChild } from "../../WeaponChild";
import { WEAPONS } from "@fps/lib";

interface KnifeProps {
playerStateRef: React.MutableRefObject<GamePlayerState>;
}

export const Knife: React.FC<KnifeProps> = ({ playerStateRef }) => {
return (
<WeaponChild
adsOffset={new Vector3(0.00139, -0.006, -0.0019)}
adsRotation={new Vector3(0.025, 3.085, 0.15)}
animationValues={{
adsWalkAmplitude: 0.0001,
crawl: {
appliedRotation: { x: -1.5, y: 0.5, z: 1.0 },
appliedTranslation: { x: 0.0001, y: 0.01, z: 0.005 },
initialValues: {
rotateX: -0.55,
rotateY: 4.3,
rotateZ: -0.5,
translateX: -0.004,
translateY: -0.01,
translateZ: -0.005,
},
},
idleAmplitude: 0.0002,
sprint: {
amplitude: 0.1,
appliedRotation: { x: 0.3, y: 0.3, z: 0.3 },
appliedTranslation: { x: 0, y: 0.025, z: 0.2 },
initialValues: {
rotateX: -0.5,
rotateY: 4.2,
rotateZ: -0.4,
translateX: -0.004,
translateY: -0.0095,
translateZ: -0.004,
},
},
walkingAmplitude: 0.0003,
}}
idleOffset={new Vector3(-0.0018, -0.007, -0.001)}
idleRotation={new Vector3(0, 3.2, 0.1)}
meshPath={PUBLIC_PATHS.weapons.Saiga} // TODO: https://app.clickup.com/t/86b5vk9q1
playerStateRef={playerStateRef}
scale={0.01}
shootBufferUrl={""}
stats={WEAPONS.Knife}
/>
);
};

useGLTF.preload(PUBLIC_PATHS.weapons.Saiga); // TODO: https://app.clickup.com/t/86b5vk9q1
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React from "react";
import ShootSound from "./AK47.mp3";
import { GamePlayerState } from "../../../utils/geckos/geckos";
import { PUBLIC_PATHS } from "../../../constants/publicPaths";
import { GamePlayerState } from "../../../../utils/geckos/geckos";
import { PUBLIC_PATHS } from "../../../../constants/publicPaths";
import { useGLTF } from "@react-three/drei";
import { Vector3 } from "three";
import { WeaponChild } from "../../WeaponChild";
import { WeaponChild } from "../../../WeaponChild";
import { WEAPONS } from "@fps/lib";

interface AK47Props {
Expand Down
59 changes: 59 additions & 0 deletions packages/frontend/src/game/weapons/weapons/primary/AWP/AWP.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import React from "react";
import { GamePlayerState } from "../../../../utils/geckos/geckos";
import { PUBLIC_PATHS } from "../../../../constants/publicPaths";
import { useGLTF } from "@react-three/drei";
import { Vector3 } from "three";
import { WeaponChild } from "../../../WeaponChild";
import { WEAPONS } from "@fps/lib";

interface AWPProps {
playerStateRef: React.MutableRefObject<GamePlayerState>;
}

export const AWP: React.FC<AWPProps> = ({ playerStateRef }) => {
return (
<WeaponChild
adsOffset={new Vector3(0.00139, -0.006, -0.0019)}
adsRotation={new Vector3(0.025, 3.085, 0.15)}
animationValues={{
adsWalkAmplitude: 0.0001,
crawl: {
appliedRotation: { x: -1.5, y: 0.5, z: 1.0 },
appliedTranslation: { x: 0.0001, y: 0.01, z: 0.005 },
initialValues: {
rotateX: -0.55,
rotateY: 4.3,
rotateZ: -0.5,
translateX: -0.004,
translateY: -0.01,
translateZ: -0.005,
},
},
idleAmplitude: 0.0002,
sprint: {
amplitude: 0.1,
appliedRotation: { x: 0.3, y: 0.3, z: 0.3 },
appliedTranslation: { x: 0, y: 0.025, z: 0.2 },
initialValues: {
rotateX: -0.5,
rotateY: 4.2,
rotateZ: -0.4,
translateX: -0.004,
translateY: -0.0095,
translateZ: -0.004,
},
},
walkingAmplitude: 0.0003,
}}
idleOffset={new Vector3(-0.0018, -0.007, -0.001)}
idleRotation={new Vector3(0, 3.2, 0.1)}
meshPath={PUBLIC_PATHS.weapons.Saiga} // TODO: https://app.clickup.com/t/86b5vk9q1
playerStateRef={playerStateRef}
scale={0.01}
shootBufferUrl={""}
stats={WEAPONS.AWP}
/>
);
};

useGLTF.preload(PUBLIC_PATHS.weapons.Saiga); // TODO: https://app.clickup.com/t/86b5vk9q1
59 changes: 59 additions & 0 deletions packages/frontend/src/game/weapons/weapons/primary/Nova/Nova.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import React from "react";
import { GamePlayerState } from "../../../../utils/geckos/geckos";
import { PUBLIC_PATHS } from "../../../../constants/publicPaths";
import { useGLTF } from "@react-three/drei";
import { Vector3 } from "three";
import { WeaponChild } from "../../../WeaponChild";
import { WEAPONS } from "@fps/lib";

interface NovaProps {
playerStateRef: React.MutableRefObject<GamePlayerState>;
}

export const Nova: React.FC<NovaProps> = ({ playerStateRef }) => {
return (
<WeaponChild
adsOffset={new Vector3(0.00139, -0.006, -0.0019)}
adsRotation={new Vector3(0.025, 3.085, 0.15)}
animationValues={{
adsWalkAmplitude: 0.0001,
crawl: {
appliedRotation: { x: -1.5, y: 0.5, z: 1.0 },
appliedTranslation: { x: 0.0001, y: 0.01, z: 0.005 },
initialValues: {
rotateX: -0.55,
rotateY: 4.3,
rotateZ: -0.5,
translateX: -0.004,
translateY: -0.01,
translateZ: -0.005,
},
},
idleAmplitude: 0.0002,
sprint: {
amplitude: 0.1,
appliedRotation: { x: 0.3, y: 0.3, z: 0.3 },
appliedTranslation: { x: 0, y: 0.025, z: 0.2 },
initialValues: {
rotateX: -0.5,
rotateY: 4.2,
rotateZ: -0.4,
translateX: -0.004,
translateY: -0.0095,
translateZ: -0.004,
},
},
walkingAmplitude: 0.0003,
}}
idleOffset={new Vector3(-0.0018, -0.007, -0.001)}
idleRotation={new Vector3(0, 3.2, 0.1)}
meshPath={PUBLIC_PATHS.weapons.Saiga} // TODO: https://app.clickup.com/t/86b5vk9q1
playerStateRef={playerStateRef}
scale={0.01}
shootBufferUrl={""}
stats={WEAPONS.Nova}
/>
);
};

useGLTF.preload(PUBLIC_PATHS.weapons.Saiga); // TODO: https://app.clickup.com/t/86b5vk9q1
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import React from "react";
import ShootSound from "../AK47/AK47.mp3";
import { GamePlayerState } from "../../../utils/geckos/geckos";
import { PUBLIC_PATHS } from "../../../constants/publicPaths";
import { GamePlayerState } from "../../../../utils/geckos/geckos";
import { PUBLIC_PATHS } from "../../../../constants/publicPaths";
import { useGLTF } from "@react-three/drei";
import { Vector3 } from "three";
import { WeaponChild } from "../../WeaponChild";
import { WeaponChild } from "../../../WeaponChild";
import { WEAPONS } from "@fps/lib";

interface SaigaProps {
Expand Down Expand Up @@ -51,7 +50,7 @@ export const Saiga: React.FC<SaigaProps> = ({ playerStateRef }) => {
meshPath={PUBLIC_PATHS.weapons.Saiga}
playerStateRef={playerStateRef}
scale={0.01}
shootBufferUrl={ShootSound}
shootBufferUrl={""}
stats={WEAPONS.Saiga}
/>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import React from "react";
import { GamePlayerState } from "../../../../utils/geckos/geckos";
import { PUBLIC_PATHS } from "../../../../constants/publicPaths";
import { useGLTF } from "@react-three/drei";
import { Vector3 } from "three";
import { WeaponChild } from "../../../WeaponChild";
import { WEAPONS } from "@fps/lib";

interface ScorpionProps {
playerStateRef: React.MutableRefObject<GamePlayerState>;
}

export const Scorpion: React.FC<ScorpionProps> = ({ playerStateRef }) => {
return (
<WeaponChild
adsOffset={new Vector3(0.00139, -0.006, -0.0019)}
adsRotation={new Vector3(0.025, 3.085, 0.15)}
animationValues={{
adsWalkAmplitude: 0.0001,
crawl: {
appliedRotation: { x: -1.5, y: 0.5, z: 1.0 },
appliedTranslation: { x: 0.0001, y: 0.01, z: 0.005 },
initialValues: {
rotateX: -0.55,
rotateY: 4.3,
rotateZ: -0.5,
translateX: -0.004,
translateY: -0.01,
translateZ: -0.005,
},
},
idleAmplitude: 0.0002,
sprint: {
amplitude: 0.1,
appliedRotation: { x: 0.3, y: 0.3, z: 0.3 },
appliedTranslation: { x: 0, y: 0.025, z: 0.2 },
initialValues: {
rotateX: -0.5,
rotateY: 4.2,
rotateZ: -0.4,
translateX: -0.004,
translateY: -0.0095,
translateZ: -0.004,
},
},
walkingAmplitude: 0.0003,
}}
idleOffset={new Vector3(-0.0018, -0.007, -0.001)}
idleRotation={new Vector3(0, 3.2, 0.1)}
meshPath={PUBLIC_PATHS.weapons.Saiga} // TODO: https://app.clickup.com/t/86b5vk9q1
playerStateRef={playerStateRef}
scale={0.01}
shootBufferUrl={""}
stats={WEAPONS.Scorpion}
/>
);
};

useGLTF.preload(PUBLIC_PATHS.weapons.Saiga); // TODO: https://app.clickup.com/t/86b5vk9q1
Loading