Machine upgrade examine verb (#12119)

This commit is contained in:
0x6273
2022-11-04 04:27:47 +01:00
committed by GitHub
parent 5ede1f4862
commit a201d777bc
22 changed files with 205 additions and 3 deletions

View File

@@ -12,6 +12,7 @@ namespace Content.Server.Power.EntitySystems
base.Initialize();
SubscribeLocalEvent<UpgradeBatteryComponent, RefreshPartsEvent>(OnRefreshParts);
SubscribeLocalEvent<UpgradeBatteryComponent, UpgradeExamineEvent>(OnUpgradeExamine);
}
public void OnRefreshParts(EntityUid uid, UpgradeBatteryComponent component, RefreshPartsEvent args)
@@ -23,5 +24,14 @@ namespace Content.Server.Power.EntitySystems
batteryComp.MaxCharge = MathF.Pow(component.MaxChargeMultiplier, capacitorRating - 1) * component.BaseMaxCharge;
}
}
private void OnUpgradeExamine(EntityUid uid, UpgradeBatteryComponent component, UpgradeExamineEvent args)
{
// UpgradeBatteryComponent.MaxChargeMultiplier is not the actual multiplier, so we have to do this.
if (TryComp<BatteryComponent>(uid, out var batteryComp))
{
args.AddPercentageUpgrade("upgrade-max-charge", batteryComp.MaxCharge / component.BaseMaxCharge);
}
}
}
}