let FlashArea be called from shared (#30343)

* let FlashArea be called from shared

* untroll

---------

Co-authored-by: deltanedas <@deltanedas:kde.org>
Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
deltanedas
2024-09-18 23:58:10 +00:00
committed by GitHub
parent e6e166405d
commit 84062da128
3 changed files with 13 additions and 6 deletions

View File

@@ -16,6 +16,7 @@ namespace Content.Client.Flash
[Dependency] private readonly IPlayerManager _playerManager = default!; [Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly IGameTiming _timing = default!; [Dependency] private readonly IGameTiming _timing = default!;
private readonly SharedFlashSystem _flash;
private readonly StatusEffectsSystem _statusSys; private readonly StatusEffectsSystem _statusSys;
public override OverlaySpace Space => OverlaySpace.WorldSpace; public override OverlaySpace Space => OverlaySpace.WorldSpace;
@@ -27,6 +28,7 @@ namespace Content.Client.Flash
{ {
IoCManager.InjectDependencies(this); IoCManager.InjectDependencies(this);
_shader = _prototypeManager.Index<ShaderPrototype>("FlashedEffect").InstanceUnique(); _shader = _prototypeManager.Index<ShaderPrototype>("FlashedEffect").InstanceUnique();
_flash = _entityManager.System<SharedFlashSystem>();
_statusSys = _entityManager.System<StatusEffectsSystem>(); _statusSys = _entityManager.System<StatusEffectsSystem>();
} }
@@ -41,7 +43,7 @@ namespace Content.Client.Flash
|| !_entityManager.TryGetComponent<StatusEffectsComponent>(playerEntity, out var status)) || !_entityManager.TryGetComponent<StatusEffectsComponent>(playerEntity, out var status))
return; return;
if (!_statusSys.TryGetTime(playerEntity.Value, SharedFlashSystem.FlashedKey, out var time, status)) if (!_statusSys.TryGetTime(playerEntity.Value, _flash.FlashedKey, out var time, status))
return; return;
var curTime = _timing.CurTime; var curTime = _timing.CurTime;

View File

@@ -152,7 +152,7 @@ namespace Content.Server.Flash
} }
} }
public void FlashArea(Entity<FlashComponent?> source, EntityUid? user, float range, float duration, float slowTo = 0.8f, bool displayPopup = false, float probability = 1f, SoundSpecifier? sound = null) public override void FlashArea(Entity<FlashComponent?> source, EntityUid? user, float range, float duration, float slowTo = 0.8f, bool displayPopup = false, float probability = 1f, SoundSpecifier? sound = null)
{ {
var transform = Transform(source); var transform = Transform(source);
var mapPosition = _transform.GetMapCoordinates(transform); var mapPosition = _transform.GetMapCoordinates(transform);

View File

@@ -1,10 +1,15 @@
using Content.Shared.Flash.Components;
using Content.Shared.StatusEffect; using Content.Shared.StatusEffect;
using Robust.Shared.Audio;
using Robust.Shared.Prototypes;
namespace Content.Shared.Flash namespace Content.Shared.Flash;
public abstract class SharedFlashSystem : EntitySystem
{ {
public abstract class SharedFlashSystem : EntitySystem public ProtoId<StatusEffectPrototype> FlashedKey = "Flashed";
public virtual void FlashArea(Entity<FlashComponent?> source, EntityUid? user, float range, float duration, float slowTo = 0.8f, bool displayPopup = false, float probability = 1f, SoundSpecifier? sound = null)
{ {
[ValidatePrototypeId<StatusEffectPrototype>]
public const string FlashedKey = "Flashed";
} }
} }