diff options
author | ubq323 <ubq323@ubq323.website> | 2023-01-29 02:59:50 +0000 |
---|---|---|
committer | ubq323 <ubq323@ubq323.website> | 2023-01-29 02:59:50 +0000 |
commit | ebe12a65c07bccfbc704667c88d8125be33067cf (patch) | |
tree | 9c1ef457ce0da96b4d5dbe77cd56625f53b4ba89 /common | |
parent | 9b659149c7273a57a82c9be988a8a78c62bb23f4 (diff) |
camera stuff + vastly optimise hex drawing
Diffstat (limited to 'common')
-rw-r--r-- | common/chunk.lua | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/common/chunk.lua b/common/chunk.lua index 38cdaf0..432e37b 100644 --- a/common/chunk.lua +++ b/common/chunk.lua @@ -22,6 +22,11 @@ function Chunk.make() return setmetatable({tiles=tiles},Chunk) end +function Chunk.tile_at_offset(self,hoffs) + if not(0<=hoffs.q and 0<=hoffs.r and hoffs.q<CHUNK_SIZE and hoffs.r<CHUNK_SIZE) then return nil end + local idx = CHUNK_SIZE*hoffs.q + hoffs.r + return self.tiles[idx] +end return { Chunk=Chunk, |