Exemple #1
0
 public static void PostFix(Pawn __instance, TradeAction action, Pawn playerNegotiator)
 {
     if (action == TradeAction.PlayerSells)
     {
         if (__instance.RaceProps.Humanlike)
         {
             Handler_PawnSold.HandlePawnSold_ByTrade(__instance, playerNegotiator);
         }
     }
 }
Exemple #2
0
        public static void SignalRelevantHandlers(Pawn __instance, TradeAction action, Pawn playerNegotiator)
        {
            if (action != TradeAction.PlayerSells)
            {
                return;
            }

            if (__instance.RaceProps.Humanlike)
            {
                Handler_PawnSold.HandlePawnSold_ByTrade(__instance, playerNegotiator);
            }
        }
Exemple #3
0
        public static bool PreFix(Pawn_RelationsTracker __instance, Pawn playerNegotiator)
        {
            // Find out the underlying pawn of this tracker exhausively
            foreach (Pawn potential in Find.WorldPawns.AllPawnsAlive)
            {
                if (potential.relations == __instance)
                {
                    Handler_PawnSold.HandlePawnSold_ByTrade(potential, playerNegotiator);
                    return(false);
                }
            }

            DesynchronizedMain.LogError("Failed to determine owner of Pawn_RelationsTracker. Falling back to vanilla behavior.");
            return(true);
        }
Exemple #4
0
        public static bool SignalRelevantHandlers(Pawn_RelationsTracker __instance, Pawn playerNegotiator)
        {
            foreach (Pawn potential in Find.WorldPawns.AllPawnsAlive)
            {
                /*
                 * Reversed method for finding the victim.
                 * If RelationsTracker -> pawn does not work, then let's do pawn -> RelationsTracker
                 */
                if (potential.relations == __instance)
                {
                    Handler_PawnSold.HandlePawnSold_ByTrade(potential, playerNegotiator);
                    return(false);
                }
            }

            DesynchronizedMain.LogError("Failed to determine owner of Pawn_RelationsTracker. Falling back to vanilla behavior.");
            return(true);
        }