And a bunch more.

This commit is contained in:
Vera Aguilera Puerto
2021-12-08 12:09:43 +01:00
parent 9b9babd429
commit 680ad72939
30 changed files with 176 additions and 125 deletions

View File

@@ -12,6 +12,8 @@ namespace Content.Client.Lathe.Visualizers
[UsedImplicitly]
public class ProtolatheVisualizer : AppearanceVisualizer
{
[Dependency] private readonly IEntityManager _entMan = default!;
private const string AnimationKey = "inserting_animation";
private Animation _buildingAnimation;
@@ -23,6 +25,8 @@ namespace Content.Client.Lathe.Visualizers
public ProtolatheVisualizer()
{
IoCManager.InjectDependencies(this);
_buildingAnimation = PopulateAnimation("building", "building_unlit", 0.8f);
_insertingMetalAnimation = PopulateAnimation("inserting_metal", "inserting_unlit", 0.8f);
_insertingGlassAnimation = PopulateAnimation("inserting_glass", "inserting_unlit", 0.8f);
@@ -50,9 +54,9 @@ namespace Content.Client.Lathe.Visualizers
public override void InitializeEntity(EntityUid entity)
{
if (!IoCManager.Resolve<IEntityManager>().HasComponent<AnimationPlayerComponent>(entity))
if (!_entMan.HasComponent<AnimationPlayerComponent>(entity))
{
IoCManager.Resolve<IEntityManager>().AddComponent<AnimationPlayerComponent>(entity);
_entMan.AddComponent<AnimationPlayerComponent>(entity);
}
}
@@ -60,8 +64,8 @@ namespace Content.Client.Lathe.Visualizers
{
base.OnChangeData(component);
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<ISpriteComponent>(component.Owner);
var animPlayer = IoCManager.Resolve<IEntityManager>().GetComponent<AnimationPlayerComponent>(component.Owner);
var sprite = _entMan.GetComponent<ISpriteComponent>(component.Owner);
var animPlayer = _entMan.GetComponent<AnimationPlayerComponent>(component.Owner);
if (!component.TryGetData(PowerDeviceVisuals.VisualState, out LatheVisualState state))
{
state = LatheVisualState.Idle;