diff --git a/server/src/game/objects/player.ts b/server/src/game/objects/player.ts index f8da5b8b..09626e97 100644 --- a/server/src/game/objects/player.ts +++ b/server/src/game/objects/player.ts @@ -2798,7 +2798,11 @@ export class Player extends BaseGameObject { gunType = obj.type; } if (gunType) { - this.weaponManager.setWeapon(newGunIdx, gunType, 0); + this.weaponManager.setWeapon( + newGunIdx, + gunType, + freeGunSlot.isDualWield ? this.weapons[newGunIdx].ammo : 0, + ); // if "preloaded" gun add ammo to inventory if (obj.isPreloadedGun) { diff --git a/server/src/game/weaponManager.ts b/server/src/game/weaponManager.ts index a953dbb1..d19ec5c1 100644 --- a/server/src/game/weaponManager.ts +++ b/server/src/game/weaponManager.ts @@ -155,11 +155,7 @@ export class WeaponManager { }> = []; get activeWeapon(): string { - // HACK: possible fix for client crash? - // active weapon seems to be undefined/empty string in the client - // idk why it also doesn't crash the server lol - // TODO: investigate this - return this.weapons[this.curWeapIdx].type || "fists"; + return this.weapons[this.curWeapIdx].type; } constructor(player: Player) { @@ -477,7 +473,7 @@ export class WeaponManager { if (weaponDef.isDual) { item = item.replace("_dual", ""); - this.player.dropLoot(item, 0); + this.player.dropLoot(item, 0, true); } this.player.dropLoot(item, amountToDrop, true); this.player.weapsDirty = true;