Unstable v0.1300.0.2

This commit is contained in:
Markus Isberg
2021-03-12 15:57:04 +02:00
parent 0f6de8ada9
commit 874616027b
145 changed files with 1897 additions and 939 deletions
@@ -843,6 +843,13 @@ namespace Barotrauma
if (item.ParentInventory != this)
{
if (Screen.Selected == GameMain.GameScreen)
{
if (item.NonInteractable || item.NonPlayerTeamInteractable)
{
return QuickUseAction.None;
}
}
if (item.ParentInventory == null || item.ParentInventory.Locked)
{
return QuickUseAction.None;
@@ -381,6 +381,8 @@ namespace Barotrauma.Items.Components
private void DrawOutputOverLay(SpriteBatch spriteBatch, GUICustomComponent overlayComponent)
{
if (!outputContainer.Inventory.IsEmpty()) { return; }
overlayComponent.RectTransform.SetAsLastChild();
FabricationRecipe targetItem = fabricatedItem ?? selectedItem;
@@ -133,7 +133,7 @@ namespace Barotrauma.Items.Components
public static Vector2 GUISizeCalculation => Vector2.One * Math.Min(GUI.RelativeHorizontalAspectRatio, 1f) * sonarAreaSize;
private List<Tuple<Vector2, List<Item>>> MineralClusters { get; set; }
private List<(Vector2 center, List<Item> resources)> MineralClusters { get; set; }
private readonly List<GUITextBlock> textBlocksToScaleAndNormalize = new List<GUITextBlock>();
@@ -471,25 +471,26 @@ namespace Barotrauma.Items.Components
{
if (MineralClusters == null)
{
MineralClusters = new List<Tuple<Vector2, List<Item>>>();
foreach (var p in Level.Loaded.PathPoints)
MineralClusters = new List<(Vector2, List<Item>)>();
Level.Loaded.PathPoints.ForEach(p => p.ClusterLocations.ForEach(c => AddIfValid(c)));
Level.Loaded.AbyssResources.ForEach(c => AddIfValid(c));
void AddIfValid(Level.ClusterLocation c)
{
foreach (var c in p.ClusterLocations)
if (c.Resources == null) { return; }
if (c.Resources.None(i => i != null && !i.Removed && i.Tags.Contains("ore"))) { return; }
var pos = Vector2.Zero;
foreach (var r in c.Resources)
{
if (c.Resources.None(i => i != null && !i.Removed && i.Tags.Contains("ore"))) { continue; }
var pos = Vector2.Zero;
foreach (var r in c.Resources)
{
pos += r.WorldPosition;
}
pos /= c.Resources.Count;
MineralClusters.Add(new Tuple<Vector2, List<Item>>(pos, c.Resources));
pos += r.WorldPosition;
}
pos /= c.Resources.Count;
MineralClusters.Add((center: pos, resources: c.Resources));
}
}
else
{
MineralClusters.RemoveAll(t => t.Item2 == null || t.Item2.None() || t.Item2.All(i => i == null || i.Removed));
MineralClusters.RemoveAll(c => c.resources == null || c.resources.None() || c.resources.All(i => i == null || i.Removed));
}
}
@@ -864,7 +865,7 @@ namespace Barotrauma.Items.Components
Level.Loaded.StartLocation.Name,
Level.Loaded.StartOutpost != null ? "outpost" : "location",
Level.Loaded.StartLocation.Name,
Level.Loaded.StartPosition, transducerCenter,
Level.Loaded.StartExitPosition, transducerCenter,
displayScale, center, DisplayRadius);
}
@@ -874,7 +875,7 @@ namespace Barotrauma.Items.Components
Level.Loaded.EndLocation.Name,
Level.Loaded.EndOutpost != null ? "outpost" : "location",
Level.Loaded.EndLocation.Name,
Level.Loaded.EndPosition, transducerCenter,
Level.Loaded.EndExitPosition, transducerCenter,
displayScale, center, DisplayRadius);
}
@@ -924,16 +925,16 @@ namespace Barotrauma.Items.Components
if (AllowUsingMineralScanner && useMineralScanner && CurrentMode == Mode.Active && MineralClusters != null)
{
foreach (var t in MineralClusters)
foreach (var c in MineralClusters)
{
var unobtainedMinerals = t.Item2.Where(i => i != null && i.GetRootInventoryOwner() == i);
var unobtainedMinerals = c.resources.Where(i => i != null && i.GetRootInventoryOwner() == i);
if (unobtainedMinerals.None()) { continue; }
if (!CheckResourceMarkerVisibility(t.Item1, transducerCenter)) { continue; }
if (!CheckResourceMarkerVisibility(c.center, transducerCenter)) { continue; }
var i = unobtainedMinerals.FirstOrDefault();
if (i == null) { continue; }
DrawMarker(spriteBatch,
i.Name, "mineral", i,
t.Item1, transducerCenter,
c.center, transducerCenter,
displayScale, center, DisplayRadius * 0.95f,
onlyShowTextOnMouseOver: true);
}
@@ -351,7 +351,12 @@ namespace Barotrauma.Items.Components
{
OnClicked = (btn, userdata) =>
{
if (GameMain.GameSession?.Campaign is CampaignMode campaign)
if (GameMain.GameSession?.Missions.Any(m => !m.AllowUndocking) ?? false)
{
new GUIMessageBox("", TextManager.Get("undockingdisabledbymission"));
return false;
}
else if (GameMain.GameSession?.Campaign is CampaignMode campaign)
{
if (Level.IsLoadedOutpost &&
DockingSources.Any(d => d.Docked && (d.DockingTarget?.Item.Submarine?.Info?.IsOutpost ?? false)))
@@ -398,7 +403,7 @@ namespace Barotrauma.Items.Components
{
if (GameMain.Client == null)
{
item.SendSignal(0, "1", "toggle_docking", sender: null);
item.SendSignal("1", "toggle_docking");
}
else
{
@@ -914,7 +919,7 @@ namespace Barotrauma.Items.Components
if (dockingButtonClicked)
{
item.SendSignal(0, "1", "toggle_docking", sender: null);
item.SendSignal("1", "toggle_docking");
}
if (autoPilot)
@@ -63,8 +63,8 @@ namespace Barotrauma.Items.Components
}
OutputValue = input;
item.SendSignal(0, input, "signal_out", null);
ShowOnDisplay(input);
item.SendSignal(input, "signal_out");
}
partial void ShowOnDisplay(string input)
@@ -227,16 +227,16 @@ namespace Barotrauma
IsSubSlot = isSubSlot;
Item = ParentInventory.GetItemAt(slotIndex);
int stackCount = 1;
IEnumerable<Item> itemsInSlot = null;
if (parentInventory != null && Item != null)
{
stackCount = parentInventory.GetItemsAt(slotIndex).Count();
itemsInSlot = parentInventory.GetItemsAt(slotIndex);
}
TooltipRichTextData = RichTextData.GetRichTextData(GetTooltip(Item, stackCount), out Tooltip);
TooltipRichTextData = RichTextData.GetRichTextData(GetTooltip(Item, itemsInSlot), out Tooltip);
}
private string GetTooltip(Item item, int stackCount)
private string GetTooltip(Item item, IEnumerable<Item> itemsInSlot)
{
if (item == null) { return null; }
@@ -291,6 +291,10 @@ namespace Barotrauma
string colorStr = XMLExtensions.ColorToString(item.SpawnedInOutpost ? GUI.Style.Red : Color.White);
toolTip = $"‖color:{colorStr}‖{item.Name}‖color:end‖";
if (itemsInSlot.All(it => it.NonInteractable || it.NonPlayerTeamInteractable))
{
toolTip += " " + TextManager.Get("connectionlocked");
}
if (!item.IsFullCondition && !item.Prefab.HideConditionBar)
{
string conditionColorStr = XMLExtensions.ColorToString(ToolBox.GradientLerp(item.Condition / item.MaxCondition, GUI.Style.ColorInventoryEmpty, GUI.Style.ColorInventoryHalf, GUI.Style.ColorInventoryFull));
@@ -298,7 +302,7 @@ namespace Barotrauma
}
if (!string.IsNullOrEmpty(description)) { toolTip += '\n' + description; }
}
if (stackCount > 2)
if (itemsInSlot.Count() > 2)
{
string colorStr = XMLExtensions.ColorToString(GUI.Style.Blue);
toolTip += $"\n‖color:{colorStr}‖[{GameMain.Config.KeyBindText(InputType.TakeOneFromInventorySlot)}] {TextManager.Get("inputtype.takeonefrominventoryslot")}‖color:end‖";
@@ -579,6 +583,10 @@ namespace Barotrauma
{
DraggingItems.AddRange(slots[slotIndex].Items);
}
if (Screen.Selected == GameMain.GameScreen)
{
DraggingItems.RemoveAll(it => it.NonInteractable || it.NonPlayerTeamInteractable);
}
DraggingSlot = slot;
}
}
@@ -599,6 +607,10 @@ namespace Barotrauma
{
doubleClickedItems.AddRange(slots[slotIndex].Items);
}
if (Screen.Selected == GameMain.GameScreen)
{
doubleClickedItems.RemoveAll(it => it.NonInteractable || it.NonPlayerTeamInteractable);
}
}
}
}
@@ -1535,7 +1547,7 @@ namespace Barotrauma
}
Color spriteColor = sprite == item.Sprite ? item.GetSpriteColor() : item.GetInventoryIconColor();
if (inventory != null && inventory.Locked) { spriteColor *= 0.5f; }
if (inventory != null && (inventory.Locked || inventory.slots[slotIndex].Items.All(it => it.NonInteractable || it.NonPlayerTeamInteractable))) { spriteColor *= 0.5f; }
if (CharacterHealth.OpenHealthWindow != null && !item.UseInHealthInterface)
{
spriteColor = Color.Lerp(spriteColor, Color.TransparentBlack, 0.5f);