边缘世界 RimWorld

边缘世界 RimWorld

Intimacy - A Lovin' Expansion
此主题已被锁定
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; } } }
最后由 Crewsayter 编辑于; 8 月 6 日 下午 5:36
< >
正在显示第 1 - 4 条,共 4 条留言
turkler  [开发者] 8 月 8 日 上午 3:18 
引用自 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
Crewsayter 8 月 8 日 上午 4:53 
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  [开发者] 8 月 8 日 上午 5:05 
引用自 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
最后由 turkler 编辑于; 8 月 10 日 上午 5:18
turkler  [开发者] 8 月 8 日 上午 6:02 
just for the record, the actual solution to this problem was patching onto PawnRenderTree's AdjustParms function
< >
正在显示第 1 - 4 条,共 4 条留言
每页显示数: 1530 50