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

@ -8,6 +8,7 @@ using HarmonyLib;
//using AlienRace;
using UnityEngine;
using rjw;
using Rimworld_Animations;
using RevealingApparel;
using System.Reflection;
@ -24,6 +25,7 @@ namespace SizedApparel
public static bool rimNudeWorldActive = false;
public static bool OTYNudeActive = false;
public static bool LicentiaActive = false;
public static bool RimworldAnimationActive = false; //rjw animation
static SizedApparelPatch()
{
@ -86,6 +88,12 @@ namespace SizedApparel
LicentiaActive = true;
}
//check rjw animation
if (LoadedModManager.RunningModsListForReading.Any(x => x.PackageId.ToLower() == "c0ffee.rimworld.animations".ToLower()))
{
RimworldAnimationActive = true;
}
Log.Message("[SizedApparel] start");
var harmony = new Harmony("SizedApparelforRJW");
@ -137,7 +145,7 @@ namespace SizedApparel
}
else
{
Log.Message("[SizedApparel] RimJobWorld Paatch canceled");
Log.Message("[SizedApparel] RimJobWorld Patch canceled");
}
}))();
}
@ -170,6 +178,31 @@ namespace SizedApparel
catch (TypeLoadException ex) { }
*/
try
{
((Action)(() =>
{
if (RimworldAnimationActive)
{
Log.Message("[SizedApparel] RimworldAnimaion(rjw animation) Found");
harmony.Patch(AccessTools.Method(typeof(CompBodyAnimator), "tickClip"),
postfix: new HarmonyMethod(typeof(RimworldAnimationPatch), "TickClipPostfix"));
harmony.Patch(AccessTools.Method(typeof(JobDriver_SexBaseInitiator), "End"),
postfix: new HarmonyMethod(typeof(RimworldAnimationPatch), "EndClipPostfix"));
Log.Message("[SizedApparel] RimworldAnimaion(rjw animation) Patched");
}
else
{
Log.Message("[SizedApparel] RimworldAnimaion(rjw animation) Patch canceled");
}
}))();
}
catch (TypeLoadException ex) { }
//Rim Nude World Patch
try
{

View file

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 어셈블리에 대한 일반 정보는 다음 특성 집합을 통해
// 제어됩니다. 어셈블리와 관련된 정보를 수정하려면
// 이러한 특성 값을 변경하세요.
[assembly: AssemblyTitle("SizedApparelforRJW")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SizedApparelforRJW")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// ComVisible을 false로 설정하면 이 어셈블리의 형식이 COM 구성 요소에
// 표시되지 않습니다. COM에서 이 어셈블리의 형식에 액세스하려면
// 해당 형식에 대해 ComVisible 특성을 true로 설정하세요.
[assembly: ComVisible(false)]
// 이 프로젝트가 COM에 노출되는 경우 다음 GUID는 typelib의 ID를 나타냅니다.
[assembly: Guid("b06471b4-4c6c-478b-b94d-71cc53abd24d")]
// 어셈블리의 버전 정보는 다음 네 가지 값으로 구성됩니다.
//
// 주 버전
// 부 버전
// 빌드 번호
// 수정 버전
//
// 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 번호를
// 기본값으로 할 수 있습니다.
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View file

@ -1,14 +1,12 @@
using System;
using HarmonyLib;
using RimWorld;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RimWorld;
using Verse;
using HarmonyLib;
using System.Reflection;
//using AlienRace;
using UnityEngine;
using rjw;
using System.Reflection;
using Verse;
namespace SizedApparel
{
@ -214,6 +212,19 @@ namespace SizedApparel
}
public enum ColorMode
{
Skin, Hair
}
//Def for Hediff Graphic color options or else.
public class SizedApparelHeddifDef : Def
{
public HediffDef hediffDef;
//public string hediffDefName;
}
//Def per graphic(texture)
public class SizedApparelBodyPartGraphicDef : Def
{
@ -222,7 +233,6 @@ namespace SizedApparel
public Vector2 pivot = new Vector2(0.5f, 0.5f); // custom pivot of texture. UV. not pixel
//public Dictionary<string, BodyPartPoint> points = new Dictionary<string, BodyPartPoint>();
//public Dictionary<string, BodyPartSpline> splines = new Dictionary<string, BodyPartSpline>();
}
//Def per BodyParts
@ -237,9 +247,14 @@ namespace SizedApparel
{
static MethodInfo overrideMatMethod = AccessTools.Method(typeof(PawnRenderer), "OverrideMaterialIfNeeded");
public SizedApparelBodyPart(Pawn pawn, string bodyPartName, SizedApparelBodyPartOf bodyPartOf, string defaultHediffName, bool isBreast, bool isOverlay , string customPathName = null, SizedApparelBodyPartColorOf colorOf = SizedApparelBodyPartColorOf.Skin)
public bool AutoOffsetForFurCoveredBody = true;
public SizedApparelBodyPart(Pawn pawn, ApparelRecorderComp apparelRecorderComp, string bodyPartName, SizedApparelBodyPartOf bodyPartOf, string defaultHediffName, bool isBreast, bool isOverlay , string customPathName = null, SizedApparelBodyPartColorOf colorOf = SizedApparelBodyPartColorOf.Skin)
{
this.pawn = pawn; //owner
this.apparelRecorderCompCache = apparelRecorderComp; //for reduce GetComp Call; if it is null, it will try to get pawn's comp.
this.bodyPartName = bodyPartName;
this.def = DefDatabase<SizedApparelBodyPartDef>.AllDefs.FirstOrDefault(b => b.defName == bodyPartName);
@ -268,6 +283,8 @@ namespace SizedApparel
public SizedApparelBodyPartDef def;
public Pawn pawn;
public ApparelRecorderComp apparelRecorderCompCache; // for reduce getComp call;
public string bodyPartName; //breast, penis, belly, pubichair... etc. just name. not like architech something
public string customPath = null;
public SizedApparelBodyPartOf bodyPartOf = SizedApparelBodyPartOf.None;
@ -280,6 +297,8 @@ namespace SizedApparel
public bool isVisible = true;
public int lastPoseTick = -1;
public SizedApparelBodyPartColorOf colorType = SizedApparelBodyPartColorOf.Skin;
public Color? customColorOne;
public Color? customColorTwo;
@ -306,9 +325,15 @@ namespace SizedApparel
{
if (customPose == newPose)
return;
if(SizedApparelSettings.Debug)
Log.Message("[SizedApparel] Setting Custom Pose : " + newPose);
customPose = newPose;
if (autoUpdate)
{
this.UpdateGraphic();
this.lastPoseTick = Find.TickManager.TicksGame;
}
if(autoSetPawnGraphicDirty)
{
if (pawn == null)
@ -318,7 +343,7 @@ namespace SizedApparel
}
}
public bool CheckCanPose(string targetPose, bool checkApparels, bool mustMatchSize)
public bool CheckCanPose(string targetPose, bool checkApparels, bool checkBodyParts, bool mustMatchSize)
{
if (checkApparels)
{
@ -331,6 +356,9 @@ namespace SizedApparel
if (agr.sourceApparel.def.apparel.tags.Any(s => s.ToLower() == "SizedApparel_IgnorePose".ToLower()))
continue;
*/
//Only Check Torso Apparel Only
if (!agr.sourceApparel.def.apparel.bodyPartGroups.Contains(BodyPartGroupDefOf.Torso))
continue;
string originalPath = SizedApparelsDatabase.GetSupportedApparelOriginalPath(agr.graphic.path);
if (originalPath == null)
@ -338,17 +366,23 @@ namespace SizedApparel
int outInt = -1;
float outFloat = -1;
SizedApparelsDatabase.SizedApparelDatabaseKey key = new SizedApparelsDatabase.SizedApparelDatabaseKey(originalPath,pawn.def.defName,pawn.story?.bodyType?.defName, currentHediffName, Math.Min(currentSeverityInt, cappedSeverityInt), false, targetPose);
SizedApparelsDatabase.SizedApparelDatabaseKey key = new SizedApparelsDatabase.SizedApparelDatabaseKey(originalPath,pawn.def.defName,pawn.story?.bodyType?.defName, pawn.gender, currentHediffName, Math.Min(currentSeverityInt, cappedSeverityInt), false, targetPose);
if (SizedApparelSettings.useGenderSpecificTexture)
key.gender = Gender.None;
var result = SizedApparelsDatabase.GetSupportedApparelSizedPath(key, out outInt, out outFloat);
if (!result.isCustomPose)
return false;
}
}
Graphic graphic = GetBodyPartGraphics(false, mustMatchSize, targetPose);
Graphic graphicH = GetBodyPartGraphics(true, mustMatchSize, targetPose);
if (graphic != null || graphicH != null)
return true;
return false;
if (checkBodyParts)
{
Graphic graphic = GetBodyPartGraphics(false, mustMatchSize, targetPose);
Graphic graphicH = GetBodyPartGraphics(true, mustMatchSize, targetPose);
if (graphic != null || graphicH != null)
return true;
return false;
}
return true;
}
@ -378,6 +412,7 @@ namespace SizedApparel
public float depthOffset = 0f;
//0.008f
public float depthOffsetEast = 0.008f;
public float depthOffsetWest = 0.008f;
public float depthOffsetSouth = 0.008f;
@ -411,9 +446,9 @@ namespace SizedApparel
outPoints = null;
return null;
}
var comp = pawn.TryGetComp<ApparelRecorderComp>();
var comp = apparelRecorderCompCache;
if (comp == null)
comp = pawn.GetComp<ApparelRecorderComp>();
if (comp == null)
{
outPoints = null;
@ -421,7 +456,7 @@ namespace SizedApparel
}
var key = new SizedApparelsDatabase.BodyPartDatabaseKey(pawn.def.defName, pawn.story?.bodyType?.defName, currentHediffName, customPath==null?bodyPartName: customPath, Math.Min(currentSeverityInt, cappedSeverityInt), isHorny, poseOverride==null?customPose:poseOverride, variationOverride==null?variation: variationOverride);
var key = new SizedApparelsDatabase.BodyPartDatabaseKey(pawn.def.defName, pawn.story?.bodyType?.defName, currentHediffName, customPath==null?bodyPartName: customPath, pawn.gender, Math.Min(currentSeverityInt, cappedSeverityInt), isHorny, poseOverride==null?customPose:poseOverride, variationOverride==null?variation: variationOverride);
var result = SizedApparelsDatabase.GetSupportedBodyPartPath(key, isBreast, customPath == null ? bodyPartName : customPath, defaultHediffName);
if (mustMatchSize)
@ -503,24 +538,52 @@ namespace SizedApparel
if (pawn == null)
return;
if (bodyMesh == null)
{
if (SizedApparelSettings.Debug)
Log.Warning("[SizedApparel] DrawBodyParts But Null Body Mesh! : " + pawn.Name);
return;
}
PawnRenderer pawnRenderer = pawn.Drawer.renderer;
Shader shader = ShaderDatabase.CutoutComplex;
Color drawColor1 = Color.white;
Color drawColor2 = Color.white;
bool forceWriteZ = true;
if(colorType == SizedApparelBodyPartColorOf.Skin)
bool HasFurSkin = false;
//Furskin Check
if (pawn.Drawer.renderer.graphics.furCoveredGraphic != null)
{
HasFurSkin = true;
}
if (colorType == SizedApparelBodyPartColorOf.Skin)
{
forceWriteZ = true;
if (bodyDrawType == RotDrawMode.Fresh)
{
if (HasFurSkin)
{
shader = pawn.Drawer.renderer.graphics.furCoveredGraphic.Shader;
if (!ShaderUtility.SupportsMaskTex(shader))
shader = ShaderDatabase.CutoutSkinOverlay;
shader = pawnRenderer.graphics.furCoveredGraphic.Shader;
drawColor1 = pawnRenderer.graphics.furCoveredGraphic.Color;
drawColor2 = pawnRenderer.graphics.furCoveredGraphic.ColorTwo;
}
else
{
shader = pawn.Drawer.renderer.graphics.nakedGraphic.Shader;
if (!ShaderUtility.SupportsMaskTex(shader))
shader = ShaderDatabase.CutoutSkinOverlay;
drawColor1 = pawnRenderer.graphics.nakedGraphic.Color;
drawColor2 = pawnRenderer.graphics.nakedGraphic.ColorTwo;
}
shader = pawn.Drawer.renderer.graphics.nakedGraphic.Shader;
if (!ShaderUtility.SupportsMaskTex(shader))
shader = ShaderDatabase.CutoutSkinOverlay;
drawColor1 = pawn.Drawer.renderer.graphics.nakedGraphic.Color;
drawColor2 = pawn.Drawer.renderer.graphics.nakedGraphic.ColorTwo;
}
else if (bodyDrawType == RotDrawMode.Rotting)
{
@ -528,16 +591,18 @@ namespace SizedApparel
shader = pawn.Drawer.renderer.graphics.rottingGraphic.Shader;
if (!ShaderUtility.SupportsMaskTex(shader))
shader = ShaderDatabase.CutoutSkinOverlay;
drawColor1 = pawn.Drawer.renderer.graphics.rottingGraphic.Color;
drawColor2 = pawn.Drawer.renderer.graphics.nakedGraphic.ColorTwo;
drawColor1 = pawnRenderer.graphics.rottingGraphic.Color;
drawColor2 = pawnRenderer.graphics.nakedGraphic.ColorTwo;
}
}
else if (colorType == SizedApparelBodyPartColorOf.Hair)
{
forceWriteZ = false;
shader = ShaderDatabase.Transparent;
if(pawn.story != null)
drawColor1 = pawn.story.hairColor;
drawColor1 = pawn.story.HairColor;
}
else if (colorType == SizedApparelBodyPartColorOf.Custom)
{
@ -560,6 +625,11 @@ namespace SizedApparel
Quaternion quaternion = Quaternion.AngleAxis(angle + rotation, Vector3.up);
Vector3 vector = rootLoc;
if (this.pawn.ageTracker.CurLifeStage.bodyDrawOffset != null)
{
vector += this.pawn.ageTracker.CurLifeStage.bodyDrawOffset.Value;
}
Rot4 targetRot = facing;
if (rotOverride != null)
targetRot = rotOverride.Value;
@ -594,6 +664,8 @@ namespace SizedApparel
}
Graphic graphic = null;
if (SizedApparelUtility.IsHorny(pawn))
graphic = bodyPartGraphicHorny;
@ -603,13 +675,28 @@ namespace SizedApparel
if (graphic == null)
return;
//ForFurskinOffset
if(bodyDrawType == RotDrawMode.Fresh && HasFurSkin && AutoOffsetForFurCoveredBody)
{
//vector.y += 0.009187258f; //in PawnRenderer, it adds 0.009187258f.
//graphic.maskPath does error? need to check
// worn fur body and naked fur body has different offsets... wtf
//TODO Need to Fix
}
Material mat;
if (!flags.FlagSet(PawnRenderFlags.Cache)&&!isOverlay&& forceWriteZ)
{
graphic = graphic.GetColoredVersion(ShaderDatabase.Cutout, drawColor1, drawColor2);
graphic = graphic.GetColoredVersion(ShaderDatabase.Cutout, drawColor1, drawColor2); // ShaderDatabase.Cutout
mat = flags.FlagSet(PawnRenderFlags.Cache) ? graphic.MatAt(targetRot) : (Material)overrideMatMethod.Invoke(pawnRenderer, new object[] { graphic.MatAt(facing), pawn, flags.FlagSet(PawnRenderFlags.Portrait) });
GenDraw.DrawMeshNowOrLater(bodyMesh, vector, quaternion, mat, flags.FlagSet(PawnRenderFlags.DrawNow)); // draw for writeZ data to solve shadow issue
}
graphic = graphic.GetColoredVersion(shader, drawColor1, drawColor2);
vector.y += 0.00001f;
mat = flags.FlagSet(PawnRenderFlags.Cache) ? graphic.MatAt(targetRot) : (Material)overrideMatMethod.Invoke(pawnRenderer, new object[] { graphic.MatAt(facing), pawn, flags.FlagSet(PawnRenderFlags.Portrait) });

View file

@ -52,13 +52,13 @@ namespace SizedApparel
if (SizedApparelUtility.isBreast(parent.def.defName))
bodyPartName = "Breasts";
else if (SizedApparelUtility.isVagina(parent.def.defName))
else if (Genital_Helper.is_vagina(parent)) // SizedApparelUtility.isVagina(parent.def.defName)
bodyPartName = "Vagina";
else if (SizedApparelUtility.isAnus(parent.def.defName))
bodyPartName = "Anus";
else if (SizedApparelUtility.isUdder(parent.def.defName))
bodyPartName = "Udder";
else if (SizedApparelUtility.isPenis(parent.def.defName))
else if (Genital_Helper.is_penis(parent)) //SizedApparelUtility.isPenis(parent.def.defName)
bodyPartName = "Penis";
else

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,58 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using RimWorld;
using Verse;
using HarmonyLib;
//using AlienRace;
using UnityEngine;
using rjw;
namespace SizedApparel
{
//for avoid first hitch. some day it might need make pre def for fast cache...
public class ApparelTexture
{
public BodyTypeDef bodytype;
public List<string> textures;
public string GetTexturePath(int level, out int result)
{
result = -1;
if (level < 0)
return null;
if (textures.Count > level)
{
result = level;
return textures[level];
}
if (!textures.NullOrEmpty())
{
result = textures.Count - 1;
return textures[result]; //return biggest as supported
}
return null;
}
}
public class SizedApparelDef : Def
{
//def name must be match with apparels DefName
public bool hidingGenitals = false; // pants must be true
public List<ApparelTexture> SizedTextures;
public ApparelTexture GetApparelTexture(BodyTypeDef bodytype)
{
if(SizedTextures != null)
{
return SizedTextures.FirstOrDefault(a => a.bodytype == bodytype);
}
return null;
}
}
}

View file

@ -17,7 +17,7 @@ namespace SizedApparel
if (graphicSet == null)
return;
var comp = pawn.TryGetComp<ApparelRecorderComp>();
var comp = pawn.GetComp<ApparelRecorderComp>();
if (comp == null)
return;
comp.needToCheckApparelGraphicRecords = true;

File diff suppressed because it is too large Load diff

View file

@ -26,7 +26,7 @@ namespace SizedApparel
return;
/*
var comp = ___pawn.TryGetComp<ApparelRecorderComp>();
var comp = ___pawn.GetComp<ApparelRecorderComp>();
if (comp == null)
return;

View file

@ -18,7 +18,7 @@ namespace SizedApparel
{
if (!UnityData.IsInMainThread)
return;
ApparelRecorderComp comp = pawn?.TryGetComp<ApparelRecorderComp>();
ApparelRecorderComp comp = pawn?.GetComp<ApparelRecorderComp>();
if (comp == null)
return;
comp.SetDirty();
@ -69,7 +69,7 @@ namespace SizedApparel
return;
//GetBreastSeverity(__instance.pawn, out breastSeverity, out breastHediff);
//bool flag = hasUnSupportedApparel(__instance.pawn, breastSeverity, breastHediff);
ApparelRecorderComp comp = pawn.TryGetComp<ApparelRecorderComp>();
ApparelRecorderComp comp = pawn.GetComp<ApparelRecorderComp>();
if (comp != null)
{
/*
@ -128,7 +128,7 @@ namespace SizedApparel
{
if (pawn == null)
return;
ApparelRecorderComp comp = pawn.TryGetComp<ApparelRecorderComp>();
ApparelRecorderComp comp = pawn.GetComp<ApparelRecorderComp>();
if (comp == null)
return;
comp.SetDirty();
@ -146,7 +146,7 @@ namespace SizedApparel
ApparelRecorderComp pawnARC = __instance.pawn.TryGetComp<ApparelRecorderComp>();
ApparelRecorderComp pawnARC = __instance.pawn.GetComp<ApparelRecorderComp>();
if (pawnARC != null)
{
if (__instance.pawn.RaceProps.Humanlike)
@ -161,7 +161,7 @@ namespace SizedApparel
var partner = __instance.Partner as Pawn;
if (partner == null)
return;
ApparelRecorderComp partnerARC = partner.TryGetComp<ApparelRecorderComp>();
ApparelRecorderComp partnerARC = partner.GetComp<ApparelRecorderComp>();
if (partnerARC != null)
{
if (partner.RaceProps.Humanlike)
@ -182,7 +182,7 @@ namespace SizedApparel
{
ApparelRecorderComp pawnARC = __instance.pawn.TryGetComp<ApparelRecorderComp>();
ApparelRecorderComp pawnARC = __instance.pawn.GetComp<ApparelRecorderComp>();
if (pawnARC != null)
{
@ -209,7 +209,7 @@ namespace SizedApparel
var partner = __instance.Partner as Pawn;
if (partner == null)
return;
ApparelRecorderComp partnerARC = partner.TryGetComp<ApparelRecorderComp>();
ApparelRecorderComp partnerARC = partner.GetComp<ApparelRecorderComp>();
if (partnerARC != null)
{
partnerARC.havingSex = false;

View file

@ -36,7 +36,7 @@ namespace SizedApparel
{
if (__result == false)
return;
var comp = pawn.TryGetComp<ApparelRecorderComp>();
var comp = pawn.GetComp<ApparelRecorderComp>();
if (comp == null)
return;
if (comp.hasUnsupportedApparel)

View file

@ -16,7 +16,7 @@ namespace SizedApparel
{
public string raceName = null;
public bool overrideDef = false;
public bool asHumanlike = false;
public bool asHumanlike = true;
public float drawMinAge = -1; //pawn's Biological age. -1 to ignore.
public AlienRaceSetting(string raceName)
@ -32,7 +32,7 @@ namespace SizedApparel
{
Scribe_Values.Look(ref raceName, "raceName", null);
Scribe_Values.Look(ref overrideDef, "overrideDef", false);
Scribe_Values.Look(ref asHumanlike, "asHumanlike", false);
Scribe_Values.Look(ref asHumanlike, "asHumanlike", true);
Scribe_Values.Look(ref drawMinAge, "drawMinAge", -1);
}
@ -47,8 +47,12 @@ namespace SizedApparel
public static bool DetailLog = false;
public static bool autoClearCacheOnWriteSetting = true;
public static bool PreCacheOnLoad = true;
public static float PreCacheRandomFactor = 0.5f;
public static bool useBodyTexture = true;//for user who not use rimnudeworld
public static bool useGenderSpecificTexture = true;
public static bool matchBodyTextureToMinimumApparelSize = true;//for avoiding breasts cliping
@ -59,6 +63,23 @@ namespace SizedApparel
//Apply Target Pawn Category
public static bool ApplyHumanlikes = true; //Always true.
public static bool ApplyAnimals = false;
public static bool ApplyAnimalsPlayerFactionOnly = true; //TODO
public static bool ApplyMechanoid = false;
public static bool ApplyApparelPatchForMale = false; //only ApparelServerityWork.
public static bool ApplyColonists = true;
public static bool ApplySlaves = true;
public static bool ApplyPrisoner = true;
public static bool ApplyNeutralAndAlly = true;
public static bool ApplyHostile = false;
public static bool AnimationPatch = true;
//TODO: Standalone render bodyparts.
public static bool drawBodyParts = true;//for user who not use rimnudeworld
public static bool drawBreasts = true;
@ -76,7 +97,7 @@ namespace SizedApparel
public static bool useBodyPartsVariation = true;
public static bool showBodyPartsVariation = true;
public static bool autoJiggleBreasts = true;
public static bool breastsPhysics = false;
//RimNudeWorld
public static bool drawSizedApparelBreastsOnlyWorn = false;
@ -170,7 +191,16 @@ namespace SizedApparel
//force to use it. this is important thing.
//Scribe_Values.Look(ref useBreastSizeCapForApparels, "useBreastSizeCapForApparels", true);
//Apply Categories.
Scribe_Values.Look(ref ApplyAnimals, "ApplyAnimals", false);
Scribe_Values.Look(ref ApplyHumanlikes, "ApplyHumanlikes", true);
Scribe_Values.Look(ref ApplyMechanoid, "ApplyMechanoid", false);
Scribe_Values.Look(ref AnimationPatch, "AnimationPatch", true);
Scribe_Values.Look(ref useBodyTexture, "useBodyTexture", true);
Scribe_Values.Look(ref useGenderSpecificTexture, "useGenderSpecificTexture", true);
Scribe_Values.Look(ref matchBodyTextureToMinimumApparelSize, "matchBodyTextureToMinimumApparelSize", true);
Scribe_Values.Look(ref matchBreastToSupportedApparelSize, "matchBreastToSupportedApparelSize", true);
@ -238,6 +268,10 @@ namespace SizedApparel
//TODO: Humanlike Setting Per Race
//Scribe_Values.Look(ref alienRacesAllowHumanlikTextures, "alienRacesAllowHumanlikTextures");
//BreastsPhysics
//Scribe_Values.Look(ref breastsPhysics, "breastsPhysics", false);
base.ExposeData();
}
@ -283,7 +317,7 @@ namespace SizedApparel
{
if (pawn == null)
continue;
var comp = pawn.TryGetComp<ApparelRecorderComp>();
var comp = pawn.GetComp<ApparelRecorderComp>();
if (comp != null)
comp.SetDirty(clearPawnGraphicSet);
}
@ -311,7 +345,7 @@ namespace SizedApparel
rightRect = rightRect.ContractedBy(10f);
Rect scrollRect = new Rect(0, 0, leftRect.width - 30f, Math.Max(leftRect.height + (float)alienDefList.Count* alienRaceSettingHeight, 1f));
Widgets.BeginScrollView(leftRect, ref ScrollPos, scrollRect, true);
leftRect = new Rect(leftRect.x, leftRect.x, leftRect.width - 30f, leftRect.height + Math.Max((float)alienDefList.Count * alienRaceSettingHeight, 1f));
leftRect = new Rect(leftRect.x, leftRect.x, leftRect.width - 30f, leftRect.height + Math.Max((float)alienDefList.Count * alienRaceSettingHeight, 1f) + 250f);
listingStandard.Begin(leftRect);
listingStandard.maxOneColumn = true;
@ -330,13 +364,21 @@ namespace SizedApparel
{
ClearCache();
}
if (listingStandard.ButtonTextLabeled("RandomPreCache", "15 sec ~ 2 min"))
{
SizedApparelsDatabase.RandomPreCacheForApparels();
SizedApparelsDatabase.RandomPreCacheForBodyParts();
}
}
listingStandard.Gap();
listingStandard.Gap(8);
listingStandard.GapLine(5f);
listingStandard.Gap();
listingStandard.GapLine();
/*
listingStandard.Label("Optimization",-1,"");
//listingStandard.CheckboxLabeled("Debug Log", ref SizedApparelSettings.Debug, "Debug logs.\nDefault: false");
@ -358,10 +400,8 @@ namespace SizedApparel
//}
listingStandard.Gap(8);
listingStandard.Label("Other Mod Compatibility");
listingStandard.Gap(8);
listingStandard.GapLine(5f);
listingStandard.CheckboxLabeled(" Forced compatibility of unsupported apparel", ref SizedApparelSettings.ForcedSupportApparel, "It may have clipping issue.\nDefault: false");
listingStandard.CheckboxLabeled(" Force ignore unsupported apparel", ref SizedApparelSettings.ForcedSupportApparel, "It may have clipping issue from unsupported parts.\nDefault: false");
/*
@ -402,7 +442,7 @@ namespace SizedApparel
{
listingStandard.Label(" RimJobWorld is Actived ", -1, "");
}
listingStandard.GapLine(1);
listingStandard.Gap(12);
listingStandard.Label("AlienRace Compatibility (wip)", -1, "");
@ -443,26 +483,6 @@ namespace SizedApparel
listingStandard.Label(" AlienRace is not Actived ", -1, "");
}
//Rect outRect = new Rect(0f, 35f, rect.width, rect.height - 35f);
/*
const float alienSettingHeight = 80;
Rect outRect = listingStandard.GetRect(listingStandard.CurHeight);
outRect = new Rect(outRect.x, outRect.y, outRect.width, alienSettingHeight);
Rect viewRect = new Rect(0, 0, outRect.width - 16f, 100 );//alienDefList.Count * 30f
Widgets.BeginScrollView(outRect, ref ScrollPos, viewRect, true);
Widgets.Label(new Rect(0f, 0f, 30f, 10f), "hello");
Widgets.Label(new Rect(0f, 0f, 30f, 10f), "world");
*/
//Log.Message(alienDefList.Count.ToString());
//float h = alienDefList.Count <= 1 ? alienRaceSettingHeight : alienRaceSettingHeight * 1.8f;
//Rect rect = Race_ListingStandard.GetRect(h);
//rect.x = 0;
//rect.y = 0;
//Rect ScrollViewRect = new Rect(0, 0, rect.width - 16f, alienDefList.Count * alienRaceSettingHeight);
//Widgets.BeginScrollView(rect, ref ScrollPos, ScrollViewRect, true);
float h = alienDefList.Count * alienRaceSettingHeight;
Listing_Standard Race_ListingStandard = listingStandard.BeginSection(h);
foreach (var raceName in alienDefList)
@ -488,17 +508,17 @@ namespace SizedApparel
}
Race_ListingStandard.CheckboxLabeled("If Unsupported, Use Humanlike", ref raceSetting.asHumanlike, "This Race will use Humanlike if it doesn't have own textures. useful for race that Unsupported but simillar to human");
Race_ListingStandard.Label((raceSetting.drawMinAge <= 100 ? "" : "[overdrive]") + "SA BodyPart Draw Min Age: " + raceSetting.drawMinAge.ToString(), -1, "Lower than this age will not use Sized Apparel. Useful for BnC. -1 for disable");
raceSetting.drawMinAge = Race_ListingStandard.Slider(raceSetting.drawMinAge, raceSetting.drawMinAge <= 100 ? -1: 100, raceSetting.drawMinAge >= 100 ? 1000 : 100);
raceSetting.drawMinAge = Mathf.Round(Race_ListingStandard.Slider(raceSetting.drawMinAge, raceSetting.drawMinAge <= 100 ? -1: 100, raceSetting.drawMinAge >= 100 ? 1000 : 100));
Race_ListingStandard.Gap();
}
listingStandard.EndSection(Race_ListingStandard);
Widgets.EndScrollView();
//listingStandard.Gap(alienSettingHeight);
listingStandard.Gap(8);
listingStandard.GapLine(4f);
listingStandard.Gap(16);
listingStandard.Gap(8);
listingStandard.Label("RimNudeWorld Compatibility (WIP)", -1, "");
//listingStandard.CheckboxLabeled(" Don't Replace Body Texture On Nude", ref SizedApparelSettings.DontReplaceBodyTextureOnNude, "Only Replace BodyTexture On Not Nude. Trigers are Torso And Chests.\nDefault: False");
@ -547,18 +567,51 @@ namespace SizedApparel
SizedApparelSettings.drawBelly = true;
}
}
listingStandard.Gap(8);
listingStandard.GapLine(5f);
if (SizedApparelPatch.RimworldAnimationActive)
{
listingStandard.Label("RimworldAnimation (rjwAnimation) is Actived ", -1, "");
listingStandard.CheckboxLabeled(" Animated SizedApparel BodyParts (wip)", ref SizedApparelSettings.AnimationPatch, "this option may animated breasts jiggle during animation.\n but not copatable with rimnudeworld.\ndefault: true");
}
else
{
listingStandard.Label("RimworldAnimation (rjwAnimation) is not Actived ", -1, "");
}
listingStandard.End();
listingStandard.Begin(rightRect);
listingStandard.Label("SizedApparel System Apply (apparel and body parts)");
listingStandard.CheckboxLabeled(" Apply Humanlikes", ref SizedApparelSettings.ApplyHumanlikes, "Try to Apply SizedApparel to Humanlikes if The textures are valid.\nDefault: true");
listingStandard.CheckboxLabeled(" Apply Animals", ref SizedApparelSettings.ApplyAnimals, "Try to Apply SizedApparel to Animals if The textures are valid.\nDefault: false");
//TODO
/*
if (SizedApparelSettings.ApplyAnimals)
listingStandard.CheckboxLabeled(" Apply Player Faction Animals Only", ref SizedApparelSettings.ApplyAnimalsPlayerFactionOnly, "Default: true");
*/
listingStandard.CheckboxLabeled(" Apply Mechanoid", ref SizedApparelSettings.ApplyMechanoid, "Try to Apply SizedApparel to Mech if The textures are valid.\nDefault: true");
listingStandard.GapLine(5f);
listingStandard.Label("Apparel Patch (Breasts Sized Apparel)");
listingStandard.CheckboxLabeled(" Apply Apparel Patch for Male", ref SizedApparelSettings.ApplyApparelPatchForMale, "It Skips breasts size test for male. Do you need man with breasts...? may be not.\nDefault: false");
listingStandard.GapLine(5f);
listingStandard.Label("If you changed the option, try change apparels or reload save", -1);
listingStandard.Label("Body Part Render Option (wip)",-1,"standalone BodyPart Render System from this mod. It's for user who don't use RimNudeWorld\nIf you use RimNudeWorld, you should turn off this.");
listingStandard.CheckboxLabeled("Use Gender Specific Textures.", ref SizedApparelSettings.useGenderSpecificTexture,"Use Gender Specific texture for body and apparel if it's valid. \nDefault: true");
listingStandard.GapLine(1);
listingStandard.CheckboxLabeled("Draw Body Parts", ref SizedApparelSettings.drawBodyParts, "Draw Breasts..etc. when the pawn is wearing supported apparels. \nDefault: true");
if (SizedApparelSettings.drawBodyParts)
{
listingStandard.CheckboxLabeled(" Use (Sized Apparel) Body Texture", ref SizedApparelSettings.useBodyTexture, "change pawn's body texture when the pawn is wearing supported apparels. Recommanded\nDefault: true");
listingStandard.CheckboxLabeled(" Draw Muscle Overlay (wip)", ref SizedApparelSettings.drawMuscleOverlay, "\nDisable this option when you use RimNudeWorld");
listingStandard.CheckboxLabeled(" Draw Breasts", ref SizedApparelSettings.drawBreasts, "this option is why this mod exist.\nDefault: true");
@ -566,6 +619,7 @@ namespace SizedApparel
{
listingStandard.CheckboxLabeled(" Match Breasts size to supported apparels",ref SizedApparelSettings.matchBreastToSupportedApparelSize, "to avoid breasts clipping(when breasts are bigger), you need this option.\nDefault: true");
listingStandard.CheckboxLabeled(" draw Breasts on worn pawn only (RimNudeWorld)", ref SizedApparelSettings.drawSizedApparelBreastsOnlyWorn, "when the pawn is nude, the breasts graphic for sized apparel will be hidden. \nDefault: false" );
//listingStandard.CheckboxLabeled(" (Wip) Breasts Physics", ref SizedApparelSettings.breastsPhysics, "Breasts can be jiggled from animations. It may be heavy for performance. \ndefault = false");
}
listingStandard.CheckboxLabeled(" Draw Penis", ref SizedApparelSettings.drawPenis,"Disable this option when you use RimNudeWorld");
listingStandard.CheckboxLabeled(" Draw Vagina", ref SizedApparelSettings.drawVagina, "Disable this option when you use RimNudeWorld");

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;
}
}

