Exemplo n.º 1
0
        private void InvokeOnPiecesRegistered(On.ObjectDB.orig_Awake orig, ObjectDB self)
        {
            orig(self);

            if (SceneManager.GetActiveScene().name == "main" && self.IsValid())
            {
                OnPiecesRegistered?.SafeInvoke();
            }
        }
Exemplo n.º 2
0
        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();
                }
            }
        }
Exemplo n.º 3
0
        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);
                    }
                }
            }
        }
Exemplo n.º 4
0
        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;
            }
        }
Exemplo n.º 5
0
        /// <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();
                }
            }
        }