Rename and clean up interaction events (#4044)

* Rename and clean up interaction events

* Fix hand equip events
This commit is contained in:
ShadowCommander
2021-05-22 21:06:40 -07:00
committed by GitHub
parent d97021d3a0
commit acb102f978
62 changed files with 273 additions and 240 deletions

View File

@@ -8,12 +8,12 @@ namespace Content.Client.GameObjects.Components.Body
[ComponentReference(typeof(IBody))] [ComponentReference(typeof(IBody))]
public class BodyComponent : SharedBodyComponent, IDraggable public class BodyComponent : SharedBodyComponent, IDraggable
{ {
bool IDraggable.CanStartDrag(StartDragDropEventArgs args) bool IDraggable.CanStartDrag(StartDragDropEvent args)
{ {
return true; return true;
} }
bool IDraggable.CanDrop(CanDropEventArgs args) bool IDraggable.CanDrop(CanDropEvent args)
{ {
return true; return true;
} }

View File

@@ -8,7 +8,7 @@ namespace Content.Client.GameObjects.Components.Disposal
[ComponentReference(typeof(SharedDisposalMailingUnitComponent))] [ComponentReference(typeof(SharedDisposalMailingUnitComponent))]
public class DisposalMailingUnitComponent : SharedDisposalMailingUnitComponent public class DisposalMailingUnitComponent : SharedDisposalMailingUnitComponent
{ {
public override bool DragDropOn(DragDropEventArgs eventArgs) public override bool DragDropOn(DragDropEvent eventArgs)
{ {
return false; return false;
} }

View File

@@ -8,7 +8,7 @@ namespace Content.Client.GameObjects.Components.Disposal
[ComponentReference(typeof(SharedDisposalUnitComponent))] [ComponentReference(typeof(SharedDisposalUnitComponent))]
public class DisposalUnitComponent : SharedDisposalUnitComponent public class DisposalUnitComponent : SharedDisposalUnitComponent
{ {
public override bool DragDropOn(DragDropEventArgs eventArgs) public override bool DragDropOn(DragDropEvent eventArgs)
{ {
return false; return false;
} }

View File

@@ -8,7 +8,7 @@ namespace Content.Client.GameObjects.Components.GUI
[ComponentReference(typeof(SharedStrippableComponent))] [ComponentReference(typeof(SharedStrippableComponent))]
public class StrippableComponent : SharedStrippableComponent public class StrippableComponent : SharedStrippableComponent
{ {
public override bool Drop(DragDropEventArgs args) public override bool Drop(DragDropEvent args)
{ {
// TODO: Prediction // TODO: Prediction
return false; return false;

View File

@@ -8,7 +8,7 @@ namespace Content.Client.GameObjects.Components.Kitchen
[RegisterComponent] [RegisterComponent]
internal sealed class KitchenSpikeComponent : SharedKitchenSpikeComponent internal sealed class KitchenSpikeComponent : SharedKitchenSpikeComponent
{ {
public override bool DragDropOn(DragDropEventArgs eventArgs) public override bool DragDropOn(DragDropEvent eventArgs)
{ {
return true; return true;
} }

View File

@@ -8,7 +8,7 @@ namespace Content.Client.GameObjects.Components.MedicalScanner
[ComponentReference(typeof(SharedMedicalScannerComponent))] [ComponentReference(typeof(SharedMedicalScannerComponent))]
public class MedicalScannerComponent : SharedMedicalScannerComponent public class MedicalScannerComponent : SharedMedicalScannerComponent
{ {
public override bool DragDropOn(DragDropEventArgs eventArgs) public override bool DragDropOn(DragDropEvent eventArgs)
{ {
return false; return false;
} }

View File

@@ -9,7 +9,7 @@ namespace Content.Client.GameObjects.Components.Movement
[ComponentReference(typeof(IClimbable))] [ComponentReference(typeof(IClimbable))]
public class ClimbableComponent : SharedClimbableComponent public class ClimbableComponent : SharedClimbableComponent
{ {
public override bool CanDragDropOn(DragDropEventArgs eventArgs) public override bool CanDragDropOn(DragDropEvent eventArgs)
{ {
if (!base.CanDragDropOn(eventArgs)) if (!base.CanDragDropOn(eventArgs))
return false; return false;
@@ -22,7 +22,7 @@ namespace Content.Client.GameObjects.Components.Movement
return user.InRangeUnobstructed(target, Range, predicate: Ignored) && user.InRangeUnobstructed(dragged, Range, predicate: Ignored); return user.InRangeUnobstructed(target, Range, predicate: Ignored) && user.InRangeUnobstructed(dragged, Range, predicate: Ignored);
} }
public override bool DragDropOn(DragDropEventArgs eventArgs) public override bool DragDropOn(DragDropEvent eventArgs)
{ {
return false; return false;
} }

View File

@@ -8,7 +8,7 @@ namespace Content.Client.GameObjects.Components.Strap
[ComponentReference(typeof(SharedStrapComponent))] [ComponentReference(typeof(SharedStrapComponent))]
public class StrapComponent : SharedStrapComponent public class StrapComponent : SharedStrapComponent
{ {
public override bool DragDropOn(DragDropEventArgs eventArgs) public override bool DragDropOn(DragDropEvent eventArgs)
{ {
return false; return false;
} }

View File

@@ -145,7 +145,7 @@ namespace Content.Client.GameObjects.EntitySystems
var canDrag = false; var canDrag = false;
foreach (var draggable in entity.GetAllComponents<IDraggable>()) foreach (var draggable in entity.GetAllComponents<IDraggable>())
{ {
var dragEventArgs = new StartDragDropEventArgs(dragger, entity); var dragEventArgs = new StartDragDropEvent(dragger, entity);
if (!draggable.CanStartDrag(dragEventArgs)) if (!draggable.CanStartDrag(dragEventArgs))
{ {
@@ -315,7 +315,7 @@ namespace Content.Client.GameObjects.EntitySystems
if (entity == _dragDropHelper.Dragged) continue; if (entity == _dragDropHelper.Dragged) continue;
// check if it's able to be dropped on by current dragged entity // check if it's able to be dropped on by current dragged entity
var dropArgs = new DragDropEventArgs(_dragger, args.Coordinates, _dragDropHelper.Dragged, entity); var dropArgs = new DragDropEvent(_dragger, args.Coordinates, _dragDropHelper.Dragged, entity);
// TODO: Cache valid CanDragDrops // TODO: Cache valid CanDragDrops
if (ValidDragDrop(dropArgs) != true) continue; if (ValidDragDrop(dropArgs) != true) continue;
@@ -331,7 +331,7 @@ namespace Content.Client.GameObjects.EntitySystems
if (!draggable.CanDrop(dropArgs)) continue; if (!draggable.CanDrop(dropArgs)) continue;
// tell the server about the drop attempt // tell the server about the drop attempt
RaiseNetworkEvent(new DragDropMessage(args.Coordinates, _dragDropHelper.Dragged!.Uid, RaiseNetworkEvent(new DragDropRequestEvent(args.Coordinates, _dragDropHelper.Dragged!.Uid,
entity.Uid)); entity.Uid));
draggable.Drop(dropArgs); draggable.Drop(dropArgs);
@@ -380,7 +380,7 @@ namespace Content.Client.GameObjects.EntitySystems
pvsEntity == _dragDropHelper.Dragged) continue; pvsEntity == _dragDropHelper.Dragged) continue;
// check if it's able to be dropped on by current dragged entity // check if it's able to be dropped on by current dragged entity
var dropArgs = new DragDropEventArgs(_dragger!, pvsEntity.Transform.Coordinates, _dragDropHelper.Dragged, pvsEntity); var dropArgs = new DragDropEvent(_dragger!, pvsEntity.Transform.Coordinates, _dragDropHelper.Dragged, pvsEntity);
var valid = ValidDragDrop(dropArgs); var valid = ValidDragDrop(dropArgs);
if (valid == null) continue; if (valid == null) continue;
@@ -414,7 +414,7 @@ namespace Content.Client.GameObjects.EntitySystems
/// </summary> /// </summary>
/// <param name="eventArgs"></param> /// <param name="eventArgs"></param>
/// <returns>null if the target doesn't support IDragDropOn</returns> /// <returns>null if the target doesn't support IDragDropOn</returns>
private bool? ValidDragDrop(DragDropEventArgs eventArgs) private bool? ValidDragDrop(DragDropEvent eventArgs)
{ {
bool? valid = null; bool? valid = null;

View File

@@ -20,24 +20,24 @@ namespace Content.IntegrationTests.Tests.Interaction.Click
[Reflect(false)] [Reflect(false)]
private class TestAttackEntitySystem : EntitySystem private class TestAttackEntitySystem : EntitySystem
{ {
public EntityEventHandler<AttackEventArgs> AttackEvent; public EntityEventHandler<AttackEvent> AttackEvent;
public EntityEventHandler<InteractUsingMessage> InteractUsingEvent; public EntityEventHandler<InteractUsingEvent> InteractUsingEvent;
public EntityEventHandler<AttackHandMessage> InteractHandEvent; public EntityEventHandler<AttackHandEvent> InteractHandEvent;
public override void Initialize() public override void Initialize()
{ {
base.Initialize(); base.Initialize();
SubscribeLocalEvent<AttackEventArgs>((e) => AttackEvent?.Invoke(e)); SubscribeLocalEvent<AttackEvent>((e) => AttackEvent?.Invoke(e));
SubscribeLocalEvent<InteractUsingMessage>((e) => InteractUsingEvent?.Invoke(e)); SubscribeLocalEvent<InteractUsingEvent>((e) => InteractUsingEvent?.Invoke(e));
SubscribeLocalEvent<AttackHandMessage>((e) => InteractHandEvent?.Invoke(e)); SubscribeLocalEvent<AttackHandEvent>((e) => InteractHandEvent?.Invoke(e));
} }
public override void Shutdown() public override void Shutdown()
{ {
base.Shutdown(); base.Shutdown();
UnsubscribeLocalEvent<AttackEventArgs>(); UnsubscribeLocalEvent<AttackEvent>();
UnsubscribeLocalEvent<InteractUsingMessage>(); UnsubscribeLocalEvent<InteractUsingEvent>();
UnsubscribeLocalEvent<AttackHandMessage>(); UnsubscribeLocalEvent<AttackHandEvent>();
} }
} }
@@ -95,12 +95,12 @@ namespace Content.IntegrationTests.Tests.Interaction.Click
}; };
testAttackEntitySystem.InteractUsingEvent = (ev) => testAttackEntitySystem.InteractUsingEvent = (ev) =>
{ {
Assert.That(ev.Attacked, Is.EqualTo(containerEntity)); Assert.That(ev.Target, Is.EqualTo(containerEntity));
interactUsing = true; interactUsing = true;
}; };
testAttackEntitySystem.InteractHandEvent = (ev) => testAttackEntitySystem.InteractHandEvent = (ev) =>
{ {
Assert.That(ev.Attacked, Is.EqualTo(containerEntity)); Assert.That(ev.Target, Is.EqualTo(containerEntity));
interactHand = true; interactHand = true;
}; };

View File

@@ -42,7 +42,7 @@ namespace Content.Server.GameObjects.Components.Chemistry
Dirty(); Dirty();
} }
bool IAttack.ClickAttack(AttackEventArgs eventArgs) bool IAttack.ClickAttack(AttackEvent eventArgs)
{ {
var target = eventArgs.TargetEntity; var target = eventArgs.TargetEntity;
var user = eventArgs.User; var user = eventArgs.User;

View File

@@ -723,12 +723,12 @@ namespace Content.Server.GameObjects.Components.Disposal
return TryDrop(eventArgs.User, eventArgs.Using); return TryDrop(eventArgs.User, eventArgs.Using);
} }
public override bool CanDragDropOn(DragDropEventArgs eventArgs) public override bool CanDragDropOn(DragDropEvent eventArgs)
{ {
return CanInsert(eventArgs.Dragged); return CanInsert(eventArgs.Dragged);
} }
public override bool DragDropOn(DragDropEventArgs eventArgs) public override bool DragDropOn(DragDropEvent eventArgs)
{ {
_ = TryInsert(eventArgs.Dragged, eventArgs.User); _ = TryInsert(eventArgs.Dragged, eventArgs.User);
return true; return true;

View File

@@ -616,14 +616,14 @@ namespace Content.Server.GameObjects.Components.Disposal
return TryDrop(eventArgs.User, eventArgs.Using); return TryDrop(eventArgs.User, eventArgs.Using);
} }
public override bool CanDragDropOn(DragDropEventArgs eventArgs) public override bool CanDragDropOn(DragDropEvent eventArgs)
{ {
// Base is redundant given this already calls the base CanInsert // Base is redundant given this already calls the base CanInsert
// If that changes then update this // If that changes then update this
return CanInsert(eventArgs.Dragged); return CanInsert(eventArgs.Dragged);
} }
public override bool DragDropOn(DragDropEventArgs eventArgs) public override bool DragDropOn(DragDropEvent eventArgs)
{ {
_ = TryInsert(eventArgs.Dragged, eventArgs.User); _ = TryInsert(eventArgs.Dragged, eventArgs.User);
return true; return true;

View File

@@ -74,7 +74,7 @@ namespace Content.Server.GameObjects.Components.GUI
UserInterface.SetState(new StrippingBoundUserInterfaceState(inventory, hands, cuffs)); UserInterface.SetState(new StrippingBoundUserInterfaceState(inventory, hands, cuffs));
} }
public override bool Drop(DragDropEventArgs args) public override bool Drop(DragDropEvent args)
{ {
if (!args.User.TryGetComponent(out ActorComponent? actor)) return false; if (!args.User.TryGetComponent(out ActorComponent? actor)) return false;

View File

@@ -67,7 +67,7 @@ namespace Content.Server.GameObjects.Components.Kitchen
} }
public override bool DragDropOn(DragDropEventArgs eventArgs) public override bool DragDropOn(DragDropEvent eventArgs)
{ {
TrySpike(eventArgs.Dragged, eventArgs.User); TrySpike(eventArgs.Dragged, eventArgs.User);
return true; return true;

View File

@@ -284,7 +284,7 @@ namespace Content.Server.GameObjects.Components.Medical
} }
} }
public override bool DragDropOn(DragDropEventArgs eventArgs) public override bool DragDropOn(DragDropEvent eventArgs)
{ {
_bodyContainer.Insert(eventArgs.Dragged); _bodyContainer.Insert(eventArgs.Dragged);
return true; return true;

View File

@@ -39,7 +39,7 @@ namespace Content.Server.GameObjects.Components.Movement
} }
} }
public override bool CanDragDropOn(DragDropEventArgs eventArgs) public override bool CanDragDropOn(DragDropEvent eventArgs)
{ {
if (!base.CanDragDropOn(eventArgs)) if (!base.CanDragDropOn(eventArgs))
return false; return false;
@@ -132,7 +132,7 @@ namespace Content.Server.GameObjects.Components.Movement
return true; return true;
} }
public override bool DragDropOn(DragDropEventArgs eventArgs) public override bool DragDropOn(DragDropEvent eventArgs)
{ {
if (eventArgs.User == eventArgs.Dragged) if (eventArgs.User == eventArgs.Dragged)
{ {

View File

@@ -219,7 +219,7 @@ namespace Content.Server.GameObjects.Components.Strap
} }
} }
public override bool DragDropOn(DragDropEventArgs eventArgs) public override bool DragDropOn(DragDropEvent eventArgs)
{ {
if (!eventArgs.Dragged.TryGetComponent(out BuckleComponent? buckleComponent)) return false; if (!eventArgs.Dragged.TryGetComponent(out BuckleComponent? buckleComponent)) return false;
return buckleComponent.TryBuckle(eventArgs.User, Owner); return buckleComponent.TryBuckle(eventArgs.User, Owner);

View File

@@ -43,7 +43,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
private bool HasUses => _uses > 0; private bool HasUses => _uses > 0;
protected override bool OnHitEntities(IReadOnlyList<IEntity> entities, AttackEventArgs eventArgs) protected override bool OnHitEntities(IReadOnlyList<IEntity> entities, AttackEvent eventArgs)
{ {
if (entities.Count == 0) if (entities.Count == 0)
{ {

View File

@@ -66,12 +66,12 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
[ViewVariables(VVAccess.ReadWrite)] [DataField("clickAttackEffect")] public bool ClickAttackEffect { get; set; } = true; [ViewVariables(VVAccess.ReadWrite)] [DataField("clickAttackEffect")] public bool ClickAttackEffect { get; set; } = true;
protected virtual bool OnHitEntities(IReadOnlyList<IEntity> entities, AttackEventArgs eventArgs) protected virtual bool OnHitEntities(IReadOnlyList<IEntity> entities, AttackEvent eventArgs)
{ {
return true; return true;
} }
bool IAttack.WideAttack(AttackEventArgs eventArgs) bool IAttack.WideAttack(AttackEvent eventArgs)
{ {
if (!eventArgs.WideAttack) return true; if (!eventArgs.WideAttack) return true;
@@ -126,7 +126,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
return true; return true;
} }
bool IAttack.ClickAttack(AttackEventArgs eventArgs) bool IAttack.ClickAttack(AttackEvent eventArgs)
{ {
if (eventArgs.WideAttack) return false; if (eventArgs.WideAttack) return false;

View File

@@ -80,7 +80,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
} }
} }
protected override bool OnHitEntities(IReadOnlyList<IEntity> entities, AttackEventArgs eventArgs) protected override bool OnHitEntities(IReadOnlyList<IEntity> entities, AttackEvent eventArgs)
{ {
if (!Activated || entities.Count == 0 || Cell == null) if (!Activated || entities.Count == 0 || Cell == null)
return true; return true;

View File

@@ -24,7 +24,7 @@ namespace Content.Server.GameObjects.EntitySystems
SubscribeLocalEvent<EntInsertedIntoContainerMessage>(ContainerModified); SubscribeLocalEvent<EntInsertedIntoContainerMessage>(ContainerModified);
SubscribeLocalEvent<EntRemovedFromContainerMessage>(ContainerModified); SubscribeLocalEvent<EntRemovedFromContainerMessage>(ContainerModified);
SubscribeLocalEvent<BuckleComponent, AttackHandMessage>(HandleAttackHand); SubscribeLocalEvent<BuckleComponent, AttackHandEvent>(HandleAttackHand);
} }
public override void Shutdown() public override void Shutdown()
@@ -35,10 +35,10 @@ namespace Content.Server.GameObjects.EntitySystems
UnsubscribeLocalEvent<EntInsertedIntoContainerMessage>(); UnsubscribeLocalEvent<EntInsertedIntoContainerMessage>();
UnsubscribeLocalEvent<EntRemovedFromContainerMessage>(); UnsubscribeLocalEvent<EntRemovedFromContainerMessage>();
UnsubscribeLocalEvent<BuckleComponent, AttackHandMessage>(HandleAttackHand); UnsubscribeLocalEvent<BuckleComponent, AttackHandEvent>(HandleAttackHand);
} }
private void HandleAttackHand(EntityUid uid, BuckleComponent component, AttackHandMessage args) private void HandleAttackHand(EntityUid uid, BuckleComponent component, AttackHandEvent args)
{ {
args.Handled = component.TryUnbuckle(args.User); args.Handled = component.TryUnbuckle(args.User);
} }

View File

@@ -41,7 +41,7 @@ namespace Content.Server.GameObjects.EntitySystems.Click
public override void Initialize() public override void Initialize()
{ {
SubscribeNetworkEvent<DragDropMessage>(HandleDragDropMessage); SubscribeNetworkEvent<DragDropRequestEvent>(HandleDragDropMessage);
CommandBinds.Builder CommandBinds.Builder
.Bind(EngineKeyFunctions.Use, .Bind(EngineKeyFunctions.Use,
@@ -60,7 +60,7 @@ namespace Content.Server.GameObjects.EntitySystems.Click
base.Shutdown(); base.Shutdown();
} }
private void HandleDragDropMessage(DragDropMessage msg, EntitySessionEventArgs args) private void HandleDragDropMessage(DragDropRequestEvent msg, EntitySessionEventArgs args)
{ {
var performer = args.SenderSession.AttachedEntity; var performer = args.SenderSession.AttachedEntity;
@@ -68,7 +68,7 @@ namespace Content.Server.GameObjects.EntitySystems.Click
if (!EntityManager.TryGetEntity(msg.Dropped, out var dropped)) return; if (!EntityManager.TryGetEntity(msg.Dropped, out var dropped)) return;
if (!EntityManager.TryGetEntity(msg.Target, out var target)) return; if (!EntityManager.TryGetEntity(msg.Target, out var target)) return;
var interactionArgs = new DragDropEventArgs(performer, msg.DropLocation, dropped, target); var interactionArgs = new DragDropEvent(performer, msg.DropLocation, dropped, target);
// must be in range of both the target and the object they are drag / dropping // must be in range of both the target and the object they are drag / dropping
// Client also does this check but ya know we gotta validate it. // Client also does this check but ya know we gotta validate it.
@@ -132,7 +132,7 @@ namespace Content.Server.GameObjects.EntitySystems.Click
private void InteractionActivate(IEntity user, IEntity used) private void InteractionActivate(IEntity user, IEntity used)
{ {
var activateMsg = new ActivateInWorldMessage(user, used); var activateMsg = new ActivateInWorldEvent(user, used);
RaiseLocalEvent(used.Uid, activateMsg); RaiseLocalEvent(used.Uid, activateMsg);
if (activateMsg.Handled) if (activateMsg.Handled)
{ {
@@ -404,7 +404,7 @@ namespace Content.Server.GameObjects.EntitySystems.Click
/// </summary> /// </summary>
private async void InteractAfter(IEntity user, IEntity weapon, EntityCoordinates clickLocation, bool canReach) private async void InteractAfter(IEntity user, IEntity weapon, EntityCoordinates clickLocation, bool canReach)
{ {
var message = new AfterInteractMessage(user, weapon, null, clickLocation, canReach); var message = new AfterInteractEvent(user, weapon, null, clickLocation, canReach);
RaiseLocalEvent(weapon.Uid, message); RaiseLocalEvent(weapon.Uid, message);
if (message.Handled) if (message.Handled)
{ {
@@ -421,7 +421,7 @@ namespace Content.Server.GameObjects.EntitySystems.Click
/// </summary> /// </summary>
public async Task Interaction(IEntity user, IEntity weapon, IEntity attacked, EntityCoordinates clickLocation) public async Task Interaction(IEntity user, IEntity weapon, IEntity attacked, EntityCoordinates clickLocation)
{ {
var attackMsg = new InteractUsingMessage(user, weapon, attacked, clickLocation); var attackMsg = new InteractUsingEvent(user, weapon, attacked, clickLocation);
RaiseLocalEvent(attacked.Uid, attackMsg); RaiseLocalEvent(attacked.Uid, attackMsg);
if (attackMsg.Handled) if (attackMsg.Handled)
return; return;
@@ -442,7 +442,7 @@ namespace Content.Server.GameObjects.EntitySystems.Click
} }
} }
var afterAtkMsg = new AfterInteractMessage(user, weapon, attacked, clickLocation, true); var afterAtkMsg = new AfterInteractEvent(user, weapon, attacked, clickLocation, true);
RaiseLocalEvent(weapon.Uid, afterAtkMsg, false); RaiseLocalEvent(weapon.Uid, afterAtkMsg, false);
if (afterAtkMsg.Handled) if (afterAtkMsg.Handled)
{ {
@@ -461,7 +461,7 @@ namespace Content.Server.GameObjects.EntitySystems.Click
/// </summary> /// </summary>
public void Interaction(IEntity user, IEntity attacked) public void Interaction(IEntity user, IEntity attacked)
{ {
var message = new AttackHandMessage(user, attacked); var message = new AttackHandEvent(user, attacked);
RaiseLocalEvent(attacked.Uid, message); RaiseLocalEvent(attacked.Uid, message);
if (message.Handled) if (message.Handled)
return; return;
@@ -514,7 +514,7 @@ namespace Content.Server.GameObjects.EntitySystems.Click
delayComponent.BeginDelay(); delayComponent.BeginDelay();
} }
var useMsg = new UseInHandMessage(user, used); var useMsg = new UseInHandEvent(user, used);
RaiseLocalEvent(used.Uid, useMsg); RaiseLocalEvent(used.Uid, useMsg);
if (useMsg.Handled) if (useMsg.Handled)
{ {
@@ -552,7 +552,7 @@ namespace Content.Server.GameObjects.EntitySystems.Click
/// </summary> /// </summary>
public void ThrownInteraction(IEntity user, IEntity thrown) public void ThrownInteraction(IEntity user, IEntity thrown)
{ {
var throwMsg = new ThrownMessage(user, thrown); var throwMsg = new ThrownEvent(user, thrown);
RaiseLocalEvent(thrown.Uid, throwMsg); RaiseLocalEvent(thrown.Uid, throwMsg);
if (throwMsg.Handled) if (throwMsg.Handled)
{ {
@@ -575,7 +575,7 @@ namespace Content.Server.GameObjects.EntitySystems.Click
/// </summary> /// </summary>
public void EquippedInteraction(IEntity user, IEntity equipped, EquipmentSlotDefines.Slots slot) public void EquippedInteraction(IEntity user, IEntity equipped, EquipmentSlotDefines.Slots slot)
{ {
var equipMsg = new EquippedMessage(user, equipped, slot); var equipMsg = new EquippedEvent(user, equipped, slot);
RaiseLocalEvent(equipped.Uid, equipMsg); RaiseLocalEvent(equipped.Uid, equipMsg);
if (equipMsg.Handled) if (equipMsg.Handled)
{ {
@@ -597,7 +597,7 @@ namespace Content.Server.GameObjects.EntitySystems.Click
/// </summary> /// </summary>
public void UnequippedInteraction(IEntity user, IEntity equipped, EquipmentSlotDefines.Slots slot) public void UnequippedInteraction(IEntity user, IEntity equipped, EquipmentSlotDefines.Slots slot)
{ {
var unequipMsg = new UnequippedMessage(user, equipped, slot); var unequipMsg = new UnequippedEvent(user, equipped, slot);
RaiseLocalEvent(equipped.Uid, unequipMsg); RaiseLocalEvent(equipped.Uid, unequipMsg);
if (unequipMsg.Handled) if (unequipMsg.Handled)
{ {
@@ -619,7 +619,7 @@ namespace Content.Server.GameObjects.EntitySystems.Click
/// </summary> /// </summary>
public void EquippedHandInteraction(IEntity user, IEntity item, SharedHand hand) public void EquippedHandInteraction(IEntity user, IEntity item, SharedHand hand)
{ {
var equippedHandMessage = new EquippedHandMessage(user, item, hand); var equippedHandMessage = new EquippedHandEvent(user, item, hand);
RaiseLocalEvent(item.Uid, equippedHandMessage); RaiseLocalEvent(item.Uid, equippedHandMessage);
if (equippedHandMessage.Handled) if (equippedHandMessage.Handled)
{ {
@@ -640,7 +640,7 @@ namespace Content.Server.GameObjects.EntitySystems.Click
/// </summary> /// </summary>
public void UnequippedHandInteraction(IEntity user, IEntity item, SharedHand hand) public void UnequippedHandInteraction(IEntity user, IEntity item, SharedHand hand)
{ {
var unequippedHandMessage = new UnequippedHandMessage(user, item, hand); var unequippedHandMessage = new UnequippedHandEvent(user, item, hand);
RaiseLocalEvent(item.Uid, unequippedHandMessage); RaiseLocalEvent(item.Uid, unequippedHandMessage);
if (unequippedHandMessage.Handled) if (unequippedHandMessage.Handled)
{ {
@@ -673,7 +673,7 @@ namespace Content.Server.GameObjects.EntitySystems.Click
/// </summary> /// </summary>
public void DroppedInteraction(IEntity user, IEntity item, bool intentional) public void DroppedInteraction(IEntity user, IEntity item, bool intentional)
{ {
var dropMsg = new DroppedMessage(user, item, intentional); var dropMsg = new DroppedEvent(user, item, intentional);
RaiseLocalEvent(item.Uid, dropMsg); RaiseLocalEvent(item.Uid, dropMsg);
if (dropMsg.Handled) if (dropMsg.Handled)
{ {
@@ -697,7 +697,7 @@ namespace Content.Server.GameObjects.EntitySystems.Click
/// </summary> /// </summary>
public void HandSelectedInteraction(IEntity user, IEntity item) public void HandSelectedInteraction(IEntity user, IEntity item)
{ {
var handSelectedMsg = new HandSelectedMessage(user, item); var handSelectedMsg = new HandSelectedEvent(user, item);
RaiseLocalEvent(item.Uid, handSelectedMsg); RaiseLocalEvent(item.Uid, handSelectedMsg);
if (handSelectedMsg.Handled) if (handSelectedMsg.Handled)
{ {
@@ -719,7 +719,7 @@ namespace Content.Server.GameObjects.EntitySystems.Click
/// </summary> /// </summary>
public void HandDeselectedInteraction(IEntity user, IEntity item) public void HandDeselectedInteraction(IEntity user, IEntity item)
{ {
var handDeselectedMsg = new HandDeselectedMessage(user, item); var handDeselectedMsg = new HandDeselectedEvent(user, item);
RaiseLocalEvent(item.Uid, handDeselectedMsg); RaiseLocalEvent(item.Uid, handDeselectedMsg);
if (handDeselectedMsg.Handled) if (handDeselectedMsg.Handled)
{ {
@@ -741,7 +741,7 @@ namespace Content.Server.GameObjects.EntitySystems.Click
/// </summary> /// </summary>
public async void RangedInteraction(IEntity user, IEntity weapon, IEntity attacked, EntityCoordinates clickLocation) public async void RangedInteraction(IEntity user, IEntity weapon, IEntity attacked, EntityCoordinates clickLocation)
{ {
var rangedMsg = new RangedInteractMessage(user, weapon, attacked, clickLocation); var rangedMsg = new RangedInteractEvent(user, weapon, attacked, clickLocation);
RaiseLocalEvent(attacked.Uid, rangedMsg); RaiseLocalEvent(attacked.Uid, rangedMsg);
if (rangedMsg.Handled) if (rangedMsg.Handled)
return; return;
@@ -759,7 +759,7 @@ namespace Content.Server.GameObjects.EntitySystems.Click
} }
} }
var afterAtkMsg = new AfterInteractMessage(user, weapon, attacked, clickLocation, false); var afterAtkMsg = new AfterInteractEvent(user, weapon, attacked, clickLocation, false);
RaiseLocalEvent(weapon.Uid, afterAtkMsg); RaiseLocalEvent(weapon.Uid, afterAtkMsg);
if (afterAtkMsg.Handled) if (afterAtkMsg.Handled)
return; return;
@@ -815,7 +815,7 @@ namespace Content.Server.GameObjects.EntitySystems.Click
} }
} }
var eventArgs = new AttackEventArgs(player, coordinates, wideAttack, targetUid); var eventArgs = new AttackEvent(player, coordinates, wideAttack, targetUid);
// Verify player has a hand, and find what object he is currently holding in his active hand // Verify player has a hand, and find what object he is currently holding in his active hand
if (player.TryGetComponent<IHandsComponent>(out var hands)) if (player.TryGetComponent<IHandsComponent>(out var hands))

View File

@@ -22,7 +22,7 @@ namespace Content.Server.GameObjects.EntitySystems
{ {
base.Initialize(); base.Initialize();
SubscribeLocalEvent<CloningPodComponent, ActivateInWorldMessage>(HandleActivate); SubscribeLocalEvent<CloningPodComponent, ActivateInWorldEvent>(HandleActivate);
SubscribeLocalEvent<BeingClonedComponent, MindAddedMessage>(HandleMindAdded); SubscribeLocalEvent<BeingClonedComponent, MindAddedMessage>(HandleMindAdded);
} }
@@ -30,7 +30,7 @@ namespace Content.Server.GameObjects.EntitySystems
{ {
base.Shutdown(); base.Shutdown();
UnsubscribeLocalEvent<CloningPodComponent, ActivateInWorldMessage>(HandleActivate); UnsubscribeLocalEvent<CloningPodComponent, ActivateInWorldEvent>(HandleActivate);
UnsubscribeLocalEvent<BeingClonedComponent, MindAddedMessage>(HandleMindAdded); UnsubscribeLocalEvent<BeingClonedComponent, MindAddedMessage>(HandleMindAdded);
} }
@@ -46,7 +46,7 @@ namespace Content.Server.GameObjects.EntitySystems
mind?.UnVisit(); mind?.UnVisit();
} }
private void HandleActivate(EntityUid uid, CloningPodComponent component, ActivateInWorldMessage args) private void HandleActivate(EntityUid uid, CloningPodComponent component, ActivateInWorldEvent args)
{ {
if (!component.Powered || if (!component.Powered ||
!args.User.TryGetComponent(out ActorComponent? actor)) !args.User.TryGetComponent(out ActorComponent? actor))

View File

@@ -18,21 +18,21 @@ namespace Content.Server.GameObjects.EntitySystems
{ {
base.Initialize(); base.Initialize();
SubscribeLocalEvent<DisassembleOnActivateComponent, ActivateInWorldMessage>(HandleActivateInWorld); SubscribeLocalEvent<DisassembleOnActivateComponent, ActivateInWorldEvent>(HandleActivateInWorld);
} }
public override void Shutdown() public override void Shutdown()
{ {
base.Shutdown(); base.Shutdown();
UnsubscribeLocalEvent<DisassembleOnActivateComponent, ActivateInWorldMessage>(HandleActivateInWorld); UnsubscribeLocalEvent<DisassembleOnActivateComponent, ActivateInWorldEvent>(HandleActivateInWorld);
} }
private async void HandleActivateInWorld(EntityUid uid, DisassembleOnActivateComponent component, ActivateInWorldMessage args) private async void HandleActivateInWorld(EntityUid uid, DisassembleOnActivateComponent component, ActivateInWorldEvent args)
{ {
if (string.IsNullOrEmpty(component.Prototype)) if (string.IsNullOrEmpty(component.Prototype))
return; return;
if (!args.User.InRangeUnobstructed(args.Activated)) if (!args.User.InRangeUnobstructed(args.Target))
return; return;
if (component.DoAfterTime > 0 && TryGet<DoAfterSystem>(out var doAfterSystem)) if (component.DoAfterTime > 0 && TryGet<DoAfterSystem>(out var doAfterSystem))

View File

@@ -17,48 +17,48 @@ namespace Content.Server.GameObjects.EntitySystems.Janitorial
{ {
base.Initialize(); base.Initialize();
SubscribeLocalEvent<LightReplacerComponent, InteractUsingMessage>(HandleInteract); SubscribeLocalEvent<LightReplacerComponent, InteractUsingEvent>(HandleInteract);
SubscribeLocalEvent<LightReplacerComponent, AfterInteractMessage>(HandleAfterInteract); SubscribeLocalEvent<LightReplacerComponent, AfterInteractEvent>(HandleAfterInteract);
} }
public override void Shutdown() public override void Shutdown()
{ {
base.Shutdown(); base.Shutdown();
UnsubscribeLocalEvent<LightReplacerComponent, InteractUsingMessage>(HandleInteract); UnsubscribeLocalEvent<LightReplacerComponent, InteractUsingEvent>(HandleInteract);
UnsubscribeLocalEvent<LightReplacerComponent, AfterInteractMessage>(HandleAfterInteract); UnsubscribeLocalEvent<LightReplacerComponent, AfterInteractEvent>(HandleAfterInteract);
} }
private void HandleAfterInteract(EntityUid uid, LightReplacerComponent component, AfterInteractMessage eventArgs) private void HandleAfterInteract(EntityUid uid, LightReplacerComponent component, AfterInteractEvent eventArgs)
{ {
// standard interaction checks // standard interaction checks
if (!ActionBlockerSystem.CanUse(eventArgs.User)) return; if (!ActionBlockerSystem.CanUse(eventArgs.User)) return;
if (!eventArgs.CanReach) return; if (!eventArgs.CanReach) return;
// behaviour will depends on target type // behaviour will depends on target type
if (eventArgs.Attacked != null) if (eventArgs.Target != null)
{ {
// replace broken light in fixture? // replace broken light in fixture?
if (eventArgs.Attacked.TryGetComponent(out PoweredLightComponent? fixture)) if (eventArgs.Target.TryGetComponent(out PoweredLightComponent? fixture))
component.TryReplaceBulb(fixture, eventArgs.User); component.TryReplaceBulb(fixture, eventArgs.User);
// add new bulb to light replacer container? // add new bulb to light replacer container?
else if (eventArgs.Attacked.TryGetComponent(out LightBulbComponent? bulb)) else if (eventArgs.Target.TryGetComponent(out LightBulbComponent? bulb))
component.TryInsertBulb(bulb, eventArgs.User, true); component.TryInsertBulb(bulb, eventArgs.User, true);
} }
} }
private void HandleInteract(EntityUid uid, LightReplacerComponent component, InteractUsingMessage eventArgs) private void HandleInteract(EntityUid uid, LightReplacerComponent component, InteractUsingEvent eventArgs)
{ {
// standard interaction checks // standard interaction checks
if (!ActionBlockerSystem.CanInteract(eventArgs.User)) return; if (!ActionBlockerSystem.CanInteract(eventArgs.User)) return;
if (eventArgs.ItemInHand != null) if (eventArgs.Used != null)
{ {
// want to insert a new light bulb? // want to insert a new light bulb?
if (eventArgs.ItemInHand.TryGetComponent(out LightBulbComponent? bulb)) if (eventArgs.Used.TryGetComponent(out LightBulbComponent? bulb))
component.TryInsertBulb(bulb, eventArgs.User, true); component.TryInsertBulb(bulb, eventArgs.User, true);
// add bulbs from storage? // add bulbs from storage?
else if (eventArgs.ItemInHand.TryGetComponent(out ServerStorageComponent? storage)) else if (eventArgs.Used.TryGetComponent(out ServerStorageComponent? storage))
component.TryInsertBulb(storage, eventArgs.User); component.TryInsertBulb(storage, eventArgs.User);
} }
} }

View File

@@ -21,17 +21,17 @@ namespace Content.Server.GameObjects.EntitySystems
{ {
base.Initialize(); base.Initialize();
SubscribeLocalEvent<SpawnAfterInteractComponent, AfterInteractMessage>(HandleAfterInteract); SubscribeLocalEvent<SpawnAfterInteractComponent, AfterInteractEvent>(HandleAfterInteract);
} }
public override void Shutdown() public override void Shutdown()
{ {
base.Shutdown(); base.Shutdown();
UnsubscribeLocalEvent<SpawnAfterInteractComponent, AfterInteractMessage>(HandleAfterInteract); UnsubscribeLocalEvent<SpawnAfterInteractComponent, AfterInteractEvent>(HandleAfterInteract);
} }
private async void HandleAfterInteract(EntityUid uid, SpawnAfterInteractComponent component, AfterInteractMessage args) private async void HandleAfterInteract(EntityUid uid, SpawnAfterInteractComponent component, AfterInteractEvent args)
{ {
if (string.IsNullOrEmpty(component.Prototype)) if (string.IsNullOrEmpty(component.Prototype))
return; return;

View File

@@ -67,12 +67,12 @@ namespace Content.Shared.GameObjects.Components.Buckle
return !Buckled; return !Buckled;
} }
bool IDraggable.CanDrop(CanDropEventArgs args) bool IDraggable.CanDrop(CanDropEvent args)
{ {
return args.Target.HasComponent<SharedStrapComponent>(); return args.Target.HasComponent<SharedStrapComponent>();
} }
bool IDraggable.Drop(DragDropEventArgs args) bool IDraggable.Drop(DragDropEvent args)
{ {
return TryBuckle(args.User, args.Target); return TryBuckle(args.User, args.Target);
} }

View File

@@ -187,11 +187,11 @@ namespace Content.Shared.GameObjects.Components.Disposal
return true; return true;
} }
public virtual bool CanDragDropOn(DragDropEventArgs eventArgs) public virtual bool CanDragDropOn(DragDropEvent eventArgs)
{ {
return CanInsert(eventArgs.Dragged); return CanInsert(eventArgs.Dragged);
} }
public abstract bool DragDropOn(DragDropEventArgs eventArgs); public abstract bool DragDropOn(DragDropEvent eventArgs);
} }
} }

View File

@@ -21,14 +21,14 @@ namespace Content.Shared.GameObjects.Components.GUI
&& ActionBlockerSystem.CanInteract(by); && ActionBlockerSystem.CanInteract(by);
} }
bool IDraggable.CanDrop(CanDropEventArgs args) bool IDraggable.CanDrop(CanDropEvent args)
{ {
return args.Target != args.Dragged return args.Target != args.Dragged
&& args.Target == args.User && args.Target == args.User
&& CanBeStripped(args.User); && CanBeStripped(args.User);
} }
public abstract bool Drop(DragDropEventArgs args); public abstract bool Drop(DragDropEvent args);
[NetSerializable, Serializable] [NetSerializable, Serializable]
public enum StrippingUiKey public enum StrippingUiKey

View File

@@ -12,13 +12,13 @@ namespace Content.Shared.GameObjects.Components.GUI
{ {
public override string Name => "Stripping"; public override string Name => "Stripping";
bool IDragDropOn.CanDragDropOn(DragDropEventArgs eventArgs) bool IDragDropOn.CanDragDropOn(DragDropEvent eventArgs)
{ {
if (!eventArgs.Dragged.TryGetComponent(out SharedStrippableComponent? strippable)) return false; if (!eventArgs.Dragged.TryGetComponent(out SharedStrippableComponent? strippable)) return false;
return strippable.CanBeStripped(Owner); return strippable.CanBeStripped(Owner);
} }
bool IDragDropOn.DragDropOn(DragDropEventArgs eventArgs) bool IDragDropOn.DragDropOn(DragDropEvent eventArgs)
{ {
// Handled by StrippableComponent // Handled by StrippableComponent
return true; return true;

View File

@@ -80,11 +80,11 @@ namespace Content.Shared.GameObjects.Components.Medical
} }
bool IDragDropOn.CanDragDropOn(DragDropEventArgs eventArgs) bool IDragDropOn.CanDragDropOn(DragDropEvent eventArgs)
{ {
return eventArgs.Dragged.HasComponent<IBody>(); return eventArgs.Dragged.HasComponent<IBody>();
} }
public abstract bool DragDropOn(DragDropEventArgs eventArgs); public abstract bool DragDropOn(DragDropEvent eventArgs);
} }
} }

View File

@@ -18,11 +18,11 @@ namespace Content.Shared.GameObjects.Components.Movement
/// </summary> /// </summary>
[ViewVariables] [DataField("range")] protected float Range = SharedInteractionSystem.InteractionRange / 1.4f; [ViewVariables] [DataField("range")] protected float Range = SharedInteractionSystem.InteractionRange / 1.4f;
public virtual bool CanDragDropOn(DragDropEventArgs eventArgs) public virtual bool CanDragDropOn(DragDropEvent eventArgs)
{ {
return eventArgs.Dragged.HasComponent<SharedClimbingComponent>(); return eventArgs.Dragged.HasComponent<SharedClimbingComponent>();
} }
public abstract bool DragDropOn(DragDropEventArgs eventArgs); public abstract bool DragDropOn(DragDropEvent eventArgs);
} }
} }

View File

@@ -23,7 +23,7 @@ namespace Content.Shared.GameObjects.Components.Nutrition
[DataField("meat")] [DataField("meat")]
private string? _meatPrototype; private string? _meatPrototype;
public bool CanDrop(CanDropEventArgs args) public bool CanDrop(CanDropEvent args)
{ {
return true; return true;
} }

View File

@@ -24,13 +24,13 @@ namespace Content.Shared.GameObjects.Components.Storage
/// <returns>True if no longer in storage, false otherwise</returns> /// <returns>True if no longer in storage, false otherwise</returns>
public abstract bool Remove(IEntity entity); public abstract bool Remove(IEntity entity);
bool IDraggable.CanDrop(CanDropEventArgs args) bool IDraggable.CanDrop(CanDropEvent args)
{ {
return args.Target.TryGetComponent(out SharedPlaceableSurfaceComponent? placeable) && return args.Target.TryGetComponent(out SharedPlaceableSurfaceComponent? placeable) &&
placeable.IsPlaceable; placeable.IsPlaceable;
} }
bool IDraggable.Drop(DragDropEventArgs eventArgs) bool IDraggable.Drop(DragDropEvent eventArgs)
{ {
if (!ActionBlockerSystem.CanInteract(eventArgs.User)) if (!ActionBlockerSystem.CanInteract(eventArgs.User))
{ {

View File

@@ -32,7 +32,7 @@ namespace Content.Shared.GameObjects.Components.Strap
public sealed override uint? NetID => ContentNetIDs.STRAP; public sealed override uint? NetID => ContentNetIDs.STRAP;
bool IDragDropOn.CanDragDropOn(DragDropEventArgs eventArgs) bool IDragDropOn.CanDragDropOn(DragDropEvent eventArgs)
{ {
if (!eventArgs.Dragged.TryGetComponent(out SharedBuckleComponent? buckleComponent)) return false; if (!eventArgs.Dragged.TryGetComponent(out SharedBuckleComponent? buckleComponent)) return false;
bool Ignored(IEntity entity) => entity == eventArgs.User || entity == eventArgs.Dragged || entity == eventArgs.Target; bool Ignored(IEntity entity) => entity == eventArgs.User || entity == eventArgs.Dragged || entity == eventArgs.Target;
@@ -40,7 +40,7 @@ namespace Content.Shared.GameObjects.Components.Strap
return eventArgs.Target.InRangeUnobstructed(eventArgs.Dragged, buckleComponent.Range, predicate: Ignored); return eventArgs.Target.InRangeUnobstructed(eventArgs.Dragged, buckleComponent.Range, predicate: Ignored);
} }
public abstract bool DragDropOn(DragDropEventArgs eventArgs); public abstract bool DragDropOn(DragDropEvent eventArgs);
} }
[Serializable, NetSerializable] [Serializable, NetSerializable]

View File

@@ -10,13 +10,24 @@ namespace Content.Shared.GameObjects.EntitySystemMessages
/// Requests a drag / drop interaction to be performed /// Requests a drag / drop interaction to be performed
/// </summary> /// </summary>
[Serializable, NetSerializable] [Serializable, NetSerializable]
public class DragDropMessage : EntityEventArgs public class DragDropRequestEvent : EntityEventArgs
{ {
/// <summary>
/// Location that the entity was dropped.
/// </summary>
public EntityCoordinates DropLocation { get; } public EntityCoordinates DropLocation { get; }
/// <summary>
/// Entity that was dragged and dropped.
/// </summary>
public EntityUid Dropped { get; } public EntityUid Dropped { get; }
/// <summary>
/// Entity that was drag dropped on.
/// </summary>
public EntityUid Target { get; } public EntityUid Target { get; }
public DragDropMessage(EntityCoordinates dropLocation, EntityUid dropped, EntityUid target) public DragDropRequestEvent(EntityCoordinates dropLocation, EntityUid dropped, EntityUid target)
{ {
DropLocation = dropLocation; DropLocation = dropLocation;
Dropped = dropped; Dropped = dropped;

View File

@@ -148,7 +148,7 @@ namespace Content.Shared.GameObjects.EntitySystems
return InRangeUnOccluded(originPos, otherPos, range, predicate, ignoreInsideBlocker); return InRangeUnOccluded(originPos, otherPos, range, predicate, ignoreInsideBlocker);
} }
public static bool InRangeUnOccluded(DragDropEventArgs args, float range, Ignored? predicate, bool ignoreInsideBlocker = true) public static bool InRangeUnOccluded(DragDropEvent args, float range, Ignored? predicate, bool ignoreInsideBlocker = true)
{ {
var originPos = args.User.Transform.MapPosition; var originPos = args.User.Transform.MapPosition;
var otherPos = args.DropLocation.ToMap(args.User.EntityManager); var otherPos = args.DropLocation.ToMap(args.User.EntityManager);

View File

@@ -417,7 +417,7 @@ namespace Content.Shared.GameObjects.EntitySystems
} }
/// <summary> /// <summary>
/// Checks that the user of a <see cref="DragDropEventArgs"/> is within a /// Checks that the user of a <see cref="DragDropEvent"/> is within a
/// certain distance of the target and dropped entities without any entity /// certain distance of the target and dropped entities without any entity
/// that matches the collision mask obstructing them. /// that matches the collision mask obstructing them.
/// If the <paramref name="range"/> is zero or negative, /// If the <paramref name="range"/> is zero or negative,
@@ -448,7 +448,7 @@ namespace Content.Shared.GameObjects.EntitySystems
/// True if the two points are within a given range without being obstructed. /// True if the two points are within a given range without being obstructed.
/// </returns> /// </returns>
public bool InRangeUnobstructed( public bool InRangeUnobstructed(
DragDropEventArgs args, DragDropEvent args,
float range = InteractionRange, float range = InteractionRange,
CollisionGroup collisionMask = CollisionGroup.Impassable, CollisionGroup collisionMask = CollisionGroup.Impassable,
Ignored? predicate = null, Ignored? predicate = null,
@@ -544,7 +544,7 @@ namespace Content.Shared.GameObjects.EntitySystems
/// <summary> /// <summary>
/// Checks that the user and target of a /// Checks that the user and target of a
/// <see cref="AfterInteractMessage"/> are within a certain distance /// <see cref="AfterInteractEvent"/> are within a certain distance
/// without any entity that matches the collision mask obstructing them. /// without any entity that matches the collision mask obstructing them.
/// If the <paramref name="range"/> is zero or negative, /// If the <paramref name="range"/> is zero or negative,
/// this method will only check if nothing obstructs the entity and component. /// this method will only check if nothing obstructs the entity and component.
@@ -574,7 +574,7 @@ namespace Content.Shared.GameObjects.EntitySystems
/// True if the two points are within a given range without being obstructed. /// True if the two points are within a given range without being obstructed.
/// </returns> /// </returns>
public bool InRangeUnobstructed( public bool InRangeUnobstructed(
AfterInteractMessage args, AfterInteractEvent args,
float range = InteractionRange, float range = InteractionRange,
CollisionGroup collisionMask = CollisionGroup.Impassable, CollisionGroup collisionMask = CollisionGroup.Impassable,
Ignored? predicate = null, Ignored? predicate = null,
@@ -582,7 +582,7 @@ namespace Content.Shared.GameObjects.EntitySystems
bool popup = false) bool popup = false)
{ {
var user = args.User; var user = args.User;
var target = args.Attacked; var target = args.Target;
predicate ??= e => e == user; predicate ??= e => e == user;
MapCoordinates otherPosition; MapCoordinates otherPosition;

View File

@@ -38,7 +38,7 @@ namespace Content.Shared.GameObjects.EntitySystems
// LandInteraction // LandInteraction
// TODO: Refactor these to system messages // TODO: Refactor these to system messages
var landMsg = new LandMessage(user, landing, coordinates); var landMsg = new LandEvent(user, landing, coordinates);
RaiseLocalEvent(landMsg); RaiseLocalEvent(landMsg);
if (landMsg.Handled) if (landMsg.Handled)
{ {
@@ -65,7 +65,7 @@ namespace Content.Shared.GameObjects.EntitySystems
public void ThrowCollideInteraction(IEntity? user, IPhysBody thrown, IPhysBody target) public void ThrowCollideInteraction(IEntity? user, IPhysBody thrown, IPhysBody target)
{ {
// TODO: Just pass in the bodies directly // TODO: Just pass in the bodies directly
var collideMsg = new ThrowCollideMessage(user, thrown.Owner, target.Owner); var collideMsg = new ThrowCollideEvent(user, thrown.Owner, target.Owner);
RaiseLocalEvent(collideMsg); RaiseLocalEvent(collideMsg);
if (collideMsg.Handled) if (collideMsg.Handled)
{ {

View File

@@ -38,22 +38,22 @@ namespace Content.Shared.Interfaces.GameObjects.Components
/// Raised when an entity is activated in the world. /// Raised when an entity is activated in the world.
/// </summary> /// </summary>
[PublicAPI] [PublicAPI]
public class ActivateInWorldMessage : HandledEntityEventArgs public class ActivateInWorldEvent : HandledEntityEventArgs
{ {
/// <summary> /// <summary>
/// Entity that activated the world entity. /// Entity that activated the target world entity.
/// </summary> /// </summary>
public IEntity User { get; } public IEntity User { get; }
/// <summary> /// <summary>
/// Entity that was activated in the world. /// Entity that was activated in the world.
/// </summary> /// </summary>
public IEntity Activated { get; } public IEntity Target { get; }
public ActivateInWorldMessage(IEntity user, IEntity activated) public ActivateInWorldEvent(IEntity user, IEntity target)
{ {
User = user; User = user;
Activated = activated; Target = target;
} }
} }
} }

View File

@@ -51,22 +51,22 @@ namespace Content.Shared.Interfaces.GameObjects.Components
/// Raised when clicking on another object and no attack event was handled. /// Raised when clicking on another object and no attack event was handled.
/// </summary> /// </summary>
[PublicAPI] [PublicAPI]
public class AfterInteractMessage : HandledEntityEventArgs public class AfterInteractEvent : HandledEntityEventArgs
{ {
/// <summary> /// <summary>
/// Entity that triggered the attack. /// Entity that triggered the interaction.
/// </summary> /// </summary>
public IEntity User { get; } public IEntity User { get; }
/// <summary> /// <summary>
/// Entity that the User attacked with. /// Entity that the user used to interact.
/// </summary> /// </summary>
public IEntity ItemInHand { get; set; } public IEntity Used { get; }
/// <summary> /// <summary>
/// Entity that was attacked. This can be null if the attack did not click on an entity. /// Entity that was interacted on. This can be null if the attack did not click on an entity.
/// </summary> /// </summary>
public IEntity? Attacked { get; } public IEntity? Target { get; }
/// <summary> /// <summary>
/// Location that the user clicked outside of their interaction range. /// Location that the user clicked outside of their interaction range.
@@ -79,13 +79,13 @@ namespace Content.Shared.Interfaces.GameObjects.Components
/// </summary> /// </summary>
public bool CanReach { get; } public bool CanReach { get; }
public AfterInteractMessage(IEntity user, IEntity itemInHand, IEntity? attacked, public AfterInteractEvent(IEntity user, IEntity used, IEntity? target,
EntityCoordinates clickLocation, bool canReach) EntityCoordinates clickLocation, bool canReach)
{ {
User = user; User = user;
Attacked = attacked; Used = used;
Target = target;
ClickLocation = clickLocation; ClickLocation = clickLocation;
ItemInHand = itemInHand;
CanReach = canReach; CanReach = canReach;
} }
} }

View File

@@ -15,15 +15,43 @@ namespace Content.Shared.Interfaces.GameObjects.Components
{ {
// Redirects to ClickAttack by default. // Redirects to ClickAttack by default.
[Obsolete("WideAttack")] [Obsolete("WideAttack")]
bool WideAttack(AttackEventArgs eventArgs) => ClickAttack(eventArgs); bool WideAttack(AttackEvent eventArgs) => ClickAttack(eventArgs);
[Obsolete("Use ClickAttack instead")] [Obsolete("Use ClickAttack instead")]
bool ClickAttack(AttackEventArgs eventArgs); bool ClickAttack(AttackEvent eventArgs);
} }
public class AttackEventArgs : EntityEventArgs /// <summary>
/// Raised when a target entity is attacked by a user.
/// </summary>
public class AttackEvent : EntityEventArgs
{ {
public AttackEventArgs(IEntity user, EntityCoordinates clickLocation, bool wideAttack, EntityUid target = default) /// <summary>
/// Entity that triggered the attack.
/// </summary>
public IEntity User { get; }
/// <summary>
/// The original location that was clicked by the user.
/// </summary>
public EntityCoordinates ClickLocation { get; }
/// <summary>
/// Indicates whether the attack creates a swing attack or attacks the target entity directly.
/// </summary>
public bool WideAttack { get; }
/// <summary>
/// UID of the entity that was attacked.
/// </summary>
public EntityUid Target { get; }
/// <summary>
/// Entity that was attacked.
/// </summary>
public IEntity? TargetEntity { get; }
public AttackEvent(IEntity user, EntityCoordinates clickLocation, bool wideAttack, EntityUid target = default)
{ {
User = user; User = user;
ClickLocation = clickLocation; ClickLocation = clickLocation;
@@ -33,11 +61,5 @@ namespace Content.Shared.Interfaces.GameObjects.Components
IoCManager.Resolve<IEntityManager>().TryGetEntity(Target, out var targetEntity); IoCManager.Resolve<IEntityManager>().TryGetEntity(Target, out var targetEntity);
TargetEntity = targetEntity; TargetEntity = targetEntity;
} }
public IEntity User { get; }
public EntityCoordinates ClickLocation { get; }
public bool WideAttack { get; }
public EntityUid Target { get; }
public IEntity? TargetEntity { get; }
} }
} }

View File

@@ -18,7 +18,7 @@ namespace Content.Shared.Interfaces.GameObjects.Components
/// </summary> /// </summary>
/// <param name="eventArgs"></param> /// <param name="eventArgs"></param>
/// <returns>true if <see cref="eventArgs"/> is valid, false otherwise.</returns> /// <returns>true if <see cref="eventArgs"/> is valid, false otherwise.</returns>
bool CanDragDropOn(DragDropEventArgs eventArgs); bool CanDragDropOn(DragDropEvent eventArgs);
/// <summary> /// <summary>
/// Invoked server-side when another entity is being dragged and dropped /// Invoked server-side when another entity is being dragged and dropped
@@ -30,6 +30,6 @@ namespace Content.Shared.Interfaces.GameObjects.Components
/// true if an interaction occurred and no further interaction should /// true if an interaction occurred and no further interaction should
/// be processed for this drop. /// be processed for this drop.
/// </returns> /// </returns>
bool DragDropOn(DragDropEventArgs eventArgs); bool DragDropOn(DragDropEvent eventArgs);
} }
} }

View File

@@ -23,7 +23,7 @@ namespace Content.Shared.Interfaces.GameObjects.Components
/// The information about the drag, such as who is doing it. /// The information about the drag, such as who is doing it.
/// </param> /// </param>
/// <returns>True if the drag should be initiated, false otherwise.</returns> /// <returns>True if the drag should be initiated, false otherwise.</returns>
bool CanStartDrag(StartDragDropEventArgs args) bool CanStartDrag(StartDragDropEvent args)
{ {
return true; return true;
} }
@@ -39,7 +39,7 @@ namespace Content.Shared.Interfaces.GameObjects.Components
/// True if target is a valid target to be dropped on by this component's /// True if target is a valid target to be dropped on by this component's
/// entity, false otherwise. /// entity, false otherwise.
/// </returns> /// </returns>
bool CanDrop(CanDropEventArgs args); bool CanDrop(CanDropEvent args);
/// <summary> /// <summary>
/// Invoked when this component's entity is being dropped on another. /// Invoked when this component's entity is being dropped on another.
@@ -52,73 +52,74 @@ namespace Content.Shared.Interfaces.GameObjects.Components
/// True if an interaction occurred and no further interaction should /// True if an interaction occurred and no further interaction should
/// be processed for this drop, false otherwise. /// be processed for this drop, false otherwise.
/// </returns> /// </returns>
bool Drop(DragDropEventArgs args) bool Drop(DragDropEvent args)
{ {
return false; return false;
} }
} }
public class StartDragDropEventArgs : EntityEventArgs public class StartDragDropEvent : EntityEventArgs
{ {
/// <summary> /// <summary>
/// Creates a new instance of <see cref="StartDragDropEventArgs"/>. /// Entity doing the drag and drop.
/// </summary>
/// <param name="user">The entity doing the drag and drop.</param>
/// <param name="dragged">The entity that is being dragged and dropped.</param>
public StartDragDropEventArgs(IEntity user, IEntity dragged)
{
User = user;
Dragged = dragged;
}
/// <summary>
/// The entity doing the drag and drop.
/// </summary> /// </summary>
public IEntity User { get; } public IEntity User { get; }
/// <summary> /// <summary>
/// The entity that is being dragged. /// Entity that is being dragged.
/// </summary> /// </summary>
public IEntity Dragged { get; } public IEntity Dragged { get; }
/// <summary>
/// Creates a new instance of <see cref="StartDragDropEvent"/>.
/// </summary>
/// <param name="user">The entity doing the drag and drop.</param>
/// <param name="dragged">The entity that is being dragged and dropped.</param>
public StartDragDropEvent(IEntity user, IEntity dragged)
{
User = user;
Dragged = dragged;
}
} }
public class CanDropEventArgs : StartDragDropEventArgs public class CanDropEvent : StartDragDropEvent
{ {
/// <summary> /// <summary>
/// Creates a new instance of <see cref="CanDropEventArgs"/>. /// The entity that <see cref="StartDragDropEvent.Dragged"/>
/// is being dropped onto.
/// </summary>
public IEntity Target { get; }
/// <summary>
/// Creates a new instance of <see cref="CanDropEvent"/>.
/// </summary> /// </summary>
/// <param name="user">The entity doing the drag and drop.</param> /// <param name="user">The entity doing the drag and drop.</param>
/// <param name="dragged">The entity that is being dragged and dropped.</param> /// <param name="dragged">The entity that is being dragged and dropped.</param>
/// <param name="target">The entity that <see cref="dropped"/> is being dropped onto.</param> /// <param name="target">The entity that <see cref="dropped"/> is being dropped onto.</param>
public CanDropEventArgs(IEntity user, IEntity dragged, IEntity target) : base(user, dragged) public CanDropEvent(IEntity user, IEntity dragged, IEntity target) : base(user, dragged)
{ {
Target = target; Target = target;
} }
/// <summary>
/// The entity that <see cref="StartDragDropEventArgs.Dragged"/>
/// is being dropped onto.
/// </summary>
public IEntity Target { get; }
} }
public class DragDropEventArgs : CanDropEventArgs public class DragDropEvent : CanDropEvent
{ {
/// <summary> /// <summary>
/// Creates a new instance of <see cref="DragDropEventArgs"/>. /// The location where <see cref="StartDragDropEvent.Dragged"/>
/// is being dropped.
/// </summary>
public EntityCoordinates DropLocation { get; }
/// <summary>
/// Creates a new instance of <see cref="DragDropEvent"/>.
/// </summary> /// </summary>
/// <param name="user">The entity doing the drag and drop.</param> /// <param name="user">The entity doing the drag and drop.</param>
/// <param name="dropLocation">The location where <see cref="dropped"/> is being dropped.</param> /// <param name="dropLocation">The location where <see cref="dropped"/> is being dropped.</param>
/// <param name="dragged">The entity that is being dragged and dropped.</param> /// <param name="dragged">The entity that is being dragged and dropped.</param>
/// <param name="target">The entity that <see cref="dropped"/> is being dropped onto.</param> /// <param name="target">The entity that <see cref="dropped"/> is being dropped onto.</param>
public DragDropEventArgs(IEntity user, EntityCoordinates dropLocation, IEntity dragged, IEntity target) : base(user, dragged, target) public DragDropEvent(IEntity user, EntityCoordinates dropLocation, IEntity dragged, IEntity target) : base(user, dragged, target)
{ {
DropLocation = dropLocation; DropLocation = dropLocation;
} }
/// <summary>
/// The location where <see cref="StartDragDropEventArgs.Dragged"/>
/// is being dropped.
/// </summary>
public EntityCoordinates DropLocation { get; }
} }
} }

View File

@@ -33,7 +33,7 @@ namespace Content.Shared.Interfaces.GameObjects.Components
/// Raised when an entity is dropped /// Raised when an entity is dropped
/// </summary> /// </summary>
[PublicAPI] [PublicAPI]
public class DroppedMessage : HandledEntityEventArgs public class DroppedEvent : HandledEntityEventArgs
{ {
/// <summary> /// <summary>
/// Entity that dropped the item. /// Entity that dropped the item.
@@ -50,7 +50,7 @@ namespace Content.Shared.Interfaces.GameObjects.Components
/// </summary> /// </summary>
public bool Intentional { get; } public bool Intentional { get; }
public DroppedMessage(IEntity user, IEntity dropped, bool intentional) public DroppedEvent(IEntity user, IEntity dropped, bool intentional)
{ {
User = user; User = user;
Dropped = dropped; Dropped = dropped;

View File

@@ -43,10 +43,10 @@ namespace Content.Shared.Interfaces.GameObjects.Components
} }
/// <summary> /// <summary>
/// Raised when equipping the entity in an inventory slot. /// Raised when equipping an entity in an inventory slot.
/// </summary> /// </summary>
[PublicAPI] [PublicAPI]
public class EquippedMessage : HandledEntityEventArgs public class EquippedEvent : HandledEntityEventArgs
{ {
/// <summary> /// <summary>
/// Entity that equipped the item. /// Entity that equipped the item.
@@ -59,11 +59,11 @@ namespace Content.Shared.Interfaces.GameObjects.Components
public IEntity Equipped { get; } public IEntity Equipped { get; }
/// <summary> /// <summary>
/// Slot where the item was placed. /// Slot that the item was placed into.
/// </summary> /// </summary>
public EquipmentSlotDefines.Slots Slot { get; } public EquipmentSlotDefines.Slots Slot { get; }
public EquippedMessage(IEntity user, IEntity equipped, EquipmentSlotDefines.Slots slot) public EquippedEvent(IEntity user, IEntity equipped, EquipmentSlotDefines.Slots slot)
{ {
User = user; User = user;
Equipped = equipped; Equipped = equipped;

View File

@@ -31,10 +31,10 @@ namespace Content.Shared.Interfaces.GameObjects.Components
} }
/// <summary> /// <summary>
/// Raised when putting the entity into a hand slot /// Raised when putting an entity into a hand slot
/// </summary> /// </summary>
[PublicAPI] [PublicAPI]
public class EquippedHandMessage : HandledEntityEventArgs public class EquippedHandEvent : HandledEntityEventArgs
{ {
/// <summary> /// <summary>
/// Entity that equipped the item. /// Entity that equipped the item.
@@ -47,11 +47,11 @@ namespace Content.Shared.Interfaces.GameObjects.Components
public IEntity Equipped { get; } public IEntity Equipped { get; }
/// <summary> /// <summary>
/// Hand the item is going into. /// Hand that the item was placed into.
/// </summary> /// </summary>
public SharedHand Hand { get; } public SharedHand Hand { get; }
public EquippedHandMessage(IEntity user, IEntity equipped, SharedHand hand) public EquippedHandEvent(IEntity user, IEntity equipped, SharedHand hand)
{ {
User = user; User = user;
Equipped = equipped; Equipped = equipped;

View File

@@ -30,7 +30,7 @@ namespace Content.Shared.Interfaces.GameObjects.Components
/// Raised when an entity item in a hand is deselected. /// Raised when an entity item in a hand is deselected.
/// </summary> /// </summary>
[PublicAPI] [PublicAPI]
public class HandDeselectedMessage : HandledEntityEventArgs public class HandDeselectedEvent : HandledEntityEventArgs
{ {
/// <summary> /// <summary>
/// Entity that owns the deselected hand. /// Entity that owns the deselected hand.
@@ -38,11 +38,11 @@ namespace Content.Shared.Interfaces.GameObjects.Components
public IEntity User { get; } public IEntity User { get; }
/// <summary> /// <summary>
/// The item in question. /// Item in the hand that was deselected.
/// </summary> /// </summary>
public IEntity Item { get; } public IEntity Item { get; }
public HandDeselectedMessage(IEntity user, IEntity item) public HandDeselectedEvent(IEntity user, IEntity item)
{ {
User = user; User = user;
Item = item; Item = item;

View File

@@ -27,10 +27,10 @@ namespace Content.Shared.Interfaces.GameObjects.Components
} }
/// <summary> /// <summary>
/// Raised when an entity item in a hand is selected. /// Raised when an item entity held by a hand is selected.
/// </summary> /// </summary>
[PublicAPI] [PublicAPI]
public class HandSelectedMessage : HandledEntityEventArgs public class HandSelectedEvent : HandledEntityEventArgs
{ {
/// <summary> /// <summary>
/// Entity that owns the selected hand. /// Entity that owns the selected hand.
@@ -38,11 +38,11 @@ namespace Content.Shared.Interfaces.GameObjects.Components
public IEntity User { get; } public IEntity User { get; }
/// <summary> /// <summary>
/// The item in question. /// Item in the hand that was selected.
/// </summary> /// </summary>
public IEntity Item { get; } public IEntity Item { get; }
public HandSelectedMessage(IEntity user, IEntity item) public HandSelectedEvent(IEntity user, IEntity item)
{ {
User = user; User = user;
Item = item; Item = item;

View File

@@ -31,27 +31,26 @@ namespace Content.Shared.Interfaces.GameObjects.Components
public IEntity Target { get; } public IEntity Target { get; }
} }
/// <summary> /// <summary>
/// Raised when being clicked on or "attacked" by a user with an empty hand. /// Raised when a target entity is interacted with by a user with an empty hand.
/// </summary> /// </summary>
[PublicAPI] [PublicAPI]
public class AttackHandMessage : HandledEntityEventArgs public class AttackHandEvent : HandledEntityEventArgs
{ {
/// <summary> /// <summary>
/// Entity that triggered the attack. /// Entity that triggered the interaction.
/// </summary> /// </summary>
public IEntity User { get; } public IEntity User { get; }
/// <summary> /// <summary>
/// Entity that was attacked. /// Entity that was interacted on.
/// </summary> /// </summary>
public IEntity Attacked { get; } public IEntity Target { get; }
public AttackHandMessage(IEntity user, IEntity attacked) public AttackHandEvent(IEntity user, IEntity target)
{ {
User = user; User = user;
Attacked = attacked; Target = target;
} }
} }
} }

View File

@@ -45,36 +45,36 @@ namespace Content.Shared.Interfaces.GameObjects.Components
} }
/// <summary> /// <summary>
/// Raised when being clicked on or "attacked" by a user with an object in their hand /// Raised when a target entity is interacted with by a user while holding an object in their hand.
/// </summary> /// </summary>
[PublicAPI] [PublicAPI]
public class InteractUsingMessage : HandledEntityEventArgs public class InteractUsingEvent : HandledEntityEventArgs
{ {
/// <summary> /// <summary>
/// Entity that triggered the attack. /// Entity that triggered the interaction.
/// </summary> /// </summary>
public IEntity User { get; } public IEntity User { get; }
/// <summary> /// <summary>
/// Entity that the User attacked with. /// Entity that the user used to interact.
/// </summary> /// </summary>
public IEntity ItemInHand { get; } public IEntity Used { get; }
/// <summary> /// <summary>
/// Entity that was attacked. /// Entity that was interacted on.
/// </summary> /// </summary>
public IEntity Attacked { get; } public IEntity Target { get; }
/// <summary> /// <summary>
/// The original location that was clicked by the user. /// The original location that was clicked by the user.
/// </summary> /// </summary>
public EntityCoordinates ClickLocation { get; } public EntityCoordinates ClickLocation { get; }
public InteractUsingMessage(IEntity user, IEntity itemInHand, IEntity attacked, EntityCoordinates clickLocation) public InteractUsingEvent(IEntity user, IEntity used, IEntity target, EntityCoordinates clickLocation)
{ {
User = user; User = user;
ItemInHand = itemInHand; Used = used;
Attacked = attacked; Target = target;
ClickLocation = clickLocation; ClickLocation = clickLocation;
} }
} }

View File

@@ -32,7 +32,7 @@ namespace Content.Shared.Interfaces.GameObjects.Components
/// Raised when an entity that was thrown lands. /// Raised when an entity that was thrown lands.
/// </summary> /// </summary>
[PublicAPI] [PublicAPI]
public class LandMessage : HandledEntityEventArgs public class LandEvent : HandledEntityEventArgs
{ {
/// <summary> /// <summary>
/// Entity that threw the item. /// Entity that threw the item.
@@ -49,7 +49,7 @@ namespace Content.Shared.Interfaces.GameObjects.Components
/// </summary> /// </summary>
public EntityCoordinates LandLocation { get; } public EntityCoordinates LandLocation { get; }
public LandMessage(IEntity? user, IEntity thrown, EntityCoordinates landLocation) public LandEvent(IEntity? user, IEntity thrown, EntityCoordinates landLocation)
{ {
User = user; User = user;
Thrown = thrown; Thrown = thrown;

View File

@@ -36,37 +36,37 @@ namespace Content.Shared.Interfaces.GameObjects.Components
} }
/// <summary> /// <summary>
/// Raised when being clicked by objects outside the range of direct use. /// Raised when an entity is interacted with that is out of the user entity's range of direct use.
/// </summary> /// </summary>
[PublicAPI] [PublicAPI]
public class RangedInteractMessage : HandledEntityEventArgs public class RangedInteractEvent : HandledEntityEventArgs
{ {
/// <summary> /// <summary>
/// Entity that triggered the attack. /// Entity that triggered the interaction.
/// </summary> /// </summary>
public IEntity User { get; } public IEntity User { get; }
/// <summary> /// <summary>
/// Entity that the User attacked with. /// Entity that the user used to interact.
/// </summary> /// </summary>
public IEntity ItemInHand { get; set; } public IEntity Used { get; }
/// <summary> /// <summary>
/// Entity that was attacked. /// Entity that was interacted on.
/// </summary> /// </summary>
public IEntity Attacked { get; } public IEntity Target { get; }
/// <summary> /// <summary>
/// Location that the user clicked outside of their interaction range. /// Location that the user clicked outside of their interaction range.
/// </summary> /// </summary>
public EntityCoordinates ClickLocation { get; } public EntityCoordinates ClickLocation { get; }
public RangedInteractMessage(IEntity user, IEntity itemInHand, IEntity attacked, EntityCoordinates clickLocation) public RangedInteractEvent(IEntity user, IEntity used, IEntity target, EntityCoordinates clickLocation)
{ {
User = user; User = user;
ItemInHand = itemInHand; Used = used;
Target = target;
ClickLocation = clickLocation; ClickLocation = clickLocation;
Attacked = attacked;
} }
} }
} }

View File

@@ -38,7 +38,7 @@ namespace Content.Shared.Interfaces.GameObjects.Components
} }
} }
public class ThrowCollideMessage : HandledEntityEventArgs public class ThrowCollideEvent : HandledEntityEventArgs
{ {
/// <summary> /// <summary>
/// The entity that threw <see cref="Thrown"/>. /// The entity that threw <see cref="Thrown"/>.
@@ -55,7 +55,7 @@ namespace Content.Shared.Interfaces.GameObjects.Components
/// </summary> /// </summary>
public IEntity Target { get; } public IEntity Target { get; }
public ThrowCollideMessage(IEntity? user, IEntity thrown, IEntity target) public ThrowCollideEvent(IEntity? user, IEntity thrown, IEntity target)
{ {
User = user; User = user;
Thrown = thrown; Thrown = thrown;

View File

@@ -30,7 +30,7 @@ namespace Content.Shared.Interfaces.GameObjects.Components
/// Raised when throwing the entity in your hands. /// Raised when throwing the entity in your hands.
/// </summary> /// </summary>
[PublicAPI] [PublicAPI]
public class ThrownMessage : HandledEntityEventArgs public class ThrownEvent : HandledEntityEventArgs
{ {
/// <summary> /// <summary>
/// Entity that threw the item. /// Entity that threw the item.
@@ -42,7 +42,7 @@ namespace Content.Shared.Interfaces.GameObjects.Components
/// </summary> /// </summary>
public IEntity Thrown { get; } public IEntity Thrown { get; }
public ThrownMessage(IEntity user, IEntity thrown) public ThrownEvent(IEntity user, IEntity thrown)
{ {
User = user; User = user;
Thrown = thrown; Thrown = thrown;

View File

@@ -33,10 +33,10 @@ namespace Content.Shared.Interfaces.GameObjects.Components
} }
/// <summary> /// <summary>
/// Raised when removing the entity from an inventory slot. /// Raised when removing an entity from an inventory slot.
/// </summary> /// </summary>
[PublicAPI] [PublicAPI]
public class UnequippedMessage : HandledEntityEventArgs public class UnequippedEvent : HandledEntityEventArgs
{ {
/// <summary> /// <summary>
/// Entity that equipped the item. /// Entity that equipped the item.
@@ -49,11 +49,11 @@ namespace Content.Shared.Interfaces.GameObjects.Components
public IEntity Unequipped { get; } public IEntity Unequipped { get; }
/// <summary> /// <summary>
/// Slot where the item was removed from. /// Slot that the item was removed from.
/// </summary> /// </summary>
public EquipmentSlotDefines.Slots Slot { get; } public EquipmentSlotDefines.Slots Slot { get; }
public UnequippedMessage(IEntity user, IEntity unequipped, EquipmentSlotDefines.Slots slot) public UnequippedEvent(IEntity user, IEntity unequipped, EquipmentSlotDefines.Slots slot)
{ {
User = user; User = user;
Unequipped = unequipped; Unequipped = unequipped;

View File

@@ -30,10 +30,10 @@ namespace Content.Shared.Interfaces.GameObjects.Components
} }
/// <summary> /// <summary>
/// Raised when removing the entity from an inventory slot. /// Raised when removing an entity from an inventory slot.
/// </summary> /// </summary>
[PublicAPI] [PublicAPI]
public class UnequippedHandMessage : HandledEntityEventArgs public class UnequippedHandEvent : HandledEntityEventArgs
{ {
/// <summary> /// <summary>
/// Entity that equipped the item. /// Entity that equipped the item.
@@ -46,11 +46,11 @@ namespace Content.Shared.Interfaces.GameObjects.Components
public IEntity Unequipped { get; } public IEntity Unequipped { get; }
/// <summary> /// <summary>
/// Hand the item is removed from. /// Hand that the item is removed from.
/// </summary> /// </summary>
public SharedHand Hand { get; } public SharedHand Hand { get; }
public UnequippedHandMessage(IEntity user, IEntity unequipped, SharedHand hand) public UnequippedHandEvent(IEntity user, IEntity unequipped, SharedHand hand)
{ {
User = user; User = user;
Unequipped = unequipped; Unequipped = unequipped;

View File

@@ -34,7 +34,7 @@ namespace Content.Shared.Interfaces.GameObjects.Components
/// Raised when using the entity in your hands. /// Raised when using the entity in your hands.
/// </summary> /// </summary>
[PublicAPI] [PublicAPI]
public class UseInHandMessage : HandledEntityEventArgs public class UseInHandEvent : HandledEntityEventArgs
{ {
/// <summary> /// <summary>
/// Entity holding the item in their hand. /// Entity holding the item in their hand.
@@ -46,7 +46,7 @@ namespace Content.Shared.Interfaces.GameObjects.Components
/// </summary> /// </summary>
public IEntity Used { get; } public IEntity Used { get; }
public UseInHandMessage(IEntity user, IEntity used) public UseInHandEvent(IEntity user, IEntity used)
{ {
User = user; User = user;
Used = used; Used = used;

View File

@@ -22,7 +22,7 @@ namespace Content.Shared.Kitchen
[DataField("sound")] [DataField("sound")]
protected string? SpikeSound = "/Audio/Effects/Fluids/splat.ogg"; protected string? SpikeSound = "/Audio/Effects/Fluids/splat.ogg";
bool IDragDropOn.CanDragDropOn(DragDropEventArgs eventArgs) bool IDragDropOn.CanDragDropOn(DragDropEvent eventArgs)
{ {
if (!eventArgs.Dragged.HasComponent<SharedButcherableComponent>()) if (!eventArgs.Dragged.HasComponent<SharedButcherableComponent>())
{ {
@@ -33,6 +33,6 @@ namespace Content.Shared.Kitchen
return true; return true;
} }
public abstract bool DragDropOn(DragDropEventArgs eventArgs); public abstract bool DragDropOn(DragDropEvent eventArgs);
} }
} }

View File

@@ -407,7 +407,7 @@ namespace Content.Shared.Utility
} }
public static bool InRangeUnobstructed( public static bool InRangeUnobstructed(
this DragDropEventArgs args, this DragDropEvent args,
float range = InteractionRange, float range = InteractionRange,
CollisionGroup collisionMask = CollisionGroup.Impassable, CollisionGroup collisionMask = CollisionGroup.Impassable,
Ignored? predicate = null, Ignored? predicate = null,
@@ -433,7 +433,7 @@ namespace Content.Shared.Utility
#region EntityEventArgs #region EntityEventArgs
public static bool InRangeUnobstructed( public static bool InRangeUnobstructed(
this AfterInteractMessage args, this AfterInteractEvent args,
float range = InteractionRange, float range = InteractionRange,
CollisionGroup collisionMask = CollisionGroup.Impassable, CollisionGroup collisionMask = CollisionGroup.Impassable,
Ignored? predicate = null, Ignored? predicate = null,

View File

@@ -353,7 +353,7 @@ namespace Content.Shared.Utility
} }
public static bool InRangeUnOccluded( public static bool InRangeUnOccluded(
this DragDropEventArgs args, this DragDropEvent args,
float range = InteractionRange, float range = InteractionRange,
Ignored? predicate = null, Ignored? predicate = null,
bool ignoreInsideBlocker = true) bool ignoreInsideBlocker = true)