1
0
mirror of https://github.com/lexogrine/cs2-react-hud.git synced 2025-12-10 02:42:49 +01:00

added zeus

This commit is contained in:
Hubert Walczak 2024-02-21 09:31:14 +01:00
parent 29ab58a0d9
commit dff9a6d4fb
No known key found for this signature in database
GPG Key ID: 17BB1C9355357860
4 changed files with 17 additions and 3 deletions

View File

@ -1,7 +1,7 @@
{ {
"name": "cs2-react-hud", "name": "cs2-react-hud",
"private": true, "private": true,
"version": "1.0.2", "version": "1.0.3",
"type": "module", "type": "module",
"scripts": { "scripts": {
"zip": "npm-build-zip", "zip": "npm-build-zip",

View File

@ -1,6 +1,6 @@
{ {
"name":"LHM CS2 Default HUD", "name":"LHM CS2 Default HUD",
"version":"1.0.2", "version":"1.0.3",
"author":"Lexogrine", "author":"Lexogrine",
"legacy": false, "legacy": false,
"radar": true, "radar": true,

View File

@ -69,11 +69,14 @@ const arePlayersEqual = (playerOne: I.Player, playerTwo: I.Player) => {
} }
const Player = ({ player, isObserved }: IProps) => { const Player = ({ player, isObserved }: IProps) => {
const weapons = Object.values(player.weapons).map(weapon => ({ ...weapon, name: weapon.name.replace("weapon_", "") })); const weapons = player.weapons.map(weapon => ({ ...weapon, name: weapon.name.replace("weapon_", "") }));
const primary = weapons.filter(weapon => !['C4', 'Pistol', 'Knife', 'Grenade', undefined].includes(weapon.type))[0] || null; const primary = weapons.filter(weapon => !['C4', 'Pistol', 'Knife', 'Grenade', undefined].includes(weapon.type))[0] || null;
const secondary = weapons.filter(weapon => weapon.type === "Pistol")[0] || null; const secondary = weapons.filter(weapon => weapon.type === "Pistol")[0] || null;
const grenades = weapons.filter(weapon => weapon.type === "Grenade"); const grenades = weapons.filter(weapon => weapon.type === "Grenade");
const isLeft = player.team.orientation === "left"; const isLeft = player.team.orientation === "left";
const zeus = weapons.find(weapon => weapon.name === "taser");
return ( return (
<div className={`player ${player.state.health === 0 ? "dead" : ""} ${isObserved ? 'active' : ''}`}> <div className={`player ${player.state.health === 0 ? "dead" : ""} ${isObserved ? 'active' : ''}`}>
<div className="player_data"> <div className="player_data">
@ -109,6 +112,7 @@ const Player = ({ player, isObserved }: IProps) => {
<Defuse player={player} /> <Defuse player={player} />
</div> </div>
<div className="money">${player.state.money}</div> <div className="money">${player.state.money}</div>
{zeus ? <Weapon className={`zeus ${player.team.orientation}`} weapon="taser" active={zeus.state === "active"} /> : null}
<div className="grenades"> <div className="grenades">
{grenades.map(grenade => ( {grenades.map(grenade => (
[ [

View File

@ -46,6 +46,16 @@
} }
} }
} }
.weapon.zeus {
height: 30px;
position: absolute;
&.left {
left: 170px;
}
&.right {
right: 170px;
}
}
&.right { &.right {
right: 10px; right: 10px;
.player { .player {