diff --git a/binaries/data/mods/public/globalscripts/Templates.js b/binaries/data/mods/public/globalscripts/Templates.js index 9986f879e7..0f0928cb5c 100644 --- a/binaries/data/mods/public/globalscripts/Templates.js +++ b/binaries/data/mods/public/globalscripts/Templates.js @@ -33,6 +33,7 @@ function GetVisibleIdentityClasses(template) * @param match Either a string in the form * "Class1 Class2+Class3" * where spaces are handled as OR and '+'-signs as AND, + * and ! is handled as NOT, thus Class1+!Class2 = Class1 AND NOT Class2 * Or a list in the form * [["Class1"], ["Class2", "Class3"]] * where the outer list is combined as OR, and the inner lists are AND-ed @@ -56,7 +57,8 @@ function MatchesClassList(classes, match) // if the elements are still strings, split them by space or by '+' if (typeof sublist == "string") sublist = sublist.split(/[+\s]+/); - if (sublist.every(function(c) { return classes.indexOf(c) != -1; })) + if (sublist.every(c => (c[0] == "!" && classes.indexOf(c.substr(1)) == -1) + || (c[0] != "!" && classes.indexOf(c) != -1))) return true; } diff --git a/binaries/data/mods/public/simulation/templates/template_structure_civic_house.xml b/binaries/data/mods/public/simulation/templates/template_structure_civic_house.xml index 69846bccb8..8712c3771f 100644 --- a/binaries/data/mods/public/simulation/templates/template_structure_civic_house.xml +++ b/binaries/data/mods/public/simulation/templates/template_structure_civic_house.xml @@ -22,7 +22,7 @@ 0 0.1 Unit - Support + Support+!Elephant 1