Skip to content

Commit

Permalink
copy from modded grid config if grid key not set
Browse files Browse the repository at this point in the history
  • Loading branch information
MegaPiggy committed Sep 14, 2024
1 parent dc9e284 commit 1c2ac2b
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions Winch/Util/QuestUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using UnityEngine;
using UnityEngine.AddressableAssets;
using Winch.Core;
using Winch.Data.GridConfig;
using Winch.Data.Quest;
using Winch.Data.Quest.Grid;
using Winch.Data.Quest.Step;
Expand Down Expand Up @@ -410,16 +411,24 @@ internal static void AddQuestGridConfigFromMeta(string metaPath)
}
if (PopulateQuestGridConfigFromMetaWithConverter(questGridConfig, meta))
{
questGridConfig.Populate();
var gridConfig = questGridConfig.GridConfiguration;
if (gridConfig != null)
{
if (questGridConfig.gridKey != GridKey.NONE)
GameManager.Instance.GameConfigData.gridConfigs.SafeAdd(questGridConfig.gridKey, gridConfig);
else if (gridConfig is DeferredGridConfiguration deferredGridConfig)
questGridConfig.gridKey = deferredGridConfig.gridKey;
}

if (questGridConfig.isSaved && questGridConfig.gridKey == GridKey.NONE)
{
WinchCore.Log.Error($"Savable quest grid config {id} at {metaPath} failed to load because \"gridKey\" is required");
return;
}

ModdedQuestGridConfigDict.Add(id, questGridConfig);
AddressablesUtil.AddResourceAtLocation("QuestGridConfig", id, id, questGridConfig);
questGridConfig.Populate();
if (questGridConfig.gridKey != GridKey.NONE && questGridConfig.GridConfiguration != null)
GameManager.Instance.GameConfigData.gridConfigs.SafeAdd(questGridConfig.gridKey, questGridConfig.GridConfiguration);
}
else
{
Expand Down

0 comments on commit 1c2ac2b

Please sign in to comment.