37 lines
965 B
C#
Raw Normal View History

2021-12-23 11:37:37 +00:00
using HarmonyLib;
2021-12-23 22:49:02 -08:00
using QSB.EyeOfTheUniverse.GalaxyMap.Messages;
using QSB.Messaging;
2021-12-23 11:37:37 +00:00
using QSB.Patches;
using QSB.Player;
using System.Linq;
2022-03-02 19:46:33 -08:00
namespace QSB.EyeOfTheUniverse.GalaxyMap.Patches;
2023-07-28 19:30:57 +01:00
public class GalaxyMapPatches : QSBPatch
2021-12-23 11:37:37 +00:00
{
2022-03-02 19:46:33 -08:00
public override QSBPatchTypes Type => QSBPatchTypes.OnClientConnect;
[HarmonyPrefix]
[HarmonyPatch(typeof(GalaxyMapController), nameof(GalaxyMapController.OnPressInteract))]
public static bool OnPressInteractPrefix()
2021-12-23 11:37:37 +00:00
{
2022-03-02 19:46:33 -08:00
var allInObservatory = QSBPlayerManager.PlayerList.All(x => x.EyeState == EyeState.Observatory);
2021-12-23 11:37:37 +00:00
2022-03-02 19:46:33 -08:00
if (!allInObservatory)
2021-12-23 11:37:37 +00:00
{
2022-03-02 19:46:33 -08:00
GalaxyMapManager.Instance.Tree.StartConversation();
}
2022-03-02 19:46:33 -08:00
return allInObservatory;
}
[HarmonyPostfix]
[HarmonyPatch(typeof(GalaxyMapController), nameof(GalaxyMapController.OnPressInteract))]
public static void OnPressInteractPostfix()
{
if (QSBPlayerManager.PlayerList.All(x => x.EyeState == EyeState.Observatory))
2021-12-23 11:37:37 +00:00
{
2022-03-02 19:46:33 -08:00
new ZoomOutMessage().Send();
2021-12-23 11:37:37 +00:00
}
}
2021-12-23 19:00:26 +00:00
}