summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework/ModLoading
diff options
context:
space:
mode:
Diffstat (limited to 'src/SMAPI/Framework/ModLoading')
-rw-r--r--src/SMAPI/Framework/ModLoading/AssemblyLoader.cs5
-rw-r--r--src/SMAPI/Framework/ModLoading/InstructionHandleResult.cs3
-rw-r--r--src/SMAPI/Framework/ModLoading/ModMetadata.cs21
3 files changed, 29 insertions, 0 deletions
diff --git a/src/SMAPI/Framework/ModLoading/AssemblyLoader.cs b/src/SMAPI/Framework/ModLoading/AssemblyLoader.cs
index 7670eb3a..b5533335 100644
--- a/src/SMAPI/Framework/ModLoading/AssemblyLoader.cs
+++ b/src/SMAPI/Framework/ModLoading/AssemblyLoader.cs
@@ -356,6 +356,11 @@ namespace StardewModdingAPI.Framework.ModLoading
mod.SetWarning(ModWarning.UsesDynamic);
break;
+ case InstructionHandleResult.DetectedConsoleAccess:
+ this.Monitor.LogOnce(loggedMessages, $"{logPrefix}Detected direct console access ({handler.NounPhrase}) in assembly {filename}.");
+ mod.SetWarning(ModWarning.AccessesConsole);
+ break;
+
case InstructionHandleResult.DetectedFilesystemAccess:
this.Monitor.LogOnce(loggedMessages, $"{logPrefix}Detected filesystem access ({handler.NounPhrase}) in assembly {filename}.");
mod.SetWarning(ModWarning.AccessesFilesystem);
diff --git a/src/SMAPI/Framework/ModLoading/InstructionHandleResult.cs b/src/SMAPI/Framework/ModLoading/InstructionHandleResult.cs
index d93b603d..a948213b 100644
--- a/src/SMAPI/Framework/ModLoading/InstructionHandleResult.cs
+++ b/src/SMAPI/Framework/ModLoading/InstructionHandleResult.cs
@@ -26,6 +26,9 @@ namespace StardewModdingAPI.Framework.ModLoading
/// <summary>The instruction is compatible, but references <see cref="ISpecializedEvents.UnvalidatedUpdateTicking"/> or <see cref="ISpecializedEvents.UnvalidatedUpdateTicked"/> which may impact stability.</summary>
DetectedUnvalidatedUpdateTick,
+ /// <summary>The instruction accesses the SMAPI console directly.</summary>
+ DetectedConsoleAccess,
+
/// <summary>The instruction accesses the filesystem directly.</summary>
DetectedFilesystemAccess,
diff --git a/src/SMAPI/Framework/ModLoading/ModMetadata.cs b/src/SMAPI/Framework/ModLoading/ModMetadata.cs
index 7f788d17..0e90362e 100644
--- a/src/SMAPI/Framework/ModLoading/ModMetadata.cs
+++ b/src/SMAPI/Framework/ModLoading/ModMetadata.cs
@@ -188,6 +188,27 @@ namespace StardewModdingAPI.Framework.ModLoading
}
}
+ /// <summary>Get the mod IDs that must be installed to load this mod.</summary>
+ /// <param name="includeOptional">Whether to include optional dependencies.</param>
+ public IEnumerable<string> GetRequiredModIds(bool includeOptional = false)
+ {
+ HashSet<string> required = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase);
+
+ // yield dependencies
+ if (this.Manifest?.Dependencies != null)
+ {
+ foreach (var entry in this.Manifest?.Dependencies)
+ {
+ if ((entry.IsRequired || includeOptional) && required.Add(entry.UniqueID))
+ yield return entry.UniqueID;
+ }
+ }
+
+ // yield content pack parent
+ if (this.Manifest?.ContentPackFor?.UniqueID != null && required.Add(this.Manifest.ContentPackFor.UniqueID))
+ yield return this.Manifest.ContentPackFor.UniqueID;
+ }
+
/// <summary>Whether the mod has at least one valid update key set.</summary>
public bool HasValidUpdateKeys()
{