From 9b2be2ba50ac1dda8fe8b7a848bd7f62101120d2 Mon Sep 17 00:00:00 2001 From: PrPleGoo Date: Fri, 5 Apr 2019 19:32:18 +0200 Subject: [PATCH] RangedAttackBy with an EventArg object for a parameter --- .../EntitySystems/Click/InteractionSystem.cs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs b/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs index 45cd5b5ec9..102c6c539e 100644 --- a/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs @@ -57,7 +57,7 @@ namespace Content.Server.GameObjects.EntitySystems /// /// This interface gives components behavior when being clicked by objects outside the range of direct use /// - public interface IRangedAttackby + public interface IRangedAttackBy { /// /// Called when we try to interact with an entity out of range @@ -66,7 +66,14 @@ namespace Content.Server.GameObjects.EntitySystems /// /// /// - bool RangedAttackby(IEntity user, IEntity attackwith, GridCoordinates clicklocation); + bool RangedAttackBy(RangedAttackByEventArgs eventArgs); + } + + public class RangedAttackByEventArgs : EventArgs + { + public IEntity User { get; set; } + public IEntity Weapon { get; set; } + public GridCoordinates ClickLocation { get; set; } } /// @@ -358,12 +365,12 @@ namespace Content.Server.GameObjects.EntitySystems /// public static void RangedInteraction(IEntity user, IEntity weapon, IEntity attacked, GridCoordinates clicklocation) { - List rangedusables = attacked.GetAllComponents().ToList(); + List rangedusables = attacked.GetAllComponents().ToList(); //See if we have a ranged attack interaction for (var i = 0; i < rangedusables.Count; i++) { - if (rangedusables[i].RangedAttackby(user, weapon, clicklocation)) //If an attackby returns a status completion we finish our attack + if (rangedusables[i].RangedAttackBy(new RangedAttackByEventArgs { User = user, Weapon = weapon, ClickLocation = clicklocation })) //If an attackby returns a status completion we finish our attack { return; }