#4092 closed defect (fixed)
[PATCH] Restricted classes should allow whitelisting
Reported by: | elexis | Owned by: | fatherbushido |
---|---|---|---|
Priority: | Should Have | Milestone: | Alpha 21 |
Component: | UI & Simulation | Keywords: | simple, patch |
Cc: | knight.erraunt@… | Patch: |
Description
The RestrictedClasses
property of the Attack
component allows to blacklist certain entity types from being attacked by the unit.
For example women are allowed to attack other women and siege, but not buildings or fighters.
However right now one can only specify a blacklist, not a whitelist. The fishing ship ought to be able to only attack SeaCreature
. Since we can only specify a blacklist and not a whitelist, we have to add every possible entity to that list that isn't a SeaCreature
.
Notice the attack cursor when selecting a fishing ship and hovering any land animal.
Instead one should be able to specify a whitelist or blacklist.
Related code: RestrictedClasses
in Attack.js
and simulation/templates/
Attachments (4)
Change History (11)
comment:1 by , 8 years ago
follow-up: 3 comment:2 by , 8 years ago
I don't think r18509 is the right approach. It would be much better that the tests on RestrictedClasses use the MatchesClassList function from globalscripts instead of the indexOf, and then it would be enough to have "!"SeaCreature
comment:3 by , 8 years ago
Priority: | Nice to Have → Should Have |
---|
Thanks for the hint, that's indeed better than the proposal of the ticket description, as it would also mean that we don't have to differentiate between a blacklist and a whitelist in the template and also allows for logical OR/AND.
by , 8 years ago
Attachment: | fishing_ship_template_patch.diff added |
---|
uninteresting obvious part of the patch.
comment:4 by , 8 years ago
Cc: | added |
---|---|
Keywords: | rfc patch added |
Summary: | Restricted classes should allow whitelisting → [PATCH] Restricted classes should allow whitelisting |
Changed in the way suggested by mimo, looks rather simple, hopefully it is correct. Tested in-game, and looks like it is working.
by , 8 years ago
Attachment: | Attack_MatchesClassList.diff added |
---|
Not sure why the diff tool prints strange indentation though.
comment:5 by , 8 years ago
Milestone: | Backlog → Alpha 21 |
---|
by , 8 years ago
Attachment: | 4092_ai_compatibility.patch added |
---|
Added AI compatibility, as noticed by fatherbushido. Those are all the occurances of RestrictedClasses
. Couldn't find any template besides the fishing ship which has an Attack component but no attacking abilities (besides killing whale).
comment:7 by , 7 years ago
Keywords: | rfc removed |
---|
In 18509: