Modding:Right click events: Difference between revisions

From Vintage Story Wiki
(Add the footer and header to right click events page)
(→‎Interaction methods: add missing bolds)
Line 20: Line 20:


There are 3 ways to stop an interaction. Note that it is recommended to have the client stop the interaction, because stopping the interaction on the client also stops the interaction on the server. If the server stops the interaction, then it will continue on the client until the client stops it too.
There are 3 ways to stop an interaction. Note that it is recommended to have the client stop the interaction, because stopping the interaction on the client also stops the interaction on the server. If the server stops the interaction, then it will continue on the client until the client stops it too.
# OnXXInteractStart - reject it before it starts, by returning false for a block or setting the '''handling''' reference parameter to '''NotHandled''' for an item. The system will attempt to send the interaction to the other target (held item / selected block) if there is one.
# '''OnXXInteractStart''' - reject it before it starts, by returning false for a block or setting the '''handling''' reference parameter to '''NotHandled''' for an item. The system will attempt to send the interaction to the other target (held item / selected block) if there is one.
# OnXXInteractStep - return false to signal a block/item initiated stop. For example, this is used by the poultice item to indicate that the poultice has been successfully applied.
# '''OnXXInteractStep''' - return false to signal a block/item initiated stop. For example, this is used by the poultice item to indicate that the poultice has been successfully applied.
# OnXXInteractCancel - return true to accept a player initiated stop. Some of the ways the player can attempt to cancel the interaction are by releasing the mouse button or looking at another block.
# '''OnXXInteractCancel''' - return true to accept a player initiated stop. Some of the ways the player can attempt to cancel the interaction are by releasing the mouse button or looking at another block.


The interaction can be thought of as going through several phases, which are summarized below. The interaction advances to the next phase unless the table describes otherwise.
The interaction can be thought of as going through several phases, which are summarized below. The interaction advances to the next phase unless the table describes otherwise.