Skip to content
XeoNovaDan edited this page Feb 22, 2020 · 4 revisions

Implementing Circadian Rhythms for animals:

The Nocturnal Animals mod adds a DefModExtension called NocturnalAnimals.ExtendedRaceProperties which contains a single field, bodyClock, that allows you to define the circadian rhythm that an animal has.

There are three possible values for this bodyClock field with their following effects:

Diurnal - The pawn sleeps through 10 PM to 6 AM

Nocturnal - The pawn sleeps through 11 AM to 7 PM

Crepuscular - The pawn sleeps through 10 PM to 2 AM, and through 11 AM to 3 PM

The following XML can be used as a template for giving animals circadian rhythms, which you would put in your mod's 'Patches' folder and replace YourAnimalDef with your animal's defName:

<Patch>

    <Operation Class="PatchOperationFindMod">
        <mods>
            <li>[XND] Nocturnal Animals</li>
        </mods>
        <match Class="PatchOperationAddModExtension">
            <xpath>/Defs/ThingDef[defName="YourAnimalDef`]</xpath>
            <value>
                <li Class="NocturnalAnimals.ExtendedRaceProperties">
                    <bodyClock>Diurnal</bodyClock>
                </li>
            </value>
        </match>
    </Operation>

</Patch>
Clone this wiki locally