Alter Xenotype on Use - KonradHeinser/EBSGFramework GitHub Wiki

This thing comp allows you to make usable things alter a pawn's xenotype similar to the Alter Xenotype Ability. If you are familiar with that comp, all the same options apply. You will still need the other normal usable comps to make it possible for players to activate it:

        <comps>
            <li Class="EBSGFramework.CompProperties_UseEffectAlterXenotype">
            </li>
        </comps>

These are the options available in the comp:

  • xenotypes : A weighted list that uses xenotype defNames as the tag, and the weight as the value
  • filth : A ThingDef to create around the pawn when the comp triggers
  • filthCount : Default (4-7) : How many of the filth to create, if filth is used
  • setXenotype : Default (True) : While true, most old genes are removed, with the only exceptions being hair and skin color endogenes. When false, only genes that are incompatible with genes from the new xenotype are removed, creating a type of hybrid that still uses the new xenotype's name
  • sendMessage : Default (True) : Send a message when the genes are overwritten
  • prerequisites : A special item that limits who can use the item
    • hasAnyOfHediffs : List of HediffDefs that the pawn must have any one of
    • hasAllOfHediffs : List of HediffDefs that the pawn must have all of
    • hasNoneOfHediffs : List of HediffDefs that the pawn must have none of
    • hasAnyOfGenes : List of GeneDefs that the pawn must have any one of
    • hasAllOfGenes : List of GeneDefs that the pawn must have all of
    • hasNoneOfGenes : List of GeneDefs that the pawn must have none of
    • isAnyOfXenotype : List of XenotypeDefs that the pawn must be one of
    • isNoneOfXenotype : List of XenotypeDefs that the pawn must not be one of

This example has a 98% chance of turning the user into a sanguophage, and a 1% chance of turning them into a hussar and neanderthal. Because setXenotype is set to False, most of their old genes will remain as long as they are not incompatible with one of the new xenotype's genes:

    <ThingDef ParentName="ResourceBase">
        <defName>SanguophageSerum</defName>
        <label>sanguophage serum</label>
        <description>A serum that attempts to turn the user into a mix of their current xenotype and a target xenotype.</description>
        <stackLimit>10</stackLimit>
        <graphicData>
            <texPath>Things/Item/Resource/DeathrestCapacitySerum</texPath>
            <graphicClass>Graphic_Single</graphicClass>
        </graphicData>
        <statBases>
            <MaxHitPoints>60</MaxHitPoints>
            <MarketValue>1000</MarketValue>
            <DeteriorationRate>5</DeteriorationRate>
            <Mass>0.50</Mass>
            <Flammability>0.7</Flammability>
        </statBases>
        <thingCategories>
            <li>Drugs</li>
        </thingCategories>
        <comps>
            <li Class="CompProperties_Usable">
                <useJob>UseArtifact</useJob>
                <useLabel>Use {0_label}</useLabel>
                <showUseGizmo>true</showUseGizmo>
            </li>
            <li Class="EBSGFramework.CompProperties_UseEffectAlterXenotype">
                <setXenotype>False</setXenotype>
                <xenotypes>
                    <Sanguophage>98</Sanguophage>
                    <Hussar>1</Hussar>
                    <Neanderthal>1</Neanderthal>
                </xenotypes>
            </li>
            <li Class="CompProperties_UseEffectPlaySound">
                <soundOnUsed>DeathrestCapacitySerum_Consume</soundOnUsed>
            </li>
            <li Class="CompProperties_UseEffectDestroySelf" />
        </comps>
        <thingSetMakerTags>
            <li>RewardStandardHighFreq</li>
        </thingSetMakerTags>
    </ThingDef>
⚠️ **GitHub.com Fallback** ⚠️