Class: CARPS::Player::GameConfig

Inherits:
SessionConfig show all
Defined in:
lib/carps/service/player/config.rb

Overview

Class to read game configuration files

Instance Method Summary collapse

Methods inherited from SessionConfig

#load_mod, #register_session, #save, #save_mod

Methods inherited from UserConfig

load

Methods inherited from YamlConfig

#fail_hard, #read

Constructor Details

#initialize(filename, mod, dm, about, session) ⇒ GameConfig

Create a new GameConfig



31
32
33
34
35
36
# File 'lib/carps/service/player/config.rb', line 31

def initialize filename, mod, dm, about, session
   super session, filename
   @mod = mod
   @dm = dm
   @about = about
end

Instance Method Details

#displayObject

Display information on this configuration



52
53
54
55
56
57
# File 'lib/carps/service/player/config.rb', line 52

def display
   puts "Mod: " + @mod
   puts "Description:"
   puts @about
   puts "DM: " + @dm
end

#filename=(fn) ⇒ Object

Set the file name



39
40
41
# File 'lib/carps/service/player/config.rb', line 39

def filename= fn
   @filename = fn
end

#parse_yaml(conf) ⇒ Object

Parse a game config file



44
45
46
47
48
49
# File 'lib/carps/service/player/config.rb', line 44

def parse_yaml conf
   super
   @mod = read_conf conf, "mod"
   @about = read_conf conf, "about"
   @dm = read_conf conf, "dm"
end

#spawnObject

Spawn a game object so we can resume the game



60
61
62
# File 'lib/carps/service/player/config.rb', line 60

def spawn
   GameClient.new @dm, @mod, self
end