Skip to content

on_self_item_used

fun on_self_item_used(
item: ItemDefinition,
behaviour: Interaction<Entity>.(user: Entity) -> Unit
)
Interaction<Entity>.(user: Entity) -> Unit

Entity

Works with: Npc // WorldObject // WorldItem // WorldProjection

Example
node<Npc>()
on_self_item_used(Assets.Item.bones) { user ->
self.speak("Thank you for the bones!")
user.message("You hand over the bones.")
}
item: ItemDefinition

ItemDefinition

val target: T