Skip to main content

Scrapbookable

Overview

The Scrapbookable component enables an entity to be "taught" (i.e., added to a player's Scrapbook) by storing and invoking a custom teaching callback. It is typically used for vanilla or modded recipes, creatures, or items that can be discovered and documented in the in-game Scrapbook.

Dependencies & Tags

None identified.

Properties

PropertyTypeDefault ValueDescription
instEntity(passed to constructor)Reference to the entity this component is attached to.
onteachfunction?nilOptional callback function executed when :Teach() is called; signature: fn(inst, doer).

Main Functions

SetOnTeachFn(fn)

  • Description: Sets the callback function to be invoked when the entity is taught via the Scrapbook.
  • Parameters:
    fn (function?) — The callback to register. Called with two arguments: the entity (inst) and the entity performing the teach action (doer).

Teach(doer)

  • Description: Executes the registered teaching callback (if defined) and returns true. This method is called when a player successfully teaches the entity in the Scrapbook UI.
  • Parameters:
    doer (GoreObject? or Entity) — The entity performing the teach action (typically a player).

Events & Listeners

None.