diff --git a/1.2/Assemblies/Rimworld-Animations.dll b/1.2/Assemblies/Rimworld-Animations.dll index 29cbe88..3b9a8b9 100644 Binary files a/1.2/Assemblies/Rimworld-Animations.dll and b/1.2/Assemblies/Rimworld-Animations.dll differ diff --git a/About/About.xml b/About/About.xml index 511dda3..63b1b3c 100644 --- a/About/About.xml +++ b/About/About.xml @@ -28,10 +28,6 @@ https://www.loverslab.com/topic/110270-mod-rimjobworld/ - -
  • velc.HatsDisplaySelection
  • - -
  • UnlimitedHugs.HugsLib
  • brrainz.harmony
  • diff --git a/LoadFolders.xml b/LoadFolders.xml new file mode 100644 index 0000000..1783107 --- /dev/null +++ b/LoadFolders.xml @@ -0,0 +1,8 @@ + + + +
  • /
  • +
  • Patch_HatsDisplaySelection
  • + +
    +
    \ No newline at end of file diff --git a/Patch_HatsDisplaySelection/1.2/Assemblies/Patch_HatsDisplaySelection.dll b/Patch_HatsDisplaySelection/1.2/Assemblies/Patch_HatsDisplaySelection.dll new file mode 100644 index 0000000..743b793 Binary files /dev/null and b/Patch_HatsDisplaySelection/1.2/Assemblies/Patch_HatsDisplaySelection.dll differ diff --git a/Patch_HatsDisplaySelection/Patch_HatsDisplaySelection.csproj b/Patch_HatsDisplaySelection/Patch_HatsDisplaySelection.csproj new file mode 100644 index 0000000..8da21a6 --- /dev/null +++ b/Patch_HatsDisplaySelection/Patch_HatsDisplaySelection.csproj @@ -0,0 +1,75 @@ + + + + + Debug + AnyCPU + {BA766964-1716-422D-A09E-29426F8EB9D5} + Library + Properties + Patch_HatsDisplaySelection + Patch_HatsDisplaySelection + v4.7.2 + 512 + true + + + false + none + false + 1.2\Assemblies\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\..\..\..\..\workshop\content\294100\2009463077\Current\Assemblies\0Harmony.dll + False + + + ..\..\..\RimWorldWin64_Data\Managed\Assembly-CSharp.dll + False + + + ..\..\..\..\..\workshop\content\294100\1542291825\1.2\Assemblies\HatDisplaySelection.dll + False + + + ..\1.2\Assemblies\Rimworld-Animations.dll + False + + + + + + + + + + + ..\..\..\RimWorldWin64_Data\Managed\UnityEngine.dll + False + + + ..\..\..\RimWorldWin64_Data\Managed\UnityEngine.CoreModule.dll + False + + + + + + + + + + + \ No newline at end of file diff --git a/Patch_HatsDisplaySelection/Properties/AssemblyInfo.cs b/Patch_HatsDisplaySelection/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..6905d78 --- /dev/null +++ b/Patch_HatsDisplaySelection/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Patch_HatsDisplaySelection")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Patch_HatsDisplaySelection")] +[assembly: AssemblyCopyright("Copyright © 2021")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("ba766964-1716-422d-a09e-29426f8eb9d5")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Patch_HatsDisplaySelection/Source/Patches/Patch_HatsDisplaySelection.cs b/Patch_HatsDisplaySelection/Source/Patches/Patch_HatsDisplaySelection.cs new file mode 100644 index 0000000..6f00a5a --- /dev/null +++ b/Patch_HatsDisplaySelection/Source/Patches/Patch_HatsDisplaySelection.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using HarmonyLib; +using HatDisplaySelection; +using Rimworld_Animations; +using UnityEngine; +using Verse; + +namespace Patch_HatsDisplaySelection +{ + [HarmonyBefore(new string[] { "velc.HatsDisplaySelection" })] + [HarmonyPatch(typeof(HatDisplaySelection.Patch), "Patch_PawnRenderer_RenderPawnInternal_Initialize")] + public class Patch_HatsDisplaySelectionInitialize + + { + + public static void Prefix(PawnRenderer __instance, ref Pawn ___pawn, ref Vector3 rootLoc, ref float angle, ref Rot4 bodyFacing, ref Rot4 headFacing) + { + + CompBodyAnimator bodyAnim = ___pawn.TryGetComp(); + bodyAnim.animatePawn(ref rootLoc, ref angle, ref bodyFacing, ref headFacing); + } + + public static void Postfix(PawnRenderer __instance) + { + PawnGraphicSet graphics = __instance.graphics; + Pawn pawn = graphics.pawn; + CompBodyAnimator bodyAnim = pawn.TryGetComp(); + + if (!graphics.AllResolved) + { + graphics.ResolveAllGraphics(); + } + + + if (bodyAnim != null && bodyAnim.isAnimating && pawn.Map == Find.CurrentMap) + { + bodyAnim.tickGraphics(graphics); + + + } + } + } +} diff --git a/Rimworld-Animations.csproj b/Rimworld-Animations.csproj index 3699a4f..d5212b6 100644 --- a/Rimworld-Animations.csproj +++ b/Rimworld-Animations.csproj @@ -122,6 +122,7 @@ + \ No newline at end of file diff --git a/Rimworld-Animations.sln b/Rimworld-Animations.sln index f552a93..22bc476 100644 --- a/Rimworld-Animations.sln +++ b/Rimworld-Animations.sln @@ -5,6 +5,8 @@ VisualStudioVersion = 16.0.29905.134 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rimworld-Animations", "Rimworld-Animations.csproj", "{71B05D71-67B2-4014-82CD-18C20AC0882F}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Patch_HatsDisplaySelection", "Patch_HatsDisplaySelection\Patch_HatsDisplaySelection.csproj", "{BA766964-1716-422D-A09E-29426F8EB9D5}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -15,6 +17,10 @@ Global {71B05D71-67B2-4014-82CD-18C20AC0882F}.Debug|Any CPU.Build.0 = Debug|Any CPU {71B05D71-67B2-4014-82CD-18C20AC0882F}.Release|Any CPU.ActiveCfg = Release|Any CPU {71B05D71-67B2-4014-82CD-18C20AC0882F}.Release|Any CPU.Build.0 = Release|Any CPU + {BA766964-1716-422D-A09E-29426F8EB9D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BA766964-1716-422D-A09E-29426F8EB9D5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BA766964-1716-422D-A09E-29426F8EB9D5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BA766964-1716-422D-A09E-29426F8EB9D5}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Source/Comps/CompBodyAnimator.cs b/Source/Comps/CompBodyAnimator.cs index 941c304..a234e38 100644 --- a/Source/Comps/CompBodyAnimator.cs +++ b/Source/Comps/CompBodyAnimator.cs @@ -11,12 +11,12 @@ using Verse; using Verse.Sound; namespace Rimworld_Animations { - class CompBodyAnimator : ThingComp + public class CompBodyAnimator : ThingComp { public Pawn pawn => base.parent as Pawn; public PawnGraphicSet Graphics; - public CompProperties_BodyAnimator Props => (CompProperties_BodyAnimator)(object)base.props; + //public CompProperties_BodyAnimator Props => (CompProperties_BodyAnimator)(object)base.props; public bool isAnimating { get { diff --git a/Source/Comps/CompProperties_BodyAnimator.cs b/Source/Comps/CompProperties_BodyAnimator.cs index cc40925..dd991c1 100644 --- a/Source/Comps/CompProperties_BodyAnimator.cs +++ b/Source/Comps/CompProperties_BodyAnimator.cs @@ -1,4 +1,4 @@ -using System; + using System; using System.Collections.Generic; using System.Linq; using System.Text; diff --git a/Source/Patches/HarmonyPatch_HatsDisplaySelection.cs b/Source/Patches/HarmonyPatch_HatsDisplaySelection.cs index 8139203..d628e8c 100644 --- a/Source/Patches/HarmonyPatch_HatsDisplaySelection.cs +++ b/Source/Patches/HarmonyPatch_HatsDisplaySelection.cs @@ -1,4 +1,4 @@ -/*using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -19,8 +19,34 @@ namespace Rimworld_Animations { (new Harmony("rjw")).Patch(AccessTools.Method(AccessTools.TypeByName("HatDisplaySelection.Patch"), "DrawHatWithHair"), transpiler: new HarmonyMethod(AccessTools.Method(typeof(HarmonyPatch_HatsDisplaySelection), "ReplaceDrawMeshOrLaterWithAnimate"))); + + (new Harmony("rjw")).Patch(AccessTools.Method(AccessTools.TypeByName("HatDisplaySelection.Patch"), "DrawHeadApparelWithHair"), + prefix: new HarmonyMethod(AccessTools.Method(typeof(HarmonyPatch_HatsDisplaySelection), "PrefixPatchForDrawHeadApparelWithHair"))); + + } + public static void PrefixPatchForDrawHeadApparelWithHair(PawnRenderer renderer, ref Vector3 rootLoc, ref float angle, bool renderBody, ref Rot4 bodyFacing, ref Rot4 headFacing, RotDrawMode bodyDrawType, bool portrait, bool headStump, bool invisible) + { + PawnGraphicSet graphics = renderer.graphics; + Pawn pawn = graphics.pawn; + CompBodyAnimator bodyAnim = pawn.TryGetComp(); + + if (!graphics.AllResolved) + { + graphics.ResolveAllGraphics(); + } + + + if (bodyAnim != null && bodyAnim.isAnimating && !portrait && pawn.Map == Find.CurrentMap) + { + bodyAnim.tickGraphics(graphics); + bodyAnim.animatePawn(ref rootLoc, ref angle, ref bodyFacing, ref headFacing); + + } + } + + public static IEnumerable ReplaceDrawMeshOrLaterWithAnimate(IEnumerable instructions) { MethodInfo drawMeshNowOrLater = AccessTools.Method(typeof(GenDraw), "DrawMeshNowOrLater"); @@ -44,4 +70,4 @@ namespace Rimworld_Animations { } } -}*/ +} diff --git a/Source/Patches/HarmonyPatch_PawnRenderer.cs b/Source/Patches/HarmonyPatch_PawnRenderer.cs index bcd521f..82db065 100644 --- a/Source/Patches/HarmonyPatch_PawnRenderer.cs +++ b/Source/Patches/HarmonyPatch_PawnRenderer.cs @@ -51,19 +51,20 @@ namespace Rimworld_Animations { { static HarmonyPatch_Animate() { - /* hats display selection patch -- broken + // hats display selection patch -- broken if (LoadedModManager.RunningModsListForReading.Any(x => x.Name == "Hats Display Selection")) { HarmonyPatch_HatsDisplaySelection.PatchHatsDisplaySelectionArgs(); } else { PatchRimworldFunctionsNormally(); - }*/ + } - PatchRimworldFunctionsNormally(); + //PatchRimworldFunctionsNormally(); } + static void PatchRimworldFunctionsNormally() { (new Harmony("rjw")).Patch(AccessTools.Method(typeof(PawnRenderer), "RenderPawnInternal", parameters: new Type[] {