// Case 1: Mother is Queen, Father is something else. Produce Worker.
if(!hasDroneParent)
{
if(RJW_Genes_Settings.rjw_genes_detailed_debug)ModLog.Message($"{pawn} was born as a worker, as it did not have Drone Father ({100}% chance)");
MakeWorker(pawn,queenDef);
}
// Case 2: Mother is Queen, Father is drone. Apply xenotype as per chance.
else
{
doubleroll=(newRandom()).NextDouble();
// Case 2.a: New Queen born
if(roll<hiveOffspringChanceDef.queenChance)
{
pawn.genes.SetXenotype(queenDef);
if(RJW_Genes_Settings.rjw_genes_detailed_debug)ModLog.Message($"{pawn} born as a new queen with xenotype {queenDef.defName} ({hiveOffspringChanceDef.queenChance * 100}% chance,rolled {roll})");
Find.LetterStack.ReceiveLetter("New Queen","A new Queen was born! Make sure to adress inheritance before the new queen reaches adolesence.",LetterDefOf.BabyBirth,(LookTargets)(Thing)pawn);
if(RJW_Genes_Settings.rjw_genes_detailed_debug)ModLog.Message($"{pawn} born as a new drone with xenotype {droneDef.defName} ({(hiveOffspringChanceDef.droneChance + hiveOffspringChanceDef.queenChance) * 100}% chance,rolled {roll}))");
}
// Case 2.c: Worker
else
{
if(RJW_Genes_Settings.rjw_genes_detailed_debug)ModLog.Message($"{pawn} born as a worker ({(hiveOffspringChanceDef.workerChance) * 100}% chance,rolled {roll}))");
MakeWorker(pawn,queenDef);
}
}
}
/// <summary>
/// Turns a given pawn into a worker, by looking up the relevant genes as per queen.
///
/// If the queen xenotype has no mapping, the "rjw_genes_default_worker_xenotype" are used instead.
/// The genes are added as endogenes, so the worker can still become a xenotype.
/// </summary>
/// <param name="pawnTobeWorker">The pawn for which the genes are added.</param>
/// <param name="queenDef">The xenotype of the queen, used for lookup.</param>