Fixes projectiles inheriting gun's pixel offsets when fired (#92166)

## About The Pull Request

Gun itself was passed as source when fired, which resulted in its pixel
offsets being inherited. Also we didn't move projectiles over turfs, so
any offsets larger than 32 pixels resulted in projectiles steering to
the side.

## Changelog
🆑
fix: Fixed projectiles inheriting gun's pixel offsets when fired
/🆑
This commit is contained in:
SmArtKar
2025-07-19 20:29:29 -04:00
committed by Roxy
parent 7d89dd90ac
commit 6aa2ca1026
2 changed files with 6 additions and 1 deletions
@@ -91,7 +91,7 @@
var/direct_target
if(target && curloc.Adjacent(targloc, target=targloc, mover=src)) //if the target is right on our location or adjacent (including diagonally if reachable) we'll skip the travelling code in the proj's fire()
direct_target = target
loaded_projectile.aim_projectile(target, fired_from, params2list(params), spread)
loaded_projectile.aim_projectile(target, tk_firing(user, fired_from) ? fired_from : user, params2list(params), spread)
var/obj/projectile/loaded_projectile_cache = loaded_projectile
loaded_projectile = null
loaded_projectile_cache.fire(null, direct_target)
+5
View File
@@ -1284,6 +1284,11 @@
source_loc = new_loc
pixel_y = pixel_y % (ICON_SIZE_X / 2)
// We've got moved by turf offsets
if (starting != source_loc)
starting = source_loc
forceMove(source_loc)
if(length(modifiers))
var/list/calculated = calculate_projectile_angle_and_pixel_offsets(source, target_loc && target, modifiers)
p_x = calculated[2]