AttackBy with an EventArg object for a parameter
This commit is contained in:
@@ -23,7 +23,7 @@ namespace Content.Server.GameObjects
|
||||
/// <summary>
|
||||
/// Storage component for containing entities within this one, matches a UI on the client which shows stored entities
|
||||
/// </summary>
|
||||
public class ServerStorageComponent : SharedStorageComponent, IAttackby, IUse, IActivate
|
||||
public class ServerStorageComponent : SharedStorageComponent, IAttackBy, IUse, IActivate
|
||||
{
|
||||
private Container storage;
|
||||
|
||||
@@ -131,25 +131,25 @@ namespace Content.Server.GameObjects
|
||||
/// <param name="user"></param>
|
||||
/// <param name="attackwith"></param>
|
||||
/// <returns></returns>
|
||||
bool IAttackby.Attackby(IEntity user, IEntity attackwith)
|
||||
bool IAttackBy.AttackBy(AttackByEventArgs eventArgs)
|
||||
{
|
||||
_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;
|
||||
|
||||
//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 (Insert(attackwith))
|
||||
if (Insert(eventArgs.AttackWith))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Owner.PopupMessage(user, "Can't insert.");
|
||||
Owner.PopupMessage(eventArgs.User, "Can't insert.");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -324,5 +324,10 @@ namespace Content.Server.GameObjects
|
||||
|
||||
_storageInitialCalculated = true;
|
||||
}
|
||||
|
||||
public bool Attackby(AttackByEventArgs eventArgs)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user