mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-15 03:30:53 +01:00
@@ -162,11 +162,14 @@ namespace Robust.Client.Player
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!EntManager.EnsureComponent(uid.Value, out EyeComponent eye))
|
||||
if (!EntManager.HasComponent<EyeComponent>(uid.Value))
|
||||
{
|
||||
if (_client.RunLevel != ClientRunLevel.SinglePlayerGame)
|
||||
Sawmill.Warning($"Attaching local player to an entity {EntManager.ToPrettyString(uid)} without an eye. This eye will not be netsynced and may cause issues.");
|
||||
var eye = (EyeComponent) Factory.GetComponent(typeof(EyeComponent));
|
||||
eye.Owner = uid.Value;
|
||||
eye.NetSyncEnabled = false;
|
||||
EntManager.AddComponent(uid.Value, eye);
|
||||
}
|
||||
|
||||
Sawmill.Info($"Attaching local player to {EntManager.ToPrettyString(uid)}.");
|
||||
|
||||
@@ -318,10 +318,8 @@ namespace Robust.Shared.GameObjects
|
||||
metadata ??= MetaQuery.GetComponentInternal(uid);
|
||||
metadata.NetComponents.Add(netId, component);
|
||||
}
|
||||
else
|
||||
{
|
||||
component.Networked = false;
|
||||
}
|
||||
|
||||
component.Networked = reg.NetID != null;
|
||||
|
||||
var eventArgs = new AddedComponentEventArgs(new ComponentEventArgs(component, uid), reg);
|
||||
ComponentAdded?.Invoke(eventArgs);
|
||||
|
||||
@@ -12,6 +12,7 @@ namespace Robust.Shared.Player;
|
||||
internal abstract partial class SharedPlayerManager : ISharedPlayerManager
|
||||
{
|
||||
[Dependency] protected readonly IEntityManager EntManager = default!;
|
||||
[Dependency] protected readonly IComponentFactory Factory = default!;
|
||||
[Dependency] protected readonly ILogManager LogMan = default!;
|
||||
[Dependency] protected readonly IGameTiming Timing = default!;
|
||||
[Dependency] private readonly INetManager _netMan = default!;
|
||||
|
||||
Reference in New Issue
Block a user