Ejemplo n.º 1
0
        public override void PostSpawnSetup()
        {
            fuelContainer = new ThingContainer(this, false);

            // internal temperature initialize
            internalTemp = parent.Position.GetTemperature();

            // required comps initialize
            compFueled = parent.TryGetComp<CompFueled>();
            compFlickable = parent.TryGetComp<CompFlickable>();
            compHeatPusher = parent.TryGetComp<CompHeatPusher>();
            heatPerSecond_fromXML = compHeatPusher.Props.heatPerSecond;
            compGlower = parent.TryGetComp<CompGlower>();
            glowRadius_fromXML = compGlower.Props.glowRadius;

            // initialize glower and heater
            AdjustGlowerAndHeater();

            // filters initialize
            filterFuelPossible.SetDisallowAll();
            filterFuelPossible.allowedQualitiesConfigurable = false;
            filterFuelPossible.allowedHitPointsConfigurable = false;
            foreach (var thingDef in DefDatabase<ThingDef>.AllDefs.Where(def => !def.statBases.NullOrEmpty() && def.statBases.Exists(stat => stat.stat.defName == "MaxBurningTempCelsius" && stat.value > 0)))
            {
                filterFuelPossible.SetAllow(thingDef, true);
            }
            filterFuelCurrent.CopyAllowancesFrom(filterFuelPossible);
        }
        public BeltItemContainer([NotNull] BeltComponent component)
        {
            _parentComponent = component;

            _container = new ThingContainer(this);
            _thingCounter = new Dictionary<Thing, int>();
        }
Ejemplo n.º 3
0
 public AssemblyBill(AssemblyBillStack stack, Blueprint bp)
 {
     _bp = bp;
     _stack = stack;
     _container = new ThingContainer(this);
     WorkAmount = _bp.WorkAmount;
 }
Ejemplo n.º 4
0
 public ThingContainerAdapter(ThingContainer container)
 {
     this.oddThingsPropertyAdapter = this.CreatePropertyAdapter(
         nameof(this.OddThings),
         () => from Thing in container.AllThings
         where container.EvenThings.Contains(Thing) == false
         select Thing,
         value => ThingAdapter.GetInstance(value));
 }
Ejemplo n.º 5
0
        public override void SpawnSetup()
        {
            base.SpawnSetup();

            //Inventory Initialize
            this.inventory.container.Clear();
            mountContainer = new ThingContainer();

            UpdateGraphics();
        }
Ejemplo n.º 6
0
        public Vehicle_Cart() : base()
        {
            wheelRotation = 0;

            //Inventory Initialize. It should be moved in constructor
            this.storage    = new ThingContainer(this);
            this.allowances = new ThingFilter();
            this.allowances.SetFromPreset(StorageSettingsPreset.DefaultStockpile);
            this.allowances.SetFromPreset(StorageSettingsPreset.DumpingStockpile);
        }
Ejemplo n.º 7
0
        // initialises ThingContainer owner and restricts the max slots range
        public override void PostSpawnSetup()
        {
            slots = new ThingContainer(this);

            if (Properties.maxSlots > 6)
                Properties.maxSlots = 6;

            if (Properties.maxSlots < 1)
                Properties.maxSlots = 1;
        }
Ejemplo n.º 8
0
        public Vehicle_Cart()
            : base()
        {
            wheelRotation = 0;

            //Inventory Initialize. It should be moved in constructor
            this.storage = new ThingContainer(this);
            this.allowances = new ThingFilter();
            this.allowances.SetFromPreset(StorageSettingsPreset.DefaultStockpile);
            this.allowances.SetFromPreset(StorageSettingsPreset.DumpingStockpile);
        }
Ejemplo n.º 9
0
 public static void MakepawnInfos(ThingContainer container)
 {
     foreach (Thing t in container)
     {
         Pawn pawn = t as Pawn;
         if (pawn != null)
         {
             Log.Message(TravelingShipsUtility.PawnInfoString(pawn));
         }
     }
 }
        internal static void Remove(this ThingContainer _this, Thing item)
        {
            if (item.holder == _this)
            {
                item.holder = null;
            }
            List <Thing> innerList = (List <Thing>)innerListFieldInfo.GetValue(_this);    // Fetch innerList through reflection

            innerList.Remove(item);
            Utility.TryUpdateInventory(_this.owner as Pawn_InventoryTracker);           // Item was removed, update inventory
        }
