Page MenuHomeWildfire Games

Switch from a placeable filter to an unplaceable filter.
AbandonedPublic

Authored by leper on Sep 6 2017, 6:28 AM.

Details

Reviewers
None
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Restricted Owners Package(Owns No Changed Paths)
Restricted Owners Package(Owns No Changed Paths)
Summary

This makes it easier for modders to use different template organization schemes.
(Other folders, more folders, different names, etc.)

Depends on D876 and D877.

Test Plan

Check that all placeable templates still show up in atlas. Create a new folder with some placeable template and notice that it shows up with the patch without any further edits, notice that this wasn't the case previously.

Possibly complain about me not having removed those parameters that never do anything (the only caller always passes the same thing), but then also notice that now the structure of that function is nearly the same as for the one that we are slightly extending, but unifying them isn't as easy/nice as one would think.

Event Timeline

leper created this revision.Sep 6 2017, 6:28 AM
Vulcan added a comment.Sep 6 2017, 7:11 AM
Executing section Default...
Executing section Source...
Executing section JS...
Executing section XML GUI...
Executing section Python...
Executing section Perl...

http://jenkins-master:8080/job/phabricator_lint/497/ for more details.

elexis added a subscriber: elexis.Sep 6 2017, 8:01 PM

Code complexity aside, sure a whitelist isn't preferable?
(as in people forgetting to change the un/placeable file rather having some valuable templates not placeable instead of having some templates that shouldn't ever be placed available in atlas?)

binaries/data/mods/public/simulation/data/unplaceablesFilter.json
10

This makes other/catafalque placeable which was denied in D327 without making CaptureTheRelic.js aware of relics placed by the map.
(But I think we can just add that issue to the bodycount of fixing something unrelated).

In D878#34308, @elexis wrote:

Code complexity aside, sure a whitelist isn't preferable?

We have one now, that limits modders to using the exact same folders as we do, or finding out about that filter file. And templates that shouldn't be placed do tend to be named "template_*" or put in one of the folders with unplaceable templates.

(as in people forgetting to change the un/placeable file rather having some valuable templates not placeable instead of having some templates that shouldn't ever be placed available in atlas?)

Something non-placeable will not make any sense to the player, so if they still try to place those they get what they deserve (after having added a few of those themselves, else they wouldn't show up).
Having new templates in some folder (e.g. units/romans/) not show up because they weren't added to the placeables filter is a lot worse IMO.

binaries/data/mods/public/simulation/data/unplaceablesFilter.json
10

Well, it seems like that should be placeable and the code fixed.
Could also just add "other/catafalque/", in there.

(unplaceables ending up in atlas might cause atlas errors or invisible items which players might not be able to delete and people not knowing how to delete it in the XML file.
If some new units don't show up in atlas, that might go unnoticed indeed (as opposed to placeables that shouldnt be placeable). So approach seems correct.)

binaries/data/mods/public/simulation/data/unplaceablesFilter.json
10

Make those relics placeable, mention it in the commit message and refs D327. The script can be fixed in #4762.

In D878#34375, @elexis wrote:

(unplaceables ending up in atlas might cause atlas errors or invisible items which players might not be able to delete and people not knowing how to delete it in the XML file.

I still consider adding new folders with unplaceable templates to be the uncommon case, and that is more likely to be done by some programmer and a relatively quick search should point out that there is another file to update.

If some new units don't show up in atlas, that might go unnoticed indeed (as opposed to placeables that shouldnt be placeable). So approach seems correct.)

Any complaints about the pointer to a pair of pointers or the TODOs in the code apart from that?

I suspect that we might be able to remove FindTemplates since there are nearly no users of that (and I'm not really sure if the AI needs to know about non-placeable templates that are not special_filter ones (which it also doesn't need to know, but just query for them). And that also filters for template_ (though it does hard-code that, which might be faster.

binaries/data/mods/public/simulation/data/unplaceablesFilter.json
10

Ack.

@leper: can you 'rebase' the patch? (the last hunk doesn't apply right now)

@leper: can you 'rebase' the patch? (the last hunk doesn't apply right now)

I guess that might be caused by me working on that thing on top of my other changes (which in this case includes D863).

Also given D925 and the now given possibility of using subfolders I have been thinking of moving all those other unplaceable templates to within special/ or something, and then hard-coding that check (as is currently done for template_ in AddToTemplates and using that for everything again. (If anything needs to know about other things we should do that for those things specifically.)

Also given D925 and the now given possibility of using subfolders I have been thinking of moving all those other unplaceable templates to within special/ or something, and then hard-coding that check (as is currently done for template_ in AddToTemplates and using that for everything again. (If anything needs to know about other things we should do that for those things specifically.)

It looks that last plan can do the job.

leper abandoned this revision.Sep 30 2017, 2:34 PM

Given what seems to be consensus that D935 is cleaner this one is unlikely to be included.