Vanilla-Expanded / VanillaExpandedFramework

Vanilla Expanded Framework for RimWorld
Other
74 stars 37 forks source link

Reduce harmony patch overhead #34

Open Owlchemist opened 1 year ago

Owlchemist commented 1 year ago

Lots of VFE mechanoid patches are running even if you don't use that mod. Regardless of how lightweight the patches themselves may be, they would still add detour overhead to the methods of which are running constantly.

It may be good to have Taranchuk sign off on this one as, afaik, those harmony patches belong to him. I skimmed them over but as far as I could see they would be fine to omit when VFEM isn't active.

Taranchuk commented 1 year ago

The thing is that not only VFEM mod uses these mechanoid patches, but also RimEffect, Reinforced Mechanoids and Mechanoid Foundry. The code was put into the framework for a reason otherwise would stay in VFEM where it was created initially.

erdelf commented 1 year ago

We might be exploring other ways to lessen the load in the future, but this for now doesn't work, as taran explained.

Owlchemist commented 1 year ago

Would just checking to see if a CompMachine exists anywhere in the database work as a new gate?

Taranchuk commented 1 year ago

Could work this way.

legodude17 commented 1 year ago

Maybe instead of doing the flat mod presence check you could have CompMachine and Machine set flags on load to apply the patches?

Edit: Yeah basically what you already said.

Owlchemist commented 1 year ago

Sure. I can just redirect the bool to point to that logic instead, then.

legodude17 commented 1 year ago

Maybe move it out of ModCompatibilityCheck, then. Since it's not really a mod compat thing anymore.