Merge branch 'master' into 'master'

checking if the soliciting memory is related to the correct pawns during whoring hookup attempts + logs

See merge request Ed86/rjw-whoring!4
This commit is contained in:
Ed86 2023-11-27 10:43:54 +00:00
commit 44e5961507
2 changed files with 40 additions and 4 deletions

View File

@ -19,6 +19,23 @@ namespace rjwwhoring
return val == null ? false : true;
}
public static Thought_Memory GetMemory(Pawn pawn, Pawn target, ThoughtDef thought)
{
Thought_Memory val = pawn.needs.mood.thoughts.memories.Memories.Find(
(Thought_Memory x) =>
{
if (x.def != thought)
return false;
if (x.otherPawn == null || x.otherPawn != target)
return false;
return true;
}
);
return val;
}
//[SyncMethod]
private static bool Roll_to_skip(Pawn client, Pawn whore)
{
@ -185,10 +202,29 @@ namespace rjwwhoring
//if (RJWSettings.DebugWhoring) ModLog.Message($" number of clients can memory OK {guestsSpawned.Count()}");
IEnumerable<Pawn> guestsSpawned = valid_targets.Where(x => x.Faction != whore.Faction
&& !MemoryChecker(x, ThoughtDef.Named("RJWFailedSolicitation"))
&& WhoringHelper.CanAfford(x, whore, priceOfWhore)
&& x != LovePartnerRelationUtility.ExistingLovePartner(whore));
List<Pawn> guestsSpawned = new List<Pawn>();
foreach(Pawn x in valid_targets)
{
bool canAfford = WhoringHelper.CanAfford(x, whore, priceOfWhore);
Thought_Memory refusedMmeory = GetMemory(x, whore, ThoughtDef.Named("RJWFailedSolicitation"));
bool refused = refusedMmeory != null;
DirectPawnRelation relationship = LovePartnerRelationUtility.ExistingLoveRealtionshipBetween(whore, x);
bool relation = relationship != null;
bool differentFaction = x.Faction != whore.Faction;
bool finalResult = canAfford && !refused && !relation && differentFaction;
if (WhoringBase.DebugWhoring)
{
ModLog.Message($"Pawn {x.Name} is an {(finalResult ? "acceptable" : "unacceptable")} client for {whore.Name}. Explanation: canAfford {canAfford.ToString()} refused: {refused.ToString()} relation: {relation.ToString()} differentFaction: {differentFaction.ToString()}");
}
if (canAfford && !refused && !relation && differentFaction)
guestsSpawned.Add(x);
}
if (guestsSpawned.Any())
{