Repository navigation
Make locked-homing weapons lose their target when it dies - #7861
Open
Goober5000 wants to merge 1 commit into
Open
Goober5000 wants to merge 1 commit into
Goober5000 wants to merge 1 commit into
Conversation
Goober5000
marked this pull request as draft
October 14, 2026 02:21
Goober5000
force-pushed
the
fix/die_on_lost_lock
branch
from
October 16, 2026 07:54
1b5c651 to
97e18c2
Compare
Goober5000
marked this pull request as ready for review
October 16, 2026 07:55
Goober5000
force-pushed
the
fix/die_on_lost_lock
branch
from
October 16, 2026 07:58
97e18c2 to
347a5bd
Compare
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
force-pushed
the
fix/die_on_lost_lock
branch
from
October 16, 2026 08:16
347a5bd to
d72c768
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.