diff --git a/JotunnModStub/Factions/FactionsConfig.cs b/JotunnModStub/Factions/FactionsConfig.cs index 332c622..2898c7a 100644 --- a/JotunnModStub/Factions/FactionsConfig.cs +++ b/JotunnModStub/Factions/FactionsConfig.cs @@ -31,13 +31,21 @@ namespace RacesOfValheim { const string factions = "Factions"; + // Key kept as "Faction truce" even though it now covers the per-race truces too: + // renaming it would orphan the entry in every .cfg already written, and an existing + // .cfg beats the default in code - anyone who had switched this off would silently + // get the truce back. HostilityEnabled = config.Bind(factions, "Faction truce", true, - new ConfigDescription("Mobs of your race's faction leave you alone - they will not open a fight, " + + new ConfigDescription("Mobs your race is at peace with leave you alone - they will not open a fight, " + "hunt you during events, or smash structures near you. Turn this off and every " + - "creature treats you exactly as vanilla would. Does not touch the older per-race " + - "truces in RaceHostilityManager (Fenrir, Aswid, Draugh, Trenta), which have no " + - "switch of their own. Hitting a mob still starts a fight either way: retaliation " + - "runs through BaseAI.OnDamaged, which no truce has a say over.")); + "creature treats you exactly as vanilla would. Covers BOTH halves, because both " + + "answer the same BaseAI.IsEnemy and a switch over only one of them changes " + + "nothing for most races: the faction rules in FactionHostilityPatch, and the " + + "per-race passives in RaceHostilityManager - Fenrir's wolves, Aswid's " + + "progression list, the Draugh's undead, the Trenta's Black Forest, the Sverm's " + + "invertebrates. Switching this off gives those five races up along with the " + + "faction truce. Hitting a mob still starts a fight either way: retaliation runs " + + "through BaseAI.OnDamaged, which no truce has a say over.")); MerchantsEnabled = config.Bind(factions, "Faction merchants", true, new ConfigDescription("Certain mobs of your own faction can be traded with - 'E - Talk' opens a shop " + diff --git a/JotunnModStub/Furling/FurlingPatches.cs b/JotunnModStub/Furling/FurlingPatches.cs index 3588c9d..2ba0df5 100644 --- a/JotunnModStub/Furling/FurlingPatches.cs +++ b/JotunnModStub/Furling/FurlingPatches.cs @@ -75,6 +75,7 @@ namespace RacesOfValheim { public static void Postfix(Character a, Character b, ref bool __result) { + if (!FactionsConfig.Hostility) return; if (!__result || !FurlingRace.IsFurling() || Player.m_localPlayer == null) return; Character playerChar = Player.m_localPlayer; diff --git a/JotunnModStub/RaceHostilityManager.cs b/JotunnModStub/RaceHostilityManager.cs index 0b6b261..ae99bc0 100644 --- a/JotunnModStub/RaceHostilityManager.cs +++ b/JotunnModStub/RaceHostilityManager.cs @@ -12,6 +12,12 @@ namespace RacesOfValheim { public static void Postfix(Character a, Character b, ref bool __result) { + // The per-race truces below answer the same BaseAI.IsEnemy the Factions patches do, + // so the switch has to cover both or it covers nothing: a Trenta reads its Greydwarf + // truce from HERE, not from FactionHostilityPatch, and turning the faction one off + // left the mobs friendly anyway. Same flag rather than a second one, because from + // the player's side there is only one question being asked. + if (!FactionsConfig.Hostility) return; if (!__result) return; // If already not enemies, skip if (a == null || b == null) return; diff --git a/JotunnModStub/Skeleton/SkeletonPatches.cs b/JotunnModStub/Skeleton/SkeletonPatches.cs index 1e343f6..fda8d95 100644 --- a/JotunnModStub/Skeleton/SkeletonPatches.cs +++ b/JotunnModStub/Skeleton/SkeletonPatches.cs @@ -702,6 +702,7 @@ namespace RacesOfValheim { public static void Postfix(Character a, Character b, ref bool __result) { + if (!FactionsConfig.Hostility) return; if (!__result || !SkeletonRace.IsSkeleton() || Player.m_localPlayer == null) return; Character playerChar = Player.m_localPlayer;