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

Overhaul range weapons infrastructure #1857

Merged

Conversation

leoCottret
Copy link
Collaborator

Summary

Infrastructure "Overhaul range weapons infrastructure"

Purpose of change

image
-->

Describe the solution

For now:

  • create classes with the right flags and make weapons using the archery or throw skill copy-from those classes
  • as a bonus, bows and range weapons using the "throw" skill now all have some kind of base class with shared fields (skill, ammo etc.), so I could remove a bit of boilerplate code again
  • for a summary look at range.json

Describe alternatives you've considered

Playing the game instead.

Testing

I fixed all loading errors and compared a few range weapons/ammoes from an experimental version of the game and this branch.
Although some flags don't appear (in the item description) in both cases so I'll suppose it worked.

@@ -0,0 +1,40 @@
[
{
"abstract": "range_base",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe something like "muscle_ranged_base"? "ranged_base" could mean guns as well.

"reload_noise_volume": 3,
"color": "yellow",
"ammo": "arrow",
"valid_mod_locations": [ [ "underbarrel", 1 ], [ "sights", 1 ], [ "accessories", 2 ], [ "stabilizer", 1 ], [ "dampening", 1 ] ]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Common flags could also go here. I'm pretty sure that all bows will have "FIRE_TWOHAND" and "WATER_FRIENDLY". First for obvious reasons, second because the flag covers failure to fire a chemical propellant gun under water.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some bows are not water_friendly (compound ones), alright I made the changes, I'm done for this PR

@Coolthulhu
Copy link
Member

Clang-tidy:

/home/runner/work/Cataclysm-BN/Cataclysm-BN/src/item_factory.cpp:75:1: error: Variable 'ammo_effect_NEVER_MISFIRES' declared but not used. [cata-unused-statics,-warnings-as-errors]
static const ammo_effect_str_id ammo_effect_NEVER_MISFIRES( "NEVER_MISFIRES" );
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

@Coolthulhu Coolthulhu self-assigned this Sep 17, 2022
@Coolthulhu Coolthulhu merged commit 2937745 into cataclysmbnteam:upload Sep 18, 2022
@Coolthulhu
Copy link
Member

Some mods may act weird without the hardcode, but we can't really do anything here. Except maybe announcing it on the discord - I'll try that.

@chaosvolt
Copy link
Member

Belated thought: which of the bow flags and ammo effects will crossbows be expected to have? Because the removal of hardcoded flag injection reminds me, crossbows probably USED to benefit from this old hardcoded too because back in the old day they had the archery skill. Another overlooked consequence of CleverRaven/Cataclysm-DDA#21545 probably?

chaosvolt added a commit to chaosvolt/MST_Extra_Mod that referenced this pull request Sep 18, 2022
So it turns out a long-forgotten side effect of CleverRaven/Cataclysm-DDA#21545 was breaking the janky hardcoded injection of certain flags and ammo effects into

cataclysmbnteam/Cataclysm-BN#1857 makes this more important in BN but implemented same general changes to both versions in case DDA ever notices that function (and it's been about 5 years so literally everyone evidently never noticed any changes to crossbow behavior).

Also updated the deployable vehicles in DDA version, as CleverRaven/Cataclysm-DDA#59572 updated folding vehicles. While a great idea on paper, in practice they somehow managed to invent a form of JSON that's even MORE of an unreadable mess than vehicle JSON is, with making folded_parts something you have to work with to implement deployable vehicles now.
@leoCottret leoCottret deleted the refactore-ranged-weapons branch September 24, 2022 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants