public bool TryDropEquipment(ThingWithComps eq, out ThingWithComps resultingEq, IntVec3 pos, bool forbid = true) { bool result; if (!pos.IsValid) { Log.Error(string.Concat(new object[] { this.pawn, " tried to drop ", eq, " at invalid cell." }), false); resultingEq = null; result = false; } else if (this.equipment.TryDrop(eq, pos, this.pawn.MapHeld, ThingPlaceMode.Near, out resultingEq, null, null)) { if (resultingEq != null) { resultingEq.SetForbidden(forbid, false); } result = true; } else { result = false; } return(result); }
public bool TryDropEquipment(ThingWithComps eq, out ThingWithComps resultingEq, IntVec3 pos, bool forbid = true) { if (!pos.IsValid) { Log.Error(this.pawn + " tried to drop " + eq + " at invalid cell."); resultingEq = null; return(false); } if (this.equipment.TryDrop((Thing)eq, pos, this.pawn.MapHeld, ThingPlaceMode.Near, out resultingEq, (Action <ThingWithComps, int>)null)) { if (resultingEq != null) { resultingEq.SetForbidden(forbid, false); } return(true); } return(false); }
public void MakeRoomFor(ThingWithComps eq) { if (eq.def.equipmentType == EquipmentType.Primary && this.Primary != null) { ThingWithComps thingWithComps = default(ThingWithComps); if (this.TryDropEquipment(this.Primary, out thingWithComps, this.pawn.Position, true)) { if (thingWithComps != null) { thingWithComps.SetForbidden(false, true); } } else { Log.Error(this.pawn + " couldn't make room for equipment " + eq); } } }