Skip to content

Commit 1f41f1b

Browse files
author
Picoseconds
committed
fix: fixed secondary weapons
1 parent eaa7c85 commit 1f41f1b

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

src/moomoo/Game.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,12 @@ export default class Game {
427427
for (let hitPlayer of hitPlayers) {
428428
if (hitPlayer.clanName == player.clanName && hitPlayer.clanName != null) continue;
429429

430-
let dmg = getWeaponDamage(player.weapon, player.weaponVariant);
430+
let dmg = getWeaponDamage(
431+
player.selectedWeapon,
432+
player.selectedWeapon == player.weapon ?
433+
player.primaryWeaponVariant :
434+
player.secondaryWeaponVariant
435+
);
431436

432437
hitPlayer.health -= dmg;
433438
if (hitPlayer.health <= 0 && hitPlayer.client) {

src/moomoo/Player.ts

+10-3
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ export default class Player extends Entity {
4141
public weapon: PrimaryWeapons = 0;
4242
public secondaryWeapon: SecondaryWeapons = -1;
4343
public selectedWeapon: Weapons = 0;
44-
public weaponVariant = WeaponVariant.Normal;
44+
public primaryWeaponVariant = WeaponVariant.Normal;
45+
public secondaryWeaponVariant = WeaponVariant.Normal;
4546
public buildItem = -1;
4647
public items: ItemType[] = [ItemType.Apple, ItemType.WoodWall, ItemType.Spikes, ItemType.Windmill];
4748

@@ -323,7 +324,11 @@ export default class Player extends Entity {
323324
this.dead = true;
324325
this.kills = 0;
325326
this.weapon = 0;
326-
this.weaponVariant = WeaponVariant.Normal;
327+
this.secondaryWeapon = -1;
328+
this.primaryWeaponVariant = WeaponVariant.Normal;
329+
this.secondaryWeaponVariant = WeaponVariant.Normal;
330+
this.age = 1;
331+
this.xp = 0;
327332
this.buildItem = -1;
328333
this.autoAttackOn = false;
329334
this.disableRotation = false;
@@ -360,7 +365,9 @@ export default class Player extends Entity {
360365
this.angle,
361366
this.buildItem,
362367
this.selectedWeapon,
363-
this.weaponVariant,
368+
this.selectedWeapon == this.weapon ?
369+
this.primaryWeaponVariant :
370+
this.secondaryWeaponVariant,
364371
this.clanName,
365372
this.isClanLeader ? 1 : 0,
366373
this.hatID,

0 commit comments

Comments
 (0)