From d5dc40e465bbaf3cab7ac7eb58c66e7ffa61176e Mon Sep 17 00:00:00 2001 From: Jeffrey Phillips Freeman <jeffrey.freeman@syncleus.com> Date: Tue, 16 Apr 2019 16:15:30 -0400 Subject: [PATCH] improved output of help command --- lib/aethyr/core/commands/help_handler.rb | 16 +++++++--------- lib/aethyr/core/objects/player.rb | 3 ++- lib/aethyr/core/render/display.rb | 2 +- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/lib/aethyr/core/commands/help_handler.rb b/lib/aethyr/core/commands/help_handler.rb index a37f385..4e1a113 100644 --- a/lib/aethyr/core/commands/help_handler.rb +++ b/lib/aethyr/core/commands/help_handler.rb @@ -4,25 +4,23 @@ module Aethyr module Extend module HandleHelp attr_reader :commands - + def initialize(player, commands, *args) super(player, *args) - + @commands = commands end - + def player_input(data) super(data) case data[:input] when /^(help|help topics)$/i if self.can_help? - self.commands.each do |command| - self.player.output command - end + self.player.output( commands.join(" ") + " ", true) end end end - + def can_help? true end @@ -30,10 +28,10 @@ module Aethyr class HelpHandler include Aethyr::Extend::HandleHelp - + def initialize(player, commands, *args) super end end end -end \ No newline at end of file +end diff --git a/lib/aethyr/core/objects/player.rb b/lib/aethyr/core/objects/player.rb index bb4d270..3c5aa37 100644 --- a/lib/aethyr/core/objects/player.rb +++ b/lib/aethyr/core/objects/player.rb @@ -181,9 +181,10 @@ class Player < LivingObject end 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}) event = CommandParser.parse(self, input) + self.output(" ", false) if (clean_input.eql? "help") or (clean_input.eql? "help topics") if event.nil? if input diff --git a/lib/aethyr/core/render/display.rb b/lib/aethyr/core/render/display.rb index 25edde3..7a22990 100644 --- a/lib/aethyr/core/render/display.rb +++ b/lib/aethyr/core/render/display.rb @@ -266,7 +266,7 @@ class Display message << "\r\n" end end - send( message, message_type: message_type) + send( message, message_type: message_type, add_newline: newline) end def paginate message -- GitLab