Pawn Need Chargers - KonradHeinser/EBSGFramework GitHub Wiki
This building thingClass allows you to make buildings that can recover or drain a pawn's needs and/or the resource levels of DRGs. This requires both a special thingClass and the EBSGExtension:
<thingClass>EBSGFramework.Building_PawnNeedCharger</thingClass>
<modExtensions>
<li Class="EBSGFramework.EBSGExtension">
</li>
</modExtensions>
At least one of these lists of items must be used for this building to function:
- needOffsetsPerHour : List of items that designates needs to be offset
- need : The need to offset. If left blank, a random one will be picked. If all are left blank or with negative offsets, then pawns will never use the building automatically unless it is for a DRG
- offset : The amount to offset by. If negative and need is not random, it will be treated like a cost, and stop the pawn from using it if the relevant need is too low or disabled
- resourceOffsetsPerHour : List of items that designates DRGs to offset
- gene : The main resource gene in question
- offset : The amount to offset it by. If negative, then it will be treated like a cost, so pawns with insufficient resource or without the gene will not be able to use the building
If you have negative offsets but don't want them to stop the pawn from using the building when their need is low or disabled, you can use the following tags within the extension itself:
- negativeNeedOffsetsAreNotCosts : Default (False)
- negativeResourceOffsetsAreNotCosts : Default (False)
These two tags only take effect if you include the comp class CompProperties_WasteProducer in the building comps:
- wastePerHourOfUse : Default (0.0) : How many waste packs to make for each total hour of use. Progress to a waste pack is saved between uses
- wasteProducedEffecter : EffecterDef that is used when the waste is fully produced
For the final few tags, these are the options available for creating special effects or sounds. Because their names more or less explain their purpose, I won't attempting to add more fluff in the form of descriptions, though if one is confusing I recommend trying to add them to one of your buildings to see/hear the effects:
- startSound
- sustainerSound
- chargeMote
- chargeMotePulse
This example recovers the pawn's food need and the Radiation Resource from SHG - Just the Radiomancer
<ThingDef ParentName="BuildingBase">
<defName>EBSG_FoodReplenisher</defName>
<label>food replenisher</label>
<description>A food replenishing building that looks suspiciously like a mech recharger.</description>
<thingClass>EBSGFramework.Building_PawnNeedCharger</thingClass>
<tickerType>Normal</tickerType>
<altitudeLayer>Building</altitudeLayer>
<hasInteractionCell>true</hasInteractionCell>
<canOverlapZones>false</canOverlapZones>
<designationCategory>Production</designationCategory>
<uiOrder>2410</uiOrder>
<drawerType>MapMeshAndRealTime</drawerType>
<graphicData>
<texPath>Things/Building/Production/BasicRecharger</texPath>
<graphicClass>Graphic_Multi</graphicClass>
<drawSize>(2.9,1.25)</drawSize>
<shadowData>
<volume>(2.9, 0.5, 0.9)</volume>
</shadowData>
</graphicData>
<interactionCellOffset>(0,0,1)</interactionCellOffset>
<passability>PassThroughOnly</passability>
<statBases>
<MaxHitPoints>150</MaxHitPoints>
<WorkToBuild>8000</WorkToBuild>
<Mass>25</Mass>
<Flammability>0.5</Flammability>
</statBases>
<size>(3,1)</size>
<fillPercent>0.3</fillPercent>
<building>
<ai_chillDestination>false</ai_chillDestination>
</building>
<costList>
<Steel>125</Steel>
<ComponentIndustrial>1</ComponentIndustrial>
</costList>
<comps>
<li Class="CompProperties_Power">
<compClass>CompPowerTrader</compClass>
<basePowerConsumption>200</basePowerConsumption>
</li>
<li Class="CompProperties_Flickable"/>
<li Class="CompProperties_Forbiddable"/>
</comps>
<modExtensions>
<li Class="EBSGFramework.EBSGExtension">
<needOffsetsPerHour>
<li>
<need>Food</need>
<offset>0.5</offset> <!--Only takes 2 hours to satisfy most fully grown pawns-->
</li>
</needOffsetsPerHour>
<resourceOffsetsPerHour>
<li>
<gene>SHG_Archetypes_Radiomancer</gene>
<offset>1</offset>
</li>
</resourceOffsetsPerHour>
</li>
</modExtensions>
</ThingDef>