-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Better handling of default rules - Pawns who have been disallowed new romances should now no longer still try
- Loading branch information
1 parent
a906c90
commit bde66cc
Showing
10 changed files
with
73 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
Source/Patch/RimWorld_InteractionWorker_RomanceAttempt_RandomSelectionWeight.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using Harmony; | ||
using PawnRules.Data; | ||
using RimWorld; | ||
using Verse; | ||
|
||
namespace PawnRules.Patch | ||
{ | ||
[HarmonyPatch(typeof(InteractionWorker_RomanceAttempt), nameof(InteractionWorker_RomanceAttempt.RandomSelectionWeight))] | ||
internal static class RimWorld_InteractionWorker_RomanceAttempt_RandomSelectionWeight | ||
{ | ||
private static bool Prefix(ref float __result, Pawn initiator, Pawn recipient) | ||
{ | ||
if (!Registry.IsActive) { return true; } | ||
|
||
var initiatorCanCourt = Registry.GetRules(initiator)?.AllowCourting ?? true; | ||
var recipientCanCourt = Registry.GetRules(recipient)?.AllowCourting ?? true; | ||
|
||
if (initiatorCanCourt && recipientCanCourt) { return true; } | ||
|
||
__result = 0f; | ||
return false; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using Harmony; | ||
using PawnRules.Data; | ||
using RimWorld; | ||
using Verse; | ||
|
||
namespace PawnRules.Patch | ||
{ | ||
[HarmonyPatch(typeof(PawnGenerator), nameof(PawnGenerator.GeneratePawn), typeof(PawnGenerationRequest))] | ||
internal static class Verse_PawnGenerator_GeneratePawn | ||
{ | ||
private static void Postfix(ref Pawn __result) | ||
{ | ||
if (!Registry.IsActive) { return; } | ||
|
||
if ((__result == null) || ((__result.Faction != Faction.OfPlayer) && (__result.HostFaction != Faction.OfPlayer))) { return; } | ||
|
||
Registry.GetOrDefaultRules(__result); | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters