/// <summary>Determines whether the animal is valid.</summary> /// <returns><see langword="true"/> if the animal is valid; otherwise, <see langword="false"/>.</returns> public bool IsValid() { // ensure animal name is valid if (string.IsNullOrEmpty(Name)) { ModEntry.Instance.Monitor.Log("Animal subtype doesn't have a name", LogLevel.Error); return(false); } if (Name.Contains('.') || Name.Contains(',')) { ModEntry.Instance.Monitor.Log($"Animal subtype: {Name} cannot have a '.' or ',' in the name", LogLevel.Error); return(false); } // remove any duplicate produce from each subtype var oldCount = Produce.Count; Produce = Produce.Distinct(new ParsedAnimalProduceEqualityComparer()).ToList(); if (Produce.Count != oldCount) { ModEntry.Instance.Monitor.Log($"Atleast one produce has been removed from animal subtype: {InternalName} as it had the same {nameof(AnimalProduce.UniqueName)} as another produce in the same subtype", LogLevel.Error); } return(true); }