require "Command.rb"
require "Commands.rb"

module RubyMud

class Exits < Command

	def words
		return["exits","exit","ex"]
	end
	
	def initialize()
		super()
	end
	
	def execute(clientConnection, string)
		
		exitCount = 0
		roomExits = "<bright white>Obvious exits: "
			
		room = clientConnection.player.parent
			
		exitCount = 0
		
		for exit in room.exits
			next if exit.rooms[room][0] == nil
			roomExits += "," if exitCount > 0
			roomExits += exit.rooms[room][0]
			exitCount +=1
		end
	
		
		# Check whether any exits were found
		roomExits = "There are no obvious exits" if exitCount == 0
			
		
		# Send available exit info to client
		clientConnection.send(roomExits+"\r\n")
		return
	end
end

#Create the instance, it adds itself to the commands list
Exits.new()

end #module