Table of Contents

Class TimbnNpcSteps

Namespace
Timbn.GraveyardKeeperTwo.Core.Framework
Assembly
Timbn.GraveyardKeeperTwo.Core.dll

A list of things for a person to do in order. Build one in a block's Intro, LateIntro or Loop, return one from Decide(Func<TimbnNpc, TimbnNpcSteps?>) to pick a trip, or hand one to RunSteps(TimbnNpcSteps, Action?) to play it on command. A wait names its clock, game minutes that follow the game's speed or real seconds that do not.

public sealed class TimbnNpcSteps
Inheritance
TimbnNpcSteps
Inherited Members

Examples

steps
    .WalkNavmesh("npc_sim_village_right_side_road_34")
    .Walk("npc_sim_village_right_side_03")
    .WaitGameMinutes(45)
    .Walk("npc_sim_village_right_side_road_34")
    .WalkNavmesh("RT_herm_spawn");

Methods

Animate(string)

Plays an animation of the person's own, from TimbnGameIds.NpcAnimations such as TimbnGameIds.NpcAnimations.Herm.AdjustingJabbot. It keeps playing until their next walk.

public TimbnNpcSteps Animate(string trigger)

Parameters

trigger string

Returns

TimbnNpcSteps

ChainTrips(Func<TimbnNpc, TimbnNpcTrip?, TimbnNpcTrip?>)

Picks a trip off the origin and runs it, then asks again from where it ended, so trips can chain on without going back to the origin in between. The pick is called with no previous trip at the origin, and with the trip just finished after its body. Return a trip to run it (only its Leave part is skipped when it chains on), or null to stay put at the origin or to run the finished trip's Return. Once the next block is due no trip chains on, and the block waits for the walk home. A point claimed on the way is let go when the chain is over.

public TimbnNpcSteps ChainTrips(Func<TimbnNpc, TimbnNpcTrip?, TimbnNpcTrip?> pick)

Parameters

pick Func<TimbnNpc, TimbnNpcTrip, TimbnNpcTrip>

Returns

TimbnNpcSteps

Examples

.Loop(steps => steps
    .WaitGameMinutes(10, 30)
    .ChainTrips((npc, previous) => previous == null || Roll() < 0.4 ? PickTrip(npc) : null))

Decide(Func<TimbnNpc, TimbnNpcSteps?>)

Decides what to do when the step is reached, such as rolling for a trip, and runs the steps it returns before going on. Return null to do nothing. A point claimed during the trip is let go when it ends.

public TimbnNpcSteps Decide(Func<TimbnNpc, TimbnNpcSteps?> decide)

Parameters

decide Func<TimbnNpc, TimbnNpcSteps>

Returns

TimbnNpcSteps

Examples

.Loop(steps => steps
    .WaitGameMinutes(10, 30)
    .Decide(npc => npc.IsFree(Pond) && npc.Claim(Pond) ? new TimbnNpcSteps().Walk(Pond).WaitGameMinutes(45) : null))

Face(Direction)

Turns the person to face a direction.

public TimbnNpcSteps Face(Direction direction)

Parameters

direction Direction

Returns

TimbnNpcSteps

Face(Vector3)

Turns the person toward a spot, such as a grave, at whatever angle it lies.

public TimbnNpcSteps Face(Vector3 point)

Parameters

point Vector3

Returns

TimbnNpcSteps

FireEvent(string)

Fires an event of the person's own game script, such as Herm's go_home, and waits until the walk it starts ends.

public TimbnNpcSteps FireEvent(string eventName)

Parameters

eventName string

Returns

TimbnNpcSteps

GoToFreePoint(IReadOnlyList<string>, bool)

Claims a free point from a list and walks there, or puts the person there at once. When none is free the step does nothing and the log says why each one was blocked.

public TimbnNpcSteps GoToFreePoint(IReadOnlyList<string> points, bool teleport = false)

Parameters

points IReadOnlyList<string>

The points to choose from.

teleport bool

Puts the person on the point at once, such as when a block is joined late.

Returns

TimbnNpcSteps

GoToFreePoint(string, string?, bool)

Claims a free point from one of the game's life simulator groups and walks there, the points read from the game when the step runs. When none is free the step does nothing.

public TimbnNpcSteps GoToFreePoint(string groupId, string? prefix = null, bool teleport = false)

Parameters

groupId string

The group, from TimbnGameIds.Groups.

prefix string

Keeps only the points whose id starts with this, such as the tavern seats.

teleport bool

Puts the person on the point at once, such as when a block is joined late.

Returns

TimbnNpcSteps

RunCode(Action<TimbnNpc>)

Runs code of your own as a step.

public TimbnNpcSteps RunCode(Action<TimbnNpc> action)

Parameters

action Action<TimbnNpc>

Returns

TimbnNpcSteps

Teleport(string)

Puts the person on a point at once.

public TimbnNpcSteps Teleport(string pointId)

Parameters

pointId string

Returns

TimbnNpcSteps

Teleport(Vector3)

Puts the person on a spot at once, such as a door's landing, keeping the way they face.

public TimbnNpcSteps Teleport(Vector3 position)

Parameters

position Vector3

Returns

TimbnNpcSteps

WaitGameMinutes(float)

Stands still for a number of game minutes, skipped when the person found their claimed point taken.

public TimbnNpcSteps WaitGameMinutes(float minutes)

Parameters

minutes float

Returns

TimbnNpcSteps

WaitGameMinutes(float, float)

Stands still for a random number of game minutes between two, skipped when the person found their claimed point taken.

public TimbnNpcSteps WaitGameMinutes(float shortest, float longest)

Parameters

shortest float
longest float

Returns

TimbnNpcSteps

WaitRealSeconds(float)

Stands still for a number of real seconds whatever the game speed, such as a pause between the lines of a cutscene.

public TimbnNpcSteps WaitRealSeconds(float seconds)

Parameters

seconds float

Returns

TimbnNpcSteps

Walk(string)

Walks along the game's paths to a point by the shortest way, so name only the stops that matter.

public TimbnNpcSteps Walk(string pointId)

Parameters

pointId string

Returns

TimbnNpcSteps

WalkNavmesh(float, float)

Walks over the navmesh to a spot with no game point, given as its x and z, such as a corner of a room.

public TimbnNpcSteps WalkNavmesh(float x, float z)

Parameters

x float
z float

Returns

TimbnNpcSteps

WalkNavmesh(string)

Walks over the navmesh to a point, for stepping onto the paths from a spot they do not reach.

public TimbnNpcSteps WalkNavmesh(string pointId)

Parameters

pointId string

Returns

TimbnNpcSteps

WalkStraight(IReadOnlyList<Vector3>)

Walks in straight lines from corner to corner as one movement, turning at each corner without stopping, for a route with several bends such as a way along the graveyard paths. The person ends within 0.1 of the last corner, the game's own slack for a waypoint walk, so take an exact step onto a seat or a spot with WalkStraight(float, float) after it. Should the game's walker change, each corner is walked as its own straight step instead.

public TimbnNpcSteps WalkStraight(IReadOnlyList<Vector3> corners)

Parameters

corners IReadOnlyList<Vector3>

Returns

TimbnNpcSteps

WalkStraight(float, float)

Walks in a straight line to a spot given as its x and z, around nothing, for the short step onto a spot the navmesh leaves out, such as the seat of a placed bench. Walk the navmesh to the nearest ground first, and back off the same way.

public TimbnNpcSteps WalkStraight(float x, float z)

Parameters

x float
z float

Returns

TimbnNpcSteps