Skip to content

Add scripting access for per-guarder guard ranges - #7794

Merged
BMagnu merged 1 commit into
scp-fs2open:masterfrom
Goober5000:fix/guard_range_script
Sep 21, 2026
Merged

BMagnu merged 1 commit into
scp-fs2open:masterfrom
Goober5000:fix/guard_range_script

Conversation

@Goober5000

Copy link
Copy Markdown
Contributor

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.

@Goober5000 Goober5000 added fix A fix for bugs, not-a-bugs, and/or regressions. ai A feature or issue related to the AI algorithms scripting A feature or issue related to LUA scripting labels Sep 20, 2026
@Goober5000 Goober5000 added this to the Release 26.2 milestone Sep 20, 2026
@Goober5000
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
Goober5000 force-pushed the fix/guard_range_script branch from ab73b8b to 15b7d5f Compare September 20, 2026 22:02
@Goober5000
Goober5000 marked this pull request as ready for review September 20, 2026 22:02
@BMagnu
BMagnu merged commit 0dcee2a into scp-fs2open:master Sep 21, 2026
18 checks passed
@Goober5000
Goober5000 deleted the fix/guard_range_script branch September 21, 2026 04:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai A feature or issue related to the AI algorithms fix A fix for bugs, not-a-bugs, and/or regressions. scripting A feature or issue related to LUA scripting

Projects

None yet

Development

Successfully merging this pull request may close these issues.

New Guard Range SEXP Should have scripting access

2 participants