From 27b7433eb7dce73d01ce13e0e109b7d6222f3ecb Mon Sep 17 00:00:00 2001 From: Jeffrey Phillips Freeman <jeffrey.freeman@syncleus.com> Date: Wed, 24 Feb 2021 21:55:08 -0500 Subject: [PATCH] Moved deleteme out to its own file. --- lib/aethyr/core/input_handlers/deleteme.rb | 51 ++++++++++++++++++++++ lib/aethyr/core/input_handlers/generic.rb | 16 +------ 2 files changed, 52 insertions(+), 15 deletions(-) create mode 100644 lib/aethyr/core/input_handlers/deleteme.rb diff --git a/lib/aethyr/core/input_handlers/deleteme.rb b/lib/aethyr/core/input_handlers/deleteme.rb new file mode 100644 index 0000000..2e8507f --- /dev/null +++ b/lib/aethyr/core/input_handlers/deleteme.rb @@ -0,0 +1,51 @@ + +require "aethyr/core/actions/commands/deleteme" +require "aethyr/core/registry" +require "aethyr/core/input_handlers/command_handler" + +module Aethyr + module Core + module Commands + module Deleteme + class DeletemeHandler < Aethyr::Extend::CommandHandler + + def self.create_help_entries + help_entries = [] + + command = "deleteme" + see_also = nil + syntax_formats = ["DELETE ME PLEASE"] + aliases = nil + content = <<'EOF' +Deleting Your Character + +In case you ever need to do so, you can remove your character from the game. Quite permanently. You will need to enter your password as confirmation and that's it. You will be wiped out of time and memory. + +EOF + help_entries.push(Aethyr::Core::Help::HelpEntry.new(command, content: content, syntax_formats: syntax_formats, see_also: see_also, aliases: aliases)) + + return help_entries + end + + + def initialize(player) + super(player, ["delete"], help_entries: DeletemeHandler.create_help_entries) + end + + def self.object_added(data) + super(data, self) + end + + def player_input(data) + super(data) + case data[:input] + when /^delete me please$/i + $manager.submit_action(Aethyr::Core::Actions::Deleteme::DeletemeCommand.new(@player, {})) + end + end + end + Aethyr::Extend::HandlerRegistry.register_handler(DeletemeHandler) + end + end + end +end diff --git a/lib/aethyr/core/input_handlers/generic.rb b/lib/aethyr/core/input_handlers/generic.rb index 8c76691..43873bc 100644 --- a/lib/aethyr/core/input_handlers/generic.rb +++ b/lib/aethyr/core/input_handlers/generic.rb @@ -3,7 +3,6 @@ require "aethyr/core/actions/commands/listen" require "aethyr/core/actions/commands/smell" require "aethyr/core/actions/commands/taste" require "aethyr/core/actions/commands/write" -require "aethyr/core/actions/commands/deleteme" require "aethyr/core/actions/commands/who" require "aethyr/core/actions/commands/date" require "aethyr/core/actions/commands/time" @@ -128,17 +127,6 @@ EOF - command = "deleteme" - see_also = nil - syntax_formats = ["DELETE ME PLEASE"] - aliases = nil - content = <<'EOF' -Deleting Your Character - -In case you ever need to do so, you can remove your character from the game. Quite permanently. You will need to enter your password as confirmation and that's it. You will be wiped out of time and memory. - -EOF - help_entries.push(Aethyr::Core::Help::HelpEntry.new(command, content: content, syntax_formats: syntax_formats, see_also: see_also, aliases: aliases)) @@ -205,7 +193,7 @@ EOF def initialize(player) - super(player, ['date', 'delete', 'feel', 'taste', 'smell', 'sniff', 'lick', 'listen', 'health', 'hunger', 'satiety', 'shut', 'status', 'stat', 'st', 'time', 'typo', 'who', 'write'], help_entries: GenericHandler.create_help_entries) + super(player, ['date', 'feel', 'taste', 'smell', 'sniff', 'lick', 'listen', 'health', 'hunger', 'satiety', 'shut', 'status', 'stat', 'st', 'time', 'typo', 'who', 'write'], help_entries: GenericHandler.create_help_entries) end def self.object_added(data) @@ -215,8 +203,6 @@ EOF def player_input(data) super(data) case data[:input] - when /^delete me please$/i - $manager.submit_action(Aethyr::Core::Actions::Deleteme::DeletemeCommand.new(@player, {})) when /^(health)$/i $manager.submit_action(Aethyr::Core::Actions::Health::HealthCommand.new(@player, {})) when /^(satiety|hunger)$/i -- GitLab