-
Notifications
You must be signed in to change notification settings - Fork 276
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add exclusions and exclusion categories to gunmods #4254
feat: Add exclusions and exclusion categories to gunmods #4254
Conversation
Allows gunmods to exclude specific weapons/weapon categories.
The Autofix app has found code style violation and automatically formatted this Pull Request. I locally edit my commits (e.g: git, github desktop)Please choose following options: I'd like to accept the automated commit
I do not want the automated commit
If you don't do this, your following commits will be based on the old commit, and cause MERGE CONFLICT. This PR is complete and I don't want to edit it anymoreIt's safe to ignore this message. I edit this PR through web UIYou can ignore this message and continue working. I have no idea what this message is talking aboutYou can ignore this message and continue working. If you find any problem, please ask for help and ping @scarf005. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/item.cpp
Outdated
} else if( !g_mod.usable.empty() || !g_mod.usable_category.empty() || !g_mod.exclusion.empty() || | ||
!g_mod.exclusion_category.empty() ) { | ||
// First check that it's not explicitly excluded by id. | ||
bool unusable = g_mod.exclusion.count( this->typeId() ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might make sense to rename it to excluded
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, how so?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because this line is highly confusing?
if( usable || unusable ) {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I thought you were talking about "exclusion".
Per request for readability.
Purpose of change
Allow further fine-tuning of what guns can and cannot be installed with specific gunmods, both for further development and specificity of vanilla gunmods and for the use of mod authors.
Describe the solution
Adds
mod_exclusions
andmod_exclusion_category
as optional fields in gunmods. This allows contributors to add specific blacklists (say you want to make a gun mod installable on all rifles except the Rivtech battlerifle for instance), and blacklist categories (all rifles unless they are energy weapons).Blacklists take priority over target categories but not target ids. Priority for inclusion/exclusion goes
mod_targets
>mod_exclusions
>mod_exclusion_category
>mod_target_category
Note that it will scream at you if you try to include and exclude the same id or the same set of categories.
Changes the gyroscopic stabilizing system as a proof of concept for this system, and to ensure it's used somewhere in the vanilla game to avoid it being lost to time.
Describe alternatives you've considered
Testing
mod_targets
andmod_exclusions
forlaser_rifle
, and extendmod_target_category
to includeENERGY_WEAPONS
mod_targets
andmod_exclusions
and once formod_target_category
andmod_exclusion_category
)mod_exclusion
andmod_exclusion_category
it screams at you.Additional context
Not ideal to be using gyroscopic stabilizers as the proof of concept, but I can't think of anything that I can even remotely justify as an example right now. Maybe someone can look over the gunmods to see if anything nonsensical jumps out.
Checklist
doc/
folder.lang/bn_extract_json_strings.sh
script if it does not support them yet. (?)