Build 0.17.13.0

This commit is contained in:
Markus Isberg
2022-04-22 21:48:04 +09:00
parent 6cc100d98c
commit 7a09cf3260
58 changed files with 506 additions and 184 deletions
@@ -18,8 +18,8 @@ namespace Barotrauma
foreach ((Identifier identifier, Rectangle rect) in DisplayEntities)
{
var entityPrefab = MapEntityPrefab.FindByIdentifier(identifier);
if (entityPrefab is CoreEntityPrefab) { continue; }
var entityPrefab = FindByIdentifier(identifier);
if (entityPrefab is CoreEntityPrefab || entityPrefab == null) { continue; }
var drawRect = new Rectangle(
(int)(rect.X * scale) + drawArea.Center.X, (int)((rect.Y) * scale) - drawArea.Center.Y,
(int)(rect.Width * scale), (int)(rect.Height * scale));
@@ -1,10 +1,12 @@
using Barotrauma.IO;
using System;
using Barotrauma.IO;
using Barotrauma.Items.Components;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using System.Linq;
using System.Xml.Linq;
using Barotrauma.Extensions;
namespace Barotrauma
{
@@ -107,6 +109,25 @@ namespace Barotrauma
}
var pathContainer = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.2f), paddedFrame.RectTransform), isHorizontal: true);
string filePath = this.filePath;
if (filePath.StartsWith("Submarines"))
{
//this is the old submarines path, try to find a local mod that has a submarine with this name
string subName = Path.GetFileNameWithoutExtension(filePath);
string foundPath = ContentPackageManager.LocalPackages.Concat(ContentPackageManager.VanillaCorePackage.ToEnumerable())
.SelectMany(p => p.GetFiles<SubmarineFile>())
.FirstOrDefault(f => Path.GetFileNameWithoutExtension(f.Path.Value).Equals(subName, StringComparison.OrdinalIgnoreCase))
?.Path.Value;
if (foundPath.IsNullOrEmpty())
{
//no such sub found among the local mods, just guess the correct path
foundPath = Path.Combine(ContentPackage.LocalModsDir, subName, $"{subName}.sub");
}
filePath = foundPath;
}
var pathBox = new GUITextBox(new RectTransform(new Vector2(0.75f, 1.0f), pathContainer.RectTransform), filePath, font: GUIStyle.SmallFont);
var reloadButton = new GUIButton(new RectTransform(new Vector2(0.25f / pathBox.RectTransform.RelativeSize.X, 1.0f), pathBox.RectTransform, Anchor.CenterRight, Pivot.CenterLeft),
TextManager.Get("ReloadLinkedSub"), style: "GUIButtonSmall")