Persistent Entities
Classes
Section titled “Classes”PersistentEntities
Section titled “PersistentEntities”Defined in: packages/isaacscript-common/src/classes/features/other/PersistentEntities.ts:43
Extends
Section titled “Extends”Feature
Methods
Section titled “Methods”removePersistentEntity()
Section titled “removePersistentEntity()”removePersistentEntity(
persistentEntityIndex,shouldRemoveEntity?):void
Defined in: packages/isaacscript-common/src/classes/features/other/PersistentEntities.ts:166
Helper function to stop an entity spawned with the spawnPersistentEntity helper function from
respawning.
In order to use this function, you must upgrade your mod with ISCFeature.PERSISTENT_ENTITIES.
Parameters
Section titled “Parameters”persistentEntityIndex
Section titled “persistentEntityIndex”int
The index that was returned by the spawnPersistentEntity
function.
shouldRemoveEntity?
Section titled “shouldRemoveEntity?”boolean = true
Optional. True by default. Set to false if you want to stop an entity from being persistent but you don’t want to actually remove the currently-spawned entity from the room.
Returns
Section titled “Returns”void
spawnPersistentEntity()
Section titled “spawnPersistentEntity()”spawnPersistentEntity(
entityType,variant,subType,position):object
Defined in: packages/isaacscript-common/src/classes/features/other/PersistentEntities.ts:206
Helper function to spawn an entity that will have persistence similar to a pickup.
By default, as soon as you leave a room, any spawned entities will be despawned and will not return if the player revisits the room. This means that if you want to have an entity like a pickup, you have to manually respawn it when the player re-enters the room. Use this helper function to avoid having to do any tracking on your own.
Conventionally, the word “persistent” refers to EntityFlag.FLAG_PERSISTENT, which is used on
e.g. familiars to make them appear in every room. On the other hand, pickups are also
persistent, but they are not present in every room, only one specific room. This function
spawns entities like pickups, not familiars.
In order to use this function, you must upgrade your mod with ISCFeature.PERSISTENT_ENTITIES.
Parameters
Section titled “Parameters”entityType
Section titled “entityType”EntityType
variant
Section titled “variant”int
subType
Section titled “subType”int
position
Section titled “position”Vector
Returns
Section titled “Returns”object
An object containing the entity and the persistent entity index. You can use the index
with the removePersistentEntity function.
entity
Section titled “entity”entity:
Entity
persistentIndex
Section titled “persistentIndex”persistentIndex:
int
