(cd17ab725) Cleanup.

This commit is contained in:
Joonas Rikkonen
2019-05-18 17:28:18 +03:00
parent c7ceed07c7
commit d84832296c
7 changed files with 65 additions and 21 deletions
@@ -331,11 +331,8 @@ namespace Barotrauma
if (!string.IsNullOrEmpty(text)) if (!string.IsNullOrEmpty(text))
{ {
Vector2 pos = rect.Location.ToVector2() + textPos + TextOffset; Vector2 pos = rect.Location.ToVector2() + textPos + TextOffset;
if (RoundToNearestPixel) pos.X = (int)pos.X;
{ pos.Y = (int)pos.Y;
pos.X = (int)pos.X;
pos.Y = (int)pos.Y;
}
Font.DrawString(spriteBatch, Font.DrawString(spriteBatch,
Wrap ? wrappedText : text, Wrap ? wrappedText : text,
@@ -105,8 +105,7 @@ namespace Barotrauma.Items.Components
textBlock = new GUITextBlock(new RectTransform(item.Rect.Size), "", textBlock = new GUITextBlock(new RectTransform(item.Rect.Size), "",
textColor: textColor, font: GUI.UnscaledSmallFont, textAlignment: Alignment.Center, wrap: true, style: null) textColor: textColor, font: GUI.UnscaledSmallFont, textAlignment: Alignment.Center, wrap: true, style: null)
{ {
TextDepth = item.SpriteDepth - 0.00001f, TextDepth = item.SpriteDepth - 0.0001f,
RoundToNearestPixel = false,
TextScale = TextScale TextScale = TextScale
}; };
} }
@@ -2408,10 +2408,7 @@ namespace Barotrauma.Networking
if (senderCharacter != null && if (senderCharacter != null &&
client.Character != null && !client.Character.IsDead) client.Character != null && !client.Character.IsDead)
{ {
if (senderCharacter != client.Character) modifiedMessage = ChatMessage.ApplyDistanceEffect(message, (ChatMessageType)type, senderCharacter, client.Character);
{
modifiedMessage = ChatMessage.ApplyDistanceEffect(message, (ChatMessageType)type, senderCharacter, client.Character);
}
//too far to hear the msg -> don't send //too far to hear the msg -> don't send
if (string.IsNullOrWhiteSpace(modifiedMessage)) continue; if (string.IsNullOrWhiteSpace(modifiedMessage)) continue;
@@ -2460,16 +2457,13 @@ namespace Barotrauma.Networking
if (message.Sender != null && if (message.Sender != null &&
client.Character != null && !client.Character.IsDead) client.Character != null && !client.Character.IsDead)
{ {
if (message.Sender != client.Character) modifiedMessage = ChatMessage.ApplyDistanceEffect(message.Text, messageType, message.Sender, client.Character);
{
modifiedMessage = ChatMessage.ApplyDistanceEffect(message.Text, messageType, message.Sender, client.Character);
}
//too far to hear the msg -> don't send //too far to hear the msg -> don't send
if (string.IsNullOrWhiteSpace(modifiedMessage)) continue; if (string.IsNullOrWhiteSpace(modifiedMessage)) continue;
} }
SendDirectChatMessage(new OrderChatMessage(message.Order, message.OrderOption, message.TargetEntity, message.TargetCharacter, message.Sender), client); SendDirectChatMessage(message, client);
} }
string myReceivedMessage = message.Text; string myReceivedMessage = message.Text;
@@ -85,12 +85,18 @@ namespace Barotrauma
if (Character.Submarine != null || SelectedAiTarget?.Entity?.Submarine != null) if (Character.Submarine != null || SelectedAiTarget?.Entity?.Submarine != null)
{ {
if (steeringManager != insideSteering) insideSteering.Reset(); if (steeringManager != insideSteering)
{
insideSteering.Reset();
}
steeringManager = insideSteering; steeringManager = insideSteering;
} }
else else
{ {
if (steeringManager != outsideSteering) outsideSteering.Reset(); if (steeringManager != outsideSteering)
{
outsideSteering.Reset();
}
steeringManager = outsideSteering; steeringManager = outsideSteering;
} }
@@ -117,7 +117,7 @@ namespace Barotrauma
// Take the sub position into account in the sim pos // Take the sub position into account in the sim pos
if (character.Submarine == null && Target.Submarine != null) if (character.Submarine == null && Target.Submarine != null)
{ {
currTargetSimPos += Target.Submarine.SimPosition; //currTargetSimPos += Target.Submarine.SimPosition;
} }
else if (character.Submarine != null && Target.Submarine == null) else if (character.Submarine != null && Target.Submarine == null)
{ {
@@ -165,8 +165,8 @@ namespace Barotrauma
{ {
Vector2 nodePos = node.Position; Vector2 nodePos = node.Position;
float xDiff = System.Math.Abs(start.X - nodePos.X); float xDiff = Math.Abs(start.X - nodePos.X);
float yDiff = System.Math.Abs(start.Y - nodePos.Y); float yDiff = Math.Abs(start.Y - nodePos.Y);
if (yDiff > 1.0f && node.Waypoint.Ladders == null && node.Waypoint.Stairs == null) if (yDiff > 1.0f && node.Waypoint.Ladders == null && node.Waypoint.Stairs == null)
{ {
@@ -821,6 +821,54 @@ namespace Barotrauma
VoiceSetting = voiceSetting; VoiceSetting = voiceSetting;
} }
} }
if (!SelectedContentPackages.Any())
{
var availablePackage = ContentPackage.List.FirstOrDefault(cp => cp.IsCompatible() && cp.CorePackage);
if (availablePackage != null)
{
SelectedContentPackages.Add(availablePackage);
}
}
//save to get rid of the invalid selected packages in the config file
if (missingPackagePaths.Count > 0 || incompatiblePackages.Count > 0) { SaveNewPlayerConfig(); }
}
#endregion
#region Save DefaultConfig
private void SaveNewDefaultConfig()
{
XDocument doc = new XDocument();
if (doc.Root == null)
{
doc.Add(new XElement("config"));
}
doc.Root.Add(
new XAttribute("language", TextManager.Language),
new XAttribute("masterserverurl", MasterServerUrl),
new XAttribute("autocheckupdates", AutoCheckUpdates),
new XAttribute("musicvolume", musicVolume),
new XAttribute("soundvolume", soundVolume),
new XAttribute("voicechatvolume", voiceChatVolume),
new XAttribute("verboselogging", VerboseLogging),
new XAttribute("savedebugconsolelogs", SaveDebugConsoleLogs),
new XAttribute("enablesplashscreen", EnableSplashScreen),
new XAttribute("usesteammatchmaking", useSteamMatchmaking),
new XAttribute("quickstartsub", QuickStartSubmarineName),
new XAttribute("requiresteamauthentication", requireSteamAuthentication),
new XAttribute("aimassistamount", aimAssistAmount));
if (!ShowUserStatisticsPrompt)
{
doc.Root.Add(new XAttribute("senduserstatistics", sendUserStatistics));
}
if (WasGameUpdated)
{
doc.Root.Add(new XAttribute("wasgameupdated", true));
}
useSteamMatchmaking = doc.Root.GetAttributeBool("usesteammatchmaking", useSteamMatchmaking); useSteamMatchmaking = doc.Root.GetAttributeBool("usesteammatchmaking", useSteamMatchmaking);
requireSteamAuthentication = doc.Root.GetAttributeBool("requiresteamauthentication", requireSteamAuthentication); requireSteamAuthentication = doc.Root.GetAttributeBool("requiresteamauthentication", requireSteamAuthentication);