View file

@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SizedApparel</RootNamespace>
<AssemblyName>SizedApparelforRJW</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
@ -28,7 +28,7 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\1.3\Assemblies\</OutputPath>
<OutputPath>..\..\1.4\Assemblies\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
@ -49,11 +49,15 @@
<Private>False</Private>
</Reference>
<Reference Include="RimNudeWorld">
<HintPath>..\..\..\rimnude-unofficial\1.3 Assembly\Assemblies\RimNudeWorld.dll</HintPath>
<HintPath>..\..\..\rimnude-unofficial\Assembly Folders\1.4 Assembly\Assemblies\RimNudeWorld.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Rimworld-Animations">
<HintPath>..\..\..\rimworld-animations\1.4\Assemblies\Rimworld-Animations.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="RJW">
<HintPath>..\..\..\RJW\1.3\Assemblies\RJW.dll</HintPath>
<HintPath>..\..\..\rjw\1.4\Assemblies\RJW.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System" />
@ -74,6 +78,10 @@
<HintPath>..\..\..\..\RimWorldWin64_Data\Managed\UnityEngine.IMGUIModule.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.TextRenderingModule">
<HintPath>..\..\..\..\RimWorldWin64_Data\Managed\UnityEngine.TextRenderingModule.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="AlienRaceSupport.cs" />
@ -86,6 +94,7 @@
<Compile Include="SizedApparelBodyPartEditor.cs" />
<Compile Include="SizedApparelComp.cs" />
<Compile Include="HarmonyPatches.cs" />
<Compile Include="SizedApparelDef.cs" />
<Compile Include="SizedApparelDubsApparelPatch.cs" />
<Compile Include="SizedApparelMain.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />

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?
}
}
}
}
}
}