fix(furling): Through Fire and Flames goes out when the player changes race
The ability is vanilla's Burning set to 999 minutes. FurlingRace.Update returned before ticking it for anyone who was not a Furling, and ResetRace never removed it, so the fire followed the player onto any race and came back visible if they picked the Furling again. The tick now runs for every race and puts out a Burning longer than an hour when the player is not a tier 8 Furling; ResetRace does the same at once.
This commit is contained in:
parent
19d331789a
commit
5af7c0205d
3 changed files with 33 additions and 5 deletions
|
|
@ -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
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
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
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<ZNetView>();
|
||||
if (nview != null && nview.IsValid()) nview.GetZDO().Set("RacesOfValheim_Race", "Human");
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue