Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Male/Female-only genes leave sex-change thoughts on newly-generated pawns #32

Closed
callavico opened this issue Apr 27, 2023 · 6 comments
Closed
Labels
Bug Something isn't working

Comments

@callavico
Copy link
Contributor

Steps to reproduce:

  1. Have a static xenotype with male/female-only genes as endogenes (patch it onto and existing or create a new one via local mod, since custom xenotypes and inheritance at pawn generation are wonky)
  2. During Pawn Generation at game start, or when finding a new pawn of that xenotype, examine it's hediffs and possibly find "was_boy" and "mtf" (for female-only), along with an "upset about sex change" thought.

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.

@vegapnk vegapnk added the Bug Something isn't working label Apr 27, 2023
@vegapnk
Copy link
Owner

vegapnk commented Apr 27, 2023

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.

@vegapnk
Copy link
Owner

vegapnk commented Apr 27, 2023

@callavico , can you try this version out?

RJW-Genes-Hotfix-Issue-32.zip

vegapnk added a commit that referenced this issue Apr 27, 2023
@callavico
Copy link
Contributor Author

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_" hediffs that are used if the pawn is forcibly changed later to determine if they are happy to have "changed back".

I pulled the list of thoughts from RJW itself using Traverse.

dev...callavico:RJW-Genes:genderRestrictionSexThoughts

@vegapnk
Copy link
Owner

vegapnk commented Apr 28, 2023

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.

@callavico
Copy link
Contributor Author

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.

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_" hediffs as well because, as you said, a pawn that spawned as a succubus never "was a boy" so if it is forced male somehow later, it should be a sexchange that it's unhappy with.

@vegapnk
Copy link
Owner

vegapnk commented Apr 28, 2023

I like it!

And I like the notify too. If you prepare a PR I am more than happy to merge it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants