"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PostPickupStateChanged = void 0;
const isaac_typescript_definitions_1 = require("isaac-typescript-definitions");
const shouldFire_1 = require("../../shouldFire");
const DefaultMap_1 = require("../DefaultMap");
const CustomCallback_1 = require("../private/CustomCallback");
const v = {
    run: {
        stateMap: new DefaultMap_1.DefaultMap((state) => state),
    },
};
class PostPickupStateChanged extends CustomCallback_1.CustomCallback {
    v = v;
    constructor() {
        super();
        this.callbacksUsed = [
            // 35
            [isaac_typescript_definitions_1.ModCallback.POST_PICKUP_UPDATE, this.postPickupUpdate],
        ];
    }
    shouldFire = shouldFire_1.shouldFirePickup;
    // ModCallback.POST_PICKUP_UPDATE (35)
    postPickupUpdate = (pickup) => {
        const ptrHash = GetPtrHash(pickup);
        const previousState = v.run.stateMap.getAndSetDefault(ptrHash, pickup.State);
        const currentState = pickup.State;
        v.run.stateMap.set(ptrHash, currentState);
        if (previousState !== currentState) {
            this.fire(pickup, previousState, currentState);
        }
    };
}
exports.PostPickupStateChanged = PostPickupStateChanged;
