mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-02-23 06:40:56 +00:00
buh
This commit is contained in:
parent
2f8104959d
commit
1b717709f6
@ -41,8 +41,9 @@ namespace QSB.Animation.Player
|
|||||||
QSBSceneManager.OnUniverseSceneLoaded += OnUniverseSceneLoaded;
|
QSBSceneManager.OnUniverseSceneLoaded += OnUniverseSceneLoaded;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void OnDestroy()
|
protected override void OnDestroy()
|
||||||
{
|
{
|
||||||
|
base.OnDestroy();
|
||||||
Destroy(InvisibleAnimator);
|
Destroy(InvisibleAnimator);
|
||||||
Destroy(NetworkAnimator);
|
Destroy(NetworkAnimator);
|
||||||
QSBSceneManager.OnUniverseSceneLoaded -= OnUniverseSceneLoaded;
|
QSBSceneManager.OnUniverseSceneLoaded -= OnUniverseSceneLoaded;
|
||||||
|
@ -7,26 +7,26 @@ namespace QSB.Animation.Player.Messages
|
|||||||
{
|
{
|
||||||
internal class AnimationTriggerMessage : QSBMessage
|
internal class AnimationTriggerMessage : QSBMessage
|
||||||
{
|
{
|
||||||
private uint PlayerId;
|
private uint AttachedNetId;
|
||||||
private string Name;
|
private string Name;
|
||||||
|
|
||||||
public AnimationTriggerMessage(uint playerId, string name)
|
public AnimationTriggerMessage(uint attachedNetId, string name)
|
||||||
{
|
{
|
||||||
PlayerId = playerId;
|
AttachedNetId = attachedNetId;
|
||||||
Name = name;
|
Name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Serialize(QNetworkWriter writer)
|
public override void Serialize(QNetworkWriter writer)
|
||||||
{
|
{
|
||||||
base.Serialize(writer);
|
base.Serialize(writer);
|
||||||
writer.Write(PlayerId);
|
writer.Write(AttachedNetId);
|
||||||
writer.Write(Name);
|
writer.Write(Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Deserialize(QNetworkReader reader)
|
public override void Deserialize(QNetworkReader reader)
|
||||||
{
|
{
|
||||||
base.Deserialize(reader);
|
base.Deserialize(reader);
|
||||||
PlayerId = reader.ReadUInt32();
|
AttachedNetId = reader.ReadUInt32();
|
||||||
Name = reader.ReadString();
|
Name = reader.ReadString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -34,7 +34,7 @@ namespace QSB.Animation.Player.Messages
|
|||||||
|
|
||||||
public override void OnReceiveRemote()
|
public override void OnReceiveRemote()
|
||||||
{
|
{
|
||||||
var animationSync = QSBPlayerManager.GetPlayer(PlayerId).AnimationSync;
|
var animationSync = QSBPlayerManager.GetSyncObject<AnimationSync>(AttachedNetId);
|
||||||
if (animationSync == null)
|
if (animationSync == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using QSB.Messaging;
|
using QSB.Instruments;
|
||||||
|
using QSB.Messaging;
|
||||||
using QSB.Player;
|
using QSB.Player;
|
||||||
using QSB.WorldSync;
|
using QSB.WorldSync;
|
||||||
using QuantumUNET.Transport;
|
using QuantumUNET.Transport;
|
||||||
@ -38,7 +39,7 @@ namespace QSB.Animation.Player.Messages
|
|||||||
}
|
}
|
||||||
|
|
||||||
player.AnimationSync.SetAnimationType(Value);
|
player.AnimationSync.SetAnimationType(Value);
|
||||||
player.InstrumentsManager.CheckInstrumentProps(Value);
|
QSBPlayerManager.GetSyncObject<InstrumentsManager>(PlayerId).CheckInstrumentProps(Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -62,15 +62,16 @@ namespace QSB.Animation.Player.Patches
|
|||||||
__instance._animator.SetBool("UsingJetpack", isInZeroG && PlayerState.IsWearingSuit());
|
__instance._animator.SetBool("UsingJetpack", isInZeroG && PlayerState.IsWearingSuit());
|
||||||
if (__instance._justBecameGrounded)
|
if (__instance._justBecameGrounded)
|
||||||
{
|
{
|
||||||
|
var playerAnimationSync = QSBPlayerManager.LocalPlayer.AnimationSync;
|
||||||
if (__instance._justTookFallDamage)
|
if (__instance._justTookFallDamage)
|
||||||
{
|
{
|
||||||
__instance._animator.SetTrigger("LandHard");
|
__instance._animator.SetTrigger("LandHard");
|
||||||
new AnimationTriggerMessage(QSBPlayerManager.LocalPlayerId, "LandHard").Send();
|
new AnimationTriggerMessage(playerAnimationSync.AttachedNetId, "LandHard").Send();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
__instance._animator.SetTrigger("Land");
|
__instance._animator.SetTrigger("Land");
|
||||||
new AnimationTriggerMessage(QSBPlayerManager.LocalPlayerId, "Land").Send();
|
new AnimationTriggerMessage(playerAnimationSync.AttachedNetId, "Land").Send();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,7 +128,8 @@ namespace QSB.Animation.Player.Patches
|
|||||||
}
|
}
|
||||||
|
|
||||||
__instance._animator.SetTrigger("Jump");
|
__instance._animator.SetTrigger("Jump");
|
||||||
new AnimationTriggerMessage(QSBPlayerManager.LocalPlayerId, "Jump").Send();
|
var playerAnimationSync = QSBPlayerManager.LocalPlayer.AnimationSync;
|
||||||
|
new AnimationTriggerMessage(playerAnimationSync.AttachedNetId, "Jump").Send();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,8 +36,9 @@ namespace QSB.Instruments
|
|||||||
QSBCore.UnityEvents.RunWhen(() => Locator.GetPlayerBody() != null, SetupInstruments);
|
QSBCore.UnityEvents.RunWhen(() => Locator.GetPlayerBody() != null, SetupInstruments);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void OnDestroy()
|
protected override void OnDestroy()
|
||||||
{
|
{
|
||||||
|
base.OnDestroy();
|
||||||
if (!IsLocalPlayer)
|
if (!IsLocalPlayer)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
@ -4,7 +4,6 @@ using QSB.Animation.Player.Thrusters;
|
|||||||
using QSB.Audio;
|
using QSB.Audio;
|
||||||
using QSB.CampfireSync.WorldObjects;
|
using QSB.CampfireSync.WorldObjects;
|
||||||
using QSB.ClientServerStateSync;
|
using QSB.ClientServerStateSync;
|
||||||
using QSB.Instruments;
|
|
||||||
using QSB.ItemSync.WorldObjects.Items;
|
using QSB.ItemSync.WorldObjects.Items;
|
||||||
using QSB.Messaging;
|
using QSB.Messaging;
|
||||||
using QSB.Player.Messages;
|
using QSB.Player.Messages;
|
||||||
@ -24,9 +23,9 @@ namespace QSB.Player
|
|||||||
public class PlayerInfo
|
public class PlayerInfo
|
||||||
{
|
{
|
||||||
public uint PlayerId { get; }
|
public uint PlayerId { get; }
|
||||||
public PlayerTransformSync TransformSync { get; }
|
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public PlayerHUDMarker HudMarker { get; set; }
|
public PlayerHUDMarker HudMarker { get; set; }
|
||||||
|
public PlayerTransformSync TransformSync { get; set; }
|
||||||
|
|
||||||
// Body Objects
|
// Body Objects
|
||||||
public OWCamera Camera
|
public OWCamera Camera
|
||||||
@ -115,8 +114,7 @@ namespace QSB.Player
|
|||||||
public GameObject CurrentDialogueBox { get; set; }
|
public GameObject CurrentDialogueBox { get; set; }
|
||||||
|
|
||||||
// Animation
|
// Animation
|
||||||
public AnimationSync AnimationSync => TransformSync.GetComponent<AnimationSync>();
|
public AnimationSync AnimationSync => QSBPlayerManager.GetSyncObject<AnimationSync>(PlayerId);
|
||||||
public InstrumentsManager InstrumentsManager => TransformSync.GetComponent<InstrumentsManager>();
|
|
||||||
public bool PlayingInstrument => AnimationSync.CurrentType is not AnimationType.PlayerSuited
|
public bool PlayingInstrument => AnimationSync.CurrentType is not AnimationType.PlayerSuited
|
||||||
and not AnimationType.PlayerUnsuited;
|
and not AnimationType.PlayerUnsuited;
|
||||||
public JetpackAccelerationSync JetpackAcceleration { get; set; }
|
public JetpackAccelerationSync JetpackAcceleration { get; set; }
|
||||||
@ -195,10 +193,9 @@ namespace QSB.Player
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlayerInfo(PlayerTransformSync transformSync)
|
public PlayerInfo(uint id)
|
||||||
{
|
{
|
||||||
PlayerId = transformSync.NetId.Value;
|
PlayerId = id;
|
||||||
TransformSync = transformSync;
|
|
||||||
CurrentCharacterDialogueTreeId = -1;
|
CurrentCharacterDialogueTreeId = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -219,7 +216,8 @@ namespace QSB.Player
|
|||||||
Translator?.ChangeEquipState(TranslatorEquipped);
|
Translator?.ChangeEquipState(TranslatorEquipped);
|
||||||
ProbeLauncher?.ChangeEquipState(ProbeLauncherEquipped);
|
ProbeLauncher?.ChangeEquipState(ProbeLauncherEquipped);
|
||||||
Signalscope?.ChangeEquipState(SignalscopeEquipped);
|
Signalscope?.ChangeEquipState(SignalscopeEquipped);
|
||||||
AnimationSync.SetSuitState(SuitedUp);
|
QSBCore.UnityEvents.RunWhen(() => QSBPlayerManager.GetSyncObject<AnimationSync>(PlayerId) != null,
|
||||||
|
() => QSBPlayerManager.GetSyncObject<AnimationSync>(PlayerId).SetSuitState(SuitedUp));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateStatesFromObjects()
|
public void UpdateStatesFromObjects()
|
||||||
|
@ -4,7 +4,11 @@ namespace QSB.Player
|
|||||||
{
|
{
|
||||||
public abstract class PlayerSyncObject : QNetworkBehaviour
|
public abstract class PlayerSyncObject : QNetworkBehaviour
|
||||||
{
|
{
|
||||||
public uint PlayerId => NetIdentity.NetId.Value;
|
public uint AttachedNetId => NetIdentity?.NetId.Value ?? uint.MaxValue;
|
||||||
|
public uint PlayerId => NetIdentity.RootIdentity?.NetId.Value ?? NetIdentity.NetId.Value;
|
||||||
public PlayerInfo Player => QSBPlayerManager.GetPlayer(PlayerId);
|
public PlayerInfo Player => QSBPlayerManager.GetPlayer(PlayerId);
|
||||||
|
|
||||||
|
protected virtual void Start() => QSBPlayerManager.AddSyncObject(this);
|
||||||
|
protected virtual void OnDestroy() => QSBPlayerManager.RemoveSyncObject(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -24,19 +24,27 @@ namespace QSB.Player
|
|||||||
return uint.MaxValue;
|
return uint.MaxValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
return localInstance.NetId.Value;
|
if (localInstance.NetIdentity == null)
|
||||||
|
{
|
||||||
|
DebugLog.ToConsole($"Error - Trying to get LocalPlayerId when the local PlayerTransformSync instance's QNetworkIdentity is null.", MessageType.Error);
|
||||||
|
return uint.MaxValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
return localInstance.NetIdentity.NetId.Value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Action<uint> OnAddPlayer;
|
|
||||||
public static Action<uint> OnRemovePlayer;
|
public static Action<uint> OnRemovePlayer;
|
||||||
|
public static Action<uint> OnAddPlayer;
|
||||||
|
|
||||||
public static PlayerInfo LocalPlayer => GetPlayer(LocalPlayerId);
|
public static PlayerInfo LocalPlayer => GetPlayer(LocalPlayerId);
|
||||||
public static List<PlayerInfo> PlayerList { get; } = new();
|
public static List<PlayerInfo> PlayerList { get; } = new List<PlayerInfo>();
|
||||||
|
|
||||||
|
private static readonly List<PlayerSyncObject> PlayerSyncObjects = new();
|
||||||
|
|
||||||
public static PlayerInfo GetPlayer(uint id)
|
public static PlayerInfo GetPlayer(uint id)
|
||||||
{
|
{
|
||||||
if (id is uint.MaxValue or 0)
|
if (id is uint.MaxValue or 0U)
|
||||||
{
|
{
|
||||||
return default;
|
return default;
|
||||||
}
|
}
|
||||||
@ -51,8 +59,32 @@ namespace QSB.Player
|
|||||||
return player;
|
return player;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void AddPlayer(uint id)
|
||||||
|
{
|
||||||
|
DebugLog.DebugWrite($"Create Player : id<{id}>", MessageType.Info);
|
||||||
|
var player = new PlayerInfo(id);
|
||||||
|
PlayerList.Add(player);
|
||||||
|
OnAddPlayer?.Invoke(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void RemovePlayer(uint id)
|
||||||
|
{
|
||||||
|
DebugLog.DebugWrite($"Remove Player : id<{id}>", MessageType.Info);
|
||||||
|
PlayerList.RemoveAll(x => x.PlayerId == id);
|
||||||
|
}
|
||||||
|
|
||||||
public static bool PlayerExists(uint id) =>
|
public static bool PlayerExists(uint id) =>
|
||||||
id is not (uint.MaxValue or 0) && PlayerList.Any(x => x.PlayerId == id);
|
id != uint.MaxValue && PlayerList.Any(x => x.PlayerId == id);
|
||||||
|
|
||||||
|
public static IEnumerable<T> GetSyncObjects<T>() where T : PlayerSyncObject =>
|
||||||
|
PlayerSyncObjects.OfType<T>().Where(x => x != null);
|
||||||
|
|
||||||
|
public static T GetSyncObject<T>(uint id) where T : PlayerSyncObject =>
|
||||||
|
GetSyncObjects<T>().FirstOrDefault(x => x != null && x.AttachedNetId == id);
|
||||||
|
|
||||||
|
public static void AddSyncObject(PlayerSyncObject obj) => PlayerSyncObjects.Add(obj);
|
||||||
|
|
||||||
|
public static void RemoveSyncObject(PlayerSyncObject obj) => PlayerSyncObjects.Remove(obj);
|
||||||
|
|
||||||
public static List<PlayerInfo> GetPlayersWithCameras(bool includeLocalCamera = true)
|
public static List<PlayerInfo> GetPlayersWithCameras(bool includeLocalCamera = true)
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using OWML.Common;
|
using QSB.Animation.Player;
|
||||||
using QSB.Animation.Player;
|
|
||||||
using QSB.Audio;
|
using QSB.Audio;
|
||||||
using QSB.Instruments;
|
using QSB.Instruments;
|
||||||
using QSB.Messaging;
|
using QSB.Messaging;
|
||||||
@ -50,9 +49,8 @@ namespace QSB.Player.TransformSync
|
|||||||
public override void Start()
|
public override void Start()
|
||||||
{
|
{
|
||||||
base.Start();
|
base.Start();
|
||||||
QSBPlayerManager.PlayerList.Add(new PlayerInfo(this));
|
QSBPlayerManager.AddPlayer(PlayerId);
|
||||||
QSBPlayerManager.OnAddPlayer?.Invoke(PlayerId);
|
Player.TransformSync = this;
|
||||||
DebugLog.DebugWrite($"Create Player : id<{PlayerId}>", MessageType.Info);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnSceneLoaded(OWScene oldScene, OWScene newScene, bool isInUniverse)
|
protected override void OnSceneLoaded(OWScene oldScene, OWScene newScene, bool isInUniverse)
|
||||||
@ -90,9 +88,11 @@ namespace QSB.Player.TransformSync
|
|||||||
// TODO : Maybe move this to a leave event...? Would ensure everything could finish up before removing the player
|
// TODO : Maybe move this to a leave event...? Would ensure everything could finish up before removing the player
|
||||||
QSBPlayerManager.OnRemovePlayer?.Invoke(PlayerId);
|
QSBPlayerManager.OnRemovePlayer?.Invoke(PlayerId);
|
||||||
base.OnDestroy();
|
base.OnDestroy();
|
||||||
Player.HudMarker?.Remove();
|
if (QSBPlayerManager.PlayerExists(PlayerId))
|
||||||
QSBPlayerManager.PlayerList.RemoveAll(x => x.PlayerId == PlayerId);
|
{
|
||||||
DebugLog.DebugWrite($"Remove Player : id<{PlayerId}>", MessageType.Info);
|
Player.HudMarker?.Remove();
|
||||||
|
QSBPlayerManager.RemovePlayer(PlayerId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Transform InitLocalTransform()
|
protected override Transform InitLocalTransform()
|
||||||
|
@ -17,14 +17,48 @@ namespace QSB.Syncs
|
|||||||
|
|
||||||
public abstract class SyncBase<T> : QNetworkTransform where T : Component
|
public abstract class SyncBase<T> : QNetworkTransform where T : Component
|
||||||
{
|
{
|
||||||
public uint PlayerId { get; private set; } = uint.MaxValue;
|
public uint AttachedNetId
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (NetIdentity == null)
|
||||||
|
{
|
||||||
|
DebugLog.ToConsole($"Error - Trying to get AttachedNetId with null NetIdentity! Type:{GetType().Name} GrandType:{GetType().GetType().Name}", MessageType.Error);
|
||||||
|
return uint.MaxValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NetIdentity.NetId.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public uint PlayerId
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (!IsPlayerObject)
|
||||||
|
{
|
||||||
|
return uint.MaxValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (NetIdentity == null)
|
||||||
|
{
|
||||||
|
DebugLog.ToConsole($"Error - Trying to get PlayerId with null NetIdentity! Type:{GetType().Name} GrandType:{GetType().GetType().Name}", MessageType.Error);
|
||||||
|
return uint.MaxValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NetIdentity.RootIdentity != null
|
||||||
|
? NetIdentity.RootIdentity.NetId.Value
|
||||||
|
: AttachedNetId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public PlayerInfo Player => QSBPlayerManager.GetPlayer(PlayerId);
|
public PlayerInfo Player => QSBPlayerManager.GetPlayer(PlayerId);
|
||||||
|
|
||||||
private bool _baseIsReady
|
private bool _baseIsReady
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (NetId.Value is uint.MaxValue or 0)
|
if (NetId.Value is uint.MaxValue or 0U)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -41,7 +75,12 @@ namespace QSB.Syncs
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!IsLocalPlayer && !Player.IsReady)
|
if (Player == null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Player.IsReady && !IsLocalPlayer)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -56,7 +95,7 @@ namespace QSB.Syncs
|
|||||||
public abstract bool IgnoreDisabledAttachedObject { get; }
|
public abstract bool IgnoreDisabledAttachedObject { get; }
|
||||||
public abstract bool IgnoreNullReferenceTransform { get; }
|
public abstract bool IgnoreNullReferenceTransform { get; }
|
||||||
public abstract bool DestroyAttachedObject { get; }
|
public abstract bool DestroyAttachedObject { get; }
|
||||||
public abstract bool IsPlayerObject { get; }
|
public abstract bool IsPlayerObject { get; }
|
||||||
|
|
||||||
public T AttachedObject { get; set; }
|
public T AttachedObject { get; set; }
|
||||||
public Transform ReferenceTransform { get; set; }
|
public Transform ReferenceTransform { get; set; }
|
||||||
@ -79,12 +118,9 @@ namespace QSB.Syncs
|
|||||||
{
|
{
|
||||||
if (IsPlayerObject)
|
if (IsPlayerObject)
|
||||||
{
|
{
|
||||||
// get player objects spawned before this object (or is this one)
|
var lowestBound = QSBWorldSync.GetUnityObjects<PlayerTransformSync>()
|
||||||
// and use the most recently spawned one
|
.Where(x => x.NetId.Value <= NetId.Value).OrderBy(x => x.NetId.Value).Last();
|
||||||
PlayerId = QSBWorldSync.GetUnityObjects<PlayerTransformSync>()
|
NetIdentity.SetRootIdentity(lowestBound.NetIdentity);
|
||||||
.Select(x => x.NetId.Value)
|
|
||||||
.Where(x => x <= NetId.Value)
|
|
||||||
.Max();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DontDestroyOnLoad(gameObject);
|
DontDestroyOnLoad(gameObject);
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using OWML.Common;
|
using OWML.Common;
|
||||||
using QSB.Player;
|
using QSB.Player;
|
||||||
|
using QSB.Player.TransformSync;
|
||||||
using QuantumUNET;
|
using QuantumUNET;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -47,7 +48,21 @@ namespace QSB.Utility
|
|||||||
return uint.MaxValue;
|
return uint.MaxValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
return playerController.UnetView.NetId.Value;
|
var go = playerController.Gameobject;
|
||||||
|
if (go == null)
|
||||||
|
{
|
||||||
|
DebugLog.ToConsole($"Error - GameObject of {playerController.UnetView.NetId.Value} is null.", MessageType.Error);
|
||||||
|
return uint.MaxValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
var controller = go.GetComponent<PlayerTransformSync>();
|
||||||
|
if (controller == null)
|
||||||
|
{
|
||||||
|
DebugLog.ToConsole($"Error - No PlayerTransformSync found on {go.name}", MessageType.Error);
|
||||||
|
return uint.MaxValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
return controller.NetId.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SpawnWithServerAuthority(this GameObject go)
|
public static void SpawnWithServerAuthority(this GameObject go)
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"debugMode": true,
|
"debugMode": false,
|
||||||
"drawLines": true,
|
"drawLines": false,
|
||||||
"showQuantumVisibilityObjects": true,
|
"showQuantumVisibilityObjects": true,
|
||||||
"showQuantumDebugBoxes": true,
|
"showQuantumDebugBoxes": true,
|
||||||
"avoidTimeSync": false,
|
"avoidTimeSync": false,
|
||||||
"skipTitleScreen": true
|
"skipTitleScreen": false
|
||||||
}
|
}
|
@ -21,6 +21,8 @@ namespace QuantumUNET.Components
|
|||||||
public short PlayerControllerId { get; private set; } = -1;
|
public short PlayerControllerId { get; private set; } = -1;
|
||||||
public QNetworkConnection ConnectionToServer { get; private set; }
|
public QNetworkConnection ConnectionToServer { get; private set; }
|
||||||
public QNetworkConnection ConnectionToClient { get; private set; }
|
public QNetworkConnection ConnectionToClient { get; private set; }
|
||||||
|
public QNetworkIdentity RootIdentity { get; private set; }
|
||||||
|
public List<QNetworkIdentity> SubIdentities { get; private set; } = new List<QNetworkIdentity>();
|
||||||
|
|
||||||
public bool ServerOnly
|
public bool ServerOnly
|
||||||
{
|
{
|
||||||
@ -37,6 +39,23 @@ namespace QuantumUNET.Components
|
|||||||
public QNetworkBehaviour[] GetNetworkBehaviours()
|
public QNetworkBehaviour[] GetNetworkBehaviours()
|
||||||
=> m_NetworkBehaviours;
|
=> m_NetworkBehaviours;
|
||||||
|
|
||||||
|
public void SetRootIdentity(QNetworkIdentity newRoot)
|
||||||
|
{
|
||||||
|
if (RootIdentity != null)
|
||||||
|
{
|
||||||
|
RootIdentity.RemoveSubIdentity(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
RootIdentity = newRoot;
|
||||||
|
RootIdentity.AddSubIndentity(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal void AddSubIndentity(QNetworkIdentity identityToAdd)
|
||||||
|
=> SubIdentities.Add(identityToAdd);
|
||||||
|
|
||||||
|
internal void RemoveSubIdentity(QNetworkIdentity identityToRemove)
|
||||||
|
=> SubIdentities.Remove(identityToRemove);
|
||||||
|
|
||||||
internal void SetDynamicAssetId(int newAssetId)
|
internal void SetDynamicAssetId(int newAssetId)
|
||||||
{
|
{
|
||||||
if (m_AssetId == 0 || m_AssetId.Equals(newAssetId))
|
if (m_AssetId == 0 || m_AssetId.Equals(newAssetId))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user