module Gamefic::Scriptable::Hooks

def after_command(*verbs, &block)

Other tags:
    Yieldparam: -
    Yieldparam: -

Parameters:
  • verbs (Array) --
def after_command(*verbs, &block)
  after_commands.push(proc do |actor, command|
    instance_exec(actor, command, &block) if verbs.empty? || verbs.include?(command.verb)
  end)
end

def after_commands

Returns:
  • (Array) -
def after_commands
  @after_commands ||= []
end

def before_command(*verbs, &block)

Other tags:
    Yieldparam: -
    Yieldparam: -

Parameters:
  • verbs (Array) --

Other tags:
    Example: Cancel non-meta commands when the actor does not have a parent -
def before_command(*verbs, &block)
  before_commands.push(proc do |actor, command|
    instance_exec(actor, command, &block) if verbs.empty? || verbs.include?(command.verb)
  end)
end

def before_commands

Returns:
  • (Array) -
def before_commands
  @before_commands ||= []
end

def conclude_blocks

Returns:
  • (Array) -
def conclude_blocks
  @conclude_blocks ||= []
end

def on_conclude(&block)

@yieldreceiver [Object]

conclusion.
Define a callback that gets executed when a narrative reaches a
def on_conclude(&block)
  conclude_blocks.push(block)
end

def on_player_conclude(&block)

Other tags:
    Yieldparam: -

Other tags:
    Note: - A player can conclude participation in a narrative without the
def on_player_conclude(&block)
  player_conclude_blocks.push(block)
end

def on_player_output(&block)

Other tags:
    Yieldparam: -
    Yieldparam: -

Other tags:
    Example: Add a player's parent to the output as a custom hash value. -
def on_player_output(&block)
  player_output_blocks.push(block)
end

def on_player_ready(&block)

Other tags:
    Yieldparam: -
def on_player_ready(&block)
  ready_blocks.push(proc { players.each { |player| instance_exec(player, &block) } })
end

def on_player_update(&block)

Other tags:
    Yieldparam: -
def on_player_update(&block)
  update_blocks.push(proc { players.each { |player| instance_exec(player, &block) } })
end

def on_ready(&block)

@yieldreceiver [Object]

Define a callback to be executed after a scene starts.
def on_ready(&block)
  ready_blocks.push block
end

def on_update(&block)

@yieldreceiver [Object]

Define a callback to be executed after a scene finishes.
def on_update(&block)
  update_blocks.push block
end

def player_conclude_blocks

Returns:
  • (Array) -
def player_conclude_blocks
  @player_conclude_blocks ||= []
end

def player_output_blocks

Returns:
  • (Array) -
def player_output_blocks
  @player_output_blocks ||= []
end

def ready_blocks

Returns:
  • (Array) -
def ready_blocks
  @ready_blocks ||= []
end

def update_blocks

Returns:
  • (Array) -
def update_blocks
  @update_blocks ||= []
end