Table of Contents

Class TalkAction

Namespace
TinyLife.Actions
Assembly
Tiny Life.dll

TalkAction is a generic social action with a set of pre-defined parameters. Things like PersonalityType and Charisma automatically influence this interaction's FriendshipGain and GoBadlyChance. Create(string, Func<Person, float>, TalkSettings) should be used to create a talk action.

public class TalkAction : SocialAction, IGenericDataHolder
Inheritance
JsonTypeSafeGenericDataHolder
TalkAction
Implements
IGenericDataHolder
Inherited Members
JsonTypeSafeGenericDataHolder.GetDataKeys()
Extension Methods

Constructors

TalkAction(ActionType, ActionInfo)

Creates a new action with the given action information.

public TalkAction(ActionType type, ActionInfo info)

Parameters

type ActionType

The type for this action.

info ActionInfo

The information for this action.

Properties

Settings

The TalkAction.TalkSettings for this action, derived from its type's settings

protected TalkAction.TalkSettings Settings { get; }

Property Value

TalkAction.TalkSettings

Methods

AndThenOnCompleted(CompletionType)

MultiAction version of OnCompleted(CompletionType). This method gets called when the main action completes.

protected override void AndThenOnCompleted(CompletionType type)

Parameters

type CompletionType

The completion of the main action

Create(string, Func<Person, float>, TalkSettings)

A helper method to create a TalkAction, which is a very simple implementation of a SocialAction. The passed TalkAction.TalkSettings will be modified in this method by modifying its underlying Settings, including its CanExecute, Name, PassivePriority, and more.

public static ActionType.TypeSettings Create(string name, Func<Person, float> priority, TalkAction.TalkSettings settings)

Parameters

name string

The name of the action

priority Func<Person, float>

The passive priority of this action

settings TalkAction.TalkSettings

The additional settings for this action

Returns

ActionType.TypeSettings

A new TypeSettings instance with the given settings, which initializes a TalkAction when constructed

CreateFunny(string, Func<Person, float>, TalkSettings, int, int)

A helper method to create a TalkAction using Create(string, Func<Person, float>, TalkSettings), but with default settings applied for an action in the Funny category. The passed TalkAction.TalkSettings will be modified in this method, setting its GainedSkill to Humor, its RestoredNeed to Entertainment, modifying its GoBadlyChance to be lowered if the persoin is feeling Goofy, and more.

public static ActionType.TypeSettings CreateFunny(string name, Func<Person, float> priority, TalkAction.TalkSettings settings, int humorSkillGain = 10000, int humorSkillRequired = 0)

Parameters

name string

The name of the action

priority Func<Person, float>

The passive priority of this action

settings TalkAction.TalkSettings

The additional settings for this action

humorSkillGain int

The amount of Humor skill gain that this action should cause when successful. Defaults to 10000.

humorSkillRequired int

The level of Humor skill that this action requires to be able to be executed. Defaults to 0, which means no skill is required.

Returns

ActionType.TypeSettings

A new TypeSettings instance with the given settings, which initializes a TalkAction when constructed

CreateMean(string, Func<Person, float>, TalkSettings)

A helper method to create a TalkAction using Create(string, Func<Person, float>, TalkSettings), but with default settings applied for an action in the Mean category. The passed TalkAction.TalkSettings will be modified in this method, modifying its CanExecute delegate to check IsDislikedOrMean(ActionInfo, bool) as well.

public static ActionType.TypeSettings CreateMean(string name, Func<Person, float> priority, TalkAction.TalkSettings settings)

Parameters

name string

The name of the action

priority Func<Person, float>

The passive priority of this action

settings TalkAction.TalkSettings

The additional settings for this action

Returns

ActionType.TypeSettings

A new TypeSettings instance with the given settings, which initializes a TalkAction when constructed

CreateRomantic(string, Func<Person, float>, TalkSettings)

A helper method to create a TalkAction using Create(string, Func<Person, float>, TalkSettings), but with default settings applied for an action in the Romantic category. The passed TalkAction.TalkSettings will be modified in this method, modifying its CanExecute delegate to check IsReadyForRomance(ActionInfo, bool) as well, modifying its GoBadlyChance to be increased if the partner is already Dating someone else, and settings its FailEmotion to FailedRomance.

public static ActionType.TypeSettings CreateRomantic(string name, Func<Person, float> priority, TalkAction.TalkSettings settings)

Parameters

name string

The name of the action

priority Func<Person, float>

The passive priority of this action

settings TalkAction.TalkSettings

The additional settings for this action

Returns

ActionType.TypeSettings

A new TypeSettings instance with the given settings, which initializes a TalkAction when constructed

IsConversationCompleted()

SocialAction version of IsCompleted(). This method returns whether or not the conversation should be marked as completed. Note that this method is only called for the IsMain part of the conversation.

protected override CompletionType IsConversationCompleted()

Returns

CompletionType

Whether or not this conversation is completed

UpdateConversation(GameTime, TimeSpan, float)

SocialAction version of Update(GameTime, TimeSpan, float). This method is called every update frame during an active conversation for both conversation partners. By default, this method only increases ConversationTime.

protected override void UpdateConversation(GameTime time, TimeSpan passedInGame, float speedMultiplier)

Parameters

time GameTime

The game's time

passedInGame TimeSpan

The amount of time passed in game time

speedMultiplier float

The game speed multiplier, which represents how fast things should happen, which is usually determined by Speed

Events

OnEvaluate

An event that is invoked when EvaluateSimple(Action, Person, float, float) is called. A mod can subscribe to this event to change the outcome of any basic conversation.

public static event TalkAction.TalkSettings.EvaluationResult OnEvaluate

Event Type

TalkAction.TalkSettings.EvaluationResult

OnTalkFailure

An event that is invoked together with OnFailure, and it receives the Partner as an additional parameter. A mod can subscribe to this event to change the outcome of any basic conversation.

public static event Action<Action, Person> OnTalkFailure

Event Type

Action<Action, Person>

OnTalkSuccess

An event that is invoked together with OnSuccess, and it receives the Partner as an additional parameter. A mod can subscribe to this event to change the outcome of any basic conversation.

public static event Action<Action, Person> OnTalkSuccess

Event Type

Action<Action, Person>