diff --git a/FrostyModSupport/FrostyModExecutor.cs b/FrostyModSupport/FrostyModExecutor.cs
index 70924ca9d..984e670f1 100644
--- a/FrostyModSupport/FrostyModExecutor.cs
+++ b/FrostyModSupport/FrostyModExecutor.cs
@@ -301,9 +301,12 @@ private void ProcessModResources(IResourceContainer fmod)
// add in existing bundles
var ebxEntry = am.GetEbxEntry(resource.Name);
- foreach (int bid in ebxEntry.Bundles)
+ if (ebxEntry != null)
{
- bundles.Add(HashBundle(am.GetBundleEntry(bid)));
+ foreach (int bid in ebxEntry.Bundles)
+ {
+ bundles.Add(HashBundle(am.GetBundleEntry(bid)));
+ }
}
entry.ExtraData = extraData;
diff --git a/FrostyPlugin/Handlers/LegacyCustomActionHandler.cs b/FrostyPlugin/Handlers/LegacyCustomActionHandler.cs
index da4a11ad5..f647258d8 100644
--- a/FrostyPlugin/Handlers/LegacyCustomActionHandler.cs
+++ b/FrostyPlugin/Handlers/LegacyCustomActionHandler.cs
@@ -15,6 +15,8 @@ public sealed class LegacyCustomActionHandler : ILegacyCustomActionHandler
{
public HandlerUsage Usage => HandlerUsage.Merge;
+ public bool ModifiesAddedAssets => false;
+
private class ModLegacyFileEntry
{
public int Hash { get; set; }
diff --git a/FrostyPlugin/IO/FrostyModWriter.cs b/FrostyPlugin/IO/FrostyModWriter.cs
index d7880ae4e..e2317abb9 100644
--- a/FrostyPlugin/IO/FrostyModWriter.cs
+++ b/FrostyPlugin/IO/FrostyModWriter.cs
@@ -330,7 +330,7 @@ int HashBundle(BundleEntry bentry)
if (entry.HasModifiedData)
{
ICustomActionHandler actionHandler = App.PluginManager.GetCustomHandler(entry.Type);
- if (actionHandler != null && !entry.IsAdded)
+ if (actionHandler != null && (!entry.IsAdded || actionHandler.ModifiesAddedAssets == true))
{
// use custom action handler to save asset to mod
actionHandler.SaveToMod(this, entry);
diff --git a/FrostyPlugin/Mod/IModCustomHandler.cs b/FrostyPlugin/Mod/IModCustomHandler.cs
index fb7947db1..dfbbefe2c 100644
--- a/FrostyPlugin/Mod/IModCustomHandler.cs
+++ b/FrostyPlugin/Mod/IModCustomHandler.cs
@@ -15,6 +15,11 @@ public interface IModCustomActionHandler
///
HandlerUsage Usage { get; }
+ ///
+ /// Allows custom handlers to be used on duplicated assets which will make them mergable in FMM.
+ ///
+ bool ModifiesAddedAssets { get; }
+
///
/// Handles the loading and merging of the custom data.
///
diff --git a/Plugins/BiowareLocalizationPlugin/BiowareLocalizationCustomActionHandler.cs b/Plugins/BiowareLocalizationPlugin/BiowareLocalizationCustomActionHandler.cs
index 51765c31f..65de21b8b 100644
--- a/Plugins/BiowareLocalizationPlugin/BiowareLocalizationCustomActionHandler.cs
+++ b/Plugins/BiowareLocalizationPlugin/BiowareLocalizationCustomActionHandler.cs
@@ -18,6 +18,8 @@ public class BiowareLocalizationCustomActionHandler : ICustomActionHandler
public HandlerUsage Usage => HandlerUsage.Merge;
+ public bool ModifiesAddedAssets => false;
+
// A mod is comprised of a series of base resources, embedded, ebx, res, and chunks. Embedded are used internally
// for the icon and images of a mod. Ebx/Res/Chunks are the core resources used for applying data to the game.
// When you create a custom handler, you need to provide your own resources for your custom handled data. This
diff --git a/Plugins/DifficultyWeaponTableDataPlugin/Handlers/DifficultyWeaponTableActionHandler.cs b/Plugins/DifficultyWeaponTableDataPlugin/Handlers/DifficultyWeaponTableActionHandler.cs
index 1620a5506..c0c1989ae 100644
--- a/Plugins/DifficultyWeaponTableDataPlugin/Handlers/DifficultyWeaponTableActionHandler.cs
+++ b/Plugins/DifficultyWeaponTableDataPlugin/Handlers/DifficultyWeaponTableActionHandler.cs
@@ -22,6 +22,8 @@ public class DifficultyWeaponTableActionHandler : ICustomActionHandler
// data from one mod with another, or does it merge the two together.
public HandlerUsage Usage => HandlerUsage.Merge;
+ public bool ModifiesAddedAssets => false;
+
// A mod is comprised of a series of base resources, embedded, ebx, res, and chunks. Embedded are used internally
// for the icon and images of a mod. Ebx/Res/Chunks are the core resources used for applying data to the game.
// When you create a custom handler, you need to provide your own resources for your custom handled data. This
diff --git a/Plugins/FsLocalizationPlugin/FsLocalizationCustomActionHandler.cs b/Plugins/FsLocalizationPlugin/FsLocalizationCustomActionHandler.cs
index 2fa12ba58..d446183d3 100644
--- a/Plugins/FsLocalizationPlugin/FsLocalizationCustomActionHandler.cs
+++ b/Plugins/FsLocalizationPlugin/FsLocalizationCustomActionHandler.cs
@@ -18,6 +18,8 @@ public class FsLocalizationCustomActionHandler : ICustomActionHandler
{
public HandlerUsage Usage => HandlerUsage.Merge;
+ public bool ModifiesAddedAssets => false;
+
private class FsLocalizationResource : EditorModResource
{
public override ModResourceType Type => ModResourceType.Ebx;
diff --git a/Plugins/MeshSetPlugin/Handlers/ShaderBlockDepotCustomActionHandler.cs b/Plugins/MeshSetPlugin/Handlers/ShaderBlockDepotCustomActionHandler.cs
index 3d28d4328..84dd2aed7 100644
--- a/Plugins/MeshSetPlugin/Handlers/ShaderBlockDepotCustomActionHandler.cs
+++ b/Plugins/MeshSetPlugin/Handlers/ShaderBlockDepotCustomActionHandler.cs
@@ -13,6 +13,8 @@ public class ShaderBlockDepotCustomActionHandler : ICustomActionHandler
{
public HandlerUsage Usage => HandlerUsage.Merge;
+ public bool ModifiesAddedAssets => false;
+
private class ShaderBlockDepotResource : EditorModResource
{
public static uint Hash => 0x89ef2205;
diff --git a/Plugins/TestPlugin/Handlers/DifficultyWeaponTableActionHandler.cs b/Plugins/TestPlugin/Handlers/DifficultyWeaponTableActionHandler.cs
index ec2e91e66..d673ca722 100644
--- a/Plugins/TestPlugin/Handlers/DifficultyWeaponTableActionHandler.cs
+++ b/Plugins/TestPlugin/Handlers/DifficultyWeaponTableActionHandler.cs
@@ -18,6 +18,8 @@ public class DifficultyWeaponTableActionHandler : ICustomActionHandler
// data from one mod with another, or does it merge the two together.
public HandlerUsage Usage => HandlerUsage.Merge;
+ public bool ModifiesAddedAssets => false;
+
// A mod is comprised of a series of base resources, embedded, ebx, res, and chunks. Embedded are used internally
// for the icon and images of a mod. Ebx/Res/Chunks are the core resources used for applying data to the game.
// When you create a custom handler, you need to provide your own resources for your custom handled data. This
diff --git a/Plugins/TestPlugin/Handlers/SvgImageCustomActionHandler.cs b/Plugins/TestPlugin/Handlers/SvgImageCustomActionHandler.cs
index 95c7b4ed4..6b285eab1 100644
--- a/Plugins/TestPlugin/Handlers/SvgImageCustomActionHandler.cs
+++ b/Plugins/TestPlugin/Handlers/SvgImageCustomActionHandler.cs
@@ -18,6 +18,8 @@ public class SvgImageCustomActionHandler : ICustomActionHandler
// data from one mod with another, or does it merge the two together.
public HandlerUsage Usage => HandlerUsage.Modify;
+ public bool ModifiesAddedAssets => false;
+
// A mod is comprised of a series of base resources, embedded, ebx, res, and chunks. Embedded are used internally
// for the icon and images of a mod. Ebx/Res/Chunks are the core resources used for applying data to the game.
// When you create a custom handler, you need to provide your own resources for your custom handled data. This