Persistent Entities
Hierarchy
-
Feature
↳
PersistentEntities
Methods
removePersistentEntity
▸ removePersistentEntity(persistentEntityIndex
, removeEntity?
): void
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
Name | Type | Default value | Description |
---|---|---|---|
persistentEntityIndex | int | undefined | The index that was returned by the spawnPersistentEntity function. |
removeEntity | 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
void
Defined in
packages/isaacscript-common/src/classes/features/other/PersistentEntities.ts:166
spawnPersistentEntity
▸ spawnPersistentEntity(entityType
, variant
, subType
, position
): Object
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
Name | Type |
---|---|
entityType | EntityType |
variant | int |
subType | int |
position | Vector |
Returns
Object
An object containing the entity and the persistent entity index. You can use the index
with the removePersistentEntity
function.
Name | Type |
---|---|
entity | Entity |
persistentIndex | int |
Defined in
packages/isaacscript-common/src/classes/features/other/PersistentEntities.ts:206