Files
dusk/tools/editortool/map/map.py
Dominic Masters cf59989167
All checks were successful
Build Dusk / build-linux (push) Successful in 50s
Build Dusk / build-psp (push) Successful in 59s
Closer to actually editing
2025-11-16 10:40:20 -06:00

37 lines
773 B
Python

class Map:
def __init__(self):
self._position = [0, 0, 0] # x, y, z
self.listeners = []
self.chunks = []
self.width = 5
self.height = 5
self.depth = 3
@property
def position(self):
return self._position
@position.setter
def position(self, value):
self._position = value
self.notifyPositionListeners()
def addPositionListener(self, listener):
self.listeners.append(listener)
def notifyPositionListeners(self):
for listener in self.listeners:
listener(self._position)
def moveTo(self, x, y, z):
self.position = [x, y, z]
def moveRelative(self, x, y, z):
self.moveTo(
self._position[0] + x,
self._position[1] + y,
self._position[2] + z
)
# Singleton instance
map = Map()