From 0d86a5cf4b84e03af518d4b8dceb2385672032a8 Mon Sep 17 00:00:00 2001 From: ubq323 Date: Mon, 6 Feb 2023 12:19:58 +0000 Subject: clientside chunk unloading when not near. also refactor coordinate things slightly --- server/map.lua | 1 + server/noise.lua | 2 +- server/server.lua | 5 ++++- 3 files changed, 6 insertions(+), 2 deletions(-) (limited to 'server') diff --git a/server/map.lua b/server/map.lua index 845c644..335997a 100644 --- a/server/map.lua +++ b/server/map.lua @@ -1,6 +1,7 @@ local Map = require"common.map".Map local class = require"common.class" local worldgen = require"worldgen" +local json = require"common.dkjson" local MapS = class.extend(Map) function MapS.obtain(self,cp) diff --git a/server/noise.lua b/server/noise.lua index 8a83b60..fe254ac 100644 --- a/server/noise.lua +++ b/server/noise.lua @@ -25,7 +25,7 @@ end function PerlinNoise.vertex(self,ix,iy) local v = self.grid[ix][iy] if v then return v end - vv = random_unit_vec() + local vv = random_unit_vec() self.grid[ix][iy] = vv return vv end diff --git a/server/server.lua b/server/server.lua index eda6258..725f7f1 100644 --- a/server/server.lua +++ b/server/server.lua @@ -159,8 +159,11 @@ local ntick = 0 local function tick(ntick) - if ntick % 30 == 0 then + if ntick % 3 == 0 then print("saving things...") + for cp,ch in map:iter_chunks() do + print(cp) + end end end -- cgit v1.2.3