Closed callavico closed 1 year ago
Hi @callavico , thanks for the report!
I noticed the thought too, it's new from RJW 5.3.4 and Taleirs cleanups, which don't break things, but actually I think it was slightly off before.
In general I like that they get the thought when the gene is added mid-game, but yes I think on birth / spawn they should not have it.
I am not 100% sure if the check for endogene covers all cases. I will have a short check if Pawn.spawned
achieves the same behavior, I will drop another message a bit later.
@callavico , can you try this version out?
I am pretty sure that there's no way other than devmode (which like... fair) to add an endogene after a pawn is generated. That's the point of endogenes. Endogenes are generated at birth and can't be changed, and represent the way the pawn is supposed to have been from birth.
If you want to proceed with this path though, then there are more than just m2f and f2m thoughts. Pawns can spawn as none, trap, or futa, and get corresponding "2f"/"2m" thoughts which should be removed. There's also a set of "was_
I pulled the list of thoughts from RJW itself using Traverse.
https://github.com/vegapnk/RJW-Genes/compare/dev...callavico:RJW-Genes:genderRestrictionSexThoughts
Good Morning @callavico ,
yes sorry I was a bit unclear. The issue I have with "just" checking for endogenes is that the thoughts also appear for xenogenes when the xenogene was added "before game". E.g. you create a succubus in colony creation and the spawned pawn has the m2f
hediff.
So my approach is to check if the pawn was spawned when the gene was added, in the good faith that "fixed gender pawns that spawn on the map are contempt with their gender". That catches the xenogenes and xenotypes too. That is also a bit more robust, because yes endogenes can only be inherited vanilla but once people use mods it's the wild west.
But you are right, I have to check for the futa and none thoughts too, I just .... first have to check if they appear 😄
Have you checked the zip
? If the behavior works for you then I just slap the ones for futas in too and close things here.
I see what you mean. I was thinking in the other direction, that you were saying there were times that there were endogenes which weren't added at spawn time.
I had originally written a version that added a patch for PawnGenerator.SpawnGenes that removed the thoughts when that method ran. Do you want to take a look at that version?
It is guaranteed to remove the thoughts from any pawn that has the gene added at the time that the Pawn generates. I had originally worked it this way because it feels cleaner to just straight remove them when they are created, and adding the notify method could potentially be re-used elsewhere. It's more invasive, but it also doesn't rely on guessing which situations should have them removed, it just does it if the gene is there at generation-time.
https://github.com/vegapnk/RJW-Genes/compare/dev...callavico:RJW-Genes:notifyOnPawnGeneration
I didn't try your method, but it would definitely work to catch the cases that are relevant: where the pawn is not yet on the map when the gene is added, or when the pawn is a baby. Those are the two immediately evident cases.
If you extend the list of hediffs you're looking for to remove, your solution would work in all cases, for sure. I'd still recommend removing the "was_
I like it!
And I like the notify too. If you prepare a PR I am more than happy to merge it.
Steps to reproduce:
Expected: Pawns wouldn't have sex-change thoughts about genders that they never were (and are incapable of being by gene).
Proposed fix: During AdjustPawnToFemale/Male we can check if the pawn has the gene as an endogene or xenogene. If endogene, we can clear the sexchange thoughts, since the assumption would be that the pawn had that gene from birth and thus never was a different gender.
I have code that does this my local, and I've been playing with it for a few days. I tested pawns at pawn generation as well as children inheriting the gene with it as an endogene, and used god mode to add the gene as a xenogene to a pawn, and everything worked as expected (the xenos with the gene as an endogene didn't get sexchange thoughts even if they spawned as male and then were forced female, and the pawn who had it added as a xenogene did get the sexchange thought).
I can send a PR if you'd like, but before I take the time to clean the code up and do the legwork of making the PR itself, I wanted to see if you agreed with this change at all.