summaryrefslogtreecommitdiff
path: root/src/mapdata.py
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/mapdata.py42
1 files changed, 40 insertions, 2 deletions
diff --git a/src/mapdata.py b/src/mapdata.py
index 23c6b83..b8ab263 100644
--- a/src/mapdata.py
+++ b/src/mapdata.py
@@ -147,6 +147,40 @@ class KPTileLayer(KPLayer):
y += 1
+@mapfile.dumpable('tile_layer')
+class KPPathTileLayer(KPTileLayer):
+ __dump_attribs__ = KPLayer.__dump_attribs__ + ('tileset', 'objects')
+
+ def __repr__(self):
+ return "<KPPathTileLayer %r with %r connected to %r>" % (self.name, self.tileset, self.pathnode)
+
+ def __init__(self, pathnode):
+ KPLayer.__init__(self)
+ self.tileset = KP.map.pathNodeTileset
+ self.objects = []
+ self.doodads = []
+ self.pathnode = pathnode
+
+ self.cache = ['DUMMY_FLAG']
+ self.updateCache()
+
+ self.icon = KP.icon('LayerTile')
+
+ def getPathNode(self):
+ return self.pathnode
+
+ def _visibilityChanged(self, value):
+ for obj in self.objects:
+ item = obj.qtItem
+ if item:
+ item.setVisible(value)
+
+ for obj in self.doodads:
+ item = obj.qtItem
+ if item:
+ item.setVisible(value)
+
+
@mapfile.dumpable('doodad')
class KPDoodad(object):
__dump_attribs__ = ('position', 'size', 'angle', 'animations')
@@ -274,7 +308,6 @@ class KPNode(object):
return True if (self.level or self.mapChange or len(self.exits) != 2) else False
-
@mapfile.dumpable('path')
class KPPath(object):
__dump_attribs__ = ('unlocks', 'secret', 'animation', 'movementSpeed')
@@ -413,9 +446,14 @@ class KPMap(object):
self.loadTilesets()
+ try:
+ self.pathNodeTileset = self.tilesets[0]
+ except:
+ self.pathNodeTileset = ''
+
# LAYERS
- class LayerModel(QtCore.QAbstractListModel):
+ class LayerModel(QtCore.QAbstractItemModel):
def __init__(self, layerList):
QtCore.QAbstractListModel.__init__(self)
self.list = layerList