DamagedByFlashingSystem.cs 754 B

12345678910111213141516171819202122
  1. using Content.Server.Flash.Components;
  2. using Content.Shared.Damage;
  3. namespace Content.Server.Flash;
  4. public sealed class DamagedByFlashingSystem : EntitySystem
  5. {
  6. [Dependency] private readonly DamageableSystem _damageable = default!;
  7. public override void Initialize()
  8. {
  9. base.Initialize();
  10. SubscribeLocalEvent<DamagedByFlashingComponent, FlashAttemptEvent>(OnFlashAttempt);
  11. }
  12. private void OnFlashAttempt(Entity<DamagedByFlashingComponent> ent, ref FlashAttemptEvent args)
  13. {
  14. _damageable.TryChangeDamage(ent, ent.Comp.FlashDamage);
  15. //TODO: It would be more logical if different flashes had different power,
  16. //and the damage would be inflicted depending on the strength of the flash.
  17. }
  18. }