Gay colonists rarely hit on each other

Started by System.Linq, December 27, 2016, 01:49:41 PM

Previous topic - Next topic

System.Linq

Here's the code that governs sexuality from InteractionWorker_RomanceAttempt:


float num7 = (initiator.gender != recipient.gender != (initiator.story.traits.HasTrait(TraitDefOf.Gay) != recipient.story.traits.HasTrait(TraitDefOf.Gay))) ? 1f : 0.15f;


Here's the resultant truth table:

x = Initiator is male
y = Recipient is male
z = Initiator is gay
a = Recipient is gay

When s is true, pawns will hit on each other. When z^a is true, only one of them is gay. When it's false, both of them are straight OR (crucially) both of them are gay, as you can see in the final row. The result is that, as in the final row, when both are male and both are gay, both get the reduced 15% rate to hit on each other.

This bug means that gay colonists are once again doomed to hit endlessly on straight colonists (and straight colonists will hit on gay colonists if they find them attractive, ironically), but two gay people will very rarely end up together. This does not seem like intended behavior, more likely an unforeseen consequence of trying to adopt an elegant equation to govern straight-gay interaction.

It should look like this:


float num7 = (initiator.gender == recipient.gender) ? ((initiator.story.traits.HasTrait(TraitDefOf.Gay)) ? 1f : 0.15f) : ((!initiator.story.traits.HasTrait(TraitDefOf.Gay)) ? 1f : 0.15f);

Tynan

Tynan Sylvester - @TynanSylvester - Tynan's Blog

ison