AttackHand with an EventArg object for a parameter
This commit is contained in:
@@ -41,7 +41,7 @@ namespace Content.Server.GameObjects
|
||||
base.OnRemove();
|
||||
}
|
||||
|
||||
public bool Attackhand(IEntity user)
|
||||
public bool AttackHand(AttackHandEventArgs eventArgs)
|
||||
{
|
||||
if (_state == DoorState.Open)
|
||||
{
|
||||
|
||||
@@ -2,10 +2,11 @@
|
||||
using SS14.Server.Interfaces.GameObjects;
|
||||
using Content.Shared.GameObjects;
|
||||
using SS14.Shared.Interfaces.GameObjects;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
|
||||
namespace Content.Server.GameObjects
|
||||
{
|
||||
public class ItemComponent : StoreableComponent, EntitySystems.IAttackHand
|
||||
public class ItemComponent : StoreableComponent, IAttackHand
|
||||
{
|
||||
public override string Name => "Item";
|
||||
|
||||
@@ -26,9 +27,9 @@ namespace Content.Server.GameObjects
|
||||
}
|
||||
}
|
||||
|
||||
public bool Attackhand(IEntity user)
|
||||
public bool AttackHand(AttackHandEventArgs eventArgs)
|
||||
{
|
||||
var hands = user.GetComponent<IHandsComponent>();
|
||||
var hands = eventArgs.User.GetComponent<IHandsComponent>();
|
||||
hands.PutInHand(this, hands.ActiveIndex, fallback: false);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -106,9 +106,9 @@ namespace Content.Server.GameObjects.Components.Power
|
||||
return net.Lack > 0 ? ApcExternalPowerState.Low : ApcExternalPowerState.Good;
|
||||
}
|
||||
|
||||
bool IAttackHand.Attackhand(IEntity user)
|
||||
bool IAttackHand.AttackHand(AttackHandEventArgs eventArgs)
|
||||
{
|
||||
if (!user.TryGetComponent(out IActorComponent actor))
|
||||
if (!eventArgs.User.TryGetComponent(out IActorComponent actor))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -55,16 +55,16 @@ namespace Content.Server.GameObjects.Components.Power
|
||||
return InsertBulb(eventArgs.AttackWith);
|
||||
}
|
||||
|
||||
bool IAttackHand.Attackhand(IEntity user)
|
||||
bool IAttackHand.AttackHand(AttackHandEventArgs eventArgs)
|
||||
{
|
||||
if (user.GetComponent<InventoryComponent>().GetSlotItem(EquipmentSlotDefines.Slots.GLOVES) != null)
|
||||
if (eventArgs.User.GetComponent<InventoryComponent>().GetSlotItem(EquipmentSlotDefines.Slots.GLOVES) != null)
|
||||
{
|
||||
EjectBulb(user);
|
||||
EjectBulb(eventArgs.User);
|
||||
UpdateLight();
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!user.TryGetComponent(out DamageableComponent damageableComponent)) return false;
|
||||
if (!eventArgs.User.TryGetComponent(out DamageableComponent damageableComponent)) return false;
|
||||
damageableComponent.TakeDamage(DamageType.Heat, 20);
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user