Show / Hide Table of Contents

Class InteractionAttribute

Block of data sent to the client that defines how a general interactor works. Method applied to must have signature: void X(Player player, InteractionTriggerInfo trigger, InteractionTarget target, List{Tag} tagsTargetable)

Inheritance
System.Object
InteractionAttribute
Implements
IController
IViewController
IHasUniversalID
Namespace: Eco.Gameplay.Interactions.Interactors
Assembly: Eco.Gameplay.dll
Syntax
public class InteractionAttribute : RPCAttribute, IController, IViewController, IHasUniversalID
Remarks

NOTE: This attribute inherits directly from RPCAttribute, so an RPC will be created for every method this is defined on.

Constructors

InteractionAttribute(InteractionTrigger, String, InteractionModifier, String[], Single, Single, ClientPredictedBlockAction, Int32, Boolean, TriBool, String, AccessType, Boolean, InteractionFlags, String, String[])

Declaration
public InteractionAttribute(InteractionTrigger trigger, string overrideDescription = null, InteractionModifier modifier, string[] requiredEnvVars = null, float interactionDistance = 0F, float priority = 0F, ClientPredictedBlockAction predictedBlockAction, int maxTake = 0, bool animationDriven = false, TriBool canHoldToTrigger, string highlightColorHex = null, AccessType authRequired, bool enforceAuth = false, InteractionFlags flags, string uiType = null, params string[] tags)
Parameters
Type Name Description
InteractionTrigger trigger
System.String overrideDescription
InteractionModifier modifier
System.String[] requiredEnvVars
System.Single interactionDistance
System.Single priority
ClientPredictedBlockAction predictedBlockAction
System.Int32 maxTake
System.Boolean animationDriven
TriBool canHoldToTrigger
System.String highlightColorHex
AccessType authRequired
System.Boolean enforceAuth
InteractionFlags flags
System.String uiType
System.String[] tags

Properties

AccessForHighlight

Declaration
public AccessType AccessForHighlight { get; set; }
Property Value
Type Description
AccessType

AnimationDriven

Declaration
public bool AnimationDriven { get; set; }
Property Value
Type Description
System.Boolean

AreaBlocks

Declaration
public Vector2i[] AreaBlocks { get; set; }
Property Value
Type Description
Vector2i[]

CanHoldToTrigger

Declaration
public TriBool CanHoldToTrigger { get; set; }
Property Value
Type Description
TriBool

ControllerID

Declaration
public ref int ControllerID { get; }
Property Value
Type Description
System.Int32

Description

Description of the interaction, taken from the name of the method it's applied on, but can be overriden via our constructor.

Declaration
public LocString Description { get; set; }
Property Value
Type Description
LocString

DisallowedEnvVars

Environment vars that, if present and assigned any value besides 'false', will block the interaction.

Declaration
public string[] DisallowedEnvVars { get; set; }
Property Value
Type Description
System.String[]

Flags

Declaration
public InteractionFlags Flags { get; set; }
Property Value
Type Description
InteractionFlags

HighlightColor

Declaration
public Color HighlightColor { get; set; }
Property Value
Type Description
Color

InteractionDistance

Max distance allowed to interact, 0 means default distance.

Declaration
public float InteractionDistance { get; set; }
Property Value
Type Description
System.Single

InteractorType

Declaration
public Type InteractorType { get; set; }
Property Value
Type Description
System.Type

MaxTake

Declaration
public int MaxTake { get; set; }
Property Value
Type Description
System.Int32

MinCaloriesRequired

Min calories required to perform the action. The ingteraction may still consume more than this. And the consumption doesnt happen automatically, the interaction func must do it.

Declaration
public float MinCaloriesRequired { get; set; }
Property Value
Type Description
System.Single

PredictedBlockAction

Define an action that can happen instantly on the client when the interaction takes place, and can be rewound if the server doesnt accept it.

Declaration
public ClientPredictedBlockAction PredictedBlockAction { get; set; }
Property Value
Type Description
ClientPredictedBlockAction

Priority

When two interactions are set on the same trigger, priority determines which is displayed and available.

Declaration
public float Priority { get; set; }
Property Value
Type Description
System.Single

RequiredEnvVars

Parameters that would allow this interaction to trigger (if a tag also matches). Exists to allow state-based definitions for WorldObjects (--e.g.: 'Turn on' vs 'Turn off', etc)

Declaration
public string[] RequiredEnvVars { get; set; }
Property Value
Type Description
System.String[]
Remarks

This is applied on top of tags. If this is null or empty, the interaction can be triggered.

RPCName

Name of the RPC to call. This is called on the interactor, but if the interactor is null its called on the target.

Declaration
public string RPCName { get; set; }
Property Value
Type Description
System.String

SubComponentTypeRPCTarget

If set, means that the RPC is called on the given subcomponent of a world object.

Declaration
public Type SubComponentTypeRPCTarget { get; set; }
Property Value
Type Description
System.Type

TagsTargetable

Blocks, NetObjects, and Items that have ANY of these tags can trigger this interaction.

Declaration
public Tag[] TagsTargetable { get; set; }
Property Value
Type Description
Tag[]

TriggerInfo

Declaration
public InteractionTriggerInfo TriggerInfo { get; set; }
Property Value
Type Description
InteractionTriggerInfo

UIType

If we're includiung any views as envar paremeters in the description, they can be created on the client as prefabs of this type (listed in UIPrefab)

Declaration
public string UIType { get; set; }
Property Value
Type Description
System.String

Methods

Init(Type, String)

Init an interaction definition defined on an interactor.

Declaration
public void Init(Type interactorType, string rpcName)
Parameters
Type Name Description
System.Type interactorType
System.String rpcName

Implements

IController
IViewController
IHasUniversalID

Extension Methods

TagUtils.TagNames(Object, Boolean)
TagUtils.TagDisplayNames(Object, Boolean)
ClientSetViewExtensions.SetClassOfProperty(Object, Player, String, String, Int32)
TypeTooltipExtensions.UILinkGeneric(Object)
☀
☾
In This Article
Back to top
Copyright (c) Strange Loop Games 2021
☀
☾