Module: Gamefic::Plot::Snapshot

Included in:
Gamefic::Plot
Defined in:
lib/gamefic/plot/snapshot.rb

Instance Method Summary collapse

Instance Method Details

#initial_stateObject



19
20
21
22
23
24
# File 'lib/gamefic/plot/snapshot.rb', line 19

def initial_state
  if @initial_state.nil?
    @initial_state = internal_save
  end
  @initial_state
end

#restore(snapshot) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/gamefic/plot/snapshot.rb', line 11

def restore snapshot
  # HACK Force conclusion of current subplots

  p_subplots.each { |s| s.conclude }
  p_subplots.clear
  Gamefic::Plot::Darkroom.new(self).restore(snapshot)
  entities.each { |e| e.flush }
end

#saveHash

Returns:

  • (Hash)


6
7
8
9
# File 'lib/gamefic/plot/snapshot.rb', line 6

def save
  initial_state
  internal_save
end