public bool MatchesForAutomatic(IModRegistry registry) { if (UnsupportedMods != null) { foreach (string mod in UnsupportedMods) { if (!string.IsNullOrEmpty(mod) && registry.IsLoaded(mod)) { return(false); } } } if (SupportedMods != null) { foreach (string mod in SupportedMods) { if (!string.IsNullOrEmpty(mod) && registry.IsLoaded(mod)) { return(true); } } } return(false); }
/********* ** Protected methods *********/ /// <summary>Construct an instance.</summary> /// <param name="modRegistry">Fetches metadata about loaded mods.</param> /// <param name="reflection">Simplifies access to private code.</param> /// <param name="rateLimit">The minimum number of ticks between each update.</param> protected BaseAttachment(IModRegistry modRegistry, IReflectionHelper reflection, int rateLimit = 0) { this.ModRegistry = modRegistry; this.Reflection = reflection; this.RateLimit = rateLimit; this.HasDeepWoods = modRegistry.IsLoaded("maxvollmer.deepwoodsmod"); this.HasFarmTypeManager = modRegistry.IsLoaded("Esca.FarmTypeManager"); }
public void ModRegistryReady(IModRegistry registry) { if (registry.IsLoaded("tZed.SimpleSprinkler")) { this.simpleSprinklersAPI = registry.GetApi <ISimpleSprinklersAPI>("tZed.SimpleSprinkler"); } if (registry.IsLoaded("Speeder.BetterSprinklers")) { this.betterSprinklersAPI = registry.GetApi <IBetterSprinklersAPI>("Speeder.BetterSprinklers"); } }
/// <summary>Called when the mod registry is ready.</summary> /// <param name="registry">The mod registry.</param> public void ModRegistryReady(IModRegistry registry) { if (registry.IsLoaded("stokastic.PrismaticTools")) { this.prismaticToolsAPI = registry.GetApi<IPrismaticToolsAPI>("stokastic.PrismaticTools"); } }
/// <summary> /// Set up compatibility with other external mods. /// </summary> private void AddModCompatibility() { // Setup compatibility for the mod [Rush Orders]. isPlayerUsingRushedOrders = false; // Check if the player uses the mod [Rush Orders]. bool isLoaded = modRegistry.IsLoaded(MOD_RUSH_ORDERS_MOD_ID); if (!isLoaded) { return; } // The API we consume is only available starting with Rush Orders 1.1.4. IModInfo mod = modRegistry.Get(MOD_RUSH_ORDERS_MOD_ID); if (mod.Manifest.Version.IsOlderThan("1.1.4")) { monitor.Log($"You are running an unsupported version of the mod [{mod.Manifest.Name}]! " + $"Please use at least [{mod.Manifest.Name} 1.1.4] for compatibility!", LogLevel.Info); return; } rushOrdersApi = modRegistry.GetApi <IRushOrdersApi>(MOD_RUSH_ORDERS_MOD_ID); if (rushOrdersApi == null) { monitor.Log($"Could not add compatibility for the mod [{mod.Manifest.Name}]! " + $"A newer version of the mod [ToolUpgradeDeliveryService] might be needed.", LogLevel.Error); return; } rushOrdersApi.ToolRushed += OnPlacedRushOrder; isPlayerUsingRushedOrders = true; }
/// <summary>Whether Prismatic or Radioactive Tools mod is installed.</summary> /// <param name="modRegistry">API for fetching metadata about loaded mods.</param> /// <param name="whichMod">Which of the two mods is installed.</param> /// <returns>Returns the name of the installed mod, if either.</returns> public static bool HasHigherLevelToolMod(IModRegistry modRegistry, out string whichMod) { if (modRegistry.IsLoaded("stokastic.PrismaticTools")) { whichMod = "Prismatic"; return(true); } if (modRegistry.IsLoaded("kakashigr.RadioactiveTools")) { whichMod = "Radioactive"; return(true); } whichMod = "None"; return(false); }
public bool HasMatchingMod(IModRegistry registry) { if (For != null) { foreach (string mod in For) { if (!string.IsNullOrEmpty(mod) && registry.IsLoaded(mod)) { return(true); } } } return(false); }
internal static void LoadAugmentableMachineData() { IModRegistry ModRegistry = MachineAugmentorsMod.ModInstance.Helper.ModRegistry; IEnumerable <MachineInfo> CustomMachines = MachineAugmentorsMod.MachineConfig.Machines.Where(x => !string.IsNullOrEmpty(x.RequiredModUniqueId) && ModRegistry.IsLoaded(x.RequiredModUniqueId)).Select(x => x.ToMachineInfo()); RegisteredMachines = new ReadOnlyCollection <MachineInfo>(BuiltInMachines.Union(CustomMachines).ToList()); }
/// <summary>Construct an instance.</summary> /// <param name="modRegistry">Metadata about loaded mods.</param> protected BaseEffect(IModRegistry modRegistry) { _hasFarmTypeManager = modRegistry.IsLoaded("Esca.FarmTypeManager"); }
/********* ** Public methods *********/ /// <summary>Construct an instance.</summary> /// <param name="modRegistry">The mod registry to check for installed mods.</param> public SerializerManager(IModRegistry modRegistry) { this.HasPyTk = modRegistry.IsLoaded("Platonymous.Toolkit"); }
/// <summary>Whether Prismatic or Radioactive Tools mod is installed.</summary> /// <param name="modRegistry">API for fetching metadata about loaded mods.</param> public static bool HasHigherLevelToolMod(IModRegistry modRegistry) { return(modRegistry.IsLoaded("stokastic.PrismaticTools") || modRegistry.IsLoaded("kakashigr.RadioactiveTools")); }