Skip to content

Commit

Permalink
Renamed EngineMultiplier to Engine2Factor. Engine2Factor behaves as a…
Browse files Browse the repository at this point in the history
…ll other factors but its base is the weight calculated by the EngineFactor.
  • Loading branch information
CptMoore committed Mar 3, 2024
1 parent 36e3a07 commit 80f395f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
3 changes: 2 additions & 1 deletion source/Features/Engines/Engine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ private static int MatchingCount(IEnumerable<MechComponentRef> heatSinks, HeatSi

private float HeatSinkExternalFreeTonnage => HeatSinkExternalFreeCount * HeatSinkDef.Def.Tonnage;
internal float GyroTonnage => PrecisionUtils.RoundUp(StandardGyroTonnage * WeightFactors.GyroFactor, WeightPrecision);
internal float EngineTonnage => PrecisionUtils.RoundUp(StandardEngineTonnage * WeightFactors.EngineFactor * WeightFactors.EngineMultiplier, WeightPrecision);
private float EngineTonnage1 => PrecisionUtils.RoundUp(StandardEngineTonnage * WeightFactors.EngineFactor, WeightPrecision);
internal float EngineTonnage => PrecisionUtils.RoundUp(EngineTonnage1 * WeightFactors.Engine2Factor, WeightPrecision);
internal float HeatSinkTonnage => -HeatSinkExternalFreeTonnage;
internal float TotalTonnage => HeatSinkTonnage + EngineTonnage + GyroTonnage;

Expand Down
11 changes: 4 additions & 7 deletions source/Features/OverrideTonnage/WeightFactors.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,14 @@ namespace MechEngineer.Features.OverrideTonnage;
[UsedBy(User.BattleValue)]
public class WeightFactors : SimpleCustomComponent, IAdjustSlotElement, IAdjustTooltipEquipment, IAdjustTooltipWeapon
{
// TODO rename to BaseMultiplier, all factors are additive and therefore only a factor against the base
// factors are additive with other factors of the same name (2.0,0.5->1.5, not 2.0,0.5->1.0)
public float ArmorFactor { get; set; } = 1;
public float StructureFactor { get; set; } = 1;
public float EngineFactor { get; set; } = 1;
public float EngineFactor { get; set; } = 1; // XL, compact engines etc..
public float Engine2Factor { get; set; } = 1; // supercharger
public float GyroFactor { get; set; } = 1;
public float ChassisCapacityFactor { get; set; } = 1;

// Multipliers are multiplied with each other and the base
public float EngineMultiplier { get; set; } = 1;

// not factors
public int ReservedSlots { get; set; } = 0; // TODO move to own feature... SlotsHandler or SizeHandler
public float ComponentByChassisFactor { get; set; } = 0; // TODO move to something more elaborate (see CustomCapacities / HBS statistics)
Expand All @@ -32,11 +30,10 @@ public void Combine(WeightFactors savings)
ArmorFactor += savings.ArmorFactor - 1;
StructureFactor += savings.StructureFactor - 1;
EngineFactor += savings.EngineFactor - 1;
Engine2Factor += savings.Engine2Factor - 1;
GyroFactor += savings.GyroFactor - 1;
ChassisCapacityFactor += savings.ChassisCapacityFactor - 1;

EngineMultiplier *= savings.EngineMultiplier;

ReservedSlots += savings.ReservedSlots;
ComponentByChassisFactor += savings.ComponentByChassisFactor;
}
Expand Down

0 comments on commit 80f395f

Please sign in to comment.