Class: GarrysMod

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

Overview

A module to produce resources for a Garry’s Mod server

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeGarrysMod



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

def initialize
  @name = "gmod"
  @app_id = "4020"
  @friendly_name = "Garry's Mod" #TODO: Add friendly name to all server objects
end

Instance Attribute Details

#app_idObject (readonly)

Returns the value of attribute app_id.



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

def app_id
  @app_id
end

#friendly_nameObject (readonly)

Returns the value of attribute friendly_name.



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

def friendly_name
  @friendly_name
end

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

Instance Method Details

#launch(install_path, map = "gm_construct", players = 16, collection_id = "1270037458") ⇒ Object



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

def launch(install_path, map = "gm_construct", players = 16, collection_id = "1270037458")
  "cd #{install_path} &&
  #{install_path}/srcds_run \
  -console \
  -game garrysmod \
  +map #{map} \
  +maxplayers #{players} \
  +host_workshop_collection #{collection_id} \
  -condebug & \
  /usr/bin/tail -f #{install_path}/garrysmod/console.log"
end

#post_install(install_path) ⇒ Object



22
23
24
# File 'lib/servers/gmod.rb', line 22

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