Skip to content

Commit 7f9664a

Browse files
authored
fix: Incorrect quality bonuses/penalties from beacon modules. (#424)
As reported [on Discord](https://discord.com/channels/560199483065892894/1210135763422027837/1343188155515539457), speed modules in beacons mess up quality calculations. This was a copy/paste and duplicated code issue; the erroneous method was only called once, while the working one was called in seven different places.
2 parents 3b2d736 + ef1d174 commit 7f9664a

File tree

2 files changed

+3
-15
lines changed

2 files changed

+3
-15
lines changed

Yafc.Model/Model/ProductionTableContent.cs

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public struct ModuleEffects {
1616
public readonly float speedMod => MathF.Max(1f + speed, 0.2f);
1717
public readonly float energyUsageMod => MathF.Max(1f + consumption, 0.2f);
1818
public readonly float qualityMod => MathF.Max(quality, 0);
19-
public void AddModules(ObjectWithQuality<Module> module, float count, AllowedEffects allowedEffects) {
19+
public void AddModules(ObjectWithQuality<Module> module, float count, AllowedEffects allowedEffects = AllowedEffects.All) {
2020
ModuleSpecification spec = module.target.moduleSpecification;
2121
Quality quality = module.quality;
2222
if (allowedEffects.HasFlags(AllowedEffects.Speed)) {
@@ -32,23 +32,10 @@ public void AddModules(ObjectWithQuality<Module> module, float count, AllowedEff
3232
}
3333

3434
if (allowedEffects.HasFlags(AllowedEffects.Quality)) {
35-
this.quality += spec.Consumption(quality) * count;
35+
this.quality += spec.Quality(quality) * count;
3636
}
3737
}
3838

39-
public void AddModules(ObjectWithQuality<Module> module, float count) {
40-
ModuleSpecification spec = module.target.moduleSpecification;
41-
Quality quality = module.quality;
42-
speed += spec.Speed(quality) * count;
43-
44-
if (spec.baseProductivity > 0f) {
45-
productivity += spec.Productivity(quality) * count;
46-
}
47-
48-
consumption += spec.Consumption(quality) * count;
49-
this.quality += spec.Quality(quality) * count;
50-
}
51-
5239
public readonly int GetModuleSoftLimit(ObjectWithQuality<Module> module, int hardLimit) {
5340
ModuleSpecification spec = module.target.moduleSpecification;
5441
Quality quality = module.quality;

changelog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Date:
2121
- Add related recipes to the Link Summary screen.
2222
Fixes:
2323
- (regression) Legacy summary pages could not be saved or loaded.
24+
- Quality bonuses/penalties in beacons were not handled correctly.
2425
----------------------------------------------------------------------------------------------------------------------
2526
Version: 2.8.1
2627
Date: February 20th 2025

0 commit comments

Comments
 (0)