mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-12-11 20:15:10 +01:00
Merge pull request #717 from qsb-dev/nh-quantum-compat
Fix NH quantum objects having no ControllingPlayer if they are near spawn
This commit is contained in:
commit
c90d3345e9
@ -71,6 +71,15 @@ public abstract class QSBQuantumObject<T> : WorldObject<T>, 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<T> : WorldObject<T>, IQSBQuantumObject
|
||||
{
|
||||
_visibleToProbes.Add(player);
|
||||
}
|
||||
|
||||
|
||||
AttachedObject._visibleInProbeSnapshot = true;
|
||||
return;
|
||||
}
|
||||
@ -261,7 +270,7 @@ public abstract class QSBQuantumObject<T> : WorldObject<T>, IQSBQuantumObject
|
||||
{
|
||||
_visibleToProbes.Remove(player);
|
||||
}
|
||||
|
||||
|
||||
AttachedObject._visibleInProbeSnapshot = _visibleToProbes.Any();
|
||||
}
|
||||
|
||||
|
||||
@ -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<SocketedQuantumObject>
|
||||
{
|
||||
base.SendInitialState(to);
|
||||
|
||||
// todo SendInitialState
|
||||
if (this.ControllingPlayer != 0 && AttachedObject._occupiedSocket != null)
|
||||
{
|
||||
this.SendMessage(new SocketStateChangeMessage(
|
||||
AttachedObject._occupiedSocket.GetWorldObject<QSBQuantumSocket>().ObjectId,
|
||||
AttachedObject.transform.localRotation)
|
||||
{ To = to });
|
||||
}
|
||||
}
|
||||
|
||||
public void MoveToSocket(uint playerId, int socketId, Quaternion localRotation)
|
||||
|
||||
@ -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.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user