Ejemplo n.º 11
0
        /* InventoryCountDefs
         * If the ThingDef is minifiable, search the container for how many minified objects are contained.
         * fallback to TotalStackCountOfDef for non-minifiable things.
         */
        private int InventoryCountDefs(ThingContainer container, ThingDef def)
        {
            int count = 0;

            if (def.Minifiable)
            {
                count = container.Count(t => t.GetInnerIfMinified().def == def);
            }
            else
            {
                count = container.TotalStackCountOfDef(def);
            }
            return(count);
        }
Ejemplo n.º 12
0
 public ShipBase(bool isIncoming = false, bool shouldSpawnRefueled = false)
 {
     if (isIncoming)
     {
         this.shipState      = ShipState.Incoming;
         this.drawTickOffset = this.compShip.sProps.TicksToImpact;
     }
     else
     {
         this.shipState = ShipState.Stationary;
     }
     this.ShouldSpawnFueled = shouldSpawnRefueled;
     this.innerContainer    = new ThingContainer(this, false, LookMode.Deep);
 }
Ejemplo n.º 13
0
 private void RemoveAllPawnsFromWorldPawns()
 {
     for (int i = 0; i < this.ships.Count; i++)
     {
         ThingContainer innerContainer = this.ships[i].GetInnerContainer();
         for (int j = 0; j < innerContainer.Count; j++)
         {
             Pawn pawn = innerContainer[j] as Pawn;
             if (pawn != null && pawn.IsWorldPawn())
             {
                 Find.WorldPawns.RemovePawn(pawn);
             }
         }
     }
 }
Ejemplo n.º 14
0
        public void ReloadStockIntoShip()
        {
            List <Thing> allCargo = this.allLandedShipCargo.ToList <Thing>();

            allCargo.AddRange(this.PawnsListForReading.Cast <Thing>().ToList());
            List <Thing> remainingCargo = new List <Thing>();

            for (int i = 0; i < this.PawnsListForReading.Count; i++)
            {
                this.tmpThingsToRemove.Clear();
                ThingContainer carrier = this.PawnsListForReading[i].inventory.GetInnerContainer();
                for (int k = 0; k < carrier.Count; k++)
                {
                    if (allCargo.Contains(carrier[k]))
                    {
                        this.tmpThingsToRemove.Add(carrier[k]);
                    }
                    else
                    {
                        remainingCargo.Add(carrier[k]);
                    }
                }
                carrier.RemoveAll(x => this.tmpThingsToRemove.Contains(x));
            }

            List <Thing> stockInShips = new List <Thing>();

            foreach (ShipBase ship in this.ships)
            {
                stockInShips.AddRange(ship.GetInnerContainer());
            }

            for (int i = 0; i < allCargo.Count; i++)
            {
                if (!stockInShips.Contains(allCargo[i]))
                {
                    remainingCargo.Add(allCargo[i]);
                }
            }

            DropShipUtility.LoadNewCargoIntoRandomShips(remainingCargo, this.ships);
        }
Ejemplo n.º 15
0
        internal static void Remove(this ThingContainer _this, Thing item)
        {
            if (!_this.Contains(item))
            {
                return;
            }
            if (item.holdingContainer == _this)
            {
                item.holdingContainer = null;
            }
            List <Thing> innerList = (List <Thing>)innerListFieldInfo.GetValue(_this);    // Fetch innerList through reflection

            innerList.Remove(item);
            Pawn_InventoryTracker pawn_InventoryTracker = _this.owner as Pawn_InventoryTracker;

            if (pawn_InventoryTracker != null)
            {
                pawn_InventoryTracker.Notify_ItemRemoved(item);
            }
            CR_Utility.TryUpdateInventory(_this.owner as Pawn_InventoryTracker);           // Item was removed, update inventory
        }
