Merge ActorSystem and IPlayerManager (#21314)
This commit is contained in:
@@ -6,6 +6,7 @@ using Robust.Client.Player;
|
|||||||
using Robust.Shared.ContentPack;
|
using Robust.Shared.ContentPack;
|
||||||
using Robust.Shared.GameStates;
|
using Robust.Shared.GameStates;
|
||||||
using Robust.Shared.Input.Binding;
|
using Robust.Shared.Input.Binding;
|
||||||
|
using Robust.Shared.Player;
|
||||||
using Robust.Shared.Serialization.Manager;
|
using Robust.Shared.Serialization.Manager;
|
||||||
using Robust.Shared.Serialization.Markdown;
|
using Robust.Shared.Serialization.Markdown;
|
||||||
using Robust.Shared.Serialization.Markdown.Mapping;
|
using Robust.Shared.Serialization.Markdown.Mapping;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using System.Linq;
|
|||||||
using Content.Shared.Alert;
|
using Content.Shared.Alert;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.Player;
|
using Robust.Client.Player;
|
||||||
|
using Robust.Shared.Player;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
|
|
||||||
namespace Content.Client.Alerts;
|
namespace Content.Client.Alerts;
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ using Robust.Client.Player;
|
|||||||
using Robust.Shared.Input;
|
using Robust.Shared.Input;
|
||||||
using Robust.Shared.Input.Binding;
|
using Robust.Shared.Input.Binding;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Player;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
|
|
||||||
namespace Content.Client.Construction
|
namespace Content.Client.Construction
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using Content.Shared.Drugs;
|
using Content.Shared.Drugs;
|
||||||
using Robust.Client.Graphics;
|
using Robust.Client.Graphics;
|
||||||
using Robust.Client.Player;
|
using Robust.Client.Player;
|
||||||
|
using Robust.Shared.Player;
|
||||||
|
|
||||||
namespace Content.Client.Drugs;
|
namespace Content.Client.Drugs;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using Content.Shared.Drunk;
|
using Content.Shared.Drunk;
|
||||||
using Robust.Client.Graphics;
|
using Robust.Client.Graphics;
|
||||||
using Robust.Client.Player;
|
using Robust.Client.Player;
|
||||||
|
using Robust.Shared.Player;
|
||||||
|
|
||||||
namespace Content.Client.Drunk;
|
namespace Content.Client.Drunk;
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using Robust.Client.Graphics;
|
|||||||
using Robust.Client.Player;
|
using Robust.Client.Player;
|
||||||
using Content.Shared.Eye.Blinding.Components;
|
using Content.Shared.Eye.Blinding.Components;
|
||||||
using Content.Shared.GameTicking;
|
using Content.Shared.GameTicking;
|
||||||
|
using Robust.Shared.Player;
|
||||||
|
|
||||||
namespace Content.Client.Eye.Blinding;
|
namespace Content.Client.Eye.Blinding;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using Content.Shared.Eye.Blinding.Components;
|
using Content.Shared.Eye.Blinding.Components;
|
||||||
using Robust.Client.Graphics;
|
using Robust.Client.Graphics;
|
||||||
using Robust.Client.Player;
|
using Robust.Client.Player;
|
||||||
|
using Robust.Shared.Player;
|
||||||
|
|
||||||
namespace Content.Client.Eye.Blinding;
|
namespace Content.Client.Eye.Blinding;
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using JetBrains.Annotations;
|
|||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Client.Physics;
|
using Robust.Client.Physics;
|
||||||
using Robust.Client.Player;
|
using Robust.Client.Player;
|
||||||
|
using Robust.Shared.Player;
|
||||||
using Robust.Shared.Timing;
|
using Robust.Shared.Timing;
|
||||||
|
|
||||||
namespace Content.Client.Eye;
|
namespace Content.Client.Eye;
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using Robust.Client.Console;
|
|||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Client.Graphics;
|
using Robust.Client.Graphics;
|
||||||
using Robust.Client.Player;
|
using Robust.Client.Player;
|
||||||
|
using Robust.Shared.Player;
|
||||||
|
|
||||||
namespace Content.Client.Ghost
|
namespace Content.Client.Ghost
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ using Robust.Client.Player;
|
|||||||
using Robust.Client.UserInterface;
|
using Robust.Client.UserInterface;
|
||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameStates;
|
using Robust.Shared.GameStates;
|
||||||
|
using Robust.Shared.Player;
|
||||||
using Robust.Shared.Timing;
|
using Robust.Shared.Timing;
|
||||||
|
|
||||||
namespace Content.Client.Hands.Systems
|
namespace Content.Client.Hands.Systems
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ using Robust.Client.Player;
|
|||||||
using Robust.Client.UserInterface;
|
using Robust.Client.UserInterface;
|
||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.Input.Binding;
|
using Robust.Shared.Input.Binding;
|
||||||
|
using Robust.Shared.Player;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
|
|
||||||
namespace Content.Client.Inventory
|
namespace Content.Client.Inventory
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using Content.Shared.GameTicking;
|
|||||||
using Content.Shared.Inventory;
|
using Content.Shared.Inventory;
|
||||||
using Content.Shared.Inventory.Events;
|
using Content.Shared.Inventory.Events;
|
||||||
using Robust.Client.Player;
|
using Robust.Client.Player;
|
||||||
|
using Robust.Shared.Player;
|
||||||
|
|
||||||
namespace Content.Client.Overlays;
|
namespace Content.Client.Overlays;
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using Content.Shared.Pulling.Components;
|
|||||||
using Robust.Client.Physics;
|
using Robust.Client.Physics;
|
||||||
using Robust.Client.Player;
|
using Robust.Client.Player;
|
||||||
using Robust.Shared.Physics.Components;
|
using Robust.Shared.Physics.Components;
|
||||||
|
using Robust.Shared.Player;
|
||||||
using Robust.Shared.Timing;
|
using Robust.Shared.Timing;
|
||||||
|
|
||||||
namespace Content.Client.Physics.Controllers
|
namespace Content.Client.Physics.Controllers
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
using Content.Shared.Movement.Components;
|
using Content.Shared.Movement.Components;
|
||||||
using Robust.Client.Player;
|
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Map.Components;
|
using Robust.Shared.Map.Components;
|
||||||
using Robust.Shared.Network;
|
using Robust.Shared.Network;
|
||||||
|
using Robust.Shared.Player;
|
||||||
|
|
||||||
namespace Content.Client.Replay.Spectator;
|
namespace Content.Client.Replay.Spectator;
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using Robust.Client.Player;
|
|||||||
using Robust.Client.Replays.Playback;
|
using Robust.Client.Replays.Playback;
|
||||||
using Robust.Client.State;
|
using Robust.Client.State;
|
||||||
using Robust.Shared.Console;
|
using Robust.Shared.Console;
|
||||||
|
using Robust.Shared.Player;
|
||||||
using Robust.Shared.Serialization.Markdown.Mapping;
|
using Robust.Shared.Serialization.Markdown.Mapping;
|
||||||
|
|
||||||
namespace Content.Client.Replay.Spectator;
|
namespace Content.Client.Replay.Spectator;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using System.Numerics;
|
|||||||
using Content.Shared.Traits.Assorted;
|
using Content.Shared.Traits.Assorted;
|
||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
using Robust.Client.Player;
|
using Robust.Client.Player;
|
||||||
|
using Robust.Shared.Player;
|
||||||
using Robust.Shared.Timing;
|
using Robust.Shared.Timing;
|
||||||
|
|
||||||
namespace Content.Client.Traits;
|
namespace Content.Client.Traits;
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ using Robust.Client.Graphics;
|
|||||||
using Robust.Client.Player;
|
using Robust.Client.Player;
|
||||||
using Robust.Client.UserInterface;
|
using Robust.Client.UserInterface;
|
||||||
using Robust.Client.UserInterface.Controllers;
|
using Robust.Client.UserInterface.Controllers;
|
||||||
|
using Robust.Shared.Player;
|
||||||
|
|
||||||
namespace Content.Client.UserInterface.Systems.DamageOverlays;
|
namespace Content.Client.UserInterface.Systems.DamageOverlays;
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ using Content.Client.Construction;
|
|||||||
using Content.Client.Examine;
|
using Content.Client.Examine;
|
||||||
using Content.IntegrationTests.Pair;
|
using Content.IntegrationTests.Pair;
|
||||||
using Content.Server.Body.Systems;
|
using Content.Server.Body.Systems;
|
||||||
using Content.Server.Players;
|
|
||||||
using Content.Server.Stack;
|
using Content.Server.Stack;
|
||||||
using Content.Server.Tools;
|
using Content.Server.Tools;
|
||||||
using Content.Shared.Body.Part;
|
using Content.Shared.Body.Part;
|
||||||
@@ -17,8 +16,6 @@ using Content.Shared.Mind;
|
|||||||
using Content.Shared.Players;
|
using Content.Shared.Players;
|
||||||
using Robust.Client.Input;
|
using Robust.Client.Input;
|
||||||
using Robust.Client.UserInterface;
|
using Robust.Client.UserInterface;
|
||||||
using Robust.Server.GameObjects;
|
|
||||||
using Robust.Server.Player;
|
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Log;
|
using Robust.Shared.Log;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
@@ -102,7 +99,6 @@ public abstract partial class InteractionTest
|
|||||||
protected ToolSystem ToolSys = default!;
|
protected ToolSystem ToolSys = default!;
|
||||||
protected InteractionTestSystem STestSystem = default!;
|
protected InteractionTestSystem STestSystem = default!;
|
||||||
protected SharedTransformSystem Transform = default!;
|
protected SharedTransformSystem Transform = default!;
|
||||||
protected ActorSystem Actor = default!;
|
|
||||||
protected ISawmill SLogger = default!;
|
protected ISawmill SLogger = default!;
|
||||||
|
|
||||||
// CLIENT dependencies
|
// CLIENT dependencies
|
||||||
@@ -161,7 +157,6 @@ public abstract partial class InteractionTest
|
|||||||
SConstruction = SEntMan.System<Server.Construction.ConstructionSystem>();
|
SConstruction = SEntMan.System<Server.Construction.ConstructionSystem>();
|
||||||
STestSystem = SEntMan.System<InteractionTestSystem>();
|
STestSystem = SEntMan.System<InteractionTestSystem>();
|
||||||
Stack = SEntMan.System<StackSystem>();
|
Stack = SEntMan.System<StackSystem>();
|
||||||
Actor = SEntMan.System<ActorSystem>();
|
|
||||||
SLogger = Server.ResolveDependency<ILogManager>().RootSawmill;
|
SLogger = Server.ResolveDependency<ILogManager>().RootSawmill;
|
||||||
|
|
||||||
// client dependencies
|
// client dependencies
|
||||||
@@ -197,17 +192,17 @@ public abstract partial class InteractionTest
|
|||||||
// Mind system is a time vampire
|
// Mind system is a time vampire
|
||||||
SEntMan.System<SharedMindSystem>().WipeMind(ServerSession.ContentData()?.Mind);
|
SEntMan.System<SharedMindSystem>().WipeMind(ServerSession.ContentData()?.Mind);
|
||||||
|
|
||||||
old = cPlayerMan.LocalPlayer.ControlledEntity;
|
old = cPlayerMan.LocalEntity;
|
||||||
Player = SEntMan.GetNetEntity(SEntMan.SpawnEntity(PlayerPrototype, SEntMan.GetCoordinates(PlayerCoords)));
|
Player = SEntMan.GetNetEntity(SEntMan.SpawnEntity(PlayerPrototype, SEntMan.GetCoordinates(PlayerCoords)));
|
||||||
var serverPlayerEnt = SEntMan.GetEntity(Player);
|
var serverPlayerEnt = SEntMan.GetEntity(Player);
|
||||||
Actor.Attach(serverPlayerEnt, ServerSession);
|
Server.PlayerMan.SetAttachedEntity(ServerSession, serverPlayerEnt);
|
||||||
Hands = SEntMan.GetComponent<HandsComponent>(serverPlayerEnt);
|
Hands = SEntMan.GetComponent<HandsComponent>(serverPlayerEnt);
|
||||||
DoAfters = SEntMan.GetComponent<DoAfterComponent>(serverPlayerEnt);
|
DoAfters = SEntMan.GetComponent<DoAfterComponent>(serverPlayerEnt);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Check player got attached.
|
// Check player got attached.
|
||||||
await RunTicks(5);
|
await RunTicks(5);
|
||||||
Assert.That(CEntMan.GetNetEntity(cPlayerMan.LocalPlayer.ControlledEntity), Is.EqualTo(Player));
|
Assert.That(CEntMan.GetNetEntity(cPlayerMan.LocalEntity), Is.EqualTo(Player));
|
||||||
|
|
||||||
// Delete old player entity.
|
// Delete old player entity.
|
||||||
await Server.WaitPost(() =>
|
await Server.WaitPost(() =>
|
||||||
@@ -234,7 +229,7 @@ public abstract partial class InteractionTest
|
|||||||
await Pair.ReallyBeIdle(5);
|
await Pair.ReallyBeIdle(5);
|
||||||
Assert.Multiple(() =>
|
Assert.Multiple(() =>
|
||||||
{
|
{
|
||||||
Assert.That(CEntMan.GetNetEntity(cPlayerMan.LocalPlayer.ControlledEntity), Is.EqualTo(Player));
|
Assert.That(CEntMan.GetNetEntity(cPlayerMan.LocalEntity), Is.EqualTo(Player));
|
||||||
Assert.That(sPlayerMan.GetSessionByUserId(ClientSession.UserId).AttachedEntity, Is.EqualTo(SEntMan.GetEntity(Player)));
|
Assert.That(sPlayerMan.GetSessionByUserId(ClientSession.UserId).AttachedEntity, Is.EqualTo(SEntMan.GetEntity(Player)));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,19 +1,7 @@
|
|||||||
using Content.Shared.Alert;
|
using Content.Shared.Alert;
|
||||||
using Robust.Server.GameObjects;
|
|
||||||
|
|
||||||
namespace Content.Server.Alert;
|
namespace Content.Server.Alert;
|
||||||
|
|
||||||
internal sealed class ServerAlertsSystem : AlertsSystem
|
internal sealed class ServerAlertsSystem : AlertsSystem
|
||||||
{
|
{
|
||||||
public override void Initialize()
|
|
||||||
{
|
|
||||||
base.Initialize();
|
|
||||||
|
|
||||||
SubscribeLocalEvent<AlertsComponent, PlayerAttachedEvent>(OnPlayerAttached);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnPlayerAttached(EntityUid uid, AlertsComponent component, PlayerAttachedEvent args)
|
|
||||||
{
|
|
||||||
Dirty(component);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using Content.Shared.ActionBlocker;
|
using Content.Shared.ActionBlocker;
|
||||||
using Content.Shared.Chat.TypingIndicator;
|
using Content.Shared.Chat.TypingIndicator;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Shared.Player;
|
||||||
|
|
||||||
namespace Content.Server.Chat.TypingIndicator;
|
namespace Content.Server.Chat.TypingIndicator;
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ using Content.Shared.GameWindow;
|
|||||||
using Content.Shared.Players;
|
using Content.Shared.Players;
|
||||||
using Content.Shared.Preferences;
|
using Content.Shared.Preferences;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Server.GameObjects;
|
|
||||||
using Robust.Server.Player;
|
using Robust.Server.Player;
|
||||||
using Robust.Shared.Enums;
|
using Robust.Shared.Enums;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
@@ -18,7 +17,6 @@ namespace Content.Server.GameTicking
|
|||||||
{
|
{
|
||||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||||
[Dependency] private readonly IServerDbManager _dbManager = default!;
|
[Dependency] private readonly IServerDbManager _dbManager = default!;
|
||||||
[Dependency] private readonly ActorSystem _actor = default!;
|
|
||||||
|
|
||||||
private void InitializePlayer()
|
private void InitializePlayer()
|
||||||
{
|
{
|
||||||
@@ -102,7 +100,7 @@ namespace Content.Server.GameTicking
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (_actor.Attach(mind.CurrentEntity, session))
|
if (_playerManager.SetAttachedEntity(session, mind.CurrentEntity))
|
||||||
{
|
{
|
||||||
PlayerJoinGame(session);
|
PlayerJoinGame(session);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,10 +7,8 @@ using Content.Shared.Ghost;
|
|||||||
using Content.Shared.Mind;
|
using Content.Shared.Mind;
|
||||||
using Content.Shared.Mind.Components;
|
using Content.Shared.Mind.Components;
|
||||||
using Content.Shared.Players;
|
using Content.Shared.Players;
|
||||||
using Robust.Server.GameObjects;
|
|
||||||
using Robust.Server.GameStates;
|
using Robust.Server.GameStates;
|
||||||
using Robust.Server.Player;
|
using Robust.Server.Player;
|
||||||
using Robust.Shared.Map;
|
|
||||||
using Robust.Shared.Map.Components;
|
using Robust.Shared.Map.Components;
|
||||||
using Robust.Shared.Network;
|
using Robust.Shared.Network;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
@@ -21,10 +19,8 @@ namespace Content.Server.Mind;
|
|||||||
|
|
||||||
public sealed class MindSystem : SharedMindSystem
|
public sealed class MindSystem : SharedMindSystem
|
||||||
{
|
{
|
||||||
[Dependency] private readonly ActorSystem _actor = default!;
|
|
||||||
[Dependency] private readonly GameTicker _gameTicker = default!;
|
[Dependency] private readonly GameTicker _gameTicker = default!;
|
||||||
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
|
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
|
||||||
[Dependency] private readonly IMapManager _maps = default!;
|
|
||||||
[Dependency] private readonly IPlayerManager _players = default!;
|
[Dependency] private readonly IPlayerManager _players = default!;
|
||||||
[Dependency] private readonly MetaDataSystem _metaData = default!;
|
[Dependency] private readonly MetaDataSystem _metaData = default!;
|
||||||
[Dependency] private readonly SharedGhostSystem _ghosts = default!;
|
[Dependency] private readonly SharedGhostSystem _ghosts = default!;
|
||||||
@@ -176,7 +172,7 @@ public sealed class MindSystem : SharedMindSystem
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (GetSession(mind) is { } session)
|
if (GetSession(mind) is { } session)
|
||||||
_actor.Attach(entity, session);
|
_players.SetAttachedEntity(session, entity);
|
||||||
|
|
||||||
mind.VisitingEntity = entity;
|
mind.VisitingEntity = entity;
|
||||||
|
|
||||||
@@ -203,7 +199,7 @@ public sealed class MindSystem : SharedMindSystem
|
|||||||
|
|
||||||
var owned = mind.OwnedEntity;
|
var owned = mind.OwnedEntity;
|
||||||
if (GetSession(mind) is { } session)
|
if (GetSession(mind) is { } session)
|
||||||
_actor.Attach(owned, session);
|
_players.SetAttachedEntity(session, owned);
|
||||||
|
|
||||||
if (owned.HasValue)
|
if (owned.HasValue)
|
||||||
{
|
{
|
||||||
@@ -292,7 +288,7 @@ public sealed class MindSystem : SharedMindSystem
|
|||||||
var session = GetSession(mind);
|
var session = GetSession(mind);
|
||||||
if (session != null && !alreadyAttached && mind.VisitingEntity == null)
|
if (session != null && !alreadyAttached && mind.VisitingEntity == null)
|
||||||
{
|
{
|
||||||
_actor.Attach(entity, session, true);
|
_players.SetAttachedEntity(session, entity, true);
|
||||||
DebugTools.Assert(session.AttachedEntity == entity, $"Failed to attach entity.");
|
DebugTools.Assert(session.AttachedEntity == entity, $"Failed to attach entity.");
|
||||||
Log.Info($"Session {session.Name} transferred to entity {entity}.");
|
Log.Info($"Session {session.Name} transferred to entity {entity}.");
|
||||||
}
|
}
|
||||||
@@ -333,7 +329,7 @@ public sealed class MindSystem : SharedMindSystem
|
|||||||
|
|
||||||
if (mind.Session != null)
|
if (mind.Session != null)
|
||||||
{
|
{
|
||||||
_actor.Attach(null, GetSession(mind)!);
|
_players.SetAttachedEntity(GetSession(mind), null);
|
||||||
mind.Session = null;
|
mind.Session = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -367,7 +363,7 @@ public sealed class MindSystem : SharedMindSystem
|
|||||||
{
|
{
|
||||||
mind.Session = ret;
|
mind.Session = ret;
|
||||||
_pvsOverride.AddSessionOverride(mindId, ret);
|
_pvsOverride.AddSessionOverride(mindId, ret);
|
||||||
_actor.Attach(mind.CurrentEntity, ret);
|
_players.SetAttachedEntity(ret, mind.CurrentEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
// session may be null, but user data may still exist for disconnected players.
|
// session may be null, but user data may still exist for disconnected players.
|
||||||
|
|||||||
@@ -1,16 +1,14 @@
|
|||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using Content.Server.Cargo.Components;
|
|
||||||
using Content.Server.Shuttle.Components;
|
using Content.Server.Shuttle.Components;
|
||||||
using Content.Server.Shuttles.Components;
|
using Content.Server.Shuttles.Components;
|
||||||
using Content.Server.Shuttles.Systems;
|
using Content.Server.Shuttles.Systems;
|
||||||
using Content.Shared.Movement.Components;
|
using Content.Shared.Movement.Components;
|
||||||
using Content.Shared.Movement.Systems;
|
using Content.Shared.Movement.Systems;
|
||||||
using Content.Shared.Pulling.Components;
|
|
||||||
using Content.Shared.Shuttles.Components;
|
using Content.Shared.Shuttles.Components;
|
||||||
using Content.Shared.Shuttles.Systems;
|
using Content.Shared.Shuttles.Systems;
|
||||||
using Robust.Server.GameObjects;
|
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Physics.Components;
|
using Robust.Shared.Physics.Components;
|
||||||
|
using Robust.Shared.Player;
|
||||||
|
|
||||||
namespace Content.Server.Physics.Controllers
|
namespace Content.Server.Physics.Controllers
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
using Content.Server.Administration.Logs;
|
using Content.Server.Administration.Logs;
|
||||||
using Content.Shared.Database;
|
using Content.Shared.Database;
|
||||||
using Robust.Server.GameObjects;
|
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Placement;
|
using Robust.Shared.Placement;
|
||||||
|
using Robust.Shared.Player;
|
||||||
|
|
||||||
namespace Content.Server.Placement;
|
namespace Content.Server.Placement;
|
||||||
|
|
||||||
@@ -10,7 +10,7 @@ public sealed class PlacementLoggerSystem : EntitySystem
|
|||||||
{
|
{
|
||||||
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
|
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
|
||||||
[Dependency] private readonly ITileDefinitionManager _tileDefinitionManager = default!;
|
[Dependency] private readonly ITileDefinitionManager _tileDefinitionManager = default!;
|
||||||
[Dependency] private readonly ActorSystem _actorSystem = default!;
|
[Dependency] private readonly ISharedPlayerManager _player = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -21,7 +21,8 @@ public sealed class PlacementLoggerSystem : EntitySystem
|
|||||||
|
|
||||||
private void OnEntityPlacement(PlacementEntityEvent ev)
|
private void OnEntityPlacement(PlacementEntityEvent ev)
|
||||||
{
|
{
|
||||||
_actorSystem.TryGetActorFromUserId(ev.PlacerNetUserId, out var actor, out var actorEntity);
|
_player.TryGetSessionById(ev.PlacerNetUserId, out var actor);
|
||||||
|
var actorEntity = actor?.AttachedEntity;
|
||||||
|
|
||||||
var logType = ev.PlacementEventAction switch
|
var logType = ev.PlacementEventAction switch
|
||||||
{
|
{
|
||||||
@@ -43,7 +44,8 @@ public sealed class PlacementLoggerSystem : EntitySystem
|
|||||||
|
|
||||||
private void OnTilePlacement(PlacementTileEvent ev)
|
private void OnTilePlacement(PlacementTileEvent ev)
|
||||||
{
|
{
|
||||||
_actorSystem.TryGetActorFromUserId(ev.PlacerNetUserId, out var actor, out var actorEntity);
|
_player.TryGetSessionById(ev.PlacerNetUserId, out var actor);
|
||||||
|
var actorEntity = actor?.AttachedEntity;
|
||||||
|
|
||||||
if (actorEntity != null)
|
if (actorEntity != null)
|
||||||
_adminLogger.Add(LogType.Tile, LogImpact.High,
|
_adminLogger.Add(LogType.Tile, LogImpact.High,
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
using Robust.Shared.Player;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
|
|
||||||
namespace Content.Shared.Alert;
|
namespace Content.Shared.Alert;
|
||||||
@@ -166,6 +167,7 @@ public abstract class AlertsSystem : EntitySystem
|
|||||||
|
|
||||||
SubscribeLocalEvent<AlertsComponent, ComponentStartup>(HandleComponentStartup);
|
SubscribeLocalEvent<AlertsComponent, ComponentStartup>(HandleComponentStartup);
|
||||||
SubscribeLocalEvent<AlertsComponent, ComponentShutdown>(HandleComponentShutdown);
|
SubscribeLocalEvent<AlertsComponent, ComponentShutdown>(HandleComponentShutdown);
|
||||||
|
SubscribeLocalEvent<AlertsComponent, PlayerAttachedEvent>(OnPlayerAttached);
|
||||||
|
|
||||||
SubscribeNetworkEvent<ClickAlertEvent>(HandleClickAlert);
|
SubscribeNetworkEvent<ClickAlertEvent>(HandleClickAlert);
|
||||||
|
|
||||||
@@ -239,4 +241,9 @@ public abstract class AlertsSystem : EntitySystem
|
|||||||
|
|
||||||
alert.OnClick?.AlertClicked(player.Value);
|
alert.OnClick?.AlertClicked(player.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnPlayerAttached(EntityUid uid, AlertsComponent component, PlayerAttachedEvent args)
|
||||||
|
{
|
||||||
|
Dirty(uid, component);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user