Table of Contents

Anchor Mode

A companion's motion is relative to another entity's position, generally the player.

Anchors consist of a list of AnchorTargetData

The order matters as companion will try for anchors in order, and stop once a target is found for a given anchor mode. When no targets are found, fallback to Owner.

Sample

{
  "Action": "EditData",
  "Target": "mushymato.TrinketTinker/Tinker",
  "TargetField": [
    "{{ModId}}_Sample",
    "Motion"
  ],
  "Entries": {
    "Anchors": [
      {
        "Id": "<string unique id>",
        "Mode": "<enum anchor target>",
        "Range": <int search range>,
        "StopRange": <int stop range>,
        "Filters": [
          "<mode dependent filter 1>",
          "<mode dependent filter 2>",
          //...
        ],
        "RequiredAbilities": [
          "<ability class 1>",
          "<ability class 2>",
          //...
        ]
      },
      //...
    ]
  }
}

Structure

Property Type Default Notes
Id string same as Mode The Id of this anchor target, used for content patcher EditData.
Mode AnchorTarget Owner Anchor target, described below.
Range int 640 Search range in pixels, only switch anchor when the target is less than this far from owner.
StopRange int 0 Makes the companion stop moving towards anchor at this range (in pixels).
Filters List<string> null List of anchor mode specific filters, see the headings on each Mode for details. If not specified, then no filters have been implemented.
RequiredAbilities List<string>? mode dependent List of ability classes to check for to determine if this anchor should be enabled. Some modes have default values, which can be cleared by setting this value to null.

Monster

Anchor to nearest monster.

Filters: list of monsters to avoid targeting, based on their key in Data/Monsters.

RequiredAbilities: Default "Hitscan", "Projectile".

FarmAnimal

Anchor to nearest farm animal that has not been pet today.

NPC

Anchor to NPC.

Filters: list of NPCs to avoid targeting, based on their key in Data/Characters.

Forage

Anchor to nearest forageable item.

Filters: list of context tags to avoid harvesting, e.g. "category_flowers" (exclude flower category) or "color_orange season_summer" (exclude orange and summer). Each space separated sub list of tags act as AND while the overall list act as OR.

RequiredAbilities: Default "HarvestForage".

Stone

Anchor to nearest breakable stone.

RequiredAbilities: Default "HarvestStone".

Object

Anchor to nearest placed object. This is a superset of Stone and Forage, but also placed objects on the ground.

Crop

Anchor to nearest harvestable crop.

Filters: list of context tags to avoid harvesting, e.g. "category_flowers" (exclude flower category) or "color_orange season_summer" (exclude orange and summer). Each space separated sub list of tags act as AND while the overall list act as OR. For crops, only the main harvestable item is considered.

RequiredAbilities: Default "HarvestCrop".

Shakeable

Anchor to nearest shakeable bush/tree/fruit tree.

Filters: list of "Bush", "Tree", "FruitTree", indicating which of the 3 possible categories to avoid targeting.

RequiredAbilities: Default "HarvestShakeable".

TerrainFeature

Anchor to nearest terrain feature. This is a superset of Crop and Shakeable.

Owner

Anchor to the player who equipped the trinket. Range has no effect. This is the default anchor.