diff --git a/Content.Client/GameObjects/Components/IconSmoothing/IconSmoothComponent.cs b/Content.Client/GameObjects/Components/IconSmoothing/IconSmoothComponent.cs index 8a8670d0b6..039eba03f9 100644 --- a/Content.Client/GameObjects/Components/IconSmoothing/IconSmoothComponent.cs +++ b/Content.Client/GameObjects/Components/IconSmoothing/IconSmoothComponent.cs @@ -81,7 +81,7 @@ namespace Content.Client.GameObjects.Components.IconSmoothing base.Startup(); SnapGrid.OnPositionChanged += SnapGridOnPositionChanged; - Owner.EntityManager.EventBus.RaiseEvent(Owner, new IconSmoothDirtyEvent(null, SnapGrid.Offset, Mode)); + Owner.EntityManager.EventBus.RaiseEvent(new IconSmoothDirtyEvent(Owner,null, SnapGrid.Offset, Mode)); if (Mode == IconSmoothingMode.Corners) { var state0 = $"{StateBase}0"; @@ -203,12 +203,12 @@ namespace Content.Client.GameObjects.Components.IconSmoothing base.Shutdown(); SnapGrid.OnPositionChanged -= SnapGridOnPositionChanged; - Owner.EntityManager.EventBus.RaiseEvent(Owner, new IconSmoothDirtyEvent(_lastPosition, SnapGrid.Offset, Mode)); + Owner.EntityManager.EventBus.RaiseEvent(new IconSmoothDirtyEvent(Owner, _lastPosition, SnapGrid.Offset, Mode)); } private void SnapGridOnPositionChanged() { - Owner.EntityManager.EventBus.RaiseEvent(Owner, new IconSmoothDirtyEvent(_lastPosition, SnapGrid.Offset, Mode)); + Owner.EntityManager.EventBus.RaiseEvent(new IconSmoothDirtyEvent(Owner, _lastPosition, SnapGrid.Offset, Mode)); _lastPosition = (Owner.Transform.GridID, SnapGrid.Position); } diff --git a/Content.Client/GameObjects/Components/SubFloorHideComponent.cs b/Content.Client/GameObjects/Components/SubFloorHideComponent.cs index a9b2aa3424..cf8d72f286 100644 --- a/Content.Client/GameObjects/Components/SubFloorHideComponent.cs +++ b/Content.Client/GameObjects/Components/SubFloorHideComponent.cs @@ -1,6 +1,7 @@ using Robust.Client.Interfaces.GameObjects.Components; using Robust.Shared.GameObjects; using Robust.Shared.GameObjects.Components.Transform; +using Robust.Shared.Interfaces.GameObjects; namespace Content.Client.GameObjects.Components { @@ -32,7 +33,7 @@ namespace Content.Client.GameObjects.Components base.Startup(); _snapGridComponent.OnPositionChanged += SnapGridOnPositionChanged; - Owner.EntityManager.EventBus.RaiseEvent(Owner, new SubFloorHideDirtyEvent()); + Owner.EntityManager.EventBus.RaiseEvent(new SubFloorHideDirtyEvent(Owner)); } /// @@ -44,14 +45,22 @@ namespace Content.Client.GameObjects.Components return; _snapGridComponent.OnPositionChanged -= SnapGridOnPositionChanged; - Owner.EntityManager.EventBus.RaiseEvent(Owner, new SubFloorHideDirtyEvent()); + Owner.EntityManager.EventBus.RaiseEvent(new SubFloorHideDirtyEvent(Owner)); } private void SnapGridOnPositionChanged() { - Owner.EntityManager.EventBus.RaiseEvent(Owner, new SubFloorHideDirtyEvent()); + Owner.EntityManager.EventBus.RaiseEvent(new SubFloorHideDirtyEvent(Owner)); } } - internal sealed class SubFloorHideDirtyEvent : EntitySystemMessage { } + internal sealed class SubFloorHideDirtyEvent : EntitySystemMessage + { + public IEntity Sender { get; } + + public SubFloorHideDirtyEvent(IEntity sender) + { + Sender = sender; + } + } } diff --git a/Content.Client/GameObjects/Components/WindowComponent.cs b/Content.Client/GameObjects/Components/WindowComponent.cs index 3aec3f09a9..f3f807c75d 100644 --- a/Content.Client/GameObjects/Components/WindowComponent.cs +++ b/Content.Client/GameObjects/Components/WindowComponent.cs @@ -31,7 +31,7 @@ namespace Content.Client.GameObjects.Components base.Startup(); _snapGrid.OnPositionChanged += SnapGridOnPositionChanged; - Owner.EntityManager.EventBus.RaiseEvent(Owner, new WindowSmoothDirtyEvent()); + Owner.EntityManager.EventBus.RaiseEvent(new WindowSmoothDirtyEvent(Owner)); var state0 = $"{_stateBase}0"; _sprite.LayerMapSet(CornerLayers.SE, _sprite.AddLayerState(state0)); @@ -54,7 +54,7 @@ namespace Content.Client.GameObjects.Components private void SnapGridOnPositionChanged() { - Owner.EntityManager.EventBus.RaiseEvent(Owner, new WindowSmoothDirtyEvent()); + Owner.EntityManager.EventBus.RaiseEvent(new WindowSmoothDirtyEvent(Owner)); } public void UpdateSprite() diff --git a/Content.Client/GameObjects/EntitySystems/IconSmoothSystem.cs b/Content.Client/GameObjects/EntitySystems/IconSmoothSystem.cs index dc1c04d870..3b6aece8be 100644 --- a/Content.Client/GameObjects/EntitySystems/IconSmoothSystem.cs +++ b/Content.Client/GameObjects/EntitySystems/IconSmoothSystem.cs @@ -53,11 +53,12 @@ namespace Content.Client.GameObjects.EntitySystems } } - private void HandleDirtyEvent(object sender, IconSmoothDirtyEvent ev) + private void HandleDirtyEvent(IconSmoothDirtyEvent ev) { // Yes, we updates ALL smoothing entities surrounding us even if they would never smooth with us. // This is simpler to implement. If you want to optimize it be my guest. - if (sender is IEntity senderEnt && senderEnt.IsValid() && + var senderEnt = ev.Sender; + if (senderEnt.IsValid() && senderEnt.TryGetComponent(out IconSmoothComponent iconSmooth) && iconSmooth.Running) { @@ -137,15 +138,17 @@ namespace Content.Client.GameObjects.EntitySystems /// public sealed class IconSmoothDirtyEvent : EntitySystemMessage { - public IconSmoothDirtyEvent((GridId grid, MapIndices pos)? lastPosition, SnapGridOffset offset, IconSmoothingMode mode) + public IconSmoothDirtyEvent(IEntity sender, (GridId grid, MapIndices pos)? lastPosition, SnapGridOffset offset, IconSmoothingMode mode) { LastPosition = lastPosition; Offset = offset; Mode = mode; + Sender = sender; } public (GridId grid, MapIndices pos)? LastPosition { get; } public SnapGridOffset Offset { get; } public IconSmoothingMode Mode { get; } + public IEntity Sender { get; } } } diff --git a/Content.Client/GameObjects/EntitySystems/MeleeWeaponSystem.cs b/Content.Client/GameObjects/EntitySystems/MeleeWeaponSystem.cs index 9800018f6c..2f3c04e7a7 100644 --- a/Content.Client/GameObjects/EntitySystems/MeleeWeaponSystem.cs +++ b/Content.Client/GameObjects/EntitySystems/MeleeWeaponSystem.cs @@ -37,7 +37,7 @@ namespace Content.Client.GameObjects.EntitySystems } } - private void PlayWeaponArc(object sender, PlayMeleeWeaponAnimationMessage msg) + private void PlayWeaponArc(PlayMeleeWeaponAnimationMessage msg) { if (!_prototypeManager.TryIndex(msg.ArcPrototype, out MeleeWeaponAnimationPrototype weaponArc)) { diff --git a/Content.Client/GameObjects/EntitySystems/SubFloorHideSystem.cs b/Content.Client/GameObjects/EntitySystems/SubFloorHideSystem.cs index a373cf1ad9..b15e887080 100644 --- a/Content.Client/GameObjects/EntitySystems/SubFloorHideSystem.cs +++ b/Content.Client/GameObjects/EntitySystems/SubFloorHideSystem.cs @@ -3,7 +3,6 @@ using Content.Shared.Maps; using Robust.Client.Interfaces.GameObjects.Components; using Robust.Shared.GameObjects.Components.Transform; using Robust.Shared.GameObjects.Systems; -using Robust.Shared.Interfaces.GameObjects; using Robust.Shared.Interfaces.Map; using Robust.Shared.IoC; using Robust.Shared.Map; @@ -32,15 +31,10 @@ namespace Content.Client.GameObjects.EntitySystems SubscribeEvent(HandleDirtyEvent); } - private void HandleDirtyEvent(object sender, SubFloorHideDirtyEvent ev) + private void HandleDirtyEvent(SubFloorHideDirtyEvent ev) { - if (!(sender is IEntity senderEnt)) - { - return; - } - - var grid = _mapManager.GetGrid(senderEnt.Transform.GridID); - var indices = grid.WorldToTile(senderEnt.Transform.WorldPosition); + var grid = _mapManager.GetGrid(ev.Sender.Transform.GridID); + var indices = grid.WorldToTile(ev.Sender.Transform.WorldPosition); UpdateTile(grid, indices); } diff --git a/Content.Client/GameObjects/EntitySystems/VerbSystem.cs b/Content.Client/GameObjects/EntitySystems/VerbSystem.cs index ec9d8dd3c2..155a3900cc 100644 --- a/Content.Client/GameObjects/EntitySystems/VerbSystem.cs +++ b/Content.Client/GameObjects/EntitySystems/VerbSystem.cs @@ -112,7 +112,7 @@ namespace Content.Client.GameObjects.EntitySystems OpenContextMenu(entity, new ScreenCoordinates(_inputManager.MouseScreenPosition)); } - private void FillEntityPopup(object sender, VerbSystemMessages.VerbsResponseMessage msg) + private void FillEntityPopup(VerbSystemMessages.VerbsResponseMessage msg) { if (_currentEntity != msg.Entity || !_entityManager.TryGetEntity(_currentEntity, out var entity)) { diff --git a/Content.Client/GameObjects/EntitySystems/WindowSystem.cs b/Content.Client/GameObjects/EntitySystems/WindowSystem.cs index ae8e4c43b6..4e0ee313f5 100644 --- a/Content.Client/GameObjects/EntitySystems/WindowSystem.cs +++ b/Content.Client/GameObjects/EntitySystems/WindowSystem.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using Content.Client.GameObjects.Components; using JetBrains.Annotations; using Robust.Shared.GameObjects; @@ -19,11 +19,11 @@ namespace Content.Client.GameObjects.EntitySystems SubscribeEvent(HandleDirtyEvent); } - private void HandleDirtyEvent(object sender, WindowSmoothDirtyEvent ev) + private void HandleDirtyEvent(WindowSmoothDirtyEvent ev) { - if (sender is IEntity senderEnt && senderEnt.HasComponent()) + if (ev.Sender.HasComponent()) { - _dirtyEntities.Enqueue(senderEnt); + _dirtyEntities.Enqueue(ev.Sender); } } @@ -50,5 +50,11 @@ namespace Content.Client.GameObjects.EntitySystems /// public sealed class WindowSmoothDirtyEvent : EntitySystemMessage { + public IEntity Sender { get; } + + public WindowSmoothDirtyEvent(IEntity sender) + { + Sender = sender; + } } } diff --git a/Content.Server/GameObjects/EntitySystems/Click/ExamineSystem.cs b/Content.Server/GameObjects/EntitySystems/Click/ExamineSystem.cs index 55ce7e3d3e..2164cf3357 100644 --- a/Content.Server/GameObjects/EntitySystems/Click/ExamineSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/Click/ExamineSystem.cs @@ -35,7 +35,7 @@ namespace Content.Server.GameObjects.EntitySystems { base.Initialize(); - SubscribeEvent((sender, ev) => ExamineInfoRequest(ev)); + SubscribeEvent(ExamineInfoRequest); IoCManager.InjectDependencies(this); } diff --git a/Content.Server/GameObjects/EntitySystems/CombatModeSystem.cs b/Content.Server/GameObjects/EntitySystems/CombatModeSystem.cs index e78ec6fbcf..e81509a53c 100644 --- a/Content.Server/GameObjects/EntitySystems/CombatModeSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/CombatModeSystem.cs @@ -31,7 +31,7 @@ namespace Content.Server.GameObjects.EntitySystems InputCmdHandler.FromDelegate(CombatModeToggled)); } - private void SetCombatModeActiveHandler(object sender, SetCombatModeActiveMessage ev) + private void SetCombatModeActiveHandler(SetCombatModeActiveMessage ev) { if (!TryGetCombatComponent(ev, out var combatModeComponent)) return; @@ -39,7 +39,7 @@ namespace Content.Server.GameObjects.EntitySystems combatModeComponent.IsInCombatMode = ev.Active; } - private void SetTargetZoneHandler(object sender, SetTargetZoneMessage ev) + private void SetTargetZoneHandler(SetTargetZoneMessage ev) { if (!TryGetCombatComponent(ev, out var combatModeComponent)) return; diff --git a/Content.Server/GameObjects/EntitySystems/HandsSystem.cs b/Content.Server/GameObjects/EntitySystems/HandsSystem.cs index 3bbf6ec7f1..2bf290a69a 100644 --- a/Content.Server/GameObjects/EntitySystems/HandsSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/HandsSystem.cs @@ -65,7 +65,7 @@ namespace Content.Server.GameObjects.EntitySystems base.Shutdown(); } - private static void HandleContainerModified(object sender, ContainerModifiedMessage args) + private static void HandleContainerModified(ContainerModifiedMessage args) { if (args.Container.Owner.TryGetComponent(out IHandsComponent handsComponent)) { diff --git a/Content.Server/GameObjects/EntitySystems/MoverSystem.cs b/Content.Server/GameObjects/EntitySystems/MoverSystem.cs index 1c3b608770..b6310d8f86 100644 --- a/Content.Server/GameObjects/EntitySystems/MoverSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/MoverSystem.cs @@ -80,7 +80,7 @@ namespace Content.Server.GameObjects.EntitySystems _audioSystem = EntitySystemManager.GetEntitySystem(); } - private static void PlayerAttached(object sender, PlayerAttachSystemMessage ev) + private static void PlayerAttached(PlayerAttachSystemMessage ev) { if (!ev.Entity.HasComponent()) { @@ -88,7 +88,7 @@ namespace Content.Server.GameObjects.EntitySystems } } - private static void PlayerDetached(object sender, PlayerDetachedSystemMessage ev) + private static void PlayerDetached(PlayerDetachedSystemMessage ev) { if(ev.Entity.HasComponent()) { diff --git a/Content.Server/GameObjects/EntitySystems/StorageSystem.cs b/Content.Server/GameObjects/EntitySystems/StorageSystem.cs index 6a325ed387..98a84aab51 100644 --- a/Content.Server/GameObjects/EntitySystems/StorageSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/StorageSystem.cs @@ -29,7 +29,7 @@ namespace Content.Server.GameObjects.EntitySystems } } - private static void HandleEntityRemovedFromContainer(object sender, EntRemovedFromContainerMessage message) + private static void HandleEntityRemovedFromContainer(EntRemovedFromContainerMessage message) { var oldParentEntity = message.Container.Owner; @@ -39,7 +39,7 @@ namespace Content.Server.GameObjects.EntitySystems } } - private static void HandleEntityInsertedIntoContainer(object sender, EntInsertedIntoContainerMessage message) + private static void HandleEntityInsertedIntoContainer(EntInsertedIntoContainerMessage message) { var oldParentEntity = message.Container.Owner; diff --git a/Content.Server/GameObjects/EntitySystems/VerbSystem.cs b/Content.Server/GameObjects/EntitySystems/VerbSystem.cs index 754cfe11c9..778a8c35d8 100644 --- a/Content.Server/GameObjects/EntitySystems/VerbSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/VerbSystem.cs @@ -20,8 +20,8 @@ namespace Content.Server.GameObjects.EntitySystems { base.Initialize(); - SubscribeEvent((sender, ev) => RequestVerbs(ev)); - SubscribeEvent((sender, ev) => UseVerb(ev)); + SubscribeEvent(RequestVerbs); + SubscribeEvent(UseVerb); IoCManager.InjectDependencies(this); } diff --git a/Content.Server/GameTicking/GameRules/RuleDeathMatch.cs b/Content.Server/GameTicking/GameRules/RuleDeathMatch.cs index 524183fc98..f27ad9e793 100644 --- a/Content.Server/GameTicking/GameRules/RuleDeathMatch.cs +++ b/Content.Server/GameTicking/GameRules/RuleDeathMatch.cs @@ -46,7 +46,7 @@ namespace Content.Server.GameTicking.GameRules _playerManager.PlayerStatusChanged -= PlayerManagerOnPlayerStatusChanged; } - private void _onMobDamageStateChanged(object sender, MobDamageStateChangedMessage message) + private void _onMobDamageStateChanged(MobDamageStateChangedMessage message) { _runDelayedCheck(); }