Removed the Sender object from events. If you needed this field, add it to the event class.
This commit is contained in:
@@ -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
|
||||
/// </summary>
|
||||
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; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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))
|
||||
{
|
||||
|
||||
@@ -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<SubFloorHideDirtyEvent>(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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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))
|
||||
{
|
||||
|
||||
@@ -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<WindowSmoothDirtyEvent>(HandleDirtyEvent);
|
||||
}
|
||||
|
||||
private void HandleDirtyEvent(object sender, WindowSmoothDirtyEvent ev)
|
||||
private void HandleDirtyEvent(WindowSmoothDirtyEvent ev)
|
||||
{
|
||||
if (sender is IEntity senderEnt && senderEnt.HasComponent<WindowComponent>())
|
||||
if (ev.Sender.HasComponent<WindowComponent>())
|
||||
{
|
||||
_dirtyEntities.Enqueue(senderEnt);
|
||||
_dirtyEntities.Enqueue(ev.Sender);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,5 +50,11 @@ namespace Content.Client.GameObjects.EntitySystems
|
||||
/// </summary>
|
||||
public sealed class WindowSmoothDirtyEvent : EntitySystemMessage
|
||||
{
|
||||
public IEntity Sender { get; }
|
||||
|
||||
public WindowSmoothDirtyEvent(IEntity sender)
|
||||
{
|
||||
Sender = sender;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user