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

@ -26,6 +26,7 @@ namespace SizedApparel
public string pathWithoutSizeIndex; // Do Not Include Size Data to path! bodytype could be included
public string raceName;
public string bodyTypeName;
public Gender gender;
public string hediffName;
public int targetSize;
public bool isHorny;
@ -33,11 +34,12 @@ namespace SizedApparel
public string variation;
public SizedApparelDatabaseKey(string path, string race, string bodyType = null, string hediff = null, int size = -1, bool horny = false, string customPose = null, string variation = null)
public SizedApparelDatabaseKey(string path, string race, string bodyType = null, Gender genderInput = Gender.None , string hediff = null, int size = -1, bool horny = false, string customPose = null, string variation = null)
{
this.pathWithoutSizeIndex = path;
this.raceName = race;
this.bodyTypeName = bodyType;
this.gender = genderInput;
this.hediffName = hediff;
this.targetSize = size;
this.isHorny = horny;
@ -51,7 +53,7 @@ namespace SizedApparel
{
if (x.targetSize != y.targetSize)
return false;
return true && (x.pathWithoutSizeIndex == y.pathWithoutSizeIndex) && (x.bodyTypeName == y.bodyTypeName) && (x.raceName == y.raceName) && (x.hediffName == y.hediffName) && (x.isHorny == y.isHorny) && (x.customPose == y.customPose) && (x.variation == y.variation);
return true && (x.pathWithoutSizeIndex == y.pathWithoutSizeIndex) && (x.bodyTypeName == y.bodyTypeName) && (x.raceName == y.raceName)&& (x.gender == y.gender) && (x.hediffName == y.hediffName) && (x.isHorny == y.isHorny) && (x.customPose == y.customPose) && (x.variation == y.variation);
}
public int GetHashCode(SizedApparelDatabaseKey obj)
@ -65,17 +67,19 @@ namespace SizedApparel
public string bodyTypeName;
public string hediffName;
public string folderPath;
public Gender gender;
public int targetSize;
public bool isHorny;
public string customPose; // null custom pose as default pose
public string variation; // null variation as default graphic
public BodyPartDatabaseKey(string race, string bodyType = null, string hediff = null, string path = null, int size = -1, bool horny = false, string customPose = null, string variation = null)
public BodyPartDatabaseKey(string race, string bodyType = null, string hediff = null, string path = null, Gender pawnGender = Gender.None, int size = -1, bool horny = false, string customPose = null, string variation = null)
{
this.raceName = race;
this.bodyTypeName = bodyType;
this.hediffName = hediff;
this.folderPath = path;
this.gender = pawnGender;
this.targetSize = size;
this.isHorny = horny;
this.customPose = customPose;
@ -88,7 +92,7 @@ namespace SizedApparel
{
if (x.targetSize != y.targetSize)
return false;
return true && (x.raceName == y.raceName) && (x.bodyTypeName == y.bodyTypeName) && (x.hediffName == y.hediffName) && ( x.folderPath == y.folderPath) && (x.isHorny == y.isHorny) && (x.customPose == y.customPose) && (x.variation == y.variation);
return true && (x.raceName == y.raceName) && (x.bodyTypeName == y.bodyTypeName) && (x.hediffName == y.hediffName) && ( x.folderPath == y.folderPath)&& (x.gender == y.gender) && (x.isHorny == y.isHorny) && (x.customPose == y.customPose) && (x.variation == y.variation);
}
public int GetHashCode(BodyPartDatabaseKey obj)
@ -115,6 +119,7 @@ namespace SizedApparel
this.points = pointsInput;
}
}
private static Dictionary<Pawn, ApparelRecorderComp> ApparelRecordersCache = new Dictionary<Pawn, ApparelRecorderComp>();
private static Dictionary<BodyGraphicKey, Graphic> SizedApparelBodyGraphic = new Dictionary<BodyGraphicKey, Graphic>(); // TODO
private static Dictionary<SizedApparelDatabaseKey, PathAndSize> SupportedApparelResultPath = new Dictionary<SizedApparelDatabaseKey, PathAndSize>(new SizedApparelDatabaseKeyComparer());
@ -124,6 +129,14 @@ namespace SizedApparel
//AlienRace AllowHumanlike. Need to Restart or Clear cache to change options
public static ApparelRecorderComp GetApparelCompFast(Pawn pawn)
{
if (ApparelRecordersCache.ContainsKey(pawn))
return ApparelRecordersCache[pawn];
ApparelRecorderComp comp = pawn.GetComp<ApparelRecorderComp>(); // comp can be null
ApparelRecordersCache.Add(pawn, comp);
return comp;
}
public static Dictionary<string, bool> AlienRaceUseHumanlike = new Dictionary<string, bool>();
private static void ResetAlienRaceUseHumanlike()
@ -205,6 +218,8 @@ namespace SizedApparel
Log.Message("[Sized Apparel] SizedApparelDataBase::Result Path: " + value.pathWithSizeIndex);
return value;
}
if (SizedApparelSettings.Debug)
Log.Message(" [Sized Apparel] SizedApparelDataBase::Key Not Found: " + key.pathWithoutSizeIndex);
@ -228,11 +243,22 @@ namespace SizedApparel
targetRaceName = key.raceName;*/
targetRaceName = key.raceName;
Graphic graphic = null;
graphic = SizedApparelUtility.GetSizedApparelGraphic(sourceGraphic, SizedApparelUtility.BreastSizeIndexToSeverity(key.targetSize), out indexOut, out currentSeverityOut, out flag, out hediffResult, targetRaceName, key.hediffName, key.customPose);//key.customPose
graphic = SizedApparelUtility.GetSizedApparelGraphic(sourceGraphic, SizedApparelUtility.BreastSizeIndexToSeverity(key.targetSize), out indexOut, out currentSeverityOut, out flag, out hediffResult, targetRaceName, key.hediffName, key.customPose, key.gender);//key.customPose
if(graphic == null && key.gender != Gender.None)
{
//try Genderless
graphic = SizedApparelUtility.GetSizedApparelGraphic(sourceGraphic, SizedApparelUtility.BreastSizeIndexToSeverity(key.targetSize), out indexOut, out currentSeverityOut, out flag, out hediffResult, targetRaceName, key.hediffName, key.customPose, Gender.None);//key.customPose
}
if (key.customPose != null && graphic == null)
{
customPose = false;
graphic = SizedApparelUtility.GetSizedApparelGraphic(sourceGraphic, SizedApparelUtility.BreastSizeIndexToSeverity(key.targetSize), out indexOut, out currentSeverityOut, out flag, out hediffResult , targetRaceName);
graphic = SizedApparelUtility.GetSizedApparelGraphic(sourceGraphic, SizedApparelUtility.BreastSizeIndexToSeverity(key.targetSize), out indexOut, out currentSeverityOut, out flag, out hediffResult , targetRaceName, key.hediffName , null ,key.gender);
if (graphic == null && key.gender != Gender.None)
{
//try Genderless
graphic = SizedApparelUtility.GetSizedApparelGraphic(sourceGraphic, SizedApparelUtility.BreastSizeIndexToSeverity(key.targetSize), out indexOut, out currentSeverityOut, out flag, out hediffResult, targetRaceName, key.hediffName, null, Gender.None);//key.customPose
}
}
//Try Find Different Target Size
@ -251,7 +277,7 @@ namespace SizedApparel
return result;
}
public static PathAndSize GetSupportedBodyPartPath(BodyPartDatabaseKey key, bool isBreast, string folderName, string defaultHediffName, string customRaceDefName = null)
public static PathAndSize GetSupportedBodyPartPath(BodyPartDatabaseKey key, bool isBreast, string folderName, string defaultHediffName)
{
PathAndSize result;
if (SupportedBodyPartResultPath.ContainsKey(key))
@ -261,7 +287,7 @@ namespace SizedApparel
Graphic graphic = null;
if (key.customPose != null)
{
graphic = SizedApparelUtility.GetBodyPartGraphic(key.raceName, key.bodyTypeName, key.hediffName, isBreast, key.targetSize, folderName+"/CustomPose/"+key.customPose, defaultHediffName, out currentSize, out hediffResult, key.isHorny, customRaceDefName, key.variation);
graphic = SizedApparelUtility.GetBodyPartGraphic(key.raceName, key.bodyTypeName, key.hediffName, isBreast, key.targetSize, folderName+"/CustomPose/"+key.customPose, defaultHediffName, out currentSize, out hediffResult, key.isHorny, null, key.variation, key.gender);
if (graphic != null)
{
result = new PathAndSize(graphic.path, currentSize, false, true, hediffResult);
@ -269,7 +295,7 @@ namespace SizedApparel
return result;
}
if (key.bodyTypeName != null)
graphic = SizedApparelUtility.GetBodyPartGraphic(key.raceName, null, key.hediffName, isBreast, key.targetSize, folderName + "/CustomPose/" + key.customPose, defaultHediffName, out currentSize, out hediffResult, key.isHorny, customRaceDefName, key.variation);
graphic = SizedApparelUtility.GetBodyPartGraphic(key.raceName, null, key.hediffName, isBreast, key.targetSize, folderName + "/CustomPose/" + key.customPose, defaultHediffName, out currentSize, out hediffResult, key.isHorny, null, key.variation, key.gender);
if (graphic != null)
{
result = new PathAndSize(graphic.path, currentSize, false, true, hediffResult);
@ -278,7 +304,7 @@ namespace SizedApparel
}
}
graphic = SizedApparelUtility.GetBodyPartGraphic(key.raceName, key.bodyTypeName, key.hediffName, isBreast, key.targetSize, folderName, defaultHediffName, out currentSize, out hediffResult, key.isHorny, customRaceDefName, key.variation);
graphic = SizedApparelUtility.GetBodyPartGraphic(key.raceName, key.bodyTypeName, key.hediffName, isBreast, key.targetSize, folderName, defaultHediffName, out currentSize, out hediffResult, key.isHorny, null, key.variation, key.gender);
if (graphic != null)
{
result = new PathAndSize(graphic.path, currentSize, false, key.customPose == null ? true : false, hediffResult);
@ -287,7 +313,7 @@ namespace SizedApparel
}
if (key.bodyTypeName != null)
graphic = SizedApparelUtility.GetBodyPartGraphic(key.raceName, null, key.hediffName, isBreast, key.targetSize, folderName, defaultHediffName, out currentSize, out hediffResult, key.isHorny, customRaceDefName, key.variation);
graphic = SizedApparelUtility.GetBodyPartGraphic(key.raceName, null, key.hediffName, isBreast, key.targetSize, folderName, defaultHediffName, out currentSize, out hediffResult, key.isHorny, null, key.variation, key.gender);
if (graphic != null)
{
result = new PathAndSize(graphic.path, currentSize, false, key.customPose == null ? true : false, hediffResult);
@ -309,7 +335,7 @@ namespace SizedApparel
if (key.customPose != null)
{
graphic = SizedApparelUtility.GetBodyPartGraphic(key.raceName, key.bodyTypeName, key.hediffName, isBreast, key.targetSize, folderName + "/CustomPose/" + key.customPose, defaultHediffName, out currentSize, out hediffResult, key.isHorny, "Humanlike", key.variation);
graphic = SizedApparelUtility.GetBodyPartGraphic(key.raceName, key.bodyTypeName, key.hediffName, isBreast, key.targetSize, folderName + "/CustomPose/" + key.customPose, defaultHediffName, out currentSize, out hediffResult, key.isHorny, "Humanlike", key.variation, key.gender);
if (graphic != null)
{
result = new PathAndSize(graphic.path, currentSize, true, true, hediffResult);
@ -317,7 +343,7 @@ namespace SizedApparel
return result;
}
if (key.bodyTypeName != null)
graphic = SizedApparelUtility.GetBodyPartGraphic(key.raceName, null, key.hediffName, isBreast, key.targetSize, folderName + "/CustomPose/" + key.customPose, defaultHediffName, out currentSize, out hediffResult, key.isHorny, "Humanlike", key.variation);
graphic = SizedApparelUtility.GetBodyPartGraphic(key.raceName, null, key.hediffName, isBreast, key.targetSize, folderName + "/CustomPose/" + key.customPose, defaultHediffName, out currentSize, out hediffResult, key.isHorny, "Humanlike", key.variation, key.gender);
if (graphic != null)
{
result = new PathAndSize(graphic.path, currentSize, true, true, hediffResult);
@ -326,7 +352,7 @@ namespace SizedApparel
}
}
graphic = SizedApparelUtility.GetBodyPartGraphic(key.raceName, key.bodyTypeName, key.hediffName, isBreast, key.targetSize, folderName, defaultHediffName, out currentSize, out hediffResult, key.isHorny, "Humanlike", key.variation);
graphic = SizedApparelUtility.GetBodyPartGraphic(key.raceName, key.bodyTypeName, key.hediffName, isBreast, key.targetSize, folderName, defaultHediffName, out currentSize, out hediffResult, key.isHorny, "Humanlike", key.variation, key.gender);
if (graphic != null)
{
result = new PathAndSize(graphic.path, currentSize, true, key.customPose == null ? true : false, hediffResult);
@ -335,7 +361,7 @@ namespace SizedApparel
}
if (key.bodyTypeName != null)
graphic = SizedApparelUtility.GetBodyPartGraphic(key.raceName, null, key.hediffName, isBreast, key.targetSize, folderName, defaultHediffName, out currentSize, out hediffResult, key.isHorny, "Humanlike", key.variation);
graphic = SizedApparelUtility.GetBodyPartGraphic(key.raceName, null, key.hediffName, isBreast, key.targetSize, folderName, defaultHediffName, out currentSize, out hediffResult, key.isHorny, "Humanlike", key.variation, key.gender);
if (graphic != null)
{
result = new PathAndSize(graphic.path, currentSize, true, key.customPose == null ? true : false, hediffResult);
@ -351,5 +377,95 @@ namespace SizedApparel
return result;
}
public static void RandomPreCacheForBodyParts()
{
//variationDef = DefDatabase<SizedApparelBodyPartVariationDef>.AllDefsListForReading;
BodyPartDatabaseKey key;
for (int i = 0; i<11; i++)
{
key = new BodyPartDatabaseKey("Human", "Female", "Breasts", "Breasts", Gender.Female, i);
GetSupportedBodyPartPath(key, true, "Breasts", "Breasts");
key = new BodyPartDatabaseKey("Human", "Thin", "Breasts", "Breasts", Gender.Female, i);
GetSupportedBodyPartPath(key, true, "Breasts", "Breasts");
}
for (int i = 0; i < 6; i++)
{
key = new BodyPartDatabaseKey("Human", "Female", "Vagina", "Vagina", Gender.Female, i);
GetSupportedBodyPartPath(key, false, "Vagina", "Vagina");
key = new BodyPartDatabaseKey("Human", "Thin", "Vagina", "Vagina", Gender.Female, i);
GetSupportedBodyPartPath(key, false, "Vagina", "Vagina");
}
for (int i = 0; i < 6; i++)
{
key = new BodyPartDatabaseKey("Human", "Female", "Anus", "Anus", Gender.Female, i);
GetSupportedBodyPartPath(key, false, "Anus", "Anus");
key = new BodyPartDatabaseKey("Human", "Thin", "Anus", "Anus", Gender.Female, i);
GetSupportedBodyPartPath(key, false, "Anus", "Anus");
key = new BodyPartDatabaseKey("Human", "Male", "Anus", "Anus", Gender.Male, i);
GetSupportedBodyPartPath(key, false, "Anus", "Anus");
key = new BodyPartDatabaseKey("Human", "Thin", "Anus", "Anus", Gender.Male, i);
GetSupportedBodyPartPath(key, false, "Anus", "Anus");
}
for (int i = 0; i < 6; i++)
{
key = new BodyPartDatabaseKey("Human", "Male", "Penis", "Penis", Gender.Male, i);
GetSupportedBodyPartPath(key, false, "Penis", "Penis");
key = new BodyPartDatabaseKey("Human", "Male", "Penis", "Penis/Balls", Gender.Male, i);
GetSupportedBodyPartPath(key, false, "Penis", "Penis");
key = new BodyPartDatabaseKey("Human", "Thin", "Penis", "Penis", Gender.Male, i);
GetSupportedBodyPartPath(key, false, "Penis", "Penis");
key = new BodyPartDatabaseKey("Human", "Thin", "Penis", "Penis/Balls", Gender.Male, i);
GetSupportedBodyPartPath(key, false, "Penis", "Penis");
key = new BodyPartDatabaseKey("Human", "Fat", "Penis", "Penis", Gender.Male, i);
GetSupportedBodyPartPath(key, false, "Penis", "Penis");
key = new BodyPartDatabaseKey("Human", "Fat", "Penis", "Penis/Balls", Gender.Male, i);
GetSupportedBodyPartPath(key, false, "Penis", "Penis");
key = new BodyPartDatabaseKey("Human", "Hulk", "Penis", "Penis", Gender.Male, i);
GetSupportedBodyPartPath(key, false, "Penis", "Penis");
key = new BodyPartDatabaseKey("Human", "Hulk", "Penis", "Penis/Balls", Gender.Male, i);
GetSupportedBodyPartPath(key, false, "Penis", "Penis");
}
}
public static void RandomPreCacheForApparels()
{
//random precache should be useful. so it target female and thin body only.
//don't target male because the male doesn't need breasts textures usually.
List<string> bodyTypes = new List<string>();
bodyTypes.Add("Female");
bodyTypes.Add("Thin");
// DefDatabase<BodyTypeDef>.AllDefsListForReading
foreach (ThingDef thingDef in DefDatabase<ThingDef>.AllDefsListForReading)
{
if (thingDef.IsApparel && !thingDef.apparel.wornGraphicPath.NullOrEmpty())
{
for(int i = 0; i<11; i++)
{
var key = new SizedApparelDatabaseKey(thingDef.apparel.wornGraphicPath, "Human", "Female", Gender.Female, "Breasts", i);
GetSupportedApparelSizedPath(key);
key = new SizedApparelDatabaseKey(thingDef.apparel.wornGraphicPath, "Human", "Thin", Gender.Female, "Breasts", i);
GetSupportedApparelSizedPath(key);
//need Humanlike Cache?
}
}
}
}
}
}