Move.rb
RubyMud/Commands/Move.rb · 643 B
From the archive rbmud-0.1rc2.tar.gz
Download the archive « Back to the archive contents
require "Command.rb"
require "Commands.rb"
module RubyMud
class Move < Command
def words
return nil
end
def initialize()
super()
end
def execute(clientConnection,string)
str = string.split(' ')
return false if str.length > 1
room = clientConnection.player.parent
for exit in room.exits
#otherRoom = exit.otherRoom(room)
for name in exit.rooms[room]
if name == str[0]
clientConnection.player.moveThroughExit(exit)
return true
end
end
end
# Could not find an exit
return false
end
end
# Create the instance, it adds itself to the commands list
Move.new()
end #module