Skip to content

Item Interactions

Overview

Item interactions define how items behave when used — attacks, block placement, consumption, tool use, dodge rolls, and more. Each interaction is a JSON object with a Type and an optional Next field that chains to the following step. This creates pipelines that can branch on conditions, deal damage, apply effects, play sounds, and spawn particles. Interaction files are referenced by ID from item definitions via the Interactions and InteractionVars fields.

File Location

Assets/Server/Item/Interactions/<Category>/<InteractionId>.json

Top-level and root interactions:

Assets/Server/Item/Interactions/Block_Primary.json
Assets/Server/Item/Interactions/Block_Secondary.json
Assets/Server/Item/Interactions/Dodge.json
Assets/Server/Item/Interactions/Stamina_Bar_Flash.json
Assets/Server/Item/RootInteractions/ — Root interaction entry points

Subcategories:

Interactions/Consumables/ — Food and potion consume conditions
Interactions/Weapons/ — Weapon attack chains (Axe, Bow, Club, etc.)
Interactions/Weapons/Common/Melee/ — Shared melee damage and selector
Interactions/Tools/ — Tool-specific interactions
Interactions/Block/ — Block break/attack interactions
Interactions/Dodge/ — Dodge roll interactions
Interactions/NPCs/ — NPC-triggered interactions
Interactions/Stat_Check/ — Stat-gating conditions

Schema

Core Interaction Fields

FieldTypeRequiredDefaultDescription
TypestringNo"Simple"Interaction type. See type list below.
Nextstring or objectNoThe next interaction to execute on success. Can be an interaction ID string or an inline interaction object.
Failedstring or objectNoThe interaction to execute when this one fails (used by Condition, UseBlock, PlaceBlock, etc.).
RunTimenumberNoDuration in seconds this interaction occupies in the chain timeline.
EffectsobjectNoEffects applied when this interaction executes successfully. See Effects fields below.
ParentstringNoInherits fields from the named interaction (template inheritance).

Interaction Types

TypeDescription
SimpleExecutes immediately with no logic, then proceeds to Next.
ConditionChecks one or more boolean conditions. Proceeds to Next on pass, Failed on fail.
MovementConditionBranches based on the entity’s movement direction (ForwardLeft, ForwardRight, Left, Right, BackLeft, BackRight).
UseBlockAttempts to interact with a targeted block. Falls through to Failed if no block is hit.
PlaceBlockPlaces the held block item at the target location.
SelectorSweeps a hitbox arc or volume to detect entities and blocks. Routes hits to HitEntity and HitBlock sub-interactions.
SerialExecutes a list of child interactions in sequence. Uses an Interactions array.
ApplyEffectApplies a gameplay effect by EffectId.
ReplaceReads a named variable (Var) and substitutes its value into the chain. Falls back to DefaultValue if the variable is unset and DefaultOk is true.

Condition Fields (Type: "Condition")

FieldTypeDescription
RequiredGameModestringRequires the entity to be in this game mode (e.g. "Adventure").
CrouchingbooleanIf set, requires (true) or forbids (false) crouching.
FlyingbooleanIf set, requires (true) or forbids (false) flying.

Selector Fields (Type: "Selector")

FieldTypeDescription
Selector.IdstringShape type of the sweep (e.g. "Horizontal").
Selector.DirectionstringSweep direction (e.g. "ToLeft").
Selector.TestLineOfSightbooleanWhether to check line-of-sight before registering hits.
Selector.StartDistancenumberNear edge of the sweep volume.
Selector.EndDistancenumberFar edge of the sweep volume.
Selector.LengthnumberArc length in degrees.
Selector.YawStartOffsetnumberYaw offset from facing direction to start the sweep.
HitEntityobjectInteraction chain executed for each entity hit.
HitBlockobjectInteraction chain executed for each block hit.

DamageCalculator Fields

Used inside interaction objects to define damage output.

FieldTypeDescription
TypestringCalculation method. "Absolute" uses a fixed base damage value.
BaseDamageobjectMap of damage type to amount (e.g. { "Physical": 12 }).
RandomPercentageModifiernumberFraction of base damage added as random variance (e.g. 0.2 = ±20%).

Effects Fields

FieldTypeDescription
WorldSoundEventIdstringSound event ID played at world position.
LocalSoundEventIdstringSound event ID played locally (heard only by the acting player).
WorldParticlesobject[]Array of { "SystemId": "<id>" } particle systems spawned at world position.
Particlesobject[]Particle configs with SystemId, Color, TargetNodeName, TargetEntityPart.
Trailsobject[]Weapon trail effect configs with TrailId, TargetNodeName, PositionOffset, RotationOffset.
CameraEffectstringCamera shake/effect ID applied to the acting player (e.g. "Impact", "Sword_Swing_Diagonal_Right").
ItemAnimationIdstringAnimation played on the held item (e.g. "Consume", "Build").
WaitForAnimationToFinishbooleanWhether the chain waits for the item animation to complete before continuing.
KnockbackobjectKnockback config with Type, Force, Direction (X/Y/Z), VelocityType, and VelocityConfig.

Examples

Assets/Server/Item/Interactions/Block_Primary.json:

{
"Type": "Simple",
"Next": {
"Type": "UseBlock",
"Failed": "Block_Attack"
}
}

Assets/Server/Item/Interactions/Block_Secondary.json:

{
"Type": "UseBlock",
"Failed": {
"Type": "PlaceBlock",
"RunTime": 0.125,
"Effects": {
"WaitForAnimationToFinish": false,
"ItemAnimationId": "Build"
}
}
}

Assets/Server/Item/Interactions/Consumables/Condition_Consume_Food.json:

{
"Type": "Condition",
"RequiredGameMode": "Adventure",
"Crouching": false,
"Next": "Consume_Charge",
"Failed": "Block_Secondary"
}

Assets/Server/Item/Interactions/Dodge.json:

{
"Type": "Condition",
"Flying": false,
"Next": {
"Type": "MovementCondition",
"ForwardLeft": { "Type": "Simple" },
"ForwardRight": { "Type": "Simple" },
"Left": "Dodge_Left",
"Right": "Dodge_Right",
"BackLeft": { "Type": "Simple" },
"BackRight": { "Type": "Simple" }
}
}

Assets/Server/Item/Interactions/Weapons/Common/Melee/Common_Melee_Damage.json:

{
"Parent": "DamageEntityParent",
"DamageCalculator": {
"BaseDamage": {
"Physical": 6
}
},
"Effects": {
"CameraEffect": "Impact"
},
"DamageEffects": {
"Knockback": {
"Type": "Force",
"Force": 6.5,
"Direction": { "X": 0.0, "Y": 1.0, "Z": -1.5 },
"VelocityType": "Set"
},
"WorldSoundEventId": "SFX_Sword_T2_Impact",
"LocalSoundEventId": "SFX_Sword_T2_Impact"
}
}