From 63e1f61f4fd2212a349f35c9ae954cfdd479388a Mon Sep 17 00:00:00 2001 From: expwnent Date: Sun, 12 May 2013 12:43:45 -0400 Subject: [PATCH] autoSyndrome/syndromeTrigger: deal with overlap better for commands. --- Readme.rst | 4 ++-- plugins/autoSyndrome.cpp | 1 - plugins/syndromeTrigger.cpp | 8 ++++++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Readme.rst b/Readme.rst index a8536bde1..1d03822be 100644 --- a/Readme.rst +++ b/Readme.rst @@ -827,8 +827,6 @@ It is not currently possible to execute more than one command per syndrome. Inst Again, note that plugins AND scripts can be executed this way, and arguments will be passed according to the same rules. -If a command is executed, then the plugin will NOT apply the syndrome to any units. To call a dfhack command at the same time as applying a syndrome, use separate syndromes. This behavior is to prevent conflicts with the syndromeTrigger plugin. - syndromeTrigger --------------- @@ -842,6 +840,8 @@ The syntax is very similar to autoSyndrome. If the syndrome has the ``\\COMMAND` 3. ``\\SYNDROME_ID``: this will be replaced by the identifier of the syndrome in question. +If there is a ``[SYN_CLASS:\\AUTO_SYNDROME]`` tag, then the command, if any, will NOT be executed by syndromeTrigger, because it should already have been executed by autoSyndrome. + True Transformation +++++++++++++++++++ diff --git a/plugins/autoSyndrome.cpp b/plugins/autoSyndrome.cpp index 12b4e10d4..5a433e01d 100644 --- a/plugins/autoSyndrome.cpp +++ b/plugins/autoSyndrome.cpp @@ -330,7 +330,6 @@ void processJob(color_ostream& out, void* jobPtr) { if ( commandStr != "" ) { Core::getInstance().runCommand(out, commandStr, args); - continue; } if ( destroyRock ) { diff --git a/plugins/syndromeTrigger.cpp b/plugins/syndromeTrigger.cpp index 8508440e4..017eaf820 100644 --- a/plugins/syndromeTrigger.cpp +++ b/plugins/syndromeTrigger.cpp @@ -56,6 +56,7 @@ void syndromeHandler(color_ostream& out, void* ptr) { bool foundPermanent = false; bool foundCommand = false; + bool foundAutoSyndrome = false; string commandStr; vector args; int32_t raceId = -1; @@ -100,7 +101,10 @@ void syndromeHandler(color_ostream& out, void* ptr) { } continue; } - + if ( clazz == "\\AUTO_SYNDROME" ) { + foundAutoSyndrome = true; + continue; + } if ( clazz == "\\COMMAND" ) { foundCommand = true; continue; @@ -137,7 +141,7 @@ void syndromeHandler(color_ostream& out, void* ptr) { } } - if ( commandStr != "" ) { + if ( !foundAutoSyndrome && commandStr != "" ) { Core::getInstance().runCommand(out, commandStr, args); }