Skip to content

CompProperties_Resource

KylianB edited this page Jul 22, 2022 · 4 revisions

This comp can be added to any building. It's the most basic comp that exist within the framework. It allows said building to connect to other buildings in the net.

Basic

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

<li Class="PipeSystem.CompProperties_Resource">
  <!-- Accept a PipeNetDef -->
  <pipeNet>TestNet</pipeNet>
  <!-- If you plan on using the premade sustainer methods -->
  <sustainer>SoundDef</sustainer>
</li>

Advanced usage

If your building have this comp, and you want to access the PipeNet. Use the GetComp<CompResource>() method. Then you have access to:

public virtual PipeNet PipeNet
public virtual bool TransmitResourceNow
public Resource Resource
public PipeNetManager PipeNetManager

/// <summary>
/// Try spawn sustainer
/// </summary>
public void StartSustainer();

/// <summary>
/// End and remove sustainer
/// </summary>
public void EndSustainer();

/// <summary>
/// If have an ambient sound, and should be active now, maintain it
/// If it is null or ended, recreate it.
/// If it shouldn't make sound, end it and null it.
/// </summary>
/// <param name="check">Should make sound?</param>
public void UpdateSustainer(bool check);

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