コード例 #1
0
 public static void Validate(MechDef mechDef, ref Dictionary <MechValidationType, List <string> > errorMessages)
 {
     Structure.ValidationRulesCheck(mechDef, ref errorMessages);
     Armor.ValidationRulesCheck(mechDef, ref errorMessages);
     EngineHeat.ValidationRulesCheck(mechDef, ref errorMessages);
     Engine.ValidationRulesCheck(mechDef, ref errorMessages);
     Gyro.ValidationRulesCheck(mechDef, ref errorMessages);
     Cockpit.ValidationRulesCheck(mechDef, ref errorMessages);
 }
コード例 #2
0
 // reduce upgrade components for the center torso that are 3 or larger
 public static void Postfix(UpgradeDef __instance)
 {
     try
     {
         Gyro.AdjustGyroUpgrade(__instance);
         Cockpit.AdjustCockpitUpgrade(__instance);
     }
     catch (Exception e)
     {
         Control.mod.Logger.LogError(e);
     }
 }
コード例 #3
0
 // invalidate mech loadouts that have more than 0 endo-steel critical slots but not exactly 14
 // invalidate mech loadouts that have more than 0 ff critical slots but not exactly 14
 public static void Postfix(MechDef mechDef, ref Dictionary <MechValidationType, List <string> > errorMessages)
 {
     try
     {
         EndoSteel.ValidationRulesCheck(mechDef, ref errorMessages);
         FerrosFibrous.ValidationRulesCheck(mechDef, ref errorMessages);
         EngineHeat.ValidationRulesCheck(mechDef, ref errorMessages);
         Engine.ValidationRulesCheck(mechDef, ref errorMessages);
         Gyro.ValidationRulesCheck(mechDef, ref errorMessages);
         Cockpit.ValidationRulesCheck(mechDef, ref errorMessages);
     }
     catch (Exception e)
     {
         Control.mod.Logger.LogError(e);
     }
 }
コード例 #4
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);
                Engine.AddEngineIfPossible(mechDef);
            }
        }
コード例 #5
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;
                }

                Engine.ValidateAdd(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);
            }
        }