From 1490cf19a950d99b045fe68d7151a6cd54c57e27 Mon Sep 17 00:00:00 2001 From: ubq323 Date: Sun, 18 Jun 2023 03:31:03 +0100 Subject: add handshaking system, and refactor server a bit --- server/player.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'server/player.lua') diff --git a/server/player.lua b/server/player.lua index 365eadc..bd7b52a 100644 --- a/server/player.lua +++ b/server/player.lua @@ -8,23 +8,25 @@ local function random_color() end local Player = class() -function Player.make(cls,peer) +function Player.make(cls,peer,username) local self = { pos = Pos:make(0,0), color = random_color(), peer = peer, id = nextid, + username = username, } nextid = nextid + 1 return setmetatable(self,cls) end function Player.info_part(self) - -- eh + -- eh return { id=self.id, x=self.pos.x, y=self.pos.y, color=self.color, + username=self.username, } end -- cgit v1.2.3