SMES and substation require power cells as machine parts (#20344)

* Initial commit

* Balancing and tweaks
This commit is contained in:
chromiumboy
2023-10-12 11:06:03 -05:00
committed by GitHub
parent 3323b617dd
commit 535b013f63
10 changed files with 117 additions and 9 deletions

View File

@@ -7,6 +7,8 @@ namespace Content.Server.Power.EntitySystems
[UsedImplicitly]
public sealed class UpgradeBatterySystem : EntitySystem
{
[Dependency] private readonly BatterySystem _batterySystem = default!;
public override void Initialize()
{
base.Initialize();
@@ -17,11 +19,11 @@ namespace Content.Server.Power.EntitySystems
public void OnRefreshParts(EntityUid uid, UpgradeBatteryComponent component, RefreshPartsEvent args)
{
var capacitorRating = args.PartRatings[component.MachinePartPowerCapacity];
var powerCellRating = args.PartRatings[component.MachinePartPowerCapacity];
if (TryComp<BatteryComponent>(uid, out var batteryComp))
{
batteryComp.MaxCharge = MathF.Pow(component.MaxChargeMultiplier, capacitorRating - 1) * component.BaseMaxCharge;
_batterySystem.SetMaxCharge(uid, MathF.Pow(component.MaxChargeMultiplier, powerCellRating - 1) * component.BaseMaxCharge, batteryComp);
}
}