0

manualpois is now a per-render option

This commit is contained in:
CounterPillow
2012-12-31 18:54:31 +01:00
parent 2aa3a8cc02
commit b13f0044e2
3 changed files with 12 additions and 3 deletions

View File

@@ -100,12 +100,14 @@ def handlePlayers(rset, render, worldpath):
"z": data['SpawnZ']}
rset._pois['Players'].append(spawn)
def handleManual(rset, render, manualpois):
def handleManual(rset, manualpois):
if not hasattr(rset, "_pois"):
rset._pois = dict(TileEntities=[], Entities=[])
rset._pois['Manual'] = []
if manualpois:
rset._pois['Manual'] = manualpois
rset._pois['Manual'].extend(manualpois)
def main():
@@ -184,7 +186,7 @@ def main():
handleEntities(rset, os.path.join(destdir, rname), render, rname)
handlePlayers(rset, render, worldpath)
handleManual(rset, render, config['manualpois'])
handleManual(rset, render['manualpois'])
logging.info("Done scanning regions")
logging.info("Writing out javascript files")

View File

@@ -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")),

View File

@@ -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.