using Content.Shared.Armor;
using Content.Shared.Cargo;
using Robust.Shared.Prototypes;
using Content.Shared.Damage.Prototypes;
namespace Content.Server.Armor;
///
public sealed class ArmorSystem : SharedArmorSystem
{
[Dependency] private readonly IPrototypeManager _protoManager = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent(GetArmorPrice);
}
private void GetArmorPrice(EntityUid uid, ArmorComponent component, ref PriceCalculationEvent args)
{
foreach (var modifier in component.Modifiers.Coefficients)
{
var damageType = _protoManager.Index(modifier.Key);
args.Price += component.PriceMultiplier * damageType.ArmorPriceCoefficient * 100 * (1 - modifier.Value);
}
foreach (var modifier in component.Modifiers.FlatReduction)
{
var damageType = _protoManager.Index(modifier.Key);
args.Price += component.PriceMultiplier * damageType.ArmorPriceFlat * modifier.Value;
}
}
}