Unstable 0.17.8.0

This commit is contained in:
Markus Isberg
2022-04-09 03:18:10 +09:00
parent 164d72ae3a
commit 374f03c625
20 changed files with 156 additions and 145 deletions

View File

@@ -151,8 +151,9 @@ namespace Barotrauma
Stretch = true
};
LocalizedString deadDescription = TextManager.AddPunctuation(':', TextManager.Get("deceased") + "\n" + Character.CauseOfDeath.Affliction?.CauseOfDeathDescription ??
TextManager.AddPunctuation(':', TextManager.Get("CauseOfDeath"), TextManager.Get("CauseOfDeath." + Character.CauseOfDeath.Type.ToString())));
LocalizedString deadDescription =
TextManager.Get("deceased") + "\n" +
(Character.CauseOfDeath.Affliction?.CauseOfDeathDescription ?? TextManager.Get("CauseOfDeath." + Character.CauseOfDeath.Type.ToString()));
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), deadArea.RectTransform), deadDescription, textColor: GUIStyle.Red, font: font, textAlignment: Alignment.TopLeft) { Padding = Vector4.Zero };
}

View File

@@ -1,6 +1,9 @@
using Barotrauma.IO;
using Barotrauma.Media;
using Barotrauma.Networking;
using Barotrauma.Particles;
using Barotrauma.Steam;
using Barotrauma.Transition;
using FarseerPhysics;
using FarseerPhysics.Dynamics;
using Microsoft.Xna.Framework;
@@ -11,13 +14,7 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using Barotrauma.IO;
using System.Threading;
using Barotrauma.Tutorials;
using Barotrauma.Media;
using Barotrauma.Extensions;
using System.Threading.Tasks;
using Barotrauma.Transition;
namespace Barotrauma
{
@@ -430,7 +427,7 @@ namespace Barotrauma
if (TitleScreen.WaitForLanguageSelection)
{
ContentPackageManager.VanillaCorePackage.LoadFilesOfType<TextFile>();
TitleScreen.AvailableLanguages = TextManager.AvailableLanguages.ToArray();
TitleScreen.AvailableLanguages = TextManager.AvailableLanguages.OrderBy(l => l.Value != "english".ToIdentifier()).ThenBy(l => l.Value).ToArray();
while (TitleScreen.WaitForLanguageSelection)
{
yield return CoroutineStatus.Running;

View File

@@ -1308,17 +1308,8 @@ namespace Barotrauma
}
break;
case EventType.Status:
float prevCondition = condition;
condition = msg.ReadSingle();
if (prevCondition > 0.0f && condition <= 0.0f)
{
ApplyStatusEffects(ActionType.OnBroken, 1.0f);
foreach (ItemComponent ic in components)
{
ic.PlaySound(ActionType.OnBroken);
}
}
SetActiveSprite();
float newCondition = msg.ReadSingle();
SetCondition(newCondition, isNetworkEvent: true);
break;
case EventType.AssignCampaignInteraction:
CampaignInteractionType = (CampaignMode.InteractionType)msg.ReadByte();

View File

@@ -719,6 +719,9 @@ namespace Barotrauma.Networking
case ServerPacketHeader.CHEATS_ENABLED:
//allow interpreting this packet
break;
case ServerPacketHeader.STARTGAME:
GameMain.NetLobbyScreen.ShowSpectateButton();
return;
default:
return; //ignore any other packets
}

View File

@@ -583,17 +583,17 @@ namespace Barotrauma
c.ForceLayoutRecalculation();
});
bool serverExePickable = serverExecutableDropdown.ListBox.Content.CountChildren > 1;
serverExecutableDropdown.Parent.Visible
= serverExePickable;
serverExecutableDropdown.Parent.RectTransform.RelativeSize
= (1.0f, serverExePickable ? 0.1f : 0.0f);
serverExecutableDropdown.Parent.ForceLayoutRecalculation();
(serverExecutableDropdown.Parent.Parent as GUILayoutGroup)?.Recalculate();
if (serverExecutableDropdown.SelectedComponent is null)
bool wasPickable = serverExecutableDropdown.Parent.Visible;
if (wasPickable != serverExePickable)
{
serverExecutableDropdown.Select(0);
serverExecutableDropdown.Parent.Visible = serverExePickable;
serverExecutableDropdown.Parent.IgnoreLayoutGroups = !serverExePickable;
(serverExecutableDropdown.Parent.Parent as GUILayoutGroup)?.Recalculate();
if (serverExecutableDropdown.SelectedComponent is null)
{
serverExecutableDropdown.Select(0);
}
}
break;
case Tab.Tutorials:
if (!GameSettings.CurrentConfig.CampaignDisclaimerShown)
@@ -1132,18 +1132,19 @@ namespace Barotrauma
}
}
Vector2 textLabelSize = new Vector2(1.0f, 0.1f);
Vector2 textLabelSize = new Vector2(1.0f, 0.05f);
Alignment textAlignment = Alignment.CenterLeft;
Vector2 textFieldSize = new Vector2(0.5f, 1.0f);
Vector2 tickBoxSize = new Vector2(0.4f, 0.07f);
Vector2 tickBoxSize = new Vector2(0.4f, 0.04f);
var content = new GUILayoutGroup(new RectTransform(new Vector2(0.7f, 0.9f), menuTabs[Tab.HostServer].RectTransform, Anchor.Center), childAnchor: Anchor.TopCenter)
{
RelativeSpacing = 0.02f,
RelativeSpacing = 0.01f,
Stretch = true
};
GUIComponent parent = content;
new GUITextBlock(new RectTransform(textLabelSize, parent.RectTransform), TextManager.Get("HostServerButton"), textAlignment: Alignment.Center, font: GUIStyle.LargeFont) { ForceUpperCase = ForceUpperCase.Yes };
var header = new GUITextBlock(new RectTransform(textLabelSize, parent.RectTransform), TextManager.Get("HostServerButton"), textAlignment: Alignment.Center, font: GUIStyle.LargeFont) { ForceUpperCase = ForceUpperCase.Yes };
header.RectTransform.IsFixedSize = true;
//play style -----------------------------------------------------
@@ -1221,7 +1222,7 @@ namespace Barotrauma
MaxTextLength = NetConfig.ServerNameMaxLength,
OverflowClip = true
};
label.RectTransform.MaxSize = serverNameBox.RectTransform.MaxSize;
label.RectTransform.IsFixedSize = true;
var maxPlayersLabel = new GUITextBlock(new RectTransform(textLabelSize, parent.RectTransform), TextManager.Get("MaxPlayers"), textAlignment: textAlignment);
var buttonContainer = new GUILayoutGroup(new RectTransform(textFieldSize, maxPlayersLabel.RectTransform, Anchor.CenterRight), isHorizontal: true, childAnchor: Anchor.CenterLeft)
@@ -1254,14 +1255,14 @@ namespace Barotrauma
UserData = 1,
OnClicked = ChangeMaxPlayers
};
maxPlayersLabel.RectTransform.MaxSize = maxPlayersBox.RectTransform.MaxSize;
maxPlayersLabel.RectTransform.IsFixedSize = true;
label = new GUITextBlock(new RectTransform(textLabelSize, parent.RectTransform), TextManager.Get("Password"), textAlignment: textAlignment);
passwordBox = new GUITextBox(new RectTransform(textFieldSize, label.RectTransform, Anchor.CenterRight), text: password, textAlignment: textAlignment)
{
Censor = true
};
label.RectTransform.MaxSize = passwordBox.RectTransform.MaxSize;
label.RectTransform.IsFixedSize = true;
var serverExecutableLabel = new GUITextBlock(new RectTransform(textLabelSize, parent.RectTransform),
TextManager.Get("ServerExecutable"), textAlignment: textAlignment);
@@ -1297,7 +1298,8 @@ namespace Barotrauma
return true;
};
serverExecutableLabel.RectTransform.IsFixedSize = true;
// tickbox upper ---------------
var tickboxAreaUpper = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, tickBoxSize.Y), parent.RectTransform), isHorizontal: true);
@@ -1313,7 +1315,7 @@ namespace Barotrauma
Selected = banAfterWrongPassword
};
tickboxAreaUpper.RectTransform.MaxSize = isPublicBox.RectTransform.MaxSize;
tickboxAreaUpper.RectTransform.IsFixedSize = true;
// tickbox lower ---------------
@@ -1325,7 +1327,7 @@ namespace Barotrauma
ToolTip = TextManager.Get("hostserverkarmasettingtooltip")
};
tickboxAreaLower.RectTransform.MaxSize = karmaBox.RectTransform.MaxSize;
tickboxAreaLower.RectTransform.IsFixedSize = true;
//spacing
new GUIFrame(new RectTransform(new Vector2(1.0f, 0.05f), content.RectTransform), style: null);

