/*internal void AddWeapons(IEnumerable<ThingWithComps> weapons)
         * {
         * if (weapons == null)
         * return;
         *
         * foreach (ThingWithComps w in weapons)
         * {
         * this.AddWeapon(w);
         * }
         * }*/

        internal bool AddWeapon(ThingWithComps weapon)
        {
            if (this.CanAdd(weapon))
            {
                if (weapon.Spawned)
                {
                    weapon.DeSpawn();
                }

                if (CombatExtendedUtil.AddAmmo(weapon))
                {
                    return(true);
                }

                this.AddToSortedList(weapon, (CompBiocodable.IsBiocoded(weapon)) ? this.StoredBioEncodedWeapons : this.StoredWeapons);
                return(true);
            }
            return(false);
        }
        public override void Notify_ReceivedThing(Thing newItem)
        {
            if (!this.AllowAdds)
            {
                if (!newItem.Spawned)
                {
                    DropThing(newItem);
                }
                return;
            }

            if (!((newItem is ThingWithComps) && ((ThingWithComps)newItem).def.IsWeapon) &&
                !CombatExtendedUtil.IsAmmo(newItem))
            {
                if (!newItem.Spawned)
                {
                    DropThing(newItem);
                }
                return;
            }

            base.Notify_ReceivedThing(newItem);

            if (!CombatExtendedUtil.AddAmmo(newItem))
            {
                if (newItem is ThingWithComps &&
                    !this.Contains((ThingWithComps)newItem))
                {
                    // Must go after 'contains' check. In the case of 'drop on floor' Notify_ReceiveThing gets called before the weapon is removed from the list
                    if (newItem.Spawned)
                    {
                        newItem.DeSpawn();
                    }

                    if (!this.AddWeapon(newItem as ThingWithComps) &&
                        !WorldComp.Add(newItem as ThingWithComps))
                    {
                        BuildingUtil.DropThing(newItem, this, this.CurrentMap, true);
                    }
                }
            }
        }