mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-03-12 13:13:32 +00:00
fixes
This commit is contained in:
parent
61866c6367
commit
dd16a2f09e
@ -141,6 +141,11 @@ namespace QSB
|
||||
{
|
||||
QSBWorldSync.OldDialogueTrees = Resources.FindObjectsOfTypeAll<CharacterDialogueTree>().ToList();
|
||||
}
|
||||
|
||||
if (QSBSceneManager.IsInUniverse)
|
||||
{
|
||||
QSBCore.HasWokenUp = true;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnServerAddPlayer(QNetworkConnection connection, short playerControllerId) // Called on the server when a client joins
|
||||
@ -247,6 +252,7 @@ namespace QSB
|
||||
|
||||
base.OnStopServer();
|
||||
}
|
||||
|
||||
private void RemoveWorldObjects()
|
||||
{
|
||||
QSBWorldSync.RemoveWorldObjects<QSBOrbSlot>();
|
||||
@ -255,6 +261,5 @@ namespace QSB
|
||||
QSBWorldSync.RemoveWorldObjects<QSBSector>();
|
||||
QSBWorldSync.RemoveWorldObjects<IQSBQuantumObject>();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -49,6 +49,7 @@ namespace QSB.QuantumSync.Events
|
||||
{
|
||||
var objects = QSBWorldSync.GetWorldObjects<IQSBQuantumObject>();
|
||||
var obj = objects.ToList()[message.ObjectId];
|
||||
DebugLog.DebugWrite($"LOCAL {(obj as IWorldObject).Name} to owner {message.AuthorityOwner}");
|
||||
obj.ControllingPlayer = message.AuthorityOwner;
|
||||
}
|
||||
|
||||
|
@ -24,16 +24,22 @@ namespace QSB.QuantumSync.WorldObjects
|
||||
|
||||
public override void Init(T attachedObject, int id)
|
||||
{
|
||||
DebugLog.DebugWrite($"Init of {attachedObject.name}");
|
||||
_tracker = QSBCore.GameObjectInstance.AddComponent<OnEnableDisableTracker>();
|
||||
_tracker.AttachedComponent = AttachedObject;
|
||||
_tracker.OnEnableEvent += OnEnable;
|
||||
_tracker.OnDisableEvent += OnDisable;
|
||||
ControllingPlayer = 1u;
|
||||
ControllingPlayer = 0u;
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
DebugLog.DebugWrite($"Enable {AttachedObject.name}, current owner {ControllingPlayer}");
|
||||
IsEnabled = true;
|
||||
if (!QSBCore.HasWokenUp && !QSBCore.IsServer)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (ControllingPlayer != 0)
|
||||
{
|
||||
// controlled by another player, dont care that we activate it
|
||||
@ -46,7 +52,12 @@ namespace QSB.QuantumSync.WorldObjects
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
DebugLog.DebugWrite($"Disable {AttachedObject.name}, current owner {ControllingPlayer}");
|
||||
IsEnabled = false;
|
||||
if (!QSBCore.HasWokenUp && !QSBCore.IsServer)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (ControllingPlayer != QSBPlayerManager.LocalPlayerId)
|
||||
{
|
||||
// not being controlled by us, don't care if we leave area
|
||||
|
@ -50,7 +50,7 @@ namespace QSB.TimeSync
|
||||
|
||||
private void OnWakeUp()
|
||||
{
|
||||
DebugLog.DebugWrite($"OnWakeUp", OWML.Common.MessageType.Info);
|
||||
DebugLog.DebugWrite($"OnWakeUp", MessageType.Info);
|
||||
if (QNetworkServer.active)
|
||||
{
|
||||
QSBCore.HasWokenUp = true;
|
||||
|
@ -34,7 +34,7 @@ namespace QSB.WorldSync
|
||||
{
|
||||
item.OnRemoval();
|
||||
}
|
||||
DebugLog.DebugWrite($"Removing types {typeof(TWorldObject).Name}.");
|
||||
DebugLog.DebugWrite($"Removing {typeof(TWorldObject).Name} : {WorldObjects.Count(x => x is TWorldObject)} instances.");
|
||||
WorldObjects.RemoveAll(x => x is TWorldObject);
|
||||
}
|
||||
|
||||
@ -42,6 +42,7 @@ namespace QSB.WorldSync
|
||||
where TWorldObject : WorldObject<TUnityObject>
|
||||
where TUnityObject : MonoBehaviour
|
||||
{
|
||||
RemoveWorldObjects<TWorldObject>();
|
||||
var list = Resources.FindObjectsOfTypeAll<TUnityObject>().ToList();
|
||||
DebugLog.DebugWrite($"{typeof(TWorldObject).Name} init : {list.Count} instances.", MessageType.Info);
|
||||
for (var id = 0; id < list.Count; id++)
|
||||
|
Loading…
x
Reference in New Issue
Block a user