module Gamefic::World::Players

Public Instance Methods

get_player_character()
make_player_character() click to toggle source

Make a character that a player will control on introduction.

@return [Gamefic::Actor]

# File lib/gamefic/world/players.rb, line 31
def make_player_character
  cast player_class, name: 'yourself', synonyms: 'self myself you me', proper_named: true
end
Also aliased as: get_player_character
player_class(cls = nil) click to toggle source
# File lib/gamefic/world/players.rb, line 14
def player_class cls = nil
  STDERR.puts "Modifying player_class this way is deprecated. Use set_player_class instead" unless cls.nil?
  @player_class = cls unless cls.nil?
  @player_class ||= Gamefic::Actor
end
players() click to toggle source

An array of entities that are currently connected to users.

@return [Array<Gamefic::Actor>]

# File lib/gamefic/world/players.rb, line 10
def players
  @players ||= []
end
set_player_class(cls) click to toggle source

@param cls [Class]

# File lib/gamefic/world/players.rb, line 21
def set_player_class cls
  unless cls < Gamefic::Active && cls <= Gamefic::Entity
    raise ArgumentError, "Player class must be an active entity"
  end
  @player_class = cls
end