Skip to content

Commit

Permalink
Fixes overmap loop homing (BeeStation#2708)
Browse files Browse the repository at this point in the history
  • Loading branch information
DeltaFire15 authored and IndusRobot committed Dec 16, 2024
1 parent 02c8b68 commit 4c8b8ec
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
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

0 comments on commit 4c8b8ec

Please sign in to comment.