using Content.Shared.Armor;
using Content.Shared.Atmos;
using Content.Shared.Clothing.Components;
using Content.Shared.Inventory;
namespace Content.Shared.Clothing.EntitySystems;
///
/// Handles reducing fire damage when wearing clothing with .
///
public sealed class FireProtectionSystem : EntitySystem
{
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent>(OnGetProtection);
SubscribeLocalEvent(OnArmorExamine);
}
private void OnGetProtection(Entity ent, ref InventoryRelayedEvent args)
{
args.Args.Reduce(ent.Comp.Reduction);
}
private void OnArmorExamine(Entity ent, ref ArmorExamineEvent args)
{
var value = MathF.Round((1f - ent.Comp.Reduction) * 100, 1);
if (value == 0)
return;
args.Msg.PushNewline();
args.Msg.AddMarkupOrThrow(Loc.GetString(ent.Comp.ExamineMessage, ("value", value)));
}
}