-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMbPlayer.lua
35 lines (28 loc) · 1.07 KB
/
MbPlayer.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
--- MouseBase player class.
--- @class mousebase.MbPlayer:mousebase.EventEmitter
--- @field public name string @The player's A801 name
--- @field public nameSid string @The player's stringified consistent name identifier
--- @field public isSouris boolean @Whether the player is a souris (guest)
local Player = require("EventEmitter"):extend("MbPlayer")
local nickname801 = require("@mousetool/nickname801")
local nickname801_isSouris = nickname801.isSouris
local nickname801_idName = nickname801.idName
local roomGet = tfm.get.room
--- @param name string The name of the player
Player._init = function(self, name)
Player._parent._init(self)
self.name = name
self.nameSid = nickname801_idName(name)
self.isSouris = nickname801_isSouris(name)
end
--- Retrieves the indexed playerList of the player.
--- @return tfm.Player
Player.getTfmPlayer = function(self)
return roomGet.playerList[self.name]
end
--- Displays a chat message to the player.
--- @param messsge string
Player.chatMsg = function(self, messsge)
tfm.exec.chatMessage(messsge, self.name)
end
return Player