Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a "ModifiesAddedAssets" variable to IModCustomHandler #307

Open
wants to merge 3 commits into
base: 1.0.6.3
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions FrostyModSupport/FrostyModExecutor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions FrostyPlugin/Handlers/LegacyCustomActionHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down
2 changes: 1 addition & 1 deletion FrostyPlugin/IO/FrostyModWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 5 additions & 0 deletions FrostyPlugin/Mod/IModCustomHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ public interface IModCustomActionHandler
/// </summary>
HandlerUsage Usage { get; }

/// <summary>
/// Allows custom handlers to be used on duplicated assets which will make them mergable in FMM.
/// </summary>
bool ModifiesAddedAssets { get; }

/// <summary>
/// Handles the loading and merging of the custom data.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions Plugins/TestPlugin/Handlers/SvgImageCustomActionHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down