Activate with an EventArg object for a parameter
This commit is contained in:
@@ -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()
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user