Skip to main content

Prevent Grid Entity Respawn

Hierarchy

  • Feature

    PreventGridEntityRespawn

Methods

preventGridEntityRespawn

preventGridEntityRespawn(): void

Helper function to prevent any removed grid entities from respawning if the player re-enters the current room.

This is accomplished by spawning a new grid entity on every tile that does not already have a grid entity. This will force the game to spawn the new grid entity instead of the old one. The natural grid entity to choose for this purpose is a decoration, since it is non-interacting. Then, the decorations are made invisible and any shovel uses are intercepted to avoid creating a crawl space (instead of a trapdoor).

Another option besides decorations would be to use a pressure plates with a state of 1, which is a state that is normally unused by the game and makes it invisible & persistent. However, pickups will not be able to spawn on pressure plates, which lead to various bugs (e.g. pickups spawning on top of pits). Thus, using a decoration is preferable.

Yet another option to accomplish this would be to replace the room data with that of an empty room. However, the room data must exactly match the room type, the room shape, and the doors, so this is not possible to do in a robust way without adding empty rooms to the mod's content folder to draw the data from.

In order to use this function, you must upgrade your mod with ISCFeature.PREVENT_GRID_ENTITY_RESPAWN.

Returns

void

Defined in

packages/isaacscript-common/src/classes/features/other/PreventGridEntityRespawn.ts:175