24 lines
746 B
C#
24 lines
746 B
C#
using Content.Server.Damage.Components;
|
|
using Content.Shared.Damage.Components;
|
|
using Content.Shared.Throwing;
|
|
using Robust.Shared.GameObjects;
|
|
|
|
namespace Content.Server.Damage
|
|
{
|
|
public class DamageOtherOnHitSystem : EntitySystem
|
|
{
|
|
public override void Initialize()
|
|
{
|
|
SubscribeLocalEvent<DamageOtherOnHitComponent, ThrowDoHitEvent>(OnDoHit);
|
|
}
|
|
|
|
private void OnDoHit(EntityUid uid, DamageOtherOnHitComponent component, ThrowDoHitEvent args)
|
|
{
|
|
if (!args.Target.TryGetComponent(out IDamageableComponent? damageable))
|
|
return;
|
|
|
|
damageable.ChangeDamage(component.DamageType, component.Amount, component.IgnoreResistances, args.User);
|
|
}
|
|
}
|
|
}
|