diff options
author | Jesusaves <cpntb1@ymail.com> | 2020-04-23 12:34:57 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2020-04-23 12:34:57 -0300 |
commit | 9387caf1e412f0771ecaa5bf506727cda0a4f5f4 (patch) | |
tree | b49aa439997b94bc41649f0b53dbaba88e8338a7 | |
parent | cb73c414b222702a8a68237d296991397bf80663 (diff) | |
download | evol-tools-9387caf1e412f0771ecaa5bf506727cda0a4f5f4.tar.gz evol-tools-9387caf1e412f0771ecaa5bf506727cda0a4f5f4.tar.bz2 evol-tools-9387caf1e412f0771ecaa5bf506727cda0a4f5f4.tar.xz evol-tools-9387caf1e412f0771ecaa5bf506727cda0a4f5f4.zip |
Add support to dest_map="self" and dest_map="slide"
They'll create a slide object instead of a warp object.
-rwxr-xr-x | hercules/tmx_converter.py | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/hercules/tmx_converter.py b/hercules/tmx_converter.py index 611abee..3264797 100755 --- a/hercules/tmx_converter.py +++ b/hercules/tmx_converter.py @@ -372,13 +372,22 @@ class ContentHandler(xml.sax.ContentHandler): elif isinstance(obj, Warp): if (obj.npc_id == u'WARP'): obj_name = "#%s_%s_%s" % (self.base, obj.x, obj.y) - self.warps.write( - SEPARATOR.join([ - '%s,%d,%d,0\t' % (self.base, obj.x, obj.y), - 'warp\t', - '%s\t%s,%s,%s,%d,%d\n' % (obj_name, obj.w, obj.h, obj.dest_map, obj.dest_x, obj.dest_y), - ]) - ) + if (obj.dest_map.lower() in ["slide", "self"]): + self.warps.write( + SEPARATOR.join([ + '%s,%d,%d,0\t' % (self.base, obj.x, (obj.y)), + 'script\t', + '%s\tNPC_HIDDEN,%d,%d,{\n\tend;\nOnTouch:\n\tslide %d,%d; end;\n}\n' % (obj_name, obj.w, obj.h, obj.dest_x, obj.dest_y), + ]) + ) + else: + self.warps.write( + SEPARATOR.join([ + '%s,%d,%d,0\t' % (self.base, obj.x, obj.y), + 'warp\t', + '%s\t%s,%s,%s,%d,%d\n' % (obj_name, obj.w, obj.h, obj.dest_map, obj.dest_x, obj.dest_y), + ]) + ) self.warp_cnt = True elif (not obj.npc_id == u'SCRIPT'): obj_name = "#%s_%s_%s" % (self.base, obj.x, obj.y) |