Class: Alchemist::Commands::Who

Inherits:
Base show all
Defined in:
lib/alchemist-server/commands/who.rb

Instance Attribute Summary

Attributes inherited from Base

#avatar_name, #history

Instance Method Summary collapse

Methods inherited from Base

#initialize, #outcome, pattern, run

Constructor Details

This class inherits a constructor from Alchemist::Commands::Base

Instance Method Details

#runObject



6
7
8
9
10
11
12
13
14
15
# File 'lib/alchemist-server/commands/who.rb', line 6

def run
  a = history.world.avatar avatar_name
  avatars = history.world.nearby_avatars a

  locations = avatars.map do |avatar|
    "#{avatar.name} #{avatar.x} #{avatar.y}\n"
  end

  outcome (["avatars #{locations.length}\n"] + locations).join('')
end