Map exec
Some checks failed
Build Dusk / build-linux (push) Successful in 1m40s
Build Dusk / build-psp (push) Failing after 1m38s

This commit is contained in:
2025-12-26 20:38:24 +10:00
parent 7940f4c487
commit 726233e55f
29 changed files with 152 additions and 33 deletions

View File

@@ -131,12 +131,12 @@ class Chunk:
return self.dirty
def getFilename(self):
if not self.map or not hasattr(self.map, 'getMapDirectory'):
if not self.map or not hasattr(self.map, 'getChunkDirectory'):
return None
dir_path = self.map.getMapDirectory()
if dir_path is None:
dirPath = self.map.getChunkDirectory()
if dirPath is None:
return None
return f"{dir_path}/{self.x}_{self.y}_{self.z}.json"
return f"{dirPath}/{self.x}_{self.y}_{self.z}.json"
def draw(self):
self.vertexBuffer.draw()

View File

@@ -1,4 +1,5 @@
import json
import sys
from dusk.event import Event
from PyQt5.QtWidgets import QFileDialog, QMessageBox
from PyQt5.QtCore import QTimer
@@ -129,11 +130,17 @@ class Map:
return self.mapFileName if self.mapFileName and os.path.exists(self.mapFileName) else None
def getMapDirectory(self):
fname = self.getMapFilename()
if not fname or not fname.endswith('.json'):
if self.mapFileName is None:
return None
return fname[:-5] # Remove '.json' extension
dirname = os.path.dirname(self.mapFileName)
return dirname
def getChunkDirectory(self):
dirName = self.getMapDirectory()
if dirName is None:
return None
return os.path.join(dirName, 'chunks')
def anyChunksDirty(self):
for chunk in self.chunks.values():
if chunk.isDirty():