From 9cfcaf19f5bfad61d9bd6fd7789e6d55f0c86a45 Mon Sep 17 00:00:00 2001 From: leia_uwu Date: Fri, 29 Sep 2023 19:11:28 -0300 Subject: [PATCH] fix: fix picking up skins --- src/game/objects/loot.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/game/objects/loot.ts b/src/game/objects/loot.ts index dd77009..34e0daa 100644 --- a/src/game/objects/loot.ts +++ b/src/game/objects/loot.ts @@ -1,6 +1,6 @@ import { Constants, ObjectKind } from "../../utils/constants"; import { deepCopy, log } from "../../utils/misc"; -import { Items, LootTables, Weapons, TypeToId } from "../../utils/data"; +import { Items, LootTables, Weapons, TypeToId, IdToGameType } from "../../utils/data"; import type { SurvivBitStream } from "../../utils/survivBitStream"; import { random, unitVecToRadians, weightedRandom } from "../../utils/math"; import { type Game } from "../game"; @@ -110,6 +110,14 @@ export class Loot extends GameObject { } else if (this.typeString.startsWith("helmet")) { result = this.pickUpTieredItem("helmet", p); playerDirty = true; + } else if (this.typeString.startsWith("outfit")) { + if (p.loadout.outfit === this.typeId) { + result = PickupMsgType.AlreadyOwned; + } else { + this.game.dynamicObjects.add(new Loot(this.game, IdToGameType[p.loadout.outfit], this.position, p.layer, 1)); + p.loadout.outfit = this.typeId; + playerDirty = true; + } } else if (Constants.bagSizes[this.typeString]) { // Throwables implementation [inside here cus it's tiered] /* if (Weapons[this.typeString]?.type === "throwable") { @@ -284,7 +292,7 @@ export class Loot extends GameObject { } // eslint-disable-next-line @typescript-eslint/no-empty-function - damage(amount: number, source): void {} + damage(amount: number, source): void { } } export interface LooseLoot {