Unstable 0.1300.2.11

This commit is contained in:
Markus Isberg
2021-04-27 17:12:39 +03:00
parent 2c750282ec
commit bf743f1e99
15 changed files with 140 additions and 50 deletions

View File

@@ -44,11 +44,11 @@ namespace Barotrauma.Networking
protected string GetPackageStr(ContentPackage contentPackage)
{
return "\"" + contentPackage.Name + "\" (hash " + contentPackage.MD5hash.ShortHash + ")";
return $"\"{contentPackage.Name}\" (hash {contentPackage.MD5hash.ShortHash})";
}
protected string GetPackageStr(ServerContentPackage contentPackage)
{
return "\"" + contentPackage.Name + "\" (hash " + Md5Hash.GetShortHash(contentPackage.Hash) + ")";
return $"\"{contentPackage.Name}\" (hash {Md5Hash.GetShortHash(contentPackage.Hash)})";
}
public delegate void MessageCallback(IReadMessage message);
@@ -156,20 +156,12 @@ namespace Barotrauma.Networking
{
return ContentPackage.AllPackages.Any(local =>
local.SteamWorkshopId != 0 && /* is a Workshop item */
remote.WorkshopId == local.SteamWorkshopId /* ids match */);
remote.WorkshopId == local.SteamWorkshopId && /* ids match */
remote.InstallTime < local.InstallTime/* remote is older than local */);
});
if (GameMain.ServerListScreen.LastAutoConnectEndpoint != ServerConnection.EndPointString)
{
mismatchedButDownloaded = mismatchedButDownloaded.Where(remote =>
{
return ContentPackage.AllPackages.Any(local =>
remote.InstallTime < local.InstallTime/* remote is older than local */);
});
}
if (mismatchedButDownloaded.Any())
{
GameMain.ServerListScreen.LastAutoConnectEndpoint = null;
string disconnectMsg;
if (mismatchedButDownloaded.Count() == 1)
{
@@ -225,7 +217,9 @@ namespace Barotrauma.Networking
msgBox.Buttons[0].OnClicked = (yesBtn, userdata) =>
{
GameMain.ServerListScreen.Select();
GameMain.ServerListScreen.DownloadWorkshopItems(missingPackages.Select(p => p.WorkshopId), serverName, ServerConnection.EndPointString);
IEnumerable<ServerListScreen.PendingWorkshopDownload> downloads =
missingPackages.Select(p => new ServerListScreen.PendingWorkshopDownload(p.Hash, p.WorkshopId));
GameMain.ServerListScreen.DownloadWorkshopItems(downloads, serverName, ServerConnection.EndPointString);
return true;
};
msgBox.Buttons[0].OnClicked += msgBox.Close;

View File

@@ -1001,7 +1001,7 @@ namespace Barotrauma.Steam
}
catch (Exception e) { DebugConsole.ThrowError("Failed to delete Workshop item cache", e); }
}
itemToNuke.Download(onDownloadFinished, highPriority: true);
DebugConsole.NewMessage($"{itemToNuke.Download(onDownloadFinished, highPriority: true)}");
}
/// <summary>

View File

