class Gamefic::Plot


methods for creating entities, actions, scenes, and hooks.
The plot is the central narrative. It provides a script interface with

def self.append(chapter, **config)

def self.append(chapter, **config)
  Gamefic.logger.warn "Overwriting existing chapter #{chapter}" if appended_chapter_map.key?(chapter)
  appended_chapter_map[chapter] = config
end

def self.appended_chapter_map

def self.appended_chapter_map
  @appended_chapter_map ||= {}
end

def branch subplot_class = Gamefic::Subplot, introduce: [], **config

Returns:
  • (Gamefic::Subplot) -

Parameters:
  • config (Hash) -- Subplot configuration
  • introduce (Gamefic::Actor, Array) -- Players to introduce
  • subplot_class (Class) -- The Subplot class
def branch subplot_class = Gamefic::Subplot, introduce: [], **config
  subplot_class.new(self, introduce: introduce, **config)
               .tap { |sub| subplots.push sub }
end

def find_and_bind(symbol)

def find_and_bind(symbol)
  super + chapters.flat_map { |chap| chap.find_and_bind(symbol) }
end

def initialize

def initialize
  super
  @chapters = self.class.appended_chapter_map.map { |chap, config| chap.new(self, **unproxy(config)) }
end

def inspect

def inspect
  "#<#{self.class}>"
end

def player_output_blocks

def player_output_blocks
  super + subplots.flat_map(&:player_output_blocks)
end

def ready_blocks

def ready_blocks
  super + subplots.flat_map(&:ready_blocks)
end

def responses

def responses
  super + chapters.flat_map(&:responses)
end

def responses_for(*verbs)

def responses_for(*verbs)
  super + chapters.flat_map { |chap| chap.responses_for(*verbs) }
end

def subplots

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

def syntaxes

def syntaxes
  super + chapters.flat_map(&:syntaxes)
end

def turn

Returns:
  • (void) -
def turn
  super
  subplots.each(&:conclude) if concluding?
  chapters.delete_if(&:concluding?)
  subplots.delete_if(&:concluding?)
end

def uncast(actor)

def uncast(actor)
  subplots.each { |sp| sp.uncast actor }
  super
end

def update_blocks

def update_blocks
  super + subplots.flat_map(&:update_blocks)
end