diff options
author | Juan J. Martinez <jjm@usebox.net> | 2022-12-11 10:41:23 +0000 |
---|---|---|
committer | Juan J. Martinez <jjm@usebox.net> | 2022-12-11 10:41:23 +0000 |
commit | fa92e111ab5dfb3f386ad53317fea0103111cfbb (patch) | |
tree | ec634258d3391c05b4fe20cedaca4fb65ca8e3e8 /tools | |
parent | 4f4e4d92c83795bd2283ed7ff7f61e56c583ad9c (diff) | |
download | ubox-msx-lib-fa92e111ab5dfb3f386ad53317fea0103111cfbb.tar.gz ubox-msx-lib-fa92e111ab5dfb3f386ad53317fea0103111cfbb.zip |
Make Entities layer optional.
It can also be disabled using "visible" flag in tiled.
Closes issue #19
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/map.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/tools/map.py b/tools/map.py index 60ef887..476c1cd 100755 --- a/tools/map.py +++ b/tools/map.py @@ -220,8 +220,16 @@ def main(): # ents size placeholder 0 out[i] = [size & 0xFF, size >> 8, 0] + out[i] - entities_layer = find_name(data["layers"], "Entities") - if len(entities_layer): + try: + entities_layer = find_name(data["layers"], "Entities") + except ValueError: + entities_layer = [] + if not args.quiet: + print( + "%s: warning: 'Entities' layer not found" % path.basename(sys.argv[0]), + file=sys.stderr, + ) + if len(entities_layer) and entities_layer["visible"]: map_ents = defaultdict(list) map_ents_w = defaultdict(int) map_ents_bytes = defaultdict(int) |