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,username) local self = { pos = Pos:make(0,0), color = random_color(), peer = peer, id = nextid, username = username, inv = {}, } 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, username=self.username, inv = self.inv, } end return {Player=Player}