Skip to content

Commit

Permalink
Reviews dealt with
Browse files Browse the repository at this point in the history
  • Loading branch information
plykiya committed Aug 4, 2024
1 parent 99d8997 commit 6ce2670
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public sealed partial class DamageOnAttackedComponent : Component
/// <summary>
/// How much damage to apply to the person making contact
/// </summary>
[DataField, AutoNetworkedField]
[DataField(required: true), AutoNetworkedField]
public DamageSpecifier Damage = default!;

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,14 @@ namespace Content.Shared.Damage.Components;
/// 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]
[DataField(required: true)]
public DamageModifierSet DamageProtection = default!;

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public sealed partial class DamageOnInteractComponent : Component
/// <summary>
/// How much damage to apply to the person making contact
/// </summary>
[DataField, AutoNetworkedField]
[DataField(required: true), AutoNetworkedField]
public DamageSpecifier Damage = default!;

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public sealed partial class DamageOnInteractProtectionComponent : Component, ICl
/// How much and what kind of damage to protect the user from
/// when interacting with something with <see cref="DamageOnInteractComponent"/>
/// </summary>
[DataField]
[DataField(required: true)]
public DamageModifierSet DamageProtection = default!;

/// <summary>
Expand Down
7 changes: 0 additions & 7 deletions Content.Shared/Damage/Systems/DamageOnAttackedSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,8 @@ private void OnAttacked(Entity<DamageOnAttackedComponent> entity, ref AttackedEv
if (totalDamage != null && totalDamage.AnyPositive())
{
_adminLogger.Add(LogType.Damaged, $"{ToPrettyString(args.User):user} injured themselves by attacking {ToPrettyString(entity):target} and received {totalDamage.GetTotal():damage} damage");

if (!_gameTiming.IsFirstTimePredicted)
return;

_audioSystem.PlayPredicted(entity.Comp.InteractSound, entity, args.User);

if (_net.IsServer)
return;

if (entity.Comp.PopupText != null)
_popupSystem.PopupClient(Loc.GetString(entity.Comp.PopupText), args.User, args.User);

Expand Down
9 changes: 1 addition & 8 deletions Content.Shared/Damage/Systems/DamageOnInteractSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,10 @@ private void OnHandInteract(Entity<DamageOnInteractComponent> entity, ref Intera

if (totalDamage != null && totalDamage.AnyPositive())
{
_adminLogger.Add(LogType.Damaged, $"{ToPrettyString(args.User):user} injured their hand by interacting with {ToPrettyString(args.Target):target} and received {totalDamage.GetTotal():damage} damage");
args.Handled = true;

if (!_gameTiming.IsFirstTimePredicted)
return;

_adminLogger.Add(LogType.Damaged, $"{ToPrettyString(args.User):user} injured their hand by interacting with {ToPrettyString(args.Target):target} and received {totalDamage.GetTotal():damage} damage");
_audioSystem.PlayPredicted(entity.Comp.InteractSound, args.Target, args.User);

if (_net.IsServer)
return;

if (entity.Comp.PopupText != null)
_popupSystem.PopupClient(Loc.GetString(entity.Comp.PopupText), args.User, args.User);
}
Expand Down

0 comments on commit 6ce2670

Please sign in to comment.