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

Fixes overmap loop homing #2708

Merged
merged 2 commits into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions code/modules/projectiles/projectile.dm
Original file line number Diff line number Diff line change
Expand Up @@ -820,8 +820,14 @@

/obj/item/projectile/proc/process_homing() //Nsv13 - Enhanced the performance of this entire proc.
if(QDELETED(homing_target)) //NSV13 - Changed proc to be less performance intensive
return FALSE
var/targetAngle = get_angle(src, homing_target)
if(homing_target) //Bla bla refclearing. Necessary evil. (Probably not worth the hassle of handling this via comsig, so this is here instead)
homing_target = null
return FALSE //Hi, Delta from the past here, future one. We don't just disable homing entirely here because some projectiles might be able to reassess targets.
var/targetAngle
if(z && SSmapping.level_trait(z, ZTRAIT_OVERMAP)) //This bit of performance cost should be worth making these track properly.
targetAngle = overmap_angle(src, homing_target)
else
targetAngle = get_angle(src, homing_target)
var/angle = closer_angle_difference(Angle, targetAngle)
next_homing_process = world.time + homing_delay
setAngle(Angle + CLAMP(angle, -homing_turn_speed, homing_turn_speed))
Expand Down
3 changes: 2 additions & 1 deletion nsv13/code/modules/projectiles/overmap.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
var/valid_angle = 0 //Angle the projectile can track at
var/shotdown_effect_type = /obj/effect/temp_visual/impact_effect/torpedo

//Hey look, all this logic doesn't work! I love finding these things.
/obj/item/projectile/guided_munition/process_homing(atom/A)
. = ..()
var/simplify_Angle = SIMPLIFY_DEGREES(Angle)
var/simplify_targetAngle = SIMPLIFY_DEGREES(targetAngle)
var/simplify_targetAngle = SIMPLIFY_DEGREES(targetAngle) //<< This var is never actually modified because [local var] supercedes [obj var] unless src is used. Personally, I'm unsure if we actually WANT it fixed. ~Delta
if(simplify_targetAngle > simplify_Angle + valid_angle)
homing = FALSE
Loading