diff --git a/1.3/Assemblies/RJW-Events.dll b/1.3/Assemblies/RJW-Events.dll deleted file mode 100644 index 31c857b..0000000 Binary files a/1.3/Assemblies/RJW-Events.dll and /dev/null differ diff --git a/1.3/Assemblies/Rimworld-Animations-Patch.dll b/1.3/Assemblies/Rimworld-Animations-Patch.dll index e9b46a6..1c13061 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 8e6f46a..0000000 Binary files a/1.3/Assemblies/Rimworld-Animations-Patch.pdb and /dev/null differ diff --git a/About/About.xml b/About/About.xml index ed51e74..4f8d5e5 100644 --- a/About/About.xml +++ b/About/About.xml @@ -27,6 +27,7 @@
  • Dubwise.DubsApparelTweaks
  • +
  • babies.and.children.continued.13
  • UnlimitedHugs.HugsLib
  • @@ -34,8 +35,7 @@
  • rim.job.world
  • c0ffee.rimworld.animations
  • shauaputa.rimnudeworld
  • -
  • OTYOTY.NudePatchForRimNudeWorld.UnofficialUpdate
  • -
  • babies.and.children.continued.13
  • +
  • OTYOTY.NudePatchForRimNudeWorld.UnofficialUpdate
  • This started as a patch for RimWorld-Animation, but has since grown to patch RJW and RimNudeWorld as well diff --git a/About/Changelog_v1.2.3.txt b/About/Changelog_v1.2.4.txt similarity index 95% rename from About/Changelog_v1.2.3.txt rename to About/Changelog_v1.2.4.txt index 535962c..04f8c72 100644 --- a/About/Changelog_v1.2.3.txt +++ b/About/Changelog_v1.2.4.txt @@ -1,6 +1,12 @@ -Change lob v 1.2.3 +Change log v 1.2.4 +- Fix: Fixed an issue with body addons and portraits while pawns are sleeping +- Fix: Fixed an error which occurred when the RJW events mod was not installed +- Change: Added additional support for the Babies for Children mod. This means that you will need to place BnC below the patch in order for it to work correctly. It also means you can run BnC and Dubs apparel tweaks together now if you wish + +Change log 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: Fixed a bug which where body parts would not be hidden after sex was finished - 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 diff --git a/Source/.vs/Rimworld-Animations-Patch/v16/.suo b/Source/.vs/Rimworld-Animations-Patch/v16/.suo index 3cf7175..9851ffb 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 89ebe1e..e4bdb6d 100644 --- a/Source/Rimworld-Animations-Patch.csproj +++ b/Source/Rimworld-Animations-Patch.csproj @@ -8,10 +8,11 @@ Library Rimworld_Animations_Patch Rimworld-Animations-Patch - v4.7.2 + v4.8 512 true true + AnyCPU @@ -48,6 +49,10 @@ ..\..\..\RimWorldWin64_Data\Managed\Assembly-CSharp.dll False + + ..\..\..\..\..\workshop\content\294100\2559574784\1.3\Assemblies\BabiesAndChildren.dll + False + ..\..\..\..\..\workshop\content\294100\836308268\1.3\Assemblies\BadHygiene.dll False @@ -76,6 +81,7 @@ ..\..\rjw-events-master\1.3\Assemblies\RJW-Events.dll + False ..\..\rjw-toys-and-masturbation-master\Assemblies\RJW-ToysAndMasturbation.dll @@ -117,9 +123,11 @@ + + diff --git a/Source/Scripts/Defs/BodyAddonData.cs b/Source/Scripts/Defs/BodyAddonData.cs index 3b20c08..384849a 100644 --- a/Source/Scripts/Defs/BodyAddonData.cs +++ b/Source/Scripts/Defs/BodyAddonData.cs @@ -30,10 +30,10 @@ namespace Rimworld_Animations_Patch if (isPortrait) { renderFlags |= PawnRenderFlags.Portrait; } - - bodyPartRecord = pawn?.def?.race?.body?.AllParts?.FirstOrDefault(x => x.def.defName == bodyAddon?.bodyPart || x.customLabel == bodyAddon?.bodyPart); + + bodyPartRecord = pawn.def?.race?.body?.AllParts?.FirstOrDefault(x => x.def.defName == bodyAddon?.bodyPart || x.customLabel == bodyAddon?.bodyPart); alignsWithHead = bodyAddon.alignWithHead || (bodyPartRecord != null && bodyPartRecord.IsInGroup(BodyPartGroupDefOf.FullHead)); - + GenerateOffsets(); UpdateVisibility(); } @@ -115,7 +115,10 @@ namespace Rimworld_Animations_Patch { if (pawn == null || bodyAddon == null) return false; - if (pawn.CurrentBed()?.def.building.bed_showSleeperBody == false && bodyAddon.drawnInBed == false) + if (renderFlags.FlagSet(PawnRenderFlags.Portrait) == false && pawn.CurrentBed()?.def.building.bed_showSleeperBody == false && bodyAddon.drawnInBed == false) + { return false; } + + if (renderFlags.FlagSet(PawnRenderFlags.Portrait) == false && (pawn.GetPosture() == PawnPosture.LayingOnGroundNormal || pawn.GetPosture() == PawnPosture.LayingOnGroundFaceUp) && bodyAddon.drawnOnGround == false) { return false; } if (bodyAddon.backstoryRequirement.NullOrEmpty() == false && pawn.story?.AllBackstories?.Any((Backstory x) => x.identifier == bodyAddon.backstoryRequirement) == false) @@ -130,26 +133,25 @@ namespace Rimworld_Animations_Patch 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; - + if (pawn == null || bodyAddon == null || bodyPartRecord == null) return; + canDraw = true; if (pawn.health?.hediffSet?.GetNotMissingParts()?.Contains(bodyPartRecord) == false) { bodyPartMissing = true; return; } + if (pawn?.apparel?.WornApparel == null || pawn.apparel.WornApparel.NullOrEmpty()) + { return; } + foreach (Apparel apparel in pawn.apparel.WornApparel) { CompApparelVisibility comp = apparel?.TryGetComp(); if (comp == null) continue; - LoadRimNudeData(comp); if (comp.isBeingWorn == false) continue; diff --git a/Source/Scripts/Patches/HarmonyPatch_BabiesAndChildren.cs b/Source/Scripts/Patches/HarmonyPatch_BabiesAndChildren.cs new file mode 100644 index 0000000..7faf36f --- /dev/null +++ b/Source/Scripts/Patches/HarmonyPatch_BabiesAndChildren.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Verse; +using HarmonyLib; +using BabiesAndChildren; +using BabiesAndChildren.api; + +namespace Rimworld_Animations_Patch +{ + [StaticConstructorOnStartup] + public static class HarmonyPatch_BabiesAndChildren + { + static HarmonyPatch_BabiesAndChildren() + { + try + { + ((Action)(() => + { + if (LoadedModManager.RunningModsListForReading.Any(x => x.PackageIdPlayerFacing == "babies.and.children.continued.13")) + { + (new Harmony("Rimworld_Animations_Patch")).Patch(AccessTools.Method(typeof(AnimationPatchUtility), "ShouldNotDrawAddonsForPawn"), + prefix: new HarmonyMethod(AccessTools.Method(typeof(HarmonyPatch_BabiesAndChildren), "Prefix_ShouldNotDrawAddonsForPawn"))); + (new Harmony("Rimworld_Animations_Patch")).Patch(AccessTools.Method(typeof(AnimationPatchUtility), "GetBodySize"), + prefix: new HarmonyMethod(AccessTools.Method(typeof(HarmonyPatch_BabiesAndChildren), "Prefix_GetBodySize"))); + } + }))(); + } + + catch (TypeLoadException ex) { } + } + + public static bool Prefix_ShouldNotDrawAddonsForPawn(ref bool __result, Pawn pawn) + { + __result = AgeStages.IsYoungerThan(pawn, AgeStages.Child, false); + + return false; + } + + public static bool Prefix_GetBodySize(ref float __result, Pawn pawn) + { + __result = pawn.ShouldBeScaled() ? ChildrenUtility.GetBodySize(pawn) : 1f; + + return false; + } + } +} diff --git a/Source/Scripts/Patches/HarmonyPatch_PawnRenderer.cs b/Source/Scripts/Patches/HarmonyPatch_PawnRenderer.cs index a166f84..84d8ce3 100644 --- a/Source/Scripts/Patches/HarmonyPatch_PawnRenderer.cs +++ b/Source/Scripts/Patches/HarmonyPatch_PawnRenderer.cs @@ -12,7 +12,7 @@ using rjw; namespace Rimworld_Animations_Patch { - [StaticConstructorOnStartup] + /*[StaticConstructorOnStartup] [HarmonyPatch(typeof(PawnRenderer), "RenderPawnInternal", new Type[] { typeof(Vector3), @@ -67,7 +67,7 @@ namespace Rimworld_Animations_Patch } } } - } + }*/ [StaticConstructorOnStartup] [HarmonyPatch(typeof(PawnGraphicSet), "ResolveAllGraphics")] diff --git a/Source/Scripts/Patches/HarmonyPatch_Pawn_ApparelTracker.cs b/Source/Scripts/Patches/HarmonyPatch_Pawn_ApparelTracker.cs index 94475b4..dc1171d 100644 --- a/Source/Scripts/Patches/HarmonyPatch_Pawn_ApparelTracker.cs +++ b/Source/Scripts/Patches/HarmonyPatch_Pawn_ApparelTracker.cs @@ -38,6 +38,4 @@ namespace Rimworld_Animations_Patch __instance?.pawn?.TryGetComp()?.UpdateBodyAddonVisibility(); } } - - } diff --git a/Source/Scripts/Patches/HarmonyPatch_RJWEvents.cs b/Source/Scripts/Patches/HarmonyPatch_RJWEvents.cs new file mode 100644 index 0000000..4f3a569 --- /dev/null +++ b/Source/Scripts/Patches/HarmonyPatch_RJWEvents.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Verse; +using HarmonyLib; +using RJW_Events; + +namespace Rimworld_Animations_Patch +{ + [StaticConstructorOnStartup] + public static class HarmonyPatch_RJWEvents + { + static HarmonyPatch_RJWEvents() + { + try + { + ((Action)(() => + { + if (LoadedModManager.RunningModsListForReading.Any(x => x.PackageIdPlayerFacing == "c0ffee.rjw.events")) + { + (new Harmony("Rimworld_Animations_Patch")).Patch(AccessTools.Method(typeof(ThinkNode_ConditionalNude), "Satisfied"), + prefix: new HarmonyMethod(AccessTools.Method(typeof(HarmonyPatch_RJWEvents), "Postfix_ThinkNode_ConditionalNude_Satisfied"))); + } + }))(); + } + + catch (TypeLoadException ex) { } + } + + public static bool Postfix_ThinkNode_ConditionalNude_Satisfied(ref bool __result, Pawn pawn) + { + if (__result == false && pawn?.apparel?.WornApparel != null) + { + // If 'isBeingWorn' has a value, the apparel has already been checked if it should be discarded + if (pawn.apparel.WornApparel.Any(x => x.TryGetComp() != null && x.TryGetComp().isBeingWorn.HasValue)) + { __result = true; } + } + + return false; + } + } +} diff --git a/Source/Scripts/Patches/HarmonyPatch_Rimworld_Animations.cs b/Source/Scripts/Patches/HarmonyPatch_Rimworld_Animations.cs index 77cd9e4..5c3e632 100644 --- a/Source/Scripts/Patches/HarmonyPatch_Rimworld_Animations.cs +++ b/Source/Scripts/Patches/HarmonyPatch_Rimworld_Animations.cs @@ -95,7 +95,6 @@ namespace Rimworld_Animations_Patch DebugMode.Message("Running animation: " + anim.defName); List pawnsToAnimate = pawn.GetAllSexParticipants(); - Pawn Target = pawn.GetSexReceiver(); foreach (Pawn participant in pawnsToAnimate) { @@ -109,7 +108,9 @@ 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; - + if (AnimationPatchUtility.ShouldNotDrawAddonsForPawn(pawn)) + { return false; } + // Try to draw apparel thrown on ground if (ApparelSettings.clothesThrownOnGround) { ApparelAnimationUtility.TryToDrawApparelOnFloor(pawn); } @@ -168,8 +169,22 @@ namespace Rimworld_Animations_Patch bodyAddonAngle = bodyAddonAngle < 0f ? 360f - (bodyAddonAngle % 360) : bodyAddonAngle % 360f; float combinedAngle = (bodyAngle + bodyAddonAngle) < 0f ? 360f + ((bodyAngle + bodyAddonAngle) % 360) : (bodyAngle + bodyAddonAngle) % 360f; - Vector3 bodyAddonPosition = vector + (bodyAddonDatum.alignsWithHead ? headOffset : Vector3.zero) + bodyAddonDatum.GetOffset(rotation).RotatedBy(angle: bodyAngle); - + Vector3 vector_ = vector; + Vector3 headOffset_ = bodyAddonDatum.alignsWithHead ? headOffset : Vector3.zero; + Vector3 bodyAddonOffset_ = bodyAddonDatum.GetOffset(apparentRotation).RotatedBy(angle: bodyAngle); + + if (pawn.ageTracker.Adult == false) + { + float bodySize = AnimationPatchUtility.GetBodySize(pawn); + addonGraphic.drawSize = new Vector2(1.5f * bodySize, 1.5f * bodySize); // Doesn't seem to be a need to scale by body part draw size (re: Orassians) + + Vector2 multi = AnimationPatchUtility.GetRaceSpecificOffsetMultipliers(pawn, bodyAddon.bodyPart); + bodyAddonOffset_.x *= bodySize * multi.x; + bodyAddonOffset_.z *= bodySize * multi.y; + } + + Vector3 bodyAddonPosition = vector_ + headOffset_ + bodyAddonOffset_; + // Draw the addon if visible if (canDraw) { diff --git a/Source/Scripts/Patches/HarmonyPatch_ThoughtWorkers.cs b/Source/Scripts/Patches/HarmonyPatch_ThoughtWorkers.cs index f0af349..be5997a 100644 --- a/Source/Scripts/Patches/HarmonyPatch_ThoughtWorkers.cs +++ b/Source/Scripts/Patches/HarmonyPatch_ThoughtWorkers.cs @@ -6,25 +6,9 @@ using System.Threading.Tasks; using RimWorld; using Verse; using HarmonyLib; -using RJW_Events; namespace Rimworld_Animations_Patch { - - [HarmonyPatch(typeof(ThinkNode_ConditionalNude), "Satisfied")] - public static class HarmonyPatch_ThinkNode_ConditionalNude - { - public static void Postfix(ref bool __result, Pawn pawn) - { - if (__result == false && pawn?.apparel?.WornApparel != null) - { - // If 'isBeingWorn' has a value, the apparel has already been checked if it should be discarded - if (pawn.apparel.WornApparel.Any(x => x.TryGetComp() != null && x.TryGetComp().isBeingWorn.HasValue)) - { __result = true; return; } - } - } - } - [HarmonyPatch(typeof(ThoughtWorker_Precept_GroinChestHairOrFaceUncovered), "HasUncoveredGroinChestHairOrFace")] public static class HarmonyPatch_ThoughtWorker_Precept_GroinChestHairOrFaceUncovered { diff --git a/Source/Scripts/Utilities/AnimationPatchUtility.cs b/Source/Scripts/Utilities/AnimationPatchUtility.cs index 0425318..453e9f1 100644 --- a/Source/Scripts/Utilities/AnimationPatchUtility.cs +++ b/Source/Scripts/Utilities/AnimationPatchUtility.cs @@ -172,5 +172,43 @@ namespace Rimworld_Animations_Patch return anchor; } - } + + public static bool ShouldNotDrawAddonsForPawn(Pawn pawn) + { + return false; + } + + public static float GetBodySize(Pawn pawn) + { + return 1f; + } + + private static Dictionary raceSpecifocChildMultipliers = new Dictionary() + { + { "Alien_Orassan", new Vector3(1.4f, 1.4f, 1.4f) }, + { "Alien_Cutebold", new Vector3(1.2f, 1f, 1f) }, + }; + + public static Vector2 GetRaceSpecificOffsetMultipliers(Pawn pawn, string bodypart) + { + Vector2 multiplierVector = new Vector2(); + + if (GetBodySize(pawn) == 1f || raceSpecifocChildMultipliers.TryGetValue(pawn.def.defName, out Vector3 raceVector) == false) + { raceVector = new Vector3(1f, 1f, 1f); } + + if (bodypart?.ToLower() == "tail") + { + multiplierVector.x = raceVector.z; + multiplierVector.y = raceVector.x; + } + + else + { + multiplierVector.x = raceVector.y; + multiplierVector.y = raceVector.x; + } + + return multiplierVector; + } + } } diff --git a/Source/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/Source/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache index e79a668..bdbed12 100644 Binary files a/Source/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache and b/Source/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ 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.CoreCompileInputs.cache b/Source/obj/Debug/Rimworld-Animations-Patch.csproj.CoreCompileInputs.cache index 3e3d80b..c13d4d7 100644 --- a/Source/obj/Debug/Rimworld-Animations-Patch.csproj.CoreCompileInputs.cache +++ b/Source/obj/Debug/Rimworld-Animations-Patch.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -3f4f0c89e9095de19b2f487c386783c64b9bb50a +80ac53cd1937a7f3bc413d1816a7df030fc583c6 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 55969fa..e9f773b 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 e9b46a6..1c13061 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 8e6f46a..4ca4542 100644 Binary files a/Source/obj/Debug/Rimworld-Animations-Patch.pdb and b/Source/obj/Debug/Rimworld-Animations-Patch.pdb differ