diff --git a/Content.Server/GameObjects/Components/Chemistry/InjectorComponent.cs b/Content.Server/GameObjects/Components/Chemistry/InjectorComponent.cs index 7fecdc0e45..aa3fa3ea7b 100644 --- a/Content.Server/GameObjects/Components/Chemistry/InjectorComponent.cs +++ b/Content.Server/GameObjects/Components/Chemistry/InjectorComponent.cs @@ -20,7 +20,7 @@ namespace Content.Server.GameObjects.Components.Chemistry /// containers, and can directly inject into a mobs bloodstream. /// [RegisterComponent] - public class InjectorComponent : SharedInjectorComponent, IAfterAttack, IUse + public class InjectorComponent : SharedInjectorComponent, IAfterInteract, IUse { #pragma warning disable 649 [Dependency] private readonly IServerNotifyManager _notifyManager; @@ -109,17 +109,17 @@ namespace Content.Server.GameObjects.Components.Chemistry /// Called when clicking on entities while holding in active hand /// /// - void IAfterAttack.AfterAttack(AfterAttackEventArgs eventArgs) + void IAfterInteract.AfterInteract(AfterInteractEventArgs eventArgs) { if (!InteractionChecks.InRangeUnobstructed(eventArgs)) return; //Make sure we have the attacking entity - if (eventArgs.Attacked == null || !_internalContents.Injector) + if (eventArgs.Target == null || !_internalContents.Injector) { return; } - var targetEntity = eventArgs.Attacked; + var targetEntity = eventArgs.Target; //Handle injecting/drawing for solutions if (targetEntity.TryGetComponent(out var targetSolution) && targetSolution.Injectable) { diff --git a/Content.Server/GameObjects/Components/Chemistry/PourableComponent.cs b/Content.Server/GameObjects/Components/Chemistry/PourableComponent.cs index f36ff18ffc..8c72596fc9 100644 --- a/Content.Server/GameObjects/Components/Chemistry/PourableComponent.cs +++ b/Content.Server/GameObjects/Components/Chemistry/PourableComponent.cs @@ -23,7 +23,7 @@ namespace Content.Server.GameObjects.Components.Chemistry /// (DrinkComponent adds a SolutionComponent if one isn't present). /// [RegisterComponent] - class PourableComponent : Component, IAttackBy + class PourableComponent : Component, IInteractUsing { #pragma warning disable 649 [Dependency] private readonly IServerNotifyManager _notifyManager; @@ -58,7 +58,7 @@ namespace Content.Server.GameObjects.Components.Chemistry /// /// Attack event args /// - bool IAttackBy.AttackBy(AttackByEventArgs eventArgs) + bool IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs) { //Get target and check if it can be poured into if (!Owner.TryGetComponent(out var targetSolution)) @@ -67,7 +67,7 @@ namespace Content.Server.GameObjects.Components.Chemistry return false; //Get attack entity and check if it can pour out. - var attackEntity = eventArgs.AttackWith; + var attackEntity = eventArgs.Using; if (!attackEntity.TryGetComponent(out var attackSolution) || !attackSolution.CanPourOut) return false; if (!attackEntity.TryGetComponent(out var attackPourable)) diff --git a/Content.Server/GameObjects/Components/Chemistry/ReagentDispenserComponent.cs b/Content.Server/GameObjects/Components/Chemistry/ReagentDispenserComponent.cs index 39584973fd..4d3dbf9dfd 100644 --- a/Content.Server/GameObjects/Components/Chemistry/ReagentDispenserComponent.cs +++ b/Content.Server/GameObjects/Components/Chemistry/ReagentDispenserComponent.cs @@ -30,8 +30,8 @@ namespace Content.Server.GameObjects.Components.Chemistry /// [RegisterComponent] [ComponentReference(typeof(IActivate))] - [ComponentReference(typeof(IAttackBy))] - public class ReagentDispenserComponent : SharedReagentDispenserComponent, IActivate, IAttackBy, ISolutionChange + [ComponentReference(typeof(IInteractUsing))] + public class ReagentDispenserComponent : SharedReagentDispenserComponent, IActivate, IInteractUsing, ISolutionChange { #pragma warning disable 649 [Dependency] private readonly IServerNotifyManager _notifyManager; @@ -278,7 +278,7 @@ namespace Content.Server.GameObjects.Components.Chemistry /// /// Data relevant to the event such as the actor which triggered it. /// - bool IAttackBy.AttackBy(AttackByEventArgs args) + bool IInteractUsing.InteractUsing(InteractUsingEventArgs args) { if (!args.User.TryGetComponent(out IHandsComponent hands)) { diff --git a/Content.Server/GameObjects/Components/Construction/ConstructionComponent.cs b/Content.Server/GameObjects/Components/Construction/ConstructionComponent.cs index 146dabeaf8..291247dbbf 100644 --- a/Content.Server/GameObjects/Components/Construction/ConstructionComponent.cs +++ b/Content.Server/GameObjects/Components/Construction/ConstructionComponent.cs @@ -26,7 +26,7 @@ using Robust.Shared.Utility; namespace Content.Server.GameObjects.Components.Construction { [RegisterComponent] - public class ConstructionComponent : Component, IAttackBy + public class ConstructionComponent : Component, IInteractUsing { public override string Name => "Construction"; @@ -52,7 +52,7 @@ namespace Content.Server.GameObjects.Components.Construction Transform = Owner.GetComponent(); } - public bool AttackBy(AttackByEventArgs eventArgs) + public bool InteractUsing(InteractUsingEventArgs eventArgs) { // default interaction check for AttackBy allows inside blockers, so we will check if its blocked if // we're not allowed to build on impassable stuff @@ -64,7 +64,7 @@ namespace Content.Server.GameObjects.Components.Construction var stage = Prototype.Stages[Stage]; - if (TryProcessStep(stage.Forward, eventArgs.AttackWith)) + if (TryProcessStep(stage.Forward, eventArgs.Using)) { Stage++; if (Stage == Prototype.Stages.Count - 1) @@ -84,7 +84,7 @@ namespace Content.Server.GameObjects.Components.Construction } } - else if (TryProcessStep(stage.Backward, eventArgs.AttackWith)) + else if (TryProcessStep(stage.Backward, eventArgs.Using)) { Stage--; if (Stage == 0) diff --git a/Content.Server/GameObjects/Components/Doors/AirlockComponent.cs b/Content.Server/GameObjects/Components/Doors/AirlockComponent.cs index e917422964..12c763728a 100644 --- a/Content.Server/GameObjects/Components/Doors/AirlockComponent.cs +++ b/Content.Server/GameObjects/Components/Doors/AirlockComponent.cs @@ -20,7 +20,7 @@ namespace Content.Server.GameObjects.Components.Doors [RegisterComponent] [ComponentReference(typeof(IActivate))] [ComponentReference(typeof(ServerDoorComponent))] - public class AirlockComponent : ServerDoorComponent, IWires, IAttackBy + public class AirlockComponent : ServerDoorComponent, IWires, IInteractUsing { public override string Name => "Airlock"; @@ -199,9 +199,9 @@ namespace Content.Server.GameObjects.Components.Doors return _powerDevice.Powered; } - public bool AttackBy(AttackByEventArgs eventArgs) + public bool InteractUsing(InteractUsingEventArgs eventArgs) { - if (eventArgs.AttackWith.HasComponent()) + if (eventArgs.Using.HasComponent()) { if (IsPowered()) { diff --git a/Content.Server/GameObjects/Components/Fluids/BucketComponent.cs b/Content.Server/GameObjects/Components/Fluids/BucketComponent.cs index 6a0b47d9b8..39fd272166 100644 --- a/Content.Server/GameObjects/Components/Fluids/BucketComponent.cs +++ b/Content.Server/GameObjects/Components/Fluids/BucketComponent.cs @@ -16,7 +16,7 @@ namespace Content.Server.GameObjects.Components.Fluids /// Can a mop click on this entity and dump its fluids /// [RegisterComponent] - public class BucketComponent : Component, IAttackBy + public class BucketComponent : Component, IInteractUsing { #pragma warning disable 649 [Dependency] private readonly ILocalizationManager _localizationManager; @@ -71,9 +71,9 @@ namespace Content.Server.GameObjects.Components.Fluids return true; } - public bool AttackBy(AttackByEventArgs eventArgs) + public bool InteractUsing(InteractUsingEventArgs eventArgs) { - if (!eventArgs.AttackWith.TryGetComponent(out MopComponent mopComponent)) + if (!eventArgs.Using.TryGetComponent(out MopComponent mopComponent)) { return false; } diff --git a/Content.Server/GameObjects/Components/Fluids/MopComponent.cs b/Content.Server/GameObjects/Components/Fluids/MopComponent.cs index 4a374c0ac4..e84fe79aac 100644 --- a/Content.Server/GameObjects/Components/Fluids/MopComponent.cs +++ b/Content.Server/GameObjects/Components/Fluids/MopComponent.cs @@ -16,7 +16,7 @@ namespace Content.Server.GameObjects.Components.Fluids /// For cleaning up puddles /// [RegisterComponent] - public class MopComponent : Component, IAfterAttack + public class MopComponent : Component, IAfterInteract { #pragma warning disable 649 [Dependency] private readonly ILocalizationManager _localizationManager; @@ -58,12 +58,12 @@ namespace Content.Server.GameObjects.Components.Fluids } - void IAfterAttack.AfterAttack(AfterAttackEventArgs eventArgs) + void IAfterInteract.AfterInteract(AfterInteractEventArgs eventArgs) { if (!InteractionChecks.InRangeUnobstructed(eventArgs)) return; Solution solution; - if (eventArgs.Attacked == null) + if (eventArgs.Target == null) { if (CurrentVolume <= 0) { @@ -77,7 +77,7 @@ namespace Content.Server.GameObjects.Components.Fluids return; } - if (!eventArgs.Attacked.TryGetComponent(out PuddleComponent puddleComponent)) + if (!eventArgs.Target.TryGetComponent(out PuddleComponent puddleComponent)) { return; } diff --git a/Content.Server/GameObjects/Components/Gravity/GravityGeneratorComponent.cs b/Content.Server/GameObjects/Components/Gravity/GravityGeneratorComponent.cs index d1a01ef345..d2d43e6d9d 100644 --- a/Content.Server/GameObjects/Components/Gravity/GravityGeneratorComponent.cs +++ b/Content.Server/GameObjects/Components/Gravity/GravityGeneratorComponent.cs @@ -22,7 +22,7 @@ using Robust.Shared.Utility; namespace Content.Server.GameObjects.Components.Gravity { [RegisterComponent] - public class GravityGeneratorComponent: SharedGravityGeneratorComponent, IAttackBy, IBreakAct, IAttackHand + public class GravityGeneratorComponent: SharedGravityGeneratorComponent, IInteractUsing, IBreakAct, IInteractHand { private BoundUserInterface _userInterface; @@ -89,7 +89,7 @@ namespace Content.Server.GameObjects.Components.Gravity serializer.DataField(ref _intact, "intact", true); } - bool IAttackHand.AttackHand(AttackHandEventArgs eventArgs) + bool IInteractHand.InteractHand(InteractHandEventArgs eventArgs) { if (!eventArgs.User.TryGetComponent(out var actor)) return false; @@ -101,9 +101,9 @@ namespace Content.Server.GameObjects.Components.Gravity return true; } - public bool AttackBy(AttackByEventArgs eventArgs) + public bool InteractUsing(InteractUsingEventArgs eventArgs) { - if (!eventArgs.AttackWith.TryGetComponent(out var welder)) return false; + if (!eventArgs.Using.TryGetComponent(out var welder)) return false; if (welder.TryUse(5.0f)) { diff --git a/Content.Server/GameObjects/Components/Healing/HealingComponent.cs b/Content.Server/GameObjects/Components/Healing/HealingComponent.cs index 6360facb39..bfebc2d3ab 100644 --- a/Content.Server/GameObjects/Components/Healing/HealingComponent.cs +++ b/Content.Server/GameObjects/Components/Healing/HealingComponent.cs @@ -8,7 +8,7 @@ using Robust.Shared.Serialization; namespace Content.Server.GameObjects.Components.Weapon.Melee { [RegisterComponent] - public class HealingComponent : Component, IAfterAttack, IUse + public class HealingComponent : Component, IAfterInteract, IUse { public override string Name => "Healing"; @@ -23,16 +23,16 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee serializer.DataField(ref Damage, "damage", DamageType.Brute); } - void IAfterAttack.AfterAttack(AfterAttackEventArgs eventArgs) + void IAfterInteract.AfterInteract(AfterInteractEventArgs eventArgs) { if (!InteractionChecks.InRangeUnobstructed(eventArgs)) return; - if (eventArgs.Attacked == null) + if (eventArgs.Target == null) { return; } - if (!eventArgs.Attacked.TryGetComponent(out DamageableComponent damagecomponent)) return; + if (!eventArgs.Target.TryGetComponent(out DamageableComponent damagecomponent)) return; if (Owner.TryGetComponent(out StackComponent stackComponent)) { if (!stackComponent.Use(1)) diff --git a/Content.Server/GameObjects/Components/Interactable/HandheldLightComponent.cs b/Content.Server/GameObjects/Components/Interactable/HandheldLightComponent.cs index 6aeb776312..dfc011b05a 100644 --- a/Content.Server/GameObjects/Components/Interactable/HandheldLightComponent.cs +++ b/Content.Server/GameObjects/Components/Interactable/HandheldLightComponent.cs @@ -22,7 +22,7 @@ namespace Content.Server.GameObjects.Components.Interactable /// Component that represents a handheld lightsource which can be toggled on and off. /// [RegisterComponent] - internal sealed class HandheldLightComponent : SharedHandheldLightComponent, IUse, IExamine, IAttackBy, IMapInit + internal sealed class HandheldLightComponent : SharedHandheldLightComponent, IUse, IExamine, IInteractUsing, IMapInit { #pragma warning disable 649 [Dependency] private readonly ISharedNotifyManager _notifyManager; @@ -53,15 +53,15 @@ namespace Content.Server.GameObjects.Components.Interactable [ViewVariables] public bool Activated { get; private set; } - bool IAttackBy.AttackBy(AttackByEventArgs eventArgs) + bool IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs) { - if (!eventArgs.AttackWith.HasComponent()) return false; + if (!eventArgs.Using.HasComponent()) return false; if (Cell != null) return false; var handsComponent = eventArgs.User.GetComponent(); - if (!handsComponent.Drop(eventArgs.AttackWith, _cellContainer)) + if (!handsComponent.Drop(eventArgs.Using, _cellContainer)) { return false; } diff --git a/Content.Server/GameObjects/Components/Interactable/Tools/CrowbarComponent.cs b/Content.Server/GameObjects/Components/Interactable/Tools/CrowbarComponent.cs index 1bf0cf1231..df44ecc92e 100644 --- a/Content.Server/GameObjects/Components/Interactable/Tools/CrowbarComponent.cs +++ b/Content.Server/GameObjects/Components/Interactable/Tools/CrowbarComponent.cs @@ -11,7 +11,7 @@ using Robust.Shared.Map; namespace Content.Server.GameObjects.Components.Interactable.Tools { [RegisterComponent] - public class CrowbarComponent : ToolComponent, IAfterAttack + public class CrowbarComponent : ToolComponent, IAfterInteract { #pragma warning disable 649 [Dependency] private readonly ITileDefinitionManager _tileDefinitionManager; @@ -24,7 +24,7 @@ namespace Content.Server.GameObjects.Components.Interactable.Tools /// public override string Name => "Crowbar"; - public void AfterAttack(AfterAttackEventArgs eventArgs) + public void AfterInteract(AfterInteractEventArgs eventArgs) { if (!InteractionChecks.InRangeUnobstructed(eventArgs)) return; diff --git a/Content.Server/GameObjects/Components/Items/FloorTileItemComponent.cs b/Content.Server/GameObjects/Components/Items/FloorTileItemComponent.cs index f5b4cd2b8b..9f472658cd 100644 --- a/Content.Server/GameObjects/Components/Items/FloorTileItemComponent.cs +++ b/Content.Server/GameObjects/Components/Items/FloorTileItemComponent.cs @@ -15,7 +15,7 @@ using Robust.Shared.Utility; namespace Content.Server.GameObjects.Components.Items { [RegisterComponent] - public class FloorTileItemComponent : Component, IAfterAttack + public class FloorTileItemComponent : Component, IAfterInteract { #pragma warning disable 649 [Dependency] private readonly ITileDefinitionManager _tileDefinitionManager; @@ -39,11 +39,11 @@ namespace Content.Server.GameObjects.Components.Items base.Initialize(); Stack = Owner.GetComponent(); } - public void AfterAttack(AfterAttackEventArgs eventArgs) + public void AfterInteract(AfterInteractEventArgs eventArgs) { if (!InteractionChecks.InRangeUnobstructed(eventArgs)) return; - var attacked = eventArgs.Attacked; + var attacked = eventArgs.Target; var mapGrid = _mapManager.GetGrid(eventArgs.ClickLocation.GridID); var tile = mapGrid.GetTileRef(eventArgs.ClickLocation); var tileDef = (ContentTileDefinition)_tileDefinitionManager[tile.Tile.TypeId]; diff --git a/Content.Server/GameObjects/Components/Items/Storage/ItemComponent.cs b/Content.Server/GameObjects/Components/Items/Storage/ItemComponent.cs index 1b69ef420c..f80d7e977a 100644 --- a/Content.Server/GameObjects/Components/Items/Storage/ItemComponent.cs +++ b/Content.Server/GameObjects/Components/Items/Storage/ItemComponent.cs @@ -31,7 +31,7 @@ namespace Content.Server.GameObjects { [RegisterComponent] [ComponentReference(typeof(StoreableComponent))] - public class ItemComponent : StoreableComponent, IAttackHand, IExAct, IEquipped, IUnequipped + public class ItemComponent : StoreableComponent, IInteractHand, IExAct, IEquipped, IUnequipped { public override string Name => "Item"; public override uint? NetID => ContentNetIDs.ITEM; @@ -102,7 +102,7 @@ namespace Content.Server.GameObjects return InteractionChecks.InRangeUnobstructed(user, itemPos, ignoredEnt: Owner, insideBlockerValid:true); } - public bool AttackHand(AttackHandEventArgs eventArgs) + public bool InteractHand(InteractHandEventArgs eventArgs) { if (!CanPickup(eventArgs.User)) return false; diff --git a/Content.Server/GameObjects/Components/Items/Storage/ServerStorageComponent.cs b/Content.Server/GameObjects/Components/Items/Storage/ServerStorageComponent.cs index fd19a8be39..27bbc2c942 100644 --- a/Content.Server/GameObjects/Components/Items/Storage/ServerStorageComponent.cs +++ b/Content.Server/GameObjects/Components/Items/Storage/ServerStorageComponent.cs @@ -32,7 +32,7 @@ namespace Content.Server.GameObjects [RegisterComponent] [ComponentReference(typeof(IActivate))] [ComponentReference(typeof(IStorageComponent))] - public class ServerStorageComponent : SharedStorageComponent, IAttackBy, IUse, IActivate, IStorageComponent, IDestroyAct + public class ServerStorageComponent : SharedStorageComponent, IInteractUsing, IUse, IActivate, IStorageComponent, IDestroyAct { #pragma warning disable 649 [Dependency] private readonly IMapManager _mapManager; @@ -141,9 +141,9 @@ namespace Content.Server.GameObjects /// /// /// - public bool AttackBy(AttackByEventArgs eventArgs) + public bool InteractUsing(InteractUsingEventArgs eventArgs) { - Logger.DebugS("Storage", "Storage (UID {0}) attacked by user (UID {1}) with entity (UID {2}).", Owner.Uid, eventArgs.User.Uid, eventArgs.AttackWith.Uid); + Logger.DebugS("Storage", "Storage (UID {0}) attacked by user (UID {1}) with entity (UID {2}).", Owner.Uid, eventArgs.User.Uid, eventArgs.Using.Uid); if(Owner.TryGetComponent(out var placeableSurfaceComponent)) { diff --git a/Content.Server/GameObjects/Components/Kitchen/KitchenMicrowaveComponent.cs b/Content.Server/GameObjects/Components/Kitchen/KitchenMicrowaveComponent.cs index b8341b8a32..939881fb92 100644 --- a/Content.Server/GameObjects/Components/Kitchen/KitchenMicrowaveComponent.cs +++ b/Content.Server/GameObjects/Components/Kitchen/KitchenMicrowaveComponent.cs @@ -28,7 +28,7 @@ namespace Content.Server.GameObjects.Components.Kitchen { [RegisterComponent] [ComponentReference(typeof(IActivate))] - public class KitchenMicrowaveComponent : SharedMicrowaveComponent, IActivate, IAttackBy, ISolutionChange + public class KitchenMicrowaveComponent : SharedMicrowaveComponent, IActivate, IInteractUsing, ISolutionChange { #pragma warning disable 649 [Dependency] private readonly IEntitySystemManager _entitySystemManager; @@ -184,7 +184,7 @@ namespace Content.Server.GameObjects.Components.Kitchen } - public bool AttackBy(AttackByEventArgs eventArgs) + public bool InteractUsing(InteractUsingEventArgs eventArgs) { var itemEntity = eventArgs.User.GetComponent().GetActiveHand.Owner; diff --git a/Content.Server/GameObjects/Components/Mining/AsteroidRockComponent.cs b/Content.Server/GameObjects/Components/Mining/AsteroidRockComponent.cs index 265b86783c..7e7d05fb7a 100644 --- a/Content.Server/GameObjects/Components/Mining/AsteroidRockComponent.cs +++ b/Content.Server/GameObjects/Components/Mining/AsteroidRockComponent.cs @@ -13,7 +13,7 @@ using Robust.Shared.Random; namespace Content.Server.GameObjects.Components.Mining { [RegisterComponent] - public class AsteroidRockComponent : Component, IAttackBy + public class AsteroidRockComponent : Component, IInteractUsing { public override string Name => "AsteroidRock"; private static readonly string[] SpriteStates = {"0", "1", "2", "3", "4"}; @@ -29,9 +29,9 @@ namespace Content.Server.GameObjects.Components.Mining spriteComponent.LayerSetState(0, _random.Pick(SpriteStates)); } - bool IAttackBy.AttackBy(AttackByEventArgs eventArgs) + bool IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs) { - var item = eventArgs.AttackWith; + var item = eventArgs.Using; if (!item.TryGetComponent(out MeleeWeaponComponent meleeWeaponComponent)) return false; Owner.GetComponent().TakeDamage(DamageType.Brute, meleeWeaponComponent.Damage, item, eventArgs.User); diff --git a/Content.Server/GameObjects/Components/Mobs/StunnableComponent.cs b/Content.Server/GameObjects/Components/Mobs/StunnableComponent.cs index 3ec94fa9b7..8af56a8bde 100644 --- a/Content.Server/GameObjects/Components/Mobs/StunnableComponent.cs +++ b/Content.Server/GameObjects/Components/Mobs/StunnableComponent.cs @@ -22,7 +22,7 @@ using Timer = Robust.Shared.Timers.Timer; namespace Content.Server.GameObjects.Components.Mobs { [RegisterComponent] - public class StunnableComponent : Component, IActionBlocker, IAttackHand, IMoveSpeedModifier + public class StunnableComponent : Component, IActionBlocker, IInteractHand, IMoveSpeedModifier { public override string Name => "Stunnable"; @@ -161,7 +161,7 @@ namespace Content.Server.GameObjects.Components.Mobs _stunnedTimer = 0f; } - public bool AttackHand(AttackHandEventArgs eventArgs) + public bool InteractHand(InteractHandEventArgs eventArgs) { if (!_canHelp || !KnockedDown) return false; diff --git a/Content.Server/GameObjects/Components/Movement/ServerTeleporterComponent.cs b/Content.Server/GameObjects/Components/Movement/ServerTeleporterComponent.cs index 2a9d6a6780..3c1dffb2c2 100644 --- a/Content.Server/GameObjects/Components/Movement/ServerTeleporterComponent.cs +++ b/Content.Server/GameObjects/Components/Movement/ServerTeleporterComponent.cs @@ -23,7 +23,7 @@ namespace Content.Server.GameObjects.Components.Movement { [RegisterComponent] - public class ServerTeleporterComponent : Component, IAfterAttack + public class ServerTeleporterComponent : Component, IAfterInteract { #pragma warning disable 649 [Dependency] private readonly IMapManager _mapManager; @@ -84,7 +84,7 @@ namespace Content.Server.GameObjects.Components.Movement _state = newState; } - void IAfterAttack.AfterAttack(AfterAttackEventArgs eventArgs) + void IAfterInteract.AfterInteract(AfterInteractEventArgs eventArgs) { if (_teleporterType == TeleporterType.Directed) { diff --git a/Content.Server/GameObjects/Components/Nutrition/DrinkComponent.cs b/Content.Server/GameObjects/Components/Nutrition/DrinkComponent.cs index e3c5242a17..baa6e7ac9d 100644 --- a/Content.Server/GameObjects/Components/Nutrition/DrinkComponent.cs +++ b/Content.Server/GameObjects/Components/Nutrition/DrinkComponent.cs @@ -23,7 +23,7 @@ using Robust.Shared.Utility; namespace Content.Server.GameObjects.Components.Nutrition { [RegisterComponent] - public class DrinkComponent : Component, IAfterAttack, IUse + public class DrinkComponent : Component, IAfterInteract, IUse { #pragma warning disable 649 [Dependency] private readonly ILocalizationManager _localizationManager; @@ -100,11 +100,11 @@ namespace Content.Server.GameObjects.Components.Nutrition return true; } - void IAfterAttack.AfterAttack(AfterAttackEventArgs eventArgs) + void IAfterInteract.AfterInteract(AfterInteractEventArgs eventArgs) { if (!InteractionChecks.InRangeUnobstructed(eventArgs)) return; - UseDrink(eventArgs.Attacked); + UseDrink(eventArgs.Target); } private void UseDrink(IEntity targetEntity) diff --git a/Content.Server/GameObjects/Components/Nutrition/FoodComponent.cs b/Content.Server/GameObjects/Components/Nutrition/FoodComponent.cs index 8ea5cbe173..dec7af1f70 100644 --- a/Content.Server/GameObjects/Components/Nutrition/FoodComponent.cs +++ b/Content.Server/GameObjects/Components/Nutrition/FoodComponent.cs @@ -17,7 +17,7 @@ using Robust.Shared.ViewVariables; namespace Content.Server.GameObjects.Components.Nutrition { [RegisterComponent] - public class FoodComponent : Component, IAfterAttack, IUse + public class FoodComponent : Component, IAfterInteract, IUse { #pragma warning disable 649 [Dependency] private readonly ILocalizationManager _localizationManager; @@ -110,11 +110,11 @@ namespace Content.Server.GameObjects.Components.Nutrition return true; } - void IAfterAttack.AfterAttack(AfterAttackEventArgs eventArgs) + void IAfterInteract.AfterInteract(AfterInteractEventArgs eventArgs) { if (!InteractionChecks.InRangeUnobstructed(eventArgs)) return; - UseFood(eventArgs.Attacked); + UseFood(eventArgs.Target); } void UseFood(IEntity user) diff --git a/Content.Server/GameObjects/Components/Paper/PaperComponent.cs b/Content.Server/GameObjects/Components/Paper/PaperComponent.cs index 064af4e78e..1c2fd6044e 100644 --- a/Content.Server/GameObjects/Components/Paper/PaperComponent.cs +++ b/Content.Server/GameObjects/Components/Paper/PaperComponent.cs @@ -10,7 +10,7 @@ using Robust.Shared.Utility; namespace Content.Server.GameObjects.Components.Interactable { [RegisterComponent] - public class PaperComponent : SharedPaperComponent, IExamine, IAttackBy, IUse + public class PaperComponent : SharedPaperComponent, IExamine, IInteractUsing, IUse { private BoundUserInterface _userInterface; @@ -63,9 +63,9 @@ namespace Content.Server.GameObjects.Components.Interactable UpdateUserInterface(); } - public bool AttackBy(AttackByEventArgs eventArgs) + public bool InteractUsing(InteractUsingEventArgs eventArgs) { - if (!eventArgs.AttackWith.HasComponent()) + if (!eventArgs.Using.HasComponent()) return false; if (!eventArgs.User.TryGetComponent(out IActorComponent actor)) return false; diff --git a/Content.Server/GameObjects/Components/PlaceableSurfaceComponent.cs b/Content.Server/GameObjects/Components/PlaceableSurfaceComponent.cs index 15c518098e..1f8789d579 100644 --- a/Content.Server/GameObjects/Components/PlaceableSurfaceComponent.cs +++ b/Content.Server/GameObjects/Components/PlaceableSurfaceComponent.cs @@ -6,7 +6,7 @@ using Robust.Shared.Serialization; namespace Content.Server.GameObjects.Components { [RegisterComponent] - public class PlaceableSurfaceComponent : Component, IAttackBy + public class PlaceableSurfaceComponent : Component, IInteractUsing { public override string Name => "PlaceableSurface"; @@ -19,7 +19,7 @@ namespace Content.Server.GameObjects.Components serializer.DataField(ref _isPlaceable, "IsPlaceable", true); } - public bool AttackBy(AttackByEventArgs eventArgs) + public bool InteractUsing(InteractUsingEventArgs eventArgs) { if (!IsPlaceable) return false; @@ -28,8 +28,8 @@ namespace Content.Server.GameObjects.Components { return false; } - handComponent.Drop(eventArgs.AttackWith); - eventArgs.AttackWith.Transform.WorldPosition = eventArgs.ClickLocation.Position; + handComponent.Drop(eventArgs.Using); + eventArgs.Using.Transform.WorldPosition = eventArgs.ClickLocation.Position; return true; } } diff --git a/Content.Server/GameObjects/Components/Power/Chargers/PowerCellChargerComponent.cs b/Content.Server/GameObjects/Components/Power/Chargers/PowerCellChargerComponent.cs index fd73b7503d..57ae2f41f7 100644 --- a/Content.Server/GameObjects/Components/Power/Chargers/PowerCellChargerComponent.cs +++ b/Content.Server/GameObjects/Components/Power/Chargers/PowerCellChargerComponent.cs @@ -18,8 +18,8 @@ namespace Content.Server.GameObjects.Components.Power.Chargers /// [RegisterComponent] [ComponentReference(typeof(IActivate))] - [ComponentReference(typeof(IAttackBy))] - public sealed class PowerCellChargerComponent : BaseCharger, IActivate, IAttackBy + [ComponentReference(typeof(IInteractUsing))] + public sealed class PowerCellChargerComponent : BaseCharger, IActivate, IInteractUsing { public override string Name => "PowerCellCharger"; public override double CellChargePercent => _container.ContainedEntity != null ? @@ -37,9 +37,9 @@ namespace Content.Server.GameObjects.Components.Power.Chargers _powerDevice.OnPowerStateChanged += PowerUpdate; } - bool IAttackBy.AttackBy(AttackByEventArgs eventArgs) + bool IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs) { - var result = TryInsertItem(eventArgs.AttackWith); + var result = TryInsertItem(eventArgs.Using); if (result) { return true; diff --git a/Content.Server/GameObjects/Components/Power/Chargers/WeaponCapacitorChargerComponent.cs b/Content.Server/GameObjects/Components/Power/Chargers/WeaponCapacitorChargerComponent.cs index 40741df442..e51b75b20b 100644 --- a/Content.Server/GameObjects/Components/Power/Chargers/WeaponCapacitorChargerComponent.cs +++ b/Content.Server/GameObjects/Components/Power/Chargers/WeaponCapacitorChargerComponent.cs @@ -21,17 +21,17 @@ namespace Content.Server.GameObjects.Components.Power.Chargers /// [RegisterComponent] [ComponentReference(typeof(IActivate))] - [ComponentReference(typeof(IAttackBy))] - public sealed class WeaponCapacitorChargerComponent : BaseCharger, IActivate, IAttackBy + [ComponentReference(typeof(IInteractUsing))] + public sealed class WeaponCapacitorChargerComponent : BaseCharger, IActivate, IInteractUsing { public override string Name => "WeaponCapacitorCharger"; public override double CellChargePercent => _container.ContainedEntity != null ? _container.ContainedEntity.GetComponent().Charge / _container.ContainedEntity.GetComponent().Capacity * 100 : 0.0f; - bool IAttackBy.AttackBy(AttackByEventArgs eventArgs) + bool IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs) { - var result = TryInsertItem(eventArgs.AttackWith); + var result = TryInsertItem(eventArgs.Using); if (!result) { var localizationManager = IoCManager.Resolve(); diff --git a/Content.Server/GameObjects/Components/Power/PowerDebugTool.cs b/Content.Server/GameObjects/Components/Power/PowerDebugTool.cs index 47d744180a..fe17946205 100644 --- a/Content.Server/GameObjects/Components/Power/PowerDebugTool.cs +++ b/Content.Server/GameObjects/Components/Power/PowerDebugTool.cs @@ -10,20 +10,20 @@ using Robust.Shared.Interfaces.GameObjects.Components; namespace Content.Server.GameObjects.Components.Power { [RegisterComponent] - public class PowerDebugTool : SharedPowerDebugTool, IAfterAttack + public class PowerDebugTool : SharedPowerDebugTool, IAfterInteract { - void IAfterAttack.AfterAttack(AfterAttackEventArgs eventArgs) + void IAfterInteract.AfterInteract(AfterInteractEventArgs eventArgs) { - if (eventArgs.Attacked == null) + if (eventArgs.Target == null) { return; } var builder = new StringBuilder(); - builder.AppendFormat("Entity: {0} ({1})\n", eventArgs.Attacked.Name, eventArgs.Attacked.Uid); + builder.AppendFormat("Entity: {0} ({1})\n", eventArgs.Target.Name, eventArgs.Target.Uid); - if (eventArgs.Attacked.TryGetComponent(out var node)) + if (eventArgs.Target.TryGetComponent(out var node)) { builder.AppendFormat("Power Node:\n"); if (node.Parent == null) @@ -51,7 +51,7 @@ namespace Content.Server.GameObjects.Components.Power } } - if (eventArgs.Attacked.TryGetComponent(out var device)) + if (eventArgs.Target.TryGetComponent(out var device)) { builder.AppendFormat(@"Power Device: Load: {0} W @@ -76,7 +76,7 @@ namespace Content.Server.GameObjects.Components.Power } } - if (eventArgs.Attacked.TryGetComponent(out var storage)) + if (eventArgs.Target.TryGetComponent(out var storage)) { var stateSeconds = (DateTime.Now - storage.LastChargeStateChange).TotalSeconds; builder.AppendFormat(@"Power Storage: @@ -85,7 +85,7 @@ namespace Content.Server.GameObjects.Components.Power ", storage.Capacity, storage.Charge, storage.ChargeRate, storage.DistributionRate, storage.ChargePowernet, storage.LastChargeState, storage.GetChargeState(), stateSeconds); } - if (eventArgs.Attacked.TryGetComponent(out var transfer)) + if (eventArgs.Target.TryGetComponent(out var transfer)) { builder.AppendFormat(@"Power Transfer: Powernet: {0} diff --git a/Content.Server/GameObjects/Components/Power/PowerTransferComponent.cs b/Content.Server/GameObjects/Components/Power/PowerTransferComponent.cs index 342c3b44b1..c7243b201c 100644 --- a/Content.Server/GameObjects/Components/Power/PowerTransferComponent.cs +++ b/Content.Server/GameObjects/Components/Power/PowerTransferComponent.cs @@ -18,7 +18,7 @@ namespace Content.Server.GameObjects.Components.Power /// Component to transfer power to nearby components, can create powernets and connect to nodes /// [RegisterComponent] - public class PowerTransferComponent : Component, IAttackBy + public class PowerTransferComponent : Component, IInteractUsing { public override string Name => "PowerTransfer"; @@ -139,9 +139,9 @@ namespace Content.Server.GameObjects.Components.Power return Parent != null && Parent.Dirty == false && !Regenerating; } - public bool AttackBy(AttackByEventArgs eventArgs) + public bool InteractUsing(InteractUsingEventArgs eventArgs) { - if (eventArgs.AttackWith.TryGetComponent(out WirecutterComponent wirecutter)) + if (eventArgs.Using.TryGetComponent(out WirecutterComponent wirecutter)) { Owner.Delete(); var droppedEnt = Owner.EntityManager.SpawnEntity("CableStack", eventArgs.ClickLocation); diff --git a/Content.Server/GameObjects/Components/Power/PoweredLightComponent.cs b/Content.Server/GameObjects/Components/Power/PoweredLightComponent.cs index cd789fbec5..36b80f9ecf 100644 --- a/Content.Server/GameObjects/Components/Power/PoweredLightComponent.cs +++ b/Content.Server/GameObjects/Components/Power/PoweredLightComponent.cs @@ -20,7 +20,7 @@ namespace Content.Server.GameObjects.Components.Power /// Component that represents a wall light. It has a light bulb that can be replaced when broken. /// [RegisterComponent] - public class PoweredLightComponent : Component, IAttackHand, IAttackBy + public class PoweredLightComponent : Component, IInteractHand, IInteractUsing { public override string Name => "PoweredLight"; @@ -49,12 +49,12 @@ namespace Content.Server.GameObjects.Components.Power } } - public bool AttackBy(AttackByEventArgs eventArgs) + public bool InteractUsing(InteractUsingEventArgs eventArgs) { - return InsertBulb(eventArgs.AttackWith); + return InsertBulb(eventArgs.Using); } - public bool AttackHand(AttackHandEventArgs eventArgs) + public bool InteractHand(InteractHandEventArgs eventArgs) { if (!eventArgs.User.TryGetComponent(out DamageableComponent damageableComponent)) { diff --git a/Content.Server/GameObjects/Components/Power/WirePlacerComponent.cs b/Content.Server/GameObjects/Components/Power/WirePlacerComponent.cs index 1897b71601..14671cda88 100644 --- a/Content.Server/GameObjects/Components/Power/WirePlacerComponent.cs +++ b/Content.Server/GameObjects/Components/Power/WirePlacerComponent.cs @@ -13,7 +13,7 @@ using Robust.Shared.Map; namespace Content.Server.GameObjects.Components.Power { [RegisterComponent] - internal class WirePlacerComponent : Component, IAfterAttack + internal class WirePlacerComponent : Component, IAfterInteract { #pragma warning disable 649 [Dependency] private readonly IServerEntityManager _entityManager; @@ -24,7 +24,7 @@ namespace Content.Server.GameObjects.Components.Power public override string Name => "WirePlacer"; /// - public void AfterAttack(AfterAttackEventArgs eventArgs) + public void AfterInteract(AfterInteractEventArgs eventArgs) { if (!InteractionChecks.InRangeUnobstructed(eventArgs)) return; diff --git a/Content.Server/GameObjects/Components/Research/LatheComponent.cs b/Content.Server/GameObjects/Components/Research/LatheComponent.cs index 6847614f18..66cf882876 100644 --- a/Content.Server/GameObjects/Components/Research/LatheComponent.cs +++ b/Content.Server/GameObjects/Components/Research/LatheComponent.cs @@ -25,7 +25,7 @@ namespace Content.Server.GameObjects.Components.Research { [RegisterComponent] [ComponentReference(typeof(IActivate))] - public class LatheComponent : SharedLatheComponent, IAttackBy, IActivate + public class LatheComponent : SharedLatheComponent, IInteractUsing, IActivate { public const int VolumePerSheet = 3750; @@ -154,14 +154,14 @@ namespace Content.Server.GameObjects.Components.Research OpenUserInterface(actor.playerSession); } - bool IAttackBy.AttackBy(AttackByEventArgs eventArgs) + bool IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs) { if (!Owner.TryGetComponent(out MaterialStorageComponent storage) - || !eventArgs.AttackWith.TryGetComponent(out MaterialComponent material)) return false; + || !eventArgs.Using.TryGetComponent(out MaterialComponent material)) return false; var multiplier = 1; - if (eventArgs.AttackWith.TryGetComponent(out StackComponent stack)) multiplier = stack.Count; + if (eventArgs.Using.TryGetComponent(out StackComponent stack)) multiplier = stack.Count; var totalAmount = 0; @@ -198,7 +198,7 @@ namespace Content.Server.GameObjects.Components.Research SetAppearance(LatheVisualState.Idle); }); - eventArgs.AttackWith.Delete(); + eventArgs.Using.Delete(); return false; } diff --git a/Content.Server/GameObjects/Components/Stack/StackComponent.cs b/Content.Server/GameObjects/Components/Stack/StackComponent.cs index 28fe570868..ff6cc6a3b5 100644 --- a/Content.Server/GameObjects/Components/Stack/StackComponent.cs +++ b/Content.Server/GameObjects/Components/Stack/StackComponent.cs @@ -16,7 +16,7 @@ namespace Content.Server.GameObjects.Components.Stack // TODO: Naming and presentation and such could use some improvement. [RegisterComponent] - public class StackComponent : SharedStackComponent, IAttackBy, IExamine + public class StackComponent : SharedStackComponent, IInteractUsing, IExamine { #pragma warning disable 649 [Dependency] private readonly ISharedNotifyManager _sharedNotifyManager; @@ -69,9 +69,9 @@ namespace Content.Server.GameObjects.Components.Stack return false; } - public bool AttackBy(AttackByEventArgs eventArgs) + public bool InteractUsing(InteractUsingEventArgs eventArgs) { - if (eventArgs.AttackWith.TryGetComponent(out var stack)) + if (eventArgs.Using.TryGetComponent(out var stack)) { if (!stack.StackType.Equals(StackType)) { diff --git a/Content.Server/GameObjects/Components/Weapon/Ranged/Hitscan/HitscanWeaponComponent.cs b/Content.Server/GameObjects/Components/Weapon/Ranged/Hitscan/HitscanWeaponComponent.cs index e2f417a0f0..8a40308a39 100644 --- a/Content.Server/GameObjects/Components/Weapon/Ranged/Hitscan/HitscanWeaponComponent.cs +++ b/Content.Server/GameObjects/Components/Weapon/Ranged/Hitscan/HitscanWeaponComponent.cs @@ -25,7 +25,7 @@ using Robust.Shared.Utility; namespace Content.Server.GameObjects.Components.Weapon.Ranged.Hitscan { [RegisterComponent] - public class HitscanWeaponComponent : Component, IAttackBy + public class HitscanWeaponComponent : Component, IInteractUsing { private const float MaxLength = 20; public override string Name => "HitscanWeapon"; @@ -68,9 +68,9 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Hitscan } - public bool AttackBy(AttackByEventArgs eventArgs) + public bool InteractUsing(InteractUsingEventArgs eventArgs) { - if (!eventArgs.AttackWith.TryGetComponent(out PowerStorageComponent component)) + if (!eventArgs.Using.TryGetComponent(out PowerStorageComponent component)) { return false; } diff --git a/Content.Server/GameObjects/Components/Weapon/Ranged/Projectile/AmmoBoxComponent.cs b/Content.Server/GameObjects/Components/Weapon/Ranged/Projectile/AmmoBoxComponent.cs index ec885c7e72..42bb2e2918 100644 --- a/Content.Server/GameObjects/Components/Weapon/Ranged/Projectile/AmmoBoxComponent.cs +++ b/Content.Server/GameObjects/Components/Weapon/Ranged/Projectile/AmmoBoxComponent.cs @@ -15,7 +15,7 @@ using Robust.Shared.ViewVariables; namespace Content.Server.GameObjects.Components.Weapon.Ranged.Projectile { [RegisterComponent] - public class AmmoBoxComponent : Component, IAttackBy, IMapInit + public class AmmoBoxComponent : Component, IInteractUsing, IMapInit // TODO: Potential improvements: // Add verbs for stack splitting // Behaviour is largely the same as BallisticMagazine except you can't insert it into a gun. @@ -145,12 +145,12 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Projectile } } - bool IAttackBy.AttackBy(AttackByEventArgs eventArgs) + bool IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs) { - var ammoBoxTransfer = CanTransferFrom(eventArgs.AttackWith); + var ammoBoxTransfer = CanTransferFrom(eventArgs.Using); if (ammoBoxTransfer.Result) { IEntity bullet; - if (eventArgs.AttackWith.TryGetComponent(out BallisticMagazineComponent magazineComponent)) + if (eventArgs.Using.TryGetComponent(out BallisticMagazineComponent magazineComponent)) { int fillCount = Math.Min(magazineComponent.CountLoaded, Capacity - CountLeft); for (int i = 0; i < fillCount; i++) @@ -161,7 +161,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Projectile eventArgs.User.PopupMessage(eventArgs.User, $"Transferred {fillCount} rounds"); return true; } - if (eventArgs.AttackWith.TryGetComponent(out AmmoBoxComponent boxComponent)) + if (eventArgs.Using.TryGetComponent(out AmmoBoxComponent boxComponent)) { int fillCount = Math.Min(boxComponent.CountLeft, Capacity - CountLeft); for (int i = 0; i < fillCount; i++) diff --git a/Content.Server/GameObjects/Components/Weapon/Ranged/Projectile/BallisticMagazineComponent.cs b/Content.Server/GameObjects/Components/Weapon/Ranged/Projectile/BallisticMagazineComponent.cs index fddd55a063..67f93938ba 100644 --- a/Content.Server/GameObjects/Components/Weapon/Ranged/Projectile/BallisticMagazineComponent.cs +++ b/Content.Server/GameObjects/Components/Weapon/Ranged/Projectile/BallisticMagazineComponent.cs @@ -15,7 +15,7 @@ using Robust.Shared.ViewVariables; namespace Content.Server.GameObjects.Components.Weapon.Ranged.Projectile { [RegisterComponent] - public class BallisticMagazineComponent : Component, IMapInit, IAttackBy + public class BallisticMagazineComponent : Component, IMapInit, IInteractUsing { public override string Name => "BallisticMagazine"; @@ -189,12 +189,12 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Projectile } } - bool IAttackBy.AttackBy(AttackByEventArgs eventArgs) + bool IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs) { - var ammoMagTransfer = CanTransferFrom(eventArgs.AttackWith); + var ammoMagTransfer = CanTransferFrom(eventArgs.Using); if (ammoMagTransfer.Result) { IEntity bullet; - if (eventArgs.AttackWith.TryGetComponent(out BallisticMagazineComponent magazineComponent)) + if (eventArgs.Using.TryGetComponent(out BallisticMagazineComponent magazineComponent)) { int fillCount = Math.Min(magazineComponent.CountLoaded, Capacity - CountLoaded); for (int i = 0; i < fillCount; i++) @@ -205,7 +205,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Projectile eventArgs.User.PopupMessage(eventArgs.User, $"Transferred {fillCount} rounds"); return true; } - if (eventArgs.AttackWith.TryGetComponent(out AmmoBoxComponent boxComponent)) + if (eventArgs.Using.TryGetComponent(out AmmoBoxComponent boxComponent)) { int fillCount = Math.Min(boxComponent.CountLeft, Capacity - CountLoaded); for (int i = 0; i < fillCount; i++) diff --git a/Content.Server/GameObjects/Components/Weapon/Ranged/Projectile/BallisticMagazineWeaponComponent.cs b/Content.Server/GameObjects/Components/Weapon/Ranged/Projectile/BallisticMagazineWeaponComponent.cs index 64a119f267..6ebdcdd3b4 100644 --- a/Content.Server/GameObjects/Components/Weapon/Ranged/Projectile/BallisticMagazineWeaponComponent.cs +++ b/Content.Server/GameObjects/Components/Weapon/Ranged/Projectile/BallisticMagazineWeaponComponent.cs @@ -26,7 +26,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Projectile /// Guns that have a magazine. /// [RegisterComponent] - public class BallisticMagazineWeaponComponent : BallisticWeaponComponent, IUse, IAttackBy, IMapInit + public class BallisticMagazineWeaponComponent : BallisticWeaponComponent, IUse, IInteractUsing, IMapInit { private const float BulletOffset = 0.2f; @@ -210,9 +210,9 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Projectile return true; } - public bool AttackBy(AttackByEventArgs eventArgs) + public bool InteractUsing(InteractUsingEventArgs eventArgs) { - if (!eventArgs.AttackWith.TryGetComponent(out BallisticMagazineComponent component)) + if (!eventArgs.Using.TryGetComponent(out BallisticMagazineComponent component)) { return false; } @@ -226,7 +226,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Projectile Owner.PopupMessage(eventArgs.User, "Magazine doesn't fit."); return false; } - return InsertMagazine(eventArgs.AttackWith); + return InsertMagazine(eventArgs.Using); } private void MagazineAmmoCountChanged() diff --git a/Content.Server/GameObjects/Components/WiresComponent.cs b/Content.Server/GameObjects/Components/WiresComponent.cs index 8c7eee7f1c..d48140c655 100644 --- a/Content.Server/GameObjects/Components/WiresComponent.cs +++ b/Content.Server/GameObjects/Components/WiresComponent.cs @@ -27,7 +27,7 @@ using Robust.Shared.Utility; namespace Content.Server.GameObjects.Components { [RegisterComponent] - public class WiresComponent : SharedWiresComponent, IAttackBy, IExamine + public class WiresComponent : SharedWiresComponent, IInteractUsing, IExamine { #pragma warning disable 649 [Dependency] private readonly IRobustRandom _random; @@ -296,9 +296,9 @@ namespace Content.Server.GameObjects.Components _userInterface.SetState(new WiresBoundUserInterfaceState(clientList, _statuses.Values.ToList())); } - bool IAttackBy.AttackBy(AttackByEventArgs eventArgs) + bool IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs) { - if (!eventArgs.AttackWith.HasComponent()) + if (!eventArgs.Using.HasComponent()) { return false; } diff --git a/Content.Server/GameObjects/Components/WrenchableComponent.cs b/Content.Server/GameObjects/Components/WrenchableComponent.cs index 37f46a02fb..3e4e5a41a3 100644 --- a/Content.Server/GameObjects/Components/WrenchableComponent.cs +++ b/Content.Server/GameObjects/Components/WrenchableComponent.cs @@ -12,7 +12,7 @@ using Robust.Shared.Utility; namespace Content.Server.GameObjects.Components { [RegisterComponent] - public class WrenchableComponent : Component, IAttackBy + public class WrenchableComponent : Component, IInteractUsing { public override string Name => "Wrenchable"; private AudioSystem _audioSystem; @@ -23,9 +23,9 @@ namespace Content.Server.GameObjects.Components _audioSystem = EntitySystem.Get(); } - public bool AttackBy(AttackByEventArgs eventArgs) + public bool InteractUsing(InteractUsingEventArgs eventArgs) { - if (!eventArgs.AttackWith.HasComponent()) + if (!eventArgs.Using.HasComponent()) { return false; } diff --git a/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs b/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs index a123560120..60a5a27d40 100644 --- a/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Linq; using Content.Server.GameObjects.Components.Mobs; using Content.Server.GameObjects.Components.Timing; @@ -28,26 +28,26 @@ using Robust.Shared.Players; namespace Content.Server.GameObjects.EntitySystems { /// - /// This interface gives components behavior when being clicked on or "attacked" by a user with an object in their hand + /// This interface gives components behavior when being clicked on by a user with an object in their hand /// who is in range and has unobstructed reach of the target entity (allows inside blockers). /// - public interface IAttackBy + public interface IInteractUsing { /// /// Called when using one object on another when user is in range of the target entity. /// - bool AttackBy(AttackByEventArgs eventArgs); + bool InteractUsing(InteractUsingEventArgs eventArgs); } - public class AttackByEventArgs : EventArgs, ITargetedAttackEventArgs + public class InteractUsingEventArgs : EventArgs, ITargetedInteractEventArgs { public IEntity User { get; set; } public GridCoordinates ClickLocation { get; set; } - public IEntity AttackWith { get; set; } - public IEntity Attacked { get; set; } + public IEntity Using { get; set; } + public IEntity Target { get; set; } } - public interface ITargetedAttackEventArgs + public interface ITargetedInteractEventArgs { /// /// Performer of the attack @@ -56,45 +56,46 @@ namespace Content.Server.GameObjects.EntitySystems /// /// Target of the attack /// - IEntity Attacked { get; } + IEntity Target { get; } } /// - /// This interface gives components behavior when being clicked on or "attacked" by a user with an empty hand + /// This interface gives components behavior when being clicked on by a user with an empty hand /// who is in range and has unobstructed reach of the target entity (allows inside blockers). /// - public interface IAttackHand + public interface IInteractHand { /// /// Called when a player directly interacts with an empty hand when user is in range of the target entity. /// - bool AttackHand(AttackHandEventArgs eventArgs); + bool InteractHand(InteractHandEventArgs eventArgs); } - public class AttackHandEventArgs : EventArgs, ITargetedAttackEventArgs + public class InteractHandEventArgs : EventArgs, ITargetedInteractEventArgs { public IEntity User { get; set; } - public IEntity Attacked { get; set; } + public IEntity Target { get; set; } } /// - /// This interface gives components behavior when being clicked by objects outside the range of direct use + /// This interface gives components behavior when being clicked on by a user with an object + /// outside the range of direct use /// - public interface IRangedAttackBy + public interface IRangedInteract { /// /// Called when we try to interact with an entity out of range /// /// - bool RangedAttackBy(RangedAttackByEventArgs eventArgs); + bool RangedInteract(RangedInteractEventArgs eventArgs); } [PublicAPI] - public class RangedAttackByEventArgs : EventArgs + public class RangedInteractEventArgs : EventArgs { public IEntity User { get; set; } - public IEntity Weapon { get; set; } + public IEntity Using { get; set; } public GridCoordinates ClickLocation { get; set; } } @@ -102,19 +103,19 @@ namespace Content.Server.GameObjects.EntitySystems /// This interface gives components a behavior when clicking on another object and no interaction occurs, /// at any range. /// - public interface IAfterAttack + public interface IAfterInteract { /// /// Called when we interact with nothing, or when we interact with an entity out of range that has no behavior /// - void AfterAttack(AfterAttackEventArgs eventArgs); + void AfterInteract(AfterInteractEventArgs eventArgs); } - public class AfterAttackEventArgs : EventArgs + public class AfterInteractEventArgs : EventArgs { public IEntity User { get; set; } public GridCoordinates ClickLocation { get; set; } - public IEntity Attacked { get; set; } + public IEntity Target { get; set; } } /// @@ -146,10 +147,10 @@ namespace Content.Server.GameObjects.EntitySystems void Activate(ActivateEventArgs eventArgs); } - public class ActivateEventArgs : EventArgs, ITargetedAttackEventArgs + public class ActivateEventArgs : EventArgs, ITargetedInteractEventArgs { public IEntity User { get; set; } - public IEntity Attacked { get; set; } + public IEntity Target { get; set; } } /// @@ -382,7 +383,7 @@ namespace Content.Server.GameObjects.EntitySystems } // all activates should only fire when in range / unbostructed - var activateEventArgs = new ActivateEventArgs {User = user, Attacked = used}; + var activateEventArgs = new ActivateEventArgs {User = user, Target = used}; if (InteractionChecks.InRangeUnobstructed(activateEventArgs)) { activateComp.Activate(activateEventArgs); @@ -499,8 +500,8 @@ namespace Content.Server.GameObjects.EntitySystems { if (item != null) { - // After attack: Check if we clicked on an empty location, if so the only interaction we can do is AfterAttack - InteractAfterAttack(player, item, coordinates); + // After attack: Check if we clicked on an empty location, if so the only interaction we can do is AfterInteract + InteractAfter(player, item, coordinates); } return; @@ -525,7 +526,7 @@ namespace Content.Server.GameObjects.EntitySystems } } - // RangedAttack/AfterAttack: Check distance between user and clicked item, if too large parse it in the ranged function + // RangedInteract/AfterInteract: Check distance between user and clicked item, if too large parse it in the ranged function // TODO: have range based upon the item being used? or base it upon some variables of the player himself? var distance = (playerTransform.WorldPosition - attacked.Transform.WorldPosition).LengthSquared; if (distance > InteractionRangeSquared) @@ -536,16 +537,16 @@ namespace Content.Server.GameObjects.EntitySystems return; } - return; // Add some form of ranged AttackHand here if you need it someday, or perhaps just ways to modify the range of AttackHand + return; // Add some form of ranged InteractHand here if you need it someday, or perhaps just ways to modify the range of InteractHand } // We are close to the nearby object and the object isn't contained in our active hand - // AttackBy/AfterAttack: We will either use the item on the nearby object + // InteractUsing/AfterInteract: We will either use the item on the nearby object if (item != null) { Interaction(player, item, attacked, coordinates); } - // AttackHand/Activate: Since our hand is empty we will use AttackHand/Activate + // InteractHand/Activate: Since our hand is empty we will use InteractHand/Activate else { Interaction(player, attacked); @@ -553,9 +554,9 @@ namespace Content.Server.GameObjects.EntitySystems } /// - /// We didn't click on any entity, try doing an AfterAttack on the click location + /// We didn't click on any entity, try doing an AfterInteract on the click location /// - private void InteractAfterAttack(IEntity user, IEntity weapon, GridCoordinates clickLocation) + private void InteractAfter(IEntity user, IEntity weapon, GridCoordinates clickLocation) { var message = new AfterAttackMessage(user, weapon, null, clickLocation); RaiseLocalEvent(message); @@ -564,18 +565,18 @@ namespace Content.Server.GameObjects.EntitySystems return; } - var afterAttacks = weapon.GetAllComponents().ToList(); - var afterAttackEventArgs = new AfterAttackEventArgs {User = user, ClickLocation = clickLocation}; + var afterInteracts = weapon.GetAllComponents().ToList(); + var afterInteractEventArgs = new AfterInteractEventArgs {User = user, ClickLocation = clickLocation}; - foreach (var afterAttack in afterAttacks) + foreach (var afterInteract in afterInteracts) { - afterAttack.AfterAttack(afterAttackEventArgs); + afterInteract.AfterInteract(afterInteractEventArgs); } } /// /// Uses a weapon/object on an entity - /// Finds components with the AttackBy interface and calls their function + /// Finds components with the InteractUsing interface and calls their function /// public void Interaction(IEntity user, IEntity weapon, IEntity attacked, GridCoordinates clickLocation) { @@ -586,10 +587,10 @@ namespace Content.Server.GameObjects.EntitySystems return; } - var attackBys = attacked.GetAllComponents().ToList(); - var attackByEventArgs = new AttackByEventArgs + var attackBys = attacked.GetAllComponents().ToList(); + var attackByEventArgs = new InteractUsingEventArgs { - User = user, ClickLocation = clickLocation, AttackWith = weapon, Attacked = attacked + User = user, ClickLocation = clickLocation, Using = weapon, Target = attacked }; // all AttackBys should only happen when in range / unobstructed, so no range check is needed @@ -597,9 +598,9 @@ namespace Content.Server.GameObjects.EntitySystems { foreach (var attackBy in attackBys) { - if (attackBy.AttackBy(attackByEventArgs)) + if (attackBy.InteractUsing(attackByEventArgs)) { - // If an AttackBy returns a status completion we finish our attack + // If an InteractUsing returns a status completion we finish our attack return; } } @@ -613,21 +614,21 @@ namespace Content.Server.GameObjects.EntitySystems } // If we aren't directly attacking the nearby object, lets see if our item has an after attack we can do - var afterAttacks = weapon.GetAllComponents().ToList(); - var afterAttackEventArgs = new AfterAttackEventArgs + var afterAttacks = weapon.GetAllComponents().ToList(); + var afterAttackEventArgs = new AfterInteractEventArgs { - User = user, ClickLocation = clickLocation, Attacked = attacked + User = user, ClickLocation = clickLocation, Target = attacked }; foreach (var afterAttack in afterAttacks) { - afterAttack.AfterAttack(afterAttackEventArgs); + afterAttack.AfterInteract(afterAttackEventArgs); } } /// /// Uses an empty hand on an entity - /// Finds components with the AttackHand interface and calls their function + /// Finds components with the InteractHand interface and calls their function /// public void Interaction(IEntity user, IEntity attacked) { @@ -638,17 +639,17 @@ namespace Content.Server.GameObjects.EntitySystems return; } - var attackHands = attacked.GetAllComponents().ToList(); - var attackHandEventArgs = new AttackHandEventArgs {User = user, Attacked = attacked}; + var attackHands = attacked.GetAllComponents().ToList(); + var attackHandEventArgs = new InteractHandEventArgs {User = user, Target = attacked}; // all attackHands should only fire when in range / unbostructed if (InteractionChecks.InRangeUnobstructed(attackHandEventArgs)) { foreach (var attackHand in attackHands) { - if (attackHand.AttackHand(attackHandEventArgs)) + if (attackHand.InteractHand(attackHandEventArgs)) { - // If an AttackHand returns a status completion we finish our attack + // If an InteractHand returns a status completion we finish our attack return; } } @@ -896,18 +897,18 @@ namespace Content.Server.GameObjects.EntitySystems if (rangedMsg.Handled) return; - var rangedAttackBys = attacked.GetAllComponents().ToList(); - var rangedAttackByEventArgs = new RangedAttackByEventArgs + var rangedAttackBys = attacked.GetAllComponents().ToList(); + var rangedAttackByEventArgs = new RangedInteractEventArgs { - User = user, Weapon = weapon, ClickLocation = clickLocation + User = user, Using = weapon, ClickLocation = clickLocation }; // See if we have a ranged attack interaction foreach (var t in rangedAttackBys) { - if (t.RangedAttackBy(rangedAttackByEventArgs)) + if (t.RangedInteract(rangedAttackByEventArgs)) { - // If an AttackBy returns a status completion we finish our attack + // If an InteractUsing returns a status completion we finish our attack return; } } @@ -917,16 +918,16 @@ namespace Content.Server.GameObjects.EntitySystems if (afterAtkMsg.Handled) return; - var afterAttacks = weapon.GetAllComponents().ToList(); - var afterAttackEventArgs = new AfterAttackEventArgs + var afterAttacks = weapon.GetAllComponents().ToList(); + var afterAttackEventArgs = new AfterInteractEventArgs { - User = user, ClickLocation = clickLocation, Attacked = attacked + User = user, ClickLocation = clickLocation, Target = attacked }; //See if we have a ranged attack interaction foreach (var afterAttack in afterAttacks) { - afterAttack.AfterAttack(afterAttackEventArgs); + afterAttack.AfterInteract(afterAttackEventArgs); } } diff --git a/Content.Server/Health/BodySystem/BodyManagerComponent.cs b/Content.Server/Health/BodySystem/BodyManagerComponent.cs index a371fcdbd5..514ad33df1 100644 --- a/Content.Server/Health/BodySystem/BodyManagerComponent.cs +++ b/Content.Server/Health/BodySystem/BodyManagerComponent.cs @@ -17,7 +17,7 @@ namespace Content.Server.BodySystem { /// Component representing the many BodyParts attached to each other. /// [RegisterComponent] - public class BodyManagerComponent : Component, IAttackHand { + public class BodyManagerComponent : Component, IInteractHand { public sealed override string Name => "BodyManager"; #pragma warning disable CS0649 @@ -117,7 +117,7 @@ namespace Content.Server.BodySystem { ///////// Server-specific stuff ///////// - public bool AttackHand(AttackHandEventArgs eventArgs) + public bool InteractHand(InteractHandEventArgs eventArgs) { //TODO: remove organs? return false; diff --git a/Content.Server/Health/BodySystem/Surgery/ServerSurgeryToolComponent.cs b/Content.Server/Health/BodySystem/Surgery/ServerSurgeryToolComponent.cs index 7f8c5d7274..42694bde13 100644 --- a/Content.Server/Health/BodySystem/Surgery/ServerSurgeryToolComponent.cs +++ b/Content.Server/Health/BodySystem/Surgery/ServerSurgeryToolComponent.cs @@ -28,7 +28,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee { [RegisterComponent] - public class ServerSurgeryToolComponent : SharedSurgeryToolComponent, IAfterAttack + public class ServerSurgeryToolComponent : SharedSurgeryToolComponent, IAfterInteract { #pragma warning disable 649 [Dependency] private readonly IMapManager _mapManager; @@ -41,13 +41,13 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee private BodyManagerComponent _targetCache; private IEntity _performerCache; - void IAfterAttack.AfterAttack(AfterAttackEventArgs eventArgs) + void IAfterInteract.AfterInteract(AfterInteractEventArgs eventArgs) { if (!InteractionChecks.InRangeUnobstructed(eventArgs)) return; - if (eventArgs.Attacked == null) + if (eventArgs.Target == null) return; - if (eventArgs.Attacked.TryGetComponent(out BodySystem.BodyManagerComponent bodyManager)) + if (eventArgs.Target.TryGetComponent(out BodySystem.BodyManagerComponent bodyManager)) { _surgeryOptionsCache.Clear(); var toSend = new Dictionary(); diff --git a/Content.Server/Utility/InteractionChecks.cs b/Content.Server/Utility/InteractionChecks.cs index f78824f0f6..107e3120ec 100644 --- a/Content.Server/Utility/InteractionChecks.cs +++ b/Content.Server/Utility/InteractionChecks.cs @@ -25,13 +25,13 @@ namespace Content.Server.Utility /// Validates that attacker is in range of the attacked entity. Additionally shows a popup if /// validation fails. /// - public static bool InRangeUnobstructed(ITargetedAttackEventArgs eventArgs, bool insideBlockerValid = true) + public static bool InRangeUnobstructed(ITargetedInteractEventArgs eventArgs, bool insideBlockerValid = true) { if (!EntitySystem.Get().InRangeUnobstructed(eventArgs.User.Transform.MapPosition, - eventArgs.Attacked.Transform.WorldPosition, ignoredEnt: eventArgs.Attacked, insideBlockerValid: insideBlockerValid)) + eventArgs.Target.Transform.WorldPosition, ignoredEnt: eventArgs.Target, insideBlockerValid: insideBlockerValid)) { var localizationManager = IoCManager.Resolve(); - eventArgs.Attacked.PopupMessage(eventArgs.User, localizationManager.GetString("You can't reach there!")); + eventArgs.Target.PopupMessage(eventArgs.User, localizationManager.GetString("You can't reach there!")); return false; } @@ -45,15 +45,15 @@ namespace Content.Server.Utility /// If there is no attacked entity, validates that they are in range of the clicked position. /// Additionally shows a popup if validation fails. /// - public static bool InRangeUnobstructed(AfterAttackEventArgs eventArgs, bool insideBlockerValid = true) + public static bool InRangeUnobstructed(AfterInteractEventArgs eventArgs, bool insideBlockerValid = true) { - if (eventArgs.Attacked != null) + if (eventArgs.Target != null) { if (!EntitySystem.Get().InRangeUnobstructed(eventArgs.User.Transform.MapPosition, - eventArgs.Attacked.Transform.WorldPosition, ignoredEnt: eventArgs.Attacked, insideBlockerValid: insideBlockerValid)) + eventArgs.Target.Transform.WorldPosition, ignoredEnt: eventArgs.Target, insideBlockerValid: insideBlockerValid)) { var localizationManager = IoCManager.Resolve(); - eventArgs.Attacked.PopupMessage(eventArgs.User, localizationManager.GetString("You can't reach there!")); + eventArgs.Target.PopupMessage(eventArgs.User, localizationManager.GetString("You can't reach there!")); return false; } }