Files
tbd-station-14/Content.Shared/Damage/Components/DamageOnInteractComponent.cs
Plykiya b266c9b545 Create Generic DamageOnInteract/Attacked Comps/Systems (#30244)
* Everything but the submodule

* stuff I forgot

* heat

* missed lights

* behonky

* LocId

* I guess it was a skill issue?

* predicted audio

* It works with lights now

* Borg equality

* Gorilla gauntlet grants protection from anomaly returned damage when attacking it

* woops, there we go

* NONE

* Use DamageModifierSets, remove Behonker damage

* Reviews dealt with

---------

Co-authored-by: plykiya <plykiya@protonmail.com>
2024-08-09 15:32:41 +10:00

48 lines
1.6 KiB
C#

using Robust.Shared.Audio;
using Robust.Shared.GameStates;
namespace Content.Shared.Damage.Components;
/// <summary>
/// This component is added to entities that you want to damage the player
/// if the player interacts with it. For example, if a player tries touching
/// a hot light bulb or an anomaly. This damage can be cancelled if the user
/// has a component that protects them from this.
/// </summary>
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
public sealed partial class DamageOnInteractComponent : Component
{
/// <summary>
/// How much damage to apply to the person making contact
/// </summary>
[DataField(required: true), AutoNetworkedField]
public DamageSpecifier Damage = default!;
/// <summary>
/// Whether the damage should be resisted by a person's armor values
/// and the <see cref="DamageOnInteractProtectionComponent"/>
/// </summary>
[DataField]
public bool IgnoreResistances;
/// <summary>
/// What kind of localized text should pop up when they interact with the entity
/// </summary>
[DataField]
public LocId? PopupText;
/// <summary>
/// The sound that should be made when interacting with the entity
/// </summary>
[DataField]
public SoundSpecifier InteractSound = new SoundPathSpecifier("/Audio/Effects/lightburn.ogg");
/// <summary>
/// Generic boolean to toggle the damage application on and off
/// This is useful for things that can be toggled on or off, like a stovetop
/// </summary>
[DataField, AutoNetworkedField]
public bool IsDamageActive = true;
}