This commit is contained in:
AbstractConcept 2022-09-30 22:51:09 -05:00
parent 3e8476ce8a
commit d18d422a94
15 changed files with 68 additions and 39 deletions

View File

@ -55,8 +55,13 @@ Here's a brief overview of whats included in this mod
A full list of changes can be found in the main discussion thread on the forum
Known conflicts
Known issues
- This mod requires that you run RimWorld Animations v 1.2.8 or later, otherwise animations will result in errors
- If you plan to use this mod's apparel cropping feature and the Sized Apparel mod, you must turn off texture caching or graphical glitches will occur (this can be done by adding Vanilla Expanded Framework to your mod list and enabling its 'Disable Texture Caching' setting)
- Using Dubs Apparel Tweaks or the Show Hair mod may result in hair rendering over hats during animations
- To avoid certain graphical issues, Dubs Apparel Tweaks should be loaded before this mod while Babies and Children should be loaded after (if you choose to use them). This will mean that you will not be able to run this mod with Dubs Apparel Tweaks and Babies and Children running at the same time
- Using Speak Up and Dirty Talk results in warning messages being posted in the log. This does not seem to be causing problems in their function, however. This issue will be monitored
- This mod tweaks pretty much every animation involving humans, so it isn't currently compatible with the Tory's VoicePatch mod (unsupported animations will have no voices played)
- This mod will result in graphical errors when using Pawnmorpher's 'Pawn scaling' setting
</description>
</ModMetaData>

View File

@ -1,3 +1,8 @@
Change lob v 1.2.3
- Fix: Fixed a bug which would cause body parts to vanish while a pawn is in a biosculpter pod
- Fix: Fixed a bug which would cause body parts to show while sleeping in a bed
- Fix: Added additional safeguards to help prevent rare errors when equipping certain apparel and when closing the settings menu while in game
Change log v 1.2.2
- Fix: Fix for portraits appearing blank when using the 'crop apparel' feature
- Fix: Underwear counts as covering private parts when determining basic nudity

View File

@ -35,7 +35,7 @@
<autoscale_delta_pos> Auto-scale animation offsets based on body size</autoscale_delta_pos>
<autoscale_delta_pos_desc>Turning this setting on may help when using alien races which are much larger or smaller than regular humans.</autoscale_delta_pos_desc>
<show_hands> Add animated hands to animations</show_hands>
<show_hands_desc>Requires RimNudeWorld.</show_hands_desc>
<show_hands_desc>Requires RimNudeWorld. This feature can be performance intense. If you have large colonies (50+ colonist), you may wish to turn this off.</show_hands_desc>
<redraw_hair> Redraw hair in pawn portraits</redraw_hair>
<redraw_hair_desc>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.</redraw_hair_desc>

View File

