blob: 365eadc9eb68c0021c127ed0d9bce91e515e1ad2 (
plain)
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
|
local class = require'common.class'
local Pos = require'common.coords'.Pos
local nextid = 1
local function random_color()
return {math.random(),math.random(),math.random()}
end
local Player = class()
function Player.make(cls,peer)
local self = {
pos = Pos:make(0,0),
color = random_color(),
peer = peer,
id = nextid,
}
nextid = nextid + 1
return setmetatable(self,cls)
end
function Player.info_part(self)
-- eh
return {
id=self.id,
x=self.pos.x,
y=self.pos.y,
color=self.color,
}
end
return {Player=Player}
|