public static void Postfix(Mech __instance, ref float __result) { try { __result *= ArmorStructureChangesFeature.GetStructureFactorForMech(__instance); } catch (Exception e) { Control.Logger.Error.Log(e); } }
private static void UndoArmorStructureChanges(Mech mech, MechDef mechDef) { var armorFactor = ArmorStructureChangesFeature.GetArmorFactorForMech(mech); var structureFactor = ArmorStructureChangesFeature.GetStructureFactorForMech(mech); foreach (var mechLocationDef in mechDef.Locations) { var chassisLocationDef = mechDef.Chassis.GetLocationDef(mechLocationDef.Location); mechLocationDef.CurrentInternalStructure = ReverseFactor(structureFactor, mechLocationDef.CurrentInternalStructure, chassisLocationDef.InternalStructure); mechLocationDef.CurrentArmor = ReverseFactor(armorFactor, mechLocationDef.CurrentArmor, mechLocationDef.AssignedArmor); mechLocationDef.CurrentRearArmor = ReverseFactor(armorFactor, mechLocationDef.CurrentRearArmor, mechLocationDef.AssignedRearArmor); } }