set up stuff but dont actually implement it yet lol

This commit is contained in:
JohnCorby 2021-12-31 02:52:31 -08:00
parent 2eda59044d
commit 4265b4a58f
5 changed files with 90 additions and 1 deletions

View File

@ -0,0 +1,80 @@
using QSB.Messaging;
using QSB.Player;
using QSB.Player.Messages;
using QSB.WorldSync;
using System.Collections.Generic;
using UnityEngine;
namespace QSB.EyeOfTheUniverse.CosmicInflation
{
internal class InflationManager : WorldObjectManager
{
public static InflationManager Instance { get; private set; }
private readonly List<PlayerInfo> _playersInFog = new();
private CosmicInflationController _controller;
public override WorldObjectType WorldObjectType => WorldObjectType.Eye;
public override void Awake()
{
base.Awake();
Instance = this;
QSBPlayerManager.OnRemovePlayer += OnPlayerLeave;
}
private void OnPlayerLeave(uint id)
{
_playersInFog.Remove(QSBPlayerManager.GetPlayer(id));
if (_playersInFog.Count == QSBPlayerManager.PlayerList.Count)
{
StartCollapse();
}
}
protected override void RebuildWorldObjects(OWScene scene)
{
_playersInFog.Clear();
if (_controller != null)
{
_controller._smokeSphereTrigger.OnEntry -= OnEntry;
}
_controller = FindObjectOfType<CosmicInflationController>();
_controller._smokeSphereTrigger.OnEntry += _controller.OnEnterFogSphere;
_controller._smokeSphereTrigger.OnEntry += OnEntry;
}
private void OnEntry(GameObject hitObj)
{
if (hitObj.CompareTag("PlayerCameraDetector") && _controller._state == CosmicInflationController.State.ReadyToCollapse)
{
_controller._smokeSphereTrigger.SetTriggerActivation(false);
_controller._probeDestroyTrigger.SetTriggerActivation(false);
new EnterLeaveMessage(EnterLeaveType.EnterCosmicFog).Send();
// the pausing and stuff happens here
}
}
public void Enter(PlayerInfo player)
{
_playersInFog.Add(player);
if (_playersInFog.Count == QSBPlayerManager.PlayerList.Count)
{
StartCollapse();
}
}
private void StartCollapse()
{
// the actual collapsing happens here
}
}
}

View File

@ -14,6 +14,8 @@ namespace QSB.EyeOfTheUniverse.CosmicInflation.Patches
[HarmonyPatch(typeof(CosmicInflationController), nameof(CosmicInflationController.OnEnterFogSphere))]
public static bool OnEnterFogSphere(CosmicInflationController __instance, GameObject obj)
{
return true; // remove this patch later lol
if (obj.CompareTag("PlayerCameraDetector") && __instance._state == CosmicInflationController.State.ReadyToCollapse)
{
__instance._smokeSphereTrigger.SetTriggerActivation(false);

View File

@ -24,6 +24,8 @@ namespace QSB.EyeOfTheUniverse.VesselSync
protected override void RebuildWorldObjects(OWScene scene)
{
_playersInCage.Clear();
if (_warpController != null)
{
_warpController._cageTrigger.OnEntry -= OnEntry;

View File

@ -15,6 +15,7 @@
EnterNomaiHeadZone = 10,
ExitNomaiHeadZone = 11,
EnterVesselCage = 12,
ExitVesselCage = 13
ExitVesselCage = 13,
EnterCosmicFog = 14,
}
}

View File

@ -1,5 +1,6 @@
using OWML.Common;
using QSB.Animation.NPC.WorldObjects;
using QSB.EyeOfTheUniverse.CosmicInflation;
using QSB.EyeOfTheUniverse.VesselSync;
using QSB.Messaging;
using QSB.Player.TransformSync;
@ -103,6 +104,9 @@ namespace QSB.Player.Messages
case EnterLeaveType.ExitVesselCage:
VesselManager.Instance.Exit(player);
break;
case EnterLeaveType.EnterCosmicFog:
InflationManager.Instance.Enter(player);
break;
default:
DebugLog.ToConsole($"Warning - Unknown EnterLeaveType : {Value}", MessageType.Warning);
break;