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))]
public class BodyComponent : SharedBodyComponent, IDraggable
{
bool IDraggable.CanStartDrag(StartDragDropEventArgs args)
bool IDraggable.CanStartDrag(StartDragDropEvent args)
{
return true;
}
bool IDraggable.CanDrop(CanDropEventArgs args)
bool IDraggable.CanDrop(CanDropEvent args)
{
return true;
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -9,7 +9,7 @@ namespace Content.Client.GameObjects.Components.Movement
[ComponentReference(typeof(IClimbable))]
public class ClimbableComponent : SharedClimbableComponent
{
public override bool CanDragDropOn(DragDropEventArgs eventArgs)
public override bool CanDragDropOn(DragDropEvent eventArgs)
{
if (!base.CanDragDropOn(eventArgs))
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);
}
public override bool DragDropOn(DragDropEventArgs eventArgs)
public override bool DragDropOn(DragDropEvent eventArgs)
{
return false;
}

View File

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

View File

@@ -145,7 +145,7 @@ namespace Content.Client.GameObjects.EntitySystems
var canDrag = false;
foreach (var draggable in entity.GetAllComponents<IDraggable>())
{
var dragEventArgs = new StartDragDropEventArgs(dragger, entity);
var dragEventArgs = new StartDragDropEvent(dragger, entity);
if (!draggable.CanStartDrag(dragEventArgs))
{
@@ -315,7 +315,7 @@ namespace Content.Client.GameObjects.EntitySystems
if (entity == _dragDropHelper.Dragged) continue;
// 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
if (ValidDragDrop(dropArgs) != true) continue;
@@ -331,7 +331,7 @@ namespace Content.Client.GameObjects.EntitySystems
if (!draggable.CanDrop(dropArgs)) continue;
// 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));
draggable.Drop(dropArgs);
@@ -380,7 +380,7 @@ namespace Content.Client.GameObjects.EntitySystems
pvsEntity == _dragDropHelper.Dragged) continue;
// 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);
if (valid == null) continue;
@@ -414,7 +414,7 @@ namespace Content.Client.GameObjects.EntitySystems
/// </summary>
/// <param name="eventArgs"></param>
/// <returns>null if the target doesn't support IDragDropOn</returns>
private bool? ValidDragDrop(DragDropEventArgs eventArgs)
private bool? ValidDragDrop(DragDropEvent eventArgs)
{
bool? valid = null;

View File

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

View File

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

View File

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

View File

@@ -616,14 +616,14 @@ namespace Content.Server.GameObjects.Components.Disposal
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
// If that changes then update this
return CanInsert(eventArgs.Dragged);
}
public override bool DragDropOn(DragDropEventArgs eventArgs)
public override bool DragDropOn(DragDropEvent eventArgs)
{
_ = TryInsert(eventArgs.Dragged, eventArgs.User);
return true;

View File

@@ -74,7 +74,7 @@ namespace Content.Server.GameObjects.Components.GUI
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;

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);
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);
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))
return false;
@@ -132,7 +132,7 @@ namespace Content.Server.GameObjects.Components.Movement
return true;
}
public override bool DragDropOn(DragDropEventArgs eventArgs)
public override bool DragDropOn(DragDropEvent eventArgs)
{
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;
return buckleComponent.TryBuckle(eventArgs.User, Owner);

View File

@@ -43,7 +43,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
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)
{

View File

@@ -66,12 +66,12 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
[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;
}
bool IAttack.WideAttack(AttackEventArgs eventArgs)
bool IAttack.WideAttack(AttackEvent eventArgs)
{
if (!eventArgs.WideAttack) return true;
@@ -126,7 +126,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
return true;
}
bool IAttack.ClickAttack(AttackEventArgs eventArgs)
bool IAttack.ClickAttack(AttackEvent eventArgs)
{
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)
return true;

View File

@@ -24,7 +24,7 @@ namespace Content.Server.GameObjects.EntitySystems
SubscribeLocalEvent<EntInsertedIntoContainerMessage>(ContainerModified);
SubscribeLocalEvent<EntRemovedFromContainerMessage>(ContainerModified);
SubscribeLocalEvent<BuckleComponent, AttackHandMessage>(HandleAttackHand);
SubscribeLocalEvent<BuckleComponent, AttackHandEvent>(HandleAttackHand);
}
public override void Shutdown()
@@ -35,10 +35,10 @@ namespace Content.Server.GameObjects.EntitySystems
UnsubscribeLocalEvent<EntInsertedIntoContainerMessage>();
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);
}

