Module: RuneRb::Game::Entity::Helpers::Command

Included in:
Context
Defined in:
app/game/entity/helpers/command.rb

Overview

Since:

  • 0.9.3

Instance Method Summary collapse

Instance Method Details

#fetch_command(label) ⇒ RuneRb::Game::Entity::Command, FalseClass

Attempts to fetch a registered Command object by it's label

Parameters:

  • label (Symbol, String)

    the label that will be used to fetch the Command

Returns:

Since:

  • 0.9.3


22
23
24
# File 'app/game/entity/helpers/command.rb', line 22

def fetch_command(label)
  @commands[label].nil? ? false : @commands[label]
end

#load_commandsObject

Initializes the Instance#commands hash and populates it with recognizable commands.

Since:

  • 0.9.3


4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'app/game/entity/helpers/command.rb', line 4

def load_commands
  @commands = {
    Animation: RuneRb::Game::Entity::Commands::Animation,
    Ban: RuneRb::Game::Entity::Commands::Ban,
    Graphic: RuneRb::Game::Entity::Commands::Graphic,
    Ascend: RuneRb::Game::Entity::Commands::Ascend,
    Descend: RuneRb::Game::Entity::Commands::Descend,
    Design: RuneRb::Game::Entity::Commands::Design,
    Position: RuneRb::Game::Entity::Commands::Position,
    Show: RuneRb::Game::Entity::Commands::Show,
    To: RuneRb::Game::Entity::Commands::To,
    Item: RuneRb::Game::Entity::Commands::Item
  }.freeze
end