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

@@ -28,7 +28,7 @@ using Robust.Shared.ViewVariables;
namespace Content.Server.GameObjects.Components.Weapon.Melee
{
[RegisterComponent]
public class StunbatonComponent : MeleeWeaponComponent, IUse, IExamine, IMapInit, IInteractUsing
public class StunbatonComponent : MeleeWeaponComponent, IUse, IExamine, IMapInit, IInteractUsing, IThrowCollide
{
[Dependency] private readonly IRobustRandom _robustRandom = default!;
@@ -282,5 +282,15 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
component.EjectCell(user);
}
}
public void DoHit(ThrowCollideEventArgs eventArgs)
{
if (!Activated || Cell == null || !Cell.TryUseCharge(EnergyPerUse) || !eventArgs.Target.TryGetComponent(out StunnableComponent stunnable))
return;
EntitySystem.Get<AudioSystem>().PlayAtCoords("/Audio/Weapons/egloves.ogg", Owner.Transform.Coordinates, AudioHelpers.WithVariation(0.25f));
stunnable.Paralyze(_paralyzeTime);
}
}
}