Adds IThrowCollide, Creaming people with cream pies and tactical stun baton throws (#2122)

This commit is contained in:
Víctor Aguilera Puerto
2020-09-22 15:34:30 +02:00
committed by GitHub
parent db32180942
commit 4c34a12c67
33 changed files with 285 additions and 2 deletions

View File

@@ -625,6 +625,32 @@ namespace Content.Server.GameObjects.EntitySystems.Click
}
}
/// <summary>
/// Calls ThrowCollide on all components that implement the IThrowCollide interface
/// on a thrown entity and the target entity it hit.
/// </summary>
public void ThrowCollideInteraction(IEntity user, IEntity thrown, IEntity target, EntityCoordinates location)
{
var collideMsg = new ThrowCollideMessage(user, thrown, target, location);
RaiseLocalEvent(collideMsg);
if (collideMsg.Handled)
{
return;
}
var eventArgs = new ThrowCollideEventArgs(user, thrown, target, location);
foreach (var comp in thrown.GetAllComponents<IThrowCollide>().ToArray())
{
comp.DoHit(eventArgs);
}
foreach (var comp in target.GetAllComponents<IThrowCollide>().ToArray())
{
comp.HitBy(eventArgs);
}
}
/// <summary>
/// Calls Equipped on all components that implement the IEquipped interface
/// on an entity that has been equipped.