Files
tbd-station-14/Content.Shared/Electrocution/Components/ElectrifiedComponent.cs
Fildrance 4bcf3c3c0e Station AI ability to electricute doors (#32012)
* Boom! Emergency access!

* Emergency access sound

* locale

* Updated sounds

* bleh

* Door electrify base

* feat: popups on attempt to activate AI action when wires cut

* refactor: use SharedApcPowerReceiverComponent to check if AI can interact with door

* refactor: added icon and sound for door overcharge

* meta.json should use tabs not spaces

* refactor: extracted sounds for airlock overcharge to static field in system

* refactor: cleanup, ScarKy0 mentions for resources

* refactor: removed unused textures

* feat: now notification is displayed when AI attempting to interact with door which have wire cut

* StationAiWhitelistComponent is properly gating  BUI OnMessageAttempt, SharedPowerReceiverSystem.IsPowered is now used to check if device powered

* refactor: use PlayLocal to play electrify sound only for AI player

* refactor: SetBoltsDown now uses TrySetBoltDown, checks for power.

* bolts now check for power using SharedPowerReceiverSystem

* electrify localization and louder electrify sounds

* extracted ShowDeviceNotRespondingPopup, reverted airlocks not opening/closing when ai wire was cut

* refactor: cleanup

* New sprites and fixes

* Copyright

* even more sprite changes

* refactore: cleanup, rename overcharge => electrify

---------

Co-authored-by: ScarKy0 <scarky0@onet.eu>
Co-authored-by: pa.pecherskij <pa.pecherskij@interfax.ru>
Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
2024-09-27 17:22:17 +10:00

132 lines
3.6 KiB
C#

using Robust.Shared.GameStates;
using Robust.Shared.Audio;
namespace Content.Shared.Electrocution;
/// <summary>
/// Component for things that shock users on touch.
/// </summary>
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
public sealed partial class ElectrifiedComponent : Component
{
[DataField, AutoNetworkedField]
public bool Enabled = true;
/// <summary>
/// Should player get damage on collide
/// </summary>
[DataField, AutoNetworkedField]
public bool OnBump = true;
/// <summary>
/// Should player get damage on attack
/// </summary>
[DataField, AutoNetworkedField]
public bool OnAttacked = true;
/// <summary>
/// When true - disables power if a window is present in the same tile
/// </summary>
[DataField, AutoNetworkedField]
public bool NoWindowInTile = false;
/// <summary>
/// Should player get damage on interact with empty hand
/// </summary>
[DataField, AutoNetworkedField]
public bool OnHandInteract = true;
/// <summary>
/// Should player get damage on interact while holding an object in their hand
/// </summary>
[DataField, AutoNetworkedField]
public bool OnInteractUsing = true;
/// <summary>
/// Indicates if the entity requires power to function
/// </summary>
[DataField, AutoNetworkedField]
public bool RequirePower = true;
/// <summary>
/// Indicates if the entity uses APC power
/// </summary>
[DataField, AutoNetworkedField]
public bool UsesApcPower = false;
/// <summary>
/// Identifier for the high voltage node.
/// </summary>
[DataField, AutoNetworkedField]
public string? HighVoltageNode;
/// <summary>
/// Identifier for the medium voltage node.
/// </summary>
[DataField, AutoNetworkedField]
public string? MediumVoltageNode;
/// <summary>
/// Identifier for the low voltage node.
/// </summary>
[DataField, AutoNetworkedField]
public string? LowVoltageNode;
/// <summary>
/// Damage multiplier for HV electrocution
/// </summary>
[DataField, AutoNetworkedField]
public float HighVoltageDamageMultiplier = 3f;
/// <summary>
/// Shock time multiplier for HV electrocution
/// </summary>
[DataField, AutoNetworkedField]
public float HighVoltageTimeMultiplier = 1.5f;
/// <summary>
/// Damage multiplier for MV electrocution
/// </summary>
[DataField, AutoNetworkedField]
public float MediumVoltageDamageMultiplier = 2f;
/// <summary>
/// Shock time multiplier for MV electrocution
/// </summary>
[DataField, AutoNetworkedField]
public float MediumVoltageTimeMultiplier = 1.25f;
[DataField, AutoNetworkedField]
public float ShockDamage = 7.5f;
/// <summary>
/// Shock time, in seconds.
/// </summary>
[DataField, AutoNetworkedField]
public float ShockTime = 8f;
[DataField, AutoNetworkedField]
public float SiemensCoefficient = 1f;
[DataField, AutoNetworkedField]
public SoundSpecifier ShockNoises = new SoundCollectionSpecifier("sparks");
[DataField, AutoNetworkedField]
public SoundPathSpecifier AirlockElectrifyDisabled = new("/Audio/Machines/airlock_electrify_on.ogg");
[DataField, AutoNetworkedField]
public SoundPathSpecifier AirlockElectrifyEnabled = new("/Audio/Machines/airlock_electrify_off.ogg");
[DataField, AutoNetworkedField]
public bool PlaySoundOnShock = true;
[DataField, AutoNetworkedField]
public float ShockVolume = 20;
[DataField, AutoNetworkedField]
public float Probability = 1f;
[DataField, AutoNetworkedField]
public bool IsWireCut = false;
}