Files
fs2open.github.com/code/scripting/api/objs
Goober5000andClaude Fable 5.1 112ca2fc4b handle submodel repair/destruction consistently
When a destroyed subsystem was repaired, its submodels were only restored if the repair was done through a SEXP.  A subsystem repaired by a support ship, by automatic repair, by a script, or through the debug console regained its hitpoints but not its submodels, so a ship could have a working turret with no model.  Any -destroyed form also remained visible.

All of these now call restore_subsystem_submodels, which brings back the subsystem's submodels and hides the -destroyed submodel linked to a special-point subsystem.  The -destroyed form of an ordinary submodel is hidden when the submodels are next replicated.  The SEXP code uses the same function, with no change in its behavior.

Destruction outside do_subobj_destroyed_stuff now goes through a new blow_off_subsystem_submodels function, which do_subobj_destroyed_stuff also uses.  It blows off both of the subsystem's submodels and shows any linked -destroyed submodel, unless the subsystem has "no disappear".  This handles the cases where a subsystem appears destroyed without going through do_subobj_destroyed_stuff:
- the subsystem is destroyed at the start of the mission
- the subsystem was destroyed in the previous mission of a red-alert sequence
- the ship changes class while the subsystem's submodels are blown off
Previously the first two blew off only the first submodel, ignored "no disappear" for it, and never showed a linked -destroyed submodel; the third did nothing.  For red alert, subsystems with no hitpoints at all are not treated as destroyed.  For a class change, the visible state is carried over rather than inferred from hitpoints, so a subsystem set to zero without being blown up, or repaired without its submodels, keeps its appearance.

Red alert also restores the submodels of a subsystem that the mission file starts destroyed if the previous mission's data gives it hitpoints.  Ship-copy-damage now shows or hides the -destroyed submodel linked to a special-point subsystem to match the copied state.

As before, the link between special-point subsystems and -destroyed submodels requires "$Link special-point subsystems to -destroyed submodels:" in game_settings.tbl.

The multiplayer hitpoint-update path is not changed.  A client receives subsystem hitpoints separately from the notification that a subsystem was destroyed, so a hitpoint update sent just before the destruction could arrive after it and wrongly restore the submodels.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
2026-09-29 02:58:02 -04:00
..
2022-05-16 18:36:34 +09:00
2023-12-05 17:47:41 +01:00
2020-08-08 19:36:39 +02:00
2024-07-28 11:15:02 +02:00
2026-04-13 01:30:31 +02:00
2024-11-22 20:12:17 -05:00
2024-07-28 11:15:02 +02:00
2023-04-12 00:14:20 -04:00
2024-07-28 11:15:02 +02:00
2025-01-30 22:09:29 -05:00
2023-04-12 00:14:20 -04:00
2024-06-13 00:17:47 +02:00
2024-06-17 21:28:40 +02:00
2024-04-17 17:48:57 +00:00
2019-03-02 14:02:21 +01:00
2024-08-13 23:17:28 +02:00
2024-07-28 11:15:02 +02:00
2025-09-28 10:40:46 +02:00
2023-09-19 10:57:30 -05:00
2026-02-16 14:41:34 +01:00
2023-04-12 00:14:20 -04:00
2023-03-28 03:07:03 +09:00
2022-10-06 20:43:09 -04:00
2024-07-28 11:15:02 +02:00
2025-07-13 19:44:44 -05:00