public bool TryGetFirstFilteredItemForMending(Bill bill, ThingFilter filter, bool remove, out Thing gotten)
        {
            gotten = null;
            foreach (LinkedList <Thing> l in this.storedThings.Values)
            {
                if (l != null && l.Count > 0)
                {
                    for (LinkedListNode <Thing> n = l.First; n.Next != null; n = n.Next)
                    {
                        Thing t = n.Value;
                        if (!bill.IsFixedOrAllowedIngredient(t.def) || !filter.Allows(t.def))
                        {
                            break;
                        }

                        if (bill.IsFixedOrAllowedIngredient(t) && filter.Allows(t))
                        {
                            if (t.HitPoints == t.MaxHitPoints)
                            {
                                continue;
                            }

                            l.Remove(n);
                            BuildingUtil.DropSingleThing(t, this, this.Map, out gotten);
                            return(true);
                        }
                    }
                }
            }
            return(gotten != null);
        }
 public override void Notify_ReceivedThing(Thing newItem)
 {
     if (!this.AllowAdds)
     {
         BuildingUtil.DropSingleThing(newItem, this, this.Map, out Thing result);
     }
     else if (!this.Add(newItem))
     {
         this.DropThing(newItem, null);
     }
 }