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:
@@ -100,6 +100,13 @@ def handlePlayers(rset, render, worldpath):
|
|||||||
"z": data['SpawnZ']}
|
"z": data['SpawnZ']}
|
||||||
rset._pois['Players'].append(spawn)
|
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():
|
def main():
|
||||||
|
|
||||||
if os.path.basename(sys.argv[0]) == """genPOI.py""":
|
if os.path.basename(sys.argv[0]) == """genPOI.py""":
|
||||||
@@ -177,6 +184,7 @@ def main():
|
|||||||
|
|
||||||
handleEntities(rset, os.path.join(destdir, rname), render, rname)
|
handleEntities(rset, os.path.join(destdir, rname), render, rname)
|
||||||
handlePlayers(rset, render, worldpath)
|
handlePlayers(rset, render, worldpath)
|
||||||
|
handleManual(rset, render, config['manualpois'])
|
||||||
|
|
||||||
logging.info("Done scanning regions")
|
logging.info("Done scanning regions")
|
||||||
logging.info("Writing out javascript files")
|
logging.info("Writing out javascript files")
|
||||||
@@ -215,6 +223,15 @@ def main():
|
|||||||
if "createInfoWindow" in poi:
|
if "createInfoWindow" in poi:
|
||||||
d.update({"createInfoWindow": poi['createInfoWindow']})
|
d.update({"createInfoWindow": poi['createInfoWindow']})
|
||||||
markerSetDict[name]['raw'].append(d)
|
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
|
#print markerSetDict
|
||||||
|
|
||||||
with open(os.path.join(destdir, "markersDB.js"), "w") as output:
|
with open(os.path.join(destdir, "markersDB.js"), "w") as output:
|
||||||
|
|||||||
Reference in New Issue
Block a user