zer0Kerbal / OhScrap

Scrapyard based part failure mod for Kerbal Space Program.
https://forum.kerbalspaceprogram.com/index.php?/topic/192360-*/
GNU General Public License v2.0
5 stars 10 forks source link

ModuleManager: patch in `ModuleUPFMEvents` during `LAST` pass instead of `AFTER`. #94

Closed keyspace closed 1 year ago

keyspace commented 1 year ago

Closes #46 as fixed. Closes #91 as duplicate (might have comments that are different issues?..).

Some mods modify existing nodes/modules in parts, others replace them; sometimes this happens in a chained manner.

Not all parts fail the same way, too, so OhScrap adds different *FailureModules across many files, often with rules on ordering, depending on which compatible mod is addressed.

In the touched ModuleManager patch, all parts that already have a *FailureModule also get a ModuleUPFMEvents.

Before this commit, RemoteTech antennas would get a RTAntennaFailureModule after the ModuleUPFMEvents patch has already run (and you don't get a second pass). This was because RemoteTech parts would only get their *FailureModule after getting a ModuleRTAntenna, different from antennas untouched by RT, which get a *FailureModule based on having a ModuleDataTransmitter, itself different from a custom ModuleRTDataTransmitter...

After this commit, parts having a *FailureModule are guaranteed to have a ModuleUPFMEvents. We do get a second pass!

This commit may also activate warranty and immediately expire it on all parts that were supposed to fail long ago, but were unable to communicate their intent to OhScrap.

More on ModuleManager patch ordering:

https://github.com/sarbian/ModuleManager/wiki/Patch-Ordering

keyspace commented 1 year ago

Testing - no display issues so far, no NREs...

image

keyspace commented 1 year ago

No new bugs or new NREs on "live" save so far.

image

(Pic: One new booster in tandem with four old ones.)

IMO worth mentioning on next release that some parts that "never used to fail" now "perform as advertised".

zer0Kerbal commented 1 year ago

IMO worth mentioning on next release that some parts that "never used to fail" now "perform as advertised".

just plain deviously worded😂. I will mention that. 😁