/// <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(); } } }
/// <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(); } } }