Mirror of 1.4.7 from Lovers Lab

This commit is contained in:
ghostclinic3YTB 2023-04-03 21:47:48 -04:00
parent 161133e4e1
commit 9a3d9f4185
607 changed files with 11263 additions and 1309 deletions

View file

@ -128,16 +128,16 @@ namespace SizedApparel
return result;
}
public static Graphic GetSizedApparelGraphic(Graphic sourceGraphic, float breastSeverity, string wearerDefName = null, string breastHediff = null, string customPose = null)
public static Graphic GetSizedApparelGraphic(Graphic sourceGraphic, float breastSeverity, string wearerDefName = null, string breastHediff = null, string customPose = null, Gender gender = Gender.None)
{
int currentBreastSizeIndex = -1;
float currentBreastSeverity = -1;
string s;
bool flag = false;
return GetSizedApparelGraphic(sourceGraphic, breastSeverity, out currentBreastSizeIndex, out currentBreastSeverity, out flag, out s, wearerDefName, breastHediff);
return GetSizedApparelGraphic(sourceGraphic, breastSeverity, out currentBreastSizeIndex, out currentBreastSeverity, out flag, out s, wearerDefName, breastHediff, customPose, gender);
}
public static Graphic GetSizedApparelGraphic(Graphic sourceGraphic, float breastSeverity , out int indexOut, out float severityOut, out bool result, out string hediffResult, string wearerDefName = null, string breastHediffName = null, string customPose = null)
public static Graphic GetSizedApparelGraphic(Graphic sourceGraphic, float breastSeverity , out int indexOut, out float severityOut, out bool result, out string hediffResult, string wearerDefName = null, string breastHediffName = null, string customPose = null, Gender gender = Gender.None)
{
indexOut = -1;
severityOut = -1;
@ -155,7 +155,9 @@ namespace SizedApparel
string raceExtraPath = null;
string racePath = null;
//path = agr.sourceApparel.def.apparel.wornGraphicPath + "_" + __instance.pawn.story.bodyType.defName;
path = sourceGraphic.path;
@ -164,8 +166,21 @@ namespace SizedApparel
path = path.Insert(Math.Max(path.LastIndexOf('/'), 0), "/CustomPose/"+ customPose);
}
string genderSting;
if (gender == Gender.Female)
{
genderSting = "F";
}
if (gender == Gender.Male)
{
genderSting = "M";
}
else
genderSting = string.Empty;
if(wearerDefName != null)
path = path + genderSting;
if (wearerDefName != null)
racePath = path + "_" + wearerDefName;
if (breastHediffName != null)
{
@ -178,6 +193,7 @@ namespace SizedApparel
int offset = 0;
@ -195,7 +211,7 @@ namespace SizedApparel
pathString = raceExtraPath + SizedApparelUtility.BreastSeverityString(breastSeverity, offset, findBigger, ref indexOut, ref severityOut);
if (ContentFinder<Texture2D>.Get((pathString + "_south"), false) != null) // checking special texture like udder
{
if (SizedApparelSettings.Debug)
if (SizedApparelSettings.Debug && SizedApparelSettings.DetailLog)
Log.Message("[Sized Apparel] (" + pathString + ")apparel texture is found");
graphic = GraphicDatabase.Get<Graphic_Multi>(pathString, sourceGraphic.Shader, sourceGraphic.drawSize, sourceGraphic.color, sourceGraphic.colorTwo, sourceGraphic.data);
validTexture = true;
@ -210,7 +226,7 @@ namespace SizedApparel
pathString = extraPath + SizedApparelUtility.BreastSeverityString(breastSeverity, offset, findBigger, ref indexOut, ref severityOut);
if (ContentFinder<Texture2D>.Get((pathString + "_south"), false) != null) // checking special texture like udder
{
if (SizedApparelSettings.Debug)
if (SizedApparelSettings.Debug && SizedApparelSettings.DetailLog)
Log.Message("[Sized Apparel] (" + pathString + ")apparel texture is found");
graphic = GraphicDatabase.Get<Graphic_Multi>(pathString, sourceGraphic.Shader, sourceGraphic.drawSize, sourceGraphic.color, sourceGraphic.colorTwo, sourceGraphic.data);
validTexture = true;
@ -221,7 +237,7 @@ namespace SizedApparel
}
}
if (SizedApparelSettings.Debug)
if (SizedApparelSettings.Debug && SizedApparelSettings.DetailLog)
Log.Message("[Sized Apparel] (" + pathString + ")apparel texture is missing");
if(racePath != null)
@ -229,7 +245,7 @@ namespace SizedApparel
pathString = racePath + SizedApparelUtility.BreastSeverityString(breastSeverity, offset, findBigger, ref indexOut, ref severityOut);
if ((ContentFinder<Texture2D>.Get((pathString + "_south"), false) != null))
{
if (SizedApparelSettings.Debug)
if (SizedApparelSettings.Debug && SizedApparelSettings.DetailLog)
Log.Message("[Sized Apparel] (" + pathString + ")apparel texture is found");
graphic = GraphicDatabase.Get<Graphic_Multi>(pathString, sourceGraphic.Shader, sourceGraphic.drawSize, sourceGraphic.color, sourceGraphic.colorTwo, sourceGraphic.data);
validTexture = true;
@ -244,7 +260,7 @@ namespace SizedApparel
pathString = path + SizedApparelUtility.BreastSeverityString(breastSeverity, offset, findBigger, ref indexOut, ref severityOut);
if ((ContentFinder<Texture2D>.Get((pathString + "_south"), false) != null))
{
if (SizedApparelSettings.Debug)
if (SizedApparelSettings.Debug && SizedApparelSettings.DetailLog)
Log.Message("[Sized Apparel] (" + pathString + ")apparel texture is found");
graphic = GraphicDatabase.Get<Graphic_Multi>(pathString, sourceGraphic.Shader, sourceGraphic.drawSize, sourceGraphic.color, sourceGraphic.colorTwo, sourceGraphic.data);
//newAgr.Add(new ApparelGraphicRecord(graphic, agr.sourceApparel));
@ -254,7 +270,7 @@ namespace SizedApparel
//Log.Message(path + BreastSeverityString(breastSeverity, offset, findBigger) + ":Texture Found");
break;
}
if (SizedApparelSettings.Debug)
if (SizedApparelSettings.Debug && SizedApparelSettings.DetailLog)
Log.Message("[Sized Apparel] (" + pathString + ")apparel texture is missing");
//Log.Warning(path + BreastSeverityString(breastSeverity, offset, findBigger) + ":Texture Not Found. Try bigger Texture.");
@ -274,7 +290,7 @@ namespace SizedApparel
pathString = raceExtraPath + SizedApparelUtility.BreastSeverityString(breastSeverity, offset, !findBigger, ref indexOut, ref severityOut);
if (ContentFinder<Texture2D>.Get((pathString + "_south"), false) != null) // checking special texture like udder
{
if (SizedApparelSettings.Debug)
if (SizedApparelSettings.Debug && SizedApparelSettings.DetailLog)
Log.Message("[Sized Apparel] (" + pathString + ")apparel texture is found");
graphic = GraphicDatabase.Get<Graphic_Multi>(pathString, sourceGraphic.Shader, sourceGraphic.drawSize, sourceGraphic.color, sourceGraphic.colorTwo, sourceGraphic.data);
@ -290,7 +306,7 @@ namespace SizedApparel
pathString = extraPath + SizedApparelUtility.BreastSeverityString(breastSeverity, offset, !findBigger, ref indexOut, ref severityOut);
if (ContentFinder<Texture2D>.Get((pathString + "_south"), false) != null) // checking special texture like udder
{
if (SizedApparelSettings.Debug)
if (SizedApparelSettings.Debug && SizedApparelSettings.DetailLog)
Log.Message("[Sized Apparel] (" + pathString + ")apparel texture is found");
graphic = GraphicDatabase.Get<Graphic_Multi>(pathString, sourceGraphic.Shader, sourceGraphic.drawSize, sourceGraphic.color, sourceGraphic.colorTwo, sourceGraphic.data);
//newAgr.Add(new ApparelGraphicRecord(graphic, agr.sourceApparel));
@ -300,7 +316,7 @@ namespace SizedApparel
//Log.Message(extraPath + BreastSeverityString(breastSeverity, offset, !findBigger) + ":Extra Texture Found");
break;
}
if (SizedApparelSettings.Debug)
if (SizedApparelSettings.Debug && SizedApparelSettings.DetailLog)
Log.Message("[Sized Apparel] (" + pathString + ")apparel texture is missing");
//Log.Warning(extraPath + BreastSeverityString(breastSeverity, offset, !findBigger) + ":Extra Texture Not Found.");
@ -311,7 +327,7 @@ namespace SizedApparel
pathString = racePath + SizedApparelUtility.BreastSeverityString(breastSeverity, offset, !findBigger, ref indexOut, ref severityOut);
if ((ContentFinder<Texture2D>.Get((pathString + "_south"), false) != null))
{
if (SizedApparelSettings.Debug)
if (SizedApparelSettings.Debug && SizedApparelSettings.DetailLog)
Log.Message("[Sized Apparel] (" + pathString + ")apparel texture is found");
graphic = GraphicDatabase.Get<Graphic_Multi>(pathString, sourceGraphic.Shader, sourceGraphic.drawSize, sourceGraphic.color, sourceGraphic.colorTwo, sourceGraphic.data);
//newAgr.Add(new ApparelGraphicRecord(graphic, agr.sourceApparel));
@ -326,7 +342,7 @@ namespace SizedApparel
pathString = path + SizedApparelUtility.BreastSeverityString(breastSeverity, offset, !findBigger, ref indexOut, ref severityOut);
if ((ContentFinder<Texture2D>.Get((pathString + "_south"), false) != null))
{
if (SizedApparelSettings.Debug)
if (SizedApparelSettings.Debug && SizedApparelSettings.DetailLog)
Log.Message("[Sized Apparel] (" + pathString + ")apparel texture is found");
graphic = GraphicDatabase.Get<Graphic_Multi>(pathString, sourceGraphic.Shader, sourceGraphic.drawSize, sourceGraphic.color, sourceGraphic.colorTwo, sourceGraphic.data);
//newAgr.Add(new ApparelGraphicRecord(graphic, agr.sourceApparel));
@ -336,7 +352,7 @@ namespace SizedApparel
//Log.Message(path + BreastSeverityString(breastSeverity, offset, !findBigger) + ":Texture Found");
break;
}
if (SizedApparelSettings.Debug)
if (SizedApparelSettings.Debug && SizedApparelSettings.DetailLog)
Log.Message("[Sized Apparel] (" + pathString + ")apparel texture is missing");
//Log.Warning(path + BreastSeverityString(breastSeverity, offset, !findBigger) + ":Texture Not Found. Try smaller Texture.");
@ -403,9 +419,10 @@ namespace SizedApparel
return false;
}
public static bool isRJWParts(string defname)
public static bool isRJWParts(Hediff h)
{
return (isBreast(defname)|| isPenis(defname)|| isVagina(defname)|| isAnus(defname));
return (isBreast(h.def.defName) || Genital_Helper.is_penis(h) || Genital_Helper.is_vagina(h) || isAnus(h.def.defName));
//return (isBreast(defname)|| isPenis(defname)|| isVagina(defname)|| isAnus(defname));
}
public static bool isBreast(string defname)
{
@ -422,7 +439,7 @@ namespace SizedApparel
return false;
}
//To Race Support, you should Patch this!
[Obsolete]
public static bool isPenis(string defname)
{
string lower = defname.ToLower();
@ -430,6 +447,7 @@ namespace SizedApparel
return true;
return false;
}
[Obsolete]
public static bool isVagina(string defname)
{
string lower = defname.ToLower();
@ -448,7 +466,7 @@ namespace SizedApparel
//find valid breasts texture to choose apparel.
public static float GetBreastSeverityValidTextures(Pawn pawn, Hediff hediff, string customDefName = null)
{
ApparelRecorderComp comp = pawn.TryGetComp<ApparelRecorderComp>();
ApparelRecorderComp comp = pawn.GetComp<ApparelRecorderComp>();
if (comp == null)
return -1;
@ -508,7 +526,7 @@ namespace SizedApparel
pathString = extraPath + SizedApparelUtility.BreastSeverityString(targetBreastSeverity, offset, findBigger, ref currentSizeIndex, ref currentSeverity);
if (ContentFinder<Texture2D>.Get((pathString + "_south"), false) != null) // checking special texture like udder
{
if (SizedApparelSettings.Debug)
if (SizedApparelSettings.Debug && SizedApparelSettings.DetailLog)
Log.Message("[Sized Apparel] (" + pathString + ")Breasts texture is found");
@ -517,19 +535,19 @@ namespace SizedApparel
}
}
if (SizedApparelSettings.Debug)
if (SizedApparelSettings.Debug && SizedApparelSettings.DetailLog)
Log.Message("[Sized Apparel] (" + pathString + ")Breasts texture is missing");
pathString = path + SizedApparelUtility.BreastSeverityString(targetBreastSeverity, offset, findBigger, ref currentSizeIndex, ref currentSeverity);
if ((ContentFinder<Texture2D>.Get((pathString + "_south"), false) != null))
{
if (SizedApparelSettings.Debug)
if (SizedApparelSettings.Debug && SizedApparelSettings.DetailLog)
Log.Message("[Sized Apparel] (" + pathString + ")Breasts texture is found");
validTexture = true;
break;
}
if (SizedApparelSettings.Debug)
if (SizedApparelSettings.Debug && SizedApparelSettings.DetailLog)
Log.Message("[Sized Apparel] (" + pathString + ")Breasts texture is missing");
offset++;
@ -546,13 +564,13 @@ namespace SizedApparel
pathString = extraPath + SizedApparelUtility.BreastSeverityString(targetBreastSeverity, offset, !findBigger, ref currentSizeIndex, ref currentSeverity);
if (ContentFinder<Texture2D>.Get((pathString + "_south"), false) != null) // checking special texture like udder
{
if (SizedApparelSettings.Debug)
if (SizedApparelSettings.Debug && SizedApparelSettings.DetailLog)
Log.Message("[Sized Apparel] (" + pathString + ")Breasts texture is found");
validTexture = true;
break;
}
if (SizedApparelSettings.Debug)
if (SizedApparelSettings.Debug && SizedApparelSettings.DetailLog)
Log.Message("[Sized Apparel] (" + pathString + ")Breasts texture is missing");
}
@ -560,13 +578,13 @@ namespace SizedApparel
pathString = path + SizedApparelUtility.BreastSeverityString(targetBreastSeverity, offset, !findBigger, ref currentSizeIndex, ref currentSeverity);
if ((ContentFinder<Texture2D>.Get((pathString + "_south"), false) != null))
{
if (SizedApparelSettings.Debug)
if (SizedApparelSettings.Debug && SizedApparelSettings.DetailLog)
Log.Message("[Sized Apparel] (" + pathString + ")Breasts texture is found");
validTexture = true;
break;
}
if (SizedApparelSettings.Debug)
if (SizedApparelSettings.Debug && SizedApparelSettings.DetailLog)
Log.Message("[Sized Apparel] (" + pathString + ")Breasts texture is missing");
offset++;
@ -589,13 +607,15 @@ namespace SizedApparel
}
//It's heavy search. Do Not Call this function rapidly
public static Graphic GetBodyPartGraphic(string raceDefName, string bodyTypeName, string hediffDefName, bool isBreast, int sizeIndex, string folderName, string defaultHediffName, out int indexOut, out string hediffResult, bool hornyGraphic = false, string customRaceDefName = null, string variation = null)
public static Graphic GetBodyPartGraphic(string raceDefName, string bodyTypeName, string hediffDefName, bool isBreast, int sizeIndex, string folderName, string defaultHediffName, out int indexOut, out string hediffResult, bool hornyGraphic = false, string customRaceDefName = null, string variation = null, Gender gender = Gender.None)
{
Graphic graphic = null; //for return
//rec = new ApparelGraphicRecord(null, null);
string defName = raceDefName;
if (customRaceDefName != null)
defName = customRaceDefName;
string bodyType = bodyTypeName;
string bodyPartsFolderPath = "SizedApparel/BodyParts/";
string graphicFolderPath;
@ -628,8 +648,21 @@ namespace SizedApparel
//SizedApparelUtility.GetBreastSeverity(apparel.Wearer, out BreastSeverity, out breastHediff);
string path = graphicFolderPath + fileName;
string extraPath = graphicFolderPath + extraFileName;
string genderString;
if(gender == Gender.Female)
{
genderString = "F";
}
if (gender == Gender.Male)
{
genderString = "M";
}
else
genderString = string.Empty;
string path = graphicFolderPath + fileName + genderString;
string extraPath = graphicFolderPath + extraFileName + genderString;
//path = agr.sourceApparel.def.apparel.wornGraphicPath + "_" + __instance.pawn.story.bodyType.defName;
@ -661,7 +694,7 @@ namespace SizedApparel
pathStringWithVariatione = pathString + "_" + variation;
if (ContentFinder<Texture2D>.Get((pathStringWithVariatione + "_south"), false) != null) // checking special texture like udder
{
if (SizedApparelSettings.Debug)
if (SizedApparelSettings.Debug && SizedApparelSettings.DetailLog)
Log.Message("[Sized Apparel] (" + pathStringWithVariatione + ")BodyPart texture is found");
graphic = GraphicDatabase.Get<Graphic_Multi>(pathStringWithVariatione);
@ -669,7 +702,7 @@ namespace SizedApparel
hediffResult = hediffDefName;
break;
}
if (SizedApparelSettings.Debug)
if (SizedApparelSettings.Debug && SizedApparelSettings.DetailLog)
Log.Message("[Sized Apparel] (" + pathStringWithVariatione + ")BodyPart texture is missing");
}
@ -677,7 +710,7 @@ namespace SizedApparel
if (ContentFinder<Texture2D>.Get((pathString + "_south"), false) != null) // checking special texture like udder
{
if (SizedApparelSettings.Debug)
if (SizedApparelSettings.Debug && SizedApparelSettings.DetailLog)
Log.Message("[Sized Apparel] (" + pathString + ")BodyPart texture is found");
@ -694,7 +727,7 @@ namespace SizedApparel
//Log.Warning(extraPath + BreastSeverityString(BreastSeverity, offset, findBigger) + ":Extra Texture Not Found.");
}
if (SizedApparelSettings.Debug)
if (SizedApparelSettings.Debug && SizedApparelSettings.DetailLog)
Log.Message("[Sized Apparel] (" + pathString + ")BodyPart texture is missing");
if (isBreast)
@ -707,7 +740,7 @@ namespace SizedApparel
pathStringWithVariatione = pathString + "_" + variation;
if (ContentFinder<Texture2D>.Get((pathStringWithVariatione + "_south"), false) != null) // checking special texture like udder
{
if (SizedApparelSettings.Debug)
if (SizedApparelSettings.Debug && SizedApparelSettings.DetailLog)
Log.Message("[Sized Apparel] (" + pathStringWithVariatione + ")BodyPart texture is found");
graphic = GraphicDatabase.Get<Graphic_Multi>(pathStringWithVariatione);
@ -715,13 +748,13 @@ namespace SizedApparel
hediffResult = hediffDefName;
break;
}
if (SizedApparelSettings.Debug)
if (SizedApparelSettings.Debug && SizedApparelSettings.DetailLog)
Log.Message("[Sized Apparel] (" + pathStringWithVariatione + ")BodyPart texture is missing");
}
if ((ContentFinder<Texture2D>.Get((pathString + "_south"), false) != null))
{
if (SizedApparelSettings.Debug)
if (SizedApparelSettings.Debug && SizedApparelSettings.DetailLog)
Log.Message("[Sized Apparel] (" + pathString + ")BodyPart texture is found");
//minSupportedBreastSizeIndex = Math.Min(currentBreastSizeIndex, minSupportedBreastSizeIndex);
@ -733,7 +766,7 @@ namespace SizedApparel
//Log.Message(path + BreastSeverityString(BreastSeverity, offset, findBigger) + ":Texture Found");
break;
}
if (SizedApparelSettings.Debug)
if (SizedApparelSettings.Debug && SizedApparelSettings.DetailLog)
Log.Message("[Sized Apparel] (" + pathString + ")BodyPart texture is missing");
//Log.Warning(path + BreastSeverityString(BreastSeverity, offset, findBigger) + ":Texture Not Found. Try bigger Texture.");
@ -758,7 +791,7 @@ namespace SizedApparel
pathStringWithVariatione = pathString + "_" + variation;
if (ContentFinder<Texture2D>.Get((pathStringWithVariatione + "_south"), false) != null) // checking special texture like udder
{
if (SizedApparelSettings.Debug)
if (SizedApparelSettings.Debug && SizedApparelSettings.DetailLog)
Log.Message("[Sized Apparel] (" + pathStringWithVariatione + ")BodyPart texture is found");
graphic = GraphicDatabase.Get<Graphic_Multi>(pathStringWithVariatione);
@ -766,13 +799,13 @@ namespace SizedApparel
hediffResult = hediffDefName;
break;
}
if (SizedApparelSettings.Debug)
if (SizedApparelSettings.Debug && SizedApparelSettings.DetailLog)
Log.Message("[Sized Apparel] (" + pathStringWithVariatione + ")BodyPart texture is missing");
}
if (ContentFinder<Texture2D>.Get((pathString + "_south"), false) != null) // checking special texture like udder
{
if (SizedApparelSettings.Debug)
if (SizedApparelSettings.Debug && SizedApparelSettings.DetailLog)
Log.Message("[Sized Apparel] (" + pathString + ")BodyPart texture is found");
//minSupportedBreastSizeIndex = Math.Min(currentBreastSizeIndex, minSupportedBreastSizeIndex);
@ -785,7 +818,7 @@ namespace SizedApparel
//Log.Message(extraPath + BreastSeverityString(BreastSeverity, offset, !findBigger) + ":Extra Texture Found");
break;
}
if (SizedApparelSettings.Debug)
if (SizedApparelSettings.Debug && SizedApparelSettings.DetailLog)
Log.Message("[Sized Apparel] (" + pathString + ")BodyPart texture is missing");
//Log.Warning(extraPath + BreastSeverityString(BreastSeverity, offset, !findBigger) + ":Extra Texture Not Found.");
@ -800,7 +833,7 @@ namespace SizedApparel
pathStringWithVariatione = pathString + "_" + variation;
if (ContentFinder<Texture2D>.Get((pathStringWithVariatione + "_south"), false) != null) // checking special texture like udder
{
if (SizedApparelSettings.Debug)
if (SizedApparelSettings.Debug && SizedApparelSettings.DetailLog)
Log.Message("[Sized Apparel] (" + pathStringWithVariatione + ")BodyPart texture is found");
graphic = GraphicDatabase.Get<Graphic_Multi>(pathStringWithVariatione);
@ -808,13 +841,13 @@ namespace SizedApparel
hediffResult = hediffDefName;
break;
}
if (SizedApparelSettings.Debug)
if (SizedApparelSettings.Debug && SizedApparelSettings.DetailLog)
Log.Message("[Sized Apparel] (" + pathStringWithVariatione + ")BodyPart texture is missing");
}
if ((ContentFinder<Texture2D>.Get((pathString + "_south"), false) != null))
{
if (SizedApparelSettings.Debug)
if (SizedApparelSettings.Debug && SizedApparelSettings.DetailLog)
Log.Message("[Sized Apparel] (" + pathString + ")BodyPart texture is found");
//minSupportedBreastSizeIndex = Math.Min(currentBreastSizeIndex, minSupportedBreastSizeIndex);
@ -826,7 +859,7 @@ namespace SizedApparel
//Log.Message(path + BreastSeverityString(BreastSeverity, offset, !findBigger) + ":Texture Found");
break;
}
if (SizedApparelSettings.Debug)
if (SizedApparelSettings.Debug && SizedApparelSettings.DetailLog)
Log.Message("[Sized Apparel] (" + pathString + ")BodyPart texture is missing");
//Log.Warning(path + BreastSeverityString(BreastSeverity, offset, !findBigger) + ":Texture Not Found. Try smaller Texture.");
@ -854,11 +887,17 @@ namespace SizedApparel
}
indexOut = currentSizeIndex;
if(graphic == null & gender != Gender.None)
{
//try search genderless graphic
graphic = GetBodyPartGraphic(raceDefName, bodyTypeName, hediffDefName, isBreast, sizeIndex, folderName, defaultHediffName, out indexOut, out hediffResult, hornyGraphic, customRaceDefName, variation, Gender.None);
}
if(graphic == null & hornyGraphic == true)
if (graphic == null & hornyGraphic == true)
{
//try search normal Graphic instead of HornyGraphic
graphic = GetBodyPartGraphic(raceDefName, bodyTypeName, hediffDefName, isBreast, sizeIndex, folderName, defaultHediffName, out indexOut, out hediffResult, false, customRaceDefName, variation);
graphic = GetBodyPartGraphic(raceDefName, bodyTypeName, hediffDefName, isBreast, sizeIndex, folderName, defaultHediffName, out indexOut, out hediffResult, false, customRaceDefName, variation, gender);
}
return graphic;
@ -885,14 +924,14 @@ namespace SizedApparel
Graphic nakedGraphic = pawn.Drawer?.renderer?.graphics?.nakedGraphic;
if (nakedGraphic == null)
return null;
var rotComp = pawn.TryGetComp<CompRottable>();
var rotComp = pawn.GetComp<CompRottable>();
if (rotComp!=null)
{
if (rotComp.Stage == RotStage.Rotting)
nakedGraphic = pawn.Drawer.renderer.graphics.rottingGraphic;
}
ApparelRecorderComp comp = pawn.TryGetComp<ApparelRecorderComp>();
ApparelRecorderComp comp = pawn.GetComp<ApparelRecorderComp>();
string defName = pawn.def.defName;
if (customRaceDefName != null)
defName = customRaceDefName;
@ -995,7 +1034,7 @@ namespace SizedApparel
public static bool IsHorny(Pawn pawn)
{
var comp = pawn.TryGetComp<ApparelRecorderComp>();
var comp = pawn.GetComp<ApparelRecorderComp>();
if(comp != null)
{
if (comp.forceHorny == true)
@ -1293,108 +1332,6 @@ namespace SizedApparel
public static string BreastSeverityString(float BreastSeverity, int offset, bool findBigger, ref int outTargetIndex, ref float outTargetSeverity)
{
{
/* old method
if (offset == 0)
{
if (BreastSeverity <= 0.1f)
return micro; //micro, flat
if (BreastSeverity <= 0.05f)
return small; // small , tight
if (BreastSeverity <= 0.25f)
return average; // average
if (BreastSeverity <= 0.70f)
return large; // large , loose
if (BreastSeverity <= 0.90f)
return huge; // huge , gaping
if (BreastSeverity <= 1.01f)
return oversized; // oversized
return String.Empty; // none
}
if (offset == 1)
{
if (BreastSeverity <= 0.1f)
return micro; //micro, flat
if (BreastSeverity <= 0.05f)
return small; // small , tight
if (BreastSeverity <= 0.25f)
return average; // average
if (BreastSeverity <= 0.70f)
return large; // large , loose
if (BreastSeverity <= 0.90f)
return huge; // huge , gaping
if (BreastSeverity <= 1.01f)
return oversized; // oversized
return String.Empty; // none
}
if (offset == 2)
{
if (BreastSeverity <= 0.1f)
return micro; //micro, flat
if (BreastSeverity <= 0.05f)
return small; // small , tight
if (BreastSeverity <= 0.25f)
return average; // average
if (BreastSeverity <= 0.70f)
return large; // large , loose
if (BreastSeverity <= 0.90f)
return huge; // huge , gaping
if (BreastSeverity <= 1.01f)
return oversized; // oversized
return String.Empty; // none
}
if (offset == 3)
{
if (BreastSeverity <= 0.1f)
return micro; //micro, flat
if (BreastSeverity <= 0.05f)
return small; // small , tight
if (BreastSeverity <= 0.25f)
return average; // average
if (BreastSeverity <= 0.70f)
return large; // large , loose
if (BreastSeverity <= 0.90f)
return huge; // huge , gaping
if (BreastSeverity <= 1.01f)
return oversized; // oversized
return String.Empty; // none
}
if (offset == 4)
{
if (BreastSeverity <= 0.1f)
return micro; //micro, flat
if (BreastSeverity <= 0.05f)
return small; // small , tight
if (BreastSeverity <= 0.25f)
return average; // average
if (BreastSeverity <= 0.70f)
return large; // large , loose
if (BreastSeverity <= 0.90f)
return huge; // huge , gaping
if (BreastSeverity <= 1.01f)
return oversized; // oversized
return String.Empty; // none
}
if (offset == 5)
{
if (BreastSeverity <= 0.1f)
return micro; //micro, flat
if (BreastSeverity <= 0.05f)
return small; // small , tight
if (BreastSeverity <= 0.25f)
return average; // average
if (BreastSeverity <= 0.70f)
return large; // large , loose
if (BreastSeverity <= 0.90f)
return huge; // huge , gaping
if (BreastSeverity <= 1.01f)
return oversized; // oversized
return String.Empty; // none
}
return String.Empty; // none }
*/
}//Old Method
int targetIndex = -1;
float targetSeverity = 0;
int result = -1;
@ -1552,7 +1489,7 @@ namespace SizedApparel
{
/*
ApparelRecorderComp apparelRecorder = pawn.TryGetComp<ApparelRecorderComp>();
ApparelRecorderComp apparelRecorder = pawn.GetComp<ApparelRecorderComp>();
if(apparelRecorder == null)
{
Log.Message("No ApparelRecorder Found");
@ -1608,7 +1545,7 @@ namespace SizedApparel
if (breastHediff != null)
{
searchingPath = extraPath + BreastSeverityString(BreastSeverity, offset, findBigger,ref currentIndex,ref currentSeverity) + "_south";
if (SizedApparelSettings.Debug)
if (SizedApparelSettings.Debug && SizedApparelSettings.DetailLog)
Log.Message("[Sized Apparel] " + pawn.Name + ": ApparelSearching: " + searchingPath);
if (ContentFinder<Texture2D>.Get((searchingPath), false) != null) // checking special texture like udder
@ -1620,7 +1557,7 @@ namespace SizedApparel
//Log.Warning(extraPath + BreastSeverityString(BreastSeverity, offset, findBigger) + ":Extra Texture Not Found.");
}
searchingPath = path + BreastSeverityString(BreastSeverity, offset, findBigger, ref currentIndex,ref currentSeverity) + "_south";
if (SizedApparelSettings.Debug)
if (SizedApparelSettings.Debug && SizedApparelSettings.DetailLog)
Log.Message("[Sized Apparel] " + pawn.Name + ": ApparelSearching: " + searchingPath);
if ((ContentFinder<Texture2D>.Get((searchingPath), false) != null))
{
@ -1647,7 +1584,7 @@ namespace SizedApparel
if (breastHediff != null)
{
searchingPath = extraPath + BreastSeverityString(BreastSeverity, offset, !findBigger, ref currentIndex,ref currentSeverity) + "_south";
if (SizedApparelSettings.Debug)
if (SizedApparelSettings.Debug && SizedApparelSettings.DetailLog)
Log.Message("[Sized Apparel] " + pawn.Name + ": ApparelSearching: " + searchingPath);
if (ContentFinder<Texture2D>.Get((searchingPath), false) != null) // checking special texture like udder
{
@ -1658,7 +1595,7 @@ namespace SizedApparel
//Log.Warning(extraPath + BreastSeverityString(BreastSeverity, offset, !findBigger) + ":Extra Texture Not Found.");
}
searchingPath = path + BreastSeverityString(BreastSeverity, offset, !findBigger, ref currentIndex, ref currentSeverity) + "_south";
if (SizedApparelSettings.Debug)
if (SizedApparelSettings.Debug && SizedApparelSettings.DetailLog)
Log.Message("[Sized Apparel] " + pawn.Name + ": ApparelSearching: " + searchingPath);
if ((ContentFinder<Texture2D>.Get((searchingPath), false) != null))
{
@ -1698,7 +1635,7 @@ namespace SizedApparel
if (SizedApparelSettings.Debug)
Log.Message("[Sized Apparel] " + pawn.Name + ": hasUnSupportedApparel Testing...");
/*
ApparelRecorderComp apparelRecorder = pawn.TryGetComp<ApparelRecorderComp>();
ApparelRecorderComp apparelRecorder = pawn.GetComp<ApparelRecorderComp>();
if(apparelRecorder == null)
{
Log.Message("No ApparelRecorder Found");
@ -1712,9 +1649,15 @@ namespace SizedApparel
*/
//Log.Message("Check hasUnSupportedApparel");
bool hasUnsupportedApparel = false;
var comp = pawn.TryGetComp<ApparelRecorderComp>();
if (!pawn.RaceProps.Humanlike)
/*
if (!pawn.RaceProps.Humanlike) //Animals or Mechanoids would have apparels?
return true;
*/
var comp = pawn.GetComp<ApparelRecorderComp>();
if (comp == null)
return false;
List<Apparel> apparels = new List<Apparel>();
if (!fromGraphicRecord)
{
@ -1797,7 +1740,10 @@ namespace SizedApparel
extraPath = path;
string resultPath = null;
bool resultOut = false;
var result = SizedApparelsDatabase.GetSupportedApparelSizedPath(new SizedApparelsDatabase.SizedApparelDatabaseKey(path, pawn.def.defName, pawn.story?.bodyType?.defName, breastHediff?.def.defName, SizedApparelUtility.BreastSeverityInt(BreastSeverity)),out currentIndex, out currentSeverity).pathWithSizeIndex;
var key = new SizedApparelsDatabase.SizedApparelDatabaseKey(path, pawn.def.defName, pawn.story?.bodyType?.defName, pawn.gender, breastHediff?.def.defName, SizedApparelUtility.BreastSeverityInt(BreastSeverity));
if (SizedApparelSettings.useGenderSpecificTexture)
key.gender = Gender.None;
var result = SizedApparelsDatabase.GetSupportedApparelSizedPath(key,out currentIndex, out currentSeverity).pathWithSizeIndex;
if (comp != null)
{
if (cacheToComp)
@ -1959,9 +1905,10 @@ namespace SizedApparel
public static void UpdateAllApparel(Pawn pawn, bool onlyGraphicRecords = false)//need to be update before call it
{
if (pawn == null)
return;
var comp = pawn.TryGetComp<ApparelRecorderComp>();
var comp = pawn.GetComp<ApparelRecorderComp>();
if (comp == null)
return;
PawnGraphicSet pawnGraphicSet = pawn.Drawer?.renderer?.graphics;
@ -2009,7 +1956,7 @@ namespace SizedApparel
{
if (pawn == null)
return false;
var comp = pawn.TryGetComp<ApparelRecorderComp>();
var comp = pawn.GetComp<ApparelRecorderComp>();
if (comp == null)
return false;
if (!flags.FlagSet(PawnRenderFlags.Clothes))
@ -2023,7 +1970,7 @@ namespace SizedApparel
{
if (pawn == null)
return false;
var comp = pawn.TryGetComp<ApparelRecorderComp>();
var comp = pawn.GetComp<ApparelRecorderComp>();
if (comp == null)
return false;
if (!flags.FlagSet(PawnRenderFlags.Clothes))
@ -2078,7 +2025,7 @@ namespace SizedApparel
{
if (pawn == null)
return false;
var comp = pawn.TryGetComp<ApparelRecorderComp>();
var comp = pawn.GetComp<ApparelRecorderComp>();
if (comp == null)
return false;
@ -2091,7 +2038,7 @@ namespace SizedApparel
{
if (pawn == null)
return false;
var comp = pawn.TryGetComp<ApparelRecorderComp>();
var comp = pawn.GetComp<ApparelRecorderComp>();
if (comp == null)
return false;
if (!flags.FlagSet(PawnRenderFlags.Clothes))
@ -2113,7 +2060,7 @@ namespace SizedApparel
{
if (pawn == null)
return false;
var comp = pawn.TryGetComp<ApparelRecorderComp>();
var comp = pawn.GetComp<ApparelRecorderComp>();
if (comp == null)
return false;
@ -2159,6 +2106,48 @@ namespace SizedApparel
}
public static bool CanApplySizedApparel(Pawn pawn)
{
if (pawn == null)
return false;
//RaceProps Check
if (!pawn.RaceProps.Humanlike) //apply humanlikes always
{
if (pawn.RaceProps.Animal)
{
if (!SizedApparelSettings.ApplyAnimals)
return false;
}
else if (pawn.RaceProps.IsMechanoid)
{
if (!SizedApparelSettings.ApplyMechanoid)
return false;
}
}
else
{
if (!SizedApparelSettings.ApplyHumanlikes)
return false;
}
//Faction Check TODO
if (pawn.Faction != null && pawn.Faction != Faction.OfPlayer)
{
switch (pawn.Faction.PlayerRelationKind)
{
case FactionRelationKind.Neutral:
break;
case FactionRelationKind.Ally:
break;
case FactionRelationKind.Hostile:
break;
default:
break;
}
}
return true;
}
}