Removed the Sender object from events. If you needed this field, add it to the event class.
This commit is contained in:
@@ -81,7 +81,7 @@ namespace Content.Client.GameObjects.Components.IconSmoothing
|
|||||||
base.Startup();
|
base.Startup();
|
||||||
|
|
||||||
SnapGrid.OnPositionChanged += SnapGridOnPositionChanged;
|
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)
|
if (Mode == IconSmoothingMode.Corners)
|
||||||
{
|
{
|
||||||
var state0 = $"{StateBase}0";
|
var state0 = $"{StateBase}0";
|
||||||
@@ -203,12 +203,12 @@ namespace Content.Client.GameObjects.Components.IconSmoothing
|
|||||||
base.Shutdown();
|
base.Shutdown();
|
||||||
|
|
||||||
SnapGrid.OnPositionChanged -= SnapGridOnPositionChanged;
|
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()
|
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);
|
_lastPosition = (Owner.Transform.GridID, SnapGrid.Position);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using Robust.Client.Interfaces.GameObjects.Components;
|
using Robust.Client.Interfaces.GameObjects.Components;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.GameObjects.Components.Transform;
|
using Robust.Shared.GameObjects.Components.Transform;
|
||||||
|
using Robust.Shared.Interfaces.GameObjects;
|
||||||
|
|
||||||
namespace Content.Client.GameObjects.Components
|
namespace Content.Client.GameObjects.Components
|
||||||
{
|
{
|
||||||
@@ -32,7 +33,7 @@ namespace Content.Client.GameObjects.Components
|
|||||||
base.Startup();
|
base.Startup();
|
||||||
|
|
||||||
_snapGridComponent.OnPositionChanged += SnapGridOnPositionChanged;
|
_snapGridComponent.OnPositionChanged += SnapGridOnPositionChanged;
|
||||||
Owner.EntityManager.EventBus.RaiseEvent(Owner, new SubFloorHideDirtyEvent());
|
Owner.EntityManager.EventBus.RaiseEvent(new SubFloorHideDirtyEvent(Owner));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
@@ -44,14 +45,22 @@ namespace Content.Client.GameObjects.Components
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
_snapGridComponent.OnPositionChanged -= SnapGridOnPositionChanged;
|
_snapGridComponent.OnPositionChanged -= SnapGridOnPositionChanged;
|
||||||
Owner.EntityManager.EventBus.RaiseEvent(Owner, new SubFloorHideDirtyEvent());
|
Owner.EntityManager.EventBus.RaiseEvent(new SubFloorHideDirtyEvent(Owner));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SnapGridOnPositionChanged()
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ namespace Content.Client.GameObjects.Components
|
|||||||
base.Startup();
|
base.Startup();
|
||||||
|
|
||||||
_snapGrid.OnPositionChanged += SnapGridOnPositionChanged;
|
_snapGrid.OnPositionChanged += SnapGridOnPositionChanged;
|
||||||
Owner.EntityManager.EventBus.RaiseEvent(Owner, new WindowSmoothDirtyEvent());
|
Owner.EntityManager.EventBus.RaiseEvent(new WindowSmoothDirtyEvent(Owner));
|
||||||
|
|
||||||
var state0 = $"{_stateBase}0";
|
var state0 = $"{_stateBase}0";
|
||||||
_sprite.LayerMapSet(CornerLayers.SE, _sprite.AddLayerState(state0));
|
_sprite.LayerMapSet(CornerLayers.SE, _sprite.AddLayerState(state0));
|
||||||
@@ -54,7 +54,7 @@ namespace Content.Client.GameObjects.Components
|
|||||||
|
|
||||||
private void SnapGridOnPositionChanged()
|
private void SnapGridOnPositionChanged()
|
||||||
{
|
{
|
||||||
Owner.EntityManager.EventBus.RaiseEvent(Owner, new WindowSmoothDirtyEvent());
|
Owner.EntityManager.EventBus.RaiseEvent(new WindowSmoothDirtyEvent(Owner));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateSprite()
|
public void UpdateSprite()
|
||||||
|
|||||||
@@ -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.
|
// 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.
|
// 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)
|
senderEnt.TryGetComponent(out IconSmoothComponent iconSmooth)
|
||||||
&& iconSmooth.Running)
|
&& iconSmooth.Running)
|
||||||
{
|
{
|
||||||
@@ -137,15 +138,17 @@ namespace Content.Client.GameObjects.EntitySystems
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed class IconSmoothDirtyEvent : EntitySystemMessage
|
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;
|
LastPosition = lastPosition;
|
||||||
Offset = offset;
|
Offset = offset;
|
||||||
Mode = mode;
|
Mode = mode;
|
||||||
|
Sender = sender;
|
||||||
}
|
}
|
||||||
|
|
||||||
public (GridId grid, MapIndices pos)? LastPosition { get; }
|
public (GridId grid, MapIndices pos)? LastPosition { get; }
|
||||||
public SnapGridOffset Offset { get; }
|
public SnapGridOffset Offset { get; }
|
||||||
public IconSmoothingMode Mode { 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))
|
if (!_prototypeManager.TryIndex(msg.ArcPrototype, out MeleeWeaponAnimationPrototype weaponArc))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ using Content.Shared.Maps;
|
|||||||
using Robust.Client.Interfaces.GameObjects.Components;
|
using Robust.Client.Interfaces.GameObjects.Components;
|
||||||
using Robust.Shared.GameObjects.Components.Transform;
|
using Robust.Shared.GameObjects.Components.Transform;
|
||||||
using Robust.Shared.GameObjects.Systems;
|
using Robust.Shared.GameObjects.Systems;
|
||||||
using Robust.Shared.Interfaces.GameObjects;
|
|
||||||
using Robust.Shared.Interfaces.Map;
|
using Robust.Shared.Interfaces.Map;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
@@ -32,15 +31,10 @@ namespace Content.Client.GameObjects.EntitySystems
|
|||||||
SubscribeEvent<SubFloorHideDirtyEvent>(HandleDirtyEvent);
|
SubscribeEvent<SubFloorHideDirtyEvent>(HandleDirtyEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HandleDirtyEvent(object sender, SubFloorHideDirtyEvent ev)
|
private void HandleDirtyEvent(SubFloorHideDirtyEvent ev)
|
||||||
{
|
{
|
||||||
if (!(sender is IEntity senderEnt))
|
var grid = _mapManager.GetGrid(ev.Sender.Transform.GridID);
|
||||||
{
|
var indices = grid.WorldToTile(ev.Sender.Transform.WorldPosition);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var grid = _mapManager.GetGrid(senderEnt.Transform.GridID);
|
|
||||||
var indices = grid.WorldToTile(senderEnt.Transform.WorldPosition);
|
|
||||||
UpdateTile(grid, indices);
|
UpdateTile(grid, indices);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ namespace Content.Client.GameObjects.EntitySystems
|
|||||||
OpenContextMenu(entity, new ScreenCoordinates(_inputManager.MouseScreenPosition));
|
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))
|
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 Content.Client.GameObjects.Components;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
@@ -19,11 +19,11 @@ namespace Content.Client.GameObjects.EntitySystems
|
|||||||
SubscribeEvent<WindowSmoothDirtyEvent>(HandleDirtyEvent);
|
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>
|
/// </summary>
|
||||||
public sealed class WindowSmoothDirtyEvent : EntitySystemMessage
|
public sealed class WindowSmoothDirtyEvent : EntitySystemMessage
|
||||||
{
|
{
|
||||||
|
public IEntity Sender { get; }
|
||||||
|
|
||||||
|
public WindowSmoothDirtyEvent(IEntity sender)
|
||||||
|
{
|
||||||
|
Sender = sender;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ namespace Content.Server.GameObjects.EntitySystems
|
|||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|
||||||
SubscribeEvent<ExamineSystemMessages.RequestExamineInfoMessage>((sender, ev) => ExamineInfoRequest(ev));
|
SubscribeEvent<ExamineSystemMessages.RequestExamineInfoMessage>(ExamineInfoRequest);
|
||||||
|
|
||||||
IoCManager.InjectDependencies(this);
|
IoCManager.InjectDependencies(this);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ namespace Content.Server.GameObjects.EntitySystems
|
|||||||
InputCmdHandler.FromDelegate(CombatModeToggled));
|
InputCmdHandler.FromDelegate(CombatModeToggled));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetCombatModeActiveHandler(object sender, SetCombatModeActiveMessage ev)
|
private void SetCombatModeActiveHandler(SetCombatModeActiveMessage ev)
|
||||||
{
|
{
|
||||||
if (!TryGetCombatComponent(ev, out var combatModeComponent))
|
if (!TryGetCombatComponent(ev, out var combatModeComponent))
|
||||||
return;
|
return;
|
||||||
@@ -39,7 +39,7 @@ namespace Content.Server.GameObjects.EntitySystems
|
|||||||
combatModeComponent.IsInCombatMode = ev.Active;
|
combatModeComponent.IsInCombatMode = ev.Active;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetTargetZoneHandler(object sender, SetTargetZoneMessage ev)
|
private void SetTargetZoneHandler(SetTargetZoneMessage ev)
|
||||||
{
|
{
|
||||||
if (!TryGetCombatComponent(ev, out var combatModeComponent))
|
if (!TryGetCombatComponent(ev, out var combatModeComponent))
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ namespace Content.Server.GameObjects.EntitySystems
|
|||||||
base.Shutdown();
|
base.Shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void HandleContainerModified(object sender, ContainerModifiedMessage args)
|
private static void HandleContainerModified(ContainerModifiedMessage args)
|
||||||
{
|
{
|
||||||
if (args.Container.Owner.TryGetComponent(out IHandsComponent handsComponent))
|
if (args.Container.Owner.TryGetComponent(out IHandsComponent handsComponent))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ namespace Content.Server.GameObjects.EntitySystems
|
|||||||
_audioSystem = EntitySystemManager.GetEntitySystem<AudioSystem>();
|
_audioSystem = EntitySystemManager.GetEntitySystem<AudioSystem>();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void PlayerAttached(object sender, PlayerAttachSystemMessage ev)
|
private static void PlayerAttached(PlayerAttachSystemMessage ev)
|
||||||
{
|
{
|
||||||
if (!ev.Entity.HasComponent<IMoverComponent>())
|
if (!ev.Entity.HasComponent<IMoverComponent>())
|
||||||
{
|
{
|
||||||
@@ -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<PlayerInputMoverComponent>())
|
if(ev.Entity.HasComponent<PlayerInputMoverComponent>())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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;
|
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;
|
var oldParentEntity = message.Container.Owner;
|
||||||
|
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ namespace Content.Server.GameObjects.EntitySystems
|
|||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|
||||||
SubscribeEvent<RequestVerbsMessage>((sender, ev) => RequestVerbs(ev));
|
SubscribeEvent<RequestVerbsMessage>(RequestVerbs);
|
||||||
SubscribeEvent<UseVerbMessage>((sender, ev) => UseVerb(ev));
|
SubscribeEvent<UseVerbMessage>(UseVerb);
|
||||||
|
|
||||||
IoCManager.InjectDependencies(this);
|
IoCManager.InjectDependencies(this);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ namespace Content.Server.GameTicking.GameRules
|
|||||||
_playerManager.PlayerStatusChanged -= PlayerManagerOnPlayerStatusChanged;
|
_playerManager.PlayerStatusChanged -= PlayerManagerOnPlayerStatusChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void _onMobDamageStateChanged(object sender, MobDamageStateChangedMessage message)
|
private void _onMobDamageStateChanged(MobDamageStateChangedMessage message)
|
||||||
{
|
{
|
||||||
_runDelayedCheck();
|
_runDelayedCheck();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user