View File

@@ -280,6 +280,7 @@ namespace Barotrauma
}
else
{
if (FlowSounds[i] == null) { continue; }
Vector2 soundPos = new Vector2(GameMain.SoundManager.ListenerPosition.X + (flowVolumeRight[i] - flowVolumeLeft[i]) * 100, GameMain.SoundManager.ListenerPosition.Y);
if (flowSoundChannels[i] == null || !flowSoundChannels[i].IsPlaying)
{

View File

@@ -6,7 +6,7 @@
<RootNamespace>Barotrauma</RootNamespace>
<Authors>FakeFish, Undertow Games</Authors>
<Product>Barotrauma</Product>
<Version>0.17.7.0</Version>
<Version>0.17.8.0</Version>
<Copyright>Copyright © FakeFish 2018-2022</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.17.7.0</Version>
<Version>0.17.8.0</Version>
<Copyright>Copyright © FakeFish 2018-2022</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.17.7.0</Version>
<Version>0.17.8.0</Version>
<Copyright>Copyright © FakeFish 2018-2022</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.17.7.0</Version>
<Version>0.17.8.0</Version>
<Copyright>Copyright © FakeFish 2018-2022</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.17.7.0</Version>
<Version>0.17.8.0</Version>
<Copyright>Copyright © FakeFish 2018-2022</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.17.7.0</Version>
<Version>0.17.8.0</Version>
<Copyright>Copyright © FakeFish 2018-2022</Copyright>
<Platforms>AnyCPU;x64</Platforms>
<AssemblyName>DedicatedServer</AssemblyName>

View File

@@ -1778,7 +1778,7 @@ namespace Barotrauma
AnimController.Anim != AnimController.Animation.UsingConstruction &&
AnimController.Anim != AnimController.Animation.CPR &&
(GameMain.NetworkMember == null || !GameMain.NetworkMember.IsClient || Controlled == this) &&
(AnimController.OnGround && !AnimController.InWater || IsKeyDown(InputType.Aim) && HeldItems.None(i => i.RequireAimToUse)))
AnimController.OnGround && !AnimController.InWater)
{
if (dontFollowCursor)
{
@@ -1788,30 +1788,13 @@ namespace Barotrauma
{
// Values lower than this seem to cause constantious flipping when the mouse is near the player and the player is running, because the root collider moves after flipping.
float followMargin = 40;
Vector2 diff = CursorPosition - AnimController.Collider.Position;
if (InWater)
if (CursorPosition.X < AnimController.Collider.Position.X - followMargin)
{
followMargin = 80;
diff = Vector2.Transform(diff, Matrix.CreateRotationZ(-AnimController.Collider.Rotation));
if (diff.X < followMargin)
{
AnimController.TargetDir = Direction.Left;
}
else if (diff.X > followMargin)
{
AnimController.TargetDir = Direction.Right;
}
AnimController.TargetDir = Direction.Left;
}
else
else if (CursorPosition.X > AnimController.Collider.Position.X + followMargin)
{
if (CursorPosition.X < AnimController.Collider.Position.X - followMargin)
{
AnimController.TargetDir = Direction.Left;
}
else if (CursorPosition.X > AnimController.Collider.Position.X + followMargin)
{
AnimController.TargetDir = Direction.Right;
}
AnimController.TargetDir = Direction.Right;
}
}
}

View File

@@ -21,7 +21,7 @@ namespace Barotrauma
public override void UnloadFile()
{
SubmarineInfo.RefreshSavedSub(Path.Value);
SubmarineInfo.RemoveSavedSub(Path.Value);
}
public override void Sort()

View File

@@ -469,15 +469,22 @@ namespace Barotrauma
}
var corePackageElement = contentPackagesElement.GetChildElement(CorePackageElementName);
var configEnabledCorePackage = findPackage(CorePackages, corePackageElement);
if (configEnabledCorePackage == null)
if (corePackageElement == null)
{
string packageStr = corePackageElement.GetAttributeString("name", null) ?? corePackageElement.GetAttributeStringUnrestricted("path", "UNKNOWN");
DebugConsole.ThrowError($"Could not find the selected core package \"{packageStr}\". Switching to the \"{enabledCorePackage.Name}\" package.");
DebugConsole.AddWarning($"No core package selected. Switching to the \"{enabledCorePackage.Name}\" package.");
}
else
{
enabledCorePackage = configEnabledCorePackage;
var configEnabledCorePackage = findPackage(CorePackages, corePackageElement);
if (configEnabledCorePackage == null)
{
string packageStr = corePackageElement.GetAttributeString("name", null) ?? corePackageElement.GetAttributeStringUnrestricted("path", "UNKNOWN");
DebugConsole.ThrowError($"Could not find the selected core package \"{packageStr}\". Switching to the \"{enabledCorePackage.Name}\" package.");
}
else
{
enabledCorePackage = configEnabledCorePackage;
}
}
var regularPackagesElement = contentPackagesElement.GetChildElement(RegularPackagesElementName);

