-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 <[email protected]>
- Loading branch information
Plykiya
and
plykiya
authored
Aug 9, 2024
1 parent
8a4ef69
commit b266c9b
Showing
25 changed files
with
507 additions
and
185 deletions.
There are no files selected for viewing
12 changes: 0 additions & 12 deletions
12
Content.Server/Clothing/Components/GloveHeatResistanceComponent.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
Content.Shared/Damage/Components/DamageOnAttackedComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
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 DamageOnAttackedComponent : 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="DamageOnAttackedProtectionComponent"/> | ||
/// </summary> | ||
[DataField] | ||
public bool IgnoreResistances = false; | ||
|
||
/// <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; | ||
} |
29 changes: 29 additions & 0 deletions
29
Content.Shared/Damage/Components/DamageOnAttackedProtectionComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using Content.Shared.Inventory; | ||
using Robust.Shared.GameStates; | ||
|
||
namespace Content.Shared.Damage.Components; | ||
|
||
|
||
/// <summary> | ||
/// This component is added to entities to protect them from being damaged | ||
/// when attacking objects with the <see cref="DamageOnAttackedComponent"/> | ||
/// If the entity has sufficient protection, the entity will take no damage. | ||
/// </summary> | ||
[RegisterComponent, NetworkedComponent] | ||
public sealed partial class DamageOnAttackedProtectionComponent : Component, IClothingSlots | ||
{ | ||
/// <summary> | ||
/// How much and what kind of damage to protect the user from | ||
/// when interacting with something with <see cref="DamageOnInteractComponent"/> | ||
/// </summary> | ||
[DataField(required: true)] | ||
public DamageModifierSet DamageProtection = default!; | ||
|
||
/// <summary> | ||
/// Only protects if the item is in the correct slot | ||
/// i.e. having gloves in your pocket doesn't protect you, it has to be on your hands | ||
/// Set slots to NONE if it works while you hold the item in your main hand | ||
/// </summary> | ||
[DataField] | ||
public SlotFlags Slots { get; set; } = SlotFlags.WITHOUT_POCKET; | ||
} |
47 changes: 47 additions & 0 deletions
47
Content.Shared/Damage/Components/DamageOnInteractComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
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; | ||
} |
29 changes: 29 additions & 0 deletions
29
Content.Shared/Damage/Components/DamageOnInteractProtectionComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using Content.Shared.Inventory; | ||
using Robust.Shared.GameStates; | ||
|
||
namespace Content.Shared.Damage.Components; | ||
|
||
|
||
/// <summary> | ||
/// This component is added to entities to protect them from being damaged | ||
/// when interacting with objects with the <see cref="DamageOnInteractComponent"/> | ||
/// If the entity has sufficient protection, interaction with the object is not cancelled. | ||
/// This allows the user to do things like remove a lightbulb. | ||
/// </summary> | ||
[RegisterComponent, NetworkedComponent] | ||
public sealed partial class DamageOnInteractProtectionComponent : Component, IClothingSlots | ||
{ | ||
/// <summary> | ||
/// How much and what kind of damage to protect the user from | ||
/// when interacting with something with <see cref="DamageOnInteractComponent"/> | ||
/// </summary> | ||
[DataField(required: true)] | ||
public DamageModifierSet DamageProtection = default!; | ||
|
||
/// <summary> | ||
/// Only protects if the item is in the correct slot | ||
/// i.e. having gloves in your pocket doesn't protect you, it has to be on your hands | ||
/// </summary> | ||
[DataField] | ||
public SlotFlags Slots { get; set; } = SlotFlags.GLOVES; | ||
} |
Oops, something went wrong.