Skip to content
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

A function for conflicts on gunmods #69221

Closed
tenmillimaster opened this issue Nov 10, 2023 · 1 comment
Closed

A function for conflicts on gunmods #69221

tenmillimaster opened this issue Nov 10, 2023 · 1 comment
Labels
<Suggestion / Discussion> Talk it out before implementing

Comments

@tenmillimaster
Copy link
Member

Is your feature request related to a problem? Please describe.

CDDA would benefit from removing bayonets from the underbarrel slot location and adding them to their own unique slot. This presents the problem of installing a grenade launcher and a bayonet.

Solution you would like.

I would like to have gunmods be prevented from being installed if another gunmod is present. For example, certain bayonets if a grenade launcher is present. #27269 added a function that is very nearly what I'd like, which checks available slots against a list on the gunmod.

I would like a similiar function, that checks installed gunmods against a list on the gunmod.
E.g. M203 can't be co-installed with Combat knife, modified combat knife, sword bayonet... etc.
Sword bayonet can't be co-installed with m203, m320, M26, etc.

Describe alternatives you have considered.

Leaving things as is and not adding a bayonet lug location, but that means to control which guns can have bayonets and which can't we'd need, I dunno, a complex system of flags.

Additional context

I tried getting something setup for myself to being building CDDA (Codeblocks MINGW, cygwin, vsstudio) but ran into errors on each try.

I am quite inept when it comes to programming C++ (I can't even set up a build environment) but where I had intended to start was something like the below inserted at https://github.com/CleverRaven/Cataclysm-DDA/blob/master/src/item.cpp#L11262,
with a new json field other than blacklist_mod, obviously.

    for( const typeId &mod : mod.type->gunmod->blacklist_mod ) {
        if( gunmod_find().count( mod ) ) {
            return ret_val<void>::make_failure( _( "cannot be installed on a weapon with \"%s\"" ),
                                                mod.tname() );
        }
    }
@tenmillimaster
Copy link
Member Author

tenmillimaster commented Nov 21, 2023

Implemented in #69373

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
<Suggestion / Discussion> Talk it out before implementing
Projects
None yet
Development

No branches or pull requests

1 participant