public bool TryDropCarriedThing(IntVec3 dropLoc, ThingPlaceMode mode, out Thing resultingThing, Action <Thing, int> placedAction = null) { if (innerContainer.TryDrop(CarriedThing, dropLoc, pawn.MapHeld, mode, out resultingThing, placedAction)) { if (resultingThing != null && pawn.Faction.HostileTo(Faction.OfPlayer)) { resultingThing.SetForbidden(value: true, warnOnFail: false); } return(true); } return(false); }
public void DropAllNearPawn(IntVec3 pos, bool forbid = false, bool unforbid = false) { if (pawn.MapHeld == null) { Log.Error("Tried to drop all inventory near pawn but the pawn is unspawned. pawn=" + pawn); } else { tmpThingList.Clear(); tmpThingList.AddRange(innerContainer); for (int i = 0; i < tmpThingList.Count; i++) { innerContainer.TryDrop(tmpThingList[i], pos, pawn.MapHeld, ThingPlaceMode.Near, out Thing _, delegate(Thing t, int unused) { if (forbid) { t.SetForbiddenIfOutsideHomeArea(); } if (unforbid) { t.SetForbidden(value: false, warnOnFail: false); } if (t.def.IsPleasureDrug) { LessonAutoActivator.TeachOpportunity(ConceptDefOf.DrugBurning, OpportunityType.Important); } }); } } }