isaacscript-common
Version:
Helper functions and features for IsaacScript mods.
71 lines • 4.13 kB
TypeScript
export declare function anyEntityCloserThan(entities: readonly Entity[], position: Vector, distance: int): boolean;
/**
* Iterates over all players and checks if any player is close enough to the specified position.
*
* Note that this function does not consider players with a non-undefined parent, since they are not
* real players (e.g. the Strawman Keeper).
*/
export declare function anyPlayerCloserThan(position: Vector, distance: float): boolean;
/**
* Helper function to get a room position that is not overlapping with a grid entity, a heaven door,
* or a player. The `Room.FindFreePickupSpawnPosition` method will return locations that overlap
* with heaven doors and partially overlap with players, if the thing being spawned is bigger than a
* tile (like a Blood Donation Machine). Use this function instead if you want to account for those
* specific situations.
*
* @param startingPosition The position to start searching from. If this position is not overlapping
* with anything, then it will be returned.
* @param avoidActiveEntities Optional. Default is false.
* @param minimumDistance Optional. If specified, will ensure that the randomly generated position
* is equal to or greater than the distance provided.
*/
export declare function findFreePosition(startingPosition: Vector, avoidActiveEntities?: boolean, minimumDistance?: float): Readonly<Vector>;
/**
* Helper function to get a map containing the positions of every entity in the current room.
*
* This is useful for rewinding entity positions at a later time. Also see `setEntityPositions`.
*
* @param entities Optional. If provided, will only get the positions of the provided entities. Use
* this with cached entities to avoid invoking the `Isaac.GetRoomEntities` method
* multiple times.
*/
export declare function getEntityPositions(entities?: readonly Entity[]): ReadonlyMap<PtrHash, Vector>;
/**
* Helper function to get a map containing the velocities of every entity in the current room.
*
* This is useful for rewinding entity velocities at a later time. Also see `setEntityVelocities`.
*
* @param entities Optional. If provided, will only get the velocities of the provided entities. Use
* this with cached entities to avoid invoking the `Isaac.GetRoomEntities` method
* multiple times.
*/
export declare function getEntityVelocities(entities?: readonly Entity[]): ReadonlyMap<PtrHash, Vector>;
/**
* Helper function to set the position of every entity in the room based on a map of positions. If
* an entity is found that does not have matching element in the provided map, then that entity will
* be skipped.
*
* This function is useful for rewinding entity positions at a later time. Also see
* `getEntityPositions`.
*
* @param entityPositions The map providing the positions for every entity.
* @param entities Optional. If provided, will only set the positions of the provided entities. Use
* this with cached entities to avoid invoking the `Isaac.GetRoomEntities` method
* multiple times.
*/
export declare function setEntityPositions(entityPositions: ReadonlyMap<PtrHash, Vector>, entities?: readonly Entity[]): void;
/**
* Helper function to set the velocity of every entity in the room based on a map of velocities. If
* an entity is found that does not have matching element in the provided map, then that entity will
* be skipped.
*
* This function is useful for rewinding entity velocities at a later time. Also see
* `getEntityVelocities`.
*
* @param entityVelocities The map providing the velocities for every entity.
* @param entities Optional. If provided, will only set the velocities of the provided entities. Use
* this with cached entities to avoid invoking the `Isaac.GetRoomEntities` method
* multiple times.
*/
export declare function setEntityVelocities(entityVelocities: ReadonlyMap<PtrHash, Vector>, entities?: readonly Entity[]): void;
//# sourceMappingURL=positionVelocity.d.ts.map