diff --git a/1.3/Assemblies/Rimworld-Animations-Patch.dll b/1.3/Assemblies/Rimworld-Animations-Patch.dll
index 2212931..7039ed8 100644
Binary files a/1.3/Assemblies/Rimworld-Animations-Patch.dll and b/1.3/Assemblies/Rimworld-Animations-Patch.dll differ
diff --git a/1.3/Assemblies/Rimworld-Animations-Patch.pdb b/1.3/Assemblies/Rimworld-Animations-Patch.pdb
deleted file mode 100644
index a160924..0000000
Binary files a/1.3/Assemblies/Rimworld-Animations-Patch.pdb and /dev/null differ
diff --git a/1.3/Assemblies/Rimworld-Animations.dll b/1.3/Assemblies/Rimworld-Animations.dll
deleted file mode 100644
index 7f376ba..0000000
Binary files a/1.3/Assemblies/Rimworld-Animations.dll and /dev/null differ
diff --git a/About/Changelog_v1.2.0.txt b/About/Changelog_v1.2.1.txt
similarity index 96%
rename from About/Changelog_v1.2.0.txt
rename to About/Changelog_v1.2.1.txt
index fa951c4..b885e60 100644
--- a/About/Changelog_v1.2.0.txt
+++ b/About/Changelog_v1.2.1.txt
@@ -1,3 +1,7 @@
+Chnage log v 1.2.1
+- Change: Optimisation of the body part rendering code - there should be much better frame rates now. Just avoid hosting orgies involving 50 or more people...
+- Addition: Added option to the basic settings menu to toggle hair redrawing for portraits (helps make sure that body parts are properly covered by long hair)
+
Change log v 1.2.0
- Fix: Fixed bug where married pawns could be accused of cheating when having sex with another spouse
- Fix: Fixed bug where some animations would not result in an orgasm occuring when they should be occuring
diff --git a/Languages/English/Keyed/SettingsKeys.xml b/Languages/English/Keyed/SettingsKeys.xml
index 19f0f50..4bcb1e2 100644
--- a/Languages/English/Keyed/SettingsKeys.xml
+++ b/Languages/English/Keyed/SettingsKeys.xml
@@ -36,6 +36,8 @@
Turning this setting on may help when using alien races which are much larger or smaller than regular humans.
Add animated hands to animations
Requires RimNudeWorld.
+ Redraw hair in pawn portraits
+ Helps prevent bodyparts from rendering over long hair in portraits. Disable this feature if you find two sets of hair appearing on your pawns or hair is being rendered over headgear.
Clothing options
Crop the bottoms of worn shirts, tank tops, etc. when not wearing pants or a skirt
diff --git a/Patches/OTYNude_AnusPatch.xml b/Patches/OTYNude_AnusPatch.xml
index 3da36ab..47eb613 100644
--- a/Patches/OTYNude_AnusPatch.xml
+++ b/Patches/OTYNude_AnusPatch.xml
@@ -14,6 +14,10 @@
false
+
+
+ Defs/ThingDef/alienRace/generalSettings/alienPartGenerator/bodyAddons/li[bodyPart="Anus"]/hiddenUnderApparelFor
+
diff --git a/Patches/RimNudeWorld_AlienPartGenerator.xml b/Patches/RimNudeWorld_AlienPartGenerator.xml
index 18975da..4e51fd4 100644
--- a/Patches/RimNudeWorld_AlienPartGenerator.xml
+++ b/Patches/RimNudeWorld_AlienPartGenerator.xml
@@ -8,32 +8,16 @@
Normal
-
- Defs/ThingDef/alienRace/generalSettings/alienPartGenerator/bodyAddons/li/hiddenUnderApparelFor[li="Torso"]
-
- ChestBPG
-
+
+
+ Defs/ThingDef/alienRace/generalSettings/alienPartGenerator/bodyAddons/li[bodyPart="Genitals"]/hiddenUnderApparelFor
-
- Defs/ThingDef/alienRace/generalSettings/alienPartGenerator/bodyAddons/li/hiddenUnderApparelFor[li="Legs"]
-
- GenitalsBPG
-
+
+ Defs/ThingDef/alienRace/generalSettings/alienPartGenerator/bodyAddons/li[bodyPart="Chest"]/hiddenUnderApparelFor
-
-
- Defs/ThingDef/alienRace/generalSettings/alienPartGenerator/bodyAddons/li[hediffGraphics/RJW_pregnancy]/hiddenUnderApparelFor
-
- Defs/ThingDef/alienRace/generalSettings/alienPartGenerator/bodyAddons/li[hediffGraphics/RJW_pregnancy]
-
-
- Torso
-
-
-
-
-
+
+
Defs/ThingDef/alienRace/generalSettings/alienPartGenerator/bodyAddons/li[hediffGraphics/RJW_pregnancy]/offsets/south/layerOffset
diff --git a/Source/.vs/Rimworld-Animations-Patch/v16/.suo b/Source/.vs/Rimworld-Animations-Patch/v16/.suo
index 1e3af22..41ac4a3 100644
Binary files a/Source/.vs/Rimworld-Animations-Patch/v16/.suo and b/Source/.vs/Rimworld-Animations-Patch/v16/.suo differ
diff --git a/Source/Rimworld-Animations-Patch.csproj b/Source/Rimworld-Animations-Patch.csproj
index 6debb38..87ab5b4 100644
--- a/Source/Rimworld-Animations-Patch.csproj
+++ b/Source/Rimworld-Animations-Patch.csproj
@@ -67,6 +67,7 @@
False
..\..\rimworld-animations-master\1.3\Assemblies\Rimworld-Animations.dll
+ False
False
diff --git a/Source/Scripts/Comps/CompApparelVisibility.cs b/Source/Scripts/Comps/CompApparelVisibility.cs
index 2fb307e..0ccbc0c 100644
--- a/Source/Scripts/Comps/CompApparelVisibility.cs
+++ b/Source/Scripts/Comps/CompApparelVisibility.cs
@@ -14,14 +14,21 @@ namespace Rimworld_Animations_Patch
public Apparel apparel => base.parent as Apparel;
public Vector3 position;
public float rotation = 0f;
+
public bool isBeingWorn = true;
+ public bool coversChest = false;
+ public bool coversGroin = false;
+ public bool coversBelly = false;
+ public RimNudeDataStatus rimNudeDataStatus = RimNudeDataStatus.NotLoaded;
private IntVec3 cellPosition;
public override void PostExposeData()
{
base.PostExposeData();
+
Scribe_Values.Look(ref position, "position", default);
+ Scribe_Values.Look(ref rotation, "rotation", 0);
Scribe_Values.Look(ref cellPosition, "cellPosition", default);
}
@@ -44,32 +51,5 @@ namespace Rimworld_Animations_Patch
position = cellPosition.ToVector3() + offset + new Vector3(0.5f, AltitudeLayer.ItemImportant.AltitudeFor() - Mathf.Clamp(apparel.def.apparel.LastLayer.drawOrder/100000f, 0f, 1f), 0.5f);
rotation = 120 * (-1f + 2f * Rand.Value);
}
-
- /*public bool IsBeingWorn()
- {
- Pawn pawn = apparel.Wearer;
-
- if (apparel.def.apparel.wornGraphicPath.NullOrEmpty())
- { return true; }
-
- foreach (ApparelGraphicRecord record in pawn.Drawer.renderer.graphics.apparelGraphics)
- {
- if (record.sourceApparel == apparel)
- { return true; }
- }
-
- return false;
- }*/
}
-}
-
-//var methodInfo = AccessTools.Method(typeof(GenPlace), "TryFindPlaceSpotNear", null, null);
-//object[] parameters = new object[] { apparel.Wearer.Position, default(Rot4), apparel.Wearer.Map, apparel.Wearer, false, null, null };
-//object result = methodInfo.Invoke(null, parameters);
-
-/*bool _result = (bool)result;
-if (_result)
-{
- bestSpot = (IntVec3)parameters[5];
- DebugMode.Message("Best position: " + bestSpot.ToString());
-}*/
+}
\ No newline at end of file
diff --git a/Source/Scripts/Enums.cs b/Source/Scripts/Enums.cs
index dec424c..172af6b 100644
--- a/Source/Scripts/Enums.cs
+++ b/Source/Scripts/Enums.cs
@@ -12,4 +12,11 @@ namespace Rimworld_Animations_Patch
MinorTaboo = 1,
MajorTaboo = 2,
}
+
+ public enum RimNudeDataStatus
+ {
+ Unavailable = -1,
+ NotLoaded = 0,
+ Loaded = 1,
+ }
}
diff --git a/Source/Scripts/Patches/HarmonyPatch_ApparelGraphicRecordGetter.cs b/Source/Scripts/Patches/HarmonyPatch_ApparelGraphicRecordGetter.cs
index 8e1e041..f9b0793 100644
--- a/Source/Scripts/Patches/HarmonyPatch_ApparelGraphicRecordGetter.cs
+++ b/Source/Scripts/Patches/HarmonyPatch_ApparelGraphicRecordGetter.cs
@@ -29,7 +29,8 @@ namespace Rimworld_Animations_Patch
{
Graphic graphicWithApparelMask = GraphicDatabase.Get(graphic.path, ShaderDatabase.CutoutComplex, apparel.def.graphicData.drawSize, apparel.DrawColor, apparel.DrawColor, null, "Masks/apparel_shirt_mask_" + bodyType.defName);
graphic = GraphicMaskingUtility.ApplyGraphicWithMasks(graphic, graphicWithApparelMask, true);
- DebugMode.Message("Applying apparel mask: Masks/apparel_shirt_mask_" + bodyType.defName + " to " + apparel.def.defName + " (" + graphic.path + ")");
+
+ //DebugMode.Message("Applying apparel mask: Masks/apparel_shirt_mask_" + bodyType.defName + " to " + apparel.def.defName + " (" + graphic.path + ")");
}
}
diff --git a/Source/Scripts/Patches/HarmonyPatch_PawnRenderer.cs b/Source/Scripts/Patches/HarmonyPatch_PawnRenderer.cs
index dd772fe..6c3ba57 100644
--- a/Source/Scripts/Patches/HarmonyPatch_PawnRenderer.cs
+++ b/Source/Scripts/Patches/HarmonyPatch_PawnRenderer.cs
@@ -83,12 +83,15 @@ namespace Rimworld_Animations_Patch
if (__instance.pawn.apparel.WornApparel.NullOrEmpty() == false)
{
- foreach(Apparel apparel in __instance.pawn.apparel.WornApparel)
+ foreach (Apparel apparel in __instance.pawn.apparel.WornApparel)
{
CompApparelVisibility comp = apparel.TryGetComp();
if (comp != null)
- { comp.isBeingWorn = true; }
+ {
+ comp.isBeingWorn = true;
+ comp.rimNudeDataStatus = RimNudeDataStatus.NotLoaded;
+ }
}
}
}
diff --git a/Source/Scripts/Patches/HarmonyPatch_Rimworld_Animations.cs b/Source/Scripts/Patches/HarmonyPatch_Rimworld_Animations.cs
index 7849549..2665074 100644
--- a/Source/Scripts/Patches/HarmonyPatch_Rimworld_Animations.cs
+++ b/Source/Scripts/Patches/HarmonyPatch_Rimworld_Animations.cs
@@ -24,6 +24,8 @@ namespace Rimworld_Animations_Patch
postfix: new HarmonyMethod(AccessTools.Method(typeof(HarmonyPatch_Rimworld_Animations), "Postfix_RerollAnimations")));
(new Harmony("Rimworld_Animations_Patch")).Patch(AccessTools.Method(AccessTools.TypeByName("Rimworld_Animations.HarmonyPatch_AlienRace"), "Prefix_AnimateHeadAddons"),
prefix: new HarmonyMethod(AccessTools.Method(typeof(HarmonyPatch_Rimworld_Animations), "Prefix_DrawAddons")));
+ (new Harmony("Rimworld_Animations_Patch")).Patch(AccessTools.Method(AccessTools.TypeByName("BodyAddon"), "CanDrawAddon"),
+ postfix: new HarmonyMethod(AccessTools.Method(typeof(HarmonyPatch_Rimworld_Animations), "Postfix_CanDrawAddon")));
}
// Extend the animation selector's body part check to include hands and whether the pawn is in bed or not
@@ -81,101 +83,31 @@ namespace Rimworld_Animations_Patch
}
// Determine if a body addon is covered by apparel
- /*public static bool BodyAddonCoveredByApparel(Pawn pawn, AlienPartGenerator.BodyAddon bodyAddon)
- {
- foreach (ApparelGraphicRecord apparelGraphicRecord in pawn.Drawer.renderer.graphics.apparelGraphics)
- {
- Apparel apparel = apparelGraphicRecord.sourceApparel;
-
- if (apparel.def.apparel.bodyPartGroups.Any(x => bodyAddon.hiddenUnderApparelFor.Contains(x)))
- { return true; }
- }
-
- return false;
- }*/
-
public static bool BodyAddonCoveredByWornApparel(Pawn pawn, AlienPartGenerator.BodyAddon bodyAddon)
{
- if (bodyAddon?.hiddenUnderApparelFor == null || bodyAddon?.hiddenUnderApparelTag == null)
+ if (pawn?.apparel?.WornApparel == null || bodyAddon == null)
{ return false; }
foreach (Apparel apparel in pawn.apparel.WornApparel)
{
- if (ApparelAnimationUtility.BodyAddonCoveredByApparel(apparel, bodyAddon))
+ if (ApparelAnimationUtility.PrivatePartCoveredByApparel(apparel, bodyAddon.bodyPart))
{ return true; }
}
return false;
}
- // Determine if a body addon should be drawn
- public static bool CanDrawAddon(Pawn pawn, AlienPartGenerator.BodyAddon bodyAddon)
+ public static void Postfix_CanDrawAddon(AlienPartGenerator.BodyAddon __instance, ref bool __result, Pawn pawn)
{
- if (bodyAddon == null)
- { return false; }
+ if (__result == false) return;
- if (pawn.RaceProps.Animal)
- { return true; }
-
- Building_Bed building_Bed = pawn.CurrentBed();
-
- if ((building_Bed == null ||
- building_Bed.def.building.bed_showSleeperBody ||
- bodyAddon.drawnInBed) && (bodyAddon.backstoryRequirement.NullOrEmpty() || pawn.story.AllBackstories.Any((Backstory x) => x.identifier == bodyAddon.backstoryRequirement)))
- {
- if (!bodyAddon.drawnDesiccated)
- {
- Corpse corpse = pawn.Corpse;
- if (corpse != null && corpse.GetRotStage() == RotStage.Dessicated)
- { return false; }
- }
-
- if (!bodyAddon.bodyPart.NullOrEmpty() &&
- !pawn.health.hediffSet.GetNotMissingParts(BodyPartHeight.Undefined, BodyPartDepth.Undefined, null, null).Any((BodyPartRecord bpr) => bpr.untranslatedCustomLabel == bodyAddon.bodyPart || bpr.def.defName == bodyAddon.bodyPart))
- {
- List list = bodyAddon.hediffGraphics;
- bool flag;
- if (list == null)
- { flag = false; }
-
- else
- { flag = list.Any((AlienPartGenerator.BodyAddonHediffGraphic bahg) => bahg.hediff == HediffDefOf.MissingBodyPart); }
-
- if (!flag)
- { return false; }
- }
-
- if ((pawn.gender == Gender.Female) ? bodyAddon.drawForFemale : bodyAddon.drawForMale)
- {
- if (bodyAddon.bodyTypeRequirement.NullOrEmpty() || pawn.story.bodyType.ToString() == bodyAddon.bodyTypeRequirement)
- {
- bool renderClothes = true;
-
- if (Find.WindowStack.currentlyDrawnWindow is Page_ConfigureStartingPawns)
- { renderClothes = (bool)AccessTools.Field(typeof(Page_ConfigureStartingPawns), "renderClothes").GetValue(Find.WindowStack.currentlyDrawnWindow); }
-
- else
- { renderClothes = pawn.Drawer.renderer.graphics.apparelGraphics.Count > 0; }
-
- bool conditionA = !BodyAddonCoveredByWornApparel(pawn, bodyAddon);
- bool conditionB = !renderClothes;
- bool conditionC = pawn.GetPosture() == PawnPosture.Standing;
- bool conditionD = (pawn.GetPosture() == PawnPosture.LayingOnGroundNormal || pawn.GetPosture() == PawnPosture.LayingOnGroundFaceUp) && bodyAddon.drawnOnGround;
- bool conditionE = pawn.GetPosture() == PawnPosture.LayingInBed && bodyAddon.drawnInBed;
-
- return (conditionA || conditionB) && (conditionC || conditionD || conditionE);
- }
- }
- }
-
- return false;
+ __result = BodyAddonCoveredByWornApparel(pawn, __instance) == false;
}
// Replacement patch for AlienRace to draw the body addons
public static bool Prefix_DrawAddons(PawnRenderFlags renderFlags, Vector3 vector, Vector3 headOffset, Pawn pawn, Quaternion quat, Rot4 rotation)
{
- if (!(pawn.def is ThingDef_AlienRace alienProps) || renderFlags.FlagSet(PawnRenderFlags.Invisible))
- { return false; }
+ if (!(pawn.def is ThingDef_AlienRace alienProps) || renderFlags.FlagSet(PawnRenderFlags.Invisible)) return false;
// Try to draw apparel thrown on ground
if (ApparelSettings.clothesThrownOnGround)
@@ -198,14 +130,19 @@ namespace Rimworld_Animations_Patch
for (int idx = 0; idx < idxBodyAddons.Count; idx++)
{
int i = idxBodyAddons[idx];
- AlienPartGenerator.BodyAddon bodyAddon = bodyAddons[i];
- BodyPartRecord bodyPartRecord = AnimationPatchUtility.GetBodyPartRecord(pawn, bodyAddon.bodyPart);
+ AlienPartGenerator.BodyAddon bodyAddon = bodyAddons[i];
+ Graphic addonGraphic = alienComp.addonGraphics[i];
+
+ bool canDraw = addonGraphic.path.ToLower().Contains("featureless") == false && bodyAddon.CanDrawAddon(pawn);
+ bool drawHand = !renderFlags.FlagSet(PawnRenderFlags.Portrait) && BasicSettings.showHands && handsAvailableCount > 0 && HandAnimationUtility.BodyPartIsBeingTouched(pawn, addonGraphic.path, out var handData);
+
+ if (canDraw == false && drawHand == false)
+ { continue; }
+
+ BodyPartRecord bodyPartRecord = AnimationPatchUtility.GetBodyPartRecord(pawn, bodyAddon.bodyPart);
bool alignWithHead = bodyAddon.alignWithHead || (bodyPartRecord != null && bodyPartRecord.IsInGroup(BodyPartGroupDefOf.FullHead));
- Graphic addonGraphic = alienComp.addonGraphics[i];
- //DebugMode.Message(" Trying to draw " + addonGraphic.path);
-
Rot4 apparentRotation = rotation;
if (!renderFlags.FlagSet(PawnRenderFlags.Portrait) && pawnAnimator != null && pawnAnimator.isAnimating)
{ apparentRotation = alignWithHead ? pawnAnimator.headFacing : pawnAnimator.bodyFacing; }
@@ -216,8 +153,7 @@ namespace Rimworld_Animations_Patch
Vector3 vector2 = bodyTypeOffset + ((offsets != null) ? offsets.GetOffset(renderFlags.FlagSet(PawnRenderFlags.Portrait), pawn.story.bodyType, alienComp.crownType) : Vector3.zero);
// Offset private parts so that they render over tattoos but under apparel (rendering under tatoos looks weird)
- if ((bodyPartRecord != null && (bodyPartRecord.IsInGroup(PatchBodyPartGroupDefOf.GenitalsBPG) || bodyPartRecord.IsInGroup(PatchBodyPartGroupDefOf.ChestBPG) || bodyPartRecord.IsInGroup(PatchBodyPartGroupDefOf.AnusBPG))) ||
- addonGraphic.path.ToLower().Contains("belly"))
+ if ((bodyPartRecord != null && (bodyPartRecord.IsInGroup(PatchBodyPartGroupDefOf.GenitalsBPG) || bodyPartRecord.IsInGroup(PatchBodyPartGroupDefOf.ChestBPG) || bodyPartRecord.IsInGroup(PatchBodyPartGroupDefOf.AnusBPG))) || addonGraphic.path.ToLower().Contains("belly"))
{
vector2.y = (vector2.y + 0.40f) / 1000f + 0.012f;
@@ -225,7 +161,6 @@ namespace Rimworld_Animations_Patch
if (pawn.RaceProps.Humanlike &&
addonGraphic.path.ToLower().Contains("penis") &&
addonGraphic.path.ToLower().Contains("flaccid") == false &&
- BodyAddonCoveredByWornApparel(pawn, bodyAddon) == false &&
apparentRotation == Rot4.South)
{ vector2.y += 0.010f; }
}
@@ -289,7 +224,7 @@ namespace Rimworld_Animations_Patch
finalAngle = bodyAngle;
}
}
-
+
// Fixes 'leaning left' issue with Yayo's animations
else if (!renderFlags.FlagSet(PawnRenderFlags.Portrait) && (pawnAnimator == null || pawnAnimator.isAnimating == false))
{
@@ -302,26 +237,29 @@ namespace Rimworld_Animations_Patch
{ vector2 -= pawn.Drawer.renderer.BaseHeadOffsetAt(apparentRotation); }
Vector3 finalPosition = vector + (alignWithHead ? headOffset : Vector3.zero) + vector2.RotatedBy(angle: Mathf.Acos(f: Quaternion.Dot(a: Quaternion.identity, b: addonRotation)) * 2f * 57.29578f);
-
+
// Draw the addon if visible
- if (CanDrawAddon(pawn, bodyAddon))
- {
+ if (canDraw)
+ {
+ //DebugMode.Message("Drawing " + addonGraphic.path);
+
GenDraw.DrawMeshNowOrLater(mesh: addonGraphic.MeshAt(rot: apparentRotation),
loc: finalPosition,
quat: Quaternion.AngleAxis(angle: bodyAddonAngle, axis: Vector3.up) * quatAdditional * addonRotation,
- mat: addonGraphic.MatAt(rot: apparentRotation), renderFlags.FlagSet(PawnRenderFlags.DrawNow));
+ mat: addonGraphic.MatAt(rot: apparentRotation),
+ drawNow: renderFlags.FlagSet(PawnRenderFlags.DrawNow));
}
// Draw hand over the body part if required
- if (BasicSettings.showHands && !renderFlags.FlagSet(PawnRenderFlags.Portrait) && handsAvailableCount > 0)
+ if (drawHand)
{
if (HandAnimationUtility.TryToDrawHand(pawn, addonGraphic.path, finalPosition, finalAngle, rotation, renderFlags))
{ handsAvailableCount--; }
}
}
- // Body addons are sometimes are not appropriately concealed by long hair, so re-draw the pawn's hair here
- if (pawn.Drawer.renderer.graphics.headGraphic != null)
+ // Body addons are sometimes are not appropriately concealed by long hair in portraits, so re-draw the pawn's hair here
+ if (pawn.Drawer.renderer.graphics.headGraphic != null && renderFlags.FlagSet(PawnRenderFlags.Portrait) && BasicSettings.redrawHair)
{
var methodInfo = AccessTools.Method(typeof(PawnRenderer), "DrawHeadHair", null, null);
diff --git a/Source/Scripts/Settings/ApparelSettings.cs b/Source/Scripts/Settings/ApparelSettings.cs
index a70ca46..c7e6793 100644
--- a/Source/Scripts/Settings/ApparelSettings.cs
+++ b/Source/Scripts/Settings/ApparelSettings.cs
@@ -82,8 +82,9 @@ namespace Rimworld_Animations_Patch
{
foreach (Pawn pawn in Current.Game.CurrentMap.mapPawns.AllPawns)
{
- if (pawn.RaceProps.Humanlike && pawn.apparel.WornApparel.NullOrEmpty() == false)
- { pawn.Drawer.renderer.graphics.ResolveAllGraphics(); }
+ pawn.Drawer.renderer.graphics.ResolveAllGraphics();
+ PortraitsCache.SetDirty(pawn);
+ GlobalTextureAtlasManager.TryMarkPawnFrameSetDirty(pawn);
}
}
}
@@ -150,7 +151,6 @@ namespace Rimworld_Animations_Patch
int num = 0;
bool isEnabled = false;
- bool linkChangesChanged = false;
// Get a list of apparel of interest
if (thingDefs.NullOrEmpty())
@@ -281,7 +281,6 @@ namespace Rimworld_Animations_Patch
foreach (ThingDef thingDef in thingDefs)
{
isEnabled = false;
- bool changeHappened = false;
innerX = 0;
innerY = (float)num * (rowHeight);
@@ -303,7 +302,6 @@ namespace Rimworld_Animations_Patch
{
isEnabled = rimNudeApparel.coversGroin;
Widgets.Checkbox(innerX + SettingsUtility.Align(checkboxSize, singleColumnWidth), innerY + SettingsUtility.Align(checkboxSize, rowHeight), ref isEnabled, checkboxSize, false, true, null, null);
- if (isEnabled != rimNudeApparel.coversGroin) { changeHappened = true; }
rimNudeApparel.coversGroin = isEnabled;
}; innerX += singleColumnWidth;
@@ -312,7 +310,6 @@ namespace Rimworld_Animations_Patch
{
isEnabled = rimNudeApparel.coversBelly;
Widgets.Checkbox(innerX + SettingsUtility.Align(checkboxSize, singleColumnWidth), innerY + SettingsUtility.Align(checkboxSize, rowHeight), ref isEnabled, checkboxSize, false, true, null, null);
- if (isEnabled != rimNudeApparel.coversBelly) { changeHappened = true; }
rimNudeApparel.coversBelly = isEnabled;
}; innerX += singleColumnWidth;
@@ -321,29 +318,14 @@ namespace Rimworld_Animations_Patch
{
isEnabled = rimNudeApparel.coversChest;
Widgets.Checkbox(innerX + SettingsUtility.Align(checkboxSize, singleColumnWidth), innerY + SettingsUtility.Align(checkboxSize, rowHeight), ref isEnabled, checkboxSize, false, true, null, null);
- if (isEnabled != rimNudeApparel.coversChest) { changeHappened = true; }
rimNudeApparel.coversChest = isEnabled;
}; innerX += singleColumnWidth;
// Is sex-wear checkbox
isEnabled = rimNudeApparel.sexWear;
Widgets.Checkbox(innerX + SettingsUtility.Align(checkboxSize, singleColumnWidth), innerY + SettingsUtility.Align(checkboxSize, rowHeight), ref isEnabled, checkboxSize, false, true, null, null);
- if (isEnabled != rimNudeApparel.sexWear) { changeHappened = true; }
rimNudeApparel.sexWear = isEnabled;
innerX += singleColumnWidth;
-
- // Update other body types if linked changed are enabled
- if (BasicSettings.linkChanges && (changeHappened || linkChangesChanged))
- {
- for (int i = 0; i < 5; i++)
- {
- RimNudeData _rimNudeApparel = ApparelSettings.rimNudeData.First(x => x.EquivalentTo(new RimNudeData(thingDef)));
- _rimNudeApparel.coversGroin = rimNudeApparel.coversGroin;
- _rimNudeApparel.coversBelly = rimNudeApparel.coversBelly;
- _rimNudeApparel.coversChest = rimNudeApparel.coversChest;
- _rimNudeApparel.sexWear = rimNudeApparel.sexWear;
- }
- }
}
Widgets.EndScrollView();
diff --git a/Source/Scripts/Settings/BasicSettings.cs b/Source/Scripts/Settings/BasicSettings.cs
index f610796..0ef4bad 100644
--- a/Source/Scripts/Settings/BasicSettings.cs
+++ b/Source/Scripts/Settings/BasicSettings.cs
@@ -3,6 +3,7 @@ using System.Linq;
using System.Collections.Generic;
using UnityEngine;
using Verse;
+using RimWorld;
namespace Rimworld_Animations_Patch
{
@@ -16,6 +17,7 @@ namespace Rimworld_Animations_Patch
public static bool hideNamesForSex = false;
public static bool debugMode = false;
public static bool showHands = true;
+ public static bool redrawHair = true;
public static bool worryAboutInfidelity = true;
public static bool worryAboutBeastiality = true;
@@ -42,6 +44,7 @@ namespace Rimworld_Animations_Patch
Scribe_Values.Look(ref hideNamesForSex, "hideNamesForSex", false);
Scribe_Values.Look(ref debugMode, "debugMode", false);
Scribe_Values.Look(ref showHands, "showHands", true);
+ Scribe_Values.Look(ref redrawHair, "redrawHair", true);
Scribe_Values.Look(ref worryAboutInfidelity, "worryAboutInfidelity", true);
Scribe_Values.Look(ref worryAboutBeastiality, "worryAboutBeastiality", true);
Scribe_Values.Look(ref worryAboutRape, "worryAboutRape", true);
@@ -73,8 +76,9 @@ namespace Rimworld_Animations_Patch
{
foreach (Pawn pawn in Current.Game.CurrentMap.mapPawns.AllPawns)
{
- if (pawn.RaceProps.Humanlike && pawn.apparel.WornApparel.NullOrEmpty() == false)
- { pawn.Drawer.renderer.graphics.ResolveAllGraphics(); }
+ pawn.Drawer.renderer.graphics.ResolveAllGraphics();
+ PortraitsCache.SetDirty(pawn);
+ GlobalTextureAtlasManager.TryMarkPawnFrameSetDirty(pawn);
}
}
}
@@ -105,6 +109,7 @@ namespace Rimworld_Animations_Patch
listingStandard.Label("chance_for_other_to_join_in_sex".Translate() + ": " + BasicSettings.chanceForOtherToJoinInSex.ToString("F"), -1f, "chance_for_other_to_join_in_sex_desc".Translate());
BasicSettings.chanceForOtherToJoinInSex = listingStandard.Slider(BasicSettings.chanceForOtherToJoinInSex, 0f, 1f);
+
listingStandard.CheckboxLabeled("hide_names_for_sex".Translate(), ref BasicSettings.hideNamesForSex, "hide_names_for_sex_desc".Translate());
listingStandard.CheckboxLabeled("debug_mode".Translate(), ref BasicSettings.debugMode, "debug_mode_desc".Translate());
@@ -114,6 +119,7 @@ namespace Rimworld_Animations_Patch
listingStandard.CheckboxLabeled("autoscale_delta_pos".Translate(), ref BasicSettings.autoscaleDeltaPos, "autoscale_delta_pos_desc".Translate());
listingStandard.CheckboxLabeled("show_hands".Translate(), ref BasicSettings.showHands, "show_hands_desc".Translate());
+ listingStandard.CheckboxLabeled("redraw_hair".Translate(), ref BasicSettings.redrawHair, "redraw_hair_desc".Translate());
listingStandard.End();
base.DoSettingsWindowContents(inRect);
diff --git a/Source/Scripts/Utilities/ApparelAnimationUtility.cs b/Source/Scripts/Utilities/ApparelAnimationUtility.cs
index 9553b1b..6f1e3e2 100644
--- a/Source/Scripts/Utilities/ApparelAnimationUtility.cs
+++ b/Source/Scripts/Utilities/ApparelAnimationUtility.cs
@@ -15,14 +15,14 @@ namespace Rimworld_Animations_Patch
public static void TryToDrawApparelOnFloor(Pawn pawn)
{
- if (pawn?.apparel?.WornApparel != null)
+ if (pawn?.apparel?.WornApparel != null)
{
- CompBodyAnimator compBodyAnimator = pawn.TryGetComp();
+ CompBodyAnimator compBodyAnimator = pawn.TryGetComp();
- if (ApparelSettings.clothesThrownOnGround == false || Find.CurrentMap != pawn.Map || compBodyAnimator == null || compBodyAnimator.isAnimating == false)
+ if (ApparelSettings.clothesThrownOnGround == false || Find.CurrentMap != pawn.Map || compBodyAnimator == null || compBodyAnimator.isAnimating == false)
{ return; }
-
- foreach (Apparel apparel in pawn.apparel.WornApparel)
+
+ foreach (Apparel apparel in pawn.apparel.WornApparel)
{
CompApparelVisibility compApparelVisibility = apparel.TryGetComp();
@@ -40,64 +40,48 @@ namespace Rimworld_Animations_Patch
apparelGraphic.drawSize.x *= 1f / apparelScale;
apparelGraphic.drawSize.y *= 1f / apparelScale;
- DebugMode.Message(compApparelVisibility.rotation.ToString());
+
//DebugMode.Message("Drawing " + apparel.def.defName + " on ground");
}
}
}
}
- public static bool BodyAddonCoveredByApparel(Apparel apparel, AlienPartGenerator.BodyAddon bodyAddon)
+ public static bool PrivatePartCoveredByApparel(Apparel apparel, string bodyPart)
{
CompApparelVisibility comp = apparel.TryGetComp();
- if (comp != null && comp.isBeingWorn == false)
+ if (comp == null || comp.rimNudeDataStatus == RimNudeDataStatus.Unavailable)
{ return false; }
- RimNudeData rimNudeData = ApparelSettings.GetRimNudeData(apparel);
-
- if (rimNudeData != null && bodyAddon?.bodyPart != null)
+ if (comp.rimNudeDataStatus == RimNudeDataStatus.NotLoaded)
{
- if (bodyAddon.bodyPart == "Genitals" && rimNudeData.coversGroin == false)
- { return false; }
+ RimNudeData rimNudeData = ApparelSettings.GetRimNudeData(apparel);
- if (bodyAddon.bodyPart == "Chest" && rimNudeData.coversChest == false)
- { return false; }
+ if (rimNudeData == null)
+ {
+ comp.rimNudeDataStatus = RimNudeDataStatus.Unavailable;
+ return false;
+ }
- if (bodyAddon.bodyPart == "Torso" && rimNudeData.coversBelly == false)
- { return false; }
+ comp.coversBelly = rimNudeData.coversBelly;
+ comp.coversChest = rimNudeData.coversChest;
+ comp.coversGroin = rimNudeData.coversGroin;
+
+ comp.rimNudeDataStatus = RimNudeDataStatus.Loaded;
}
- if (apparel.def.apparel.bodyPartGroups.Any(x => bodyAddon.hiddenUnderApparelFor.Contains(x)) ||
- apparel.def.apparel.tags.Any(x => bodyAddon.hiddenUnderApparelTag.Contains(x)))
- { return true; }
-
- return false;
- }
-
- public static bool BodyPartCoveredByApparel(Apparel apparel, BodyPartRecord bodyPart)
- {
- CompApparelVisibility comp = apparel.TryGetComp();
-
- if (comp != null && comp.isBeingWorn == false)
+ if (comp.isBeingWorn == false)
{ return false; }
- RimNudeData rimNudeData = ApparelSettings.GetRimNudeData(apparel);
+ if (bodyPart == "Genitals")
+ { return comp.coversGroin; }
- if (rimNudeData != null)
- {
- if (bodyPart.def.defName == "Genitals" && rimNudeData.coversGroin == false)
- { return false; }
+ if (bodyPart == "Chest")
+ { return comp.coversChest; }
- if (bodyPart.def.defName == "Chest" && rimNudeData.coversChest == false)
- { return false; }
-
- if (bodyPart.def.defName == "Torso" && rimNudeData.coversBelly == false)
- { return false; }
- }
-
- if (apparel.def.apparel.CoversBodyPart(bodyPart))
- { return true; }
+ if (bodyPart == "Torso")
+ { return comp.coversBelly; }
return false;
}
@@ -109,9 +93,10 @@ namespace Rimworld_Animations_Patch
if (pawn.RaceProps.Humanlike == false || pawn?.apparel?.WornApparel == null || jobdriver == null)
{ return; }
- foreach (Apparel apparel in pawn.apparel?.WornApparel)
+ foreach (Apparel apparel in pawn.apparel.WornApparel)
{
CompApparelVisibility comp = apparel.TryGetComp();
+
if (comp != null)
{ comp.isBeingWorn = true; }
}
@@ -177,19 +162,19 @@ namespace Rimworld_Animations_Patch
{ requiredGenitals = new List(); }
if (anim.actors[actorID].isFucking || requiredGenitals.Contains("Penis"))
- { bodyPartCovered = bodyPartCovered || BodyPartCoveredByApparel(apparel, bodyParts.FirstOrDefault(x => x.def == xxx.genitalsDef)); }
+ { bodyPartCovered = bodyPartCovered || PrivatePartCoveredByApparel(apparel, "Genitals"); }
if (anim.actors[actorID].isFucked || requiredGenitals.Contains("Vagina"))
- { bodyPartCovered = bodyPartCovered || BodyPartCoveredByApparel(apparel, bodyParts.FirstOrDefault(x => x.def == xxx.genitalsDef)); }
+ { bodyPartCovered = bodyPartCovered || PrivatePartCoveredByApparel(apparel, "Genitals"); }
if (anim.actors[actorID].isFucked || requiredGenitals.Contains("Anus"))
- { bodyPartCovered = bodyPartCovered || BodyPartCoveredByApparel(apparel, bodyParts.FirstOrDefault(x => x.def == xxx.anusDef)); }
+ { bodyPartCovered = bodyPartCovered || PrivatePartCoveredByApparel(apparel, "Genitals"); }
if (requiredGenitals.Contains("Breasts"))
- { bodyPartCovered = bodyPartCovered || BodyPartCoveredByApparel(apparel, bodyParts.FirstOrDefault(x => x.def == xxx.breastsDef)); }
+ { bodyPartCovered = bodyPartCovered || PrivatePartCoveredByApparel(apparel, "Chest"); }
if (requiredGenitals.Contains("Mouth"))
- { bodyPartCovered = bodyPartCovered || BodyPartCoveredByApparel(apparel, bodyParts.FirstOrDefault(x => x.def.defName.ToLower().ContainsAny("mouth", "teeth", "jaw", "beak"))); }
+ { bodyPartCovered = bodyPartCovered || apparel.def.apparel.CoversBodyPart(bodyParts.FirstOrDefault(x => x.def.defName.ToLower().ContainsAny("mouth", "teeth", "jaw", "beak"))); }
return bodyPartCovered;
}
diff --git a/Source/Scripts/Utilities/ApparelSettingsUtility.cs b/Source/Scripts/Utilities/ApparelSettingsUtility.cs
index 56057f9..34956f8 100644
--- a/Source/Scripts/Utilities/ApparelSettingsUtility.cs
+++ b/Source/Scripts/Utilities/ApparelSettingsUtility.cs
@@ -14,9 +14,6 @@ namespace Rimworld_Animations_Patch
foreach (ThingDef thingDef in DefDatabase.AllDefs)
{
- if (thingDef.IsApparel && thingDef.apparel.layers.Count == 1 && thingDef.apparel.layers[0] == ApparelLayerDefOf.Belt)
- { continue; }
-
if (thingDef.IsApparel &&
(thingDef.apparel.bodyPartGroups.Contains(BodyPartGroupDefOf.Torso) ||
thingDef.apparel.bodyPartGroups.Contains(BodyPartGroupDefOf.Legs) ||
diff --git a/Source/Scripts/Utilities/HandAnimationUtility.cs b/Source/Scripts/Utilities/HandAnimationUtility.cs
index 032ec7b..dd3421b 100644
--- a/Source/Scripts/Utilities/HandAnimationUtility.cs
+++ b/Source/Scripts/Utilities/HandAnimationUtility.cs
@@ -16,8 +16,11 @@ namespace Rimworld_Animations_Patch
public static bool BodyPartIsBeingTouched(Pawn pawn, string bodypartFilePath, out List handAnimationData)
{
handAnimationData = new List();
-
ActorAnimationData actorAnimationData = pawn.GetAnimationData();
+
+ if (actorAnimationData == null)
+ { return false; }
+
HandAnimationDef handAnimationDef = DefDatabase.AllDefs.FirstOrDefault(x => x.animationDefName == actorAnimationData.animationDef.defName);
if (handAnimationDef == null)
@@ -47,13 +50,13 @@ namespace Rimworld_Animations_Patch
if (methodInfo == null)
{
- Debug.LogWarning("Hand anaimation motion '" + handAnimationData.motion + "' was not found");
+ Debug.LogWarning("Hand animation motion '" + handAnimationData.motion + "' was not found");
return default;
}
Vector3 handPosition = (Vector3)methodInfo.Invoke(null, new object[] { pawn, handAnimationData, baseAngle });
- return handPosition * pawn.RaceProps.baseBodySize + basePosition;
+ return handPosition * pawn.RaceProps.baseBodySize + basePosition + new Vector3(0f, 0.3f, 0f);
}
public static float GetGenitalSize(Pawn pawn, string genitalName)
@@ -195,7 +198,7 @@ namespace Rimworld_Animations_Patch
public static bool TryToDrawHand(Pawn pawn, string bodyAddonName, Vector3 bodyAddonPosition, float bodyAddonAngle, Rot4 bodyAddonRotation, PawnRenderFlags renderFlags)
{
- if (pawn.TryGetComp() != null && pawn.TryGetComp().isAnimating && BodyPartIsBeingTouched(pawn, bodyAddonName, out List handAnimationData))
+ if (BodyPartIsBeingTouched(pawn, bodyAddonName, out List handAnimationData))
{
foreach (HandAnimationData datum in handAnimationData)
{
diff --git a/Source/obj/Debug/Rimworld-Animations-Patch.csproj.CopyComplete b/Source/obj/Debug/Rimworld-Animations-Patch.csproj.CopyComplete
deleted file mode 100644
index e69de29..0000000
diff --git a/Source/obj/Debug/Rimworld-Animations-Patch.csproj.FileListAbsolute.txt b/Source/obj/Debug/Rimworld-Animations-Patch.csproj.FileListAbsolute.txt
index 3cfea08..94ebc10 100644
--- a/Source/obj/Debug/Rimworld-Animations-Patch.csproj.FileListAbsolute.txt
+++ b/Source/obj/Debug/Rimworld-Animations-Patch.csproj.FileListAbsolute.txt
@@ -3,5 +3,4 @@ C:\Program Files (x86)\Steam\SteamApps\common\RimWorld\Mods\rimworld-animations-
C:\Program Files (x86)\Steam\SteamApps\common\RimWorld\Mods\rimworld-animations-patch-abscon\1.3\Assemblies\Rimworld-Animations-Patch.pdb
C:\Program Files (x86)\Steam\SteamApps\common\RimWorld\Mods\rimworld-animations-patch-abscon\Source\obj\Debug\Rimworld-Animations-Patch.dll
C:\Program Files (x86)\Steam\SteamApps\common\RimWorld\Mods\rimworld-animations-patch-abscon\Source\obj\Debug\Rimworld-Animations-Patch.pdb
-C:\Program Files (x86)\Steam\SteamApps\common\RimWorld\Mods\rimworld-animations-patch-abscon\Source\obj\Debug\Rimworld-Animations-Patch.csproj.CopyComplete
C:\Program Files (x86)\Steam\SteamApps\common\RimWorld\Mods\rimworld-animations-patch-abscon\Source\obj\Debug\Rimworld-Animations-Patch.csprojAssemblyReference.cache
diff --git a/Source/obj/Debug/Rimworld-Animations-Patch.csprojAssemblyReference.cache b/Source/obj/Debug/Rimworld-Animations-Patch.csprojAssemblyReference.cache
index c5787c4..2ad85a4 100644
Binary files a/Source/obj/Debug/Rimworld-Animations-Patch.csprojAssemblyReference.cache and b/Source/obj/Debug/Rimworld-Animations-Patch.csprojAssemblyReference.cache differ
diff --git a/Source/obj/Debug/Rimworld-Animations-Patch.dll b/Source/obj/Debug/Rimworld-Animations-Patch.dll
index 2212931..7039ed8 100644
Binary files a/Source/obj/Debug/Rimworld-Animations-Patch.dll and b/Source/obj/Debug/Rimworld-Animations-Patch.dll differ
diff --git a/Source/obj/Debug/Rimworld-Animations-Patch.pdb b/Source/obj/Debug/Rimworld-Animations-Patch.pdb
index a160924..b5f2831 100644
Binary files a/Source/obj/Debug/Rimworld-Animations-Patch.pdb and b/Source/obj/Debug/Rimworld-Animations-Patch.pdb differ