removes componentdependencies (#6160)
This commit is contained in:
@@ -23,9 +23,9 @@ namespace Content.Server.Arcade.Components
|
||||
|
||||
public override string Name => "BlockGameArcade";
|
||||
|
||||
[ComponentDependency] private readonly ApcPowerReceiverComponent? _powerReceiverComponent = default!;
|
||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||
|
||||
private bool Powered => _powerReceiverComponent?.Powered ?? false;
|
||||
private bool Powered => _entityManager.TryGetComponent<ApcPowerReceiverComponent>(Owner, out var powerReceiverComponent) && powerReceiverComponent.Powered;
|
||||
private BoundUserInterface? UserInterface => Owner.GetUIOrNull(BlockGameUiKey.Key);
|
||||
|
||||
private BlockGame? _game;
|
||||
|
||||
@@ -30,10 +30,8 @@ namespace Content.Server.Arcade.Components
|
||||
{
|
||||
[Dependency] private readonly IRobustRandom _random = null!;
|
||||
|
||||
[ComponentDependency] private readonly ApcPowerReceiverComponent? _powerReceiverComponent = default!;
|
||||
[ComponentDependency] private readonly WiresComponent? _wiresComponent = default!;
|
||||
|
||||
private bool Powered => _powerReceiverComponent != null && _powerReceiverComponent.Powered;
|
||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||
private bool Powered => _entityManager.TryGetComponent<ApcPowerReceiverComponent>(Owner, out var powerReceiverComponent) && powerReceiverComponent.Powered;
|
||||
|
||||
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(SpaceVillainArcadeUiKey.Key);
|
||||
[ViewVariables] private bool _overflowFlag;
|
||||
@@ -84,9 +82,9 @@ namespace Content.Server.Arcade.Components
|
||||
|
||||
_game ??= new SpaceVillainGame(this);
|
||||
|
||||
if (_wiresComponent?.IsPanelOpen == true)
|
||||
if (_entityManager.TryGetComponent<WiresComponent>(Owner, out var wiresComponent) && wiresComponent.IsPanelOpen)
|
||||
{
|
||||
_wiresComponent.OpenInterface(actor.PlayerSession);
|
||||
wiresComponent.OpenInterface(actor.PlayerSession);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -205,13 +203,15 @@ namespace Content.Server.Arcade.Components
|
||||
|
||||
public void IndicatorUpdate()
|
||||
{
|
||||
_wiresComponent?.SetStatus(Indicators.HealthManager,
|
||||
if (!_entityManager.TryGetComponent<WiresComponent>(Owner, out var wiresComponent)) return;
|
||||
|
||||
wiresComponent.SetStatus(Indicators.HealthManager,
|
||||
new SharedWiresComponent.StatusLightData(Color.Purple,
|
||||
_playerInvincibilityFlag || _enemyInvincibilityFlag
|
||||
? SharedWiresComponent.StatusLightState.BlinkingSlow
|
||||
: SharedWiresComponent.StatusLightState.On,
|
||||
"MNGR"));
|
||||
_wiresComponent?.SetStatus(Indicators.HealthLimiter,
|
||||
wiresComponent.SetStatus(Indicators.HealthLimiter,
|
||||
new SharedWiresComponent.StatusLightData(Color.Red,
|
||||
_overflowFlag
|
||||
? SharedWiresComponent.StatusLightState.BlinkingSlow
|
||||
|
||||
Reference in New Issue
Block a user