Class: GoldSrcServer
- Inherits:
-
Object
- Object
- GoldSrcServer
- Includes:
- GameServer
- Defined in:
- lib/steam/servers/goldsrc_server.rb
Overview
This class represents a GoldSrc game server and can be used to query information about and remotely execute commands via RCON on the server
A GoldSrc game server is an instance of the Half-Life Dedicated Server (HLDS) running games using Valve’s GoldSrc engine, like Half-Life Deathmatch, Counter-Strike 1.6 or Team Fortress Classic.
Instance Attribute Summary
Attributes included from Server
Class Method Summary collapse
-
.master ⇒ MasterServer
Returns a master server instance for the default master server for GoldSrc games.
Instance Method Summary collapse
-
#init_socket ⇒ Object
Initializes the socket to communicate with the GoldSrc server.
-
#initialize(address, port = 27015, is_hltv = false) ⇒ GoldSrcServer
constructor
Creates a new instance of a GoldSrc server object.
-
#rcon_auth(password) ⇒ true
Saves the password for authenticating the RCON communication with the server.
-
#rcon_exec(command) ⇒ String
Remotely executes a command on the server via RCON.
Methods included from GameServer
#handle_response_for_request, #init, #ping, player_status_attributes, #players, #rcon_authenticated?, #rules, #server_info, split_player_status, #to_s, #update_challenge_number, #update_ping, #update_players, #update_rules, #update_server_info
Methods included from Server
Constructor Details
#initialize(address, port = 27015, is_hltv = false) ⇒ GoldSrcServer
Creates a new instance of a GoldSrc server object
40 41 42 43 44 |
# File 'lib/steam/servers/goldsrc_server.rb', line 40 def initialize(address, port = 27015, is_hltv = false) super address, port @is_hltv = is_hltv end |
Class Method Details
.master ⇒ MasterServer
Returns a master server instance for the default master server for GoldSrc games
27 28 29 |
# File 'lib/steam/servers/goldsrc_server.rb', line 27 def self.master MasterServer.new *MasterServer::GOLDSRC_MASTER_SERVER end |
Instance Method Details
#init_socket ⇒ Object
Initializes the socket to communicate with the GoldSrc server
49 50 51 |
# File 'lib/steam/servers/goldsrc_server.rb', line 49 def init_socket @socket = GoldSrcSocket.new @ip_address, @port, @is_hltv end |
#rcon_auth(password) ⇒ true
Saves the password for authenticating the RCON communication with the server
60 61 62 63 |
# File 'lib/steam/servers/goldsrc_server.rb', line 60 def rcon_auth(password) @rcon_password = password true end |
#rcon_exec(command) ⇒ String
Remotely executes a command on the server via RCON
70 71 72 |
# File 'lib/steam/servers/goldsrc_server.rb', line 70 def rcon_exec(command) @socket.rcon_exec(@rcon_password, command).strip end |