Exemple #1
0
        public static void Prefix(MechDef __instance)
        {
            try
            {
                var adapter = new MechDefAdapter(__instance);
                if (adapter.Chassis == null || adapter.Chassis.HardpointDataDef == null)
                {
                    return;
                }

                var componentRefs = adapter.Inventory
                                    .Where(c => c != null).Select(c =>
                {
                    if (c.DataManager == null)
                    {
                        c.DataManager = adapter.DataManager;
                    }

                    c.RefreshComponentDef();

                    return(c);
                })
                                    .Where(c => !c.hasPrefabName)
                                    .ToList();
                MechHardpointRulesGetComponentPrefabNamePatch.SetupCalculator(adapter.Chassis, componentRefs);
            }
            catch (Exception e)
            {
                Control.mod.Logger.LogError(e);
            }
        }
Exemple #2
0
 public static void Prefix(MechRepresentationSimGame __instance)
 {
     try
     {
         MechHardpointRulesGetComponentPrefabNamePatch.SetupCalculator(
             __instance.mechDef != null ? __instance.mechDef.Chassis : null,
             __instance.mechDef != null ? (__instance.mechDef.Inventory != null ? __instance.mechDef.Inventory.ToList() : null) : null);
     }
     catch (Exception e)
     {
         Control.mod.Logger.LogError(e);
     }
 }
Exemple #3
0
        public static void Prefix(Mech __instance, Transform parentTransform)
        {
            try
            {
                var componentRefs = __instance.Weapons
                                    .Select(w => w.baseComponentRef as MechComponentRef)
                                    .Where(c => c != null)
                                    .ToList();

                MechHardpointRulesGetComponentPrefabNamePatch.SetupCalculator(__instance.MechDef.Chassis, componentRefs);
            }
            catch (Exception e)
            {
                Control.mod.Logger.LogError(e);
            }
        }
Exemple #4
0
 public static void Postfix(Mech __instance, Transform parentTransform)
 {
     MechHardpointRulesGetComponentPrefabNamePatch.ResetCalculator();
 }
Exemple #5
0
 public static void Postfix(MechRepresentationSimGame __instance)
 {
     MechHardpointRulesGetComponentPrefabNamePatch.ResetCalculator();
 }