Ejemplo n.º 1
0
        internal static float AdditionalTonnage(MechDef mechDef)
        {
            float tonnage = 0;

            tonnage += EngineMisc.TonnageChanges(mechDef);
            tonnage -= Armor.TonnageSave(mechDef);
            return(tonnage);
        }
 // only allow one engine part per specific location
 public static void Postfix(MechLabMechInfoWidget __instance, MechLabPanel ___mechLab, MechLabHardpointElement[] ___hardpoints)
 {
     try
     {
         EngineMisc.SetJumpJetHardpointCount(__instance, ___mechLab, ___hardpoints);
     }
     catch (Exception e)
     {
         Control.mod.Logger.LogError(e);
     }
 }
 public static void Validate(MechDef mechDef, ref Dictionary <MechValidationType, List <string> > errorMessages)
 {
     UniqueController.ValidationRulesCheck(mechDef, ref errorMessages);
     Armor.ValidationRulesCheck(mechDef, ref errorMessages);
     Structure.ValidationRulesCheck(mechDef, ref errorMessages);
     ReservedSlots.ValidationRulesCheck(mechDef, ref errorMessages);
     EngineHeat.ValidationRulesCheck(mechDef, ref errorMessages);
     EngineMisc.ValidationRulesCheck(mechDef, ref errorMessages);
     Gyro.ValidationRulesCheck(mechDef, ref errorMessages);
     Cockpit.ValidationRulesCheck(mechDef, ref errorMessages);
 }
 // change the movement stats when loading into a combat game the first time
 public static void Postfix(Mech __instance)
 {
     try
     {
         EngineMisc.InitEffectstats(__instance);
     }
     catch (Exception e)
     {
         Control.mod.Logger.LogError(e);
     }
 }
Ejemplo n.º 5
0
 public static void Postfix(SimGameState __instance, MechComponentRef mechComponent, ref WorkOrderEntry_InstallComponent __result)
 {
     try
     {
         EngineMisc.ChangeInstallationCosts(mechComponent, __result);
     }
     catch (Exception e)
     {
         Control.mod.Logger.LogError(e);
     }
 }
 public static float OverrideMaxSprintDistance(this MovementCapabilitiesDef @this)
 {
     try
     {
         EngineMisc.CalculateMovementStat(mechDef, ref walkSpeed, ref runSpeed, ref TTWalkSpeed);
         return(runSpeed);
     }
     catch (Exception e)
     {
         Control.mod.Logger.LogError(e);
         return(@this.MaxSprintDistance);
     }
 }
 // hide incompatible engines
 public static void Postfix(MechLabInventoryWidget __instance, float ___mechTonnage)
 {
     try
     {
         if (!Control.settings.EnableAvailabilityChecks)
         {
             return;
         }
         EngineMisc.RefreshAvailability(__instance, ___mechTonnage);
     }
     catch (Exception e)
     {
         Control.mod.Logger.LogError(e);
     }
 }
Ejemplo n.º 8
0
        // call if mechdef is first time retrieved
        // prepare all engine defs beforehand - RequestDataManagerResources()
        internal static void PostProcessAfterLoading(DataManager dataManager)
        {
            foreach (var keyValuePair in dataManager.MechDefs)
            {
                var mechDef = keyValuePair.Value;

                if (Control.settings.AutoFixMechDefSkip.Contains(mechDef.Description.Id))
                {
                    continue;
                }

                Cockpit.AddCockpitIfPossible(mechDef);
                Gyro.AddGyroIfPossible(mechDef);
                EngineMisc.AddEngineIfPossible(mechDef);
                Armor.AddArmorIfPossible(mechDef);
                Structure.AddStructureIfPossible(mechDef);
            }
        }
Ejemplo n.º 9
0
        // allow gyro upgrades to be 1 slot and still only be added once
        public static void Postfix(
            MechLabLocationWidget __instance,
            MechComponentDef newComponentDef,
            List <MechLabItemSlotElement> ___localInventory,
            ref string ___dropErrorMessage,
            ref bool __result)
        {
            try
            {
                if (!__result)
                {
                    return;
                }

                Gyro.ValidateAdd(newComponentDef, ___localInventory, ref ___dropErrorMessage, ref __result);
                if (!__result)
                {
                    return;
                }

                EngineMisc.EngineSlotsValidateAdd(newComponentDef, ___localInventory, ref ___dropErrorMessage, ref __result);
                if (!__result)
                {
                    return;
                }

                EngineMisc.EngineCoreValidateAdd(newComponentDef, ___localInventory, ref ___dropErrorMessage, ref __result);
                if (!__result)
                {
                    return;
                }

                Cockpit.ValidateAdd(newComponentDef, ___localInventory, ref ___dropErrorMessage, ref __result);
                if (!__result)
                {
                    return;
                }
            }
            catch (Exception e)
            {
                Control.mod.Logger.LogError(e);
            }
        }