Class: Gamefic::Sdk::Server

Inherits:
Sinatra::Base
  • Object
show all
Defined in:
lib/gamefic-sdk/server.rb

Instance Method Summary collapse

Instance Method Details

#reset_featuresObject



60
61
62
63
64
65
66
67
68
# File 'lib/gamefic-sdk/server.rb', line 60

def reset_features
  @@old_features ||= $LOADED_FEATURES.clone
  @@old_constants ||= Object.constants(false)
  $LOADED_FEATURES.keep_if { |e| @@old_features.include?(e) }
  Object.constants(false).each do |const|
    Object.send(:remove_const, const) unless @@old_constants.include?(const)
  end
  Gamefic::Plot.blocks.clear
end

#start_plotObject



51
52
53
54
55
56
57
58
# File 'lib/gamefic-sdk/server.rb', line 51

def start_plot
  reset_features
  load File.join(settings.source_dir, 'main.rb')
  @@plot = Gamefic::Plot.new
  @@character = @@plot.make_player_character
  @@plot.introduce @@character
  @@plot.ready
end