Пример #1
0
        static void PopulateObjectDB(ObjectDB odb)
        {
            if (Prefabs.Count > 0 && !odb.m_items.Find(p => p.name == Prefabs[0].name))
            {
                foreach (var p in Prefabs)
                {
                    if (p.GetComponentInChildren <ItemDrop>(true))
                    {
                        odb.m_items.Add(p);
                    }
                }

                odb.UpdateItemHashes();
            }

            if (RecipeStubs.Count > 0 && !odb.GetRecipe(RecipeStubs[0].Item.m_itemData))
            {
                foreach (var rs in RecipeStubs)
                {
                    Recipe r = BuildRecipe(rs, odb);
                    if (r)
                    {
                        odb.m_recipes.Add(r);
                        Plugin.Log.LogInfo("Added recipe " + r.name);
                    }
                }
            }

            if (StatusEffects.Count > 0 && !odb.GetStatusEffect(StatusEffects[0].Key))
            {
                foreach (var se in StatusEffects)
                {
                    odb.m_StatusEffects.Add(se.Value);
                }
            }
        }