diff options
Diffstat (limited to 'server/server.lua')
-rw-r--r-- | server/server.lua | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/server/server.lua b/server/server.lua index 12d70e5..42ed41d 100644 --- a/server/server.lua +++ b/server/server.lua @@ -1,5 +1,6 @@ local enet = require"enet" local json = require"common.dkjson" +local Chunk = require"common.chunk".Chunk local unpack = unpack or table.unpack math.randomseed(os.time()) @@ -56,6 +57,8 @@ local function player_move_packet(player,x,y) return json.encode{t="move",id=player.id,x=x,y=y} end +local the_chunk = Chunk.gen() + while true do local ev = host:service(100) if ev then @@ -64,6 +67,7 @@ while true do table.insert(playerlist,player) print("connect",player.peer,player.id) player.peer:send(player_you_packet(player)) + player.peer:send(the_chunk:data_packet()) for i,otherplayer in ipairs(playerlist) do if otherplayer ~= player then |