CleverRaven / Cataclysm-DDA

Cataclysm - Dark Days Ahead. A turn-based survival game set in a post-apocalyptic world.
http://cataclysmdda.org
Other
10.62k stars 4.17k forks source link

Survival bow asks user to select an arrow type for reload after firing, but it doesn't do anything #76210

Open CoroNaut opened 2 months ago

CoroNaut commented 2 months ago

Describe the bug

I understand that we probably don't keep an arrow 'in the bow' like a bullet in a gun. When you shoot your survival bow, it asks you to reload the weapon with a new arrow, but this action does nothing. then if you want to fire again, it pops up the exact same dialog to ask you what arrow to use, which works.

Attach save file

Grafton-trimmed.tar.gz

Steps to reproduce

  1. get survival bow or any bow
  2. see enemy
  3. knock arrow and fire
  4. reload dialog pop asks for an arrow to reload with, but does nothing
  5. repeat 3

Expected behavior

Preferably, the dialog asking the user to reload the bow would work and actually bring you right back to the aiming interface.

  1. see enemy
  2. knock arrow and fire
  3. reload and fire
  4. repeat step 3

I would also LOVE to see it not popup a dialog if you only have one arrow type in your inventory. it used to be this way, but it changed at some point a year or two ago to always show a dialog for even a singular ammo type. Then i could just stay on the aiming interface and fire arrow after arrow.

Screenshots

No response

Versions and configuration

Additional context

No response

osuphobia commented 2 months ago

It should be a side effect of #73550. The feature AIM_AFTER_FIRING was disabled for the bows, and I didn't make a proper solution when enable it for the bows. If favorite ammo is set for your bow, it works as intended, but if you have not set it and carry more than one kind of arrows, this dumb thing happens. Will try to solve it later.

I would also LOVE to see it not popup a dialog if you only have one arrow type in your inventory.

I think it's #70359 that changed how it works. There are also some other side effects caused by it, and I didn't find out how to deal with them.

osuphobia commented 2 months ago

After actually testing it, I found out what's happening (it's been a while after my PR got merged so I forgot how I did it in detail😂). If you are aiming at a real enemy, things work as intented. Only when aiming at a practice target (which does not count as a real target), or just drawing your bow with out a target, the things in question will happen. https://github.com/CleverRaven/Cataclysm-DDA/blob/e398be14514639f1e6aa512d8fd39c908b347eed/src/ranged.cpp#L2652-L2659 In fact, you did select an arrow, but as there are no targets available, you just quit the aim ui. So it's not as serious an issue as I thought, no real troubles happen in combat. Will try to change the order of the functions to make it not confusing when using bows.