@@ -38,12 +38,32 @@ namespace Barotrauma
private GUIListBox friendsDropdown;
//Workshop downloads
public struct PendingWorkshopDownload
{
public readonly string ExpectedHash;
public readonly ulong Id;
public readonly Steamworks.Ugc.Item? Item;
public PendingWorkshopDownload(string expectedHash, Steamworks.Ugc.Item item)
{
ExpectedHash = expectedHash;
Item = item;
Id = item.Id;
}
public PendingWorkshopDownload(string expectedHash, ulong id)
{
ExpectedHash = expectedHash;
Item = null;
Id = id;
}
}
private GUIFrame workshopDownloadsFrame = null;
private Steamworks.Ugc.Item? currentlyDownloadingWorkshopItem = null;
private Dictionary<ulong, Steamworks.Ugc.Item?> pendingWorkshopDownloads = null;
private Dictionary<ulong, PendingWorkshopDownload> pendingWorkshopDownloads = null;
private string autoConnectName;
public string AutoConnectEndpoint { get; private set; }
public string LastAutoConnectEndpoint;
private string autoConnectEndpoint;
private enum TernaryOption
{
@@ -1043,7 +1063,7 @@ namespace Barotrauma
{
if (pendingWorkshopDownloads?.Any() ?? false)
{
Steamworks.Ugc.Item? item = pendingWorkshopDownloads.Values.FirstOrDefault(it => it != null);
Steamworks.Ugc.Item? item = pendingWorkshopDownloads.Values.FirstOrDefault(it => it.Item != null).Item;
if (item != null)
{
ulong itemId = item.Value.Id;
@@ -1054,6 +1074,7 @@ namespace Barotrauma
{
TaskPool.Add("SubscribeToServerMod", item?.Subscribe(), (t) => { });
}
PendingWorkshopDownload clearedDownload = pendingWorkshopDownloads[itemId];
pendingWorkshopDownloads.Remove(itemId);
currentlyDownloadingWorkshopItem = null;
@@ -1070,14 +1091,23 @@ namespace Barotrauma
workshopDownloadsFrame?.FindChild((c) => c.UserData is ulong l && l == itemId, true)?.Flash(GUI.Style.Red);
DebugConsole.ThrowError(errorMsg);
}
ContentPackage resultingPackage = ContentPackage.AllPackages.FirstOrDefault(p => p.MD5hash.Hash == clearedDownload.ExpectedHash);
if (resultingPackage == null)
{
workshopDownloadsFrame?.FindChild((c) => c.UserData is ulong l && l == itemId, true)?.Flash(GUI.Style.Red);
CancelWorkshopDownloads();
new GUIMessageBox(
TextManager.Get("ConnectionLost"),
TextManager.GetWithVariable("DisconnectMessage.MismatchedWorkshopMod", "incompatiblecontentpackage", $"\"{resultingPackage.Name}\" (hash {resultingPackage.MD5hash.ShortHash})"));
}
});
}
}
else if (!string.IsNullOrEmpty(AutoConnectEndpoint))
else if (!string.IsNullOrEmpty(autoConnectEndpoint))
{
LastAutoConnectEndpoint = AutoConnectEndpoint;
JoinServer(AutoConnectEndpoint, autoConnectName);
AutoConnectEndpoint = null;
JoinServer(autoConnectEndpoint, autoConnectName);
autoConnectEndpoint = null;
}
}
}
@@ -2134,46 +2164,46 @@ namespace Barotrauma
masterServerResponded = true;
}
public void DownloadWorkshopItems(IEnumerable<ulong> ids, string serverName, string endPointString)
public void DownloadWorkshopItems(IEnumerable<PendingWorkshopDownload> downloads, string serverName, string endPointString)
{
if (workshopDownloadsFrame != null) { return; }
int rowCount = ids.Count() + 2;
int rowCount = downloads.Count() + 2;
autoConnectName = serverName; AutoConnectEndpoint = endPointString;
autoConnectName = serverName; autoConnectEndpoint = endPointString;
workshopDownloadsFrame = new GUIFrame(new RectTransform(Vector2.One, GUI.Canvas), null, Color.Black * 0.5f);
currentlyDownloadingWorkshopItem = null;
pendingWorkshopDownloads = new Dictionary<ulong, Steamworks.Ugc.Item?>();
pendingWorkshopDownloads = new Dictionary<ulong, PendingWorkshopDownload>();
var innerFrame = new GUIFrame(new RectTransform(new Vector2(0.5f, 0.1f + 0.03f * rowCount), workshopDownloadsFrame.RectTransform, Anchor.Center, Pivot.Center));
var innerLayout = new GUILayoutGroup(new RectTransform(new Vector2(0.9f, (float)rowCount / (float)(rowCount + 3)), innerFrame.RectTransform, Anchor.Center, Pivot.Center));
foreach (ulong id in ids)
foreach (PendingWorkshopDownload entry in downloads)
{
pendingWorkshopDownloads.Add(id, null);
pendingWorkshopDownloads.Add(entry.Id, entry);
var itemLayout = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 1.0f / rowCount), innerLayout.RectTransform), true, Anchor.CenterLeft)
{
UserData = id
UserData = entry.Id
};
TaskPool.Add("RetrieveWorkshopItemData", Steamworks.SteamUGC.QueryFileAsync(id), (t) =>
TaskPool.Add("RetrieveWorkshopItemData", Steamworks.SteamUGC.QueryFileAsync(entry.Id), (t) =>
{
if (t.IsFaulted)
{
TaskPool.PrintTaskExceptions(t, $"Failed to retrieve Workshop item info (ID {id})");
TaskPool.PrintTaskExceptions(t, $"Failed to retrieve Workshop item info (ID {entry.Id})");
return;
}
Steamworks.Ugc.Item? item = ((Task<Steamworks.Ugc.Item?>)t).Result;
if (!item.HasValue)
{
DebugConsole.ThrowError($"Failed to find a Steam Workshop item with the ID {id}.");
DebugConsole.ThrowError($"Failed to find a Steam Workshop item with the ID {entry.Id}.");
return;
}
if (pendingWorkshopDownloads.ContainsKey(id))
if (pendingWorkshopDownloads.ContainsKey(entry.Id))
{
pendingWorkshopDownloads[id] = item;
pendingWorkshopDownloads[entry.Id] = new PendingWorkshopDownload(entry.ExpectedHash, item.Value);
new GUITextBlock(new RectTransform(new Vector2(0.4f, 0.67f), itemLayout.RectTransform, Anchor.CenterLeft, Pivot.CenterLeft), item.Value.Title);
@@ -2199,17 +2229,21 @@ namespace Barotrauma
{
OnClicked = (btn, obj) =>
{
AutoConnectEndpoint = null;
LastAutoConnectEndpoint = null;
autoConnectName = null;
pendingWorkshopDownloads.Clear();
currentlyDownloadingWorkshopItem = null;
workshopDownloadsFrame = null;
CancelWorkshopDownloads();
return true;
}
};
}
public void CancelWorkshopDownloads()
{
autoConnectEndpoint = null;
autoConnectName = null;
pendingWorkshopDownloads.Clear();
currentlyDownloadingWorkshopItem = null;
workshopDownloadsFrame = null;
}
private bool JoinServer(string endpoint, string serverName)
{
if (string.IsNullOrWhiteSpace(ClientNameBox.Text))

View File

@@ -696,7 +696,9 @@ namespace Barotrauma
DebugConsole.ThrowError($"Failed to reinstall \"{item?.Title}\": {errorMsg}", null, true);
elem.Flash(GUI.Style.Red);
}
RefreshSubscribedItems();
});
RefreshSubscribedItems();
}
catch (Exception e)
{
@@ -705,6 +707,7 @@ namespace Barotrauma
}
return true;
};
reinstallBtn.Enabled = !item.Value.IsDownloading && !item.Value.IsDownloadPending;
var unsubBtn = new GUIButton(new RectTransform(new Point((int)(32 * GUI.Scale)), rightColumn.RectTransform), "", style: "GUIMinusButton")
{
ToolTip = TextManager.Get("WorkshopItemUnsubscribe"),

View File

@@ -6,7 +6,7 @@
<RootNamespace>Barotrauma</RootNamespace>
<Authors>FakeFish, Undertow Games</Authors>
<Product>Barotrauma</Product>
<Version>0.1300.1.11</Version>
<Version>0.1300.2.11</Version>
<Copyright>Copyright © FakeFish 2018-2020</Copyright>
<Platforms>AnyCPU;x64</Platforms>
<AssemblyName>Barotrauma</AssemblyName>

View File

@@ -6,7 +6,7 @@
<RootNamespace>Barotrauma</RootNamespace>
<Authors>FakeFish, Undertow Games</Authors>
<Product>Barotrauma</Product>
<Version>0.1300.1.11</Version>
<Version>0.1300.2.11</Version>
<Copyright>Copyright © FakeFish 2018-2020</Copyright>
<Platforms>AnyCPU;x64</Platforms>
<AssemblyName>Barotrauma</AssemblyName>

View File

@@ -6,7 +6,7 @@
<RootNamespace>Barotrauma</RootNamespace>
<Authors>FakeFish, Undertow Games</Authors>
<Product>Barotrauma</Product>
<Version>0.1300.1.11</Version>
<Version>0.1300.2.11</Version>
<Copyright>Copyright © FakeFish 2018-2020</Copyright>
<Platforms>AnyCPU;x64</Platforms>
<AssemblyName>Barotrauma</AssemblyName>

View File

@@ -6,7 +6,7 @@
<RootNamespace>Barotrauma</RootNamespace>
<Authors>FakeFish, Undertow Games</Authors>
<Product>Barotrauma Dedicated Server</Product>
<Version>0.1300.1.11</Version>
<Version>0.1300.2.11</Version>
<Copyright>Copyright © FakeFish 2018-2020</Copyright>
<Platforms>AnyCPU;x64</Platforms>
<AssemblyName>DedicatedServer</AssemblyName>

View File

@@ -6,7 +6,7 @@
<RootNamespace>Barotrauma</RootNamespace>
<Authors>FakeFish, Undertow Games</Authors>
<Product>Barotrauma Dedicated Server</Product>
<Version>0.1300.1.11</Version>
<Version>0.1300.2.11</Version>
<Copyright>Copyright © FakeFish 2018-2020</Copyright>
<Platforms>AnyCPU;x64</Platforms>
<AssemblyName>DedicatedServer</AssemblyName>

View File

@@ -6,7 +6,7 @@
<RootNamespace>Barotrauma</RootNamespace>
<Authors>FakeFish, Undertow Games</Authors>
<Product>Barotrauma Dedicated Server</Product>
<Version>0.1300.1.11</Version>
<Version>0.1300.2.11</Version>
<Copyright>Copyright © FakeFish 2018-2020</Copyright>
<Platforms>AnyCPU;x64</Platforms>
<AssemblyName>DedicatedServer</AssemblyName>

View File

@@ -144,6 +144,11 @@ namespace Barotrauma
// If the variant does not exist, parse the path so that it uses first variant.
SpritePath = tempPath.Replace("[VARIANT]", "1");
}
if (!File.Exists(SpritePath) && _gender == Gender.None)
{
// If there's no sprite for Gender.None does not exist, try to use male sprite
SpritePath = tempPath.Replace("[GENDER]", "male");
}
if (parseSpritePath)
{
Sprite.ParseTexturePath(file: SpritePath);

View File

@@ -426,7 +426,7 @@ namespace Barotrauma
{
if (MathUtils.LineSegmentToPointDistanceSquared((edge.Point1 + cell.Translation).ToPoint(), (edge.Point2 + cell.Translation).ToPoint(), worldPosition.ToPoint()) < worldRange * worldRange)
{
destructibleWall.AddDamage(damage, worldPosition);
destructibleWall.AddDamage(levelWallDamage, worldPosition);
break;
}
}

View File

@@ -1068,12 +1068,36 @@ namespace Barotrauma
public void NeutralizeBallast()
{
float neutralBallastLevel = 0.5f;
int selectedSteeringValue = 0;
foreach (Item item in Item.ItemList)
{
if (item.Submarine != this) { continue; }
var steering = item.GetComponent<Steering>();
if (steering == null) { continue; }
neutralBallastLevel = Math.Min(neutralBallastLevel, steering.NeutralBallastLevel);
//find how many pumps/engines in this sub the steering item is connected to
int steeringValue = 1;
Connection connectionX = item.GetComponent<ConnectionPanel>()?.Connections.Find(c => c.Name == "velocity_x_out");
Connection connectionY = item.GetComponent<ConnectionPanel>()?.Connections.Find(c => c.Name == "velocity_y_out");
if (connectionX != null)
{
foreach (Engine engine in steering.Item.GetConnectedComponentsRecursive<Engine>(connectionX))
{
if (engine.Item.Submarine == this) { steeringValue++; }
}
}
if (connectionY != null)
{
foreach (Pump pump in steering.Item.GetConnectedComponentsRecursive<Pump>(connectionY))
{
if (pump.Item.Submarine == this) { steeringValue++; }
}
}
//the nav terminal that's connected to the most engines/pumps in the sub most likely controls the sub (instead of a shuttle or some other system)
if (steeringValue > selectedSteeringValue)
{
neutralBallastLevel = steering.NeutralBallastLevel;
}
}
HashSet<Hull> ballastHulls = new HashSet<Hull>();

View File

@@ -1,5 +1,22 @@
---------------------------------------------------------------------------------------------------------
v0.13.1.11
v0.1300.2.11 (unstable)
---------------------------------------------------------------------------------------------------------
Changes:
- Made large monsters immune to sufforin.
Fixes:
- More fixes to installing/updating mods.
- Fixed certain submarines spawning with a non-neutral ballast level (Kastrull seems to have been the only affected vanilla submarine). Happened because the game would determine the neutral ballast level from the first nav terminal it finds in the sub, without checking whether that terminal controls a shuttle or the sub itself.
- Fixed explosions using wall damage value instead of level wall damage when the explosion happens outside a level wall.
- Fixed oxygen shelves refilling oxygenite tanks (again).
- Readded traitor missions that were accidentally removed in the previous unstable build.
Modding:
- Fixed console errors when a character with no gender tries to wear clothing that only has separate male and female sprites.
---------------------------------------------------------------------------------------------------------
v0.1300.1.11 (unstable)
---------------------------------------------------------------------------------------------------------
Changes:

View File

@@ -25,7 +25,20 @@ namespace Steamworks
internal static void InstallEvents( bool server )
{
Dispatch.Install<DownloadItemResult_t>( x => OnDownloadItemResult?.Invoke( x.Result ), server );
Dispatch.Install<DownloadItemResult_t>( x =>
{
if (x.AppID == SteamClient.AppId)
{
OnDownloadItemResult?.Invoke(x.Result);
Ugc.Item item = new Ugc.Item(x.PublishedFileId);
if (item.IsInstalled && (onItemInstalled?.ContainsKey(x.PublishedFileId) ?? false))
{
onItemInstalled[x.PublishedFileId]?.Invoke();
onItemInstalled.Remove(x.PublishedFileId);
}
}
}, server );
Dispatch.Install<ItemInstalled_t>(x =>
{
if (x.AppID == SteamClient.AppId)