Skip to content

TransformThing

flango edited this page Mar 2, 2023 · 2 revisions

🟡 TODO: Properly despawn creatures when transforming into items.

×× Transform one thing into another ××

Lets you create your own ability which can transform one type of thing (item or creature) into another.

preview


Performance impact: 🟩 None (?)

Type: Ability Class, Comp

XML Node: AbilityDef/abilityClass


Example:

<Defs>
  <AbilityDef>
    <abilityClass>flangoCore.Ability_Transform</abilityClass>
	
    <!-- Change these to your likings -->
    <defName>fc_TransformCreature</defName>
    <label>transform creature</label>
    <description>Changes one creature into another.</description>
	
    <!-- 
        CastAbilityOnThing - ranged, 
        CastAbilityOnThingMelee - pawn will walk up to a creature 
    -->
    <jobDef>CastAbilityOnThing</jobDef>
	
    <stunTargetWhileCasting>True</stunTargetWhileCasting>
    <showPsycastEffects>False</showPsycastEffects>
	
    <!-- UI -->
    <iconPath>UI/TransformThing</iconPath>
    <displayGizmoWhileUndrafted>True</displayGizmoWhileUndrafted>
    <disableGizmoWhileUndrafted>False</disableGizmoWhileUndrafted>
    <hotKey>Misc12</hotKey>
    <uiOrder>2</uiOrder>
	
    <!-- probably not required if it's bound to an ideo role -->
    <!-- Memes and Precepts --> 
    <!--
    <requiredMemes>
        <li>AnimalPersonhood</li>
    </requiredMemes>
    -->
	
    <groupDef MayRequire="Ludeon.Rimworld.Ideology">MultiRole</groupDef>
    <overrideGroupCooldown>True</overrideGroupCooldown>
    <cooldownTicksRange>1000</cooldownTicksRange>
	
    <warmupSound>ShipReactor_Ambience</warmupSound> <!-- Ability start sound -->
	
    <statBases>
      <Ability_Duration>0</Ability_Duration>
      <!--<Ability_EffectRadius>10</Ability_EffectRadius>--> <!-- For AoE abilities -->
    </statBases>
    <verbProperties>
        <verbClass>Verb_CastAbility</verbClass> 
        <drawAimPie>False</drawAimPie>
        <range>12</range>
        <warmupTime>1.5</warmupTime>
        <requireLineOfSight>True</requireLineOfSight>
        <targetParams>
            <!--<canTargetPawns>true</canTargetPawns>
            <canTargetAnimals>true</canTargetAnimals>
            <canTargetHumans>true</canTargetHumans>
            <canTargetMechs>true</canTargetMechs>--> <!-- true by default -->
		
            <canTargetLocations>true</canTargetLocations>
            <canTargetBuildings>false</canTargetBuildings>
        </targetParams> 
    </verbProperties>
    <comps>
      <li Class="flangoCore.CompProperties_AbilityTransform">
	  
        <optionsIconPath>UI/OptionsIcon</optionsIconPath> <!-- Add an icon here if there are multiple options -->
        <resetIconPath>UI/ResetIcon</resetIconPath> <!-- Add an icon here if there are multiple options -->
		
        <canApplyTo>
            <li>Pig</li>
            <li>Hare</li>
            <li>Human</li>
            <li>ComponentIndustrial</li>
        </canApplyTo>
		
        <transformOptions>
            <li>
                <label>Transform into a cow</label>
                <thingDef>Cow</thingDef>
                <faction>Neutral</faction>
                <iconPath>UI/TransformThingToCow</iconPath>
            </li>
            <li>
                <label>Transform into a chicken</label>
                <thingDef>Chicken</thingDef>
                <faction>Player</faction>
                <iconPath>UI/TransformThing</iconPath>
            </li>
            <li>
                <label>Transform into a rat</label>
                <thingDef>Rat</thingDef>
                <faction>Enemy</faction>
                <iconPath>UI/TransformThingToRat</iconPath>
            </li>
            <li>
                <label>Transform into gold</label>
                <thingDef>Gold</thingDef>
                <requiredStackCount>10</requiredStackCount>
                <resultStackCount>10</resultStackCount>
                <iconPath>UI/TransformThingToRat</iconPath>
            </li>
        </transformOptions> 
        <flecks>
            <li>
                <fleckDef>LightningGlow</fleckDef>
            </li>
            <li>
                <fleckDef>SparkFlash</fleckDef>
                <scaleRange>2~3</scaleRange>
            </li>
            <li>
                <fleckDef>BloodSplashLong</fleckDef>
                <randomRotation>true</randomRotation>
            </li>
        </flecks>
      </li>
    </comps>
  </AbilityDef>
</Defs>

Uses FleckProps in <flecks> - More about FleckProps here...

🦩 Home

🚧 - 404 Page not found.
🖼 - Preview needed.

🟡 - Works but has some TODOs.
🟠 - Basic functionality implemented.
🔴 - Not working properly.
❓ - Not tested.


--== XML ==--

💡 Abilities

General

Ability Givers

Equipment Abilities

🟡 Should recode some stuff 🟡

🌳 Skill Trees

🟠 WIP, work/kill XP gain not implemented 🟠

Defs

Comps

🏘 Buildings

⚙ Comps

🏹 Equipment

General

Weapons

Projectiles

🧪 Hediffs

🧍‍♂‍ Pawn behaviors

📊 Stats

🎲 Misc

🧔 Vanilla Expanded

✨ Debug (Dev Mode)


--== C# ==--

📂 Shared Classes

🧬 Patches


Clone this wiki locally