Skip to content

Make locked-homing weapons lose their target when it dies - #7861

Open
Goober5000 wants to merge 1 commit into
scp-fs2open:masterfrom
Goober5000:fix/die_on_lost_lock
Open

Goober5000 wants to merge 1 commit into
scp-fs2open:masterfrom
Goober5000:fix/die_on_lost_lock

Conversation

@Goober5000

@Goober5000 Goober5000 commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

When a locked-homing (aspect/javelin) weapon's target was destroyed or departed, its homing_object kept pointing at the freed object slot, so "die on lost lock" never fired. If the slot was reused by an unrelated weapon, the missile would chase it, flying in circles until its lifetime expired.

weapon_home() now checks the target signature once for locked-homing weapons. On a mismatch, find_homing_object_by_sig() re-acquires the original target or, if it is gone, clears homing_object, homing_subsys, target_num, and target_sig. A countermeasure that decoyed the weapon remains the only allowed mismatch, and the weapon still re-acquires its original target when the countermeasure expires. A countermeasure the weapon can't home on still breaks its lock, and now clears the same fields and sends a multiplayer homing update.

This changes behavior for all locked-homing weapons, not just those with "die on lost lock". Once their target is destroyed or departs, missiles without the flag now fly straight instead of chasing whatever object reused the target's slot, and missiles with the flag now self-destruct, including when the target warps out. Since a missile whose target is gone could only score incidental hits either way, this doesn't affect balance, so it isn't gated behind an AI profile flag.

Also, a locked-homing weapon fired without a lock that is decoyed by a countermeasure it can't home on now ignores the countermeasure and keeps flying straight, as a locked weapon already did. Previously it would turn and chase the countermeasure.

Fixes #7849.

@Goober5000 Goober5000 added the fix A fix for bugs, not-a-bugs, and/or regressions. label Oct 14, 2026
@Goober5000
Goober5000 marked this pull request as draft October 14, 2026 02:21
@Goober5000
Goober5000 force-pushed the fix/die_on_lost_lock branch from 1b5c651 to 97e18c2 Compare October 16, 2026 07:54
@Goober5000
Goober5000 marked this pull request as ready for review October 16, 2026 07:55
@Goober5000
Goober5000 force-pushed the fix/die_on_lost_lock branch from 97e18c2 to 347a5bd Compare October 16, 2026 07:58
When a locked-homing (aspect/javelin) weapon's target was destroyed or departed, its homing_object kept pointing at the freed object slot, so "die on lost lock" never fired.  If the slot was reused by an unrelated weapon, the missile would chase it, flying in circles until its lifetime expired.

weapon_home() now checks the target signature once for locked-homing weapons.  On a mismatch, find_homing_object_by_sig() re-acquires the original target or, if it is gone, clears homing_object, homing_subsys, target_num, and target_sig.  A countermeasure that decoyed the weapon remains the only allowed mismatch, and the weapon still re-acquires its original target when the countermeasure expires.  A countermeasure the weapon can't home on still breaks its lock, and now clears the same fields and sends a multiplayer homing update.

This changes behavior for all locked-homing weapons, not just those with "die on lost lock".  Once their target is destroyed or departs, missiles without the flag now fly straight instead of chasing whatever object reused the target's slot, and missiles with the flag now self-destruct, including when the target warps out.  Since a missile whose target is gone could only score incidental hits either way, this doesn't affect balance, so it isn't gated behind an AI profile flag.

Also, a locked-homing weapon fired without a lock that is decoyed by a countermeasure it can't home on now ignores the countermeasure and keeps flying straight, as a locked weapon already did.  Previously it would turn and chase the countermeasure.

Fixes scp-fs2open#7849.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Goober5000
Goober5000 force-pushed the fix/die_on_lost_lock branch from 347a5bd to d72c768 Compare October 16, 2026 08:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix A fix for bugs, not-a-bugs, and/or regressions.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

spinning torpedoes of doom a go-go

1 participant