mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-17 10:14:14 +00:00
fix ghost animators
This commit is contained in:
parent
8733e9f758
commit
77387ffb2a
@ -5,6 +5,7 @@ using QSB.Player;
|
|||||||
using QSB.Player.TransformSync;
|
using QSB.Player.TransformSync;
|
||||||
using QSB.PlayerBodySetup.Remote;
|
using QSB.PlayerBodySetup.Remote;
|
||||||
using QSB.WorldSync;
|
using QSB.WorldSync;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace QSB.EchoesOfTheEye.DreamWorld.Messages;
|
namespace QSB.EchoesOfTheEye.DreamWorld.Messages;
|
||||||
|
|
||||||
@ -57,6 +58,11 @@ internal class EnterDreamWorldMessage : QSBWorldObjectMessage<QSBDreamLanternIte
|
|||||||
foreach (var ghost in QSBWorldSync.GetWorldObjects<QSBGhostBrain>())
|
foreach (var ghost in QSBWorldSync.GetWorldObjects<QSBGhostBrain>())
|
||||||
{
|
{
|
||||||
ghost.OnEnterDreamWorld(player);
|
ghost.OnEnterDreamWorld(player);
|
||||||
|
|
||||||
|
if (QSBPlayerManager.PlayerList.Count(x => x.InDreamWorld) == 1)
|
||||||
|
{
|
||||||
|
ghost.GetEffects().OnSectorOccupantsUpdated();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ using QSB.Messaging;
|
|||||||
using QSB.Player;
|
using QSB.Player;
|
||||||
using QSB.Player.TransformSync;
|
using QSB.Player.TransformSync;
|
||||||
using QSB.WorldSync;
|
using QSB.WorldSync;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace QSB.EchoesOfTheEye.DreamWorld.Messages;
|
namespace QSB.EchoesOfTheEye.DreamWorld.Messages;
|
||||||
|
|
||||||
@ -47,6 +48,11 @@ internal class ExitDreamWorldMessage : QSBMessage
|
|||||||
foreach (var ghost in QSBWorldSync.GetWorldObjects<QSBGhostBrain>())
|
foreach (var ghost in QSBWorldSync.GetWorldObjects<QSBGhostBrain>())
|
||||||
{
|
{
|
||||||
ghost.OnExitDreamWorld(player);
|
ghost.OnExitDreamWorld(player);
|
||||||
|
|
||||||
|
if (QSBPlayerManager.PlayerList.Count(x => x.InDreamWorld) == 0)
|
||||||
|
{
|
||||||
|
ghost.GetEffects().OnSectorOccupantsUpdated();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
using QSB.EchoesOfTheEye.Ghosts.WorldObjects;
|
using QSB.EchoesOfTheEye.Ghosts.WorldObjects;
|
||||||
using QSB.Patches;
|
using QSB.Patches;
|
||||||
|
using QSB.Player;
|
||||||
using QSB.Utility;
|
using QSB.Utility;
|
||||||
using QSB.WorldSync;
|
using QSB.WorldSync;
|
||||||
using System;
|
using System;
|
||||||
@ -69,4 +70,14 @@ internal class GhostEffectsPatches : QSBPatch
|
|||||||
__instance.GetWorldObject<QSBGhostEffects>().Update_Effects();
|
__instance.GetWorldObject<QSBGhostEffects>().Update_Effects();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HarmonyPrefix]
|
||||||
|
[HarmonyPatch(nameof(GhostEffects.OnSectorOccupantsUpdated))]
|
||||||
|
public static bool OnSectorOccupantsUpdated(GhostEffects __instance)
|
||||||
|
{
|
||||||
|
__instance._animator.enabled = __instance._sector.ContainsAnyOccupants(DynamicOccupant.Player | DynamicOccupant.Probe)
|
||||||
|
|| QSBPlayerManager.PlayerList.Any(x => x.InDreamWorld);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user