NeedType - Ellpeck/TinyLifeExampleMod Wiki

Tiny Life


NeedType Class

A need is a desire that a Person can have to a given extent.
To register a custom need type, use Register(NeedType).

public class NeedType

Inheritance System.Object 🡒 NeedType


NeedType.NeedType(string, Func<Person,float>, Func<Person,ActionType>, Func<Person,TimeSpan>, float) Constructor

Instantiates a new need type with the given settings

public NeedType(string name, System.Func<TinyLife.Objects.Person,float> passiveReduction, System.Func<TinyLife.Objects.Person,TinyLife.Actions.ActionType> needLowAction=null, System.Func<TinyLife.Objects.Person,System.TimeSpan> needLowTime=null, float solveImportance=0f);


name System.String
The name of this need

passiveReduction System.Func<Person,System.Single>
The amount that this need instance's Value is reduced by automatically every update frame

needLowAction System.Func<Person,ActionType>
The action that is executed when this need's value is very low

needLowTime System.Func<Person,System.TimeSpan>
The amount of in-game time until needLowAction is enqueued

solveImportance System.Single
The priority for solving this need over other needs, where higher numbers are more urgent


NeedType.Name Field

The name of this need.
Used for Localization purposes and saving to disk.

public readonly string Name;

Field Value


NeedType.NeedLowAction Field

The ActionType that is constructed and executed when this need type's Value is very low

public readonly Func<Person,ActionType> NeedLowAction;

Field Value


NeedType.NeedLowTime Field

The amount of in-game time that needs to pass until NeedLowAction is constructed and enqueued

public readonly Func<Person,TimeSpan> NeedLowTime;

Field Value


NeedType.PassiveReduction Field

The amount that a need instance's Value is reduced by automatically every update frame

public readonly Func<Person,float> PassiveReduction;

Field Value


NeedType.SolveImportance Field

The priority for solving this need over other needs, where higher numbers represent a more urgent need.
This value defaults to 0, meaning it has no special importance.

public readonly float SolveImportance;

Field Value


NeedType.Types Field

A list of all of the need types that are currently registered.
Register custom need types using Register(NeedType).

public static readonly IList<NeedType> Types;

Field Value



NeedType.Register(NeedType) Method

Register the NeedType specified to the Types dictionary

public static TinyLife.NeedType Register(TinyLife.NeedType type);


type NeedType
The need type to register


The need typep passed, for chaining