vrobot4/source/robots.rb

38 lines
900 B
Ruby

# Module for vrobot4 bot interfaces.
module Vrobot4::Robots
# Generic bot interface.
class Bot
# @param info [Hash] arbitrary extra information for this bot
def initialize info
@info = info
end
# Connect to all servers.
# @abstract
# @return [void]
def connect
raise NotImplementedError, "Bot#connect not implemented"
end
end
# Adds a bot type to the global list.
# @param type [Class] bot type to add
# @return [void]
def self.add_bot_type type
@@bot_types[type.type] = type
Vrobot4.log :INFO, "added bot type: #{type.type}"
end
# Gets a bot type by name from the global list.
# @param name [String] name of the bot type to find
# @return [Class] the bot type
def self.get_bot_type name
@@bot_types[name]
end
# The set of all bot types.
@@bot_types = {}
end
## EOF