Ejemplo n.º 16
0
        public static void SetupShipTrading(LandedShip landedShip)
        {
            List <Pawn> allPawns = new List <Pawn>();

            foreach (ShipBase current in landedShip.ships)
            {
                allPawns = DropShipUtility.AllPawnsInShip(current);
                for (int k = 0; k < allPawns.Count; k++)
                {
                    ThingContainer innerContainer2 = current.GetInnerContainer();
                    for (int l = 0; l < innerContainer2.Count; l++)
                    {
                        if (!(innerContainer2[l] is Pawn))
                        {
                            Pawn pawn2 = CaravanInventoryUtility.FindPawnToMoveInventoryTo(innerContainer2[l], allPawns, null, null);
                            pawn2.inventory.innerContainer.TryAdd(innerContainer2[l], true);
                        }
                    }
                }
            }
        }
        public void TestNullableFields()
        {
            NullableTestPatternBuffer pb = new NullableTestPatternBuffer(4096);

            ThingContainer tc1 = new ThingContainer();

            tc1.Thing1    = new Thing(1);
            tc1.Thing2    = new Thing(2);
            tc1.Thing3    = new Thing(3);
            tc1.Thing4    = new Thing(4);
            tc1.Thing5    = new Thing(5);
            tc1.Thing6    = new Thing(6);
            tc1.Thing7    = new Thing(7);
            tc1.Thing8    = new Thing(8);
            tc1.Thing9    = new Thing(9);
            tc1.Thing10   = new Thing(10);
            tc1.IntValue1 = 1;
            tc1.IntValue2 = 2;

            byte[] bytes1 = pb.Energize(tc1);
            Assert.AreEqual(1 + 2 + 4 * 10 + 2 * 4, bytes1.Length);

            tc1.Thing3 = null;
            tc1.Thing8 = null;
            byte[] bytes2 = pb.Energize(tc1);
            Assert.AreEqual(1 + 2 + 4 * 8 + 2 * 4, bytes2.Length);

            tc1.Thing1  = null;
            tc1.Thing2  = null;
            tc1.Thing3  = null;
            tc1.Thing4  = null;
            tc1.Thing5  = null;
            tc1.Thing6  = null;
            tc1.Thing7  = null;
            tc1.Thing8  = null;
            tc1.Thing9  = null;
            tc1.Thing10 = null;
            byte[] bytes3 = pb.Energize(tc1);
            Assert.AreEqual(1 + 2 + 2 * 4, bytes3.Length);
        }
Ejemplo n.º 18
0
 internal static bool TryDrop(this ThingContainer _this, Thing thing, IntVec3 dropLoc, Map map, ThingPlaceMode mode, int count, out Thing resultingThing, Action <Thing, int> placedAction = null)
 {
     if (thing.stackCount < count)
     {
         Log.Error(string.Concat(new object[]
         {
             "Tried to drop ",
             count,
             " of ",
             thing,
             " while only having ",
             thing.stackCount
         }));
         count = thing.stackCount;
     }
     if (count == thing.stackCount)
     {
         if (GenDrop.TryDropSpawn(thing, dropLoc, map, mode, out resultingThing, placedAction))
         {
             _this.Remove(thing);
             CR_Utility.TryUpdateInventory(_this.owner as Pawn_InventoryTracker);   // Thing dropped, update inventory
             return(true);
         }
         return(false);
     }
     else
     {
         Thing thing2 = thing.SplitOff(count);
         if (GenDrop.TryDropSpawn(thing2, dropLoc, map, mode, out resultingThing, placedAction))
         {
             CR_Utility.TryUpdateInventory(_this.owner as Pawn_InventoryTracker);   // Thing dropped, update inventory
             return(true);
         }
         thing.stackCount += thing2.stackCount;
         return(false);
     }
 }
Ejemplo n.º 19
0
        public override void SpawnSetup()
        {
            base.SpawnSetup();

            //Inventory Initialize
            this.inventory.container.Clear();
            mountContainer = new ThingContainer();

            UpdateGraphics();
        }
Ejemplo n.º 20
0
 // private bool ForcedSleep = false;
 public Iglo()
 {
     this.container = new ThingContainer(this, false);
 }
Ejemplo n.º 21
0
 public ShipBase()
 {
     this.innerContainer = new ThingContainer(this, false, LookMode.Deep);
 }
