wrote basic building stuff, need to impliment more in the player.
This commit is contained in:
+9
-6
@@ -104,6 +104,7 @@ module Game
|
||||
# @param client [TCPSocket] The client socket
|
||||
# @param command [Hash] JSON parsed command from the client.
|
||||
# @option command [String] :player_id Required, The player ID
|
||||
# @option command [String] :faction Required, The faction the player should join as.
|
||||
#
|
||||
# @return [Hash] status hash that will be converted to JSON before being
|
||||
# sent back to the client
|
||||
@@ -231,10 +232,9 @@ module Game
|
||||
# @param msg [String] The error message
|
||||
# @return [String] JSON-encoded error response
|
||||
#
|
||||
def error_response(msg)
|
||||
{ 'type' => 'error', 'payload' => msg }.to_json
|
||||
def error_response(request_id, msg)
|
||||
{ 'type' => 'error', 'request_id', => id, 'payload' => msg }.to_json
|
||||
end
|
||||
alias error_response error_response
|
||||
|
||||
##
|
||||
# Return a JSON object that tells a client about the current
|
||||
@@ -274,6 +274,9 @@ module Game
|
||||
delta_time * (player_count / GAME_SPEED_FACTOR)
|
||||
@game_time += delta_time
|
||||
|
||||
# Order here is important, We must update the buildings first (To
|
||||
# accrew resources for this delta) Because planets hold the buildings
|
||||
# they must be first.
|
||||
@planets.each do |planet|
|
||||
planet.update(delta_time)
|
||||
end
|
||||
@@ -282,9 +285,9 @@ module Game
|
||||
ship.update(delta_time)
|
||||
end
|
||||
|
||||
#@players.each do |player|
|
||||
# player.update(delta_time)
|
||||
#end
|
||||
@players.each do |player|
|
||||
player.update(delta_time)
|
||||
end
|
||||
|
||||
# Perform game saves (Or not for now...)
|
||||
if (@game_time) > next_save
|
||||
|
||||
Reference in New Issue
Block a user