summaryrefslogtreecommitdiff
path: root/src/SMAPI/Events
diff options
context:
space:
mode:
Diffstat (limited to 'src/SMAPI/Events')
-rw-r--r--src/SMAPI/Events/AssetEditPriority.cs16
-rw-r--r--src/SMAPI/Events/AssetRequestedEventArgs.cs4
2 files changed, 19 insertions, 1 deletions
diff --git a/src/SMAPI/Events/AssetEditPriority.cs b/src/SMAPI/Events/AssetEditPriority.cs
new file mode 100644
index 00000000..d41dfd7d
--- /dev/null
+++ b/src/SMAPI/Events/AssetEditPriority.cs
@@ -0,0 +1,16 @@
+namespace StardewModdingAPI.Events
+{
+ /// <summary>The priority for an asset edit when multiple apply for the same asset.</summary>
+ /// <remarks>You can also specify arbitrary intermediate values, like <c>AssetLoadPriority.Low + 5</c>.</remarks>
+ public enum AssetEditPriority
+ {
+ /// <summary>This edit should be applied before (i.e. 'under') <see cref="Default"/> edits.</summary>
+ Early = -1000,
+
+ /// <summary>The default priority.</summary>
+ Default = 0,
+
+ /// <summary>This edit should be applied after (i.e. 'on top of') <see cref="Default"/> edits.</summary>
+ Late = 1000
+ }
+}
diff --git a/src/SMAPI/Events/AssetRequestedEventArgs.cs b/src/SMAPI/Events/AssetRequestedEventArgs.cs
index 9e2cde7f..4d9ee236 100644
--- a/src/SMAPI/Events/AssetRequestedEventArgs.cs
+++ b/src/SMAPI/Events/AssetRequestedEventArgs.cs
@@ -100,6 +100,7 @@ namespace StardewModdingAPI.Events
/// <summary>Edit the asset after it's loaded.</summary>
/// <param name="apply">Apply changes to the asset.</param>
+ /// <param name="priority">If there are multiple edits that apply to the same asset, the priority with which this one should be applied.</param>
/// <param name="onBehalfOf">The content pack ID on whose behalf you're applying the change. This is only valid for content packs for your mod.</param>
/// <remarks>
/// Usage notes:
@@ -108,11 +109,12 @@ namespace StardewModdingAPI.Events
/// <item>You can apply any number of edits to the asset. Each edit will be applied on top of the previous one (i.e. it'll see the merged asset from all previous edits as its input).</item>
/// </list>
/// </remarks>
- public void Edit(Action<IAssetData> apply, string onBehalfOf = null)
+ public void Edit(Action<IAssetData> apply, AssetEditPriority priority = AssetEditPriority.Default, string onBehalfOf = null)
{
this.EditOperations.Add(
new AssetEditOperation(
mod: this.Mod,
+ priority: priority,
onBehalfOf: this.GetOnBehalfOf(this.Mod, onBehalfOf, "edit assets"),
apply
)