View File

@@ -109,7 +109,7 @@ namespace Barotrauma
set { defaultRect = value; }
}
private Dictionary<string, Connection> connections;
private readonly Dictionary<string, Connection> connections;
private readonly List<Repairable> repairables;
@@ -516,74 +516,7 @@ namespace Barotrauma
get { return condition; }
set
{
if (GameMain.NetworkMember != null && GameMain.NetworkMember.IsClient) { return; }
if (!MathUtils.IsValid(value)) { return; }
if (Indestructible) { return; }
if (InvulnerableToDamage && value <= condition) { return; }
float prev = condition;
bool wasInFullCondition = IsFullCondition;
condition = MathHelper.Clamp(value, 0.0f, MaxCondition);
if (condition == 0.0f && prev > 0.0f)
{
//Flag connections to be updated as device is broken
flagChangedConnections(connections);
#if CLIENT
foreach (ItemComponent ic in components)
{
ic.PlaySound(ActionType.OnBroken);
}
if (Screen.Selected == GameMain.SubEditorScreen) { return; }
#endif
ApplyStatusEffects(ActionType.OnBroken, 1.0f, null);
}
else if (condition > 0.0f && prev <= 0.0f)
{
//Flag connections to be updated as device is now working again
flagChangedConnections(connections);
}
SetActiveSprite();
if (GameMain.NetworkMember != null && GameMain.NetworkMember.IsServer)
{
if (Math.Abs(lastSentCondition - condition) > 1.0f)
{
conditionUpdatePending = true;
isActive = true;
}
else if (wasInFullCondition != IsFullCondition)
{
conditionUpdatePending = true;
isActive = true;
}
else if (!MathUtils.NearlyEqual(lastSentCondition, condition) && (condition <= 0.0f || condition >= MaxCondition))
{
sendConditionUpdateTimer = 0.0f;
conditionUpdatePending = true;
isActive = true;
}
}
LastConditionChange = condition - prev;
ConditionLastUpdated = Timing.TotalTime;
static void flagChangedConnections(Dictionary<string, Connection> connections)
{
if (connections == null) { return; }
foreach (Connection c in connections.Values)
{
if (c.IsPower)
{
Powered.ChangedConnections.Add(c);
foreach (Connection conn in c.Recipients)
{
Powered.ChangedConnections.Add(conn);
}
}
}
}
SetCondition(value, isNetworkEvent: false);
}
}
@@ -1667,6 +1600,81 @@ namespace Barotrauma
return new AttackResult(damageAmount, null);
}
private void SetCondition(float value, bool isNetworkEvent)
{
if (!isNetworkEvent)
{
if (GameMain.NetworkMember != null && GameMain.NetworkMember.IsClient) { return; }
}
if (!MathUtils.IsValid(value)) { return; }
if (Indestructible) { return; }
if (InvulnerableToDamage && value <= condition) { return; }
float prev = condition;
bool wasInFullCondition = IsFullCondition;
condition = MathHelper.Clamp(value, 0.0f, MaxCondition);
if (condition == 0.0f && prev > 0.0f)
{
//Flag connections to be updated as device is broken
flagChangedConnections(connections);
#if CLIENT
foreach (ItemComponent ic in components)
{
ic.PlaySound(ActionType.OnBroken);
}
if (Screen.Selected == GameMain.SubEditorScreen) { return; }
#endif
ApplyStatusEffects(ActionType.OnBroken, 1.0f, null);
}
else if (condition > 0.0f && prev <= 0.0f)
{
//Flag connections to be updated as device is now working again
flagChangedConnections(connections);
}
SetActiveSprite();
if (GameMain.NetworkMember != null && GameMain.NetworkMember.IsServer)
{
if (Math.Abs(lastSentCondition - condition) > 1.0f)
{
conditionUpdatePending = true;
isActive = true;
}
else if (wasInFullCondition != IsFullCondition)
{
conditionUpdatePending = true;
isActive = true;
}
else if (!MathUtils.NearlyEqual(lastSentCondition, condition) && (condition <= 0.0f || condition >= MaxCondition))
{
sendConditionUpdateTimer = 0.0f;
conditionUpdatePending = true;
isActive = true;
}
}
LastConditionChange = condition - prev;
ConditionLastUpdated = Timing.TotalTime;
static void flagChangedConnections(Dictionary<string, Connection> connections)
{
if (connections == null) { return; }
foreach (Connection c in connections.Values)
{
if (c.IsPower)
{
Powered.ChangedConnections.Add(c);
foreach (Connection conn in c.Recipients)
{
Powered.ChangedConnections.Add(conn);
}
}
}
}
}
private bool IsInWater()
{
if (CurrentHull == null) { return true; }

View File

@@ -545,7 +545,7 @@ namespace Barotrauma
savedSubmarines.Add(subInfo);
}
public static void RefreshSavedSub(string filePath)
public static void RemoveSavedSub(string filePath)
{
string fullPath = Path.GetFullPath(filePath);
for (int i = savedSubmarines.Count - 1; i >= 0; i--)
@@ -555,7 +555,11 @@ namespace Barotrauma
savedSubmarines[i].Dispose();
}
}
}
public static void RefreshSavedSub(string filePath)
{
RemoveSavedSub(filePath);
if (File.Exists(filePath))
{
var subInfo = new SubmarineInfo(filePath);

View File

@@ -14,7 +14,7 @@ namespace Barotrauma
public override bool Loaded => left.Loaded || right.Loaded;
public override void RetrieveValue()
{
cachedValue = left.Value + right.Value;
cachedValue = (left.Value ?? string.Empty) + (right.Value ?? string.Empty);
UpdateLanguage();
}
}

View File

@@ -2,7 +2,6 @@ using Barotrauma.Extensions;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Xml.Linq;

View File

@@ -1,3 +1,18 @@
---------------------------------------------------------------------------------------------------------
v0.17.8.0
---------------------------------------------------------------------------------------------------------
Changes (unstable only):
- Remove flipping in water while aiming (with the changes introduced to aiming in the previous versions, aiming works even better without it).
Fixes (unstable only):
- Fixed languages being in random order in the initial language selection screen.
- Fixed power grid going crazy client-side when junction boxes break.
- Fixed crashing when clicking on a dead player in the tab menu.
- Fixed spectate button not appearing if the round starts while waiting for mods to download.
- Fixed disabling a submarine mod not actually disabling the sub.
- Fixed host server menu layout changing every time you open it, and the server exe dropdown having a different size than the rest of the elements.
---------------------------------------------------------------------------------------------------------
v0.17.7.0
---------------------------------------------------------------------------------------------------------