public static Hediff Debug_MakeConcreteExampleHediff(HediffDef def) { Hediff hediff = (Hediff)Activator.CreateInstance(def.hediffClass); hediff.def = def; hediff.loadID = Find.UniqueIDsManager.GetNextHediffID(); hediff.PostMake(); return(hediff); }
public static Hediff MakeHediff(HediffDef def, Pawn pawn, BodyPartRecord partRecord = null) { if (pawn == null) { Log.Error("Cannot make hediff " + def + " for null pawn."); return(null); } Hediff hediff = (Hediff)Activator.CreateInstance(def.hediffClass); hediff.def = def; hediff.pawn = pawn; hediff.Part = partRecord; hediff.loadID = Find.UniqueIDsManager.GetNextHediffID(); hediff.PostMake(); return(hediff); }
public static Hediff MakeHediff(HediffDef def, Pawn pawn, BodyPartRecord partRecord = null) { if (pawn == null) { Log.Error(string.Concat("Cannot make hediff ", def, " for null pawn.")); return(null); } Hediff obj = (Hediff)Activator.CreateInstance(def.hediffClass); obj.def = def; obj.pawn = pawn; obj.Part = partRecord; obj.loadID = Find.UniqueIDsManager.GetNextHediffID(); obj.PostMake(); return(obj); }