Add price multiplier for armor component (#24561)

* Add price multiplier for armor component

* Fix datafiled
This commit is contained in:
MilenVolf
2024-01-26 01:04:01 +03:00
committed by GitHub
parent ff207b2e05
commit 4f3265e950
2 changed files with 9 additions and 2 deletions

View File

@@ -22,13 +22,13 @@ public sealed class ArmorSystem : SharedArmorSystem
foreach (var modifier in component.Modifiers.Coefficients)
{
var damageType = _protoManager.Index<DamageTypePrototype>(modifier.Key);
args.Price += damageType.ArmorPriceCoefficient * 100 * (1 - modifier.Value);
args.Price += component.PriceMultiplier * damageType.ArmorPriceCoefficient * 100 * (1 - modifier.Value);
}
foreach (var modifier in component.Modifiers.FlatReduction)
{
var damageType = _protoManager.Index<DamageTypePrototype>(modifier.Key);
args.Price += damageType.ArmorPriceFlat * modifier.Value;
args.Price += component.PriceMultiplier * damageType.ArmorPriceFlat * modifier.Value;
}
}
}

View File

@@ -15,6 +15,13 @@ public sealed partial class ArmorComponent : Component
/// </summary>
[DataField(required: true)]
public DamageModifierSet Modifiers = default!;
/// <summary>
/// A multiplier applied to the calculated point value
/// to determine the monetary value of the armor
/// </summary>
[DataField]
public float PriceMultiplier = 1;
}
/// <summary>