This commit is contained in:
Aaro Varis
2025-03-16 14:31:11 +02:00
parent 922c33d4a1
commit 64b2005beb
2 changed files with 7 additions and 8 deletions

View File

@@ -46,16 +46,10 @@ namespace BoneSync.Sync.Components
{ {
SyncLogger.Msg("Setting owner for " + _syncId + " to " + ownerId); SyncLogger.Msg("Setting owner for " + _syncId + " to " + ownerId);
_ownerId = ownerId; _ownerId = ownerId;
if (!isOwner)
{
_simpleEventQueue.Clear();
} else
{
TryCatchUpSimpleEvents();
}
FindAndUpdateComponents(); FindAndUpdateComponents();
MelonCoroutines.Start(SyncCoroutineAsync()); MelonCoroutines.Start(SyncCoroutineAsync());
UpdateKinematic(); UpdateKinematic();
TryCatchUpSimpleEvents();
} }
public bool ClientSpawningAllowed() public bool ClientSpawningAllowed()
@@ -149,6 +143,11 @@ namespace BoneSync.Sync.Components
private void TryCatchUpSimpleEvents() private void TryCatchUpSimpleEvents()
{ {
if (Registered && !isOwner)
{
_simpleEventQueue.Clear();
return;
}
if (_simpleEventQueue.Count > 0 && Registered && isOwner) if (_simpleEventQueue.Count > 0 && Registered && isOwner)
{ {
byte[] eventData = _simpleEventQueue.Dequeue(); byte[] eventData = _simpleEventQueue.Dequeue();

View File

@@ -25,7 +25,7 @@ namespace BoneSync.Sync.Components
byte index = (byte)Array.IndexOf(buttonToggles, toggle); byte index = (byte)Array.IndexOf(buttonToggles, toggle);
RegisterSyncable(); RegisterSyncable();
if (!isOwner && Registered) return false; if (!isOwner && Registered) return false;
AddSimpleEventToQueue(eventType, index); AddSimpleEventToQueue(eventType, index, (byte)buttonToggles.Length);
return true; return true;
} }
bool ButtonOnPress(ButtonToggle toggle) bool ButtonOnPress(ButtonToggle toggle)