Merge pull request #858
This commit is contained in:
@@ -100,6 +100,15 @@ def handlePlayers(rset, render, worldpath):
|
||||
"z": data['SpawnZ']}
|
||||
rset._pois['Players'].append(spawn)
|
||||
|
||||
def handleManual(rset, manualpois):
|
||||
if not hasattr(rset, "_pois"):
|
||||
rset._pois = dict(TileEntities=[], Entities=[])
|
||||
|
||||
rset._pois['Manual'] = []
|
||||
|
||||
if manualpois:
|
||||
rset._pois['Manual'].extend(manualpois)
|
||||
|
||||
def main():
|
||||
|
||||
if os.path.basename(sys.argv[0]) == """genPOI.py""":
|
||||
@@ -177,6 +186,7 @@ def main():
|
||||
|
||||
handleEntities(rset, os.path.join(destdir, rname), render, rname)
|
||||
handlePlayers(rset, render, worldpath)
|
||||
handleManual(rset, render['manualpois'])
|
||||
|
||||
logging.info("Done scanning regions")
|
||||
logging.info("Writing out javascript files")
|
||||
@@ -215,6 +225,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:
|
||||
|
||||
@@ -86,6 +86,7 @@ renders = Setting(required=True, default=util.OrderedDict(),
|
||||
"poititle": Setting(required=False, validator=validateStr, default="Signs"),
|
||||
"customwebassets": Setting(required=False, validator=validateWebAssetsPath, default=None),
|
||||
"maxzoom": Setting(required=False, validator=validateInt, default=None),
|
||||
"manualpois": Setting(required=False, validator=validateManualPOIs, default=[]),
|
||||
# Remove this eventually (once people update their configs)
|
||||
"worldname": Setting(required=False, default=None,
|
||||
validator=error("The option 'worldname' is now called 'world'. Please update your config files")),
|
||||
|
||||
@@ -227,6 +227,12 @@ def validatePath(p):
|
||||
if not os.path.exists(abs_path):
|
||||
raise ValidationException("'%s' does not exist. Path initially given as '%s'" % (abs_path,p))
|
||||
|
||||
def validateManualPOIs(d):
|
||||
for poi in d:
|
||||
if not poi['x'] or not poi['y'] or not poi['z'] or not poi['id']:
|
||||
raise ValidationException("Not all POIs have x/y/z coordinates or an id.")
|
||||
return d
|
||||
|
||||
def make_dictValidator(keyvalidator, valuevalidator):
|
||||
"""Compose and return a dict validator -- a validator that validates each
|
||||
key and value in a dictionary.
|
||||
|
||||
Reference in New Issue
Block a user