Fix for manual targeting of Thor not working against emp immune units, issue #4207 #5753
+11
−5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Work done
Hi, this is my first PR/contribution so let me know if there are any issues.
Decided to look into and fix #4207 since it's been there since January and seemed like a good start.
luarules/gadgets/unit_onlytargetcategory.lua
Previously didn't correctly implement a break statement, which meant that the target categories for Thor (and possibly other units) weren't disregarded if there were multiple categories, which is the intended behaviour according to the original comment:
elseif unitOnlyTargetsCategory[udid] ~= category then -- multiple different onlytargetcategory used: disregard
Also removed a random incrementing
i = i + 1
which didn't do anything lolluarules/gadgets/unit_onlytargetempable.lua
Changed the code to only consider a unit to be an "emp unit" if all of it's weapons have a
paralyze
effect, which sounds logical to me. If a unit has weapons that don't emp/paralyze, then the player should be able to target emp immune enemies as they have normal non emp weapons. The emp weapons will not fire anyway as those are handled elsewhere.Screenshots:
boom.mp4
com goes boom (with manual click, you can see hold fire is enabled)