CatStation/Content.Shared/Damage/Systems/SharedDamageOtherOnHitSystem.cs
Pieter-Jan Briers 5168b5f3d4
IoC source gen compatibility (#43863)
* IoC source gen compatibility

Can be merged before or after https://github.com/space-wizards/RobustToolbox/pull/6549 doesn't really matter.

* Missed a spot
2026-05-09 03:29:58 +00:00

32 lines
1.2 KiB
C#

using Content.Shared.CombatMode.Pacification;
using Content.Shared.Damage.Components;
using Content.Shared.Damage.Events;
namespace Content.Shared.Damage.Systems;
public abstract partial class SharedDamageOtherOnHitSystem : EntitySystem
{
[Dependency] private DamageableSystem _damageable = default!;
[Dependency] private DamageExamineSystem _damageExamine = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<DamageOtherOnHitComponent, DamageExamineEvent>(OnDamageExamine);
SubscribeLocalEvent<DamageOtherOnHitComponent, AttemptPacifiedThrowEvent>(OnAttemptPacifiedThrow);
}
private void OnDamageExamine(Entity<DamageOtherOnHitComponent> ent, ref DamageExamineEvent args)
{
_damageExamine.AddDamageExamine(args.Message, _damageable.ApplyUniversalAllModifiers(ent.Comp.Damage * _damageable.UniversalThrownDamageModifier), Loc.GetString("damage-throw"));
}
/// <summary>
/// Prevent players with the Pacified status effect from throwing things that deal damage.
/// </summary>
private void OnAttemptPacifiedThrow(Entity<DamageOtherOnHitComponent> ent, ref AttemptPacifiedThrowEvent args)
{
args.Cancel("pacified-cannot-throw");
}
}