summaryrefslogtreecommitdiff
path: root/hercules
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2020-06-24 00:21:46 -0300
committerJesusaves <cpntb1@ymail.com>2020-06-24 00:21:46 -0300
commit951b50be5e42d25ffc9cdbf7ba3e03ef8b0337c0 (patch)
treed8d398c5a1f4c0ccd797ec766934664e9e99ec07 /hercules
parentc2e7a1a3c733f2160b0c0fda9d715fb04f3bf52b (diff)
downloadtools-951b50be5e42d25ffc9cdbf7ba3e03ef8b0337c0.tar.gz
tools-951b50be5e42d25ffc9cdbf7ba3e03ef8b0337c0.tar.bz2
tools-951b50be5e42d25ffc9cdbf7ba3e03ef8b0337c0.tar.xz
tools-951b50be5e42d25ffc9cdbf7ba3e03ef8b0337c0.zip
Switches: Remove the TODO/FIXME. Check if they're already flipped before flipping
Diffstat (limited to 'hercules')
-rwxr-xr-xhercules/tmx_converter.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/hercules/tmx_converter.py b/hercules/tmx_converter.py
index 5de3e1b..55bca23 100755
--- a/hercules/tmx_converter.py
+++ b/hercules/tmx_converter.py
@@ -471,16 +471,17 @@ class ContentHandler(xml.sax.ContentHandler):
self.save_cnt = True
elif isinstance(obj, DungeonSwitch):
obj_name = "%s_%s_%s" % (self.base, obj.x, obj.y)
+ status = ifte(obj.enabled, "OFFLINE", "ONLINE")
+ nstats = ifte(obj.enabled, "ONLINE", "OFFLINE")
self.confs.write(
SEPARATOR.join([
'\n',
- '// FIXME: Either let flip/unflip, or only run once.\n',
- '// This could be done with a new attribute ',
- 'and checking NPC display when only run once.\n',
'%s,%d,%d,0\t' % (self.base, obj.x, (obj.y)),
'script\t',
- '#%s\tNPC_SWITCH_%s,{\n\tcallfunc "%s"%s;\n' % (obj_name, ifte(obj.enabled, "OFFLINE", "ONLINE"), obj.callfunc, ifte(obj.args != '', ", %s" % obj.args, "")),
- '\tsetnpcdisplay "#%s", NPC_SWITCH_%s;\n\tend;\nOnInit:\n\t.distance=%d;\n}\n' % (obj_name, ifte(obj.enabled, "ONLINE", "OFFLINE"), obj.distance),
+ '#%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, "")),
+ '\tsetnpcdisplay "#%s", NPC_SWITCH_%s;\n\tend;\nOnInit:\n\t.distance=%d;\n}\n' % (obj_name, nstats, obj.distance),
])
)
self.save_cnt = True