Adding SCP500 as a soft dependency
Updated 2 months agoHere is how you can add SCP500 as a soft dependency. This means your mod will not need to have the mod as a main dependency and will only use SCP500's functionality if it detects the mod exists.
internal class SCP500Compatibility
{
private static bool? _enabled;
internal static bool enabled
{
get
{
if (_enabled == null)
{
_enabled = BepInEx.Bootstrap.Chainloader.PluginInfos.ContainsKey("ProjectSCP.SCP500");
}
return (bool)_enabled;
}
}
internal static bool IsLocalPlayerAffectedBySCP500
{
get
{
if (enabled)
{
return LocalPlayerAffectedBySCP500();
}
return false;
}
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
private static bool LocalPlayerAffectedBySCP500()
{
return SCP500.SCP500Controller.LocalPlayerAffectedBySCP500;
}
}