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, IEnumerable<Type>, IEnumerable<Type>)

Creates a new goal trigger with the given settings.

public GoalTrigger(string name, IEnumerable<Type> validObjects, IEnumerable<Type> validGoals)

Parameters

name string

This goal trigger's name.

validObjects IEnumerable<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 IEnumerable<Type>

A set of types that determine which values are valid 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. This goal trigger supports the Action object type and the ConditionedGoal, AmountGoal and DistinctGoal<T> of type Action goal types.

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. This goal trigger supports the Action object type and the ConditionedGoal, AmountGoal and DistinctGoal<T> of type Action goal types.

public static readonly GoalTrigger ActionEnded

Field Value

GoalTrigger

ActionUpdate

A goal trigger for when an Action is updated. This goal trigger supports the Action object type and the TimedGoal goal type.

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). This goal trigger supports the Project, Furniture, Action, Job and LotEmployment.Instance object types and the ConditionedGoal and AmountGoal goal types.

public static readonly GoalTrigger EarnMoney

Field Value

GoalTrigger

EmotionGained

A goal trigger for when a EmotionModifier is added to a Person using AddEmotion(EmotionModifier, int, TimeSpan, IEmotionSource, bool). This goal trigger supports the EmotionModifier.Instance object type and the ConditionedGoal, AmountGoal and DistinctGoal<T> of type EmotionModifier goal types.

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. This goal trigger supports the EmotionModifier.Instance object type and the ConditionedGoal, AmountGoal and DistinctGoal<T> of type EmotionModifier goal types.

public static readonly GoalTrigger EmotionLost

Field Value

GoalTrigger

FoodEaten

A goal trigger for when a FoodType item is eaten by a Person in InvokeOnEaten(ActionInfo, FoodTypedItem). This goal trigger supports the FoodTypedItem object type and the ConditionedGoal, AmountGoal and DistinctGoal<T> of type FoodTypedItem goal types.

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). This goal trigger supports the Furniture object type and the ConditionedGoal, AmountGoal and DistinctGoal<T> of type Furniture goal types.

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. This goal trigger supports the Person object type and the TimedGoal and ConditionedGoal goal types.

public static readonly GoalTrigger PersonUpdate

Field Value

GoalTrigger

ProjectCompleted

A goal trigger for when a Project is marked as completed in OnCompleted(). This goal trigger supports the Project object type and the ConditionedGoal, AmountGoal and DistinctGoal<T> of type Project goal types.

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 List<Type> ValidObjects

Field Value

List<Type>

ValidValues

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

public readonly List<Type> ValidValues

Field Value

List<Type>

Methods

Equals(object)

Determines whether the specified object is equal to the current object.

public override bool Equals(object obj)

Parameters

obj object

The object to compare with the current object.

Returns

bool

true if the specified object is equal to the current object; otherwise, false.

Equals(GoalTrigger)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(GoalTrigger other)

Parameters

other GoalTrigger

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

GetHashCode()

Serves as the default hash function.

public override int GetHashCode()

Returns

int

A hash code for the current object.

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.