88 lines
3.6 KiB
C#
88 lines
3.6 KiB
C#
/*using IntegratedConfigs.Harmony;
|
|
using IntegratedConfigs.Scripts;*/
|
|
using IntegratedConfigs.Harmony;
|
|
using IntegratedConfigs.Scripts;
|
|
using System.Xml.Linq;
|
|
|
|
namespace Harmony
|
|
{
|
|
public class RebirthUtilsInit : IModApi
|
|
{
|
|
public void InitMod(Mod _modInstance)
|
|
{
|
|
Log.Out(" Loading Patch: " + GetType());
|
|
|
|
// Reduce extra logging stuff
|
|
// disabled to prevent extra debugging info from getting stripped - Emu 12/07/2024
|
|
//Application.SetStackTraceLogType(UnityEngine.LogType.Log, StackTraceLogType.None);
|
|
//Application.SetStackTraceLogType(UnityEngine.LogType.Warning, StackTraceLogType.None);
|
|
|
|
var harmony = new HarmonyLib.Harmony(GetType().ToString());
|
|
harmony.PatchAll(Assembly.GetExecutingAssembly());
|
|
|
|
ReflectionHelpers.FindTypesImplementingBase(typeof(IIntegratedConfig), delegate (System.Type type)
|
|
{
|
|
IIntegratedConfig configRegistration = ReflectionHelpers.Instantiate<IIntegratedConfig>(type);
|
|
Log.Out($"{Globals.LOG_TAG} Registering custom XML {configRegistration.RegistrationInfo.XmlName}");
|
|
Harmony_WorldStaticData.RegisterConfig(configRegistration.RegistrationInfo);
|
|
});
|
|
|
|
RebirthVariables.loadCommonParticles();
|
|
RebirthVariables.LoadFactionStandings();
|
|
RebirthVariables.LoadCustomParticles();
|
|
|
|
RebirthVariables.utilsPath = ModManager.GetMod("zzz_REBIRTH__Utils", true).Path;
|
|
RebirthVariables.ignorePrefabs = XDocument.Load(RebirthVariables.utilsPath + "/IgnorePrefabs.xml");
|
|
|
|
/*var prefabNames = RebirthVariables.ignorePrefabs.Root
|
|
.Elements("prefab")
|
|
.Select(p => p.Attribute("name")?.Value)
|
|
.Where(name => !string.IsNullOrEmpty(name));
|
|
|
|
foreach (var name in prefabNames)
|
|
{
|
|
Log.Out("RebirthUtilsInit-InitMod ignored prefab: " + name);
|
|
}*/
|
|
|
|
if (RebirthVariables.testPurgeDiscovery)
|
|
{
|
|
RebirthVariables.discoveryUnlocks[0] = Tuple.Create(1f, 2f);
|
|
RebirthVariables.discoveryUnlocks[1] = Tuple.Create(2f, 3f);
|
|
RebirthVariables.discoveryUnlocks[2] = Tuple.Create(3f, 4f);
|
|
RebirthVariables.discoveryUnlocks[3] = Tuple.Create(4f, 5f);
|
|
RebirthVariables.discoveryUnlocks[4] = Tuple.Create(5f, 6f);
|
|
RebirthVariables.discoveryUnlocks[5] = Tuple.Create(6f, 7f);
|
|
RebirthVariables.discoveryUnlocks[6] = Tuple.Create(7f, 100f);
|
|
}
|
|
|
|
}
|
|
|
|
private void DisableOrigin()
|
|
{
|
|
var _Origin = GameObject.Find("Origin");
|
|
Log.Out($"Rebirth Init: Origin: {_Origin}");
|
|
if (_Origin != null)
|
|
{
|
|
Log.Out($"Found Origin activeSelf: {_Origin.activeSelf}");
|
|
Origin originObject = _Origin.GetComponent<Origin>();
|
|
if (originObject != null)
|
|
{
|
|
Log.Out($"Disabling Origin script component...");
|
|
originObject.enabled = false;
|
|
originObject.isAuto = false;
|
|
originObject.OriginPos = Vector3.zero;
|
|
|
|
if (Origin.Instance != null)
|
|
{
|
|
Log.Out($"Origin Instance found.");
|
|
}
|
|
else
|
|
{
|
|
Log.Out($"Origin Instance not set at this time.");
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
} |