0

Added manual POI option

Here's how to use it:
have a list called "manualpois" in your config filled with objects that contain
the attributes id, x, y and z. Feel free to add more attributes as you need them.
Then, write filter functions to filter for your custom POIs (hint: use the id).
This commit is contained in:
CounterPillow
2012-12-31 16:22:41 +01:00
parent 4222b9f3c2
commit 2aa3a8cc02

View File

@@ -100,6 +100,13 @@ def handlePlayers(rset, render, worldpath):
"z": data['SpawnZ']}
rset._pois['Players'].append(spawn)
def handleManual(rset, render, manualpois):
if not hasattr(rset, "_pois"):
rset._pois = dict(TileEntities=[], Entities=[])
if manualpois:
rset._pois['Manual'] = manualpois
def main():
if os.path.basename(sys.argv[0]) == """genPOI.py""":
@@ -177,6 +184,7 @@ def main():
handleEntities(rset, os.path.join(destdir, rname), render, rname)
handlePlayers(rset, render, worldpath)
handleManual(rset, render, config['manualpois'])
logging.info("Done scanning regions")
logging.info("Writing out javascript files")
@@ -215,6 +223,15 @@ def main():
if "createInfoWindow" in poi:
d.update({"createInfoWindow": poi['createInfoWindow']})
markerSetDict[name]['raw'].append(d)
for poi in rset._pois['Manual']:
result = filter_function(poi)
if result:
d = dict(x=poi['x'], y=poi['y'], z=poi['z'], text=result)
if "icon" in poi:
d.update({"icon": poi['icon']})
if "createInfoWindow" in poi:
d.update({"createInfoWindow": poi['createInfoWindow']})
markerSetDict[name]['raw'].append(d)
#print markerSetDict
with open(os.path.join(destdir, "markersDB.js"), "w") as output: