mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-09-15 06:42:25 +02:00
Remove LocalPlayer static resolves (#3995)
This commit is contained in:
@@ -56,7 +56,7 @@ namespace Robust.Client.Player
|
||||
/// Attaches a client to an entity.
|
||||
/// </summary>
|
||||
/// <param name="entity">Entity to attach the client to.</param>
|
||||
public void AttachEntity(EntityUid entity)
|
||||
public void AttachEntity(EntityUid entity, IEntityManager entMan, IBaseClient client)
|
||||
{
|
||||
if (ControlledEntity == entity)
|
||||
return;
|
||||
@@ -64,8 +64,6 @@ namespace Robust.Client.Player
|
||||
// Detach and cleanup first
|
||||
DetachEntity();
|
||||
|
||||
var entMan = IoCManager.Resolve<IEntityManager>();
|
||||
|
||||
if (!entMan.EntityExists(entity))
|
||||
{
|
||||
Logger.Error($"Attempting to attach player to non-existent entity {entity}!");
|
||||
@@ -80,7 +78,7 @@ namespace Robust.Client.Player
|
||||
{
|
||||
eye = entMan.AddComponent<EyeComponent>(entity);
|
||||
|
||||
if (IoCManager.Resolve<IBaseClient>().RunLevel != ClientRunLevel.SinglePlayerGame)
|
||||
if (client.RunLevel != ClientRunLevel.SinglePlayerGame)
|
||||
{
|
||||
Logger.Warning($"Attaching local player to an entity {entMan.ToPrettyString(entity)} without an eye. This eye will not be netsynced and may cause issues.");
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ namespace Robust.Client.Player
|
||||
{
|
||||
[Dependency] private readonly IClientNetManager _network = default!;
|
||||
[Dependency] private readonly IBaseClient _client = default!;
|
||||
[Dependency] private readonly IEntityManager _entManager = default!;
|
||||
|
||||
/// <summary>
|
||||
/// Active sessions of connected clients to the server.
|
||||
@@ -153,7 +154,7 @@ namespace Robust.Client.Player
|
||||
return;
|
||||
}
|
||||
|
||||
LocalPlayer.AttachEntity(entity.Value);
|
||||
LocalPlayer.AttachEntity(entity.Value, _entManager, _client);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user