Build 0.20.8.0
This commit is contained in:
+1
-1
@@ -40,7 +40,7 @@ namespace Barotrauma.Steam
|
||||
CanBeFocused = false,
|
||||
UserData = p
|
||||
};
|
||||
if (p.Errors.Any())
|
||||
if (p.FatalLoadErrors.Any())
|
||||
{
|
||||
CreateModErrorInfo(p, regularBox, regularBox);
|
||||
regularBox.CanBeFocused = true;
|
||||
|
||||
+21
-21
@@ -49,21 +49,10 @@ namespace Barotrauma.Steam
|
||||
SteamManager.Workshop.DownloadModThenEnqueueInstall(item);
|
||||
}
|
||||
}
|
||||
|
||||
TaskPool.Add("RemoveUnsubscribedItems", SteamManager.Workshop.GetPublishedItems(), t =>
|
||||
|
||||
SteamManager.Workshop.DeleteUnsubscribedMods(removedPackages =>
|
||||
{
|
||||
if (!t.TryGetResult(out ISet<Steamworks.Ugc.Item> publishedItems)) { return; }
|
||||
|
||||
var allRequiredInstalled = subscribedIds.Union(publishedItems.Select(it => it.Id)).ToHashSet();
|
||||
bool needsRefresh = false;
|
||||
foreach (var id in installedIds.Where(id2 => !allRequiredInstalled.Contains(id2)))
|
||||
{
|
||||
Steamworks.Ugc.Item item = new Steamworks.Ugc.Item(id);
|
||||
SteamManager.Workshop.Uninstall(item);
|
||||
needsRefresh = true;
|
||||
}
|
||||
|
||||
if (needsRefresh)
|
||||
if (removedPackages.Any())
|
||||
{
|
||||
PopulateInstalledModLists();
|
||||
}
|
||||
@@ -487,8 +476,9 @@ namespace Barotrauma.Steam
|
||||
{
|
||||
string str = modsListFilter.Text;
|
||||
enabledRegularModsList.Content.Children.Concat(disabledRegularModsList.Content.Children)
|
||||
.ForEach(c => c.Visible = c.UserData is not ContentPackage p
|
||||
|| ModNameMatches(p, str) && ModMatchesTickboxes(p, c));
|
||||
.ForEach(c
|
||||
=> c.Visible = c.UserData is not ContentPackage p
|
||||
|| ModNameMatches(p, str) && ModMatchesTickboxes(p, c));
|
||||
}
|
||||
|
||||
private bool ModMatchesTickboxes(ContentPackage p, GUIComponent guiItem)
|
||||
@@ -550,7 +540,20 @@ namespace Barotrauma.Steam
|
||||
(p) => p.Name,
|
||||
ContentPackageManager.CorePackages.ToArray(),
|
||||
ContentPackageManager.EnabledPackages.Core!,
|
||||
(p) => { });
|
||||
(p) =>
|
||||
{
|
||||
enabledCoreDropdown.ButtonTextColor =
|
||||
p.HasAnyErrors
|
||||
? GUIStyle.Red
|
||||
: GUIStyle.TextColorNormal;
|
||||
});
|
||||
enabledCoreDropdown.ListBox.Content.Children
|
||||
.OfType<GUITextBlock>()
|
||||
.ForEach(tb =>
|
||||
CreateModErrorInfo(
|
||||
(tb.UserData as ContentPackage)!,
|
||||
tb,
|
||||
tb));
|
||||
|
||||
void addRegularModToList(RegularPackage mod, GUIListBox list)
|
||||
{
|
||||
@@ -658,10 +661,7 @@ namespace Barotrauma.Steam
|
||||
{
|
||||
CanBeFocused = false
|
||||
};
|
||||
if (mod.Errors.Any())
|
||||
{
|
||||
CreateModErrorInfo(mod, modFrame, modName);
|
||||
}
|
||||
CreateModErrorInfo(mod, modFrame, modName);
|
||||
if (ContentPackageManager.LocalPackages.Contains(mod))
|
||||
{
|
||||
var editButton = new GUIButton(new RectTransform(Vector2.One, frameContent.RectTransform, scaleBasis: ScaleBasis.Smallest), "",
|
||||
|
||||
+4
@@ -165,6 +165,10 @@ namespace Barotrauma.Steam
|
||||
.Select(c => c.UserData as RegularPackage).OfType<RegularPackage>().ToArray());
|
||||
PopulateInstalledModLists(forceRefreshEnabled: true, refreshDisabled: true);
|
||||
ContentPackageManager.LogEnabledRegularPackageErrors();
|
||||
enabledCoreDropdown.ButtonTextColor =
|
||||
EnabledCorePackage.HasAnyErrors
|
||||
? GUIStyle.Red
|
||||
: GUIStyle.TextColorNormal;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -294,10 +294,11 @@ namespace Barotrauma.Steam
|
||||
{
|
||||
//Reload the package to force hash recalculation
|
||||
string packageName = localPackage.Name;
|
||||
localPackage = ContentPackageManager.ReloadContentPackage(localPackage);
|
||||
if (localPackage is null)
|
||||
var result = ContentPackageManager.ReloadContentPackage(localPackage);
|
||||
if (!result.TryUnwrapSuccess(out localPackage))
|
||||
{
|
||||
throw new Exception($"\"{packageName}\" was removed upon reload");
|
||||
throw new Exception($"\"{packageName}\" was removed upon reload",
|
||||
result.TryUnwrapFailure(out var exception) ? exception : null);
|
||||
}
|
||||
|
||||
//Set up the Ugc.Editor object that we'll need to publish
|
||||
|
||||
@@ -133,20 +133,29 @@ namespace Barotrauma.Steam
|
||||
return searchBox;
|
||||
}
|
||||
|
||||
protected void CreateModErrorInfo(ContentPackage mod, GUIComponent uiElement, GUITextBlock nameText)
|
||||
protected static void CreateModErrorInfo(ContentPackage mod, GUIComponent uiElement, GUITextBlock nameText)
|
||||
{
|
||||
if (mod.Errors.Any())
|
||||
uiElement.ToolTip = "";
|
||||
if (mod.FatalLoadErrors.Any())
|
||||
{
|
||||
const int maxErrorsToShow = 5;
|
||||
nameText.TextColor = GUIStyle.Red;
|
||||
uiElement.ToolTip =
|
||||
TextManager.GetWithVariable("contentpackagehaserrors", "[packagename]", mod.Name)
|
||||
+ '\n' + string.Join('\n', mod.Errors.Take(maxErrorsToShow).Select(e => e.Message));
|
||||
if (mod.Errors.Count() > maxErrorsToShow)
|
||||
TextManager.GetWithVariable("ContentPackageHasFatalErrors", "[packagename]", mod.Name)
|
||||
+ '\n' + string.Join('\n', mod.FatalLoadErrors.Take(maxErrorsToShow).Select(e => e.Message));
|
||||
if (mod.FatalLoadErrors.Length > maxErrorsToShow)
|
||||
{
|
||||
uiElement.ToolTip += '\n' + TextManager.GetWithVariable("workshopitemdownloadprompttruncated", "[number]", (mod.Errors.Count() - maxErrorsToShow).ToString());
|
||||
uiElement.ToolTip += '\n' + TextManager.GetWithVariable("workshopitemdownloadprompttruncated", "[number]", (mod.FatalLoadErrors.Count() - maxErrorsToShow).ToString());
|
||||
}
|
||||
}
|
||||
|
||||
if (mod.EnableError.IsSome())
|
||||
{
|
||||
nameText.TextColor = GUIStyle.Red;
|
||||
if (!uiElement.ToolTip.IsNullOrWhiteSpace()) { uiElement.ToolTip += "\n"; }
|
||||
uiElement.ToolTip += TextManager.GetWithVariable(
|
||||
"ContentPackageEnableError", "[packagename]", mod.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user