Kalevala.World.Room.Callbacks protocol (kalevala v0.1.0) View Source

Link to this section Summary

Functions

Callback for confirming or aborting character movement

Callback for when a new event is received

Load the exits for a given room

Called when the room is initializing

Called after the room process is started

Convert item instances into items

Callback for the room to hook into movement between exits

Link to this section Types

Link to this section Functions

Link to this function

confirm_movement(room, context, event)

View Source

Callback for confirming or aborting character movement

Called while the Zone is checking each side of the exit to know if the movement is indeed allowed. Returning the original event allows movement to proceed, otherwise return an aborted event to prevent movement.

Hook to allow for the room to reject movement for custom reasons, e.g. an NPC is blocking the exit and needs to be convinced first, or there is a trap blocking the exit.

Link to this function

event(room, context, event)

View Source

Callback for when a new event is received

Load the exits for a given room

Used when a character is trying to move, the appropriate exit is chosen and forwarded into movement request callbacks. Since this is a common thing that will happen 99% of the time, Kalevala handles it.

Called when the room is initializing

Called after the room process is started

Directly after init is completed.

Link to this function

item_request_drop(room, context, item_request_drop, item_instance)

View Source

Callback for allowing an item drop off

A character is requesting to pick up an item, this let's the room accept or reject the request.

Link to this function

item_request_pickup(room, context, item_request_pickup, item_instance)

View Source

Callback for allowing an item pick up

A character is requesting to pick up an item, this let's the room accept or reject the request.

Link to this function

load_item(room, item_instance)

View Source

Convert item instances into items

Link to this function

movement_request(room, context, movement_request, room_exit)

View Source

Callback for the room to hook into movement between exits

The character is requesting to move via an exit, a tuple allowing or rejecting the movement before being pitched up to the Zone should be returned.

Can immediately terminate a room before being checked in a more detailed fashion with confirm_movement/2 below.