AttackBy with an EventArg object for a parameter

This commit is contained in:
PrPleGoo
2019-04-05 19:22:38 +02:00
parent 6f298cab62
commit ee7a29326d
9 changed files with 57 additions and 52 deletions

View File

@@ -14,7 +14,7 @@ namespace Content.Server.GameObjects.Components.Interactable
/// <summary>
/// Component that represents a handheld lightsource which can be toggled on and off.
/// </summary>
internal class HandheldLightComponent : Component, IUse, IExamine, IAttackby
internal class HandheldLightComponent : Component, IUse, IExamine, IAttackBy
{
public const float Wattage = 10;
[ViewVariables] private ContainerSlot _cellContainer;
@@ -41,15 +41,15 @@ namespace Content.Server.GameObjects.Components.Interactable
[ViewVariables]
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;
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()