diff options
author | Jesusaves <cpntb1@ymail.com> | 2019-03-15 21:38:08 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2019-03-15 21:38:08 -0300 |
commit | a958a4b5b5c6b81b0bf184c75721a49c3cfb48dd (patch) | |
tree | e07fb0df351729f403fbf0bb15a4475283def903 /hercules | |
parent | e047232276ddc35e485223754ba655eebad17a53 (diff) | |
download | tools-a958a4b5b5c6b81b0bf184c75721a49c3cfb48dd.tar.gz tools-a958a4b5b5c6b81b0bf184c75721a49c3cfb48dd.tar.bz2 tools-a958a4b5b5c6b81b0bf184c75721a49c3cfb48dd.tar.xz tools-a958a4b5b5c6b81b0bf184c75721a49c3cfb48dd.zip |
Warp objects can now have dest_map set to "slide" or "self".
This will make a slide instead of a warp on server, without losing client effect.
Diffstat (limited to 'hercules')
-rwxr-xr-x | hercules/tmx_converter.py | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/hercules/tmx_converter.py b/hercules/tmx_converter.py index 7c68446..feaf103 100755 --- a/hercules/tmx_converter.py +++ b/hercules/tmx_converter.py @@ -340,21 +340,29 @@ 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 isinstance(obj, Slide): if (obj.npc_id == u'SLIDE'): obj_name = "#%s_%s_%s" % (self.base, obj.x, obj.y) - y_offset = int(self.heightmap[((obj.y * self.width) + obj.x)])/2 self.warps.write( SEPARATOR.join([ - '%s,%d,%d,0\t' % (self.base, obj.x, (obj.y + y_offset)), + '%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), ]) |