Table of Contents

Class GoalTrigger

Namespace
TinyLife.Goals
Assembly
Tiny Life.dll

A goal trigger is used by AutoTriggerGoal instances to determine whether they should be triggered. Goal triggers are compared only by their Name, so mods can add goal triggers that work for other mods without explicit compatibility.

public class GoalTrigger : IEquatable<GoalTrigger>
Inheritance
GoalTrigger
Implements
Inherited Members
Extension Methods

Constructors

GoalTrigger(string, Type[], Type[])

Creates a new goal trigger with the given settings.

public GoalTrigger(string name, Type[] validObjects, Type[] validGoals)

Parameters

name string

This goal trigger's name.

validObjects Type[]

A set of types that determine which objects are valid trigger objects for this goal trigger. This validates the obj parameter of Trigger(IGoalTriggerable, object, GoalTrigger, params object[]).

validGoals Type[]

A set of types that determine which values are valud trigger values for this goal trigger. This validates the values parameter of Trigger(IGoalTriggerable, object, GoalTrigger, params object[]).

Fields

ActionCompleted

A goal trigger for when an Action is completed succesfully (the result is Completed) by a Person.

public static readonly GoalTrigger ActionCompleted

Field Value

GoalTrigger

ActionEnded

A goal trigger for when an Action is completed in any way (the CompletionType doesn't matter) by a Person.

public static readonly GoalTrigger ActionEnded

Field Value

GoalTrigger

ActionUpdate

A goal trigger for when an Action is updated.

public static readonly GoalTrigger ActionUpdate

Field Value

GoalTrigger

EarnMoney

A goal trigger for when a Person earns money through an Action or Project. By default, this trigger is used in EarnMoney(float, object).

public static readonly GoalTrigger EarnMoney

Field Value

GoalTrigger

EmotionGained

public static readonly GoalTrigger EmotionGained

Field Value

GoalTrigger

EmotionLost

A goal trigger for when a EmotionModifier is removed from a Person in RemoveEmotion(EmotionModifier) or when it runs out.

public static readonly GoalTrigger EmotionLost

Field Value

GoalTrigger

FoodEaten

A goal trigger for when a FoodType item is eaten by a Person in InvokeOnEaten(Action, FoodTypedItem).

public static readonly GoalTrigger FoodEaten

Field Value

GoalTrigger

FurnitureCreated

A goal trigger for when a Furniture item is created by a Person. By default, this trigger is used in SetCreator(Person, bool).

public static readonly GoalTrigger FurnitureCreated

Field Value

GoalTrigger

Name

This goal trigger's name.

public readonly string Name

Field Value

string

PersonUpdate

A goal trigger for when a Person's Update(GameTime, TimeSpan, float) method is called.

public static readonly GoalTrigger PersonUpdate

Field Value

GoalTrigger

ProjectCompleted

A goal trigger for when a Project is marked as completed in OnCompleted().

public static readonly GoalTrigger ProjectCompleted

Field Value

GoalTrigger

ValidObjects

A set of types that determine which objects are valid trigger objects for this goal trigger. This validates the obj parameter of Trigger(IGoalTriggerable, object, GoalTrigger, params object[]).

public readonly Type[] ValidObjects

Field Value

Type[]

ValidValues

A set of types that determine which values are valud trigger values for this goal trigger. This validates the values parameter of Trigger(IGoalTriggerable, object, GoalTrigger, params object[]).

public readonly Type[] ValidValues

Field Value

Type[]

Methods

Equals(object)

public override bool Equals(object obj)

Parameters

obj object

Returns

bool

Equals(GoalTrigger)

public bool Equals(GoalTrigger other)

Parameters

other GoalTrigger

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int

IsObjectCompatible(Type)

Returns whether an object of the given objType is compatible with this goal trigger, based on ValidObjects. This validates the obj parameter of Trigger(IGoalTriggerable, object, GoalTrigger, params object[])

public bool IsObjectCompatible(Type objType)

Parameters

objType Type

The type of the object.

Returns

bool

Whether the object is compatible.

IsValueCompatible(Type)

Returns whether a value of the given valueType is compatible with this goal trigger, based on ValidValues. This validates the values parameter of Trigger(IGoalTriggerable, object, GoalTrigger, params object[])

public bool IsValueCompatible(Type valueType)

Parameters

valueType Type

The type of the value.

Returns

bool

Whether the value is compatible.