isaacscript-common
Version:
Helper functions and features for IsaacScript mods.
44 lines • 2.14 kB
TypeScript
import type { ActiveSlot, CollectibleType } from "isaac-typescript-definitions";
import { ModCallbackCustom } from "../../enums/ModCallbackCustom";
import type { PlayerIndex } from "../../types/PlayerIndex";
import { DefaultMap } from "../DefaultMap";
import type { FireArgs, OptionalArgs } from "../private/CustomCallback";
import { CustomCallback } from "../private/CustomCallback";
type T = ModCallbackCustom.POST_ITEM_DISCHARGE;
type ActiveSlotToCollectibleTypeMap = Map<ActiveSlot, CollectibleType>;
type ActiveSlotToChargeMap = Map<ActiveSlot, int>;
export declare class PostItemDischarge extends CustomCallback<T> {
v: {
run: {
playersActiveItemMap: DefaultMap<PlayerIndex, ActiveSlotToCollectibleTypeMap, []>;
playersActiveChargeMap: DefaultMap<PlayerIndex, ActiveSlotToChargeMap, []>;
};
room: {
playersBulbLastCollisionFrame: Map<PlayerIndex, int>;
};
};
constructor();
protected shouldFire: (fireArgs: FireArgs<T>, optionalArgs: OptionalArgs<T>) => boolean;
private readonly preNPCCollisionSucker;
private preNPCCollisionBulb;
/**
* The algorithm for detecting a discharge is checking if the current charge is less than the
* charge on the previous frame. Thus, when a Bulb zaps a player and drains their charge, this
* will be a false position, so Bulbs have to be handled.
*
* When Bulbs zap a player, they go to `NPCState.STATE_JUMP` for a frame. However, this only
* happens on the frame after the player is discharged, which is too late to be of any use.
*
* Instead, we track the frames that Bulbs collide with players and assume that a collision means
* a zap has occurred.
*/
private checkPlayerCollidedWithBulb;
private readonly postPEffectUpdateReordered;
/**
* If the player collided with a Bulb on either this frame or the last frame, then assume a zap
* has occurred. (We do not want to fire the discharge callback if this is the case.)
*/
private playerRecentlyCollidedWithBulb;
}
export {};
//# sourceMappingURL=PostItemDischarge.d.ts.map