public static void Prefix(MechDef __instance) { try { var adapter = new MechDefAdapter(__instance); if (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(); MechHardpointRules_GetComponentPrefabName_Patch.SetupCalculator(adapter.Chassis, componentRefs); } catch (Exception e) { Control.mod.Logger.LogError(e); } }
public static void Prefix(MechRepresentationSimGame __instance) { try { MechHardpointRules_GetComponentPrefabName_Patch.SetupCalculator( __instance.mechDef?.Chassis, __instance.mechDef?.Inventory?.ToList()); } catch (Exception e) { Control.mod.Logger.LogError(e); } }
public static void Prefix(Mech __instance, Transform parentTransform) { try { var componentRefs = __instance.Weapons.Union(__instance.supportComponents) .Select(w => w.baseComponentRef as MechComponentRef) .Where(c => c != null) .ToList(); MechHardpointRules_GetComponentPrefabName_Patch.SetupCalculator(__instance.MechDef.Chassis, componentRefs); } catch (Exception e) { Control.mod.Logger.LogError(e); } }
public static void Prefix(MechDef __instance) { try { var mechDef = __instance; // missing fixed equipment :/ MechHardpointRules_GetComponentPrefabName_Patch.SetupCalculator( mechDef.Chassis, mechDef.Inventory?.ToList() ); } catch (Exception e) { Control.mod.Logger.LogError(e); } }
public static void Postfix(MechDef __instance) { MechHardpointRules_GetComponentPrefabName_Patch.ResetCalculator(); }
public static void Postfix(Mech __instance, Transform parentTransform) { MechHardpointRules_GetComponentPrefabName_Patch.ResetCalculator(); }