Ven0maus / SOD.Common

A common library for shadows of doubt modding.
MIT License
4 stars 4 forks source link

[FEATURE] Add ChainLoader util to detect the presence of another mod #18

Closed ReveredRedHood closed 4 months ago

ReveredRedHood commented 8 months ago

Introduction Based on suggestion from Arsonide on Discord

I'm overridding Player.IsTrespassing to do the above, and I feel like lots of mods are going to want to change the trespassing behavior. I think it would be a good candidate for something in SODCommon that different mods can hook into to add new trespassing behaviors.

Here's my current code: https://pastebin.com/Y1ct0Tei

I have to do a reverse patch over the base Human.IsTrespassing method, I copied most of the existing Player.IsTrespassing code into this and I return false at the end so this is totally overriding Player.IsTrespassing. The actual return value is the __result ref. My bit is the isCrunchingDatabase block, and I imagine other modders may want additional blocks there.

Description of the feature

Feature usage Would allow mod authors to check for the presence of a mod. Would be useful for cases where methods have been patched for already-released mods, patching them, etc.

Dependencies and Prerequisites Does this feature require any new dependencies? No

Implementation details As extension methods or static methods in Lib, or as a change to PluginController

Ven0maus commented 4 months ago

Implemented in V1.1.8