-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Skip Melee in Firing Mode #35132
Skip Melee in Firing Mode #35132
Conversation
@@ -1875,7 +1875,7 @@ std::string item::info( std::vector<iteminfo> &info, const iteminfo_query *parts | |||
info.emplace_back( "GUNMOD", _( "Handling modifier: " ), "", | |||
iteminfo::show_plus, mod.handling ); | |||
} | |||
if( is_gun() && !type->mod->ammo_modifier.empty() && parts->test( iteminfo_parts::GUNMOD_AMMO ) ) { | |||
if( !type->mod->ammo_modifier.empty() && parts->test( iteminfo_parts::GUNMOD_AMMO ) ) { |
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.
Checking if ammo_modifier is empty is sufficient for all gunmods now that all gunmod items actually have def.mod
instantiated, and makes sure that any gunmod which isn't itself a gun, but still modifies ammo, will work in the future (none exist currently)
load_slot_optional( def.gunmod, jo, "gunmod_data", src ); | ||
load_slot_optional( def.mod, jo, "mod_data", src ); | ||
load_slot_optional( def.mod, jo, "gunmod_data", src ); |
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.
load_gunmod()
Already calls both of these functions, as both are needed. This revert allows items which are not typed as GUNMOD to exhibit correct behavior.
As mentioned in my code comment, The resulting 'unvisited JSON' errors either need to be ignored, the entire |
Tested:
no crashes or errors. |
Summary
SUMMARY: Bugfixes "Fixes crashes involving bayonet type items"
Purpose of change
Fixes #35117 and Fixes #30676
Describe the solution
Reverted an erroneous change that broke the loading of gunmods.
Added extra logic to skip over melee gun modes when in the firing screen.
Describe alternatives you've considered
Automatically switch between
reach_attack()
targeting view andfire()
targeting view.Merge the two firing views.
Testing
Created a new character.
Spawned in a rifle.
Spawned in one of every bayonet type gunmod (combat knife, makeshift bayonet, etc.)
Tested that each can be installed as a gunmod on a rifle.
Spawned in ammo and a magazine for the rifle.
Tested switching firing modes both inside of and outside of the
fire()
targeting view.Also tested that regular reach attacks still worked.
Additional context