diff --git a/Content.Server/GameObjects/Components/Healing/HealingComponent.cs b/Content.Server/GameObjects/Components/Healing/HealingComponent.cs index 76dc535382..357bdc66ef 100644 --- a/Content.Server/GameObjects/Components/Healing/HealingComponent.cs +++ b/Content.Server/GameObjects/Components/Healing/HealingComponent.cs @@ -1,4 +1,4 @@ -using System; +using System; using Content.Server.GameObjects.Components.Stack; using SS14.Shared.GameObjects; using Content.Server.GameObjects.EntitySystems; @@ -54,9 +54,9 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee Owner.Delete(); } - bool IUse.UseEntity(IEntity user) + bool IUse.UseEntity(UseEntityEventArgs eventArgs) { - if (!user.TryGetComponent(out DamageableComponent damagecomponent)) return false; + if (!eventArgs.User.TryGetComponent(out DamageableComponent damagecomponent)) return false; 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 cdc9fb254c..87e1b16e9e 100644 --- a/Content.Server/GameObjects/Components/Interactable/HandheldLightComponent.cs +++ b/Content.Server/GameObjects/Components/Interactable/HandheldLightComponent.cs @@ -59,7 +59,7 @@ namespace Content.Server.GameObjects.Components.Interactable return null; } - bool IUse.UseEntity(IEntity user) + bool IUse.UseEntity(UseEntityEventArgs eventArgs) { return ToggleStatus(); } diff --git a/Content.Server/GameObjects/Components/Interactable/Tools/WelderComponent.cs b/Content.Server/GameObjects/Components/Interactable/Tools/WelderComponent.cs index 2a42e3ce56..6e44644212 100644 --- a/Content.Server/GameObjects/Components/Interactable/Tools/WelderComponent.cs +++ b/Content.Server/GameObjects/Components/Interactable/Tools/WelderComponent.cs @@ -115,7 +115,7 @@ namespace Content.Server.GameObjects.Components.Interactable.Tools return Fuel > 0; } - public bool UseEntity(IEntity user) + public bool UseEntity(UseEntityEventArgs eventArgs) { return ToggleStatus(); } diff --git a/Content.Server/GameObjects/Components/Items/Storage/ServerStorageComponent.cs b/Content.Server/GameObjects/Components/Items/Storage/ServerStorageComponent.cs index 5ebb35d31c..4a094fae79 100644 --- a/Content.Server/GameObjects/Components/Items/Storage/ServerStorageComponent.cs +++ b/Content.Server/GameObjects/Components/Items/Storage/ServerStorageComponent.cs @@ -159,10 +159,10 @@ namespace Content.Server.GameObjects /// /// /// - bool IUse.UseEntity(IEntity user) + bool IUse.UseEntity(UseEntityEventArgs eventArgs) { _ensureInitialCalculated(); - var user_session = user.GetComponent().playerSession; + var user_session = eventArgs.User.GetComponent().playerSession; Logger.DebugS("Storage", "Storage (UID {0}) \"used\" by player session (UID {1}).", Owner.Uid, user_session.AttachedEntityUid); SubscribeSession(user_session); SendNetworkMessage(new OpenStorageUIMessage(), user_session.ConnectedClient); @@ -304,7 +304,7 @@ namespace Content.Server.GameObjects /// void IActivate.Activate(IEntity user) { - ((IUse) this).UseEntity(user); + ((IUse) this).UseEntity(new UseEntityEventArgs { User = user }); } private void _ensureInitialCalculated() diff --git a/Content.Server/GameObjects/Components/Weapon/Ranged/Projectile/BallisticMagazineWeaponComponent.cs b/Content.Server/GameObjects/Components/Weapon/Ranged/Projectile/BallisticMagazineWeaponComponent.cs index 94bca2c65a..b121bd1e8f 100644 --- a/Content.Server/GameObjects/Components/Weapon/Ranged/Projectile/BallisticMagazineWeaponComponent.cs +++ b/Content.Server/GameObjects/Components/Weapon/Ranged/Projectile/BallisticMagazineWeaponComponent.cs @@ -185,16 +185,16 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Projectile _updateAppearance(); } - public bool UseEntity(IEntity user) + public bool UseEntity(UseEntityEventArgs eventArgs) { var ret = EjectMagazine(); if (ret) { - Owner.PopupMessage(user, "Magazine ejected"); + Owner.PopupMessage(eventArgs.User, "Magazine ejected"); } else { - Owner.PopupMessage(user, "No magazine"); + Owner.PopupMessage(eventArgs.User, "No magazine"); } return true; diff --git a/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs b/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs index 3243d6035d..dc091410a0 100644 --- a/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs @@ -108,7 +108,12 @@ namespace Content.Server.GameObjects.EntitySystems /// /// /// - bool UseEntity(IEntity user); + bool UseEntity(UseEntityEventArgs eventArgs); + } + + public class UseEntityEventArgs : EventArgs + { + public IEntity User { get; set; } } /// @@ -356,7 +361,7 @@ namespace Content.Server.GameObjects.EntitySystems //Try to use item on any components which have the interface for (var i = 0; i < usables.Count; i++) { - if (usables[i].UseEntity(user)) //If an attackby returns a status completion we finish our attack + if (usables[i].UseEntity(new UseEntityEventArgs { User = user })) //If an attackby returns a status completion we finish our attack { return; }