View File

@@ -41,7 +41,7 @@ namespace Content.Server.GameObjects.EntitySystems.Click
public override void Initialize()
{
SubscribeNetworkEvent<DragDropMessage>(HandleDragDropMessage);
SubscribeNetworkEvent<DragDropRequestEvent>(HandleDragDropMessage);
CommandBinds.Builder
.Bind(EngineKeyFunctions.Use,
@@ -60,7 +60,7 @@ namespace Content.Server.GameObjects.EntitySystems.Click
base.Shutdown();
}
private void HandleDragDropMessage(DragDropMessage msg, EntitySessionEventArgs args)
private void HandleDragDropMessage(DragDropRequestEvent msg, EntitySessionEventArgs args)
{
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.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
// 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)
{
var activateMsg = new ActivateInWorldMessage(user, used);
var activateMsg = new ActivateInWorldEvent(user, used);
RaiseLocalEvent(used.Uid, activateMsg);
if (activateMsg.Handled)
{
@@ -404,7 +404,7 @@ namespace Content.Server.GameObjects.EntitySystems.Click
/// </summary>
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);
if (message.Handled)
{
@@ -421,7 +421,7 @@ namespace Content.Server.GameObjects.EntitySystems.Click
/// </summary>
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);
if (attackMsg.Handled)
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);
if (afterAtkMsg.Handled)
{
@@ -461,7 +461,7 @@ namespace Content.Server.GameObjects.EntitySystems.Click
/// </summary>
public void Interaction(IEntity user, IEntity attacked)
{
var message = new AttackHandMessage(user, attacked);
var message = new AttackHandEvent(user, attacked);
RaiseLocalEvent(attacked.Uid, message);
if (message.Handled)
return;
@@ -514,7 +514,7 @@ namespace Content.Server.GameObjects.EntitySystems.Click
delayComponent.BeginDelay();
}
var useMsg = new UseInHandMessage(user, used);
var useMsg = new UseInHandEvent(user, used);
RaiseLocalEvent(used.Uid, useMsg);
if (useMsg.Handled)
{
@@ -552,7 +552,7 @@ namespace Content.Server.GameObjects.EntitySystems.Click
/// </summary>
public void ThrownInteraction(IEntity user, IEntity thrown)
{
var throwMsg = new ThrownMessage(user, thrown);
var throwMsg = new ThrownEvent(user, thrown);
RaiseLocalEvent(thrown.Uid, throwMsg);
if (throwMsg.Handled)
{
@@ -575,7 +575,7 @@ namespace Content.Server.GameObjects.EntitySystems.Click
/// </summary>
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);
if (equipMsg.Handled)
{
@@ -597,7 +597,7 @@ namespace Content.Server.GameObjects.EntitySystems.Click
/// </summary>
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);
if (unequipMsg.Handled)
{
@@ -619,7 +619,7 @@ namespace Content.Server.GameObjects.EntitySystems.Click
/// </summary>
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);
if (equippedHandMessage.Handled)
{
@@ -640,7 +640,7 @@ namespace Content.Server.GameObjects.EntitySystems.Click
/// </summary>
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);
if (unequippedHandMessage.Handled)
{
@@ -673,7 +673,7 @@ namespace Content.Server.GameObjects.EntitySystems.Click
/// </summary>
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);
if (dropMsg.Handled)
{
@@ -697,7 +697,7 @@ namespace Content.Server.GameObjects.EntitySystems.Click
/// </summary>
public void HandSelectedInteraction(IEntity user, IEntity item)
{
var handSelectedMsg = new HandSelectedMessage(user, item);
var handSelectedMsg = new HandSelectedEvent(user, item);
RaiseLocalEvent(item.Uid, handSelectedMsg);
if (handSelectedMsg.Handled)
{
@@ -719,7 +719,7 @@ namespace Content.Server.GameObjects.EntitySystems.Click
/// </summary>
public void HandDeselectedInteraction(IEntity user, IEntity item)
{
var handDeselectedMsg = new HandDeselectedMessage(user, item);
var handDeselectedMsg = new HandDeselectedEvent(user, item);
RaiseLocalEvent(item.Uid, handDeselectedMsg);
if (handDeselectedMsg.Handled)
{
@@ -741,7 +741,7 @@ namespace Content.Server.GameObjects.EntitySystems.Click
/// </summary>
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);
if (rangedMsg.Handled)
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);
if (afterAtkMsg.Handled)
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
if (player.TryGetComponent<IHandsComponent>(out var hands))

View File

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

View File

@@ -18,21 +18,21 @@ namespace Content.Server.GameObjects.EntitySystems
{
base.Initialize();
SubscribeLocalEvent<DisassembleOnActivateComponent, ActivateInWorldMessage>(HandleActivateInWorld);
SubscribeLocalEvent<DisassembleOnActivateComponent, ActivateInWorldEvent>(HandleActivateInWorld);
}
public override void 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))
return;
if (!args.User.InRangeUnobstructed(args.Activated))
if (!args.User.InRangeUnobstructed(args.Target))
return;
if (component.DoAfterTime > 0 && TryGet<DoAfterSystem>(out var doAfterSystem))

View File

@@ -17,48 +17,48 @@ namespace Content.Server.GameObjects.EntitySystems.Janitorial
{
base.Initialize();
SubscribeLocalEvent<LightReplacerComponent, InteractUsingMessage>(HandleInteract);
SubscribeLocalEvent<LightReplacerComponent, AfterInteractMessage>(HandleAfterInteract);
SubscribeLocalEvent<LightReplacerComponent, InteractUsingEvent>(HandleInteract);
SubscribeLocalEvent<LightReplacerComponent, AfterInteractEvent>(HandleAfterInteract);
}
public override void Shutdown()
{
base.Shutdown();
UnsubscribeLocalEvent<LightReplacerComponent, InteractUsingMessage>(HandleInteract);
UnsubscribeLocalEvent<LightReplacerComponent, AfterInteractMessage>(HandleAfterInteract);
UnsubscribeLocalEvent<LightReplacerComponent, InteractUsingEvent>(HandleInteract);
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
if (!ActionBlockerSystem.CanUse(eventArgs.User)) return;
if (!eventArgs.CanReach) return;
// behaviour will depends on target type
if (eventArgs.Attacked != null)
if (eventArgs.Target != null)
{
// replace broken light in fixture?
if (eventArgs.Attacked.TryGetComponent(out PoweredLightComponent? fixture))
if (eventArgs.Target.TryGetComponent(out PoweredLightComponent? fixture))
component.TryReplaceBulb(fixture, eventArgs.User);
// 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);
}
}
private void HandleInteract(EntityUid uid, LightReplacerComponent component, InteractUsingMessage eventArgs)
private void HandleInteract(EntityUid uid, LightReplacerComponent component, InteractUsingEvent eventArgs)
{
// standard interaction checks
if (!ActionBlockerSystem.CanInteract(eventArgs.User)) return;
if (eventArgs.ItemInHand != null)
if (eventArgs.Used != null)
{
// 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);
// 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);
}
}

View File

@@ -21,17 +21,17 @@ namespace Content.Server.GameObjects.EntitySystems
{
base.Initialize();
SubscribeLocalEvent<SpawnAfterInteractComponent, AfterInteractMessage>(HandleAfterInteract);
SubscribeLocalEvent<SpawnAfterInteractComponent, AfterInteractEvent>(HandleAfterInteract);
}
public override void 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))
return;

View File

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

View File

@@ -187,11 +187,11 @@ namespace Content.Shared.GameObjects.Components.Disposal
return true;
}
public virtual bool CanDragDropOn(DragDropEventArgs eventArgs)
public virtual bool CanDragDropOn(DragDropEvent eventArgs)
{
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);
}
bool IDraggable.CanDrop(CanDropEventArgs args)
bool IDraggable.CanDrop(CanDropEvent args)
{
return args.Target != args.Dragged
&& args.Target == args.User
&& CanBeStripped(args.User);
}
public abstract bool Drop(DragDropEventArgs args);
public abstract bool Drop(DragDropEvent args);
[NetSerializable, Serializable]
public enum StrippingUiKey

View File

@@ -12,13 +12,13 @@ namespace Content.Shared.GameObjects.Components.GUI
{
public override string Name => "Stripping";
bool IDragDropOn.CanDragDropOn(DragDropEventArgs eventArgs)
bool IDragDropOn.CanDragDropOn(DragDropEvent eventArgs)
{
if (!eventArgs.Dragged.TryGetComponent(out SharedStrippableComponent? strippable)) return false;
return strippable.CanBeStripped(Owner);
}
bool IDragDropOn.DragDropOn(DragDropEventArgs eventArgs)
bool IDragDropOn.DragDropOn(DragDropEvent eventArgs)
{
// Handled by StrippableComponent
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>();
}
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>
[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>();
}
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")]
private string? _meatPrototype;
public bool CanDrop(CanDropEventArgs args)
public bool CanDrop(CanDropEvent args)
{
return true;
}

View File

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

View File

@@ -32,7 +32,7 @@ namespace Content.Shared.GameObjects.Components.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;
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);
}
public abstract bool DragDropOn(DragDropEventArgs eventArgs);
public abstract bool DragDropOn(DragDropEvent eventArgs);
}
[Serializable, NetSerializable]