Ejemplo n.º 22
0
 public Vehicle_Saddle()
     : base()
 {
     this.storage = new ThingContainer(this);
 }
        internal static bool TryAdd(this ThingContainer _this, Thing item)
        {
            if (item.stackCount > _this.AvailableStackSpace)
            {
                Log.Error(string.Concat(new object[]
                {
                    "Add item with stackCount=",
                    item.stackCount,
                    " with only ",
                    _this.AvailableStackSpace,
                    " in container. Splitting and adding..."
                }));
                return(_this.TryAdd(item, _this.AvailableStackSpace));
            }

            List <Thing> innerList = (List <Thing>)innerListFieldInfo.GetValue(_this);    // Fetch innerList through reflection

            SlotGroupUtility.Notify_TakingThing(item);
            if (item.def.stackLimit > 1)
            {
                for (int i = 0; i < innerList.Count; i++)
                {
                    if (innerList[i].def == item.def)
                    {
                        int num = item.stackCount;
                        if (num > _this.AvailableStackSpace)
                        {
                            num = _this.AvailableStackSpace;
                        }
                        Thing other = item.SplitOff(num);
                        if (!innerList[i].TryAbsorbStack(other, false))
                        {
                            Log.Error("ThingContainer did TryAbsorbStack " + item + " but could not absorb stack.");
                        }
                    }
                    if (item.Destroyed)
                    {
                        Utility.TryUpdateInventory(_this.owner as Pawn_InventoryTracker);   // Item has been added, notify CompInventory
                        return(true);
                    }
                }
            }

            int maxStacks = (int)maxStacksFieldInfo.GetValue(_this);    // Fetch maxStacks through reflection

            if (innerList.Count >= maxStacks)
            {
                return(false);
            }
            if (item.Spawned)
            {
                item.DeSpawn();
            }
            if (item.HasAttachment(ThingDefOf.Fire))
            {
                item.GetAttachment(ThingDefOf.Fire).Destroy(DestroyMode.Vanish);
            }
            item.holder = _this;
            innerList.Add(item);

            Utility.TryUpdateInventory(_this.owner as Pawn_InventoryTracker);   // Item has been added, notify CompInventory

            return(true);
        }
