fs2open.github.com icon indicating copy to clipboard operation
fs2open.github.com copied to clipboard

Script spawned beams (via sexp) do not have their graphics correctly loaded

Open Baezon opened this issue 4 months ago • 3 comments

If a beam spawned via script, via a runSEXP beam-create, is not used elsewhere traditionally in the mission it's graphics will not be loaded, and its sections will be invisible. beam_fire specifically checks for beams which are 'not used', and loads their graphics, but beam-create calls preload_turret_change_weapon which marks the weapon as being used, despite its graphics not being loaded.

Baezon avatar Sep 04 '25 21:09 Baezon

There isn't a preloader for scripts like there is for sexps. I'm not even sure if a preloader is practical since the Lua parser is trickier than the sexp parser. It might be necessary to make some explicit functions, e.g. ship_class:preload() or weapon_class:preload().

Goober5000 avatar Sep 05 '25 00:09 Goober5000

Agreed, though in this case, it would have worked properly, if not for the preloader. preload_turret_change_weapon prevented the graphics from being correctly loaded.

Baezon avatar Sep 05 '25 21:09 Baezon

Well it's not the preloader per se, it's the weapon_mark_as_used infrastructure.

Goober5000 avatar Sep 06 '25 18:09 Goober5000