View File

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

View File

@@ -148,7 +148,7 @@ namespace Content.Shared.GameObjects.EntitySystems
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 otherPos = args.DropLocation.ToMap(args.User.EntityManager);

View File

@@ -417,7 +417,7 @@ namespace Content.Shared.GameObjects.EntitySystems
}
/// <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
/// that matches the collision mask obstructing them.
/// 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.
/// </returns>
public bool InRangeUnobstructed(
DragDropEventArgs args,
DragDropEvent args,
float range = InteractionRange,
CollisionGroup collisionMask = CollisionGroup.Impassable,
Ignored? predicate = null,
@@ -544,7 +544,7 @@ namespace Content.Shared.GameObjects.EntitySystems
/// <summary>
/// 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.
/// If the <paramref name="range"/> is zero or negative,
/// 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.
/// </returns>
public bool InRangeUnobstructed(
AfterInteractMessage args,
AfterInteractEvent args,
float range = InteractionRange,
CollisionGroup collisionMask = CollisionGroup.Impassable,
Ignored? predicate = null,
@@ -582,7 +582,7 @@ namespace Content.Shared.GameObjects.EntitySystems
bool popup = false)
{
var user = args.User;
var target = args.Attacked;
var target = args.Target;
predicate ??= e => e == user;
MapCoordinates otherPosition;

View File

@@ -38,7 +38,7 @@ namespace Content.Shared.GameObjects.EntitySystems
// LandInteraction
// TODO: Refactor these to system messages
var landMsg = new LandMessage(user, landing, coordinates);
var landMsg = new LandEvent(user, landing, coordinates);
RaiseLocalEvent(landMsg);
if (landMsg.Handled)
{
@@ -65,7 +65,7 @@ namespace Content.Shared.GameObjects.EntitySystems
public void ThrowCollideInteraction(IEntity? user, IPhysBody thrown, IPhysBody target)
{
// 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);
if (collideMsg.Handled)
{

View File

@@ -38,22 +38,22 @@ namespace Content.Shared.Interfaces.GameObjects.Components
/// Raised when an entity is activated in the world.
/// </summary>
[PublicAPI]
public class ActivateInWorldMessage : HandledEntityEventArgs
public class ActivateInWorldEvent : HandledEntityEventArgs
{
/// <summary>
/// Entity that activated the world entity.
/// Entity that activated the target world entity.
/// </summary>
public IEntity User { get; }
/// <summary>
/// Entity that was activated in the world.
/// </summary>
public IEntity Activated { get; }
public IEntity Target { get; }
public ActivateInWorldMessage(IEntity user, IEntity activated)
public ActivateInWorldEvent(IEntity user, IEntity target)
{
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.
/// </summary>
[PublicAPI]
public class AfterInteractMessage : HandledEntityEventArgs
public class AfterInteractEvent : HandledEntityEventArgs
{
/// <summary>
/// Entity that triggered the attack.
/// Entity that triggered the interaction.
/// </summary>
public IEntity User { get; }
/// <summary>
/// Entity that the User attacked with.
/// Entity that the user used to interact.
/// </summary>
public IEntity ItemInHand { get; set; }
public IEntity Used { get; }
/// <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>
public IEntity? Attacked { get; }
public IEntity? Target { get; }
/// <summary>
/// Location that the user clicked outside of their interaction range.
@@ -79,13 +79,13 @@ namespace Content.Shared.Interfaces.GameObjects.Components
/// </summary>
public bool CanReach { get; }
public AfterInteractMessage(IEntity user, IEntity itemInHand, IEntity? attacked,
public AfterInteractEvent(IEntity user, IEntity used, IEntity? target,
EntityCoordinates clickLocation, bool canReach)
{
User = user;
Attacked = attacked;
Used = used;
Target = target;
ClickLocation = clickLocation;
ItemInHand = itemInHand;
CanReach = canReach;
}
}

View File

@@ -15,15 +15,43 @@ namespace Content.Shared.Interfaces.GameObjects.Components
{
// Redirects to ClickAttack by default.
[Obsolete("WideAttack")]
bool WideAttack(AttackEventArgs eventArgs) => ClickAttack(eventArgs);
bool WideAttack(AttackEvent eventArgs) => ClickAttack(eventArgs);
[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;
ClickLocation = clickLocation;
@@ -33,11 +61,5 @@ namespace Content.Shared.Interfaces.GameObjects.Components
IoCManager.Resolve<IEntityManager>().TryGetEntity(Target, out var 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>
/// <param name="eventArgs"></param>
/// <returns>true if <see cref="eventArgs"/> is valid, false otherwise.</returns>
bool CanDragDropOn(DragDropEventArgs eventArgs);
bool CanDragDropOn(DragDropEvent eventArgs);
/// <summary>
/// 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
/// be processed for this drop.
/// </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.
/// </param>
/// <returns>True if the drag should be initiated, false otherwise.</returns>
bool CanStartDrag(StartDragDropEventArgs args)
bool CanStartDrag(StartDragDropEvent args)
{
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
/// entity, false otherwise.
/// </returns>
bool CanDrop(CanDropEventArgs args);
bool CanDrop(CanDropEvent args);
/// <summary>
/// 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
/// be processed for this drop, false otherwise.
/// </returns>
bool Drop(DragDropEventArgs args)
bool Drop(DragDropEvent args)
{
return false;
}
}
public class StartDragDropEventArgs : EntityEventArgs
public class StartDragDropEvent : EntityEventArgs
{
/// <summary>
/// Creates a new instance of <see cref="StartDragDropEventArgs"/>.
/// </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.
/// Entity doing the drag and drop.
/// </summary>
public IEntity User { get; }
/// <summary>
/// The entity that is being dragged.
/// Entity that is being dragged.
/// </summary>
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>
/// 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>
/// <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="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;
}
/// <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>
/// 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>
/// <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="dragged">The entity that is being dragged and dropped.</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;
}
/// <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
/// </summary>
[PublicAPI]
public class DroppedMessage : HandledEntityEventArgs
public class DroppedEvent : HandledEntityEventArgs
{
/// <summary>
/// Entity that dropped the item.
@@ -50,7 +50,7 @@ namespace Content.Shared.Interfaces.GameObjects.Components
/// </summary>
public bool Intentional { get; }
public DroppedMessage(IEntity user, IEntity dropped, bool intentional)
public DroppedEvent(IEntity user, IEntity dropped, bool intentional)
{
User = user;
Dropped = dropped;

View File

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

View File

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

View File

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

View File

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

View File

@@ -31,27 +31,26 @@ namespace Content.Shared.Interfaces.GameObjects.Components
public IEntity Target { get; }
}
/// <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>
[PublicAPI]
public class AttackHandMessage : HandledEntityEventArgs
public class AttackHandEvent : HandledEntityEventArgs
{
/// <summary>
/// Entity that triggered the attack.
/// Entity that triggered the interaction.
/// </summary>
public IEntity User { get; }
/// <summary>
/// Entity that was attacked.
/// Entity that was interacted on.
/// </summary>
public IEntity Attacked { get; }
public IEntity Target { get; }
public AttackHandMessage(IEntity user, IEntity attacked)
public AttackHandEvent(IEntity user, IEntity target)
{
User = user;
Attacked = attacked;
Target = target;
}
}
}

View File

@@ -45,36 +45,36 @@ namespace Content.Shared.Interfaces.GameObjects.Components
}
/// <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>
[PublicAPI]
public class InteractUsingMessage : HandledEntityEventArgs
public class InteractUsingEvent : HandledEntityEventArgs
{
/// <summary>
/// Entity that triggered the attack.
/// Entity that triggered the interaction.
/// </summary>
public IEntity User { get; }
/// <summary>
/// Entity that the User attacked with.
/// Entity that the user used to interact.
/// </summary>
public IEntity ItemInHand { get; }
public IEntity Used { get; }
/// <summary>
/// Entity that was attacked.
/// Entity that was interacted on.
/// </summary>
public IEntity Attacked { get; }
public IEntity Target { get; }
/// <summary>
/// The original location that was clicked by the user.
/// </summary>
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;
ItemInHand = itemInHand;
Attacked = attacked;
Used = used;
Target = target;
ClickLocation = clickLocation;
}
}

View File

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

View File

@@ -36,37 +36,37 @@ namespace Content.Shared.Interfaces.GameObjects.Components
}
/// <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>
[PublicAPI]
public class RangedInteractMessage : HandledEntityEventArgs
public class RangedInteractEvent : HandledEntityEventArgs
{
/// <summary>
/// Entity that triggered the attack.
/// Entity that triggered the interaction.
/// </summary>
public IEntity User { get; }
/// <summary>
/// Entity that the User attacked with.
/// Entity that the user used to interact.
/// </summary>
public IEntity ItemInHand { get; set; }
public IEntity Used { get; }
/// <summary>
/// Entity that was attacked.
/// Entity that was interacted on.
/// </summary>
public IEntity Attacked { get; }
public IEntity Target { get; }
/// <summary>
/// Location that the user clicked outside of their interaction range.
/// </summary>
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;
ItemInHand = itemInHand;
Used = used;
Target = target;
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>
/// The entity that threw <see cref="Thrown"/>.
@@ -55,7 +55,7 @@ namespace Content.Shared.Interfaces.GameObjects.Components
/// </summary>
public IEntity Target { get; }
public ThrowCollideMessage(IEntity? user, IEntity thrown, IEntity target)
public ThrowCollideEvent(IEntity? user, IEntity thrown, IEntity target)
{
User = user;
Thrown = thrown;

View File

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

View File

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

View File

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

View File

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

View File

@@ -22,7 +22,7 @@ namespace Content.Shared.Kitchen
[DataField("sound")]
protected string? SpikeSound = "/Audio/Effects/Fluids/splat.ogg";
bool IDragDropOn.CanDragDropOn(DragDropEventArgs eventArgs)
bool IDragDropOn.CanDragDropOn(DragDropEvent eventArgs)
{
if (!eventArgs.Dragged.HasComponent<SharedButcherableComponent>())
{
@@ -33,6 +33,6 @@ namespace Content.Shared.Kitchen
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(
this DragDropEventArgs args,
this DragDropEvent args,
float range = InteractionRange,
CollisionGroup collisionMask = CollisionGroup.Impassable,
Ignored? predicate = null,
@@ -433,7 +433,7 @@ namespace Content.Shared.Utility
#region EntityEventArgs
public static bool InRangeUnobstructed(
this AfterInteractMessage args,
this AfterInteractEvent args,
float range = InteractionRange,
CollisionGroup collisionMask = CollisionGroup.Impassable,
Ignored? predicate = null,

View File

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