RimWorld

RimWorld

Intimacy - A Lovin' Expansion
This topic has been locked
If you want it, here's the code to hide helmets while in the middle of lovin'
[HarmonyPatch(typeof(PawnRenderNodeWorker_Apparel_Head))] [HarmonyPatch("HeadgearVisible")] public static class PawnRenderNodeWorker_Apparel_Head_HeadgearVisible_Patch { [HarmonyPostfix] public static void Postfix(PawnDrawParms parms, ref bool __result) { Pawn pawn = parms.pawn; if (pawn?.jobs?.curDriver is JobDriver_Sex { IsCurrentlyLovin: not false }) { __result = false; } if (pawn?.jobs?.curDriver is JobDriver_Sex_Mechanitor { IsCurrentlyLovin: not false }) { __result = false; } } }
Last edited by Crewsayter; Aug 6 @ 5:36pm
< >
Showing 1-4 of 4 comments
turkler  [developer] Aug 8 @ 3:18am 
Originally posted by Crewsayter:
[HarmonyPatch(typeof(PawnRenderNodeWorker_Apparel_Head))] [HarmonyPatch("HeadgearVisible")] public static class PawnRenderNodeWorker_Apparel_Head_HeadgearVisible_Patch { [HarmonyPostfix] public static void Postfix(PawnDrawParms parms, ref bool __result) { Pawn pawn = parms.pawn; if (pawn?.jobs?.curDriver is JobDriver_Sex { IsCurrentlyLovin: not false }) { __result = false; } if (pawn?.jobs?.curDriver is JobDriver_Sex_Mechanitor { IsCurrentlyLovin: not false }) { __result = false; } } }
this is a not only a blatant copy of my PawnRenderNodeWorker_Apparel_Body_CanDrawNow_Patch, I assume you also asked ai to make this version of it because this part:
pawn?.jobs?.curDriver is JobDriver_Sex { IsCurrentlyLovin: not false }
is technically *a* way of checking whether a pawn is doing lovin' but it's such a roundabout way of doing it that no real coder would do that. your if condition can literally just be
job.IsCurrentlyLovin

moreover, if I actually insert your patch into my project, visual studio complains because rimworld uses c# 7.3:
Feature 'not pattern' is not available in C# 7.3. Please use language version 9.0 or greater. Feature 'recursive patterns' is not available in C# 7.3. Please use language version 8.0 or greater.
this goes without saying but no, I'm not going to use ai generated slop that you sent in without even bothering to check whether the code compiled or not
First, yeah it's similar to yours because I was using your code as a base. Second, no it's not AI, but it is what the decompiler spit out as your code when I opened your dll in visual studio. I copied it because that's what I thought you wrote. And you're right, I actually had to change my c# language to 8 for it to compile (and I had to manually edit the project file to get it to 8).

The point though is that whatever code YOU originally used can be put in your own
[HarmonyPatch(typeof(PawnRenderNodeWorker_Apparel_Head))]
[HarmonyPatch("HeadgearVisible")]
to fix the problem. I know it works because I have been using it in my own patch for the last few days (so yeah I have built the solution).

And finally you are right, I'm not a real coder. I got my computer science minor back in 2004 and I haven't done squat with it since. But I am trying to learn by looking at the various mods I use and making tweaks. So cut a guy some slack.
turkler  [developer] Aug 8 @ 5:05am 
Originally posted by Crewsayter:
First, yeah it's similar to yours because I was using your code as a base. Second, no it's not AI, but it is what the decompiler spit out as your code when I opened your dll in visual studio. I copied it because that's what I thought you wrote. And you're right, I actually had to change my c# language to 8 for it to compile (and I had to manually edit the project file to get it to 8).

The point though is that whatever code YOU originally used can be put in your own
[HarmonyPatch(typeof(PawnRenderNodeWorker_Apparel_Head))]
[HarmonyPatch("HeadgearVisible")]
to fix the problem. I know it works because I have been using it in my own patch for the last few days (so yeah I have built the solution).

And finally you are right, I'm not a real coder. I got my computer science minor back in 2004 and I haven't done squat with it since. But I am trying to learn by looking at the various mods I use and making tweaks. So cut a guy some slack.
bro think he a part of the team :lilimjoy:

no, I'm not using your 'solution' which doesn't even compile. I did get a patch targeting the same function and class to compile except that wasn't the solution to the problem either, as pawns render as bald if they're wearing apparel which hides their hair.
like, not only is your provided 'fix' written with the wrong version of c# for rimworld, poorly written in general and doesn't include a message saying you give me unlimited permission to do whatever I want with the contribution, it doesn't even work

''waaa turkler you're being too harsh'' I don't care, you're not doing me a favor by trying to stick your nose into a project. I didn't ask for anyone's help (especially not yours) and so your contribution better be absolutely perfect if you don't want me to laugh you out of the room
Last edited by turkler; Aug 10 @ 5:18am
turkler  [developer] Aug 8 @ 6:02am 
just for the record, the actual solution to this problem was patching onto PawnRenderTree's AdjustParms function
< >
Showing 1-4 of 4 comments
Per page: 1530 50