Class: ServerSettings

Inherits:
Object
  • Object
show all
Defined in:
lib/messages/server_settings.rb

Instance Method Summary collapse

Constructor Details

#initialize(attr = {}) ⇒ ServerSettings

Returns a new instance of ServerSettings.



4
5
6
7
8
9
10
11
# File 'lib/messages/server_settings.rb', line 4

def initialize(attr = {})
  @kick_vote = attr[:kick_vote] || 0
  @kick_min = attr[:kick_min] || 0
  @spec_vote = attr[:spec_vote] || 0
  @team_lock = attr[:team_lock] || 0
  @team_balance = attr[:team_balance] || 0
  @player_slots = attr[:player_slots] || 16
end

Instance Method Details

#to_aObject

basically to_network int array the server sends to the client



15
16
17
18
19
20
21
22
# File 'lib/messages/server_settings.rb', line 15

def to_a
  Packer.pack_int(@kick_vote) +
    Packer.pack_int(@kick_min) +
    Packer.pack_int(@spec_vote) +
    Packer.pack_int(@team_lock) +
    Packer.pack_int(@team_balance) +
    Packer.pack_int(@player_slots)
end