Revert "debug: log the Ulv's sleep state while the player sits (temporary)"

This reverts commit 2df8264c42.
This commit is contained in:
kanym 2026-10-17 19:09:38 +02:00
commit 4cb6da801b

View file

@ -87,9 +87,7 @@ namespace RacesOfValheim
(hasSleeping ? "sitting puts it to sleep." : "sitting keeps it idle.")); (hasSleeping ? "sitting puts it to sleep." : "sitting keeps it idle."));
} }
} }
bool sitting = IsSitting(player); if (hasSleeping) form.SetBool("sleeping", IsSitting(player));
if (hasSleeping) form.SetBool("sleeping", sitting);
DebugSleep(form, player, sitting);
return grounded; return grounded;
} }
@ -100,31 +98,6 @@ namespace RacesOfValheim
/// never saw it and the Ulv stayed on its feet. Player.StartEmote writes the emote's name on the /// never saw it and the Ulv stayed on its feet. Player.StartEmote writes the emote's name on the
/// ZDO, which every client reads, so this is right for an onlooker's copy as well. /// ZDO, which every client reads, so this is right for an onlooker's copy as well.
/// </summary> /// </summary>
// TEMPORARY DEBUG for the Ulv that will not sleep. Remove with the fix.
private bool lastSitting;
private float nextSleepLog;
private void DebugSleep(Animator form, Player player, bool sitting)
{
if (player == null || player != Player.m_localPlayer) return;
ZNetView nview = player.GetComponent<ZNetView>();
string emote = nview != null && nview.IsValid() ? nview.GetZDO().GetString(ZDOVars.s_emote, "") : "?";
if (sitting != lastSitting)
{
lastSitting = sitting;
Jotunn.Logger.LogInfo($"[SleepDebug] sitting={sitting} IsSitting={player.IsSitting()} emote='{emote}' hasSleeping={hasSleeping}");
}
if (!sitting && emote != "sit") return;
if (Time.time < nextSleepLog) return;
nextSleepLog = Time.time + 1f;
string clip = "?";
var clips = form.GetCurrentAnimatorClipInfo(0);
if (clips.Length > 0 && clips[0].clip != null) clip = clips[0].clip.name;
bool sleepingNow = false;
try { sleepingNow = form.GetBool("sleeping"); } catch {}
Jotunn.Logger.LogInfo($"[SleepDebug] sitting={sitting} emote='{emote}' sleepingBool={sleepingNow} clip='{clip}' " +
$"inTransition={form.IsInTransition(0)} enabled={form.enabled} speed={form.speed}");
}
private static bool IsSitting(Player player) private static bool IsSitting(Player player)
{ {
if (player == null) return false; if (player == null) return false;