// I had to take into account the old defs of ISR2G that used to be buildings, and replace them with new ISR2G defs that are craftable items public void OldDefsCleanup() { int newISRG2 = 0; int newAISRG2 = 0; Caravan caravan = this.GetCaravan(); foreach (Thing aThing in CaravanInventoryUtility.AllInventoryItems(caravan)) { if (aThing.GetInnerIfMinified().def.defName == "RotR_ISR2G") { newISRG2++; aThing.Destroy(); } else if (aThing.GetInnerIfMinified().def.defName == "RotR_AISR2G") { newAISRG2++; aThing.Destroy(); } } for (int i = newISRG2; i > 0; i--) { Thing newThing = ThingMaker.MakeThing(ThingDef.Named("RotR_ISR2GNew")); CaravanInventoryUtility.GiveThing(caravan, newThing); RoadsOfTheRim.DebugLog("Replacing an ISR2G in caravan " + caravan.ToString()); } for (int j = newAISRG2; j > 0; j--) { Thing newThing = ThingMaker.MakeThing(ThingDef.Named("RotR_AISR2GNew")); CaravanInventoryUtility.GiveThing(caravan, newThing); RoadsOfTheRim.DebugLog("Replacing an AISR2G in caravan " + caravan.ToString()); } }