Ejemplo n.º 24
0
        internal static bool TryAdd(this ThingContainer _this, Thing item, bool canMergeWithExistingStacks = true)
        {
            if (item == null)
            {
                Log.Warning("Tried to add null item to ThingContainer.");
                return(false);
            }
            if (_this.Contains(item))
            {
                Log.Warning("Tried to add " + item + " to ThingContainer but this item is already here.");
                return(false);
            }

            if (item.stackCount > _this.AvailableStackSpace)
            {
                return(_this.TryAdd(item, _this.AvailableStackSpace) > 0);
            }

            List <Thing> innerList = (List <Thing>)innerListFieldInfo.GetValue(_this);    // Fetch innerList through reflection

            SlotGroupUtility.Notify_TakingThing(item);
            if (canMergeWithExistingStacks && item.def.stackLimit > 1)
            {
                for (int i = 0; i < innerList.Count; i++)
                {
                    if (innerList[i].def == item.def)
                    {
                        int num = item.stackCount;
                        if (num > _this.AvailableStackSpace)
                        {
                            num = _this.AvailableStackSpace;
                        }
                        Thing other = item.SplitOff(num);
                        if (!innerList[i].TryAbsorbStack(other, false))
                        {
                            Log.Error("ThingContainer did TryAbsorbStack " + item + " but could not absorb stack.");
                        }
                    }
                    if (item.Destroyed)
                    {
                        //CR PART!!!
                        CR_Utility.TryUpdateInventory(_this.owner as Pawn_InventoryTracker);   // Item has been added, notify CompInventory
                        return(true);
                    }
                }
            }

            int maxStacks = (int)maxStacksFieldInfo.GetValue(_this);    // Fetch maxStacks through reflection

            if (innerList.Count >= maxStacks)
            {
                return(false);
            }
            if (item.Spawned)
            {
                item.DeSpawn();
            }
            if (item.HasAttachment(ThingDefOf.Fire))
            {
                item.GetAttachment(ThingDefOf.Fire).Destroy(DestroyMode.Vanish);
            }
            item.holdingContainer = _this;
            innerList.Add(item);

            CR_Utility.TryUpdateInventory(_this.owner as Pawn_InventoryTracker);   // Item has been added, notify CompInventory

            return(true);
        }
        internal static bool TryTransferEquipmentToContainer(this Pawn_EquipmentTracker _this, ThingWithComps eq, ThingContainer container, out ThingWithComps resultingEq)
        {
            // Fetch private fields
            Pawn pawn = (Pawn)pawnFieldInfo.GetValue(_this);

            if (!_this.AllEquipment.Contains(eq))
            {
                Log.Warning(pawn.LabelCap + " tried to transfer equipment he didn't have: " + eq);
                resultingEq = null;
                return(false);
            }
            if (container.TryAdd(eq, true))
            {
                resultingEq = null;
            }
            else
            {
                resultingEq = eq;
            }
            _this.Remove(eq);
            CE_Utility.TryUpdateInventory(pawn);   // Equipment was stored away, update inventory

            // Cancel current job (use verb, etc.)
            if (pawn.Spawned)
            {
                pawn.stances.CancelBusyStanceSoft();
            }

            return(resultingEq == null);
        }
 public CompMechanicusImplantManager()
 {
     this.innerContainer = new ThingContainer(this, false);
 }
 private float ApplyToPawn(DamageInfo dinfo, Pawn pawn)
 {
     if (dinfo.Amount <= 0)
     {
         return(0f);
     }
     if (!DebugSettings.enablePlayerDamage && pawn.Faction == Faction.OfPlayer)
     {
         return(0f);
     }
     if (!dinfo.Part.HasValue)
     {
         dinfo.SetPart(new BodyPartDamageInfo(null, null));
     }
     DamageWorker_AddInjuryCR.LocalInjuryResult localInjuryResult = DamageWorker_AddInjuryCR.LocalInjuryResult.MakeNew();
     if (dinfo.Def.spreadOut)
     {
         if (pawn.apparel != null)
         {
             List <Apparel> wornApparel = pawn.apparel.WornApparel;
             for (int i = wornApparel.Count - 1; i >= 0; i--)
             {
                 this.CheckApplySpreadDamage(dinfo, wornApparel[i]);
             }
         }
         if (pawn.equipment != null && pawn.equipment.Primary != null)
         {
             this.CheckApplySpreadDamage(dinfo, pawn.equipment.Primary);
         }
         if (pawn.inventory != null)
         {
             ThingContainer container = pawn.inventory.container;
             for (int j = container.Count - 1; j >= 0; j--)
             {
                 this.CheckApplySpreadDamage(dinfo, container[j]);
             }
         }
     }
     if (!this.FragmentDamageForDamageType(dinfo, pawn, ref localInjuryResult))
     {
         this.ApplyDamagePartial(dinfo, pawn, ref localInjuryResult);
         this.CheckDuplicateSmallPawnDamageToPartParent(dinfo, pawn, ref localInjuryResult);
     }
     if (localInjuryResult.wounded)
     {
         DamageWorker_AddInjuryCR.PlayWoundedVoiceSound(dinfo, pawn);
         pawn.Drawer.Notify_DamageApplied(dinfo);
         DamageWorker_AddInjuryCR.InformPsychology(dinfo, pawn);
     }
     if (localInjuryResult.headshot && pawn.Spawned)
     {
         MoteThrower.ThrowText(new Vector3((float)pawn.Position.x + 1f, (float)pawn.Position.y, (float)pawn.Position.z + 1f), "Headshot".Translate(), Color.white, -1);
         if (dinfo.Instigator != null)
         {
             Pawn pawn2 = dinfo.Instigator as Pawn;
             if (pawn2 != null)
             {
                 pawn2.records.Increment(RecordDefOf.Headshots);
             }
         }
     }
     if (localInjuryResult.absorbed)
     {
         if (pawn.health.deflectionEffecter == null)
         {
             pawn.health.deflectionEffecter = EffecterDef.Named("ArmorRating").Spawn();
         }
         pawn.health.deflectionEffecter.Trigger(pawn, pawn);
     }
     else
     {
         ImpactSoundUtility.PlayImpactSound(pawn, dinfo.Def.impactSoundType);
     }
     return(localInjuryResult.totalDamageDealt);
 }
 public CompMechanicusImplantManager(Pawn pawn)
 {
     this.innerContainer = new ThingContainer(this, false);
     this.pawn           = pawn;
 }
