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

Homemade Suppressor's DISABLE_SIGHTS flag prevents aiming #22043

Closed
TheFreckle opened this Issue Oct 1, 2017 · 0 comments

Comments

3 participants
@TheFreckle
Contributor

TheFreckle commented Oct 1, 2017

Relation of #22031

I have discovered the issue with the homemade suppressor's inability to steady aim and improve hit chance, however, I am uncertain of a proper implementation for a fix.

Effects of DISABLE_SIGHTS flag

If there are no sights attached along with the homemade suppressor, the weapon's sight dispersion is set to MAX_RECOIL, 3000.

Cataclysm-DDA/src/item.cpp

Lines 3997 to 4005 in 3957dc7

int res = has_flag( "DISABLE_SIGHTS" ) ? MAX_RECOIL : type->gun->sight_dispersion;
for( const auto e : gunmods() ) {
const auto mod = e->type->gunmod.get();
if( mod->sight_dispersion < 0 || mod->aim_speed < 0 ) {
continue; // skip gunmods which don't provide a sight
}
res = std::min( res, mod->sight_dispersion );
}

Additionally, the weapon is set to have no sight speed modifier and no limit
int sight_speed_modifier = INT_MIN;
int limit = 0;
if( !gun.has_flag( "DISABLE_SIGHTS" ) && effective_dispersion( gun.type->gun->sight_dispersion ) < recoil ) {

Results

Because of sight speed modifier being set to INT_MIN, aiming does not take place

if( sight_speed_modifier == INT_MIN ) {
// No suitable sights (already at maxium aim).
return 0;
}

Even if a sight speed modifier and a limit were set, aiming would still be pointless as the weapon's base dispersion is already at MAX_RECOIL.

It is quite late and I just can't seem to get a grip on a solution. I hope that the above evidence is correct and will assist in finding a solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment