From 2aa3a8cc028a1c1a21f0e78a6aa268aeb6daa262 Mon Sep 17 00:00:00 2001 From: CounterPillow Date: Mon, 31 Dec 2012 16:22:41 +0100 Subject: [PATCH] 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). --- overviewer_core/aux_files/genPOI.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/overviewer_core/aux_files/genPOI.py b/overviewer_core/aux_files/genPOI.py index 78390a5..786134f 100755 --- a/overviewer_core/aux_files/genPOI.py +++ b/overviewer_core/aux_files/genPOI.py @@ -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: