diff options
author | Jesusaves <cpntb1@ymail.com> | 2020-06-24 00:23:50 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2020-06-24 00:23:50 -0300 |
commit | 1e783f3840c182e3dbe1490b3f35862ae1bca5de (patch) | |
tree | 4f7fd2ecd544726cef65fe7471ace0e45e620ed7 | |
parent | 951b50be5e42d25ffc9cdbf7ba3e03ef8b0337c0 (diff) | |
download | tools-1e783f3840c182e3dbe1490b3f35862ae1bca5de.tar.gz tools-1e783f3840c182e3dbe1490b3f35862ae1bca5de.tar.bz2 tools-1e783f3840c182e3dbe1490b3f35862ae1bca5de.tar.xz tools-1e783f3840c182e3dbe1490b3f35862ae1bca5de.zip |
Allow switches to doevent() as well
It is needed for Dynamic Collision
-rwxr-xr-x | hercules/tmx_converter.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/hercules/tmx_converter.py b/hercules/tmx_converter.py index 55bca23..92cf5a5 100755 --- a/hercules/tmx_converter.py +++ b/hercules/tmx_converter.py @@ -146,11 +146,14 @@ class DungeonSwitch(Object): 'enabled', 'distance', 'callfunc', + 'doevent', 'args', ) def __init__(self): self.enabled = False self.distance = 2 + self.callfunc = '' + self.doevent = '' self.args = '' class FunctionTrigger(Object): @@ -473,6 +476,9 @@ class ContentHandler(xml.sax.ContentHandler): obj_name = "%s_%s_%s" % (self.base, obj.x, obj.y) status = ifte(obj.enabled, "OFFLINE", "ONLINE") nstats = ifte(obj.enabled, "ONLINE", "OFFLINE") + func_name = ifte(obj.callfunc != "", "\tcallfunc \"%s\"%s;\n" % (obj.callfunc, + ifte(obj.args != "", ", %s" % obj.args, "")), "") + scrp_name = ifte(obj.doevent != "", "\tdoevent \"%s\";\n" % (obj.doevent), "") self.confs.write( SEPARATOR.join([ '\n', @@ -480,7 +486,7 @@ class ContentHandler(xml.sax.ContentHandler): 'script\t', '#%s\tNPC_SWITCH_%s,{\n' % (obj_name, status), '\tif (getnpcclass() == NPC_SWITCH_%s)\n\t\tend;\n' % (nstats), - '\tcallfunc "%s"%s;\n' % (obj.callfunc, ifte(obj.args != '', ", %s" % obj.args, "")), + '%s%s' % (func_name, scrp_name), '\tsetnpcdisplay "#%s", NPC_SWITCH_%s;\n\tend;\nOnInit:\n\t.distance=%d;\n}\n' % (obj_name, nstats, obj.distance), ]) ) |