Create Items - KonradHeinser/EBSGFramework GitHub Wiki

This comp allows you to add things into the world using a system similar to how create walls adds the temporary wall thingdefs (RaisedRocks) into the world. The basic comp looks like this:

        <comps>
            <li Class="EBSGFramework.CompProperties_AbilityCreateItems">
                <sendSkipSignal>True</sendSkipSignal> <!--This is just an example-->
                <thingPattern>
                    <li>
                        <thing>InsertDefNameHere</thing>
                    </li>
                </thingPattern>
            </li>
        </comps>

There are two major parts to deal with for this comp, the pattern and the settings. The way the pattern works is that it has a special list (the example above already has one item), and each item on that list belongs in a spot relative to the center (the item above just targets the center itself). Because there isn't really a better way for me to explain it, I recommend making a test ability if you're still confused, with a bunch of small items on the list to see where they end up (i.e. gold, silver, steel, plasteel, logs, etc.)

These are the tags that can exist in each list item:

  • relativeLocation : Default ( (0, 0) ) : How much to offset from the targeted location
  • thing : The thing to make
  • count : Default (1) : How many of the thing to add to the location
  • reservedForLargeThing : Default (False) : When true, the li won't need a thing, but will instead just be making sure the spot isn't taken
  • skipIfBlocked : Default (False) : When false, the location being filled or unstandable blocks the ability. Making this true allows for partial successes where this li will just be skipped

The second part is the settings, which for readability is recommended to all be above the thingPattern. Most of them are self explanatory due to their names, so most of them will not have an explanation. Forbidden ones will cause an li to not accept a location if said location has that condition, while required does the reverse. These are the options available:

  • sendSkipSignal : Default (True) : When true, using the ability around things like sleeping mechanoids can wake them up. It's recommended to leave this as true
  • pollutedForbidden : Default (False)
  • pollutedRequired : Default (False)
  • waterForbidden : Default (False)
  • waterRequired : Default (False)
  • roofForbidden : Default (False)
  • roofRequired : Default (False)
  • noPlants : Default (False)
  • noPushing : Default (False) : Normally this ability comp tries to just move loose items out of the way, but if this is true, loose items will just block the li
  • noBuildings : Default (True) : Blocks the li if anything Rimworld recognized as a building is already there. It's recommended to leave this as true

If the Spawn Baby Thing Comp is in use, you have one additional tag for use:

  • linkingHediff : A HediffDef that points to the other parent. Needs to be a HediffWithTarget or a class that inherits from that one

Example from SHG - Just the Radiomancer. All this ability does is create 10 radiation orbs on the target location

    <AbilityDef>
        <defName>SHG_Radiomancer_CondenseRadiation</defName>
        <label>condense radiation</label>
        <description>There was a description here.</description>
        <iconPath>Radiomancer/RadiationOrb/RadiationOrb_A</iconPath>
        <aiCanUse>False</aiCanUse>
        <cooldownTicksRange>100</cooldownTicksRange>
        <canUseAoeToGetTargets>False</canUseAoeToGetTargets>
        <displayGizmoWhileUndrafted>True</displayGizmoWhileUndrafted>
        <disableGizmoWhileUndrafted>False</disableGizmoWhileUndrafted>
        <hostile>false</hostile>
        <verbProperties>
            <verbClass>Verb_CastAbility</verbClass>
            <warmupTime>1</warmupTime>
            <range>24.9</range>
            <targetParams>
                <canTargetPawns>False</canTargetPawns>
                <canTargetBuildings>False</canTargetBuildings>
                <canTargetLocations>True</canTargetLocations>
                <canTargetPlants>False</canTargetPlants>
            </targetParams>
        </verbProperties>
        <descriptionHyperlinks>
            <ThingDef>SHG_RadiationOrb</ThingDef>
        </descriptionHyperlinks>
        <comps>
            <li Class="EBSGFramework.CompProperties_AbilityResourceCost">
                <resourceCost>0.50</resourceCost>
                <mainResourceGene>SHG_Archetypes_Radiomancer</mainResourceGene>
            </li>
            <li Class="EBSGFramework.CompProperties_AbilityCreateItems">
                <thingPattern>
                    <li>
                        <thing>SHG_RadiationOrb</thing>
                        <count>10</count>
                    </li>
                </thingPattern>
            </li>
        </comps>
    </AbilityDef>
⚠️ **GitHub.com Fallback** ⚠️