static bool Prefix(Verb __instance, ref bool __result, LocalTargetInfo target) { if (GMT_Animal_Friend_Helper.isHarmfulVerb(__instance) && GMT_Animal_Friend_Helper.ShouldBeFriendly(__instance.Caster, target.Thing)) { __result = false; return(false); } return(true); }
static void Postfix(ref bool __result, Thing a, Thing b) { // Only interested in turning hostility into nonhostility if (__result) { // If one is an animal, and the other is an animal friend, change the result to false __result = !GMT_Animal_Friend_Helper.ShouldBeFriendly(a, b); } }
static bool Prefix(ref bool __result, Pawn predator, Pawn prey) { if (GMT_Animal_Friend_Helper.ShouldBeFriendly(predator, prey)) { __result = false; return(false); } return(true); }
static bool Prefix(bool __result, Pawn pawn, Thing t) { if (GMT_Animal_Friend_Helper.ShouldBeFriendly(pawn, t)) { __result = false; Verse.AI.JobFailReason.Is("Garthor_CannotHarmAnimals".Translate(), null); return(false); } return(true); }
static bool Prefix(Thing __instance, DamageInfo dinfo, float totalDamageDealt) { if (totalDamageDealt > 0.0f && GMT_Animal_Friend_Helper.ShouldBeFriendly(__instance, dinfo.Instigator)) { if (dinfo.Def.defName != "ExecutionCut") { (dinfo.Instigator as Pawn)?.needs?.mood?.thoughts?.memories?.TryGainMemory(GMT_DefOf.GMT_Animal_Friend_Hurt_Animal, (__instance as Pawn)); } } return(true); }
static bool Prefix(ref Action __result, Pawn pawn, LocalTargetInfo target, out string failStr) { if (GMT_Animal_Friend_Helper.ShouldBeFriendly(pawn, target.Thing)) { failStr = "GMT_CannotHarmAnimals".Translate(); __result = null; return(false); } failStr = ""; return(true); }