diff --git a/JotunnModStub/Furling/FurlingFireAbility.cs b/JotunnModStub/Furling/FurlingFireAbility.cs index 1d4d87f..bf6079b 100644 --- a/JotunnModStub/Furling/FurlingFireAbility.cs +++ b/JotunnModStub/Furling/FurlingFireAbility.cs @@ -22,11 +22,14 @@ namespace RacesOfValheim private static readonly int BurningHash = "Burning".GetStableHashCode(); private const float BURN_DURATION = 999f * 60f; // 999 minutes in seconds - // ─── Called from FurlingRace.Update() — cheap check, no timer ──────── + // ─── Called from FurlingRace.Update() for every race — cheap check, no timer ──────── public static void Tick() { - if (Player.m_localPlayer == null || !FurlingRace.IsFurling()) + if (Player.m_localPlayer == null) return; + + if (!FurlingRace.IsFurling()) { + RemovePermanentBurning(Player.m_localPlayer); _burningApplied = false; _lastState = -1; return; @@ -36,6 +39,7 @@ namespace RacesOfValheim if (state < 8) { + RemovePermanentBurning(Player.m_localPlayer); _burningApplied = false; _lastState = state; return; @@ -73,6 +77,26 @@ namespace RacesOfValheim } } + /// + /// Puts out the fire this ability lit, and only that one. + /// + /// It is vanilla's own Burning, so it outlived the race: FurlingRace.Update used to return + /// before calling Tick for anyone who was not a Furling, and ResetRace never listed it. A + /// player who changed race kept burning for 999 minutes, with no immunity and no hidden + /// icon, and brought the same fire back if they picked the Furling again. + /// + /// The duration tells ours apart. Real fire lasts seconds, so a Burning longer than an hour + /// can only be the one set above; a player standing in a campfire keeps theirs. + /// + public static void RemovePermanentBurning(Player player) + { + SEMan seman = player != null ? player.GetSEMan() : null; + if (seman == null) return; + + StatusEffect se = seman.GetStatusEffect(BurningHash); + if (se != null && se.m_ttl > 3600f) seman.RemoveStatusEffect(BurningHash, true); + } + // ─── Hide Burning icon from HUD ─────────────────────────────────────── [HarmonyPatch(typeof(SEMan), "GetStatusEffects")] public static class FurlingFire_HideHUDBurning_Patch diff --git a/JotunnModStub/Furling/FurlingRace.cs b/JotunnModStub/Furling/FurlingRace.cs index da3c59d..dfd3c0c 100644 --- a/JotunnModStub/Furling/FurlingRace.cs +++ b/JotunnModStub/Furling/FurlingRace.cs @@ -67,9 +67,9 @@ namespace RacesOfValheim private void Update() { - if (!IsFurling()) return; - - // Through Fire and Flames (Fader) + // Through Fire and Flames (Fader). Ticked for every race, not only the Furling: a + // player who stops being a tier 8 Furling has to lose the fire, and nothing else would + // be left running to notice. FurlingFireAbility.Tick(); } } diff --git a/JotunnModStub/RacesOfValheim.cs b/JotunnModStub/RacesOfValheim.cs index 630923b..2803f51 100644 --- a/JotunnModStub/RacesOfValheim.cs +++ b/JotunnModStub/RacesOfValheim.cs @@ -150,6 +150,10 @@ namespace RacesOfValheim // this time with nobody left to rename or repaint it. player.GetSEMan().RemoveStatusEffect("Cold".GetStableHashCode()); + // BURNING, the same story: Through Fire and Flames is vanilla's Burning set to 999 + // minutes, and it followed the player onto whatever race came next. + FurlingFireAbility.RemovePermanentBurning(player); + ZNetView nview = player.GetComponent(); if (nview != null && nview.IsValid()) nview.GetZDO().Set("RacesOfValheim_Race", "Human");