コード例 #1
0
 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);
 }
コード例 #2
0
 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);
     }
 }
コード例 #3
0
 static bool Prefix(ref bool __result, Pawn predator, Pawn prey)
 {
     if (GMT_Animal_Friend_Helper.ShouldBeFriendly(predator, prey))
     {
         __result = false;
         return(false);
     }
     return(true);
 }
コード例 #4
0
 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);
 }
コード例 #5
0
 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);
 }
コード例 #6
0
 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);
 }