Skip to content
Snippets Groups Projects
Commit d5dc40e4 authored by Jeffrey Phillips Freeman's avatar Jeffrey Phillips Freeman :boom:
Browse files

improved output of help command

parent 07f5f26a
No related branches found
No related tags found
No related merge requests found
...@@ -4,25 +4,23 @@ module Aethyr ...@@ -4,25 +4,23 @@ module Aethyr
module Extend module Extend
module HandleHelp module HandleHelp
attr_reader :commands attr_reader :commands
def initialize(player, commands, *args) def initialize(player, commands, *args)
super(player, *args) super(player, *args)
@commands = commands @commands = commands
end end
def player_input(data) def player_input(data)
super(data) super(data)
case data[:input] case data[:input]
when /^(help|help topics)$/i when /^(help|help topics)$/i
if self.can_help? if self.can_help?
self.commands.each do |command| self.player.output( commands.join(" ") + " ", true)
self.player.output command
end
end end
end end
end end
def can_help? def can_help?
true true
end end
...@@ -30,10 +28,10 @@ module Aethyr ...@@ -30,10 +28,10 @@ module Aethyr
class HelpHandler class HelpHandler
include Aethyr::Extend::HandleHelp include Aethyr::Extend::HandleHelp
def initialize(player, commands, *args) def initialize(player, commands, *args)
super super
end end
end end
end end
end end
\ No newline at end of file
...@@ -181,9 +181,10 @@ class Player < LivingObject ...@@ -181,9 +181,10 @@ class Player < LivingObject
end end
clean_input = input.downcase.strip clean_input = input.downcase.strip
self.output('Help topics available:') if (clean_input.eql? "help") or (clean_input.eql? "help topics") self.output("Help topics available: ", false) if (clean_input.eql? "help") or (clean_input.eql? "help topics")
broadcast(:player_input, {:publisher => self, :input => input}) broadcast(:player_input, {:publisher => self, :input => input})
event = CommandParser.parse(self, input) event = CommandParser.parse(self, input)
self.output(" ", false) if (clean_input.eql? "help") or (clean_input.eql? "help topics")
if event.nil? if event.nil?
if input if input
......
...@@ -266,7 +266,7 @@ class Display ...@@ -266,7 +266,7 @@ class Display
message << "\r\n" message << "\r\n"
end end
end end
send( message, message_type: message_type) send( message, message_type: message_type, add_newline: newline)
end end
def paginate message def paginate message
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment