Predict Flashes (#37640)

Co-authored-by: ScarKy0 <scarky0@onet.eu>
This commit is contained in:
slarticodefast
2025-06-23 13:32:56 +02:00
committed by GitHub
parent 7e77ee0cd2
commit b83d00b792
23 changed files with 501 additions and 386 deletions

View File

@@ -0,0 +1,26 @@
using Content.Shared.Flash.Components;
using Content.Shared.Damage;
namespace Content.Shared.Flash;
public sealed class DamagedByFlashingSystem : EntitySystem
{
[Dependency] private readonly DamageableSystem _damageable = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<DamagedByFlashingComponent, FlashAttemptEvent>(OnFlashAttempt);
}
// TODO: Attempt events should not be doing state changes. But using AfterFlashedEvent does not work because this entity cannot get the status effect.
// Best wait for Ed's status effect system rewrite.
private void OnFlashAttempt(Entity<DamagedByFlashingComponent> ent, ref FlashAttemptEvent args)
{
_damageable.TryChangeDamage(ent, ent.Comp.FlashDamage);
// TODO: It would be more logical if different flashes had different power,
// and the damage would be inflicted depending on the strength of the flash.
}
}