Skip to content

CompProperties_ConvertResourceToThing

KylianB edited this page Oct 6, 2022 · 2 revisions

Take input from net, convert it to a thing pawn can haul and use.

Basic

Below, an example of the comp, the building do not need to tick.

<li Class="PipeSystem.CompProperties_ConvertResourceToThing">
  <pipeNet>VCHE_ChemfuelNet</pipeNet>
  <!-- ThingDef to spawn -->
  <thing>Chemfuel</thing>
  <!-- 1 spawned is 1*X removed in the net -->
  <ratio>X</ratio>
  <!-- Default max stack size, it won't output past that number -->
  <maxOutputStackSize>10</maxOutputStackSize>
</li>

You will also need to add to your def:

  • <thingClass>Building_Storage</thingClass>
  •  <building>
       <preventDeteriorationOnTop>true</preventDeteriorationOnTop>
       <ignoreStoredThingsBeauty>true</ignoreStoredThingsBeauty>
       <fixedStorageSettings>
         <filter>
           <disallowNotEverStorable>true</disallowNotEverStorable>
           <thingDefs>
             <li>Chemfuel</li>
           </thingDefs>
         </filter>
       </fixedStorageSettings>
       <defaultStorageSettings>
         <priority>Important</priority>
         <filter>
           <disallowNotEverStorable>true</disallowNotEverStorable>
           <thingDefs>
             <li>Chemfuel</li>
           </thingDefs>
         </filter>
       </defaultStorageSettings>
     </building>
  •  <inspectorTabs>
       <li>ITab_Storage</li>
     </inspectorTabs>
  • <surfaceType>Item</surfaceType>

Advanced usage

If your building have this comp. Use the GetComp<CompConvertToThing>() method. Then you have access to:

public bool CanOutputNow
public int MaxCanOutput
public Thing HeldThing

/// <summary>
/// Spawn X things
/// </summary>
/// <param name="amount">Amount to spawn</param>
public void OutputResource(int amount)

And everything inherited from CompProperties_Resource;

VFE Core

General Comp classes

General DefModExtensions

Item Processor

PipeSystem

Custom Structure Generation

Multi Verb Combat Framework - MVCF

Animal Behaviours

Genes

Apparel

Cuisine

Furniture

Plants

Deprecated

Clone this wiki locally