Machine upgrade examine verb (#12119)
This commit is contained in:
@@ -26,6 +26,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
||||
SubscribeLocalEvent<GasThermoMachineComponent, AtmosDeviceUpdateEvent>(OnThermoMachineUpdated);
|
||||
SubscribeLocalEvent<GasThermoMachineComponent, AtmosDeviceDisabledEvent>(OnThermoMachineLeaveAtmosphere);
|
||||
SubscribeLocalEvent<GasThermoMachineComponent, RefreshPartsEvent>(OnGasThermoRefreshParts);
|
||||
SubscribeLocalEvent<GasThermoMachineComponent, UpgradeExamineEvent>(OnGasThermoUpgradeExamine);
|
||||
|
||||
// UI events
|
||||
SubscribeLocalEvent<GasThermoMachineComponent, GasThermomachineToggleMessage>(OnToggleMessage);
|
||||
@@ -68,7 +69,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
||||
var matterBinRating = args.PartRatings[component.MachinePartHeatCapacity];
|
||||
var laserRating = args.PartRatings[component.MachinePartTemperature];
|
||||
|
||||
component.HeatCapacity = 5000 * MathF.Pow(matterBinRating, 2);
|
||||
component.HeatCapacity = component.BaseHeatCapacity * MathF.Pow(matterBinRating, 2);
|
||||
|
||||
switch (component.Mode)
|
||||
{
|
||||
@@ -88,6 +89,20 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
||||
DirtyUI(uid, component);
|
||||
}
|
||||
|
||||
private void OnGasThermoUpgradeExamine(EntityUid uid, GasThermoMachineComponent component, UpgradeExamineEvent args)
|
||||
{
|
||||
switch (component.Mode)
|
||||
{
|
||||
case ThermoMachineMode.Heater:
|
||||
args.AddPercentageUpgrade("gas-thermo-component-upgrade-heating", component.MaxTemperature / (component.BaseMaxTemperature + component.MaxTemperatureDelta));
|
||||
break;
|
||||
case ThermoMachineMode.Freezer:
|
||||
args.AddPercentageUpgrade("gas-thermo-component-upgrade-cooling", component.MinTemperature / (component.BaseMinTemperature - component.MinTemperatureDelta));
|
||||
break;
|
||||
}
|
||||
args.AddPercentageUpgrade("gas-thermo-component-upgrade-heat-capacity", component.HeatCapacity / component.BaseHeatCapacity);
|
||||
}
|
||||
|
||||
private void OnToggleMessage(EntityUid uid, GasThermoMachineComponent component, GasThermomachineToggleMessage args)
|
||||
{
|
||||
component.Enabled = !component.Enabled;
|
||||
|
||||
@@ -40,6 +40,7 @@ namespace Content.Server.Atmos.Portable
|
||||
SubscribeLocalEvent<PortableScrubberComponent, DestructionEventArgs>(OnDestroyed);
|
||||
SubscribeLocalEvent<PortableScrubberComponent, GasAnalyzerScanEvent>(OnScrubberAnalyzed);
|
||||
SubscribeLocalEvent<PortableScrubberComponent, RefreshPartsEvent>(OnRefreshParts);
|
||||
SubscribeLocalEvent<PortableScrubberComponent, UpgradeExamineEvent>(OnUpgradeExamine);
|
||||
}
|
||||
|
||||
private bool IsFull(PortableScrubberComponent component)
|
||||
@@ -179,5 +180,11 @@ namespace Content.Server.Atmos.Portable
|
||||
component.MaxPressure = component.BaseMaxPressure * MathF.Pow(component.PartRatingMaxPressureModifier, pressureRating - 1);
|
||||
component.TransferRate = component.BaseTransferRate * MathF.Pow(component.PartRatingTransferRateModifier, transferRating - 1);
|
||||
}
|
||||
|
||||
private void OnUpgradeExamine(EntityUid uid, PortableScrubberComponent component, UpgradeExamineEvent args)
|
||||
{
|
||||
args.AddPercentageUpgrade("portable-scrubber-component-upgrade-max-pressure", component.MaxPressure / component.BaseMaxPressure);
|
||||
args.AddPercentageUpgrade("portable-scrubber-component-upgrade-transfer-rate", component.TransferRate / component.BaseTransferRate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user