splewis / csgo-practice-mode

CS:GO Sourcemod plugin for private team/individual practice servers
GNU General Public License v3.0
455 stars 70 forks source link

Allow .throw to filter on multiple categories #123

Closed Maistho closed 4 years ago

Maistho commented 5 years ago

I'm thinking of opening a PR to add a method to filter on multiple categories when using .throw.

My idea is to add two boolean operators & (AND) and | (OR) that can be used when filtering categories.

Use-case:

We would like to categorise our nades with categories such as:

Then it would be nice to be able to throw all smokes to retake A by combining the categories.

For example:

.throw smoke&a&retake would throw any saved nades that are categorised with smoke, a and retake

.throw smoke|a would throw any saved nades that are categorised with either smoke or a

.throw smoke&b|smoke&a would throw any saved nades that are categorised with either smoke and a or smoke and b

Is this something that you would be open to merging?

I'm still not fully decided on adding both AND and OR, I can't think of very many usecases for OR so I might only add AND to start with.

It would be a breaking change for anyone currently using & or | in their category names, but I don't expect many people to do so.

splewis commented 5 years ago

I'm still not fully decided on adding both AND and OR, I can't think of very many usecases for OR so I might only add AND to start with.

Agreed.

It would be a breaking change for anyone currently using & or | in their category names, but I don't expect many people to do so.

Also agreed. It might be worth a cvar to disable the behavior, just in case someone is using them.

Is this something that you would be open to merging?

Sure, as long as the implementation is relatively straightforward, and I think it should be.