Skip to content

TileMutatorExtension

juanosarg edited this page May 30, 2026 · 4 revisions

<- Back

IMPORTANT: This requires a feature to be toggled, learn how here: OptionalFeatures

TileMutatorExtension is a def extension that adds a few custom behaviours for the tile mutators added by Odyssey.

      //This is used by TileMutatorWorker_ExtraAnimal
      public List<PawnKindDefAndChance> forcedPawnKindDefs;

      //This is used by TileMutatorWorker_GenericSpawner
      public ThingDef thingToSpawn;
      public IntRange thingToSpawnAmount;
      public List<TerrainDef> terrainValidation;
      public bool allowWater = true;

      //These are used by TileMutatorWorker_GenericPrefabSpawner
      public List<PrefabDef> prefabsToSpawn;
      public IntRange prefabsToSpawnAmount = new IntRange(1, 1);
      public int minSeparationBetweenPrefabs = 10;

      //These are used by TileMutatorWorker_GenericKCSGSpawner
      public List<KCSG.StructureLayoutDef> KCSGStructuresToSpawn;
      public IntRange KCSGStructuresToSpawnAmount = new IntRange(1, 1);
      public int minSeparationBetweenKCSGStructures = 10;

      //These are used by TileMutatorWorker_TerrainSwapper
      public TerrainDef terrainToSwap;
      public TerrainDef terrainToSwapTo;

      public int mapSizeOverrideX = -1;
      public int mapSizeOverrideZ = -1;
      public float mapSizeMultiplier = 1;

      public float deepOresMultiplier = 1;

      public float diseaseMTBMultiplier = 1;

      public float movementDifficultyOffset = 0;

      //This value is used by TileMutatorWorker_River
      public int riverbankSizeMultiplier = 1;

      //This value is used by TileMutatorWorker_PlantsWithCommonality
      public List<PlantsWithCommonality> plantDefsWithCommonality;

      //This value only affects VE Helixien Gas
      public int extraDeepHelixienGasDeposits = 0;

      //This value only affects VE Furniture - Power
      public float tideStrengthMultiplier = 1;

PawnKindDefAndChance and PlantsWithCommonality are wrapper classes:

    public class PawnKindDefAndChance
    {
        public PawnKindDef forcedPawnKindDef;
        public float forcedPawnKindDefChance;
    }
    public class PlantsWithCommonality
    {
        public ThingDef plantDef;
        public float commonality;
    }

How do I use this code?

This Def Extension is added to the TileMutatorDef of the tile mutator you want to add them to.

If you aren't sure if the TileMutatorDef ALREADY has an extension (for example, if you think another mod will add their own), always use XPATH (xml patching) to add an extension, as there is already a PatchOperationAddModExtension to ensure they don't collide.

For example, on Vanilla Landmarks Expanded "domesticated escapees" tile mutator:

<modExtensions>
	<li Class="VEF.Maps.TileMutatorExtension">
		<forcedPawnKindDefs>
			<li>
				<forcedPawnKindDef>Chicken</forcedPawnKindDef>
				<forcedPawnKindDefChance>0.1</forcedPawnKindDefChance>
			</li>
			<li>
				<forcedPawnKindDef>Cow</forcedPawnKindDef>
				<forcedPawnKindDefChance>0.1</forcedPawnKindDefChance>
			</li>
			<li>
				<forcedPawnKindDef>Pig</forcedPawnKindDef>
				<forcedPawnKindDefChance>0.1</forcedPawnKindDefChance>
			</li>
		</forcedPawnKindDefs>
	</li>
</modExtensions>

Clone this wiki locally