Class: Conreality::Player
Overview
Represents a Conreality player.
Constant Summary collapse
- TABLE =
:object_player- KEY =
:uuid
Instance Attribute Summary collapse
-
#avatar ⇒ Binary
The player’s avatar image.
-
#ip_addr ⇒ String
The player’s IPv4/IPv6 address.
-
#language ⇒ String
The player’s primary language.
-
#name ⇒ String
The player’s full name.
-
#nick ⇒ String
The player’s nickname.
Attributes inherited from Object
#color, #group, #label, #mass, #orientation, #position, #radius, #theater, #type, #uuid
Instance Method Summary collapse
-
#camera ⇒ Camera?
Returns the bodycam, if any, of this player.
-
#deregister! ⇒ void
Deregisters this player from the game.
-
#has_camera? ⇒ Boolean
Checks whether this player has a bodycam.
-
#initialize(session, uuid) ⇒ Player
constructor
A new instance of Player.
Methods inherited from Object
#as_asset, #as_camera, #as_player, #inspect, #is_asset?, #is_camera?, #is_player?, #is_target?, #send_message
Constructor Details
#initialize(session, uuid) ⇒ Player
Returns a new instance of Player.
44 45 46 |
# File 'lib/conreality/player.rb', line 44 def initialize(session, uuid) super(session, uuid) end |
Instance Attribute Details
#avatar ⇒ Binary
The player’s avatar image.
32 33 34 |
# File 'lib/conreality/player.rb', line 32 def avatar @avatar end |
#ip_addr ⇒ String
The player’s IPv4/IPv6 address.
26 27 28 |
# File 'lib/conreality/player.rb', line 26 def ip_addr @ip_addr end |
#language ⇒ String
The player’s primary language.
39 40 41 |
# File 'lib/conreality/player.rb', line 39 def language @language end |
#name ⇒ String
The player’s full name.
20 21 22 |
# File 'lib/conreality/player.rb', line 20 def name @name end |
#nick ⇒ String
The player’s nickname.
14 15 16 |
# File 'lib/conreality/player.rb', line 14 def nick @nick end |
Instance Method Details
#camera ⇒ Camera?
Returns the bodycam, if any, of this player.
62 63 64 |
# File 'lib/conreality/player.rb', line 62 def camera self.has_camera? ? self.as_camera : nil end |
#deregister! ⇒ void
This method returns an undefined value.
Deregisters this player from the game.
70 71 72 |
# File 'lib/conreality/player.rb', line 70 def deregister! # TODO end |
#has_camera? ⇒ Boolean
Checks whether this player has a bodycam.
52 53 54 55 56 |
# File 'lib/conreality/player.rb', line 52 def has_camera? @session.client.exec_with_params("SELECT COUNT(*) FROM #{q(Database::SCHEMA)}.#{q(:camera)} WHERE #{q(:uuid)} = $1 LIMIT 1", self.key) do |result| !!result.num_tuples.nonzero? end end |