// The AME is being overloaded.
// Note about these maths: I would assume the general idea here is to make larger engines less safe to overload.
// In other words, yes, those are supposed to be CoreCount, not safeFuelLimit.
- var instability = 0;
var overloadVsSizeResult = fuel - CoreCount;
- // fuel > safeFuelLimit: Slow damage. Can safely run at this level for burst periods if the engine is small and someone is keeping an eye on it.
- if (_random.Prob(0.5f))
- instability = 1;
- // overloadVsSizeResult > 5:
- if (overloadVsSizeResult > 5)
- instability = 3;
- // overloadVsSizeResult > 10: This will explode in at most 20 injections.
- if (overloadVsSizeResult > 10)
- instability = 5;
-
- // Apply calculated instability
- if (instability == 0)
- return powerOutput;
+ var instability = overloadVsSizeResult / CoreCount;
+ var fuzz = _random.Next(-1, 2); // -1 to 1
+ instability += fuzz; // fuzz the values a tiny bit.
overloading = true;
var integrityCheck = 100;
/// </summary>
public float CalculatePower(int fuel, int cores)
{
- // Fuel is squared so more fuel vastly increases power and efficiency
- // We divide by the number of cores so a larger AME is less efficient at the same fuel settings
- // this results in all AMEs having the same efficiency at the same fuel-per-core setting
- return 20000f * fuel * fuel / cores;
+ // Balanced around a single core AME with injection level 2 producing 120KW.
+ // Overclocking yields diminishing returns until it evens out at around 360KW.
+
+ // The adjustment for cores make it so that a 1 core AME at 2 injections is better than a 2 core AME at 2 injections.
+ // However, for the relative amounts for each (1 core at 2 and 2 core at 4), more cores has more output.
+ return 200000f * MathF.Log10(fuel * fuel) * MathF.Pow(0.75f, cores - 1);
}
public int GetTotalStability()
At the time of editing, players regularly "overclock" the AME and those cases require no admin attention.
// Admin alert
- var safeLimit = 0;
+ var safeLimit = int.MaxValue;
if (TryGetAMENodeGroup(uid, out var group))
- safeLimit = group.CoreCount * 2;
+ safeLimit = group.CoreCount * 4;
if (oldValue <= safeLimit && value > safeLimit)
{
*/
}
- public void AdjustInjectionAmount(EntityUid uid, int delta, int min = 0, int max = int.MaxValue, EntityUid? user = null, AmeControllerComponent? controller = null)
+ public void AdjustInjectionAmount(EntityUid uid, int delta, EntityUid? user = null, AmeControllerComponent? controller = null)
{
- if (Resolve(uid, ref controller))
- SetInjectionAmount(uid, MathHelper.Clamp(controller.InjectionAmount + delta, min, max), user, controller);
+ if (!Resolve(uid, ref controller))
+ return;
+
+ var max = GetMaxInjectionAmount((uid, controller));
+ SetInjectionAmount(uid, MathHelper.Clamp(controller.InjectionAmount + delta, 0, max), user, controller);
+ }
+
+ public int GetMaxInjectionAmount(Entity<AmeControllerComponent> ent)
+ {
+ if (!TryGetAMENodeGroup(ent, out var group))
+ return 0;
+ return group.CoreCount * 8;
}
private void UpdateDisplay(EntityUid uid, int stability, AmeControllerComponent? controller = null, AppearanceComponent? appearance = null)
/// The amount of fuel in the container.
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite), AutoNetworkedField]
- public int FuelAmount = 1000;
+ public int FuelAmount = 500;
/// <summary>
/// The maximum fuel capacity of the container.
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite), AutoNetworkedField]
- public int FuelCapacity = 1000;
+ public int FuelCapacity = 500;
}