Mount Reconciler
Description
Decides what an action needs of an agent's seat, and stands the agent up when it needs to be on its feet. The action processor asks it once as each action starts, before the action itself runs, which is what lets an agent stay seated from one action to the next.
It finds action types by name in the action type collection, which the module registers as IActionTypeCollection. No action id is held in code.
Interface
| Type |
|---|
| IMountReconciler |
Inherits
| Type |
|---|
| N/A |
Properties
| Name | Type |
|---|---|
| actionTypes | IActionTypeCollection |
Public Methods
| Name | Parameters | Return Type | Description |
|---|---|---|---|
| MountReconciler | N/A | MountReconciler | A constructor which finds the action type collection through the module's services when it is first needed. |
| MountReconciler | IActionTypeCollection actionTypes | MountReconciler | A constructor for a given action type collection. |
| Reconcile | Action action, IAgentService agent | bool? | Stands the agent up if the action needs it to. Null while the dismount animation plays, true once the agent is where it should be. Never false. |
| RequiresDismount | Action action, IAgentService agent | bool | Whether the agent has to stand up before the action can run. |
| RequiresMount | Action action, Item item | bool | Whether the action's POI action is one the item performs seated. |
| IsPerformedMounted | Action action, Item goalItem | bool | Whether the action ends with the agent sitting down, as a Mount or as a seated POI action. |
| CanStayMountedFor | Action action, IAgentService agent | bool | Whether the item the agent is sitting on answers the action, so it can stay where it is. |
| Dismount | IAgentService agent, bool playTransition | bool? | Stands the agent up. Pass false to skip the dismount animation. Succeeds on an agent that is already standing. |
| ReleaseSeatReservation | IAgentService agent, Item mountItem | void | Gives up a seat the agent reserved on the item and never sat in. |
| GetMountedItem | IAgentService agent | Item | Returns the item the agent is sitting on, or null. |
| IsMountedOn | IAgentService agent, Item item | bool | Whether the agent is sitting on the item. |
| FindMissingActionTypes | IActionTypeCollection actionTypes | IEnumerable<string> | Static. The built-in action type names the collection lacks. The module logs each one as it starts. |
Standing an agent up from your own code
Dismount is the one place an agent is taken off its seat, so use it rather than calling the seat directly.
csharp
var reconciler = new MountReconciler();
if (reconciler.Dismount(agent, playTransition: false) == true)
{
// the agent is on its feet and back on the nav mesh
}
With playTransition left at true the call returns null until the seat's dismount animation has finished, so call it again on each update until it returns true.