Skip to content

Commit

Permalink
Patch PB bonus projectile knockback (#6784)
Browse files Browse the repository at this point in the history
# About the pull request

Prevents an issue with PB bonus projectiles.

In a PB, the initial projectile is never "fired", it remains in
nullspace. That's fine, since there's special handling in knockback code
for a projectile in nullspace, it uses the firer.

In a PB, bonus projectiles are set to the target's loc. That doesn't
matter much except for knockback, which uses the position of the
projectile vs. the position of the target. The bonus projectile is on
the same tile as the target, so it can't give a sane angle, so it
defaults to EAST.

This changes the bonus projectile's position to nullspace, matching how
the initial projectile works.

<!-- Remove this text and explain what the purpose of your PR is.

Mention if you have tested your changes. If you changed a map, make sure
you used the mapmerge tool.
If this is an Issue Correction, you can type "Fixes Issue #169420" to
link the PR to the corresponding Issue number #169420.

Remember: something that is self-evident to you might not be to others.
Explain your rationale fully, even if you feel it goes without saying.
-->

# Explain why it's good for the game

If a bonus projectile with knockback were ever to be used, this will
prevent issues.
# Testing Photographs and Procedure
<details>
<summary>Screenshots & Videos</summary>

Put screenshots and videos here with an empty line between the
screenshots and the `<details>` tags.

</details>


# Changelog
No player facing changes.
  • Loading branch information
Doubleumc authored Aug 23, 2024
1 parent a66629a commit 97c21f9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion code/modules/projectiles/gun.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1420,7 +1420,7 @@ and you're good to go.
if(projectile_to_fire.ammo.bonus_projectiles_amount)
var/obj/projectile/BP
for(var/i in 1 to projectile_to_fire.ammo.bonus_projectiles_amount)
BP = new /obj/projectile(attacked_mob.loc, create_cause_data(initial(name), user))
BP = new /obj/projectile(null, create_cause_data(initial(name), user))
BP.generate_bullet(GLOB.ammo_list[projectile_to_fire.ammo.bonus_projectiles_type], 0, NO_FLAGS)
BP.accuracy = floor(BP.accuracy * projectile_to_fire.accuracy/initial(projectile_to_fire.accuracy)) //Modifies accuracy of pellets per fire_bonus_projectiles.
BP.damage *= damage_buff
Expand Down

0 comments on commit 97c21f9

Please sign in to comment.