Merge remote-tracking branch 'upstream/master' into develop

This commit is contained in:
EvilFactory
2024-05-02 12:25:49 -03:00
19 changed files with 216 additions and 151 deletions
@@ -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;
};
}
@@ -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}...");