Skip to main content

Event hooks

Hooks for events created as plain objects, as shown in the create-event guide.

Members

onAction

Called when a player performs an action on this event
  • Source: packages/server/src/rooms/map.ts
  • Kind: property
  • Defined in: EventHooks

Signature

onChanges

Called during the change-detection cycle for the current player. Use this hook to recompute the event state from player data, especially player variables. This is useful for reactive visuals such as an opened chest, a hidden door, or a conditional NPC graphic.
  • Source: packages/server/src/rooms/map.ts
  • Kind: property
  • Defined in: EventHooks

Signature

onDetectInShape

Called when a player is detected entering a detection shape attached to the event
  • Source: packages/server/src/rooms/map.ts
  • Kind: property
  • Defined in: EventHooks

Signature

onDetectOutShape

Called when a player is detected exiting a detection shape attached to the event
  • Source: packages/server/src/rooms/map.ts
  • Kind: property
  • Defined in: EventHooks

Signature

onInit

Called when the event is first initialized. Use this hook for default setup that does not depend on a player interaction, such as setting the initial graphic, speed, or movement route.
  • Source: packages/server/src/rooms/map.ts
  • Kind: property
  • Defined in: EventHooks

Signature

onInShape

Called when a player enters a shape attached to the event
  • Source: packages/server/src/rooms/map.ts
  • Kind: property
  • Defined in: EventHooks

Signature

onOutShape

Called when a player exits a shape attached to the event
  • Source: packages/server/src/rooms/map.ts
  • Kind: property
  • Defined in: EventHooks

Signature

onPlayerTouch

Called when a player touches this event
  • Source: packages/server/src/rooms/map.ts
  • Kind: property
  • Defined in: EventHooks

Signature