Class: TeamFortress

Inherits:
Object
  • Object
show all
Defined in:
lib/servers/team_fortress.rb

Overview

A module to produce resources for a Team Fortress 2 server

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeTeamFortress

Returns a new instance of TeamFortress.



4
5
6
7
# File 'lib/servers/team_fortress.rb', line 4

def initialize
  @name = "tf2"
  @app_id = "232250"
end

Instance Attribute Details

#app_idObject (readonly)

Returns the value of attribute app_id.



3
4
5
# File 'lib/servers/team_fortress.rb', line 3

def app_id
  @app_id
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/servers/team_fortress.rb', line 3

def name
  @name
end

Instance Method Details

#launch(install_path, map = "ctf_2fort", players = 24) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/servers/team_fortress.rb', line 9

def launch(install_path, map = "ctf_2fort", players = 24)
  "cd #{install_path} &&
  #{install_path}/srcds_run \
  -console \
  -game tf \
  +sv_pure 1 \
  +map #{map} \
  +maxplayers #{players} \
  -condebug & \
  /usr/bin/tail -f #{install_path}/tf/console.log"
end

#post_install(install_path) ⇒ Object



21
22
23
# File 'lib/servers/team_fortress.rb', line 21

def post_install(install_path)
  system("touch #{install_path}/tf/console.log")
end