Entities

Overview

Return Value
Function

any

GetEntityData(table mod, Entity entity, string field)

void

SetEntityData(table mod, Entity entity, string field, any value)

void

SetEntityPositions(table<EntityPtr, Vector> positions, Entity[]? entities)

void

SetEntityVelocities(table<EntityPtr, Vector> velocities, Entity[]? entities)

Spawn(EntityType entityType, integer variant, integer subType, Vector position, Vector? velocity, Entity? spawner, `integer

Functions

GetEntities()

Entity[] GetEntities(EntityType | integer? entityType = -1 , integer? variant = -1 , integer? subType = -1 , boolean? ignoreFriendly = false )

Helper function to get all of the entities in the room or all of the entities tht match a specific entity type / variant / sub-type. Due to bugs with Isaac.FindInRadius, this function uses Isaac.GetRoomEntities, which is more expensive but is also more robust. (If a matching entity type is provided, then Isaac.FindByType will be used instead.)

GetEntityData()

any GetEntityData(table mod, Entity entity, string field)

Gets some arbitrary data for an entity. Use this instead of Entity:GetData() since that is global and allows for other mods to edit your data. This is also better than manually keeping track of the data manually with the save manager since the PtrHash can be reused after the entity is removed and this keeps track of it manually. Use only for non persistent entities like effects.

GetEntityPositions()

table<EntityPtr, Vector> GetEntityPositions(Entity[]? entities)

Helper function to get a map containing the positions of every entity in the current room.

GetEntityVelocities()

table<EntityPtr, Vector> GetEntityVelocities(Entity[]? entities)

Helper function to get a map containing the velocities of every entity in the current room.

IsCollidingWithGrid()

GridEntity? IsCollidingWithGrid(Entity entity)

Checks if an entity is colliding with a grid entity. If it does, returns the grid entity it's colliding with, else returns nil.

SetEntityData()

void SetEntityData(table mod, Entity entity, string field, any value)

Sets some arbitrary data for an entity. Use this instead of Entity:GetData() since that is global and allows for other mods to edit your data. This is also better than manually keeping track of the data manually with the save manager since the PtrHash can be reused after the entity is removed and this keeps track of it manually. Use only for non persistent entities like effects.

SetEntityPositions()

void SetEntityPositions(table<EntityPtr, Vector> positions, Entity[]? entities)

Helper function to set the positions of all the entities in the room. Useful for rewinding entity positions.

SetEntityVelocities()

void SetEntityVelocities(table<EntityPtr, Vector> velocities, Entity[]? entities)

Helper function to set the velocities of all the entities in the room. Useful for rewinding entity velocities.

Spawn()

Entity Spawn(EntityTypeentityType, integer variant, integer subType,Vectorposition,Vector? velocity, Entity? spawner, integer | RNG? seedOrRNG)

Helper function to spawn an entity. Use this instead of the Isaac.Spawn method if you do not need to specify the velocity or spawner.

Last updated