NeedType - Ellpeck/TinyLifeExampleMod Wiki

Tiny Life

TinyLife

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

Constructors

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);

Parameters

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

Fields

NeedType.Name Field

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

public readonly string Name;

Field Value

System.String

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

System.Func<Person,ActionType>

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

System.Func<Person,System.TimeSpan>

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

System.Func<Person,System.Single>

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

System.Single

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

System.Collections.Generic.IList<NeedType>

Methods

NeedType.Register(NeedType) Method

Register the NeedType specified to the Types dictionary

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

Parameters

type NeedType
The need type to register

Returns

NeedType
The need typep passed, for chaining