Class: GarrysMod

Inherits:
Object
  • Object
show all
Defined in:
lib/game_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

Returns a new instance of GarrysMod.



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

def initialize
  @name = "gmod"
  @app_id = "4020"
end

Instance Attribute Details

#app_idObject (readonly)

Returns the value of attribute app_id.



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

def app_id
  @app_id
end

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

Instance Method Details

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



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

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



21
22
23
# File 'lib/game_servers/gmod.rb', line 21

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