erdelf / AlienRaces

Rimworld mod alien race framework
MIT License
103 stars 69 forks source link

Races with isFlesh = false getting infection messages #63

Open cnsguy opened 2 years ago

cnsguy commented 2 years ago

Androids from Android Tiers can get a message about their injuries getting infected (but don't get the actual infection). I believe a harmony patch similar to this could get rid of the entire call, so no more annoying messages:

internal class Infection_Patch
{
    [HarmonyPatch(typeof(HediffComp_Infecter), "CheckMakeInfection")]
    class NoInfection_Patch
    {
        [HarmonyPrefix]
        public static bool Prefix(HediffWithComps ___parent)
        {
            if (___parent.pawn.RaceProps.IsFlesh)
                return false;

            return true;
       }
    }
}

Unfortunately from what I could tell, CE overrides CheckMakeInfection, leading to the patch never being called in the first place. If something like this ever gets upstreamed, I'll nag the CE devs about fixing it.