Blood in the Water Hotfix 2 - 1.4.6.0

This commit is contained in:
Markus Isberg
2024-05-02 14:08:04 +03:00
parent ff1b8951a7
commit 0a0a9784c5
26 changed files with 304 additions and 191 deletions
@@ -2321,6 +2321,29 @@ namespace Barotrauma
}
}));
commands.Add(new Command("converttowreck", "", (string[] args) =>
{
if (Screen.Selected is not SubEditorScreen)
{
ThrowError("The command can only be used in the submarine editor.");
return;
}
if (Submarine.MainSub == null)
{
ThrowError("Load a submarine first to convert it to a wreck.");
return;
}
if (Submarine.MainSub.Info.SubmarineElement == null)
{
ThrowError("The submarine must be saved before you can convert it to a wreck.");
return;
}
var wreckedSubmarineInfo = new SubmarineInfo(filePath: string.Empty, element: WreckConverter.ConvertToWreck(Submarine.MainSub.Info.SubmarineElement));
wreckedSubmarineInfo.Name += "_Wrecked";
wreckedSubmarineInfo.Type = SubmarineType.Wreck;
GameMain.SubEditorScreen.LoadSub(wreckedSubmarineInfo);
}));
#if DEBUG
commands.Add(new Command("listspamfilters", "Lists filters that are in the global spam filter.", (string[] args) =>
{
@@ -2434,29 +2457,6 @@ namespace Barotrauma
}
}));
commands.Add(new Command("converttowreck", "", (string[] args) =>
{
if (Screen.Selected is not SubEditorScreen)
{
ThrowError("The command can only be used in the submarine editor.");
return;
}
if (Submarine.MainSub == null)
{
ThrowError("Load a submarine first to convert it to a wreck.");
return;
}
if (Submarine.MainSub.Info.SubmarineElement == null)
{
ThrowError("The submarine must be saved before you can convert it to a wreck.");
return;
}
var wreckedSubmarineInfo = new SubmarineInfo(filePath: string.Empty, element: WreckConverter.ConvertToWreck(Submarine.MainSub.Info.SubmarineElement));
wreckedSubmarineInfo.Name += "_Wrecked";
wreckedSubmarineInfo.Type = SubmarineType.Wreck;
GameMain.SubEditorScreen.LoadSub(wreckedSubmarineInfo);
}));
commands.Add(new Command("camerasettings", "camerasettings [defaultzoom] [zoomsmoothness] [movesmoothness] [minzoom] [maxzoom]: debug command for testing camera settings. The values default to 1.1, 8.0, 8.0, 0.1 and 2.0.", (string[] args) =>
{
float defaultZoom = Screen.Selected.Cam.DefaultZoom;
@@ -1735,7 +1735,7 @@ namespace Barotrauma
if (!ItemAndAllContainersInteractable(subItem)) { continue; }
//don't list items in a character inventory (the ones in a crew member's inventory are counted below)
var rootInventoryOwner = subItem.GetRootInventoryOwner();
if (rootInventoryOwner != null) { continue; }
if (rootInventoryOwner is Character) { continue; }
AddOwnedItem(subItem);
}
}
@@ -806,12 +806,18 @@ namespace Barotrauma
{
if (order.Identifier == Tags.DeconstructThis)
{
Item.DeconstructItems.Add(item);
foreach (var stackedItem in item.GetStackedItems())
{
Item.DeconstructItems.Add(stackedItem);
}
HintManager.OnItemMarkedForDeconstruction(order.OrderGiver);
}
else
{
Item.DeconstructItems.Remove(item);
foreach (var stackedItem in item.GetStackedItems())
{
Item.DeconstructItems.Remove(stackedItem);
}
}
}
}
@@ -820,8 +826,19 @@ namespace Barotrauma
WallSection ws = null;
if (order.TargetType == Order.OrderTargetType.Entity && order.TargetEntity is IIgnorable ignorable)
{
ignorable.OrderedToBeIgnored = order.Identifier == Tags.IgnoreThis;
AddOrder(order.Clone(), null);
if (ignorable is Item item)
{
foreach (var stackedItem in item.GetStackedItems())
{
stackedItem.OrderedToBeIgnored = order.Identifier == Tags.IgnoreThis;
AddOrder(order.Clone().WithTargetEntity(stackedItem), fadeOutTime: null);
}
}
else
{
ignorable.OrderedToBeIgnored = order.Identifier == Tags.IgnoreThis;
AddOrder(order.Clone(), fadeOutTime: null);
}
}
else if (order.TargetType == Order.OrderTargetType.WallSection && order.TargetEntity is Structure s)
{
@@ -830,7 +847,7 @@ namespace Barotrauma
if (ws != null)
{
ws.OrderedToBeIgnored = order.Identifier == Tags.IgnoreThis;
AddOrder(order.WithWallSection(s, wallSectionIndex), null);
AddOrder(order.WithWallSection(s, wallSectionIndex), fadeOutTime: null);
}
}
else
@@ -841,9 +858,9 @@ namespace Barotrauma
{
hull = Hull.FindHull(ws.WorldPosition);
}
else if (order.TargetEntity is Item i)
else if (order.TargetEntity is Item item)
{
hull = i.CurrentHull;
hull = item.CurrentHull;
}
else if (order.TargetEntity is ISpatialEntity se)
{
@@ -1238,7 +1255,7 @@ namespace Barotrauma
if (GUI.DisableHUD) { return; }
if (CoroutineManager.IsCoroutineRunning("LevelTransition") || CoroutineManager.IsCoroutineRunning("SubmarineTransition")) { return; }
commandFrame?.AddToGUIUpdateList();
commandFrame?.AddToGUIUpdateList(order: 1);
if (GUI.DisableUpperHUD) { return; }
@@ -1977,8 +1994,6 @@ namespace Barotrauma
{
if (commandFrame != null) { DisableCommandUI(); }
CharacterHealth.OpenHealthWindow = null;
// Character context works differently to others as we still use the "basic" command interface,
// but the order will be automatically assigned to this character
isContextual = forceContextual;
@@ -720,9 +720,16 @@ namespace Barotrauma
if (errorMsgs.Any())
{
GUIMessageBox msgBox = new GUIMessageBox(TextManager.Get("Warning"), string.Join("\n\n", errorMsgs), new Vector2(0.25f, 0.0f), new Point(400, 200));
GUIMessageBox msgBox = new GUIMessageBox(TextManager.Get("Warning"), string.Empty, new Vector2(0.25f, 0.0f), minSize: new Point(GUI.IntScale(650), GUI.IntScale(650)));
if (warnings.Any())
{
var textListBox = new GUIListBox(new RectTransform(new Vector2(1.0f, 0.75f), msgBox.Content.RectTransform));
var text = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), textListBox.Content.RectTransform), string.Join("\n\n", errorMsgs), wrap: true)
{
CanBeFocused = false
};
text.RectTransform.MinSize = new Point(0, (int)text.TextSize.Y);
Point size = msgBox.RectTransform.NonScaledSize;
GUITickBox suppress = new GUITickBox(new RectTransform(new Vector2(1f, 0.33f), msgBox.Content.RectTransform), TextManager.Get("editor.suppresswarnings"));
msgBox.RectTransform.NonScaledSize = new Point(size.X, size.Y + suppress.RectTransform.NonScaledSize.Y);
@@ -736,7 +743,6 @@ namespace Barotrauma
SubEditorScreen.SuppressedWarnings.Add(warning);
}
}
return true;
};
}
@@ -1820,7 +1820,7 @@ namespace Barotrauma.Networking
if (Screen.Selected != GameMain.GameScreen)
{
new GUIMessageBox(TextManager.Get("PleaseWait"), TextManager.Get(allowSpectating ? "RoundRunningSpectateEnabled" : "RoundRunningSpectateDisabled"));
if (!(Screen.Selected is ModDownloadScreen)) { GameMain.NetLobbyScreen.Select(); }
if (Screen.Selected is not ModDownloadScreen) { GameMain.NetLobbyScreen.Select(); }
}
}
}
@@ -57,6 +57,7 @@ namespace Barotrauma
private GUILayoutGroup roundControlsHolder;
public GUIButton SettingsButton { get; private set; }
public GUIButton ServerMessageButton { get; private set; }
public static GUIButton JobInfoFrame { get; set; }
private GUITickBox spectateBox;
@@ -427,6 +428,20 @@ namespace Barotrauma
TextGetter = serverNameShadow.TextGetter = () => GameMain.Client?.ServerName
};
ServerMessageButton = new GUIButton(new RectTransform(new Vector2(0.2f, 0.15f), serverInfoContent.RectTransform, Anchor.BottomLeft),
TextManager.Get("workshopitemdescription"), style: "GUIButtonSmall")
{
IgnoreLayoutGroups = true,
OnClicked = (bt, userdata) =>
{
if (GameMain.Client?.ServerSettings is { } serverSettings)
{
CreateServerMessagePopup(serverSettings.ServerName, serverSettings.ServerMessageText);
}
return true;
}
};
playStyleIconContainer = new GUILayoutGroup(new RectTransform(new Vector2(0.5f, 0.4f), serverInfoContent.RectTransform, Anchor.BottomRight), isHorizontal: true, childAnchor: Anchor.BottomRight)
{
AbsoluteSpacing = GUI.IntScale(5)
@@ -455,8 +470,23 @@ namespace Barotrauma
}
};
SettingsButton = new GUIButton(new RectTransform(new Vector2(0.25f, 1.0f), serverInfoContent.RectTransform, Anchor.TopRight),
TextManager.Get("ServerSettingsButton"), style: "GUIButtonSmall");
SettingsButton = new GUIButton(new RectTransform(new Vector2(0.25f, 0.4f), serverInfoContent.RectTransform, Anchor.TopRight),
TextManager.Get("ServerSettingsButton"), style: "GUIButtonFreeScale");
}
private void CreateServerMessagePopup(string serverName, string message)
{
if (string.IsNullOrEmpty(message)) { return; }
var popup = new GUIMessageBox(serverName, string.Empty, minSize: new Point(GUI.IntScale(650), GUI.IntScale(650)));
//popup.Content.Stretch = true;
popup.Header.Font = GUIStyle.LargeFont;
popup.Header.RectTransform.MinSize = new Point(0, (int)popup.Header.TextSize.Y);
var textListBox = new GUIListBox(new RectTransform(new Vector2(1.0f, 0.7f), popup.Content.RectTransform));
var text = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), textListBox.Content.RectTransform), message, wrap: true)
{
CanBeFocused = false
};
text.RectTransform.MinSize = new Point(0, (int)text.TextSize.Y);
}
public void RefreshPlaystyleIcons()
@@ -1474,7 +1504,8 @@ namespace Barotrauma
}
else
{
GameMain.Client.RequestStartRound();
//if a campaign is active, and we're not setting one up atm, start button continues the existing campaign
GameMain.Client.RequestStartRound(continueCampaign: GameMain.GameSession?.GameMode is CampaignMode && CampaignSetupFrame is not { Visible: true });
CoroutineManager.StartCoroutine(WaitForStartRound(StartButton), "WaitForStartRound");
}
return true;
@@ -1570,10 +1601,7 @@ namespace Barotrauma
chatInput.OnTextChanged += GameMain.Client.TypingChatMessage;
chatInput.OnDeselected += (sender, key) =>
{
if (GameMain.Client != null)
{
GameMain.Client.ChatBox.ChatManager.Clear();
}
GameMain.Client?.ChatBox.ChatManager.Clear();
};
//disable/hide elements the clients are not supposed to use/see
@@ -1815,6 +1815,7 @@ namespace Barotrauma
public void StoreServerFilters()
{
if (loadingServerFilters) { return; }
foreach (KeyValuePair<Identifier, GUITickBox> filterBox in filterTickBoxes)
{
ServerListFilters.Instance.SetAttribute(filterBox.Key, filterBox.Value.Selected.ToString());
@@ -1826,8 +1827,10 @@ namespace Barotrauma
GameSettings.SaveCurrentConfig();
}
private bool loadingServerFilters;
public void LoadServerFilters()
{
loadingServerFilters = true;
XDocument currentConfigDoc = XMLExtensions.TryLoadXml(GameSettings.PlayerConfigPath);
ServerListFilters.Init(currentConfigDoc.Root.GetChildElement("serverfilters"));
foreach (KeyValuePair<Identifier, GUITickBox> filterBox in filterTickBoxes)
@@ -1845,6 +1848,7 @@ namespace Barotrauma
var child = ternaryFilter.Value.ListBox.Content.GetChildByUserData(ternaryOption);
ternaryFilter.Value.Select(ternaryFilter.Value.ListBox.Content.GetChildIndex(child));
}
loadingServerFilters = false;
}
}
@@ -868,12 +868,8 @@ namespace Barotrauma
string prefabTags = GetPrefabTags(it);
if (string.IsNullOrEmpty(text) || string.IsNullOrEmpty(prefabTags)) { return text; }
text = text.Remove(prefabTags);
if (text.StartsWith(","))
{
text = text.Remove(0, 1);
}
return text;
string[] splitTags = text.Split(',');
return string.Join(',', splitTags.Where(t => !it.Prefab.Tags.Contains(t)));
}
static string GetPrefabTags(Item it) => string.Join(',', it.Prefab.Tags);
@@ -444,6 +444,7 @@ namespace Barotrauma
var modifiedLine = line;
while (font.MeasureString($"{modifiedLine}...").X > lineX)
{
if (modifiedLine.Length == 0) { break; }
modifiedLine = modifiedLine[..^1];
}
sb.AppendLine($"{modifiedLine}...");