fix(resetrace): drop every form and every mod status effect on reset
ResetRace now undoes each race's form on the spot before it touches status effects: Aswid bat and mist, Fenrir, Skadi drake, Trol True Form, Trenta Muspell and Sverm Ravager. Each race gets a HardResetForReset that stops the form's coroutine, so a transform caught mid-gesture can't finish after the reset and a revert can't hand out its cooldown after the sweep. The hand-written status effect list is gone. The reset now removes everything the mod registers through Jotunn (ModRegistry), which covers the True Form and its cooldowns, Bat and Mist Form, the Skeleton resurrect cooldown and Skadi's ability cooldowns. It also puts the player and the Visual back to scale 1, clears the Sverm's static Ravager cooldown and the Trol's wasTrueFormActive flag, and prints what it removed to the console and the BepInEx log.
This commit is contained in:
parent
65b488b5dc
commit
d5c2d58636
7 changed files with 336 additions and 37 deletions
|
|
@ -177,7 +177,7 @@ namespace RacesOfValheim
|
|||
|
||||
if (SvermRace.Instance != null)
|
||||
{
|
||||
SvermRace.Instance.StartCoroutine(EnterRoutine(player));
|
||||
formRoutine = SvermRace.Instance.StartCoroutine(EnterRoutine(player));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -342,12 +342,42 @@ namespace RacesOfValheim
|
|||
}
|
||||
}
|
||||
|
||||
// The enter or exit routine in flight, if any, so ResetRace can stop it. An ExitRoutine
|
||||
// left running finishes with Exit(spendCooldown: true), which puts the cooldown back on
|
||||
// after the reset has swept it.
|
||||
private static Coroutine formRoutine;
|
||||
|
||||
/// <summary>
|
||||
/// Drops Ravager Strain on the spot for ResetRace, and forgets its cooldown: nextAllowedAt
|
||||
/// is a static the status effect sweep never touches, so without this a player who left
|
||||
/// the Sverm and came back stayed locked out of the form with no timer in the HUD.
|
||||
/// </summary>
|
||||
/// <returns>True if there was a form to drop.</returns>
|
||||
public static bool HardResetForReset(Player player)
|
||||
{
|
||||
if (player == null) return false;
|
||||
|
||||
if (formRoutine != null && SvermRace.Instance != null)
|
||||
{
|
||||
SvermRace.Instance.StopCoroutine(formRoutine);
|
||||
}
|
||||
formRoutine = null;
|
||||
|
||||
bool hadForm = IsActive || transforming || exiting || model != null;
|
||||
if (IsActive || model != null) Exit(player, spendCooldown: false);
|
||||
|
||||
transforming = false;
|
||||
exiting = false;
|
||||
nextAllowedAt = 0f;
|
||||
return hadForm;
|
||||
}
|
||||
|
||||
/// <summary>Kicks off the graceful exit (shrink, then Exit) if there is a host to run it on.</summary>
|
||||
private static void RunExit(Player player, bool spendCooldown, string message)
|
||||
{
|
||||
if (SvermRace.Instance != null)
|
||||
{
|
||||
SvermRace.Instance.StartCoroutine(ExitRoutine(player, spendCooldown, message));
|
||||
formRoutine = SvermRace.Instance.StartCoroutine(ExitRoutine(player, spendCooldown, message));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue