Pikifen/Object categories/Interactable

Interactables are any object that the current leader can interact with to cause something to happen. This interaction happens via the throw button.

Examples of interactable types include a sign that the player can read.

To create a new type of interactable, please follow the creating object types tutorial.

Overview
An interactable type object will cause a prompt to appear above it when the player's current leader approaches, informing the player what button to press to interact with the object. The most common case for this is to allow the player to read the contents of a sign, but it can be used for things like user-activated switches, too. Because the interactable only needs to be on the lookout for the player's input, and because the outcome can be anything, the player is tasked with giving each interactable type object its behavior using the script.

Interactable type objects are hardcoded in the engine to do whatever the script tells them, plus show the user prompt above them when the current leader is within a certain radius. They also have logic to receive the  message from the leader object when they're interacted with.

Attributes
Besides the global object type attributes, an interactable type has the following attributes.

Mandatory

 *  : What text to show on the prompt, like "Read", or "Flip switch".

Recommended

 *  : How close the leader object needs to be to this one before it can be interacted with. Defaults to 64.

Optional
None.

Animations
Interactable object types do not need any specific animations, only the ones that you call in the script.

Script
All of the interactable type object's behavior is defined by the user-made script. It is recommended that, in all relevant states, you handle the  event, since when the player interacts with the object, a message is sent from the leader object with the text.

Object spawn script variables
Besides the global spawn script variables, interactable type objects do not read any specific script variables, but any script variable fed into them can be used in the script.