/// <summary> /// <para>Creates a new <see cref="CustomMutator"/> with the specified <paramref name="id"/>, <paramref name="name"/> and <paramref name="description"/>.</para> /// </summary> public static CustomMutator CreateCustomMutator(string id, bool unlockedFromStart, CustomNameInfo name, CustomNameInfo description) { CustomMutator customMutator = GetCustomMutator(id); if (customMutator != null) { string message = string.Concat("A CustomMutator with Id \"", id, "\" already exists!"); Logger.LogError(message); throw new ArgumentException(message, nameof(id)); } CustomMutators.Add(customMutator = new CustomMutator(id, CreateCustomName(id, "Unlock", name), CreateCustomName("D_" + id, "Unlock", description) )); customMutator.Unlocked = unlockedFromStart; PluginInstance.Setup(customMutator); Logger.LogDebug(string.Concat("A CustomMutator with Id \"", id, "\" was created.")); return(customMutator); }
/// <summary> /// <para>Finds an existing <see cref="CustomMutator"/> by its <paramref name="id"/>.</para> /// </summary> public static CustomMutator GetCustomMutator(string id) => CustomMutators.Find(m => m.Id == id);