Skip to content

GasBase

NachoToast edited this page Mar 24, 2025 · 4 revisions

GasBase is an abstract GasDef that defines some baseline properties. Unless you gas is really unique, you should probably inherit from this (via the ParentName="GasBase" attribute).

Below is the XML definition for GasBase (see source).

<!-- 1.5/Defs/Bases.xml -->
<?xml version="1.0" encoding="utf-8"?>
<Defs>
    <SCGF.GasDef Name="GasBase" Abstract="True">
        <dissipationRate>3</dissipationRate>
        <diffuses>true</diffuses>

        <!-- Apply to organic pawns only. -->
        <appliesTo>
            <li Class="SCGF.Filters.Organic" />
        </appliesTo>

        <!-- Consider pawns immune if they are wearing protective apparel that covers at least the mouth. -->
        <immunityWhen>
            <li Class="SCGF.Filters.ProtectiveApparel">
                <types>
                    <li>Mouth</li>
                </types>
            </li>
        </immunityWhen>
    </SCGF.GasDef>
</Defs>

If you want to create a gas that overrides some of these rules, I recommend setting the Inherit="False" attribute on relevant subnodes instead of removing the ParentName="GasBase" attribute.

Example 1 (Mustard Gas)

Mustard gas targets the skin, not just the lungs. So while the GasDef still inherits from GasBase, it overrides the <immunityWhen> value to instead only consider a pawn immune if they are wearing full head and body protective apparel.

<?xml version="1.0" encoding="utf-8"?>
<Defs>
    <SCGF.GasDef ParentName="GasBase">
        <defName>MustardGas</defName>
        <label>mustard gas</label>
        <color>(255, 255, 0)</color>

        <immunityWhen Inherit="False">
            <li Class="SCGF.Filters.ProtectiveApparel">
                <types>
                    <li>Body</li>
                    <li>Head</li>
                </types>
            </li>
        </immunityWhen>

        <actions>
            <li Class="SCGF.Actions.ApplyHediff">
                <hediffDef>NachoToast_MustardGas</hediffDef>
                <severityPerTick>0.1</severityPerTick>
            </li>
            <li Class="SCGF.Actions.DoToxicDamage" />
        </actions>
    </SCGF.GasDef>
</Defs>

Example 2 (Tear Gas)

Tear gas targets the eyes as well as the lungs, so it overrides the <immunityWhen> value to only consider a pawn immune if they are wearing full face protective apparel.

<?xml version="1.0" encoding="utf-8"?>
<Defs>
    <SCGF.GasDef ParentName="GasBase">
        <defName>TearGas</defName>
        <label>tear gas</label>
        <color>(242, 162, 120)</color>

        <!-- Tear gas targets the eyes, not just the lungs, so pawns are only considered immune if they have full face protective covering. -->
        <immunityWhen Inherit="False">
            <li Class="SCGF.Filters.ProtectiveApparel">
                <types>
                    <li>Face</li>
                </types>
            </li>
        </immunityWhen>

        <actions>
            <li Class="SCGF.Actions.ApplyHediff">
                <hediffDef>NachoToast_TearGas</hediffDef>
                <severityPerTick>0.2</severityPerTick>
            </li>
        </actions>
    </SCGF.GasDef>
</Defs>

Example 3 (Mechanoid Gas)

This gas only targets mechanoids, and since mechanoids can't wear apparel, it also overrides the <immunityWhen> node to remove the unnecessary checks.

<?xml version="1.0" encoding="utf-8"?>
<Defs>
    <SCGF.GasDef ParentName="GasBase">

        <!-- ... -->

        <appliesTo Inherit="False">
            <li Class="SCGF.Filters.Mechanoids" />
        </appliesTo>
        
        <immunitWhen Inherit="False">

        <!-- ... -->

    </SCGF.GasDef>

Clone this wiki locally