mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-10 02:41:18 +03:00
* Remove all IPrototypeManager instances * Remove redundant IComponentFactory instances too * Found some stragglers * DestructibleSystem.PrototypeManager: no dependency * not based
31 lines
1 KiB
C#
31 lines
1 KiB
C#
using Content.Shared.Armor;
|
|
using Content.Shared.Cargo;
|
|
using Content.Shared.Damage.Prototypes;
|
|
|
|
namespace Content.Server.Armor;
|
|
|
|
/// <inheritdoc/>
|
|
public sealed partial class ArmorSystem : SharedArmorSystem
|
|
{
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<ArmorComponent, PriceCalculationEvent>(GetArmorPrice);
|
|
}
|
|
|
|
private void GetArmorPrice(EntityUid uid, ArmorComponent component, ref PriceCalculationEvent args)
|
|
{
|
|
foreach (var modifier in component.Modifiers.Coefficients)
|
|
{
|
|
var damageType = ProtoMan.Index<DamageTypePrototype>(modifier.Key);
|
|
args.Price += component.PriceMultiplier * damageType.ArmorPriceCoefficient * 100 * (1 - modifier.Value);
|
|
}
|
|
|
|
foreach (var modifier in component.Modifiers.FlatReduction)
|
|
{
|
|
var damageType = ProtoMan.Index<DamageTypePrototype>(modifier.Key);
|
|
args.Price += component.PriceMultiplier * damageType.ArmorPriceFlat * modifier.Value;
|
|
}
|
|
}
|
|
}
|