mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-29 18:32:45 +00:00
Merge pull request #427 from misternebula/initial-eye-stuff
add picking up instruments, starting instruments playing
This commit is contained in:
commit
8cf584c48e
@ -6,6 +6,8 @@ namespace QSB.Anglerfish
|
||||
{
|
||||
public class AnglerManager : WorldObjectManager
|
||||
{
|
||||
public override WorldObjectType WorldObjectType => WorldObjectType.SolarSystem;
|
||||
|
||||
public static readonly List<AnglerfishController> Anglers = new();
|
||||
|
||||
protected override void RebuildWorldObjects(OWScene scene)
|
||||
|
@ -1,4 +1,5 @@
|
||||
using QSB.Anglerfish.TransformSync;
|
||||
using QSB.Utility;
|
||||
using QSB.WorldSync;
|
||||
using QuantumUNET;
|
||||
using UnityEngine;
|
||||
@ -17,7 +18,7 @@ namespace QSB.Anglerfish.WorldObjects
|
||||
{
|
||||
if (QSBCore.IsHost)
|
||||
{
|
||||
QNetworkServer.Spawn(Object.Instantiate(QSBNetworkManager.Instance.AnglerPrefab));
|
||||
Object.Instantiate(QSBNetworkManager.Instance.AnglerPrefab).SpawnWithServerAuthority();
|
||||
}
|
||||
|
||||
StartDelayedReady();
|
||||
|
@ -1,11 +1,13 @@
|
||||
using QSB.Animation.NPC.WorldObjects;
|
||||
using QSB.WorldSync;
|
||||
using System.Linq;
|
||||
|
||||
namespace QSB.Animation.NPC
|
||||
{
|
||||
internal class CharacterAnimManager : WorldObjectManager
|
||||
{
|
||||
// im assuming this is used in the eye as well
|
||||
public override WorldObjectType WorldObjectType => WorldObjectType.Both;
|
||||
|
||||
protected override void RebuildWorldObjects(OWScene scene)
|
||||
{
|
||||
QSBWorldSync.Init<QSBCharacterAnimController, CharacterAnimController>();
|
||||
@ -13,6 +15,7 @@ namespace QSB.Animation.NPC
|
||||
QSBWorldSync.Init<QSBSolanumController, NomaiConversationManager>();
|
||||
QSBWorldSync.Init<QSBSolanumAnimController, SolanumAnimController>();
|
||||
QSBWorldSync.Init<QSBHearthianRecorderEffects, HearthianRecorderEffects>();
|
||||
QSBWorldSync.Init<QSBTravelerEyeController, TravelerEyeController>();
|
||||
|
||||
//MOVE : this is the wrong place to put this... move it to Conversations?
|
||||
QSBWorldSync.OldDialogueTrees.Clear();
|
||||
|
@ -15,6 +15,7 @@ namespace QSB.Animation.NPC.WorldObjects
|
||||
public virtual void EndConversation()
|
||||
=> GetDialogueTree().RaiseEvent("OnEndConversation");
|
||||
|
||||
public abstract bool InConversation();
|
||||
public virtual bool InConversation()
|
||||
=> false;
|
||||
}
|
||||
}
|
||||
|
@ -2,9 +2,6 @@
|
||||
{
|
||||
internal class QSBHearthianRecorderEffects : NpcAnimController<HearthianRecorderEffects>
|
||||
{
|
||||
public override bool InConversation()
|
||||
=> AttachedObject._characterDialogueTree.InConversation();
|
||||
|
||||
public override CharacterDialogueTree GetDialogueTree()
|
||||
=> AttachedObject._characterDialogueTree;
|
||||
}
|
||||
|
@ -4,8 +4,5 @@
|
||||
{
|
||||
public override CharacterDialogueTree GetDialogueTree()
|
||||
=> AttachedObject._characterDialogueTree;
|
||||
|
||||
public override bool InConversation()
|
||||
=> AttachedObject._solanumAnimController._animator.GetBool("ListeningToPlayer");
|
||||
}
|
||||
}
|
||||
|
@ -4,8 +4,5 @@
|
||||
{
|
||||
public override CharacterDialogueTree GetDialogueTree()
|
||||
=> AttachedObject._dialogueSystem;
|
||||
|
||||
public override bool InConversation()
|
||||
=> AttachedObject._talking;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,8 @@
|
||||
namespace QSB.Animation.NPC.WorldObjects
|
||||
{
|
||||
internal class QSBTravelerEyeController : NpcAnimController<TravelerEyeController>
|
||||
{
|
||||
public override CharacterDialogueTree GetDialogueTree()
|
||||
=> AttachedObject._dialogueTree;
|
||||
}
|
||||
}
|
@ -5,6 +5,8 @@ namespace QSB.CampfireSync
|
||||
{
|
||||
internal class CampfireManager : WorldObjectManager
|
||||
{
|
||||
public override WorldObjectType WorldObjectType => WorldObjectType.Both;
|
||||
|
||||
protected override void RebuildWorldObjects(OWScene scene)
|
||||
=> QSBWorldSync.Init<QSBCampfire, Campfire>();
|
||||
}
|
||||
|
@ -7,8 +7,8 @@
|
||||
AliveInSolarSystem,
|
||||
DeadInSolarSystem,
|
||||
AliveInEye,
|
||||
WaitingForOthersToDieInSolarSystem,
|
||||
WaitingForOthersToReadyInSolarSystem,
|
||||
WaitingForOthersToDie,
|
||||
WaitingForOthersToBeReady,
|
||||
WatchingLongCredits,
|
||||
WatchingShortCredits
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ namespace QSB.ClientServerStateSync
|
||||
if (oldScene == OWScene.SolarSystem)
|
||||
{
|
||||
// reloading scene
|
||||
newState = ClientState.WaitingForOthersToReadyInSolarSystem;
|
||||
newState = ClientState.WaitingForOthersToBeReady;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -98,21 +98,21 @@ namespace QSB.ClientServerStateSync
|
||||
case OWScene.SolarSystem:
|
||||
if (serverState == ServerState.WaitingForAllPlayersToDie)
|
||||
{
|
||||
newState = ClientState.WaitingForOthersToReadyInSolarSystem;
|
||||
newState = ClientState.WaitingForOthersToBeReady;
|
||||
break;
|
||||
}
|
||||
|
||||
if (oldScene == OWScene.SolarSystem)
|
||||
{
|
||||
// reloading scene
|
||||
newState = ClientState.WaitingForOthersToReadyInSolarSystem;
|
||||
newState = ClientState.WaitingForOthersToBeReady;
|
||||
}
|
||||
else
|
||||
{
|
||||
// loading in from title screen
|
||||
if (serverState == ServerState.WaitingForAllPlayersToReady)
|
||||
{
|
||||
newState = ClientState.WaitingForOthersToReadyInSolarSystem;
|
||||
newState = ClientState.WaitingForOthersToBeReady;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -122,7 +122,14 @@ namespace QSB.ClientServerStateSync
|
||||
|
||||
break;
|
||||
case OWScene.EyeOfTheUniverse:
|
||||
newState = ClientState.WaitingForOthersToReadyInSolarSystem;
|
||||
if (serverState == ServerState.WaitingForAllPlayersToReady)
|
||||
{
|
||||
newState = ClientState.WaitingForOthersToBeReady;
|
||||
}
|
||||
else
|
||||
{
|
||||
newState = ClientState.AliveInEye;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
newState = ClientState.NotLoaded;
|
||||
|
@ -128,7 +128,7 @@ namespace QSB.ClientServerStateSync
|
||||
if (_currentState == ServerState.WaitingForAllPlayersToReady)
|
||||
{
|
||||
if (QSBPlayerManager.PlayerList.All(x
|
||||
=> x.State is ClientState.WaitingForOthersToReadyInSolarSystem
|
||||
=> x.State is ClientState.WaitingForOthersToBeReady
|
||||
or ClientState.AliveInSolarSystem
|
||||
or ClientState.AliveInEye))
|
||||
{
|
||||
|
@ -13,6 +13,8 @@ namespace QSB.ConversationSync
|
||||
{
|
||||
public class ConversationManager : WorldObjectManager
|
||||
{
|
||||
public override WorldObjectType WorldObjectType => WorldObjectType.Both;
|
||||
|
||||
public static ConversationManager Instance { get; private set; }
|
||||
public Dictionary<CharacterDialogueTree, GameObject> BoxMappings { get; } = new Dictionary<CharacterDialogueTree, GameObject>();
|
||||
|
||||
|
@ -5,6 +5,9 @@ namespace QSB.EchoesOfTheEye.AirlockSync
|
||||
{
|
||||
internal class AirlockManager : WorldObjectManager
|
||||
{
|
||||
// is this used in the prisoner sequence in the eye?
|
||||
public override WorldObjectType WorldObjectType => WorldObjectType.SolarSystem;
|
||||
|
||||
protected override void RebuildWorldObjects(OWScene scene) => QSBWorldSync.Init<QSBGhostAirlock, GhostAirlock>();
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,9 @@ namespace QSB.EchoesOfTheEye.LightSensorSync
|
||||
{
|
||||
internal class LightSensorManager : WorldObjectManager
|
||||
{
|
||||
// see AirlockManager question
|
||||
public override WorldObjectType WorldObjectType => WorldObjectType.SolarSystem;
|
||||
|
||||
protected override void RebuildWorldObjects(OWScene scene) => QSBWorldSync.Init<QSBSingleLightSensor, SingleLightSensor>();
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,8 @@ namespace QSB.ElevatorSync
|
||||
{
|
||||
public class ElevatorManager : WorldObjectManager
|
||||
{
|
||||
public override WorldObjectType WorldObjectType => WorldObjectType.SolarSystem;
|
||||
|
||||
protected override void RebuildWorldObjects(OWScene scene)
|
||||
=> QSBWorldSync.Init<QSBElevator, Elevator>();
|
||||
}
|
||||
|
@ -106,5 +106,6 @@
|
||||
public const string QSBRequestGameDetails = nameof(QSBRequestGameDetails);
|
||||
public const string QSBGameDetails = nameof(QSBGameDetails);
|
||||
public const string QSBEnterRemoteDialogue = nameof(QSBEnterRemoteDialogue);
|
||||
public const string QSBGatherInstrument = nameof(QSBGatherInstrument);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,29 @@
|
||||
using QSB.Events;
|
||||
using QSB.EyeOfTheUniverse.InstrumentSync.WorldObjects;
|
||||
using QSB.WorldSync;
|
||||
using QSB.WorldSync.Events;
|
||||
|
||||
namespace QSB.EyeOfTheUniverse.InstrumentSync.Event
|
||||
{
|
||||
internal class GatherInstrumentEvent : QSBEvent<WorldObjectMessage>
|
||||
{
|
||||
public override bool RequireWorldObjectsReady => true;
|
||||
|
||||
public override void SetupListener() => GlobalMessenger<QSBQuantumInstrument>.AddListener(EventNames.QSBGatherInstrument, Handler);
|
||||
public override void CloseListener() => GlobalMessenger<QSBQuantumInstrument>.RemoveListener(EventNames.QSBGatherInstrument, Handler);
|
||||
|
||||
private void Handler(QSBQuantumInstrument instrument) => SendEvent(CreateMessage(instrument));
|
||||
|
||||
private BoolWorldObjectMessage CreateMessage(QSBQuantumInstrument instrument) => new()
|
||||
{
|
||||
AboutId = LocalPlayerId,
|
||||
ObjectId = instrument.ObjectId
|
||||
};
|
||||
|
||||
public override void OnReceiveRemote(bool isHost, WorldObjectMessage message)
|
||||
{
|
||||
var qsbObj = QSBWorldSync.GetWorldFromId<QSBQuantumInstrument>(message.ObjectId);
|
||||
qsbObj.AttachedObject.Gather();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
using HarmonyLib;
|
||||
using QSB.Events;
|
||||
using QSB.EyeOfTheUniverse.InstrumentSync.WorldObjects;
|
||||
using QSB.Patches;
|
||||
using QSB.WorldSync;
|
||||
namespace QSB.EyeOfTheUniverse.InstrumentSync.Patches
|
||||
{
|
||||
internal class QuantumInstrumentPatches : QSBPatch
|
||||
{
|
||||
public override QSBPatchTypes Type => QSBPatchTypes.OnClientConnect;
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(QuantumInstrument), nameof(QuantumInstrument.OnPressInteract))]
|
||||
public static void Gather(QuantumInstrument __instance)
|
||||
=> QSBEventManager.FireEvent(EventNames.QSBGatherInstrument, QSBWorldSync.GetWorldFromUnity<QSBQuantumInstrument>(__instance));
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
using QSB.EyeOfTheUniverse.InstrumentSync.WorldObjects;
|
||||
using QSB.WorldSync;
|
||||
|
||||
namespace QSB.EyeOfTheUniverse.InstrumentSync
|
||||
{
|
||||
internal class QuantumInstrumentManager : WorldObjectManager
|
||||
{
|
||||
public override WorldObjectType WorldObjectType => WorldObjectType.Eye;
|
||||
|
||||
protected override void RebuildWorldObjects(OWScene scene)
|
||||
=> QSBWorldSync.Init<QSBQuantumInstrument, QuantumInstrument>();
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
using QSB.WorldSync;
|
||||
|
||||
namespace QSB.EyeOfTheUniverse.InstrumentSync.WorldObjects
|
||||
{
|
||||
internal class QSBQuantumInstrument : WorldObject<QuantumInstrument>
|
||||
{
|
||||
}
|
||||
}
|
@ -5,6 +5,8 @@ namespace QSB.GeyserSync
|
||||
{
|
||||
public class GeyserManager : WorldObjectManager
|
||||
{
|
||||
public override WorldObjectType WorldObjectType => WorldObjectType.SolarSystem;
|
||||
|
||||
protected override void RebuildWorldObjects(OWScene scene)
|
||||
=> QSBWorldSync.Init<QSBGeyser, GeyserController>();
|
||||
}
|
||||
|
@ -8,6 +8,8 @@ namespace QSB.ItemSync
|
||||
{
|
||||
internal class ItemManager : WorldObjectManager
|
||||
{
|
||||
public override WorldObjectType WorldObjectType => WorldObjectType.Both;
|
||||
|
||||
protected override void RebuildWorldObjects(OWScene scene)
|
||||
{
|
||||
DebugLog.DebugWrite("Rebuilding OWItems...", MessageType.Info);
|
||||
|
@ -6,6 +6,8 @@ namespace QSB.JellyfishSync
|
||||
{
|
||||
public class JellyfishManager : WorldObjectManager
|
||||
{
|
||||
public override WorldObjectType WorldObjectType => WorldObjectType.SolarSystem;
|
||||
|
||||
public static readonly List<JellyfishController> Jellyfish = new();
|
||||
|
||||
protected override void RebuildWorldObjects(OWScene scene)
|
||||
|
@ -1,4 +1,5 @@
|
||||
using QSB.JellyfishSync.TransformSync;
|
||||
using QSB.Utility;
|
||||
using QSB.WorldSync;
|
||||
using QuantumUNET;
|
||||
using UnityEngine;
|
||||
@ -16,7 +17,7 @@ namespace QSB.JellyfishSync.WorldObjects
|
||||
|
||||
if (QSBCore.IsHost)
|
||||
{
|
||||
QNetworkServer.Spawn(Object.Instantiate(QSBNetworkManager.Instance.JellyfishPrefab));
|
||||
Object.Instantiate(QSBNetworkManager.Instance.JellyfishPrefab).SpawnWithServerAuthority();
|
||||
}
|
||||
|
||||
StartDelayedReady();
|
||||
|
@ -6,6 +6,8 @@ namespace QSB.MeteorSync
|
||||
{
|
||||
public class MeteorManager : WorldObjectManager
|
||||
{
|
||||
public override WorldObjectType WorldObjectType => WorldObjectType.SolarSystem;
|
||||
|
||||
public static WhiteHoleVolume WhiteHoleVolume;
|
||||
|
||||
protected override void RebuildWorldObjects(OWScene scene)
|
||||
|
@ -6,6 +6,8 @@ namespace QSB.OrbSync
|
||||
{
|
||||
public class OrbManager : WorldObjectManager
|
||||
{
|
||||
public override WorldObjectType WorldObjectType => WorldObjectType.Both;
|
||||
|
||||
public static readonly List<NomaiInterfaceOrb> Orbs = new();
|
||||
|
||||
protected override void RebuildWorldObjects(OWScene scene)
|
||||
|
@ -14,7 +14,7 @@ namespace QSB.OrbSync.WorldObjects
|
||||
{
|
||||
if (QSBCore.IsHost)
|
||||
{
|
||||
QNetworkServer.Spawn(Object.Instantiate(QSBNetworkManager.Instance.OrbPrefab));
|
||||
Object.Instantiate(QSBNetworkManager.Instance.OrbPrefab).SpawnWithServerAuthority();
|
||||
}
|
||||
|
||||
StartDelayedReady();
|
||||
|
@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using HarmonyLib;
|
||||
|
@ -4,6 +4,8 @@ namespace QSB.PoolSync
|
||||
{
|
||||
internal class PoolManager : WorldObjectManager
|
||||
{
|
||||
public override WorldObjectType WorldObjectType => WorldObjectType.SolarSystem;
|
||||
|
||||
protected override void RebuildWorldObjects(OWScene scene)
|
||||
{
|
||||
foreach (var streaming in QSBWorldSync.GetUnityObjects<NomaiRemoteCameraStreaming>())
|
||||
|
@ -14,6 +14,8 @@ namespace QSB.QuantumSync
|
||||
{
|
||||
internal class QuantumManager : WorldObjectManager
|
||||
{
|
||||
public override WorldObjectType WorldObjectType => WorldObjectType.Both;
|
||||
|
||||
public static QuantumShrine Shrine { get; private set; }
|
||||
public static QuantumManager Instance { get; private set; }
|
||||
|
||||
|
@ -14,17 +14,23 @@ namespace QSB.SaveSync.Events
|
||||
|
||||
private void Handler(uint toId) => SendEvent(CreateMessage(toId));
|
||||
|
||||
private GameStateMessage CreateMessage(uint toId) => new()
|
||||
private GameStateMessage CreateMessage(uint toId)
|
||||
{
|
||||
AboutId = LocalPlayerId,
|
||||
ForId = toId,
|
||||
InSolarSystem = QSBSceneManager.CurrentScene == OWScene.SolarSystem,
|
||||
InEye = QSBSceneManager.CurrentScene == OWScene.EyeOfTheUniverse,
|
||||
LaunchCodesGiven = PlayerData.KnowsLaunchCodes(),
|
||||
LoopCount = StandaloneProfileManager.SharedInstance.currentProfileGameSave.loopCount,
|
||||
KnownFrequencies = StandaloneProfileManager.SharedInstance.currentProfileGameSave.knownFrequencies,
|
||||
KnownSignals = StandaloneProfileManager.SharedInstance.currentProfileGameSave.knownSignals
|
||||
};
|
||||
var gameSave = StandaloneProfileManager.SharedInstance.currentProfileGameSave;
|
||||
return new()
|
||||
{
|
||||
AboutId = LocalPlayerId,
|
||||
ForId = toId,
|
||||
InSolarSystem = QSBSceneManager.CurrentScene == OWScene.SolarSystem,
|
||||
InEye = QSBSceneManager.CurrentScene == OWScene.EyeOfTheUniverse,
|
||||
WarpedToTheEye = gameSave.warpedToTheEye,
|
||||
SecondsRemainingOnWarp = gameSave.secondsRemainingOnWarp,
|
||||
LaunchCodesGiven = PlayerData.KnowsLaunchCodes(),
|
||||
LoopCount = gameSave.loopCount,
|
||||
KnownFrequencies = gameSave.knownFrequencies,
|
||||
KnownSignals = gameSave.knownSignals,
|
||||
};
|
||||
}
|
||||
|
||||
public override void OnReceiveRemote(bool isHost, GameStateMessage message)
|
||||
{
|
||||
@ -40,6 +46,8 @@ namespace QSB.SaveSync.Events
|
||||
gameSave.loopCount = message.LoopCount;
|
||||
gameSave.knownFrequencies = message.KnownFrequencies;
|
||||
gameSave.knownSignals = message.KnownSignals;
|
||||
gameSave.warpedToTheEye = message.WarpedToTheEye;
|
||||
gameSave.secondsRemainingOnWarp = message.SecondsRemainingOnWarp;
|
||||
|
||||
PlayerData.SetPersistentCondition("LAUNCH_CODES_GIVEN", message.LaunchCodesGiven);
|
||||
|
||||
|
@ -9,6 +9,8 @@ namespace QSB.SaveSync.Events
|
||||
{
|
||||
public bool InSolarSystem { get; set; }
|
||||
public bool InEye { get; set; }
|
||||
public bool WarpedToTheEye { get; set; }
|
||||
public float SecondsRemainingOnWarp { get; set; }
|
||||
public bool LaunchCodesGiven { get; set; }
|
||||
public int LoopCount { get; set; }
|
||||
public bool[] KnownFrequencies { get; set; }
|
||||
@ -19,6 +21,8 @@ namespace QSB.SaveSync.Events
|
||||
base.Deserialize(reader);
|
||||
InSolarSystem = reader.ReadBoolean();
|
||||
InEye = reader.ReadBoolean();
|
||||
WarpedToTheEye = reader.ReadBoolean();
|
||||
SecondsRemainingOnWarp = reader.ReadSingle();
|
||||
LaunchCodesGiven = reader.ReadBoolean();
|
||||
LoopCount = reader.ReadInt32();
|
||||
|
||||
@ -46,6 +50,8 @@ namespace QSB.SaveSync.Events
|
||||
base.Serialize(writer);
|
||||
writer.Write(InSolarSystem);
|
||||
writer.Write(InEye);
|
||||
writer.Write(WarpedToTheEye);
|
||||
writer.Write(SecondsRemainingOnWarp);
|
||||
writer.Write(LaunchCodesGiven);
|
||||
writer.Write(LoopCount);
|
||||
|
||||
|
@ -11,6 +11,8 @@ namespace QSB.SectorSync
|
||||
{
|
||||
public class QSBSectorManager : WorldObjectManager
|
||||
{
|
||||
public override WorldObjectType WorldObjectType => WorldObjectType.Both;
|
||||
|
||||
public static QSBSectorManager Instance { get; private set; }
|
||||
public bool IsReady { get; private set; }
|
||||
public readonly List<QSBSector> FakeSectors = new();
|
||||
|
@ -14,6 +14,8 @@ namespace QSB.ShipSync
|
||||
{
|
||||
internal class ShipManager : WorldObjectManager
|
||||
{
|
||||
public override WorldObjectType WorldObjectType => WorldObjectType.SolarSystem;
|
||||
|
||||
public static ShipManager Instance;
|
||||
|
||||
public InteractZone HatchInteractZone;
|
||||
|
@ -273,7 +273,7 @@ namespace QSB.TimeSync
|
||||
var serverState = ServerStateManager.Instance.GetServerState();
|
||||
var clientState = QSBPlayerManager.LocalPlayer.State;
|
||||
|
||||
if (serverState == ServerState.WaitingForAllPlayersToReady && clientState == ClientState.WaitingForOthersToReadyInSolarSystem)
|
||||
if (serverState == ServerState.WaitingForAllPlayersToReady && clientState == ClientState.WaitingForOthersToBeReady)
|
||||
{
|
||||
if (CurrentState != State.Pausing)
|
||||
{
|
||||
@ -289,7 +289,7 @@ namespace QSB.TimeSync
|
||||
}
|
||||
}
|
||||
|
||||
if (serverState == ServerState.WaitingForAllPlayersToDie && clientState == ClientState.WaitingForOthersToReadyInSolarSystem)
|
||||
if (serverState == ServerState.WaitingForAllPlayersToDie && clientState == ClientState.WaitingForOthersToBeReady)
|
||||
{
|
||||
if (CurrentState == State.Pausing && (PauseReason)CurrentReason == PauseReason.WaitingForAllPlayersToBeReady)
|
||||
{
|
||||
@ -352,12 +352,12 @@ namespace QSB.TimeSync
|
||||
StartPausing(PauseReason.ServerNotStarted);
|
||||
}
|
||||
|
||||
if (serverState == ServerState.WaitingForAllPlayersToReady && CurrentState != State.Pausing && clientState == ClientState.WaitingForOthersToReadyInSolarSystem)
|
||||
if (serverState == ServerState.WaitingForAllPlayersToReady && CurrentState != State.Pausing && clientState == ClientState.WaitingForOthersToBeReady)
|
||||
{
|
||||
StartPausing(PauseReason.WaitingForAllPlayersToBeReady);
|
||||
}
|
||||
|
||||
if (serverState == ServerState.WaitingForAllPlayersToDie && clientState == ClientState.WaitingForOthersToReadyInSolarSystem)
|
||||
if (serverState == ServerState.WaitingForAllPlayersToDie && clientState == ClientState.WaitingForOthersToBeReady)
|
||||
{
|
||||
StartPausing(PauseReason.WaitingForAllPlayersToBeReady);
|
||||
}
|
||||
|
@ -5,6 +5,8 @@ namespace QSB.Tools.ProbeLauncherTool
|
||||
{
|
||||
internal class ProbeLauncherManager : WorldObjectManager
|
||||
{
|
||||
public override WorldObjectType WorldObjectType => WorldObjectType.Both;
|
||||
|
||||
protected override void RebuildWorldObjects(OWScene scene)
|
||||
=> QSBWorldSync.Init<QSBProbeLauncher, ProbeLauncher>(typeof(PlayerProbeLauncher));
|
||||
}
|
||||
|
@ -5,6 +5,8 @@ namespace QSB.Tools.TranslatorTool.TranslationSync
|
||||
{
|
||||
internal class SpiralManager : WorldObjectManager
|
||||
{
|
||||
public override WorldObjectType WorldObjectType => WorldObjectType.Both;
|
||||
|
||||
protected override void RebuildWorldObjects(OWScene scene)
|
||||
{
|
||||
QSBWorldSync.Init<QSBWallText, NomaiWallText>();
|
||||
|
@ -8,6 +8,8 @@ namespace QSB.TornadoSync
|
||||
{
|
||||
public class TornadoManager : WorldObjectManager
|
||||
{
|
||||
public override WorldObjectType WorldObjectType => WorldObjectType.SolarSystem;
|
||||
|
||||
protected override void RebuildWorldObjects(OWScene scene)
|
||||
{
|
||||
QSBWorldSync.Init<QSBTornado, TornadoController>();
|
||||
|
@ -39,6 +39,45 @@ namespace QSB.Utility
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* 1 - Warp to first player
|
||||
* 2 - Set time flowing
|
||||
* 3 -
|
||||
* 4 - Damage ship electricals
|
||||
* 5 - Trigger supernova
|
||||
* 6 -
|
||||
* 7 - Warp to vessel
|
||||
* 8 - Place warp core into vessel
|
||||
* 9 - Load eye scene
|
||||
* 0 -
|
||||
*/
|
||||
|
||||
if (Keyboard.current[Key.Numpad1].wasPressedThisFrame)
|
||||
{
|
||||
var otherPlayer = QSBPlayerManager.PlayerList.FirstOrDefault(x => x.PlayerId != QSBPlayerManager.LocalPlayerId);
|
||||
if (otherPlayer != null && otherPlayer.Body != null)
|
||||
{
|
||||
var playerBody = Locator.GetPlayerBody();
|
||||
playerBody.WarpToPositionRotation(otherPlayer.Body.transform.position, otherPlayer.Body.transform.rotation);
|
||||
var parentBody = otherPlayer.TransformSync?.ReferenceSector?.AttachedObject?.GetOWRigidbody();
|
||||
if (parentBody != null)
|
||||
{
|
||||
playerBody.SetVelocity(parentBody.GetVelocity());
|
||||
playerBody.SetAngularVelocity(parentBody.GetAngularVelocity());
|
||||
}
|
||||
else
|
||||
{
|
||||
playerBody.SetVelocity(Vector3.zero);
|
||||
playerBody.SetAngularVelocity(Vector3.zero);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Keyboard.current[Key.Numpad1].wasPressedThisFrame)
|
||||
{
|
||||
TimeLoop._isTimeFlowing = true;
|
||||
}
|
||||
|
||||
if (Keyboard.current[Key.Numpad4].wasPressedThisFrame)
|
||||
{
|
||||
DamageShipElectricalSystem();
|
||||
@ -64,27 +103,6 @@ namespace QSB.Utility
|
||||
PlayerData.SaveWarpedToTheEye(60);
|
||||
LoadManager.LoadSceneAsync(OWScene.EyeOfTheUniverse, true, LoadManager.FadeType.ToWhite);
|
||||
}
|
||||
|
||||
if (Keyboard.current[Key.Numpad1].wasPressedThisFrame)
|
||||
{
|
||||
var otherPlayer = QSBPlayerManager.PlayerList.FirstOrDefault(x => x.PlayerId != QSBPlayerManager.LocalPlayerId);
|
||||
if (otherPlayer != null && otherPlayer.Body != null)
|
||||
{
|
||||
var playerBody = Locator.GetPlayerBody();
|
||||
playerBody.WarpToPositionRotation(otherPlayer.Body.transform.position, otherPlayer.Body.transform.rotation);
|
||||
var parentBody = otherPlayer.TransformSync?.ReferenceSector?.AttachedObject?.GetOWRigidbody();
|
||||
if (parentBody != null)
|
||||
{
|
||||
playerBody.SetVelocity(parentBody.GetVelocity());
|
||||
playerBody.SetAngularVelocity(parentBody.GetAngularVelocity());
|
||||
}
|
||||
else
|
||||
{
|
||||
playerBody.SetVelocity(Vector3.zero);
|
||||
playerBody.SetAngularVelocity(Vector3.zero);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
13
QSB/Utility/IsExternalInit.cs
Normal file
13
QSB/Utility/IsExternalInit.cs
Normal file
@ -0,0 +1,13 @@
|
||||
namespace System.Runtime.CompilerServices
|
||||
{
|
||||
public static class IsExternalInit
|
||||
{
|
||||
/*
|
||||
* You might think this class isn't used. And you'd be right!
|
||||
* But if you delete this file, the project will refuse to compile.
|
||||
* This is because IsExternalInit is only included in net5 and above.
|
||||
* So we have to create this dummy file to make it happy.
|
||||
* Yay.
|
||||
*/
|
||||
}
|
||||
}
|
@ -53,19 +53,19 @@ namespace QSB.WorldSync
|
||||
return default;
|
||||
}
|
||||
|
||||
if (!WorldObjectsToUnityObjects.TryGetValue(unityObject, out var returnObject))
|
||||
if (!WorldObjectsToUnityObjects.TryGetValue(unityObject, out var worldObject))
|
||||
{
|
||||
DebugLog.ToConsole($"Error - WorldObjectsToUnityObjects does not contain \"{unityObject.name}\"! TWorldObject:{typeof(TWorldObject).Name}, TUnityObject:{unityObject.GetType().Name}, Stacktrace:\r\n{Environment.StackTrace}", MessageType.Error);
|
||||
return default;
|
||||
}
|
||||
|
||||
if (returnObject == null)
|
||||
if (worldObject == null)
|
||||
{
|
||||
DebugLog.ToConsole($"Error - World object for unity object {unityObject.name} is null! TWorldObject:{typeof(TWorldObject).Name}, TUnityObject:{unityObject.GetType().Name}, Stacktrace:\r\n{Environment.StackTrace}", MessageType.Error);
|
||||
return default;
|
||||
}
|
||||
|
||||
return (TWorldObject)returnObject;
|
||||
return (TWorldObject)worldObject;
|
||||
}
|
||||
|
||||
public static int GetIdFromUnity<TWorldObject>(MonoBehaviour unityObject)
|
||||
|
@ -6,8 +6,8 @@ namespace QSB.WorldSync
|
||||
public abstract class WorldObject<T> : IWorldObject
|
||||
where T : MonoBehaviour
|
||||
{
|
||||
public int ObjectId { get; set; }
|
||||
public T AttachedObject { get; set; }
|
||||
public int ObjectId { get; init; }
|
||||
public T AttachedObject { get; init; }
|
||||
public string Name => AttachedObject == null ? "<NullObject!>" : AttachedObject.name;
|
||||
public string LogName => $"{QSBPlayerManager.LocalPlayerId}.{ObjectId}:{GetType().Name}";
|
||||
|
||||
|
@ -7,6 +7,13 @@ using UnityEngine;
|
||||
|
||||
namespace QSB.WorldSync
|
||||
{
|
||||
public enum WorldObjectType
|
||||
{
|
||||
Both,
|
||||
SolarSystem,
|
||||
Eye
|
||||
}
|
||||
|
||||
public abstract class WorldObjectManager : MonoBehaviour
|
||||
{
|
||||
private static readonly List<WorldObjectManager> _managers = new();
|
||||
@ -21,6 +28,11 @@ namespace QSB.WorldSync
|
||||
/// </summary>
|
||||
public static bool AllObjectsReady { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// when the scene does not match the type, this manager will not build its world objects
|
||||
/// </summary>
|
||||
public abstract WorldObjectType WorldObjectType { get; }
|
||||
|
||||
public virtual void Awake()
|
||||
{
|
||||
QSBSceneManager.OnSceneLoaded += OnSceneLoaded;
|
||||
@ -73,6 +85,14 @@ namespace QSB.WorldSync
|
||||
AllObjectsReady = false;
|
||||
foreach (var manager in _managers)
|
||||
{
|
||||
switch (manager.WorldObjectType)
|
||||
{
|
||||
case WorldObjectType.SolarSystem when QSBSceneManager.CurrentScene != OWScene.SolarSystem:
|
||||
case WorldObjectType.Eye when QSBSceneManager.CurrentScene != OWScene.EyeOfTheUniverse:
|
||||
DebugLog.DebugWrite($"skipping {manager.GetType().Name} as it is type {manager.WorldObjectType} and scene is {QSBSceneManager.CurrentScene}");
|
||||
continue;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
DebugLog.DebugWrite($"Rebuilding {manager.GetType().Name}", MessageType.Info);
|
||||
|
@ -5,6 +5,8 @@ namespace QSB.ZeroGCaveSync
|
||||
{
|
||||
internal class ZeroGCaveManager : WorldObjectManager
|
||||
{
|
||||
public override WorldObjectType WorldObjectType => WorldObjectType.SolarSystem;
|
||||
|
||||
protected override void RebuildWorldObjects(OWScene scene)
|
||||
=> QSBWorldSync.Init<QSBSatelliteNode, SatelliteNode>();
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
{
|
||||
"debugMode": false,
|
||||
"drawLines": false,
|
||||
"showQuantumVisibilityObjects": false,
|
||||
"showQuantumDebugBoxes": false,
|
||||
"showQuantumVisibilityObjects": true,
|
||||
"showQuantumDebugBoxes": true,
|
||||
"avoidTimeSync": false,
|
||||
"skipTitleScreen": false
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user