Activate with an EventArg object for a parameter

This commit is contained in:
PrPleGoo
2019-04-05 19:44:32 +02:00
parent c90d54664b
commit 66344c3ac7
2 changed files with 9 additions and 4 deletions

View File

@@ -302,9 +302,9 @@ namespace Content.Server.GameObjects
} }
/// <inheritdoc /> /// <inheritdoc />
void IActivate.Activate(IEntity user) void IActivate.Activate(ActivateEventArgs eventArgs)
{ {
((IUse) this).UseEntity(new UseEntityEventArgs { User = user }); ((IUse) this).UseEntity(new UseEntityEventArgs { User = eventArgs.User });
} }
private void _ensureInitialCalculated() private void _ensureInitialCalculated()

View File

@@ -125,7 +125,12 @@ namespace Content.Server.GameObjects.EntitySystems
/// Called when this component is activated by another entity. /// Called when this component is activated by another entity.
/// </summary> /// </summary>
/// <param name="user">Entity that activated this component.</param> /// <param name="user">Entity that activated this component.</param>
void Activate(IEntity user); void Activate(ActivateEventArgs eventArgs);
}
public class ActivateEventArgs : EventArgs
{
public IEntity User { get; set; }
} }
/// <summary> /// <summary>
@@ -159,7 +164,7 @@ namespace Content.Server.GameObjects.EntitySystems
if (!playerEnt.Transform.GridPosition.InRange(used.Transform.GridPosition, INTERACTION_RANGE)) if (!playerEnt.Transform.GridPosition.InRange(used.Transform.GridPosition, INTERACTION_RANGE))
return; return;
activateComp.Activate(playerEnt); activateComp.Activate(new ActivateEventArgs { User = playerEnt });
} }
private void HandleUseItemInHand(ICommonSession session, GridCoordinates coords, EntityUid uid) private void HandleUseItemInHand(ICommonSession session, GridCoordinates coords, EntityUid uid)