From 80f395fc6e3b8b53b8217b1d23d99efaf511da5d Mon Sep 17 00:00:00 2001 From: CptMoore <39010654+cptmoore@users.noreply.github.com> Date: Sun, 3 Mar 2024 11:19:10 +0100 Subject: [PATCH] Renamed EngineMultiplier to Engine2Factor. Engine2Factor behaves as all other factors but its base is the weight calculated by the EngineFactor. --- source/Features/Engines/Engine.cs | 3 ++- source/Features/OverrideTonnage/WeightFactors.cs | 11 ++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/source/Features/Engines/Engine.cs b/source/Features/Engines/Engine.cs index 6fc4e6a0..f9107cf5 100644 --- a/source/Features/Engines/Engine.cs +++ b/source/Features/Engines/Engine.cs @@ -117,7 +117,8 @@ private static int MatchingCount(IEnumerable 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; diff --git a/source/Features/OverrideTonnage/WeightFactors.cs b/source/Features/OverrideTonnage/WeightFactors.cs index 12e7ca80..64570ac5 100644 --- a/source/Features/OverrideTonnage/WeightFactors.cs +++ b/source/Features/OverrideTonnage/WeightFactors.cs @@ -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) @@ -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; }