Die And Change Into Another Def - Vanilla-Expanded/VanillaExpandedFramework GitHub Wiki

<- Back

CompDieAndChangeIntoOtherDef adds a gizmo that the player can use if the creature is tamed that destroys the animal and spawns a different thing in the same position. Basically a controllable metamorphosis

        //A comp that displays a gizmo if the animal is tamed. When clicked, it destroys the animal and turns it into a different def

        public bool needsDiggableTerrain = false;
        public ThingDef defToChangeTo;
        public bool mustBeTamed = true;
        public string gizmoImage;
        public string gizmoLabel;
        public string gizmoDesc;

How do I use this code?

It is a comp class, so you just add it in XML in the <comps> tag. For example, this allows Awakened Nectarmaker dryads to turn into palms in VIE - Dryads

<comps>
	<li Class="VEF.AnimalBehaviours.CompProperties_DieAndChangeIntoOtherDef">
		<needsDiggableTerrain>true</needsDiggableTerrain>
		<gizmoImage>Things/Building/AmbrosiaPalm/AmbrosiaPalmA</gizmoImage>
		<gizmoLabel>VDE_TurnIntoPalm</gizmoLabel>
		<gizmoDesc>VDE_TurnIntoPalmDesc</gizmoDesc>
		<defToChangeTo>VDE_AmbrosiaPalm</defToChangeTo>
	</li>
</comps>
⚠️ **GitHub.com Fallback** ⚠️