Hi,
I needed to define some custom nodes for teh snapgrid flow graph, here are the changes i made to the Assets/CodeRespawn/DungeonArchitect/Scripts/Modules/FlowImpl/SnapGridFlow/SnapGridFlowDomains.cs
file to allow for that, in case anyone else wants to do the same:
(so you basically just need to define a class that interits from FlowExecTask and has the FlowExecNodeInfo Attribute defined before it, the class name also has to start with “SGF”)
using System.Reflection;
using DungeonArchitect.Flow.Domains;
using DungeonArchitect.Flow.Exec;
namespace DungeonArchitect.Flow.Impl.SnapGridFlow
{
public class SnapGridFlowLayoutGraph3DDomain : IFlowDomain
{
public Type[] SupportedTasks { get; } = supportedTypes ?? FindSupportedTypes();
public string DisplayName { get; } = "Layout Graph";
private static readonly Type[] supportedTypes;
private static Type[] FindSupportedTypes() =>
AppDomain
.CurrentDomain
.GetAssemblies()
.SelectMany(asm =>
asm.GetTypes().Where(t =>
{
// TODO: (Dom De Re) This could be simplified but it was easier to debug this way
if (!t.IsAbstract && typeof(FlowExecTask).IsAssignableFrom(t))
{
var x = t.IsDefined(typeof(FlowExecNodeInfoAttribute), true);
var y = t.Name.StartsWith("SGF");
return x && y;
}
return false;
})
)
.OrderBy(t => t.GetCustomAttribute<FlowExecNodeInfoAttribute>().Weight)
.ToArray();
}
}