1
0

DamageOnLandSystem.cs 781 B

12345678910111213141516171819202122232425
  1. using Content.Server.Damage.Components;
  2. using Content.Shared.Damage;
  3. using Content.Shared.Throwing;
  4. namespace Content.Server.Damage.Systems
  5. {
  6. /// <summary>
  7. /// Damages the thrown item when it lands.
  8. /// </summary>
  9. public sealed class DamageOnLandSystem : EntitySystem
  10. {
  11. [Dependency] private readonly DamageableSystem _damageableSystem = default!;
  12. public override void Initialize()
  13. {
  14. base.Initialize();
  15. SubscribeLocalEvent<DamageOnLandComponent, LandEvent>(DamageOnLand);
  16. }
  17. private void DamageOnLand(EntityUid uid, DamageOnLandComponent component, ref LandEvent args)
  18. {
  19. _damageableSystem.TryChangeDamage(uid, component.Damage, component.IgnoreResistances);
  20. }
  21. }
  22. }