AttackBy with an EventArg object for a parameter
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Content.Server.GameObjects.Components.Interactable.Tools;
|
using Content.Server.GameObjects.Components.Interactable.Tools;
|
||||||
using Content.Server.GameObjects.Components.Sound;
|
|
||||||
using Content.Server.GameObjects.Components.Stack;
|
using Content.Server.GameObjects.Components.Stack;
|
||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
using Content.Shared.Construction;
|
using Content.Shared.Construction;
|
||||||
@@ -18,7 +17,7 @@ using static Content.Shared.Construction.ConstructionStepTool;
|
|||||||
|
|
||||||
namespace Content.Server.GameObjects.Components.Construction
|
namespace Content.Server.GameObjects.Components.Construction
|
||||||
{
|
{
|
||||||
public class ConstructionComponent : Component, IAttackby
|
public class ConstructionComponent : Component, IAttackBy
|
||||||
{
|
{
|
||||||
public override string Name => "Construction";
|
public override string Name => "Construction";
|
||||||
|
|
||||||
@@ -41,11 +40,11 @@ namespace Content.Server.GameObjects.Components.Construction
|
|||||||
random = new Random();
|
random = new Random();
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Attackby(IEntity user, IEntity attackwith)
|
public bool AttackBy(AttackByEventArgs eventArgs)
|
||||||
{
|
{
|
||||||
var stage = Prototype.Stages[Stage];
|
var stage = Prototype.Stages[Stage];
|
||||||
|
|
||||||
if (TryProcessStep(stage.Forward, attackwith))
|
if (TryProcessStep(stage.Forward, eventArgs.AttackWith))
|
||||||
{
|
{
|
||||||
Stage++;
|
Stage++;
|
||||||
if (Stage == Prototype.Stages.Count - 1)
|
if (Stage == Prototype.Stages.Count - 1)
|
||||||
@@ -65,7 +64,7 @@ namespace Content.Server.GameObjects.Components.Construction
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (TryProcessStep(stage.Backward, attackwith))
|
else if (TryProcessStep(stage.Backward, eventArgs.AttackWith))
|
||||||
{
|
{
|
||||||
Stage--;
|
Stage--;
|
||||||
if (Stage == 0)
|
if (Stage == 0)
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ namespace Content.Server.GameObjects.Components.Interactable
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Component that represents a handheld lightsource which can be toggled on and off.
|
/// Component that represents a handheld lightsource which can be toggled on and off.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal class HandheldLightComponent : Component, IUse, IExamine, IAttackby
|
internal class HandheldLightComponent : Component, IUse, IExamine, IAttackBy
|
||||||
{
|
{
|
||||||
public const float Wattage = 10;
|
public const float Wattage = 10;
|
||||||
[ViewVariables] private ContainerSlot _cellContainer;
|
[ViewVariables] private ContainerSlot _cellContainer;
|
||||||
@@ -41,15 +41,15 @@ namespace Content.Server.GameObjects.Components.Interactable
|
|||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
public bool Activated { get; private set; }
|
public bool Activated { get; private set; }
|
||||||
|
|
||||||
bool IAttackby.Attackby(IEntity user, IEntity attackwith)
|
bool IAttackBy.AttackBy(AttackByEventArgs eventArgs)
|
||||||
{
|
{
|
||||||
if (!attackwith.HasComponent<PowerCellComponent>()) return false;
|
if (!eventArgs.AttackWith.HasComponent<PowerCellComponent>()) return false;
|
||||||
|
|
||||||
if (Cell != null) return false;
|
if (Cell != null) return false;
|
||||||
|
|
||||||
user.GetComponent<IHandsComponent>().Drop(attackwith, _cellContainer);
|
eventArgs.User.GetComponent<IHandsComponent>().Drop(eventArgs.AttackWith, _cellContainer);
|
||||||
|
|
||||||
return _cellContainer.Insert(attackwith);
|
return _cellContainer.Insert(eventArgs.AttackWith);
|
||||||
}
|
}
|
||||||
|
|
||||||
string IExamine.Examine()
|
string IExamine.Examine()
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ namespace Content.Server.GameObjects
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Storage component for containing entities within this one, matches a UI on the client which shows stored entities
|
/// Storage component for containing entities within this one, matches a UI on the client which shows stored entities
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class ServerStorageComponent : SharedStorageComponent, IAttackby, IUse, IActivate
|
public class ServerStorageComponent : SharedStorageComponent, IAttackBy, IUse, IActivate
|
||||||
{
|
{
|
||||||
private Container storage;
|
private Container storage;
|
||||||
|
|
||||||
@@ -131,25 +131,25 @@ namespace Content.Server.GameObjects
|
|||||||
/// <param name="user"></param>
|
/// <param name="user"></param>
|
||||||
/// <param name="attackwith"></param>
|
/// <param name="attackwith"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
bool IAttackby.Attackby(IEntity user, IEntity attackwith)
|
bool IAttackBy.AttackBy(AttackByEventArgs eventArgs)
|
||||||
{
|
{
|
||||||
_ensureInitialCalculated();
|
_ensureInitialCalculated();
|
||||||
Logger.DebugS("Storage", "Storage (UID {0}) attacked by user (UID {1}) with entity (UID {2}).", Owner.Uid, user.Uid, attackwith.Uid);
|
Logger.DebugS("Storage", "Storage (UID {0}) attacked by user (UID {1}) with entity (UID {2}).", Owner.Uid, eventArgs.User.Uid, eventArgs.AttackWith.Uid);
|
||||||
|
|
||||||
if (!user.TryGetComponent(out HandsComponent hands))
|
if (!eventArgs.User.TryGetComponent(out HandsComponent hands))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
//Check that we can drop the item from our hands first otherwise we obviously cant put it inside
|
//Check that we can drop the item from our hands first otherwise we obviously cant put it inside
|
||||||
if (CanInsert(hands.GetActiveHand.Owner) && hands.Drop(hands.ActiveIndex))
|
if (CanInsert(hands.GetActiveHand.Owner) && hands.Drop(hands.ActiveIndex))
|
||||||
{
|
{
|
||||||
if (Insert(attackwith))
|
if (Insert(eventArgs.AttackWith))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Owner.PopupMessage(user, "Can't insert.");
|
Owner.PopupMessage(eventArgs.User, "Can't insert.");
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -324,5 +324,10 @@ namespace Content.Server.GameObjects
|
|||||||
|
|
||||||
_storageInitialCalculated = true;
|
_storageInitialCalculated = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool Attackby(AttackByEventArgs eventArgs)
|
||||||
|
{
|
||||||
|
throw new System.NotImplementedException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,13 +8,14 @@ using SS14.Shared.Interfaces.GameObjects;
|
|||||||
using Content.Server.GameObjects.Components.Interactable.Tools;
|
using Content.Server.GameObjects.Components.Interactable.Tools;
|
||||||
using SS14.Shared.Interfaces.GameObjects.Components;
|
using SS14.Shared.Interfaces.GameObjects.Components;
|
||||||
using SS14.Shared.ViewVariables;
|
using SS14.Shared.ViewVariables;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace Content.Server.GameObjects.Components.Power
|
namespace Content.Server.GameObjects.Components.Power
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Component to transfer power to nearby components, can create powernets and connect to nodes
|
/// Component to transfer power to nearby components, can create powernets and connect to nodes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class PowerTransferComponent : Component, IAttackby
|
public class PowerTransferComponent : Component, IAttackBy
|
||||||
{
|
{
|
||||||
public override string Name => "PowerTransfer";
|
public override string Name => "PowerTransfer";
|
||||||
|
|
||||||
@@ -133,9 +134,9 @@ namespace Content.Server.GameObjects.Components.Power
|
|||||||
return Parent != null && Parent.Dirty == false && !Regenerating;
|
return Parent != null && Parent.Dirty == false && !Regenerating;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Attackby(IEntity user, IEntity attackwith)
|
public bool AttackBy(AttackByEventArgs eventArgs)
|
||||||
{
|
{
|
||||||
if (attackwith.TryGetComponent(out WirecutterComponent wirecutter))
|
if (eventArgs.AttackWith.TryGetComponent(out WirecutterComponent wirecutter))
|
||||||
{
|
{
|
||||||
Owner.Delete();
|
Owner.Delete();
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using Content.Server.GameObjects.Components.Sound;
|
using Content.Server.GameObjects.Components.Sound;
|
||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
using Content.Server.Interfaces.GameObjects;
|
using Content.Server.Interfaces.GameObjects;
|
||||||
@@ -23,7 +23,7 @@ namespace Content.Server.GameObjects.Components.Power
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Component that represents a wall light. It has a light bulb that can be replaced when broken.
|
/// Component that represents a wall light. It has a light bulb that can be replaced when broken.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class PoweredLightComponent : Component, IAttackHand, IAttackby
|
public class PoweredLightComponent : Component, IAttackHand, IAttackBy
|
||||||
{
|
{
|
||||||
public override string Name => "PoweredLight";
|
public override string Name => "PoweredLight";
|
||||||
|
|
||||||
@@ -50,9 +50,9 @@ namespace Content.Server.GameObjects.Components.Power
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IAttackby.Attackby(IEntity user, IEntity attackwith)
|
bool IAttackBy.AttackBy(AttackByEventArgs eventArgs)
|
||||||
{
|
{
|
||||||
return InsertBulb(attackwith);
|
return InsertBulb(eventArgs.AttackWith);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IAttackHand.Attackhand(IEntity user)
|
bool IAttackHand.Attackhand(IEntity user)
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
using SS14.Shared.GameObjects;
|
using SS14.Shared.GameObjects;
|
||||||
using SS14.Shared.Interfaces.GameObjects;
|
|
||||||
using SS14.Shared.Interfaces.Reflection;
|
using SS14.Shared.Interfaces.Reflection;
|
||||||
using SS14.Shared.IoC;
|
using SS14.Shared.IoC;
|
||||||
using SS14.Shared.Serialization;
|
using SS14.Shared.Serialization;
|
||||||
@@ -10,7 +9,7 @@ using SS14.Shared.ViewVariables;
|
|||||||
namespace Content.Server.GameObjects.Components.Stack
|
namespace Content.Server.GameObjects.Components.Stack
|
||||||
{
|
{
|
||||||
// TODO: Naming and presentation and such could use some improvement.
|
// TODO: Naming and presentation and such could use some improvement.
|
||||||
public class StackComponent : Component, IAttackby, IExamine
|
public class StackComponent : Component, IAttackBy, IExamine
|
||||||
{
|
{
|
||||||
private const string SerializationCache = "stack";
|
private const string SerializationCache = "stack";
|
||||||
private int _count = 50;
|
private int _count = 50;
|
||||||
@@ -97,9 +96,9 @@ namespace Content.Server.GameObjects.Components.Stack
|
|||||||
StackType = stackType;
|
StackType = stackType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Attackby(IEntity user, IEntity attackwith)
|
public bool AttackBy(AttackByEventArgs eventArgs)
|
||||||
{
|
{
|
||||||
if (attackwith.TryGetComponent<StackComponent>(out var stack))
|
if (eventArgs.AttackWith.TryGetComponent<StackComponent>(out var stack))
|
||||||
{
|
{
|
||||||
if (!stack.StackType.Equals(StackType))
|
if (!stack.StackType.Equals(StackType))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
using Content.Shared.GameObjects;
|
using Content.Shared.GameObjects;
|
||||||
using SS14.Server.GameObjects.EntitySystems;
|
using SS14.Server.GameObjects.EntitySystems;
|
||||||
using SS14.Shared.Audio;
|
using SS14.Shared.Audio;
|
||||||
using SS14.Shared.GameObjects.EntitySystemMessages;
|
using SS14.Shared.GameObjects.EntitySystemMessages;
|
||||||
using SS14.Shared.Interfaces.GameObjects;
|
using SS14.Shared.Interfaces.GameObjects;
|
||||||
using SS14.Shared.Interfaces.GameObjects.Components;
|
|
||||||
using SS14.Shared.Interfaces.Physics;
|
using SS14.Shared.Interfaces.Physics;
|
||||||
using SS14.Shared.Interfaces.Timing;
|
using SS14.Shared.Interfaces.Timing;
|
||||||
using SS14.Shared.IoC;
|
using SS14.Shared.IoC;
|
||||||
@@ -12,15 +11,15 @@ using SS14.Shared.Maths;
|
|||||||
using SS14.Shared.Physics;
|
using SS14.Shared.Physics;
|
||||||
using SS14.Shared.Serialization;
|
using SS14.Shared.Serialization;
|
||||||
using System;
|
using System;
|
||||||
using Content.Server.GameObjects.Components.Sound;
|
using Content.Server.GameObjects.Components.Sound;
|
||||||
using SS14.Shared.GameObjects;
|
using SS14.Shared.GameObjects;
|
||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
using Content.Server.GameObjects.Components.Power;
|
using Content.Server.GameObjects.Components.Power;
|
||||||
using Content.Shared.Interfaces;
|
using Content.Shared.Interfaces;
|
||||||
|
|
||||||
namespace Content.Server.GameObjects.Components.Weapon.Ranged.Hitscan
|
namespace Content.Server.GameObjects.Components.Weapon.Ranged.Hitscan
|
||||||
{
|
{
|
||||||
public class HitscanWeaponComponent : Component, IAttackby
|
public class HitscanWeaponComponent : Component, IAttackBy
|
||||||
{
|
{
|
||||||
private const float MaxLength = 20;
|
private const float MaxLength = 20;
|
||||||
public override string Name => "HitscanWeapon";
|
public override string Name => "HitscanWeapon";
|
||||||
@@ -60,15 +59,15 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Hitscan
|
|||||||
rangedWeapon.FireHandler = Fire;
|
rangedWeapon.FireHandler = Fire;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Attackby(IEntity user, IEntity attackwith)
|
public bool AttackBy(AttackByEventArgs eventArgs)
|
||||||
{
|
{
|
||||||
if (!attackwith.TryGetComponent(out PowerStorageComponent component))
|
if (!eventArgs.AttackWith.TryGetComponent(out PowerStorageComponent component))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (capacitorComponent.Full)
|
if (capacitorComponent.Full)
|
||||||
{
|
{
|
||||||
Owner.PopupMessage(user, "Capacitor at max charge");
|
Owner.PopupMessage(eventArgs.User, "Capacitor at max charge");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
capacitorComponent.FillFrom(component);
|
capacitorComponent.FillFrom(component);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using Content.Server.GameObjects.Components.Sound;
|
using Content.Server.GameObjects.Components.Sound;
|
||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
using Content.Shared.GameObjects;
|
using Content.Shared.GameObjects;
|
||||||
@@ -6,17 +6,15 @@ using Content.Shared.GameObjects.Components.Weapons.Ranged;
|
|||||||
using Content.Shared.Interfaces;
|
using Content.Shared.Interfaces;
|
||||||
using SS14.Server.GameObjects;
|
using SS14.Server.GameObjects;
|
||||||
using SS14.Server.GameObjects.Components.Container;
|
using SS14.Server.GameObjects.Components.Container;
|
||||||
using SS14.Server.GameObjects.EntitySystems;
|
|
||||||
using SS14.Shared.Audio;
|
using SS14.Shared.Audio;
|
||||||
using SS14.Shared.Interfaces.GameObjects;
|
using SS14.Shared.Interfaces.GameObjects;
|
||||||
using SS14.Shared.IoC;
|
|
||||||
using SS14.Shared.Maths;
|
using SS14.Shared.Maths;
|
||||||
using SS14.Shared.Serialization;
|
using SS14.Shared.Serialization;
|
||||||
using SS14.Shared.Utility;
|
using SS14.Shared.Utility;
|
||||||
|
|
||||||
namespace Content.Server.GameObjects.Components.Weapon.Ranged.Projectile
|
namespace Content.Server.GameObjects.Components.Weapon.Ranged.Projectile
|
||||||
{
|
{
|
||||||
public class BallisticMagazineWeaponComponent : BallisticWeaponComponent, IUse, IAttackby
|
public class BallisticMagazineWeaponComponent : BallisticWeaponComponent, IUse, IAttackBy
|
||||||
{
|
{
|
||||||
public override string Name => "BallisticMagazineWeapon";
|
public override string Name => "BallisticMagazineWeapon";
|
||||||
|
|
||||||
@@ -202,26 +200,26 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Projectile
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Attackby(IEntity user, IEntity attackwith)
|
public bool AttackBy(AttackByEventArgs eventArgs)
|
||||||
{
|
{
|
||||||
if (!attackwith.TryGetComponent(out BallisticMagazineComponent component))
|
if (!eventArgs.AttackWith.TryGetComponent(out BallisticMagazineComponent component))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Magazine != null)
|
if (Magazine != null)
|
||||||
{
|
{
|
||||||
Owner.PopupMessage(user, "Already got a magazine.");
|
Owner.PopupMessage(eventArgs.User, "Already got a magazine.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (component.MagazineType != MagazineType || component.Caliber != Caliber)
|
if (component.MagazineType != MagazineType || component.Caliber != Caliber)
|
||||||
{
|
{
|
||||||
Owner.PopupMessage(user, "Magazine doesn't fit.");
|
Owner.PopupMessage(eventArgs.User, "Magazine doesn't fit.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return InsertMagazine(attackwith);
|
return InsertMagazine(eventArgs.AttackWith);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void _magazineAmmoCountChanged()
|
private void _magazineAmmoCountChanged()
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using Content.Server.Interfaces.GameObjects;
|
using Content.Server.Interfaces.GameObjects;
|
||||||
using SS14.Server.Interfaces.GameObjects;
|
|
||||||
using SS14.Shared.GameObjects;
|
using SS14.Shared.GameObjects;
|
||||||
using SS14.Shared.GameObjects.Systems;
|
using SS14.Shared.GameObjects.Systems;
|
||||||
using SS14.Shared.Interfaces.GameObjects;
|
using SS14.Shared.Interfaces.GameObjects;
|
||||||
@@ -10,7 +9,6 @@ using Content.Shared.Input;
|
|||||||
using SS14.Shared.Input;
|
using SS14.Shared.Input;
|
||||||
using SS14.Shared.Log;
|
using SS14.Shared.Log;
|
||||||
using SS14.Shared.Map;
|
using SS14.Shared.Map;
|
||||||
using SS14.Server.GameObjects;
|
|
||||||
using SS14.Server.GameObjects.EntitySystems;
|
using SS14.Server.GameObjects.EntitySystems;
|
||||||
using SS14.Server.Interfaces.Player;
|
using SS14.Server.Interfaces.Player;
|
||||||
using SS14.Shared.Interfaces.GameObjects.Components;
|
using SS14.Shared.Interfaces.GameObjects.Components;
|
||||||
@@ -21,7 +19,7 @@ namespace Content.Server.GameObjects.EntitySystems
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 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 or "attacked" by a user with an object in their hand
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IAttackby
|
public interface IAttackBy
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Called when using one object on another
|
/// Called when using one object on another
|
||||||
@@ -29,7 +27,13 @@ namespace Content.Server.GameObjects.EntitySystems
|
|||||||
/// <param name="user"></param>
|
/// <param name="user"></param>
|
||||||
/// <param name="attackwith"></param>
|
/// <param name="attackwith"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
bool Attackby(IEntity user, IEntity attackwith);
|
bool AttackBy(AttackByEventArgs eventArgs);
|
||||||
|
}
|
||||||
|
|
||||||
|
public class AttackByEventArgs : EventArgs
|
||||||
|
{
|
||||||
|
public IEntity User { get; set; }
|
||||||
|
public IEntity AttackWith { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -263,11 +267,11 @@ namespace Content.Server.GameObjects.EntitySystems
|
|||||||
/// <param name="attacked"></param>
|
/// <param name="attacked"></param>
|
||||||
public static void Interaction(IEntity user, IEntity weapon, IEntity attacked, GridCoordinates clicklocation)
|
public static void Interaction(IEntity user, IEntity weapon, IEntity attacked, GridCoordinates clicklocation)
|
||||||
{
|
{
|
||||||
List<IAttackby> interactables = attacked.GetAllComponents<IAttackby>().ToList();
|
List<IAttackBy> interactables = attacked.GetAllComponents<IAttackBy>().ToList();
|
||||||
|
|
||||||
for (var i = 0; i < interactables.Count; i++)
|
for (var i = 0; i < interactables.Count; i++)
|
||||||
{
|
{
|
||||||
if (interactables[i].Attackby(user, weapon)) //If an attackby returns a status completion we finish our attack
|
if (interactables[i].AttackBy(new AttackByEventArgs { User = user, AttackWith = weapon })) //If an attackby returns a status completion we finish our attack
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user