1.0 compatibility
This commit is contained in:
parent
5104f86ede
commit
6193b3ee2d
33 changed files with 712 additions and 49 deletions
|
|
@ -416,6 +416,17 @@ namespace RacesOfValheim
|
|||
{
|
||||
StartCoroutine(RevertMistFormRoutine());
|
||||
}
|
||||
|
||||
// Same rule for a night-only bat: a form the sun forbids cannot be kept through the
|
||||
// sunrise, or the daylight gate above would only be one night's patience away from
|
||||
// meaningless. activeRules is what the transform was actually granted under, so an
|
||||
// Aswid who has killed The Elder (NeedsNight false) keeps flying into the morning.
|
||||
if (IsTransformed && !isTransformingSequence && activeRules != null && activeRules.NeedsNight &&
|
||||
EnvMan.instance != null && EnvMan.IsDay())
|
||||
{
|
||||
Player.m_localPlayer.Message(MessageHud.MessageType.Center, "The morning sun drives the bat back into your body");
|
||||
StartCoroutine(RevertToHumanRoutine());
|
||||
}
|
||||
}
|
||||
|
||||
private string DumpGameObject(GameObject go, string indent)
|
||||
|
|
@ -509,6 +520,17 @@ namespace RacesOfValheim
|
|||
return;
|
||||
}
|
||||
|
||||
// The night gate lives here, not in GetGKeyRules: the rules only say WHETHER night is
|
||||
// required (state 2, Eikthyr) or not (state 3+, The Elder). Nothing ever read the
|
||||
// NeedsNight flag, so an Aswid who had only killed Eikthyr could turn into a bat in
|
||||
// broad daylight. Placed after the revert branch on purpose - a bat caught by the
|
||||
// sunrise must always be able to turn back.
|
||||
if (rules.NeedsNight && (EnvMan.instance == null || !EnvMan.IsNight()))
|
||||
{
|
||||
Player.m_localPlayer.Message(MessageHud.MessageType.Center, "The sun burns. You can only take bat form at night.");
|
||||
return;
|
||||
}
|
||||
|
||||
StartCoroutine(TransformIntoBatRoutine(rules));
|
||||
}
|
||||
|
||||
|
|
@ -524,6 +546,49 @@ namespace RacesOfValheim
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Everything RevertToHumanRoutine does, minus the puff of smoke and the scale animation,
|
||||
/// and without a coroutine - because the one moment this exists for is death, and by then
|
||||
/// Update() has already bailed out on IsDead(), so a coroutine started here would be the
|
||||
/// only thing still running on a corpse.
|
||||
///
|
||||
/// Leaving the form up costs more than a missing animation: m_debugFly stays on, so the
|
||||
/// respawned player floats; Aswid_IsBatForm stays true in the ZDO, so every other client
|
||||
/// keeps drawing a bat over a body that is walking around as a person; and the 5% scale
|
||||
/// stays on the transform. Called from Aswid_BatDiesAsBat_Patch.
|
||||
/// </summary>
|
||||
public void HardResetBatForm()
|
||||
{
|
||||
Player player = Player.m_localPlayer;
|
||||
if (player == null) return;
|
||||
if (!IsTransformed && !isTransformingSequence) return;
|
||||
|
||||
if (currentTransformation != null)
|
||||
{
|
||||
Destroy(currentTransformation);
|
||||
currentTransformation = null;
|
||||
}
|
||||
|
||||
PlayerVisualHider.Show(player.transform.Find("Visual"), "aswid-bat-death-reset");
|
||||
|
||||
if (player.GetSEMan() != null)
|
||||
player.GetSEMan().RemoveStatusEffect("SE_BatForm".GetStableHashCode(), true);
|
||||
|
||||
ZNetView nview = player.GetComponent<ZNetView>();
|
||||
if (nview != null && nview.IsValid())
|
||||
{
|
||||
nview.GetZDO().Set("Aswid_IsBatForm", false);
|
||||
nview.GetZDO().Set(ZDOVars.s_debugFly, false);
|
||||
}
|
||||
Traverse.Create(player).Field("m_debugFly").SetValue(false);
|
||||
|
||||
player.transform.localScale = Vector3.one;
|
||||
|
||||
IsTransformed = false;
|
||||
activeRules = null;
|
||||
isTransformingSequence = false;
|
||||
}
|
||||
|
||||
private System.Collections.IEnumerator TransformIntoBatRoutine(AswidProgression.FormRules rules)
|
||||
{
|
||||
isTransformingSequence = true;
|
||||
|
|
@ -961,7 +1026,7 @@ namespace RacesOfValheim
|
|||
|
||||
// Create an invisible virtual inventory so the food never goes to the real bag
|
||||
Inventory virtualInv = new Inventory("AswidStomach", null, 1, 1);
|
||||
ItemDrop.ItemData addedItem = virtualInv.AddItem(foodPrefab.name, 1, 1, 0, 0, "");
|
||||
ItemDrop.ItemData addedItem = virtualInv.AddItem(foodPrefab.name, 1, 1, 0, 0, "", false);
|
||||
|
||||
if (addedItem != null)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue