This commit is contained in:
EvilFactory
2022-10-20 12:14:02 -03:00
63 changed files with 579 additions and 339 deletions
@@ -25,7 +25,7 @@ namespace Barotrauma
private PlayerBalanceElement? playerBalanceElement;
private List<CharacterInfo> PendingHires => campaign.Map?.CurrentLocation?.HireManager?.PendingHires;
private bool HasPermission => campaignUI.Campaign.AllowedToManageCampaign(ClientPermissions.ManageHires);
private bool HasPermission => CampaignMode.AllowedToManageCampaign(ClientPermissions.ManageHires);
private Point resolutionWhenCreated;
@@ -139,10 +139,10 @@ namespace Barotrauma
return tab switch
{
StoreTab.Buy => true,
StoreTab.Sell => campaignUI.Campaign.AllowedToManageCampaign(Networking.ClientPermissions.SellInventoryItems),
StoreTab.SellSub => campaignUI.Campaign.AllowedToManageCampaign(Networking.ClientPermissions.SellSubItems),
StoreTab.Sell => CampaignMode.AllowedToManageCampaign(Networking.ClientPermissions.SellInventoryItems),
StoreTab.SellSub => CampaignMode.AllowedToManageCampaign(Networking.ClientPermissions.SellSubItems),
_ => false,
};
};
}
private void UpdatePermissions()
@@ -1867,10 +1867,13 @@ namespace Barotrauma
GUITextBlock jobBlock = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), nameLayout.RectTransform), job.Name, font: GUIStyle.SmallFont) { TextColor = job.Prefab.UIColor };
}
LocalizedString traitString = TextManager.AddPunctuation(':', TextManager.Get("PersonalityTrait"), info.PersonalityTrait.DisplayName);
Vector2 traitSize = GUIStyle.SmallFont.MeasureString(traitString);
GUITextBlock traitBlock = new GUITextBlock(new RectTransform(Vector2.One, nameLayout.RectTransform), traitString, font: GUIStyle.SmallFont);
traitBlock.RectTransform.NonScaledSize = traitSize.Pad(traitBlock.Padding).ToPoint();
if (info.PersonalityTrait != null)
{
LocalizedString traitString = TextManager.AddPunctuation(':', TextManager.Get("PersonalityTrait"), info.PersonalityTrait.DisplayName);
Vector2 traitSize = GUIStyle.SmallFont.MeasureString(traitString);
GUITextBlock traitBlock = new GUITextBlock(new RectTransform(Vector2.One, nameLayout.RectTransform), traitString, font: GUIStyle.SmallFont);
traitBlock.RectTransform.NonScaledSize = traitSize.Pad(traitBlock.Padding).ToPoint();
}
IEnumerable<TalentPrefab> talentsOutsideTree = info.GetUnlockedTalentsOutsideTree().Select(e => TalentPrefab.TalentPrefabs.Find(c => c.Identifier == e));
if (talentsOutsideTree.Count() > 0)
@@ -847,7 +847,7 @@ namespace Barotrauma
foreach (UpgradePrefab prefab in prefabs)
{
if (prefab.MaxLevel is 0) { continue; }
if (prefab.GetMaxLevelForCurrentSub() == 0) { continue; }
CreateUpgradeEntry(prefab, category, parent.Content, submarine, entitiesOnSub);
}
}
@@ -1080,7 +1080,7 @@ namespace Barotrauma
public static GUIFrame CreateUpgradeFrame(UpgradePrefab prefab, UpgradeCategory category, CampaignMode campaign, RectTransform rectTransform, bool addBuyButton = true)
{
int price = prefab.Price.GetBuyprice(campaign.UpgradeManager.GetUpgradeLevel(prefab, category), campaign.Map?.CurrentLocation);
int price = prefab.Price.GetBuyPrice(campaign.UpgradeManager.GetUpgradeLevel(prefab, category), campaign.Map?.CurrentLocation);
return CreateUpgradeEntry(rectTransform, prefab.Sprite, prefab.Name, prefab.Description, price, new CategoryData(category, prefab), addBuyButton, upgradePrefab: prefab, currentLevel: campaign.UpgradeManager.GetUpgradeLevel(prefab, category));
}
@@ -1177,11 +1177,12 @@ namespace Barotrauma
private static void UpdateUpgradePercentageText(GUITextBlock text, UpgradePrefab upgradePrefab, int currentLevel)
{
float nextIncrease = upgradePrefab.IncreaseOnTooltip * (Math.Min(currentLevel + 1, upgradePrefab.MaxLevel));
int maxLevel = upgradePrefab.GetMaxLevelForCurrentSub();
float nextIncrease = upgradePrefab.IncreaseOnTooltip * Math.Min(currentLevel + 1, maxLevel);
if (nextIncrease != 0f)
{
text.Text = $"{Math.Round(nextIncrease, 1)} %";
if (currentLevel == upgradePrefab.MaxLevel)
if (currentLevel == maxLevel)
{
text.TextColor = Color.Gray;
}
@@ -1221,7 +1222,7 @@ namespace Barotrauma
{
LocalizedString promptBody = TextManager.GetWithVariables("Upgrades.PurchasePromptBody",
("[upgradename]", prefab.Name),
("[amount]", prefab.Price.GetBuyprice(Campaign.UpgradeManager.GetUpgradeLevel(prefab, category), Campaign.Map?.CurrentLocation).ToString()));
("[amount]", prefab.Price.GetBuyPrice(Campaign.UpgradeManager.GetUpgradeLevel(prefab, category), Campaign.Map?.CurrentLocation).ToString()));
currectConfirmation = EventEditorScreen.AskForConfirmation(TextManager.Get("Upgrades.PurchasePromptTitle"), promptBody, () =>
{
if (GameMain.NetworkMember != null)
@@ -1617,14 +1618,15 @@ namespace Barotrauma
{
int currentLevel = campaign.UpgradeManager.GetUpgradeLevel(prefab, category);
LocalizedString progressText = TextManager.GetWithVariables("upgrades.progressformat", ("[level]", currentLevel.ToString()), ("[maxlevel]", prefab.MaxLevel.ToString()));
int maxLevel = prefab.GetMaxLevelForCurrentSub();
LocalizedString progressText = TextManager.GetWithVariables("upgrades.progressformat", ("[level]", currentLevel.ToString()), ("[maxlevel]", maxLevel.ToString()));
if (prefabFrame.FindChild("progressbar", true) is { } progressParent)
{
GUIProgressBar bar = progressParent.GetChild<GUIProgressBar>();
if (bar != null)
{
bar.BarSize = currentLevel / (float) prefab.MaxLevel;
bar.Color = currentLevel >= prefab.MaxLevel ? GUIStyle.Green : GUIStyle.Orange;
bar.BarSize = currentLevel / (float)maxLevel;
bar.Color = currentLevel >= maxLevel ? GUIStyle.Green : GUIStyle.Orange;
}
GUITextBlock block = progressParent.GetChild<GUITextBlock>();
@@ -1637,12 +1639,12 @@ namespace Barotrauma
GUITextBlock priceLabel = textBlocks[0];
priceLabel.Visible = true;
int price = prefab.Price.GetBuyprice(campaign.UpgradeManager.GetUpgradeLevel(prefab, category), campaign.Map?.CurrentLocation);
int price = prefab.Price.GetBuyPrice(campaign.UpgradeManager.GetUpgradeLevel(prefab, category), campaign.Map?.CurrentLocation);
if (priceLabel != null && !WaitForServerUpdate)
{
priceLabel.Text = TextManager.FormatCurrency(price);
if (currentLevel >= prefab.MaxLevel)
if (currentLevel >= maxLevel)
{
priceLabel.Text = TextManager.Get("Upgrade.MaxedUpgrade");
}
@@ -1651,7 +1653,7 @@ namespace Barotrauma
GUIButton button = buttonParent.GetChild<GUIButton>();
if (button != null)
{
button.Enabled = currentLevel < prefab.MaxLevel;
button.Enabled = currentLevel < maxLevel;
if (WaitForServerUpdate || campaign.GetBalance() < price)
{
button.Enabled = false;
@@ -1697,13 +1699,14 @@ namespace Barotrauma
foreach (GUIComponent component in indicators.Children)
{
if (!(component is GUIImage image)) { continue; }
if (component is not GUIImage image) { continue; }
foreach (UpgradePrefab prefab in prefabs)
{
if (component.UserData != prefab) { continue; }
if (prefab.MaxLevel is 0)
int maxLevel = prefab.GetMaxLevelForCurrentSub();
if (maxLevel == 0)
{
component.Visible = false;
continue;
@@ -1715,7 +1718,6 @@ namespace Barotrauma
GUIComponentStyle onStyle = styles["upgradeindicatoron".ToIdentifier()];
GUIComponentStyle dimStyle = styles["upgradeindicatordim".ToIdentifier()];
GUIComponentStyle offStyle = styles["upgradeindicatoroff".ToIdentifier()];
int maxLevel = prefab.MaxLevel;
if (maxLevel == 0)
{
@@ -89,7 +89,7 @@ namespace Barotrauma
/// <summary>
/// There is a server-side implementation of the method in <see cref="MultiPlayerCampaign"/>
/// </summary>
public bool AllowedToManageCampaign(ClientPermissions permissions)
public static bool AllowedToManageCampaign(ClientPermissions permissions)
{
//allow managing the round if the client has permissions, is the owner, the only client in the server,
//or if no-one has management permissions
@@ -99,7 +99,8 @@ namespace Barotrauma
GameMain.Client.HasPermission(ClientPermissions.ManageCampaign) ||
GameMain.Client.ConnectedClients.Count == 1 ||
GameMain.Client.IsServerOwner ||
GameMain.Client.ConnectedClients.None(c => c.InGame && (c.IsOwner || c.HasPermission(permissions)));
//allow managing if no-one with permissions is alive
GameMain.Client.ConnectedClients.None(c => c.InGame && c.Character is { IsIncapacitated: false, IsDead: false } && (c.IsOwner || c.HasPermission(permissions)));
}
public static bool AllowedToManageWallets()
@@ -265,6 +265,8 @@ namespace Barotrauma.Items.Components
foreach (DeconstructItem deconstructItem in it.Prefab.DeconstructItems)
{
if (!deconstructItem.IsValidDeconstructor(item)) { continue; }
float percentageHealth = it.Condition / it.MaxCondition;
if (percentageHealth < deconstructItem.MinCondition || percentageHealth > deconstructItem.MaxCondition) { continue; }
RegisterItem(deconstructItem.ItemIdentifier, deconstructItem.Amount);
}
@@ -1028,7 +1028,7 @@ namespace Barotrauma.Items.Components
{
foreach (var c in MineralClusters)
{
var unobtainedMinerals = c.resources.Where(i => i != null && i.GetRootInventoryOwner() == i);
var unobtainedMinerals = c.resources.Where(i => i != null && i.GetComponent<Holdable>() is { Attached: true });
if (unobtainedMinerals.None()) { continue; }
if (!CheckResourceMarkerVisibility(c.center, transducerCenter)) { continue; }
var i = unobtainedMinerals.FirstOrDefault();
@@ -162,23 +162,27 @@ namespace Barotrauma
RemoveFogOfWar(StartLocation);
GenerateLocationConnectionVisuals();
GenerateAllLocationConnectionVisuals();
}
partial void GenerateLocationConnectionVisuals()
partial void GenerateAllLocationConnectionVisuals()
{
foreach (LocationConnection connection in Connections)
{
Vector2 connectionStart = connection.Locations[0].MapPosition;
Vector2 connectionEnd = connection.Locations[1].MapPosition;
float connectionLength = Vector2.Distance(connectionStart, connectionEnd);
int iterations = Math.Min((int)Math.Sqrt(connectionLength * generationParams.ConnectionIndicatorIterationMultiplier), 5);
connection.CrackSegments.Clear();
connection.CrackSegments.AddRange(MathUtils.GenerateJaggedLine(
connectionStart, connectionEnd,
iterations, connectionLength * generationParams.ConnectionIndicatorDisplacementMultiplier));
GenerateLocationConnectionVisuals(connection);
}
}
partial void GenerateLocationConnectionVisuals(LocationConnection connection)
{
Vector2 connectionStart = connection.Locations[0].MapPosition;
Vector2 connectionEnd = connection.Locations[1].MapPosition;
float connectionLength = Vector2.Distance(connectionStart, connectionEnd);
int iterations = Math.Min((int)Math.Sqrt(connectionLength * generationParams.ConnectionIndicatorIterationMultiplier), 5);
connection.CrackSegments.Clear();
connection.CrackSegments.AddRange(MathUtils.GenerateJaggedLine(
connectionStart, connectionEnd,
iterations, connectionLength * generationParams.ConnectionIndicatorDisplacementMultiplier));
}
private void LocationChanged(Location prevLocation, Location newLocation)
{
@@ -414,7 +418,7 @@ namespace Barotrauma
new GUIMessageBox(string.Empty, TextManager.Get("LockedPathTooltip"));
}
//clients aren't allowed to select the location without a permission
else if ((GameMain.GameSession?.GameMode as CampaignMode)?.AllowedToManageCampaign(Networking.ClientPermissions.ManageMap) ?? false)
else if (CampaignMode.AllowedToManageCampaign(Networking.ClientPermissions.ManageMap))
{
connectionHighlightState = 0.0f;
SelectedConnection = connection;
@@ -702,10 +702,30 @@ namespace Barotrauma.Networking
{
Enabled = !GameMain.NetworkMember.GameStarted
};
var cargoFrame = new GUIListBox(new RectTransform(new Vector2(0.6f, 0.7f), settingsTabs[(int)SettingsTab.Rounds].RectTransform, Anchor.BottomRight, Pivot.BottomLeft))
var cargoFrame = new GUIFrame(new RectTransform(new Vector2(0.6f, 0.7f), settingsTabs[(int)SettingsTab.Rounds].RectTransform, Anchor.BottomRight, Pivot.BottomLeft))
{
Visible = false
};
var cargoContent = new GUILayoutGroup(new RectTransform(new Vector2(0.95f, 0.95f), cargoFrame.RectTransform, Anchor.Center))
{
Stretch = true
};
var filterText = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), cargoContent.RectTransform), TextManager.Get("serverlog.filter"), font: GUIStyle.SubHeadingFont);
var entityFilterBox = new GUITextBox(new RectTransform(new Vector2(0.5f, 1.0f), filterText.RectTransform, Anchor.CenterRight), font: GUIStyle.Font, createClearButton: true);
filterText.RectTransform.MinSize = new Point(0, entityFilterBox.RectTransform.MinSize.Y);
var cargoList = new GUIListBox(new RectTransform(new Vector2(1.0f, 0.8f), cargoContent.RectTransform));
entityFilterBox.OnTextChanged += (textBox, text) =>
{
foreach (var child in cargoList.Content.Children)
{
if (child.UserData is not ItemPrefab itemPrefab) { continue; }
child.Visible = string.IsNullOrEmpty(text) || itemPrefab.Name.Contains(text, StringComparison.OrdinalIgnoreCase);
}
return true;
};
cargoButton.UserData = cargoFrame;
cargoButton.OnClicked = (button, obj) =>
{
@@ -721,7 +741,7 @@ namespace Barotrauma.Networking
GUITextBlock.AutoScaleAndNormalize(buttonHolder.Children.Select(c => ((GUIButton)c).TextBlock));
foreach (ItemPrefab ip in ItemPrefab.Prefabs)
foreach (ItemPrefab ip in ItemPrefab.Prefabs.OrderBy(ip => ip.Name))
{
if (ip.AllowAsExtraCargo.HasValue)
{
@@ -732,10 +752,10 @@ namespace Barotrauma.Networking
if (!ip.CanBeBought) { continue; }
}
var itemFrame = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.15f), cargoFrame.Content.RectTransform) { MinSize = new Point(0, 30) }, isHorizontal: true)
var itemFrame = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.15f), cargoList.Content.RectTransform) { MinSize = new Point(0, 30) }, isHorizontal: true)
{
Stretch = true,
UserData = cargoFrame,
UserData = ip,
RelativeSpacing = 0.05f
};
@@ -778,7 +798,7 @@ namespace Barotrauma.Networking
numberInput.IntValue = ExtraCargo.ContainsKey(ip) ? ExtraCargo[ip] : 0;
CoroutineManager.Invoke(() =>
{
foreach (var child in cargoFrame.Content.GetAllChildren())
foreach (var child in cargoList.Content.GetAllChildren())
{
if (child.GetChild<GUINumberInput>() is GUINumberInput otherNumberInput)
{
@@ -167,7 +167,7 @@ namespace Barotrauma
foreach (GUITickBox tickBox in missionTickBoxes)
{
bool disable = hasMaxMissions && !tickBox.Selected;
tickBox.Enabled = Campaign.AllowedToManageCampaign(ClientPermissions.ManageMap) && !disable;
tickBox.Enabled = CampaignMode.AllowedToManageCampaign(ClientPermissions.ManageMap) && !disable;
tickBox.Box.DisabledColor = disable ? tickBox.Box.Color * 0.5f : tickBox.Box.Color * 0.8f;
foreach (GUIComponent child in tickBox.Parent.Parent.Children)
{
@@ -315,7 +315,7 @@ namespace Barotrauma
if (GUI.MouseOn == tickBox) { return false; }
if (tickBox != null)
{
if (Campaign.AllowedToManageCampaign(ClientPermissions.ManageMap) && tickBox.Enabled)
if (CampaignMode.AllowedToManageCampaign(ClientPermissions.ManageMap) && tickBox.Enabled)
{
tickBox.Selected = !tickBox.Selected;
}
@@ -356,10 +356,10 @@ namespace Barotrauma
};
tickBox.RectTransform.MinSize = new Point(tickBox.Rect.Height, 0);
tickBox.RectTransform.IsFixedSize = true;
tickBox.Enabled = Campaign.AllowedToManageCampaign(ClientPermissions.ManageMap);
tickBox.Enabled = CampaignMode.AllowedToManageCampaign(ClientPermissions.ManageMap);
tickBox.OnSelected += (GUITickBox tb) =>
{
if (!Campaign.AllowedToManageCampaign(Networking.ClientPermissions.ManageMap)) { return false; }
if (!CampaignMode.AllowedToManageCampaign(Networking.ClientPermissions.ManageMap)) { return false; }
if (tb.Selected)
{
@@ -379,7 +379,7 @@ namespace Barotrauma
UpdateMaxMissions(connection.OtherLocation(currentDisplayLocation));
if ((Campaign is MultiPlayerCampaign multiPlayerCampaign) && !multiPlayerCampaign.SuppressStateSending &&
Campaign.AllowedToManageCampaign(Networking.ClientPermissions.ManageMap))
CampaignMode.AllowedToManageCampaign(Networking.ClientPermissions.ManageMap))
{
GameMain.Client?.SendCampaignState();
}
@@ -500,7 +500,7 @@ namespace Barotrauma
return true;
},
Enabled = true,
Visible = Campaign.AllowedToManageCampaign(ClientPermissions.ManageMap)
Visible = CampaignMode.AllowedToManageCampaign(ClientPermissions.ManageMap)
};
buttonArea.RectTransform.MinSize = new Point(0, StartButton.RectTransform.MinSize.Y);
@@ -351,7 +351,7 @@ namespace Barotrauma.CharacterEditor
{
if (string.IsNullOrEmpty(contentPackageNameElement.Text))
{
contentPackageNameElement.Flash();
contentPackageNameElement.Flash(useRectangleFlash: true);
return false;
}
if (ContentPackageManager.AllPackages.Any(cp => cp.Name.ToLower() == contentPackageNameElement.Text.ToLower()))
@@ -405,7 +405,7 @@ namespace Barotrauma.CharacterEditor
{
if (ContentPackage == null)
{
contentPackageDropDown.Flash();
contentPackageDropDown.Flash(useRectangleFlash: true);
return false;
}
@@ -417,7 +417,7 @@ namespace Barotrauma.CharacterEditor
if (!File.Exists(evaluatedTexturePath))
{
GUI.AddMessage(GetCharacterEditorTranslation("TextureDoesNotExist"), GUIStyle.Red);
texturePathElement.Flash(GUIStyle.Red);
texturePathElement.Flash(useRectangleFlash: true);
return false;
}
}
@@ -425,7 +425,7 @@ namespace Barotrauma.CharacterEditor
if (!path.EndsWith(".png", StringComparison.OrdinalIgnoreCase))
{
GUI.AddMessage(TextManager.Get("WrongFileType"), GUIStyle.Red);
texturePathElement.Flash(GUIStyle.Red);
texturePathElement.Flash(useRectangleFlash: true);
return false;
}
if (IsCopy)
@@ -486,7 +486,8 @@ namespace Barotrauma.CharacterEditor
{
PlaySoundOnSelect = true,
};
var removeLimbButton = new GUIButton(new RectTransform(new Vector2(0.05f, 1.0f), limbEditLayout.RectTransform, scaleBasis: ScaleBasis.BothHeight), style: "GUIMinusButton")
var limbButtonSize = Vector2.One * 0.8f;
var removeLimbButton = new GUIButton(new RectTransform(limbButtonSize, limbEditLayout.RectTransform, scaleBasis: ScaleBasis.BothHeight), style: "GUIMinusButton")
{
OnClicked = (b, d) =>
{
@@ -497,7 +498,7 @@ namespace Barotrauma.CharacterEditor
return true;
}
};
var addLimbButton = new GUIButton(new RectTransform(new Vector2(0.05f, 1.0f), limbEditLayout.RectTransform, scaleBasis: ScaleBasis.BothHeight), style: "GUIPlusButton")
var addLimbButton = new GUIButton(new RectTransform(limbButtonSize, limbEditLayout.RectTransform, scaleBasis: ScaleBasis.BothHeight), style: "GUIPlusButton")
{
OnClicked = (b, d) =>
{
@@ -1817,7 +1817,11 @@ namespace Barotrauma
subList = dropDown.ListBox.Content;
}
var frame = new GUIFrame(new RectTransform(new Vector2(1.0f, 0.15f), subList.RectTransform) { MinSize = new Point(0, 25) },
var frame = new GUIFrame(new RectTransform(new Vector2(1.0f, 0.1f), subList.RectTransform)
{
//enough space for 2 lines (price and class) + some padding
MinSize = new Point(0, (int)(GUIStyle.SmallFont.LineHeight * 2.3f))
},
style: "ListBoxElement")
{
ToolTip = sub.Description,
@@ -7,6 +7,8 @@ using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Xml.Linq;
namespace Barotrauma
@@ -953,8 +955,19 @@ namespace Barotrauma
okButton.Enabled = false;
okButton.OnClicked = (btn, userdata) =>
{
if (!Endpoint.Parse(endpointBox.Text).TryUnwrap(out var endpoint)) { return false; }
JoinServer(endpoint, "");
if (Endpoint.Parse(endpointBox.Text).TryUnwrap(out var endpoint))
{
JoinServer(endpoint, "");
}
else if (LidgrenEndpoint.ParseFromWithHostNameCheck(endpointBox.Text, tryParseHostName: true).TryUnwrap(out var lidgrenEndpoint))
{
JoinServer(lidgrenEndpoint, "");
}
else
{
new GUIMessageBox(TextManager.Get("error"), TextManager.GetWithVariable("invalidipaddress", "[serverip]:[port]", endpointBox.Text));
endpointBox.Flash();
}
msgBox.Close();
return false;
};
@@ -1926,9 +1926,15 @@ namespace Barotrauma
{
filePath = $"{ContentPath.ModDirStr}/{filePath[packageDir.Length..]}";
}
if (!modProject.Files.Any(f => f.Type == subFileType &&
f.Path == filePath))
if (!modProject.Files.Any(f => f.Type == subFileType && f.Path == filePath))
{
//check if there's a file with the same name but different filename case
var matchingFile = modProject.Files.FirstOrDefault(f => f.Type == subFileType && filePath.CleanUpPath().Equals(f.Path.CleanUpPath(), StringComparison.OrdinalIgnoreCase));
if (matchingFile != null)
{
File.Delete(matchingFile.Path.Replace(ContentPath.ModDirStr, packageDir));
modProject.RemoveFile(matchingFile);
}
var newFile = ModProject.File.FromPath(filePath, subFileType);
modProject.AddFile(newFile);
}
@@ -2485,7 +2491,7 @@ namespace Barotrauma
new GUINumberInput(new RectTransform(new Vector2(0.4f, 1.0f), tierGroup.RectTransform), NumberType.Int)
{
IntValue = SubmarineInfo.GetDefaultTier(MainSub.Info.Price),
IntValue = MainSub.Info.Tier,
MinValueInt = 1,
MaxValueInt = 3,
OnValueChanged = (numberInput) =>
@@ -2827,6 +2833,7 @@ namespace Barotrauma
OnClicked = (button, o) =>
{
var requiredPackages = MapEntity.mapEntityList.Select(e => e.Prefab.ContentPackage)
.Where(cp => cp != null)
.Distinct().OfType<ContentPackage>().Select(p => p.Name).ToHashSet();
var tickboxes = requiredContentPackList.Content.Children.OfType<GUITickBox>().ToArray();
tickboxes.ForEach(tb => tb.Selected = requiredPackages.Contains(tb.UserData as string ?? ""));
@@ -2925,7 +2932,7 @@ namespace Barotrauma
subTypeDropdown.SelectItem(MainSub.Info.Type);
if (quickSave) { SaveSub(null); }
if (quickSave) { SaveSub(packageToSaveInList.SelectedData as ContentPackage); }
}
private void CreateSaveAssemblyScreen()
@@ -785,13 +785,7 @@ namespace Barotrauma
{
OnClicked = (btn, obj) =>
{
GameSettings.SetCurrentConfig(unsavedConfig);
if (WorkshopMenu is MutableWorkshopMenu mutableWorkshopMenu &&
mutableWorkshopMenu.CurrentTab == MutableWorkshopMenu.Tab.InstalledMods)
{
mutableWorkshopMenu.Apply();
}
GameSettings.SaveCurrentConfig();
ApplyInstalledModChanges();
mainFrame.Flash(color: GUIStyle.Green);
return false;
},
@@ -804,6 +798,17 @@ namespace Barotrauma
};
}
public void ApplyInstalledModChanges()
{
GameSettings.SetCurrentConfig(unsavedConfig);
if (WorkshopMenu is MutableWorkshopMenu mutableWorkshopMenu &&
mutableWorkshopMenu.CurrentTab == MutableWorkshopMenu.Tab.InstalledMods)
{
mutableWorkshopMenu.Apply();
}
GameSettings.SaveCurrentConfig();
}
public void Close()
{
if (GameMain.Client is null || GameSettings.CurrentConfig.Audio.VoiceSetting == VoiceMode.Disabled)
@@ -96,6 +96,8 @@ namespace Barotrauma
{
angle = targetLimb.body.Rotation + ((targetLimb.body.Dir > 0.0f) ? 0.0f : MathHelper.Pi);
particleRotation = -targetLimb.body.Rotation;
float offset = targetLimb.Params.GetSpriteOrientation() - MathHelper.PiOver2;
particleRotation += offset;
if (targetLimb.body.Dir < 0.0f)
{
particleRotation += MathHelper.Pi;
@@ -598,13 +598,14 @@ namespace Barotrauma.Steam
bool reinstallAction(GUIButton button, object o)
{
SettingsMenu.Instance?.ApplyInstalledModChanges();
int prevIndex = ContentPackageManager.EnabledPackages.Regular.IndexOf(contentPackage);
TaskPool.AddIfNotFound($"Reinstall{workshopItem.Id}",
SteamManager.Workshop.Reinstall(workshopItem), t =>
{
ContentPackageManager.WorkshopPackages.Refresh();
ContentPackageManager.EnabledPackages.RefreshUpdatedMods();
if (SettingsMenu.Instance?.WorkshopMenu is MutableWorkshopMenu mutableWorkshopMenu)
if (SettingsMenu.Instance?.WorkshopMenu is MutableWorkshopMenu mutableWorkshopMenu && !mutableWorkshopMenu.ViewingItemDetails)
{
mutableWorkshopMenu.PopulateInstalledModLists(forceRefreshEnabled: true);
}
@@ -543,7 +543,8 @@ namespace Barotrauma.Steam
var localModProject = new ModProject(localPackage)
{
UgcId = Option<ContentPackageId>.Some(new SteamWorkshopId(resultId))
UgcId = Option<ContentPackageId>.Some(new SteamWorkshopId(resultId)),
ModVersion = modVersion
};
localModProject.DiscardHashAndInstallTime();
localModProject.Save(localPackage.Path);