Class: Gamefic::Chapter

Inherits:
Narrative show all
Defined in:
lib/gamefic/chapter.rb

Instance Attribute Summary collapse

Attributes included from Scriptable::Scenes

#default_conclusion, #default_scene

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Narrative

#cast, inherited, #introduce, restore, #save, #turn, #uncast

Methods included from Scriptable

#pick, #pick!

Methods included from Scriptable::Syntaxes

#interpret, #syntaxes

Methods included from Scriptable::Seeds

#construct, #make, #seed, #seeds

Methods included from Scriptable::Scenes

#active_choice, #block, #conclusion, #introduction, #introductions, #multiple_choice, #named_scenes, #pause, #scene_classes, #scene_classes_map, #scenes, #select_default_conclusion, #select_default_scene, #yes_or_no

Methods included from Scriptable::Responses

#meta, #respond, #responses, #responses_for, #verbs

Methods included from Scriptable::Queries

#available, #children, #descendants, #extended, #global, #integer, #myself, #parent, #plaintext, #siblings

Methods included from Scriptable::Hooks

#after_command, #after_commands, #before_command, #before_commands, #conclude_blocks, #on_conclude, #on_player_conclude, #on_player_output, #on_player_ready, #on_player_update, #on_ready, #on_update, #player_conclude_blocks, #player_output_blocks, #ready_blocks, #update_blocks

Methods included from Scripting

#find_and_bind, included

Methods included from Scripting::Syntaxes

#synonyms, #syntaxes

Methods included from Scripting::Scenes

#default_conclusion, #default_scene, #introductions, #named_scenes, #prepare, #scene_class, #scenes

Methods included from Scripting::Seeds

#seeds

Methods included from Scripting::Responses

#responses, #responses_for

Methods included from Scripting::Hooks

#after_commands, #before_commands, #conclude_blocks, #player_conclude_blocks, #player_output_blocks, #ready_blocks, #update_blocks

Methods included from Scripting::Entities

#destroy, #entities, #find, #make, #pick, #pick!

Methods included from Scripting::Proxies

#unproxy

Constructor Details

#initialize(plot, **config) ⇒ Chapter

Returns a new instance of Chapter.

Parameters:



12
13
14
15
16
17
18
19
# File 'lib/gamefic/chapter.rb', line 12

def initialize(plot, **config)
  @plot = plot
  @concluding = false
  @config = config
  configure
  @config.freeze
  super()
end

Instance Attribute Details

#configHash (readonly)

Returns:

  • (Hash)


9
10
11
# File 'lib/gamefic/chapter.rb', line 9

def config
  @config
end

#plotPlot (readonly)

Returns:



6
7
8
# File 'lib/gamefic/chapter.rb', line 6

def plot
  @plot
end

Class Method Details

.bind_from_plot(*methods) ⇒ Object



34
35
36
37
38
39
# File 'lib/gamefic/chapter.rb', line 34

def self.bind_from_plot *methods
  methods.flatten.each do |method|
    define_method(method) { plot.send(method) }
    define_singleton_method(method) { Proxy::Attr.new(method) }
  end
end

.configObject



51
52
53
# File 'lib/gamefic/chapter.rb', line 51

def config
  Proxy::Config.new
end

Instance Method Details

#concludeObject



25
26
27
28
# File 'lib/gamefic/chapter.rb', line 25

def conclude
  # @todo Void entities?
  @concluding = true
end

#concluding?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/gamefic/chapter.rb', line 30

def concluding?
  @concluding
end

#configurevoid

This method returns an undefined value.

Subclasses can override this method to handle additional configuration.



48
# File 'lib/gamefic/chapter.rb', line 48

def configure; end

#included_scriptsObject



41
42
43
# File 'lib/gamefic/chapter.rb', line 41

def included_scripts
  super - plot.included_scripts
end

#playersObject



21
22
23
# File 'lib/gamefic/chapter.rb', line 21

def players
  plot.players
end