fix some stuff

This commit is contained in:
Mister_Nebula 2020-09-05 15:31:09 +01:00
parent b4c8f451cb
commit 03944057cd
2 changed files with 6 additions and 11 deletions

View File

@ -34,9 +34,8 @@ namespace QSB.OrbSync
{
var fromPlayer = (NetworkServer.connections.First(x => x.playerControllers[0].gameObject.GetComponent<PlayerTransformSync>().netId.Value == message.FromId));
DebugLog.DebugWrite($"[S] Setting orb {message.ObjectId} to auth id {message.FromId}");
var orbIdentity = WorldRegistry.OrbList
.First(x => x.AttachedOrb == WorldRegistry.OldOrbList[message.ObjectId])
.GetComponent<NetworkIdentity>();
var orb = WorldRegistry.OrbList.First(x => x.AttachedOrb == WorldRegistry.OldOrbList[message.ObjectId]);
var orbIdentity = orb.GetComponent<NetworkIdentity>();
orbIdentity.RemoveClientAuthority(orbIdentity.clientAuthorityOwner);
orbIdentity.AssignClientAuthority(fromPlayer);
}

View File

@ -3,7 +3,6 @@ using QSB.WorldSync;
using System;
using System.Linq;
using System.Reflection;
using UnityEngine.Networking;
namespace QSB.OrbSync
{
@ -15,16 +14,13 @@ namespace QSB.OrbSync
{
ObjectId = id;
_interfaceSlot = slot;
_interfaceSlot.OnSlotActivated += (slotInstance) => HandleEvent(slotInstance, true);
_interfaceSlot.OnSlotDeactivated += (slotInstance) => HandleEvent(slotInstance, false);
_interfaceSlot.OnSlotActivated += (slotInstance) => HandleEvent(true);
_interfaceSlot.OnSlotDeactivated += (slotInstance) => HandleEvent(false);
}
private void HandleEvent(NomaiInterfaceSlot instance, bool state)
private void HandleEvent(bool state)
{
if (NetworkServer.active)
{
GlobalMessenger<int, bool>.FireEvent(EventNames.QSBOrbSlot, ObjectId, state);
}
GlobalMessenger<int, bool>.FireEvent(EventNames.QSBOrbSlot, ObjectId, state);
}
public void SetState(bool state)