Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Source/Client/Patches/Seeds.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Reflection;
using System.Reflection.Emit;
using Multiplayer.Client.Util;
using RimWorld.QuestGen;
using Verse;
using Verse.Grammar;

Expand Down Expand Up @@ -168,6 +169,14 @@ static IEnumerable<MethodBase> TargetMethods()
yield return AccessTools.Method(typeof(GrammarResolver), nameof(GrammarResolver.Resolve));
yield return AccessTools.Method(typeof(PawnBioAndNameGenerator), nameof(PawnBioAndNameGenerator.GeneratePawnName));
yield return AccessTools.Method(typeof(NameGenerator), nameof(NameGenerator.GenerateName), [typeof(RulePackDef), typeof(Predicate<string>), typeof(bool), typeof(string), typeof(string), typeof(List<Rule>)]);
// The GrammarRequest overload holds the validator retry loop and is called directly
// (bypassing the RulePackDef overload above) by quest naming among others; a validator
// rejection count depends on the generated text and therefore on the client's language.
yield return AccessTools.Method(typeof(NameGenerator), nameof(NameGenerator.GenerateName), [typeof(GrammarRequest), typeof(Predicate<string>), typeof(bool), typeof(string), typeof(string)]);
// Quest naming additionally retries whole NameGenerator calls while the name collides
// with an existing quest's name — wrap the outer loop too so quest naming costs exactly
// one synced draw regardless of language or collisions.
yield return AccessTools.Method(typeof(QuestNode_ResolveQuestName), nameof(QuestNode_ResolveQuestName.Resolve));
}

[HarmonyPriority(MpPriority.MpFirst)]
Expand Down
Loading