Skip to content

Conversation

@wookieejedi
Copy link
Member

Asteroids_enabled is a global variable that determines if an asteroid or debris field can be used at all. Notably, it is set once when the game first runs (set to a default of 1) and then never set automatically again. #https://github.com/scp-fs2open/fs2open.github.com/pull/4857/files did add the ability to set this value via SEXP though, which we discovered lead to asteroid fields being disabled if a previous mission used the sexp to disable them (b/c the Asteroids_enabled variable is global and was never reset).

Perhaps Asteroids_enabled should be called something else, but if folks want we can discuss new names.

In any case, this PR fixes this issue by ensuring that Asteroids_enabled is reset to the default value at the start of each mission, therefore preventing the asteroid toggle sexp from bleeding over into other missions.

Tested and works as expected.

`Asteroids_enabled` is a global variable that determines if an asteroid or debris field can be used at all. Notably, it is set once when the game first runs (set to a default of 1) and then never set automatically again. #https://github.com/scp-fs2open/fs2open.github.com/pull/4857/files did add the ability to set this value via SEXP though, which we discovered lead to asteroid fields being disabled if a previous mission used the sexp to disable them (b/c the `Asteroids_enabled` variable is global and was never reset).

This PR fixes this issue by ensuring that `Asteroids_enabled` is reset to the default value at the start of each mission, therefore preventing the asteroid toggle sexp from bleeding over into other missions.

Tested and works as expected.
@wookieejedi wookieejedi added the fix A fix for bugs, not-a-bugs, and/or regressions. label Jan 8, 2026
@MjnMixael
Copy link
Contributor

Hmm. This does fix the issue but I think the newer asteroid/debris sexps entirely replace what this sexp was originally intended to do and I think I'd vote it gets deprecated either in place of or in addition to this fix.

@wookieejedi
Copy link
Member Author

The main reason we use it is b/c the Asteroid Editor allows FREDers to visualize where the field will be and the simple sexp just toggle it on and off instead of fill out the 20 arg sexp each time :D Of course, I reckon we could just use the Asteroid Editor to make the visualization then turn off the field in the editor and use the values in the sexp manually. In any case, I would be all good with deprecating while also fixing it.

@MjnMixael
Copy link
Contributor

One of the features I have on my list to add to QtFRED is that when the Events Editor is opened and an asteroid/debris field sexp is selected then it will show the field visualizer with those values to make it easier for developers.

@wookieejedi
Copy link
Member Author

Oh nice! Alas, I just realized, one feature is missing from the config-asteroid-field sexp--this +Use Enhanced Checks box which is only selectable in the Asteroids Editor.

@wookieejedi wookieejedi merged commit a2c0500 into scp-fs2open:master Jan 16, 2026
20 checks passed
@wookieejedi wookieejedi deleted the fix-asteroid-toggling branch January 16, 2026 04:15
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.

3 participants