private void InvokeOnItemsRegistered(On.ObjectDB.orig_Awake orig, ObjectDB self) { orig(self); if (SceneManager.GetActiveScene().name == "main" && self.IsValid()) { OnItemsRegistered?.SafeInvoke(); } }
private void InvokeOnItemsRegisteredFejd(On.ObjectDB.orig_CopyOtherDB orig, ObjectDB self, ObjectDB other) { orig(self, other); if (SceneManager.GetActiveScene().name == "start" && self.IsValid()) { OnItemsRegisteredFejd?.SafeInvoke(); } }
private void RegisterCustomData(On.ObjectDB.orig_Awake orig, ObjectDB self) { orig(self); if (SceneManager.GetActiveScene().name == "main") { var isValid = self.IsValid(); if (isValid) { LoadPieceTables(); RegisterInPieceTables(); } } }
private void RemoveMockPrefabs(On.ObjectDB.orig_Awake orig, ObjectDB self) { orig(self); if (SceneManager.GetActiveScene().name == "main" && self.IsValid()) { if (MockPrefabContainer.transform.childCount > 0) { Logger.LogInfo("Destroying Mock prefabs"); foreach (var transform in MockPrefabContainer.transform) { GameObject.Destroy(((Transform)transform).gameObject); } } } }
/// <summary> /// Hook on <see cref="ObjectDB.CopyOtherDB"/> to add custom items to FejdStartup screen (aka main menu) /// </summary> /// <param name="orig"></param> /// <param name="self"></param> /// <param name="other"></param> private void RegisterCustomDataFejd(On.ObjectDB.orig_CopyOtherDB orig, ObjectDB self, ObjectDB other) { OnVanillaItemsAvailable?.SafeInvoke(); orig(self, other); if (SceneManager.GetActiveScene().name == "start") { var isValid = self.IsValid(); ItemDropMockFix.Switch(!isValid); if (isValid) { RegisterCustomItems(self); self.UpdateItemHashes(); } } }
private static void AddCustomData(On.ObjectDB.orig_Awake orig, ObjectDB self) { var isValid = self.IsValid(); ItemDropMockFix.Switch(!isValid); orig(self); if (isValid) { self.AddCustomItems(); self.AddCustomRecipes(); self.AddCustomStatusEffects(); self.UpdateItemHashes(); OnAfterInit?.Invoke(); OnAfterInit = null; } }
/// <summary> /// Hook on <see cref="ObjectDB.Awake"/> to register all custom entities from this manager to the <see cref="ObjectDB"/>. /// </summary> /// <param name="orig"></param> /// <param name="self"></param> private void RegisterCustomData(On.ObjectDB.orig_Awake orig, ObjectDB self) { orig(self); if (SceneManager.GetActiveScene().name == "main") { var isValid = self.IsValid(); ItemDropMockFix.Switch(!isValid); if (isValid) { RegisterCustomItems(self); RegisterCustomRecipes(self); RegisterCustomStatusEffects(self); RegisterCustomItemConversions(); self.UpdateItemHashes(); } } }