Edit chunks when character is written to map
This commit is contained in:
parent
5b4a6a4a83
commit
9f02d63a7d
1 changed files with 8 additions and 1 deletions
9
maps.py
9
maps.py
|
|
@ -91,7 +91,14 @@ class Map():
|
||||||
return coords
|
return coords
|
||||||
|
|
||||||
def write(self, char):
|
def write(self, char):
|
||||||
pass
|
with self.chunkpool as pool:
|
||||||
|
chunk = pool.get(chunkx(self.cursorx), chunky(self.cursory))
|
||||||
|
if not chunk:
|
||||||
|
chunk = pool.create(chunkx(self.cursorx), chunky(self.cursory))
|
||||||
|
|
||||||
|
chunk.setch(inchunkx(self.cursorx), inchunky(self.cursory), char)
|
||||||
|
|
||||||
|
self.move_cursor(1, 0)
|
||||||
|
|
||||||
def move_cursor(self, dx, dy):
|
def move_cursor(self, dx, dy):
|
||||||
self.cursorx += dx
|
self.cursorx += dx
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue