Create Items (Hediff) - KonradHeinser/EBSGFramework GitHub Wiki

This hediff comp allows for items to be spawned periodically, on the death of the pawn, and/or the removal of the hediff. Below is the initial portion of the comp class

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

These are the tags available for the comp:

  • intervalTicks : Default (2500~2500) : A range of ticks to delay by. Not needed if intervalThings is not used
  • intervalThings : A list of special lists that are spawned at the end of each interval
  • onDeathThings : A list of special lists that are spawned when the pawn dies
  • onRemovalThings : A list of special lists that are spawned when the hediff is removed
  • onDeathOrRemovalThings : A list of special lists that are spawned when the pawn dies or the hediff is removed

The list of special lists are a series of lists that will pick one of the options inside it when triggered (see the example at the bottom if it's still confusing). They are made with li's inside li's like so:

                <intervalThings>
                    <li>
                        <!--When interval is triggered, one of these two options would be picked-->
                        <li>
                        </li>
                        <li>
                        </li>
                    </li>
                    <li>
                        <!--And because this is in a separate li, it is always picked in addition to the above option-->
                        <li>
                        </li>
                    </li>
                </intervalThings>

The innermost li has the same options between the four lists of special lists that determine what is spawned, and when it is okay to spawn:

  • thing : The ThingDef to spawn
  • count : Default (1) : How many of the thing to try to spawn
  • chance : Default (1) : The chance that the spawn will actually occur when the option is picked
  • stuff : The ThingDef to make the spawn out of, if applicable
  • quality : Default (Normal) : The quality to make the item, if applicable. This is always statically set. The options are: Awful, Poor, Normal, Good, Excellent, Masterwork, and Legendary
  • linkingHediff : References another pawn for some part of the creation process. Needs to be a HediffWithTarget or a class that inherits from that one. Only of use if the created thing has the Spawn Baby Thing Comp
  • minSeverity : Default (0) : The minimum severity for this option to be considered. If this condition is not met, the code will attempt to provide something else in the same list
  • maxSeverity : Default (999) : The maximum severity allowed for this option to be considered. If this condition is not met, the code will attempt to provide something else in the same list
  • weight : Default (1) : How likely this will be picked compared to other options in the same list

This example will make wood and either steel or plasteel every 600 ticks. When the pawn dies, or if this hediff is removed, they will drop one more wood log:

    <HediffDef ParentName="EBSG_TestHediffBase">
        <defName>EBSG_ThingSpawner</defName>
        <comps>
            <li Class="EBSGFramework.HediffCompProperties_CreateItems">
                <intervalTicks>600</intervalTicks>
                <intervalThings>
                    <li>
                        <li>
                            <thing>Steel</thing>
                            <count>20</count>
                            <weight>9</weight>
                        </li>
                        <li>
                            <thing>Plasteel</thing>
                            <count>10</count>
                        </li>
                    </li>
                    <li>
                        <li><thing>WoodLog</thing></li>
                    </li>
                </intervalThings>
                <onDeathOrRemovalThings>
                    <li>
                        <li><thing>WoodLog</thing></li>
                    </li>
                </onDeathOrRemovalThings>
            </li>
        </comps>
    </HediffDef>
⚠️ **GitHub.com Fallback** ⚠️