Implement parts of clientchunkpool and fix softlock in the process

This commit is contained in:
Joscha 2017-04-09 09:52:11 +00:00
parent c5af7c2480
commit 23da1ea5d9
5 changed files with 90 additions and 31 deletions

View file

@ -5,8 +5,31 @@ class ClientChunkPool(ChunkPool):
A ChunkPool that requests/loads chunks from a client.
"""
def __init__(self):
def __init__(self, client):
super().__init__()
self.max_age = 10 #s
self._client = client
pass
#def commit_changes(self):
#changes = []
#for pos, chunk in self._chunks.items():
#changes.append((pos, chunk.get_changes()))
#chunk.commit_changes()
#return changes
def apply_changes(self, changes):
super().apply_changes(changes)
self._client.redraw()
def save_changes(self):
changes = self.commit_changes()
self._client.send_changes(changes)
def load(self, pos):
raise Exception
def load_list(self, coords):
self._client.request_chunks(coords)