Fix client visualizers

This commit is contained in:
Vera Aguilera Puerto
2021-12-08 13:11:49 +01:00
parent 0a71b62305
commit 420039f278
4 changed files with 10 additions and 21 deletions

View File

@@ -195,15 +195,12 @@ namespace Content.Client.Damage
public readonly string? Color; public readonly string? Color;
} }
public DamageVisualizer()
{
IoCManager.InjectDependencies(this);
}
public override void InitializeEntity(EntityUid entity) public override void InitializeEntity(EntityUid entity)
{ {
base.InitializeEntity(entity); base.InitializeEntity(entity);
IoCManager.InjectDependencies(this);
var damageData = _entityManager.EnsureComponent<DamageVisualizerDataComponent>(entity); var damageData = _entityManager.EnsureComponent<DamageVisualizerDataComponent>(entity);
VerifyVisualizerSetup(entity, damageData); VerifyVisualizerSetup(entity, damageData);
if (damageData.Valid) if (damageData.Valid)

View File

@@ -48,13 +48,10 @@ namespace Content.Client.Doors
private Animation OpenAnimation = default!; private Animation OpenAnimation = default!;
private Animation DenyAnimation = default!; private Animation DenyAnimation = default!;
public AirlockVisualizer()
{
IoCManager.InjectDependencies(this);
}
void ISerializationHooks.AfterDeserialization() void ISerializationHooks.AfterDeserialization()
{ {
IoCManager.InjectDependencies(this);
CloseAnimation = new Animation {Length = TimeSpan.FromSeconds(_delay)}; CloseAnimation = new Animation {Length = TimeSpan.FromSeconds(_delay)};
{ {
var flick = new AnimationTrackSpriteFlick(); var flick = new AnimationTrackSpriteFlick();

View File

@@ -25,7 +25,6 @@ namespace Content.Client.Lathe.Visualizers
public AutolatheVisualizer() public AutolatheVisualizer()
{ {
IoCManager.InjectDependencies(this);
_buildingAnimation = PopulateAnimation("building", "building_unlit", 0.5f); _buildingAnimation = PopulateAnimation("building", "building_unlit", 0.5f);
_insertingMetalAnimation = PopulateAnimation("inserting_metal", "inserting_unlit", 0.5f); _insertingMetalAnimation = PopulateAnimation("inserting_metal", "inserting_unlit", 0.5f);
_insertingGlassAnimation = PopulateAnimation("inserting_glass", "inserting_unlit", 0.5f); _insertingGlassAnimation = PopulateAnimation("inserting_glass", "inserting_unlit", 0.5f);
@@ -53,10 +52,9 @@ namespace Content.Client.Lathe.Visualizers
public override void InitializeEntity(EntityUid entity) public override void InitializeEntity(EntityUid entity)
{ {
if (!_entMan.HasComponent<AnimationPlayerComponent>(entity)) IoCManager.InjectDependencies(this);
{
_entMan.AddComponent<AnimationPlayerComponent>(entity); _entMan.EnsureComponent<AnimationPlayerComponent>(entity);
}
} }
public override void OnChangeData(AppearanceComponent component) public override void OnChangeData(AppearanceComponent component)

View File

@@ -25,8 +25,6 @@ namespace Content.Client.Lathe.Visualizers
public ProtolatheVisualizer() public ProtolatheVisualizer()
{ {
IoCManager.InjectDependencies(this);
_buildingAnimation = PopulateAnimation("building", "building_unlit", 0.8f); _buildingAnimation = PopulateAnimation("building", "building_unlit", 0.8f);
_insertingMetalAnimation = PopulateAnimation("inserting_metal", "inserting_unlit", 0.8f); _insertingMetalAnimation = PopulateAnimation("inserting_metal", "inserting_unlit", 0.8f);
_insertingGlassAnimation = PopulateAnimation("inserting_glass", "inserting_unlit", 0.8f); _insertingGlassAnimation = PopulateAnimation("inserting_glass", "inserting_unlit", 0.8f);
@@ -54,10 +52,9 @@ namespace Content.Client.Lathe.Visualizers
public override void InitializeEntity(EntityUid entity) public override void InitializeEntity(EntityUid entity)
{ {
if (!_entMan.HasComponent<AnimationPlayerComponent>(entity)) IoCManager.InjectDependencies(this);
{
_entMan.AddComponent<AnimationPlayerComponent>(entity); _entMan.EnsureComponent<AnimationPlayerComponent>(entity);
}
} }
public override void OnChangeData(AppearanceComponent component) public override void OnChangeData(AppearanceComponent component)