2023-06-15 04:25:25 -07:00
|
|
|
using Content.Server.Arcade.SpaceVillain;
|
2022-05-05 19:35:06 -07:00
|
|
|
using Content.Server.Wires;
|
|
|
|
|
using Content.Shared.Arcade;
|
|
|
|
|
using Content.Shared.Wires;
|
|
|
|
|
|
|
|
|
|
namespace Content.Server.Arcade;
|
|
|
|
|
|
2023-08-22 18:14:33 -07:00
|
|
|
public sealed partial class ArcadePlayerInvincibleWireAction : BaseToggleWireAction
|
2022-05-05 19:35:06 -07:00
|
|
|
{
|
2023-01-21 12:51:02 +13:00
|
|
|
public override string Name { get; set; } = "wire-name-arcade-invincible";
|
|
|
|
|
|
|
|
|
|
public override Color Color { get; set; } = Color.Purple;
|
2022-05-05 19:35:06 -07:00
|
|
|
|
|
|
|
|
public override object? StatusKey { get; } = SharedSpaceVillainArcadeComponent.Indicators.HealthManager;
|
|
|
|
|
|
|
|
|
|
public override void ToggleValue(EntityUid owner, bool setting)
|
|
|
|
|
{
|
2023-06-15 04:25:25 -07:00
|
|
|
if (EntityManager.TryGetComponent<SpaceVillainArcadeComponent>(owner, out var arcade)
|
|
|
|
|
&& arcade.Game != null)
|
2022-05-05 19:35:06 -07:00
|
|
|
{
|
2023-06-15 04:25:25 -07:00
|
|
|
arcade.Game.PlayerChar.Invincible = !setting;
|
2022-05-05 19:35:06 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override bool GetValue(EntityUid owner)
|
|
|
|
|
{
|
|
|
|
|
return EntityManager.TryGetComponent<SpaceVillainArcadeComponent>(owner, out var arcade)
|
2023-06-15 04:25:25 -07:00
|
|
|
&& arcade.Game != null
|
|
|
|
|
&& !arcade.Game.PlayerChar.Invincible;
|
2022-05-05 19:35:06 -07:00
|
|
|
}
|
|
|
|
|
|
2023-01-21 12:51:02 +13:00
|
|
|
public override StatusLightState? GetLightState(Wire wire)
|
2022-05-05 19:35:06 -07:00
|
|
|
{
|
2023-06-15 04:25:25 -07:00
|
|
|
if (EntityManager.TryGetComponent<SpaceVillainArcadeComponent>(wire.Owner, out var arcade)
|
|
|
|
|
&& arcade.Game != null)
|
2022-05-05 19:35:06 -07:00
|
|
|
{
|
2023-06-15 04:25:25 -07:00
|
|
|
return arcade.Game.PlayerChar.Invincible || arcade.Game.VillainChar.Invincible
|
2022-05-05 19:35:06 -07:00
|
|
|
? StatusLightState.BlinkingSlow
|
|
|
|
|
: StatusLightState.On;
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-21 12:51:02 +13:00
|
|
|
return StatusLightState.Off;
|
2022-05-05 19:35:06 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-08-22 18:14:33 -07:00
|
|
|
public sealed partial class ArcadeEnemyInvincibleWireAction : BaseToggleWireAction
|
2022-05-05 19:35:06 -07:00
|
|
|
{
|
2023-01-21 12:51:02 +13:00
|
|
|
public override string Name { get; set; } = "wire-name-player-invincible";
|
|
|
|
|
public override Color Color { get; set; } = Color.Purple;
|
|
|
|
|
|
2022-05-05 19:35:06 -07:00
|
|
|
public override object? StatusKey { get; } = null;
|
|
|
|
|
|
|
|
|
|
public override void ToggleValue(EntityUid owner, bool setting)
|
|
|
|
|
{
|
2023-06-15 04:25:25 -07:00
|
|
|
if (EntityManager.TryGetComponent<SpaceVillainArcadeComponent>(owner, out var arcade)
|
|
|
|
|
&& arcade.Game != null)
|
2022-05-05 19:35:06 -07:00
|
|
|
{
|
2023-06-15 04:25:25 -07:00
|
|
|
arcade.Game.VillainChar.Invincible = !setting;
|
2022-05-05 19:35:06 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override bool GetValue(EntityUid owner)
|
|
|
|
|
{
|
|
|
|
|
return EntityManager.TryGetComponent<SpaceVillainArcadeComponent>(owner, out var arcade)
|
2023-06-15 04:25:25 -07:00
|
|
|
&& arcade.Game != null
|
|
|
|
|
&& !arcade.Game.VillainChar.Invincible;
|
2022-05-05 19:35:06 -07:00
|
|
|
}
|
|
|
|
|
|
2023-06-15 04:25:25 -07:00
|
|
|
public override StatusLightData? GetStatusLightData(Wire wire)
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
}
|
2022-05-05 19:35:06 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public enum ArcadeInvincibilityWireActionKeys : short
|
|
|
|
|
{
|
|
|
|
|
Player,
|
|
|
|
|
Enemy
|
|
|
|
|
}
|