module Gamefic::Scriptable::Hooks
def after_command(*verbs, &block)
- 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
-
(Array
-)
def after_commands @after_commands ||= [] end
def before_command(*verbs, &block)
- 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
-
(Array
-)
def before_commands @before_commands ||= [] end
def conclude_blocks
-
(Array
-)
def conclude_blocks @conclude_blocks ||= [] end
def on_conclude(&block)
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)
- 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)
- 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)
- Yieldparam: -
def on_player_ready(&block) ready_blocks.push(proc { players.each { |player| instance_exec(player, &block) } }) end
def on_player_update(&block)
- Yieldparam: -
def on_player_update(&block) update_blocks.push(proc { players.each { |player| instance_exec(player, &block) } }) end
def on_ready(&block)
Define a callback to be executed after a scene starts.
def on_ready(&block) ready_blocks.push block end
def on_update(&block)
Define a callback to be executed after a scene finishes.
def on_update(&block) update_blocks.push block end
def player_conclude_blocks
-
(Array
-)
def player_conclude_blocks @player_conclude_blocks ||= [] end
def player_output_blocks
-
(Array
-)
def player_output_blocks @player_output_blocks ||= [] end
def ready_blocks
-
(Array
-)
def ready_blocks @ready_blocks ||= [] end
def update_blocks
-
(Array
-)
def update_blocks @update_blocks ||= [] end