ID:1807753
 
Resolved
Setting an atom's luminosity to values past 7 caused gender benders.
BYOND Version:507
Operating System:windows server 2012
Web Browser:Firefox 31.0
Applies to:Dream Daemon
Status: Resolved (507.1275)

This issue has been resolved.
Descriptive Problem Summary:
Seems female humans have gender dysphoria, they will get their gender variable changed by something other than runtime code. I changed every thing in the code to set gender using the setgender proc, it is supposed to runtime and cry when somebody tries to change my human into an IT, they, xir or transfat thing, yet the issue still occurs without anything showing up in the runtime log.

Numbered Steps to Reproduce Problem:
Its hit or miss when it will happen.
Code Snippet (if applicable) to Reproduce Problem:
/datum/proc/setGender(gend = FEMALE)
if(!("gender" in vars))
CRASH("Oh MODERATOR EDIT the [src] doesn't have a gender variable.")
if(ishuman(src))
ASSERT(gend != PLURAL && gend != NEUTER)
src:gender = gend

/mob/living/carbon/human/setGender(gend = FEMALE)
if(gend == PLURAL || gend == NEUTER || (gend != FEMALE && gend != MALE))
CRASH("SOMEBODY SET A BAD GENDER ON [src] [gend]")
src.prev_gender = src.gender
src.gender = gend
testing("Set [src]'s gender to [gend], old gender [prev_gender]")


Expected Results:
A human will never get their gender set to something not MALE or FEMALE(sorry i'm cisgendered scum I know)
Actual Results:
Something is setting the gender that is not using this proc.

Does the problem occur:
Every time? Or how often?
It happens mostly with turning females into ITs

When does the problem NOT occur?
Seems males dont have gender dysphoria
Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.)

Workarounds:

I don't entirely follow this bug report, but this sounds to me more like a Developer Help issue. I'd be hugely surprised if this wasn't a bug in your code somewhere. It seems likely that the gender var is being altered by something other than this code--so maybe there's other code that sets the gender var, or can set vars generically.

Another thing to look for is if this datum is getting saved or loaded anywhere. It's possible that you're seeing old datums being loaded from before the time you implemented any sanity checks.

I also had to edit your report because you used the N word in your code. Dude, seriously? There's no excuse for that on the forum. I don't care if it's something that slipped through a copy-paste without you realizing it--what's it doing in your code in the first place? That isn't acceptable.
Only reason It seems like a byond issue is there is no code that is changing humans into a gender other than male or famel, and if there was it should be caught by the proc in my OP.
Gender comes from two Appearance flags, which means if it's breaking due to some kind of corruption, you should also see oddities in opacity, density, and luminosity. Probably non-bitflag vars in the Appearance would be impacted as well.

If there's no corruption happening, then I think the most likely issue is that you do indeed have other code affecting this. Given that this looks suspiciously like SS13 code, I'd be shocked if there weren't other ways to change the mob's gender.
In response to Lummox JR
two Appearance flags

Can you school me on this? and yeah its ss13 code but i've gone through the entire repository and gender is only set on normal human players on joining the round, having a sex change surgery done on them, or from genetics. And all of that calls setGender(newgender)


There's really nothing to tell. Internally, all atoms handle gender as two bits in their Appearance. If the Appearance is being corrupted there should be other telltales, especially to other values that are implemented as bitflags.

I strongly suggest adding some debug info to look at the other vars I suggested, or even just dumping all the vars any time you run across a human whose gender is broken. That will help tell us if the problem is more of a one-off affecting only the gender var (which would point to a code problem) or something else.

The main thing of interest that says a bug is still a possibility is that you mentioned this seems to only happen to females becoming neuter. The bitflags are basically like this:

0 - neuter
1 - male
2 - female
3 - plural

The female bit being turned off would be consistent with your report.
We have this issue on tgstation13 as well.

It seemed to have came about when nothing touched mob code, around the same time as vgstation13 (pomf's code base).

So signs point to it being a byond thing. (most likely a overflow/underflow in appearance from something else getting assigned).

Can we get a list of everything stored in the mob's internal appearance variable so we can start hunting down what might overflowing/underflowing for you?

What it might also be is a internal bitwise operation just flat out operating on the wrong bit.
A wrong-bit operation is unlikely. Appearance refcount errors could potentially be an issue if the game is running in 506 instead of 507, but it's unlikely. In 507 I don't know what could cause it.
https://github.com/tgstation/-tg-station/issues/7510

Caused by luminosity overflowing into gender, which is the next variable stored in memory
Lummox JR resolved issue with message:
Setting an atom's luminosity to values past 7 caused gender benders.
Not gonna lie, "dixels" made me laugh.
Gender dysphoria from exposure to bright lights, good shit.
Setting an atom's luminosity to values past 7 caused gender benders.

This has got to be the funniest change note in BYOND history.