GrabItemAction

Agent action that picks up an item by triggering its CarryInteraction. Resolves the item's Interactable component and uses the character's Interactor to start carrying it.

Definition

Namespace: Paragon.Townskeep.AgentSystem Assembly: Townskeep.dll

public class GrabItemAction : AgentAction

Inheritance: ActionAgentAction → GrabItemAction

Remarks

GrabItemAction is a synchronous action (returns Task.CompletedTask) that initiates a CarryInteraction on a target item. It bridges the agent AI system with the Interaction System — the agent "grabs" an item by interacting with it through the same interactor system that players use.

Execution Flow

spinner

Variable Binding

The item field is marked [Variable], meaning it is typically set by a preceding action in the sequence (e.g., WanderAction sets "Item" when it finds a shop item to purchase).

Quick Lookup

Goal
How

Grab an item via AI

Add GrabItemAction to an ActionSequence; ensure "Item" variable is set

Check interaction result

The CarryInteraction output is discarded (out _)

Fields

Field
Type
Access
Description

item

Item

[Variable] private

The target item to grab; bound from sequence variables

interactable

Interactable

private

Cached Interactable component from the item

Methods

OnBegin

If item is not null, caches its Interactable component for use in OnExecute().

OnExecute

Attempts to start a CarryInteraction with the item's Interactable. Returns synchronously — no frame waiting.

Returns: Task.CompletedTask — this action completes instantly.

Common Pitfalls

circle-exclamation
circle-exclamation
circle-exclamation
circle-exclamation

See Also

Last updated