Skip to content

Commit

Permalink
Added EngineMultiplier, which multiplies with other EngineMultipliers…
Browse files Browse the repository at this point in the history
…, opposed to EngineFactor, which always worked off the base.
  • Loading branch information
CptMoore committed Mar 3, 2024
1 parent 7ce1b2d commit 36e3a07
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion source/Features/Engines/Engine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ 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, WeightPrecision);
internal float EngineTonnage => PrecisionUtils.RoundUp(StandardEngineTonnage * WeightFactors.EngineFactor * WeightFactors.EngineMultiplier, WeightPrecision);
internal float HeatSinkTonnage => -HeatSinkExternalFreeTonnage;
internal float TotalTonnage => HeatSinkTonnage + EngineTonnage + GyroTonnage;

Expand Down
8 changes: 6 additions & 2 deletions source/Features/OverrideTonnage/WeightFactors.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,16 @@ 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
public float ArmorFactor { get; set; } = 1;
public float StructureFactor { get; set; } = 1;
public float EngineFactor { get; set; } = 1;
//public float EngineFactorFactor { get; set; } = 1; // TODO was problematic, 1. engine, 2. engine factor, 3. engine factor factor
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 @@ -29,10 +32,11 @@ public void Combine(WeightFactors savings)
ArmorFactor += savings.ArmorFactor - 1;
StructureFactor += savings.StructureFactor - 1;
EngineFactor += savings.EngineFactor - 1;
//EngineFactorFactor += savings.EngineFactorFactor - 1;
GyroFactor += savings.GyroFactor - 1;
ChassisCapacityFactor += savings.ChassisCapacityFactor - 1;

EngineMultiplier *= savings.EngineMultiplier;

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

0 comments on commit 36e3a07

Please sign in to comment.