Ejemplo n.º 1
0
    private void DropExcessIngredients(Storage storage)
    {
        TagBits search_tags = default(TagBits);

        search_tags.Or(ref keepAdditionalTags);
        for (int i = 0; i < recipe_list.Length; i++)
        {
            ComplexRecipe complexRecipe = recipe_list[i];
            if (IsRecipeQueued(complexRecipe))
            {
                ComplexRecipe.RecipeElement[] ingredients = complexRecipe.ingredients;
                foreach (ComplexRecipe.RecipeElement recipeElement in ingredients)
                {
                    search_tags.SetTag(recipeElement.material);
                }
            }
        }
        for (int num = storage.items.Count - 1; num >= 0; num--)
        {
            GameObject gameObject = storage.items[num];
            if (!((UnityEngine.Object)gameObject == (UnityEngine.Object)null))
            {
                PrimaryElement component = gameObject.GetComponent <PrimaryElement>();
                if (!((UnityEngine.Object)component == (UnityEngine.Object)null) && (!keepExcessLiquids || !component.Element.IsLiquid))
                {
                    KPrefabID component2 = gameObject.GetComponent <KPrefabID>();
                    if ((bool)component2 && !component2.HasAnyTags(ref search_tags))
                    {
                        storage.Drop(gameObject, true);
                    }
                }
            }
        }
    }
Ejemplo n.º 2
0
        /// <summary>
        /// Ands two sets of tag bits and replaces Tag Bits A with the result A | B.
        /// </summary>
        /// <param name="lhs">Tag Bits A.</param>
        /// <param name="rhs">Tag Bits B.</param>
        internal static void Or(ref TagBits lhs, ref TagBits rhs)
        {
            ulong hibits = lhs.bits7;

            lhs.Or(ref rhs);
            // Box into a type to allow the fields to be changed
            lhs.bits7 = TranspileOr(hibits, rhs.bits7);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Ands two sets of tag bits and replaces Tag Bits A with the result A | B.
        /// </summary>
        /// <param name="lhs">Tag Bits A.</param>
        /// <param name="rhs">Tag Bits B.</param>
        internal static void Or(ref TagBits lhs, ref TagBits rhs)
        {
            TagBits bits   = lhs;
            ulong   hibits = FIFTH_BIT.Get(lhs);

            bits.Or(ref rhs);
            // Box into a type to allow the fields to be changed
            object localBits = bits;

            FIFTH_BIT.Set(localBits, TranspileOr(hibits, FIFTH_BIT.Get(rhs)));
            lhs = (TagBits)localBits;
        }
Ejemplo n.º 4
0
    private void UpdateStorageFetchableBits()
    {
        ChoreType storageFetch = Db.Get().ChoreTypes.StorageFetch;
        ChoreType foodFetch    = Db.Get().ChoreTypes.FoodFetch;

        storageFetchableBits.ClearAll();
        foreach (FetchChore fetchChore in fetchChores)
        {
            if ((fetchChore.choreType == storageFetch || fetchChore.choreType == foodFetch) && (bool)fetchChore.destination)
            {
                int cell = Grid.PosToCell(fetchChore.destination);
                if (MinionGroupProber.Get().IsReachable(cell, fetchChore.destination.GetOffsets(cell)))
                {
                    storageFetchableBits.Or(ref fetchChore.tagBits);
                }
            }
        }
    }