Class: CARPS::DM::GameConfig
- Inherits:
-
SessionConfig
- Object
- YamlConfig
- UserConfig
- SessionConfig
- CARPS::DM::GameConfig
- Defined in:
- lib/carps/service/dm/config.rb
Overview
Class to read game configuration files
Instance Method Summary collapse
-
#display ⇒ Object
Display information on this configuration.
-
#initialize(filename, mod, campaign, about, session, dm) ⇒ GameConfig
constructor
Create a new GameConfig.
-
#parse_yaml(conf) ⇒ Object
Parse a game config file.
-
#spawn ⇒ Object
Return a GameServer object that can communicate with players.
Methods inherited from SessionConfig
#load_mod, #register_session, #save, #save_mod
Methods inherited from UserConfig
Methods inherited from YamlConfig
Constructor Details
#initialize(filename, mod, campaign, about, session, dm) ⇒ GameConfig
Create a new GameConfig
30 31 32 33 34 35 36 |
# File 'lib/carps/service/dm/config.rb', line 30 def initialize filename, mod, campaign, about, session, dm super session, filename @campaign = campaign @mod = mod @about = about @dm = dm end |
Instance Method Details
#display ⇒ Object
Display information on this configuration
48 49 50 51 52 53 54 |
# File 'lib/carps/service/dm/config.rb', line 48 def display puts "Mod: " + @mod puts "Campaign: " + @campaign puts "Description:" puts @about puts "DM: " + @dm end |
#parse_yaml(conf) ⇒ Object
Parse a game config file
39 40 41 42 43 44 45 |
# File 'lib/carps/service/dm/config.rb', line 39 def parse_yaml conf super @campaign = read_conf conf, "campaign" @mod = read_conf conf, "mod" @about = read_conf conf, "about" @dm = read_conf conf, "dm" end |
#spawn ⇒ Object
Return a GameServer object that can communicate with players
57 58 59 |
# File 'lib/carps/service/dm/config.rb', line 57 def spawn GameServer.new @mod, @campaign, @about, @session, self, @dm end |