using System; using System.Collections; using System.Collections.Generic; using System.Collections.Immutable; using Barotrauma; using Barotrauma.LuaCs.Data; namespace Barotrauma.LuaCs.Data; public interface IPackageDependency : IDataInfo, IEquatable { public IPackageInfo Dependency { get; } bool IEquatable.Equals(IPackageDependency other) { return other is not null && Dependency.Equals(other.Dependency); } } public interface IPackageInfo : IEquatable { /// /// Name of the content package. /// public string Name { get; } /// /// Steam ID of the package. /// public ulong SteamWorkshopId { get; } /// /// The Guid for the runtime instance of the package. /// public uint Id { get; } /// /// Gets the reference to the best-match target ContentPackage that meets the requirement. /// /// The reference, or null if none was found. public ContentPackage GetPackage(); /// /// Tries to retrieve the current best and returns true if none was found. /// public bool IsMissing => GetPackage() is null; bool IEquatable.Equals(IPackageInfo other) { if (other is null) return false; if (ReferenceEquals(other, this)) return true; if (!this.IsMissing && !other.IsMissing && ReferenceEquals(other.GetPackage, this.GetPackage)) return true; if (this.SteamWorkshopId != 0 && other.SteamWorkshopId == this.SteamWorkshopId) return true; return this.Name == other.Name; } } public interface IPackageDependenciesInfo { /// /// List of required packages. /// ImmutableArray Dependencies { get; } }