diff --git a/QSB/QuantumSync/WorldObjects/QSBQuantumObject.cs b/QSB/QuantumSync/WorldObjects/QSBQuantumObject.cs index 186b2248..f069c076 100644 --- a/QSB/QuantumSync/WorldObjects/QSBQuantumObject.cs +++ b/QSB/QuantumSync/WorldObjects/QSBQuantumObject.cs @@ -71,6 +71,15 @@ public abstract class QSBQuantumObject : WorldObject, IQSBQuantumObject if (attachedShapes.All(x => x.enabled && x.gameObject.activeInHierarchy && x.active)) { IsEnabled = true; + // If the shapes are already enabled then OnShapeActivated won't get triggered until it turns off and on again + // Then nobody ends up controlling the object until that happens + // This doesn't affect base game because there are no quantum objects at spawn, but can affect NH mods + // In this case where the host has spawned in and the object is enabled with no ControllingPlayer, the host should take control + if (QSBCore.IsHost) + { + // first player is the host + ControllingPlayer = QSBPlayerManager.PlayerList[0].PlayerId; + } } else { @@ -215,7 +224,7 @@ public abstract class QSBQuantumObject : WorldObject, IQSBQuantumObject { _visibleToProbes.Add(player); } - + AttachedObject._visibleInProbeSnapshot = true; return; } @@ -261,7 +270,7 @@ public abstract class QSBQuantumObject : WorldObject, IQSBQuantumObject { _visibleToProbes.Remove(player); } - + AttachedObject._visibleInProbeSnapshot = _visibleToProbes.Any(); } diff --git a/QSB/QuantumSync/WorldObjects/QSBSocketedQuantumObject.cs b/QSB/QuantumSync/WorldObjects/QSBSocketedQuantumObject.cs index 5a6e9c1d..8118f6a2 100644 --- a/QSB/QuantumSync/WorldObjects/QSBSocketedQuantumObject.cs +++ b/QSB/QuantumSync/WorldObjects/QSBSocketedQuantumObject.cs @@ -1,6 +1,8 @@ using Cysharp.Threading.Tasks; using OWML.Common; +using QSB.Messaging; using QSB.Player; +using QSB.QuantumSync.Messages; using QSB.Utility; using QSB.WorldSync; using System; @@ -35,7 +37,13 @@ public class QSBSocketedQuantumObject : QSBQuantumObject { base.SendInitialState(to); - // todo SendInitialState + if (this.ControllingPlayer != 0 && AttachedObject._occupiedSocket != null) + { + this.SendMessage(new SocketStateChangeMessage( + AttachedObject._occupiedSocket.GetWorldObject().ObjectId, + AttachedObject.transform.localRotation) + { To = to }); + } } public void MoveToSocket(uint playerId, int socketId, Quaternion localRotation) diff --git a/README.md b/README.md index b445d621..cdfa902b 100644 --- a/README.md +++ b/README.md @@ -114,7 +114,7 @@ See the [QSB Developer Wiki](https://github.com/qsb-dev/quantum-space-buddies/wi ### Contributers -- [xen](https://github.com/xen-42) - Help with syncing particle/sound effects, fixing lantern item bugs, and syncing addon data. +- [xen](https://github.com/xen-42) - Help with syncing particle/sound effects, fixing lantern item bugs, syncing addon data, and NH compatibility/bug fixes. - [Moonstone](https://github.com/MoonstoneStudios) - Improvements to elevators and lifts. - [Chris Yeninas](https://github.com/PhantomGamers) - Help with project files and GitHub workflows. - [Locochoco](https://github.com/loco-choco) - Code improvements.