"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PostPickupCollect = void 0;
const isaac_typescript_definitions_1 = require("isaac-typescript-definitions");
const players_1 = require("../../functions/players");
const shouldFire_1 = require("../../shouldFire");
const CustomCallback_1 = require("../private/CustomCallback");
const v = {
    room: {
        firedSet: new Set(),
    },
};
class PostPickupCollect extends CustomCallback_1.CustomCallback {
    v = v;
    constructor() {
        super();
        this.callbacksUsed = [
            // 36
            [isaac_typescript_definitions_1.ModCallback.POST_PICKUP_RENDER, this.postPickupRender],
        ];
    }
    shouldFire = shouldFire_1.shouldFirePickup;
    // ModCallback.POST_PICKUP_RENDER (36)
    postPickupRender = (pickup) => {
        const sprite = pickup.GetSprite();
        const animation = sprite.GetAnimation();
        if (animation !== "Collect") {
            return;
        }
        const index = GetPtrHash(pickup);
        if (!v.room.firedSet.has(index)) {
            v.room.firedSet.add(index);
            const player = (0, players_1.getClosestPlayer)(pickup.Position);
            this.fire(pickup, player);
        }
    };
}
exports.PostPickupCollect = PostPickupCollect;
