Remove some obsolete AppearanceComponent method usages (#13726)
This commit is contained in:
@@ -4,6 +4,7 @@ using Content.Shared.Explosion;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Throwing;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.Random;
|
||||
|
||||
@@ -15,6 +16,7 @@ public sealed class ClusterGrenadeSystem : EntitySystem
|
||||
[Dependency] private readonly SharedContainerSystem _container = default!;
|
||||
[Dependency] private readonly TriggerSystem _trigger = default!;
|
||||
[Dependency] private readonly ThrowingSystem _throwingSystem = default!;
|
||||
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -35,7 +37,7 @@ public sealed class ClusterGrenadeSystem : EntitySystem
|
||||
if (component.FillPrototype != null)
|
||||
{
|
||||
component.UnspawnedCount = Math.Max(0, component.MaxGrenades - component.GrenadesContainer.ContainedEntities.Count);
|
||||
UpdateAppearance(component);
|
||||
UpdateAppearance(uid, component);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +51,7 @@ public sealed class ClusterGrenadeSystem : EntitySystem
|
||||
return;
|
||||
|
||||
component.GrenadesContainer.Insert(args.Used);
|
||||
UpdateAppearance(component);
|
||||
UpdateAppearance(uid, component);
|
||||
args.Handled = true;
|
||||
}
|
||||
|
||||
@@ -122,10 +124,10 @@ public sealed class ClusterGrenadeSystem : EntitySystem
|
||||
return false;
|
||||
}
|
||||
|
||||
private void UpdateAppearance(ClusterGrenadeComponent component)
|
||||
private void UpdateAppearance(EntityUid uid, ClusterGrenadeComponent component)
|
||||
{
|
||||
if (!TryComp<AppearanceComponent>(component.Owner, out var appearance)) return;
|
||||
|
||||
appearance.SetData(ClusterGrenadeVisuals.GrenadesCounter, component.GrenadesContainer.ContainedEntities.Count + component.UnspawnedCount);
|
||||
_appearance.SetData(uid, ClusterGrenadeVisuals.GrenadesCounter, component.GrenadesContainer.ContainedEntities.Count + component.UnspawnedCount, appearance);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user