(acf0cb343) Fixes to EnableWorkShopItem: - Don't allow enabling if the item is not compatible with the user's version of Barotrauma or if it's a core package that's missing some required files. - Don't allow enabling if the item external files referenced in the content package are not found (e.g. if a mod uses vanilla files but the vanilla files aren't found).
This commit is contained in:
@@ -383,6 +383,7 @@ namespace Barotrauma
|
||||
|
||||
var titleText = new GUITextBlock(new RectTransform(new Vector2(0.5f, 0.0f), rightColumn.RectTransform), EnsureUTF8(item.Title), textAlignment: Alignment.CenterLeft, wrap: true)
|
||||
{
|
||||
UserData = "titletext",
|
||||
CanBeFocused = false
|
||||
};
|
||||
|
||||
@@ -575,8 +576,7 @@ namespace Barotrauma
|
||||
|
||||
private bool ToggleItemEnabled(GUITickBox tickBox)
|
||||
{
|
||||
Facepunch.Steamworks.Workshop.Item item = tickBox.UserData as Facepunch.Steamworks.Workshop.Item;
|
||||
if (item == null) { return false; }
|
||||
if (!(tickBox.UserData is Facepunch.Steamworks.Workshop.Item item)) { return false; }
|
||||
|
||||
var updateButton = tickBox.Parent.FindChild("updatebutton");
|
||||
|
||||
@@ -585,7 +585,9 @@ namespace Barotrauma
|
||||
{
|
||||
if (!SteamManager.EnableWorkShopItem(item, false, out errorMsg))
|
||||
{
|
||||
tickBox.Enabled = false;
|
||||
tickBox.Visible = false;
|
||||
tickBox.Selected = false;
|
||||
if (tickBox.Parent.GetChildByUserData("titletext") is GUITextBlock titleText) { titleText.TextColor = Color.Red; }
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user