Skip to main content

Retrofitforestmap Anr

Based on game build 714014 | Last updated: 2026-03-03

Overview

retrofitforestmap_anr is a mastersim-only component that performs deferred world modifications after initial world generation. It is typically attached to the world entity and triggers surface-level changes (e.g., spawning missing setpiece prefabs, adjusting ocean content, fixing tile/node misplacements) when OnPostInit is invoked. It does not modify the core world-generation code but applies transformations based on saved flags and world state during map loading. The component uses helper functions such as RetrofitNewContentPrefab, RemovePrefabs, and SpawnPrefab to modify the world imperatively.

Usage example

This component is automatically added to the world by the engine and does not require manual instantiation. A typical integration looks like this:

-- Example internal usage during world initialization (NOT user code)
local world = TheWorld
world:AddComponent("retrofitforestmap_anr")

-- Later, after world generation, the engine sets flags and calls OnPostInit():
world.components.retrofitforestmap_anr.retrofit_turnoftides = true
world.components.retrofitforestmap_anr.retrofit_catcoonden_deextinction = true
-- OnPostInit() is invoked automatically by the framework after load/save cycle.

Dependencies & tags

Components used:

  • scenariorunner (via terrariumchest)
  • winchtarget (to retrieve sunken objects)
  • inventory (to remove items)
  • submersible (to reposition objects on land)
  • heavyobstaclephysics (to enable floating exploit flag)
  • timer (to check TimerExists)
  • pearldecorationscore (to enable pearl scoring)
  • craftingstation (to adjust Pearl's known recipes)
  • undertile (for tile replacement)

Tags: Checks and applies tags including: structure, walkableplatform, lava, irreplaceable, playerghost, ghost, flying, player, character, animal, monster, giant, watersource, thorny, sculpture. Also adds tags like sandstorm to topology nodes.

Properties

PropertyTypeDefault ValueDescription
instEntitynil (assigned in constructor)The world entity that owns this component.
requiresresetbooleanfalseIndicates whether a world save/restart is needed after certain retrofits.
retrofit_part1booleanfalseFlag for early A New Reign content (Moonbase, Stagehand).
retrofit_artsandcraftsbooleanfalseFlag for missing Chess sculpture sketches.
retrofit_artsandcrafts2booleanfalseFlag to unlock chesspieces via event.
retrofit_cutefuzzyanimalsbooleanfalseFlag for Critter Lab and Bee Queen Hive.
retrofit_herdmentalitybooleanfalseFlag for Deer Spawning Grounds.
retrofit_againstthegrainbooleanfalseFlag for Lightning Bluff (Antlion/Oasis Lake).
retrofit_penguinicebooleanfalseFlag to mark mini glaciers for removal on dry-up.
retrofit_turnoftidesbooleanfalseFlag to populate ocean content (Turn of Tides).
retrofit_turnoftides_betaupdate1booleanfalseFlag to update nav grid.
retrofit_turnoftides_seastacksbooleanfalseFlag to balance seastacks (Cleanup/Repopulate).
retrofit_fix_sculpture_piecesbooleanfalseFlag to reposition detached sculpture heads/noses.
retrofit_saltybooleanfalseFlag to populate shoals, saltstacks (Salty Dog).
retrofit_shesellsseashellsbooleanfalseFlag to populate Wobster Dens.
retrofit_barnaclesbooleanfalseFlag to replace seastack spawners with barnacle plants.
retrofit_inaccessibleunderwaterobjectsbooleanfalseFlag to reposition inaccessible underwater salvageables.
retrofit_moonfissuresbooleanfalseFlag to add moon fissures near water.
retrofit_astralmarkersbooleanfalseFlag to add astral markers (moon altar).
retrofit_nodeidtilemap_secondpassbooleanfalseFlag to repopulate tile node IDs for lunar island.
retrofit_nodeidtilemap_thirdpassbooleanfalseFlag to repopulate tile node IDs for hermit island.
retrofit_removeextraaltarpiecesbooleanfalseFlag to remove erroneous moon altar pieces near 0,0,0.
retrofit_terraria_terrariumbooleanfalseFlag to add Terrarium Chest.
retrofit_catcoonden_deextinctionbooleanfalseFlag to add Catcoon Dens.
retrofit_alittledrama_contentbooleanfalseFlag to add Stage and Statue prefabs (A Little Drama).
retrofit_balatro_contentbooleanfalseFlag to add Balatro Machine (Balatro).
retrofit_daywalker_contentbooleanfalseFlag to remove old Daywalker entities from forest shard.
console_beard_turf_fixbooleanfalseFlag to replace Rift Moon turfs with Beard rugs if missing undertile data.
retrofit_junkyard_contentbooleanfalseFlag to add Junkyard prefabs (Junk Yard).
retrofit_junkyardv3_contentbooleanfalseFlag to reapply Junkyard fixes (second pass).
remove_rift_terraformers_fixbooleanfalseFlag to remove stale Rift Terraformers.
retrofit_otterdensbooleanfalseFlag to add Otter Dens.
sharkboi_ice_hazard_fixbooleanfalseFlag to remove ice hazards spawned off ocean.
rifts6_add_whirlpoolbooleanfalseFlag to spawn a large whirlpool in forest shard.
fix_pearl_eating_everythingbooleanfalseFlag to reset Pearl’s completed tasks if they were incorrectly eaten.
floating_heavyobstaclephysics_fixbooleanfalseFlag to enable deprecated floating exploit flag on heavy obstacles.
retrofit_missing_retrofits_generated_densitiesbooleanfalseFlag to fill missing prefab density tables for retrofits.
retrofit_enable_pearl_scorebooleanfalseFlag to enable Pearl’s decoration scoring.
hermitcrab_relocation_changebooleanfalseFlag to fix Pearl’s known recipes for relocation kit and shellweaver.

Main functions

OnPostInit()

  • Description: Executes all retrofits based on the component’s boolean flags. Each flag corresponds to a specific content addition, cleanup, or correction. Invoked automatically after world load if the component exists on the world entity.
  • Parameters: None.
  • Returns: Nothing.
  • Error states: Some operations may silently fail if prerequisite conditions are not met (e.g., no matching topology nodes). Logging indicates success/failure via print() calls.

OnSave()

  • Description: Returns an empty table, as all state flags are persisted via the component instance (handled automatically).
  • Parameters: None.
  • Returns: {} (table).

OnLoad(data)

  • Description: Loads and restores state flags from data. Flags are preserved across world saves/loads and used by OnPostInit.
  • Parameters:
    data (table | nil) — saved state from previous sessions. Key-value pairs map directly to the component’s flag properties.
  • Returns: Nothing.

Events & listeners

  • Listens to: None directly. The component uses inst:DoTaskInTime() to schedule delayed announces and the world save/rollback during requiresreset, but does not register ListenForEvent handlers.
  • Pushes:
    • ms_unlockchesspiece — fired with "pawn", "bishop", "rook", "knight", "muse", "formal" when retrofit_artsandcrafts2 is active.
    • ms_save — pushed when triggering a world save/rollback after a required reset.