Material generators from Afterlight (#18387)

This commit is contained in:
Nemanja
2023-07-31 14:42:38 -04:00
committed by GitHub
parent b9af7d3668
commit 2d08f02d23
34 changed files with 639 additions and 29 deletions

View File

@@ -43,7 +43,7 @@ public sealed class UpgradePowerSystem : EntitySystem
load *= MathF.Pow(component.PowerDrawMultiplier, rating - 1);
break;
default:
Logger.Error($"invalid power scaling type for {ToPrettyString(uid)}.");
Log.Error($"invalid power scaling type for {ToPrettyString(uid)}.");
load = 0;
break;
}
@@ -82,19 +82,19 @@ public sealed class UpgradePowerSystem : EntitySystem
supply *= MathF.Pow(component.PowerSupplyMultiplier, rating - 1);
break;
default:
Logger.Error($"invalid power scaling type for {ToPrettyString(uid)}.");
Log.Error($"invalid power scaling type for {ToPrettyString(uid)}.");
supply = component.BaseSupplyRate;
break;
}
component.ActualScalar = supply / component.BaseSupplyRate;
if (TryComp<PowerSupplierComponent>(uid, out var powa))
powa.MaxSupply = supply;
}
private void OnSupplierUpgradeExamine(EntityUid uid, UpgradePowerSupplierComponent component, UpgradeExamineEvent args)
{
// UpgradePowerSupplierComponent.PowerSupplyMultiplier is not the actual multiplier, so we have to do this.
if (TryComp<PowerSupplierComponent>(uid, out var powa))
args.AddPercentageUpgrade("upgrade-power-supply", powa.MaxSupply / component.BaseSupplyRate);
args.AddPercentageUpgrade("upgrade-power-supply", component.ActualScalar);
}
}