private static void Postfix(JobDriver_AttackMelee __instance)
        {
            Pawn  caster = ((__instance.GetType()).GetField("pawn").GetValue(__instance) as Pawn);
            Job   job    = ((__instance.GetType()).GetField("job").GetValue(__instance) as Job);
            Thing target = job?.targetA.Thing;

            if (caster != null && target != null && target is Pawn && !caster.Dead)
            {
                WeaponAssingment.chooseOptimalMeleeForAttack(caster, target as Pawn);
            }
        }
Example #2
0
        public static void Postfix(JobDriver_AttackMelee __instance)
        {
            Pawn  caster = __instance.pawn;
            Job   job    = __instance.job;
            Thing target = job?.targetA.Thing;

            if (caster != null && target != null && target is Pawn && !caster.Dead /* && caster.def.race.Humanlike*/)
            {
                WeaponAssingment.chooseOptimalMeleeForAttack(caster, target as Pawn);
            }
        }