summaryrefslogtreecommitdiff
path: root/common/chunk.lua
diff options
context:
space:
mode:
authorubq323 <ubq323@ubq323.website>2023-01-31 23:51:25 +0000
committerubq323 <ubq323@ubq323.website>2023-01-31 23:51:25 +0000
commit04664ee48de5fc8b06a584e20a4b75c41dafa558 (patch)
tree49192241d64897fb34f75a92dbab1e11d706fa22 /common/chunk.lua
parent82c4e04fa6b27a1e9cb5469d7847aef80e5a22bd (diff)
add sending of tile changes, between players. server remembers all changes made. also add better debug screen
Diffstat (limited to 'common/chunk.lua')
-rw-r--r--common/chunk.lua4
1 files changed, 4 insertions, 0 deletions
diff --git a/common/chunk.lua b/common/chunk.lua
index e210387..a9a8bc5 100644
--- a/common/chunk.lua
+++ b/common/chunk.lua
@@ -35,6 +35,10 @@ function Chunk.at(self,hoffs)
if not index_ok(hoffs.q,hoffs.r) then return nil end
return self.tiles[index(hoffs.q,hoffs.r)]
end
+function Chunk.set_at(self,hoffs,tile)
+ if not index_ok(hoffs.q,hoffs.r) then return end
+ self.tiles[index(hoffs.q,hoffs.r)] = tile
+end
function Chunk.data_packet(self)
return json.encode{t="chunk",tiles=self.tiles}