2021-06-09 22:19:39 +02:00
|
|
|
using Content.Shared.Explosion;
|
2021-01-18 17:16:34 +07:00
|
|
|
using JetBrains.Annotations;
|
|
|
|
|
using Robust.Client.GameObjects;
|
2021-11-22 23:22:59 -08:00
|
|
|
using Robust.Shared.GameObjects;
|
2021-12-05 18:09:01 +01:00
|
|
|
using Robust.Shared.IoC;
|
2021-03-05 01:08:38 +01:00
|
|
|
using Robust.Shared.Serialization.Manager.Attributes;
|
2021-01-18 17:16:34 +07:00
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
namespace Content.Client.Explosion
|
2021-01-18 17:16:34 +07:00
|
|
|
{
|
|
|
|
|
[UsedImplicitly]
|
|
|
|
|
// ReSharper disable once InconsistentNaming
|
2022-02-16 00:23:23 -07:00
|
|
|
public sealed class ClusterGrenadeVisualizer : AppearanceVisualizer
|
2021-01-18 17:16:34 +07:00
|
|
|
{
|
2021-03-05 01:08:38 +01:00
|
|
|
[DataField("state")]
|
2021-03-10 14:48:29 +01:00
|
|
|
private string? _state;
|
2021-01-18 17:16:34 +07:00
|
|
|
|
2022-08-14 07:28:34 +02:00
|
|
|
[Obsolete("Subscribe to AppearanceChangeEvent instead.")]
|
2021-01-18 17:16:34 +07:00
|
|
|
public override void OnChangeData(AppearanceComponent component)
|
|
|
|
|
{
|
|
|
|
|
base.OnChangeData(component);
|
|
|
|
|
|
2021-12-05 18:09:01 +01:00
|
|
|
var entities = IoCManager.Resolve<IEntityManager>();
|
|
|
|
|
if (!entities.TryGetComponent<ISpriteComponent>(component.Owner, out var sprite))
|
2021-01-18 17:16:34 +07:00
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2022-02-02 18:04:38 +11:00
|
|
|
if (component.TryGetData(ClusterGrenadeVisuals.GrenadesCounter, out int grenadesCounter))
|
2021-01-18 17:16:34 +07:00
|
|
|
{
|
|
|
|
|
sprite.LayerSetState(0, $"{_state}-{grenadesCounter}");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|