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); } } } } }
public void RefreshModifiers(float dt) { IStateMachineTarget master = GetMaster(); if (!master.isNull) { int cell = Grid.PosToCell(base.gameObject); if (Grid.IsValidCell(cell)) { KSelectable component = GetComponent <KSelectable>(); KPrefabID component2 = GetComponent <KPrefabID>(); if (component2.HasAnyTags(PRESERVED_TAGS)) { UnrefrigeratedModifier.SetValue(0f); ContaminatedAtmosphere.SetValue(0f); } else { UnrefrigeratedModifier.SetValue(rotTemperatureModifier()); ContaminatedAtmosphere.SetValue(rotAtmosphereModifier()); } SetStatusItems(atmoshpere: (ContaminatedAtmosphere.Value != 0f) ? ((ContaminatedAtmosphere.Value > 0f) ? RotAtmosphereQuality.Sterilizing : RotAtmosphereQuality.Contaminating) : RotAtmosphereQuality.Normal, selectable: component, refrigerated: UnrefrigeratedModifier.Value == 0f); RotAmountInstance.deltaAttribute.ClearModifiers(); if (UnrefrigeratedModifier.Value != 0f && ContaminatedAtmosphere.Value != 0.5f) { RotAmountInstance.deltaAttribute.Add(UnrefrigeratedModifier); } if (ContaminatedAtmosphere.Value != 0f && ContaminatedAtmosphere.Value != 0.5f) { RotAmountInstance.deltaAttribute.Add(ContaminatedAtmosphere); } } } }
public void UpdateTags() { if (ElementID == (SimHashes)0) { Debug.Log("UpdateTags() Primary element 0", base.gameObject); } else { KPrefabID component = GetComponent <KPrefabID>(); if ((UnityEngine.Object)component != (UnityEngine.Object)null) { List <Tag> list = new List <Tag>(); Element element = Element; list.Add(GameTagExtensions.Create(element.id)); Tag[] oreTags = element.oreTags; foreach (Tag item in oreTags) { list.Add(item); } if (component.HasAnyTags(metalTags)) { list.Add(GameTags.StoredMetal); } foreach (Tag item2 in list) { component.AddTag(item2, false); } } } }
private bool ValidMinionTags(MinionIdentity minion) { if ((UnityEngine.Object)minion == (UnityEngine.Object)null) { return(false); } KPrefabID component = minion.GetComponent <KPrefabID>(); return(!component.HasAnyTags(invalidConvoTags)); }
private bool IsPickupableRelevantToMyInterests(Pickupable pickupable) { KPrefabID kPrefabID = pickupable.KPrefabID; if (!kPrefabID.HasAnyTags(ref tagBits)) { return(false); } return(true); }
public HandleVector <int> .Handle Add(GameObject go, Vector2 initial_velocity, System.Action on_landed = null) { bool land_on_fake_floors = false; KPrefabID component = go.GetComponent <KPrefabID>(); if ((UnityEngine.Object)component != (UnityEngine.Object)null) { land_on_fake_floors = component.HasAnyTags(LANDS_ON_FAKEFLOOR); } return(Add(go, new GravityComponent(go.transform, on_landed, initial_velocity, land_on_fake_floors))); }
private bool HasTileableNeighbour(int neighbour_cell) { bool result = false; GameObject gameObject = Grid.Objects[neighbour_cell, (int)objectLayer]; if ((Object)gameObject != (Object)null) { KPrefabID component = gameObject.GetComponent <KPrefabID>(); if ((Object)component != (Object)null && component.HasAnyTags(tags)) { result = true; } } return(result); }
/** * Checks if the object meets the tag requirements for floatation. */ public static bool HasFloatableTags(Transform obj) { KPrefabID prefab = obj?.GetComponent <KPrefabID>(); if (prefab == null) { return(false); } if (prefab.HasAnyTags(nonFloatableTags) || !prefab.HasTag(GameTags.Pickupable)) { return(false); } if (prefab.HasTag(GameTags.Minion) && !prefab.HasTag(GameTags.Corpse)) { return(false); } return(true); }
/// <summary> /// Checks to see if the item can be eaten by a critter. This overload assumes that /// the item is not a plant. /// </summary> /// <param name="item">The item to check.</param> /// <param name="diet">The critter's diet.</param> /// <returns>true if the item is edible, or false otherwise.</returns> private static bool CanEatItem(KPrefabID item, Diet diet) { return(!item.HasAnyTags(ref SolidConsumerMonitor.creatureMask) && diet.GetDietInfo( item.PrefabTag) != null); }