diff --git a/Content.Client/CardboardBox/CardboardBoxSystem.cs b/Content.Client/CardboardBox/CardboardBoxSystem.cs index 50f9de239d5209..90a21d8e41b01d 100644 --- a/Content.Client/CardboardBox/CardboardBoxSystem.cs +++ b/Content.Client/CardboardBox/CardboardBoxSystem.cs @@ -1,4 +1,4 @@ -using System.Numerics; +using System.Numerics; using Content.Shared.CardboardBox; using Content.Shared.CardboardBox.Components; using Content.Shared.Examine; @@ -11,6 +11,7 @@ public sealed class CardboardBoxSystem : SharedCardboardBoxSystem { [Dependency] private readonly EntityLookupSystem _entityLookup = default!; [Dependency] private readonly TransformSystem _transform = default!; + [Dependency] private readonly ExamineSystemShared _examine = default!; public override void Initialize() { @@ -55,7 +56,7 @@ private void OnBoxEffect(PlayBoxEffectMessage msg) foreach (var mob in mobMoverEntities) { var mapPos = _transform.GetMapCoordinates(mob); - if (!ExamineSystemShared.InRangeUnOccluded(sourcePos, mapPos, box.Distance, null)) + if (!_examine.InRangeUnOccluded(sourcePos, mapPos, box.Distance, null)) continue; var ent = Spawn(box.Effect, mapPos); diff --git a/Content.Client/Popups/PopupOverlay.cs b/Content.Client/Popups/PopupOverlay.cs index 1305d8bb947b98..3bfa7278734a37 100644 --- a/Content.Client/Popups/PopupOverlay.cs +++ b/Content.Client/Popups/PopupOverlay.cs @@ -21,6 +21,7 @@ public sealed class PopupOverlay : Overlay private readonly IUserInterfaceManager _uiManager; private readonly PopupSystem _popup; private readonly PopupUIController _controller; + private readonly ExamineSystemShared _examine; private readonly ShaderInstance _shader; @@ -33,12 +34,14 @@ public PopupOverlay( IPrototypeManager protoManager, IUserInterfaceManager uiManager, PopupUIController controller, + ExamineSystemShared examine, PopupSystem popup) { _configManager = configManager; _entManager = entManager; _playerMgr = playerMgr; _uiManager = uiManager; + _examine = examine; _popup = popup; _controller = controller; @@ -81,7 +84,7 @@ private void DrawWorld(DrawingHandleScreen worldHandle, OverlayDrawArgs args, fl var distance = (mapPos.Position - args.WorldBounds.Center).Length(); // Should handle fade here too wyci. - if (!args.WorldBounds.Contains(mapPos.Position) || !ExamineSystemShared.InRangeUnOccluded(viewPos, mapPos, distance, + if (!args.WorldBounds.Contains(mapPos.Position) || !_examine.InRangeUnOccluded(viewPos, mapPos, distance, e => e == popup.InitialPos.EntityId || e == ourEntity, entMan: _entManager)) continue; diff --git a/Content.Client/Popups/PopupSystem.cs b/Content.Client/Popups/PopupSystem.cs index cf96c41241a121..46c1e0cdf62bc9 100644 --- a/Content.Client/Popups/PopupSystem.cs +++ b/Content.Client/Popups/PopupSystem.cs @@ -1,4 +1,5 @@ using System.Linq; +using Content.Shared.Examine; using Content.Shared.GameTicking; using Content.Shared.Popups; using Robust.Client.Graphics; @@ -26,6 +27,7 @@ public sealed class PopupSystem : SharedPopupSystem [Dependency] private readonly IGameTiming _timing = default!; [Dependency] private readonly IUserInterfaceManager _uiManager = default!; [Dependency] private readonly IReplayRecordingManager _replayRecording = default!; + [Dependency] private readonly ExamineSystemShared _examine = default!; public IReadOnlyList WorldLabels => _aliveWorldLabels; public IReadOnlyList CursorLabels => _aliveCursorLabels; @@ -51,6 +53,7 @@ public override void Initialize() _prototype, _uiManager, _uiManager.GetUIController(), + _examine, this)); } diff --git a/Content.Client/UserInterface/Systems/Chat/ChatUIController.cs b/Content.Client/UserInterface/Systems/Chat/ChatUIController.cs index b1cff5b85a3273..ac0ea5335e6ad4 100644 --- a/Content.Client/UserInterface/Systems/Chat/ChatUIController.cs +++ b/Content.Client/UserInterface/Systems/Chat/ChatUIController.cs @@ -613,7 +613,7 @@ private void UpdateQueuedSpeechBubbles(FrameEventArgs delta) var otherPos = EntityManager.GetComponent(ent).MapPosition; - if (occluded && !ExamineSystemShared.InRangeUnOccluded( + if (occluded && !_examine.InRangeUnOccluded( playerPos, otherPos, 0f, (ent, player), predicate)) diff --git a/Content.Client/Verbs/VerbSystem.cs b/Content.Client/Verbs/VerbSystem.cs index 329a8977a68438..77f46a3fc97703 100644 --- a/Content.Client/Verbs/VerbSystem.cs +++ b/Content.Client/Verbs/VerbSystem.cs @@ -20,7 +20,7 @@ namespace Content.Client.Verbs public sealed class VerbSystem : SharedVerbSystem { [Dependency] private readonly PopupSystem _popupSystem = default!; - [Dependency] private readonly ExamineSystem _examineSystem = default!; + [Dependency] private readonly ExamineSystem _examine = default!; [Dependency] private readonly TagSystem _tagSystem = default!; [Dependency] private readonly IStateManager _stateManager = default!; [Dependency] private readonly EntityLookupSystem _entityLookup = default!; @@ -77,7 +77,7 @@ public bool TryGetEntityMenuEntities(MapCoordinates targetPos, [NotNullWhen(true bool Predicate(EntityUid e) => e == player || entitiesUnderMouse.Contains(e); // first check the general location. - if (!_examineSystem.CanExamine(player.Value, targetPos, Predicate)) + if (!_examine.CanExamine(player.Value, targetPos, Predicate)) return false; TryComp(player.Value, out ExaminerComponent? examiner); @@ -86,7 +86,7 @@ public bool TryGetEntityMenuEntities(MapCoordinates targetPos, [NotNullWhen(true entities = new(); foreach (var ent in _entityLookup.GetEntitiesInRange(targetPos, EntityMenuLookupSize)) { - if (_examineSystem.CanExamine(player.Value, targetPos, Predicate, ent, examiner)) + if (_examine.CanExamine(player.Value, targetPos, Predicate, ent, examiner)) entities.Add(ent); } } @@ -147,7 +147,7 @@ public bool TryGetEntityMenuEntities(MapCoordinates targetPos, [NotNullWhen(true { var entity = entities[i]; - if (!ExamineSystemShared.InRangeUnOccluded( + if (!_examine.InRangeUnOccluded( playerPos, xformQuery.GetComponent(entity).MapPosition, ExamineSystemShared.ExamineRange, diff --git a/Content.Server/Administration/Systems/AdminVerbSystem.cs b/Content.Server/Administration/Systems/AdminVerbSystem.cs index c4754af9340f40..f5b237b4492afb 100644 --- a/Content.Server/Administration/Systems/AdminVerbSystem.cs +++ b/Content.Server/Administration/Systems/AdminVerbSystem.cs @@ -66,6 +66,7 @@ public sealed partial class AdminVerbSystem : EntitySystem [Dependency] private readonly SharedPopupSystem _popup = default!; [Dependency] private readonly StationSystem _stations = default!; [Dependency] private readonly StationSpawningSystem _spawning = default!; + [Dependency] private readonly ExamineSystemShared _examine = default!; private readonly Dictionary> _openSolutionUis = new(); @@ -416,7 +417,7 @@ private void AddDebugVerbs(GetVerbsEvent args) Act = () => { - var message = ExamineSystemShared.InRangeUnOccluded(args.User, args.Target) + var message = _examine.InRangeUnOccluded(args.User, args.Target) ? Loc.GetString("in-range-unoccluded-verb-on-activate-not-occluded") : Loc.GetString("in-range-unoccluded-verb-on-activate-occluded"); diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Monstermos.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Monstermos.cs index aceda3cd332391..737976a82973b1 100644 --- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Monstermos.cs +++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Monstermos.cs @@ -635,14 +635,14 @@ private void AdjustEqMovement(TileAtmosphere tile, AtmosDirection direction, flo // Turns out: no they don't. Temporary debug checks to figure out which caller is causing problems: if (tile == null) { - Logger.Error($"Encountered null-tile in {nameof(AdjustEqMovement)}. Trace: {Environment.StackTrace}"); + Log.Error($"Encountered null-tile in {nameof(AdjustEqMovement)}. Trace: {Environment.StackTrace}"); return; } var adj = tile.AdjacentTiles[direction.ToIndex()]; if (adj == null) { var nonNull = tile.AdjacentTiles.Where(x => x != null).Count(); - Logger.Error($"Encountered null adjacent tile in {nameof(AdjustEqMovement)}. Dir: {direction}, Tile: {tile.Tile}, non-null adj count: {nonNull}, Trace: {Environment.StackTrace}"); + Log.Error($"Encountered null adjacent tile in {nameof(AdjustEqMovement)}. Dir: {direction}, Tile: {tile.Tile}, non-null adj count: {nonNull}, Trace: {Environment.StackTrace}"); return; } diff --git a/Content.Server/Chat/TypingIndicator/TypingIndicatorSystem.cs b/Content.Server/Chat/TypingIndicator/TypingIndicatorSystem.cs index 761e9456bcdc60..c923738930a37f 100644 --- a/Content.Server/Chat/TypingIndicator/TypingIndicatorSystem.cs +++ b/Content.Server/Chat/TypingIndicator/TypingIndicatorSystem.cs @@ -39,7 +39,7 @@ private void OnClientTypingChanged(TypingChangedEvent ev, EntitySessionEventArgs var uid = args.SenderSession.AttachedEntity; if (!Exists(uid)) { - Logger.Warning($"Client {args.SenderSession} sent TypingChangedEvent without an attached entity."); + Log.Warning($"Client {args.SenderSession} sent TypingChangedEvent without an attached entity."); return; } diff --git a/Content.Server/GameTicking/Rules/PiratesRuleSystem.cs b/Content.Server/GameTicking/Rules/PiratesRuleSystem.cs index f83d719c219c35..98926536b9d641 100644 --- a/Content.Server/GameTicking/Rules/PiratesRuleSystem.cs +++ b/Content.Server/GameTicking/Rules/PiratesRuleSystem.cs @@ -201,7 +201,7 @@ private void OnPlayerSpawningEvent(RulePlayerSpawningEvent ev) if (!gridId.HasValue) { - Logger.ErrorS("pirates", $"Gridid was null when loading \"{map}\", aborting."); + Log.Error($"Gridid was null when loading \"{map}\", aborting."); foreach (var session in ops) { ev.PlayerPool.Add(session); @@ -230,7 +230,7 @@ private void OnPlayerSpawningEvent(RulePlayerSpawningEvent ev) if (spawns.Count == 0) { spawns.Add(Transform(pirates.PirateShip).Coordinates); - Logger.WarningS("pirates", $"Fell back to default spawn for pirates!"); + Log.Warning($"Fell back to default spawn for pirates!"); } for (var i = 0; i < ops.Length; i++) diff --git a/Content.Server/NPC/Systems/NPCUtilitySystem.cs b/Content.Server/NPC/Systems/NPCUtilitySystem.cs index fc483f68c3be72..33941be929211a 100644 --- a/Content.Server/NPC/Systems/NPCUtilitySystem.cs +++ b/Content.Server/NPC/Systems/NPCUtilitySystem.cs @@ -43,6 +43,7 @@ public sealed class NPCUtilitySystem : EntitySystem [Dependency] private readonly SharedTransformSystem _transform = default!; [Dependency] private readonly SolutionContainerSystem _solutions = default!; [Dependency] private readonly WeldableSystem _weldable = default!; + [Dependency] private readonly ExamineSystemShared _examine = default!; private EntityQuery _puddleQuery; private EntityQuery _xformQuery; @@ -296,7 +297,7 @@ private float GetScore(NPCBlackboard blackboard, EntityUid targetUid, UtilityCon { var radius = blackboard.GetValueOrDefault(NPCBlackboard.VisionRadius, EntityManager); - return ExamineSystemShared.InRangeUnOccluded(owner, targetUid, radius + 0.5f, null) ? 1f : 0f; + return _examine.InRangeUnOccluded(owner, targetUid, radius + 0.5f, null) ? 1f : 0f; } case TargetInLOSOrCurrentCon: { @@ -313,7 +314,7 @@ private float GetScore(NPCBlackboard blackboard, EntityUid targetUid, UtilityCon return 1f; } - return ExamineSystemShared.InRangeUnOccluded(owner, targetUid, radius + bufferRange, null) ? 1f : 0f; + return _examine.InRangeUnOccluded(owner, targetUid, radius + bufferRange, null) ? 1f : 0f; } case TargetIsAliveCon: { diff --git a/Content.Server/Pointing/EntitySystems/PointingSystem.cs b/Content.Server/Pointing/EntitySystems/PointingSystem.cs index a7c455e6a5d3c8..06d2d6f58b52a6 100644 --- a/Content.Server/Pointing/EntitySystems/PointingSystem.cs +++ b/Content.Server/Pointing/EntitySystems/PointingSystem.cs @@ -37,6 +37,7 @@ internal sealed class PointingSystem : SharedPointingSystem [Dependency] private readonly VisibilitySystem _visibilitySystem = default!; [Dependency] private readonly SharedMindSystem _minds = default!; [Dependency] private readonly IAdminLogManager _adminLogger = default!; + [Dependency] private readonly ExamineSystemShared _examine = default!; private static readonly TimeSpan PointDelay = TimeSpan.FromSeconds(0.5f); @@ -100,7 +101,7 @@ public bool InRange(EntityUid pointer, EntityCoordinates coordinates) } else { - return ExamineSystemShared.InRangeUnOccluded(pointer, coordinates, 15, predicate: e => e == pointer); + return _examine.InRangeUnOccluded(pointer, coordinates, 15, predicate: e => e == pointer); } } diff --git a/Content.Server/Remotes/DoorRemoteSystem.cs b/Content.Server/Remotes/DoorRemoteSystem.cs index 9be7e5e96b4145..cb3243cb837b14 100644 --- a/Content.Server/Remotes/DoorRemoteSystem.cs +++ b/Content.Server/Remotes/DoorRemoteSystem.cs @@ -22,6 +22,7 @@ public sealed class DoorRemoteSystem : EntitySystem [Dependency] private readonly SharedPopupSystem _popupSystem = default!; [Dependency] private readonly DoorSystem _doorSystem = default!; [Dependency] private readonly SharedInteractionSystem _interactionSystem = default!; + [Dependency] private readonly ExamineSystemShared _examine = default!; // I'm so sorry [Dependency] private readonly SharedAirlockSystem _sharedAirlockSystem = default!; public override void Initialize() @@ -67,7 +68,7 @@ private void OnBeforeInteract(EntityUid uid, DoorRemoteComponent component, Befo || !TryComp(args.Target, out var doorComp) // If it isn't a door we don't use it // Only able to control doors if they are within your vision and within your max range. // Not affected by mobs or machines anymore. - || !ExamineSystemShared.InRangeUnOccluded(args.User, args.Target.Value, SharedInteractionSystem.MaxRaycastRange, null)) + || !_examine.InRangeUnOccluded(args.User, args.Target.Value, SharedInteractionSystem.MaxRaycastRange, null)) { return; } diff --git a/Content.Server/Tabletop/TabletopSystem.Session.cs b/Content.Server/Tabletop/TabletopSystem.Session.cs index f16f3f01e989f1..c2bb8426fc2efa 100644 --- a/Content.Server/Tabletop/TabletopSystem.Session.cs +++ b/Content.Server/Tabletop/TabletopSystem.Session.cs @@ -31,7 +31,7 @@ public TabletopSession EnsureSession(TabletopGameComponent tabletop) // Since this is the first time opening this session, set up the game tabletop.Setup.SetupTabletop(session, EntityManager); - Logger.Info($"Created tabletop session number {tabletop} at position {session.Position}."); + Log.Info($"Created tabletop session number {tabletop} at position {session.Position}."); return session; } diff --git a/Content.Shared/Examine/ExamineSystemShared.cs b/Content.Shared/Examine/ExamineSystemShared.cs index 5a3fb8722933f9..f792862be1452e 100644 --- a/Content.Shared/Examine/ExamineSystemShared.cs +++ b/Content.Shared/Examine/ExamineSystemShared.cs @@ -144,7 +144,7 @@ public bool IsOccluded(EntityUid uid) return TryComp(uid, out var eye) && eye.DrawFov; } - public static bool InRangeUnOccluded(MapCoordinates origin, MapCoordinates other, float range, Ignored? predicate, bool ignoreInsideBlocker = true, IEntityManager? entMan = null) + public bool InRangeUnOccluded(MapCoordinates origin, MapCoordinates other, float range, Ignored? predicate, bool ignoreInsideBlocker = true, IEntityManager? entMan = null) { // No, rider. This is better. // ReSharper disable once ConvertToLocalFunction @@ -154,7 +154,7 @@ public static bool InRangeUnOccluded(MapCoordinates origin, MapCoordinates other return InRangeUnOccluded(origin, other, range, predicate, wrapped, ignoreInsideBlocker, entMan); } - public static bool InRangeUnOccluded(MapCoordinates origin, MapCoordinates other, float range, + public bool InRangeUnOccluded(MapCoordinates origin, MapCoordinates other, float range, TState state, Func predicate, bool ignoreInsideBlocker = true, IEntityManager? entMan = null) { if (other.MapId != origin.MapId || @@ -171,7 +171,7 @@ public static bool InRangeUnOccluded(MapCoordinates origin, MapCoordinat if (length > MaxRaycastRange) { - Logger.Warning("InRangeUnOccluded check performed over extreme range. Limiting CollisionRay size."); + Log.Warning("InRangeUnOccluded check performed over extreme range. Limiting CollisionRay size."); length = MaxRaycastRange; } @@ -207,7 +207,7 @@ public static bool InRangeUnOccluded(MapCoordinates origin, MapCoordinat return true; } - public static bool InRangeUnOccluded(EntityUid origin, EntityUid other, float range = ExamineRange, Ignored? predicate = null, bool ignoreInsideBlocker = true) + public bool InRangeUnOccluded(EntityUid origin, EntityUid other, float range = ExamineRange, Ignored? predicate = null, bool ignoreInsideBlocker = true) { var entMan = IoCManager.Resolve(); var originPos = entMan.GetComponent(origin).MapPosition; @@ -216,7 +216,7 @@ public static bool InRangeUnOccluded(EntityUid origin, EntityUid other, float ra return InRangeUnOccluded(originPos, otherPos, range, predicate, ignoreInsideBlocker); } - public static bool InRangeUnOccluded(EntityUid origin, EntityCoordinates other, float range = ExamineRange, Ignored? predicate = null, bool ignoreInsideBlocker = true) + public bool InRangeUnOccluded(EntityUid origin, EntityCoordinates other, float range = ExamineRange, Ignored? predicate = null, bool ignoreInsideBlocker = true) { var entMan = IoCManager.Resolve(); var originPos = entMan.GetComponent(origin).MapPosition; @@ -225,7 +225,7 @@ public static bool InRangeUnOccluded(EntityUid origin, EntityCoordinates other, return InRangeUnOccluded(originPos, otherPos, range, predicate, ignoreInsideBlocker); } - public static bool InRangeUnOccluded(EntityUid origin, MapCoordinates other, float range = ExamineRange, Ignored? predicate = null, bool ignoreInsideBlocker = true) + public bool InRangeUnOccluded(EntityUid origin, MapCoordinates other, float range = ExamineRange, Ignored? predicate = null, bool ignoreInsideBlocker = true) { var entMan = IoCManager.Resolve(); var originPos = entMan.GetComponent(origin).MapPosition;