Skip to content

Commit

Permalink
Some changes for 1.5 :3
Browse files Browse the repository at this point in the history
  • Loading branch information
cheese3660 committed Aug 24, 2023
1 parent 1604b27 commit cf7bd58
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 24 deletions.
10 changes: 1 addition & 9 deletions SpaceWarp.Core/API/Loading/Loading.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ public static class Loading
internal static List<Func<SpaceWarpPluginDescriptor, DescriptorLoadingAction>> DescriptorLoadingActionGenerators =
new();

internal static List<Func<SpaceWarpPluginDescriptor, DescriptorLoadingAction>>
FallbackDescriptorLoadingActionGenerators =
new();

internal static List<Func<BaseSpaceWarpPlugin, ModLoadingAction>> LoadingActionGenerators = new();
internal static List<Func<FlowAction>> GeneralLoadingActions = new();

Expand All @@ -33,11 +29,7 @@ internal static List<Func<SpaceWarpPluginDescriptor, DescriptorLoadingAction>>
public static void AddAssetLoadingAction(string subfolder, string name,
Func<string, string, List<(string name, UnityObject asset)>> importFunction, params string[] extensions)
{
AddModLoadingAction(name,
extensions.Length == 0
? CreateAssetLoadingActionWithoutExtension(subfolder, importFunction)
: CreateAssetLoadingActionWithExtensions(subfolder, importFunction, extensions));
FallbackDescriptorLoadingActionGenerators.Add(d => new DescriptorLoadingAction(name,
DescriptorLoadingActionGenerators.Add(d => new DescriptorLoadingAction(name,
extensions.Length == 0
? CreateAssetLoadingActionWithoutExtensionDescriptor(subfolder, importFunction)
: CreateAssetLoadingActionWithExtensionsDescriptor(subfolder, importFunction, extensions), d));
Expand Down
18 changes: 3 additions & 15 deletions SpaceWarp.Core/Patching/BootstrapPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,22 +89,10 @@ private static void DoLoadingActions(IList<SpaceWarpPluginDescriptor> allPlugins

private static void DoOldStyleLoadingActions(SequentialFlow flow, SpaceWarpPluginDescriptor plugin)
{
if (plugin.Plugin != null)
if (plugin.Plugin is not BaseSpaceWarpPlugin baseSpaceWarpPlugin) return;
foreach (var action in Loading.LoadingActionGenerators)
{
foreach (var action in Loading.LoadingActionGenerators)
{
if (plugin.Plugin is BaseSpaceWarpPlugin baseSpaceWarpPlugin)
{
flow.AddAction(action(baseSpaceWarpPlugin));
}
}
}
else
{
foreach (var action in Loading.FallbackDescriptorLoadingActionGenerators)
{
flow.AddAction(action(plugin));
}
flow.AddAction(action(baseSpaceWarpPlugin));
}
}

Expand Down

0 comments on commit cf7bd58

Please sign in to comment.