Remove some obsolete AppearanceComponent method usages (#13726)

This commit is contained in:
Visne
2023-02-02 17:34:53 +01:00
committed by GitHub
parent 23b90de34d
commit 5a5a3afbb1
111 changed files with 428 additions and 349 deletions

View File

@@ -1,5 +1,4 @@
using System.Linq;
using System.Runtime.CompilerServices;
using Content.Server.Audio;
using Content.Server.Construction;
using Content.Server.Power.Components;
@@ -14,10 +13,8 @@ using Content.Shared.Shuttles.Components;
using Content.Shared.Temperature;
using Robust.Server.GameObjects;
using Robust.Shared.Map;
using Robust.Shared.Physics;
using Robust.Shared.Physics.Collision.Shapes;
using Robust.Shared.Physics.Components;
using Robust.Shared.Physics.Dynamics;
using Robust.Shared.Physics.Events;
using Robust.Shared.Physics.Systems;
using Robust.Shared.Utility;
@@ -26,11 +23,12 @@ namespace Content.Server.Shuttles.Systems
{
public sealed class ThrusterSystem : EntitySystem
{
[Robust.Shared.IoC.Dependency] private readonly IMapManager _mapManager = default!;
[Robust.Shared.IoC.Dependency] private readonly ITileDefinitionManager _tileDefManager = default!;
[Robust.Shared.IoC.Dependency] private readonly AmbientSoundSystem _ambient = default!;
[Robust.Shared.IoC.Dependency] private readonly FixtureSystem _fixtureSystem = default!;
[Robust.Shared.IoC.Dependency] private readonly DamageableSystem _damageable = default!;
[Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly ITileDefinitionManager _tileDefManager = default!;
[Dependency] private readonly AmbientSoundSystem _ambient = default!;
[Dependency] private readonly FixtureSystem _fixtureSystem = default!;
[Dependency] private readonly DamageableSystem _damageable = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
// Essentially whenever thruster enables we update the shuttle's available impulses which are used for movement.
// This is done for each direction available.
@@ -276,9 +274,9 @@ namespace Content.Server.Shuttles.Systems
throw new ArgumentOutOfRangeException();
}
if (EntityManager.TryGetComponent(uid, out AppearanceComponent? appearanceComponent))
if (EntityManager.TryGetComponent(uid, out AppearanceComponent? appearance))
{
appearanceComponent.SetData(ThrusterVisualState.State, true);
_appearance.SetData(uid, ThrusterVisualState.State, true, appearance);
}
if (EntityManager.TryGetComponent(uid, out PointLightComponent? pointLightComponent))
@@ -329,9 +327,9 @@ namespace Content.Server.Shuttles.Systems
throw new ArgumentOutOfRangeException();
}
if (EntityManager.TryGetComponent(uid, out AppearanceComponent? appearanceComponent))
if (EntityManager.TryGetComponent(uid, out AppearanceComponent? appearance))
{
appearanceComponent.SetData(ThrusterVisualState.State, false);
_appearance.SetData(uid, ThrusterVisualState.State, false, appearance);
}
if (EntityManager.TryGetComponent(uid, out PointLightComponent? pointLightComponent))
@@ -439,11 +437,8 @@ namespace Content.Server.Shuttles.Systems
foreach (var comp in component.LinearThrusters[index])
{
if (!EntityManager.TryGetComponent((comp).Owner, out AppearanceComponent? appearanceComponent))
continue;
comp.Firing = true;
appearanceComponent.SetData(ThrusterVisualState.Thrusting, true);
_appearance.SetData(comp.Owner, ThrusterVisualState.Thrusting, true);
}
}
@@ -460,11 +455,8 @@ namespace Content.Server.Shuttles.Systems
foreach (var comp in component.LinearThrusters[index])
{
if (!EntityManager.TryGetComponent((comp).Owner, out AppearanceComponent? appearanceComponent))
continue;
comp.Firing = false;
appearanceComponent.SetData(ThrusterVisualState.Thrusting, false);
_appearance.SetData(comp.Owner, ThrusterVisualState.Thrusting, false);
}
}
@@ -484,22 +476,16 @@ namespace Content.Server.Shuttles.Systems
{
foreach (var comp in component.AngularThrusters)
{
if (!EntityManager.TryGetComponent((comp).Owner, out AppearanceComponent? appearanceComponent))
continue;
comp.Firing = true;
appearanceComponent.SetData(ThrusterVisualState.Thrusting, true);
_appearance.SetData(comp.Owner, ThrusterVisualState.Thrusting, true);
}
}
else
{
foreach (var comp in component.AngularThrusters)
{
if (!EntityManager.TryGetComponent((comp).Owner, out AppearanceComponent? appearanceComponent))
continue;
comp.Firing = false;
appearanceComponent.SetData(ThrusterVisualState.Thrusting, false);
_appearance.SetData(comp.Owner, ThrusterVisualState.Thrusting, false);
}
}
}
@@ -518,7 +504,6 @@ namespace Content.Server.Shuttles.Systems
#endregion
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private int GetFlagIndex(DirectionFlag flag)
{
return (int) Math.Log2((int) flag);