Merge branch 'war-vulture' into main

Sverm Ravager Strain (replacing the Stinger Morph), Trenta Elder Root, the
Trol food and Black Forest truce work, and the faction FindEnemy patch.

Conflicts resolved:

- FactionHostilityPatch.cs: both sides added a class at the same spot and
  they cover different holes, so both are kept - FactionStaticTargetPatch
  (main, stops same-faction mobs smashing structures) and
  FactionHuntPlayerPatch (war-vulture, closes the HuntPlayer fall-through).

- RaceCompendium.cs: both branches independently fixed the same off-by-one
  in the Trol's progression gates. Took main's wording, which matches the
  code - Axes are in the melee bonus (TrolDamagePatches sends them to
  m_slash), the 4th food slot has no gate at all, and Yagluth is +5 not +10
  (TrolConfig.YagluthMeleeBonus). Kept war-vulture's two new lines, the
  Kindling fire weakness and the Black Forest truce.

- Package/manifest.json: 1.4.8, which is what the root manifest and
  PluginVersion already said.

RacesOfValheim.cs referenced SvermConfig.StingerSE/StingerCdSE, which
war-vulture renamed to Ravager. Git merged those lines without a conflict
and the result did not compile; renamed.

Also in this commit:

- Factions on/off switches (FactionsConfig): "Faction truce" and "Faction
  merchants", both default on, both read live so they take effect without a
  restart. The truce gates its three postfixes; the merchants gate the
  Character.Awake setup plus every behavioural patch, so turning them off
  drops the prompt and the trade window on mobs already awake.

- SerpentMeat sells for 200 instead of 1 at the Fuling bench, moved to keep
  the list's ascending price order (the sell panel renders it as declared).

- DraughFoodPatches mapped "SerpentMeatRaw", which is not a prefab; the
  internal id is SerpentMeat, so serpent meat never cooked for a Draugh.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Ferdinando 2026-08-25 18:52:10 +02:00
commit 34bdf35325
33 changed files with 1829 additions and 573 deletions

View file

@ -24,12 +24,26 @@ namespace RacesOfValheim
}
}
// The ZDO copy is authoritative once it has been written - but it is written by a
// Player.OnSpawned postfix in ZdoVisualSync that Harmony registers AFTER this race's own
// OnSpawned postfix (type 363 against type 319 in the built assembly), and the player's
// ZDO is a brand new empty one every session. So on every single load there is a window
// where m_customData is the only place the race exists, and returning out of the ZDO
// branch unconditionally made that window answer "not a Trol" - which is what had
// TrolFoodManager.LoadFood wiping the 4th and 5th stomach out of the save file on reload.
//
// Same fix, same reason, as FactionHostilityPatch.GetPlayerRace: only trust the ZDO
// string when it is non-empty. An explicit "Human" written by resetrace IS non-empty and
// still wins over a stale m_customData, which is the behaviour that fix was added for.
public static bool IsTrol()
{
if (Player.m_localPlayer == null) return false;
ZNetView nview = Player.m_localPlayer.GetComponent<ZNetView>();
if (nview != null && nview.IsValid())
return nview.GetZDO().GetString("RacesOfValheim_Race", "") == "Trol";
{
string zdoRace = nview.GetZDO().GetString("RacesOfValheim_Race", "");
if (!string.IsNullOrEmpty(zdoRace)) return zdoRace == "Trol";
}
return Player.m_localPlayer.m_customData.TryGetValue("Race", out string r) && r == "Trol";
}