Removed the Sender object from events. If you needed this field, add it to the event class.

This commit is contained in:
Acruid
2020-02-19 14:39:00 -08:00
parent c51533686b
commit e719745b10
15 changed files with 50 additions and 38 deletions

View File

@@ -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; }
}
}