Add scripting access for per-guarder guard ranges - #7794
Merged
Merged
Conversation
Goober5000
marked this pull request as draft
September 20, 2026 05:14
Follow-up to scp-fs2open#7606. Restore the MaxGuardRadius property, restore the ability to set specific ranges using set-guard-range, and add scripting functions for setting the specific ranges. Fixes scp-fs2open#7756 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Goober5000
force-pushed
the
fix/guard_range_script
branch
from
September 20, 2026 22:02
ab73b8b to
15b7d5f
Compare
Goober5000
marked this pull request as ready for review
September 20, 2026 22:02
BMagnu
approved these changes
Sep 21, 2026
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.
PR #7606 moved the guard range from a single value on the guarded ship to a per-(guarder, guarded) entry, and removed the MaxGuardRadius scripting property, which can no longer express that. Add ship functions setGuardRange and getGuardRange in its place, both called on the guarding ship and taking the guarded ship as an argument. Scripts using MaxGuardRadius will need to switch to these.
Also factor the lookup out of ai_guard_threshold into get_guard_range_ship, and simplify set_guard_range_ship: a range of 0 or less now erases the entry instead of storing -1, so every stored entry is positive.
Fixes #7756. Tested with a custom test mission that exercised the script, the sexp, and the default.