@ -28,7 +28,7 @@ namespace Rimworld_Animations_Patch
if (pawn == null)
{ pawn = parent as Pawn; }
if (pawn == null || pawn.Map != Find.CurrentMap || bodyAddon == null) return null;
if (pawn == null || (pawn.Map != Find.CurrentMap && pawn.holdingOwner == null) || bodyAddon == null) return null;
if (isPortrait)
{
@ -56,10 +56,10 @@ namespace Rimworld_Animations_Patch
public void UpdateBodyAddonVisibility()
{
foreach (KeyValuePair<AlienPartGenerator.BodyAddon, BodyAddonData> kvp in bodyAddonData)
{ kvp.Value.UpdateVisibility(); }
{ kvp.Value?.UpdateVisibility(); }
foreach (KeyValuePair<AlienPartGenerator.BodyAddon, BodyAddonData> kvp in bodyAddonDataPortraits)
{ kvp.Value.UpdateVisibility(); }
{ kvp.Value?.UpdateVisibility(); }
}
public void UpdateHands()

View File

@ -21,6 +21,7 @@ namespace Rimworld_Animations_Patch
private string bodyType;
private PawnRenderFlags renderFlags;
private bool canDraw = false;
private bool bodyPartMissing = false;
public BodyAddonData(Pawn pawn, AlienPartGenerator.BodyAddon bodyAddon, bool isPortrait = false)
{
@ -107,42 +108,53 @@ namespace Rimworld_Animations_Patch
public bool CanDraw()
{
return pawn.Drawer.renderer.graphics.apparelGraphics.Any() == false || canDraw;
return bodyPartMissing == false && SitutationalVisibiltyCheck() && (pawn.Drawer.renderer.graphics.apparelGraphics.Any() == false || canDraw);
}
public bool SitutationalVisibiltyCheck()
{
if (pawn == null || bodyAddon == null) return false;
if (pawn.CurrentBed()?.def.building.bed_showSleeperBody == false && bodyAddon.drawnInBed == false)
{ return false; }
if (bodyAddon.backstoryRequirement.NullOrEmpty() == false && pawn.story?.AllBackstories?.Any((Backstory x) => x.identifier == bodyAddon.backstoryRequirement) == false)
{ return false; }
if (bodyAddon.drawnDesiccated == false && pawn.Corpse?.GetRotStage() == RotStage.Dessicated)
{ return false; }
if (pawn.gender == Gender.Female && bodyAddon.drawForFemale == false || pawn.gender == Gender.Male && bodyAddon.drawForMale == false)
{ return false; }
if (bodyAddon.bodyTypeRequirement.NullOrEmpty() == false && pawn.story?.bodyType.ToString() != bodyAddon.bodyTypeRequirement)
{ return false; }
if ((pawn.GetPosture() == PawnPosture.LayingOnGroundNormal || pawn.GetPosture() == PawnPosture.LayingOnGroundFaceUp) && bodyAddon.drawnOnGround == false)
{ return false; }
return true;
}
public void UpdateVisibility()
{
{
if (pawn == null || bodyAddon == null) return;
canDraw = true;
if (pawn.CurrentBed()?.def.building.bed_showSleeperBody == false && bodyAddon.drawnInBed == false)
{canDraw = false; return; }
if (bodyAddon.backstoryRequirement.NullOrEmpty() == false && pawn.story.AllBackstories.Any((Backstory x) => x.identifier == bodyAddon.backstoryRequirement) == false)
{ canDraw = false; return; }
if (bodyAddon.drawnDesiccated == false && pawn?.Corpse?.GetRotStage() == RotStage.Dessicated)
{ canDraw = false; return; }
if (pawn.health.hediffSet.GetNotMissingParts().Contains(bodyPartRecord) == false)
{ canDraw = false; return; }
if (pawn.gender == Gender.Female && bodyAddon.drawForFemale == false || pawn.gender == Gender.Male && bodyAddon.drawForMale == false)
{ canDraw = false; return; }
if (bodyAddon.bodyTypeRequirement.NullOrEmpty() == false && pawn.story.bodyType.ToString() != bodyAddon.bodyTypeRequirement)
{ canDraw = false; return; }
if ((pawn.GetPosture() == PawnPosture.LayingOnGroundNormal || pawn.GetPosture() == PawnPosture.LayingOnGroundFaceUp) && bodyAddon.drawnOnGround == false)
{ canDraw = false; return; }
if (pawn.health?.hediffSet?.GetNotMissingParts()?.Contains(bodyPartRecord) == false)
{ bodyPartMissing = true; return; }
foreach (Apparel apparel in pawn.apparel.WornApparel)
{
CompApparelVisibility comp = apparel.TryGetComp<CompApparelVisibility>();
CompApparelVisibility comp = apparel?.TryGetComp<CompApparelVisibility>();
if (comp == null) continue;
LoadRimNudeData(comp);
if (comp.isBeingWorn == false) continue;
if (bodyAddon.bodyPart == "Genitals" || bodyAddon.bodyPart == "Anus" || bodyAddon.bodyPart == "Chest" || bodyAddon.hediffGraphics?.Any(x => x.path.ToLower().Contains("belly")) == true)
if (bodyAddon.bodyPart == "Genitals" || bodyAddon.bodyPart == "Anus" || bodyAddon.bodyPart == "Chest" || bodyAddon.hediffGraphics?.Any(x => x.path.NullOrEmpty() == false && x.path.ToLower().Contains("belly")) == true)
{
if ((bodyAddon.bodyPart == "Genitals" || bodyAddon.bodyPart == "Anus") && comp.coversGroin)
{ canDraw = false; return; };
@ -150,16 +162,16 @@ namespace Rimworld_Animations_Patch
if (bodyAddon.bodyPart == "Chest" && comp.coversChest)
{ canDraw = false; return; };
if (bodyAddon.hediffGraphics?.Any(x => x.path.ToLower().Contains("belly")) == true && comp.coversBelly)
if (bodyAddon.hediffGraphics?.Any(x => x.path.NullOrEmpty() == false && x.path.ToLower().Contains("belly")) == true && comp.coversBelly)
{ canDraw = false; return; }
}
else
{
if (bodyAddon.hiddenUnderApparelFor?.Any(x => apparel.def.apparel.hatRenderedFrontOfFace == false && apparel.def.apparel.bodyPartGroups.Contains(x)) == true)
if (bodyAddon.hiddenUnderApparelFor?.Any(x => apparel?.def.apparel?.hatRenderedFrontOfFace == false && apparel.def.apparel?.bodyPartGroups?.Contains(x) == true) == true)
{ canDraw = false; return; };
if (bodyAddon.hiddenUnderApparelTag?.Any(x => apparel.def.apparel.hatRenderedFrontOfFace == false && apparel.def.apparel.tags.Contains(x)) == true)
if (bodyAddon.hiddenUnderApparelTag?.Any(x => apparel?.def.apparel?.hatRenderedFrontOfFace == false && apparel.def.apparel?.tags?.Contains(x) == true) == true)
{ canDraw = false; return; };
}
}
@ -167,12 +179,12 @@ namespace Rimworld_Animations_Patch
public void LoadRimNudeData(CompApparelVisibility comp)
{
if (comp == null || comp.rimNudeDataStatus == RimNudeDataStatus.Unavailable)
if (comp?.rimNudeDataStatus == RimNudeDataStatus.Unavailable)
{ return; }
if (comp.rimNudeDataStatus == RimNudeDataStatus.NotLoaded)
if (comp?.rimNudeDataStatus == RimNudeDataStatus.NotLoaded)
{
RimNudeData rimNudeData = ApparelSettings.GetRimNudeData(comp.apparel);
RimNudeData rimNudeData = ApparelSettings.GetRimNudeData(comp?.apparel);
if (rimNudeData == null)
{

View File

@ -94,6 +94,8 @@ namespace Rimworld_Animations_Patch
}
}
}
__instance.pawn.TryGetComp<CompPawnSexData>()?.UpdateBodyAddonVisibility();
}
}
}

View File

@ -109,7 +109,7 @@ namespace Rimworld_Animations_Patch
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;
// Try to draw apparel thrown on ground
if (ApparelSettings.clothesThrownOnGround)
{ ApparelAnimationUtility.TryToDrawApparelOnFloor(pawn); }
@ -142,7 +142,7 @@ namespace Rimworld_Animations_Patch
// Can draw?
bool canDraw = addonGraphic.path.ToLower().Contains("featureless") == false && bodyAddonDatum.CanDraw();
bool drawHand = BasicSettings.showHands && handsAvailableCount > 0 && renderFlags.FlagSet(PawnRenderFlags.Portrait) == false;
if (canDraw == false && drawHand == false)
{ continue; }

View File

@ -86,7 +86,9 @@ namespace Rimworld_Animations_Patch
{
foreach (Pawn pawn in Current.Game.CurrentMap.mapPawns.AllPawns)
{
pawn.Drawer.renderer.graphics.ResolveAllGraphics();
if (pawn == null) continue;
pawn.Drawer?.renderer?.graphics?.ResolveAllGraphics();
pawn.TryGetComp<CompPawnSexData>()?.UpdateBodyAddonVisibility();
PortraitsCache.SetDirty(pawn);

View File

@ -78,7 +78,10 @@ namespace Rimworld_Animations_Patch
{
foreach (Pawn pawn in Current.Game.CurrentMap.mapPawns.AllPawns)
{
pawn.Drawer.renderer.graphics.ResolveAllGraphics();
if (pawn == null) continue;
pawn.Drawer?.renderer?.graphics?.ResolveAllGraphics();
PortraitsCache.SetDirty(pawn);
GlobalTextureAtlasManager.TryMarkPawnFrameSetDirty(pawn);
}