StagePrefabs

v1.0.0·Updated 2025-09-23

Helper to create stage parts that can be placed like objects

About this mod Author’s original text

Onyx-StagePrefabs

  • Helper to place.rorlvl maps in a stage
  • Look at StageFeatures as an example

Functions

StagePrefab.create_prefab(namespace, identifier, room_path) -> prefab

Creates a prefab. that can later be placed manually or as an interactable

Parameters:

| Parameter | Type | Description |

| ------------- | -------- | --------------- |

| namespace | string | The namespace of your mod |

| identifier | string | The identifier of the variant (namespace + identifier need to be unique) |

| room_path | string | the path to the rorlvl file of your prefab |

StagePrefab.prefab_set_offsets(prefab, x, y) -> nil

The offset the prefab is placed at when it is created. (0, 0) is the bottom left of the prefab room

Parameters:

| Parameter | Type | Description |

| ------------- | -------- | --------------- |

| prefab | prefab | the prefab you want to set the offset for |

| x | int | the x offset for the prefab. higher values go to the right, 32 is 1 block. Default: 0 |

| y | int | the y offset for the prefab. higher values go upwards, 32 is 1 block. Default: 0 |

StagePrefab.prefab_set_freespace(prefab, x1, y1, x2, y2, maxSearchIterations, avoidLadders)

Set the area that is required to have no collision to be able to spawn. tries placing nearby if the area is occupied. 32 is 1 block. 0 is the bottom left tile of the prefab room

Parameters:

| Parameter | Type | Description |

| ------------- | -------- | --------------- |

| prefab | prefab | the prefab you want to set the offset for |

| x1 | int | the first x coordinate for the area. |

| y1 | int | the first y coordinate for the area |

| x2 | int | the second x coordinate for the area |

| y2 | int | the second y coordinate for the area |

| maxSearchIterations | int | how often it should try placing the prefab before returning |

| avoidLadders | bool | check if ladders are in the area |

StagePrefab.prefab_set_required_ground(prefab, x1, y1, x2, y2, trueGround)

Set the area that is required to have a collision tile

Parameters:

| Parameter | Type | Description |

| ------------- | -------- | --------------- |

| prefab | prefab | the prefab you want to set the offset for |

| x1 | int | the first x coordinate for the area. |

| y1 | int | the first y coordinate for the area |

| x2 | int | the second x coordinate for the area |

| y2 | int | the second y coordinate for the area |

| trueGround | bool | check if the ground is just a platform. Useful if you want a prefab that digs into the ground |

StagePrefab.update_lookup

if you want to delete sprites placed by a prefab, you need to call this first

delete tile object

deletes tiles in its place and destroys itself afterwards. Placing many at once lags the game pretty badly. Only affects the map and not objects unless explicitly stated otherwise

fields:

| filed | Type | Description |

| ------------- | -------- | --------------- |

| namespace | string | "StagePrefab" |

| identifier | string | "deleteTile |

| destroyBlocks| bool | whether to destroy collision or not |

| destroySprites| bool | whether to destroy sprites or not |

| minSpriteDepth| int | the minimum depth a sprite needs to be at to be destoyed |

| maxSpriteDepth| int | the maximum depth a sprite needs to be at to be destoyed |

| toDestroyExtra| {object} | a ds list of object ids that should also be destroyed |

| preventoob| bool | whether to place additional collision to prevent falling out of bounds (doesn't work 100%, but it's good enough when not spammed) |

| replacementTile| object | the tile that should replace the original tile |

Special Thanks To

  • The Return Of Modding Discord

Contact

For questions or bug reports, you can find us in the RoRR Modding Server @Onyx

Install & use Install: follow the bundled instructions

  1. Unzip the archive from playbuff and read the bundled readme / instructions first.
  2. Most mods rely on the game's mod loader — the usual route is a community mod manager (such as r2modman): pick this game, install, and it handles the loader and dependencies.
  3. For a manual install, put the mod files into the matching Mod / plugins folder inside the game directory.
  4. Launch the game to confirm it loaded; mods with listed dependencies need those installed as well.

Install locations vary a lot between mods — the bundled readme is the most reliable guide. If the mod depends on a loader such as ReturnOfModding, install it first as the readme describes.

Dependencies

Install these first, or the mod will not work:

ReturnOfModding-ReturnOfModdingRoRRModdingToolkit-RoRR_Modding_ToolkitSmoothSpatula-TomlHelper

File & checksum

Filename
StagePrefabs-1.0.0.zip
File size
20.9 KiB