Ejemplo n.º 29
0
 public void TakeInventory()
 {
     if (!this.initialized)
     {
         this.Initialize();
     }
     this.ClearInventory();
     foreach (Building current in Find.ListerBuildings.allBuildingsColonist)
     {
         this.Count(current);
         Building_Storage building_Storage = current as Building_Storage;
         if (building_Storage != null && building_Storage.GetSlotGroup() != null)
         {
             foreach (Thing current2 in building_Storage.GetSlotGroup().HeldThings)
             {
                 this.Count(current2);
             }
         }
         InventoryResolver inventoryResolver;
         if (this.inventoryResolvers.TryGetValue(current.def.defName, out inventoryResolver))
         {
             List <InventoryCount> inventoryCounts = inventoryResolver.GetInventoryCounts(current, this.state.prefs);
             if (inventoryCounts != null)
             {
                 foreach (InventoryCount current3 in inventoryCounts)
                 {
                     this.Count(current3);
                 }
             }
         }
     }
     using (List <Zone> .Enumerator enumerator4 = Find.ZoneManager.AllZones.FindAll((Zone zone) => zone is Zone_Stockpile).GetEnumerator())
     {
         while (enumerator4.MoveNext())
         {
             Zone_Stockpile zone_Stockpile = (Zone_Stockpile)enumerator4.Current;
             if (zone_Stockpile.GetSlotGroup() != null)
             {
                 foreach (Thing current4 in zone_Stockpile.GetSlotGroup().HeldThings)
                 {
                     this.Count(current4);
                 }
             }
         }
     }
     foreach (Pawn current5 in Find.ListerPawns.FreeColonists)
     {
         if (current5.equipment != null)
         {
             foreach (Thing current6 in current5.equipment.AllEquipment)
             {
                 this.Count(current6);
             }
         }
         if (current5.apparel != null)
         {
             foreach (Thing current7 in current5.apparel.WornApparel)
             {
                 this.Count(current7);
             }
         }
         if (current5.inventory != null && current5.inventory.container != null)
         {
             ThingContainer container = current5.inventory.container;
             int            count     = container.Count;
             for (int i = 0; i < count; i++)
             {
                 this.Count(container[i]);
             }
         }
     }
 }
Ejemplo n.º 30
0
 public HediffComp_NeuroController()
 {
     this.innerContainer = new ThingContainer(this, false, LookMode.Deep);
 }
 // initialises ThingContainer owner and restricts the max slots range
 public override void PostSpawnSetup()
 {
     this.slots = new ThingContainer(this);
 }
Ejemplo n.º 32
0
        // ==================================
        public override void SpawnSetup()
        {
            base.SpawnSetup();

            tickTime = 0;
            this.training = null;
            callDriver = false;
            visibleInside = false;
            driverContainer = new ThingContainer(this, true);
            driverContainer.owner = this;
            inventory = new Pawn_InventoryTracker(this);

            //def.race.corpseDef = ThingDefOf.Steel;
            vehicleDef = def as VehicleDef;

            //Work setting
            this.drafter = new Pawn_DraftController(this);
            callDriver = false;
            isStandby = false;

            turretGuns = new List<Parts_TurretGun>();
            if (!vehicleDef.vehicle.turretGunDefs.NullOrEmpty())
                for (int i = 0; i < vehicleDef.vehicle.turretGunDefs.Count; i++)
                {
                    Parts_TurretGun turretGun = new Parts_TurretGun();
                    turretGun.parent = this;
                    turretGun.parts_TurretGunDef = vehicleDef.vehicle.turretGunDefs[i];
                    turretGun.SpawnSetup();
                    turretGuns.Add(turretGun);
                }
        }
Ejemplo n.º 33
0
 public Beds()
 {
     this.container = new ThingContainer(this, false);
 }
        internal static bool TryTransferEquipmentToContainer(this Pawn_EquipmentTracker _this, ThingWithComps eq, ThingContainer container, out ThingWithComps resultingEq)
        {
            // Fetch private fields
            Pawn           pawn       = (Pawn)pawnFieldInfo.GetValue(_this);
            ThingWithComps primaryInt = (ThingWithComps)primaryIntFieldInfo.GetValue(_this);

            if (!_this.AllEquipment.Contains(eq))
            {
                Log.Warning(pawn.LabelCap + " tried to transfer equipment he didn't have: " + eq);
                resultingEq = null;
                return(false);
            }
            if (container.TryAdd(eq))
            {
                resultingEq = null;
            }
            else
            {
                resultingEq = eq;
            }
            if (primaryInt == eq)
            {
                primaryIntFieldInfo.SetValue(_this, null);  // Changed assignment to SetValue() since we're fetching a private variable through reflection
            }
            pawn.meleeVerbs.Notify_EquipmentLost();

            Utility.TryUpdateInventory(pawn);   // Equipment was stored away, update inventory

            // Cancel current job (use verb, etc.)
            if (pawn.Spawned)
            {
                pawn.stances.CancelBusyStanceSoft();
            }

            return(resultingEq == null);
        }