Page 1 of 1

[1.1.72] Combat shotgun can be fired in 2 directions simultaneously

Posted: Mon Nov 14, 2022 3:27 pm
by root
Сombat shotgun can shoot in 2 directions simultaneously if cursor in the exact place of origin of the pellets.
combat shotgun bizarre spread.png
combat shotgun bizarre spread.png (340.57 KiB) Viewed 1359 times

It is also possible shoot backwards if the cursor is between the character and the point of origin of the pellets.
combat shotgun shoot backwards.png
combat shotgun shoot backwards.png (316.85 KiB) Viewed 1359 times

I can't reproduce this behavior with normal shotgun, only works with combat shotgun.

Re: [1.1.72] Combat shotgun bizarre spread

Posted: Mon Nov 14, 2022 3:39 pm
by Silari
Sounds like viewtopic.php?p=461762#p461762 though both directions at once is new.

Re: [1.1.72] Combat shotgun can be fired in 2 directions simultaneously

Posted: Tue Mar 14, 2023 3:21 pm
by Rseding91
Thanks for the report. I don't consider this worth changing since it isn't breaking anything and code wise there's no simple fix that won't likely break other things.

The root issue is: the direction the pellets shoot is not the orientation between the character and the mouse but a offset from the character (the "end of the barrel") and the mouse. So while the character may face a given direction it has nothing to do with the direction pellets will go.

Re: [1.1.72] Combat shotgun can be fired in 2 directions simultaneously

Posted: Mon Apr 17, 2023 4:20 pm
by root
The strange thing is that this is done differently for a regular shotgun and a combat shotgun. For a regular shotgun, the direction of the pallets is calculated differently and the reported behavior cannot be repeated. After all, for the player, the difference between a regular shotgun and a combat shotgun is only in the rate of fire. Unless I'm missing something.

Re: [1.1.72] Combat shotgun can be fired in 2 directions simultaneously

Posted: Mon Apr 17, 2023 4:54 pm
by Silari
root wrote:
Mon Apr 17, 2023 4:20 pm
The strange thing is that this is done differently for a regular shotgun and a combat shotgun. For a regular shotgun, the direction of the pallets is calculated differently and the reported behavior cannot be repeated. After all, for the player, the difference between a regular shotgun and a combat shotgun is only in the rate of fire. Unless I'm missing something.
Shotgun has a min_range set as part of it's attack parameters, combat shotgun does not - that might be enough to prevent the issue, especially since it only happens with the cursor extremely close to the player. cooldown, damage_modifier, and movement_slow_down_factor are also different but those seem unlikely to affect this. Would be very easy to test with a simple mod that added the min_range to the combat shotgun.

So I did, and yeah with the min_range set to 1 the combat shotgun no longer displays any of that behavior. You can get some real wonky shooting angles (shooting almost straight down while your character still faces right) but the backward shooting goes away, and even vanilla gets some weird angles like that sometimes.
Red dot is where the cursor is
Red dot is where the cursor is
combshot.png (371.62 KiB) Viewed 851 times

This obviously won't fix the underlying cause so any modded shotguns could still have it if they don't specify a min range.