(078e3646e) Merge branch 'dev' of https://github.com/Regalis11/Barotrauma-development into dev
This commit is contained in:
@@ -331,8 +331,11 @@ namespace Barotrauma
|
|||||||
if (!string.IsNullOrEmpty(text))
|
if (!string.IsNullOrEmpty(text))
|
||||||
{
|
{
|
||||||
Vector2 pos = rect.Location.ToVector2() + textPos + TextOffset;
|
Vector2 pos = rect.Location.ToVector2() + textPos + TextOffset;
|
||||||
pos.X = (int)pos.X;
|
if (RoundToNearestPixel)
|
||||||
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,
|
||||||
|
|||||||
@@ -1350,7 +1350,7 @@ namespace Barotrauma
|
|||||||
bool hasFires = Character.Controlled.CurrentHull.FireSources.Count > 0;
|
bool hasFires = Character.Controlled.CurrentHull.FireSources.Count > 0;
|
||||||
ToggleReportButton("reportfire", hasFires);
|
ToggleReportButton("reportfire", hasFires);
|
||||||
|
|
||||||
bool hasLeaks = Character.Controlled.CurrentHull.ConnectedGaps.Any(g => !g.IsRoomToRoom && g.Open > 0.0f);
|
bool hasLeaks = Character.Controlled.CurrentHull.Submarine != null && Character.Controlled.CurrentHull.ConnectedGaps.Any(g => !g.IsRoomToRoom && g.Open > 0.0f);
|
||||||
ToggleReportButton("reportbreach", hasLeaks);
|
ToggleReportButton("reportbreach", hasLeaks);
|
||||||
|
|
||||||
bool hasIntruders = Character.CharacterList.Any(c => c.CurrentHull == Character.Controlled.CurrentHull && AIObjectiveFightIntruders.IsValidTarget(Character.Controlled, c));
|
bool hasIntruders = Character.CharacterList.Any(c => c.CurrentHull == Character.Controlled.CurrentHull && AIObjectiveFightIntruders.IsValidTarget(Character.Controlled, c));
|
||||||
|
|||||||
@@ -105,7 +105,8 @@ 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.0001f,
|
TextDepth = item.SpriteDepth - 0.00001f,
|
||||||
|
RoundToNearestPixel = false,
|
||||||
TextScale = TextScale
|
TextScale = TextScale
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2408,7 +2408,10 @@ namespace Barotrauma.Networking
|
|||||||
if (senderCharacter != null &&
|
if (senderCharacter != null &&
|
||||||
client.Character != null && !client.Character.IsDead)
|
client.Character != null && !client.Character.IsDead)
|
||||||
{
|
{
|
||||||
modifiedMessage = ChatMessage.ApplyDistanceEffect(message, (ChatMessageType)type, senderCharacter, client.Character);
|
if (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;
|
||||||
@@ -2457,13 +2460,16 @@ namespace Barotrauma.Networking
|
|||||||
if (message.Sender != null &&
|
if (message.Sender != null &&
|
||||||
client.Character != null && !client.Character.IsDead)
|
client.Character != null && !client.Character.IsDead)
|
||||||
{
|
{
|
||||||
modifiedMessage = ChatMessage.ApplyDistanceEffect(message.Text, messageType, message.Sender, client.Character);
|
if (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(message, client);
|
SendDirectChatMessage(new OrderChatMessage(message.Order, message.OrderOption, message.TargetEntity, message.TargetCharacter, message.Sender), client);
|
||||||
}
|
}
|
||||||
|
|
||||||
string myReceivedMessage = message.Text;
|
string myReceivedMessage = message.Text;
|
||||||
|
|||||||
@@ -424,6 +424,79 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
Language = doc.Root.GetAttributeString("language", "English");
|
Language = doc.Root.GetAttributeString("language", "English");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CheckBindings(bool useDefaults)
|
||||||
|
{
|
||||||
|
foreach (InputType inputType in Enum.GetValues(typeof(InputType)))
|
||||||
|
{
|
||||||
|
var binding = keyMapping[(int)inputType];
|
||||||
|
if (binding == null)
|
||||||
|
{
|
||||||
|
switch (inputType)
|
||||||
|
{
|
||||||
|
case InputType.Deselect:
|
||||||
|
if (useDefaults)
|
||||||
|
{
|
||||||
|
binding = new KeyOrMouse(1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Legacy support
|
||||||
|
var selectKey = keyMapping[(int)InputType.Select];
|
||||||
|
if (selectKey != null && selectKey.Key != Keys.None)
|
||||||
|
{
|
||||||
|
binding = new KeyOrMouse(selectKey.Key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case InputType.Shoot:
|
||||||
|
if (useDefaults)
|
||||||
|
{
|
||||||
|
binding = new KeyOrMouse(0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Legacy support
|
||||||
|
var useKey = keyMapping[(int)InputType.Use];
|
||||||
|
if (useKey != null && useKey.MouseButton.HasValue)
|
||||||
|
{
|
||||||
|
binding = new KeyOrMouse(useKey.MouseButton.Value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (binding == null)
|
||||||
|
{
|
||||||
|
DebugConsole.ThrowError("Key binding for the input type \"" + inputType + " not set!");
|
||||||
|
binding = new KeyOrMouse(Keys.D1);
|
||||||
|
}
|
||||||
|
keyMapping[(int)inputType] = binding;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Load DefaultConfig
|
||||||
|
private void LoadDefaultConfig(bool setLanguage = true)
|
||||||
|
{
|
||||||
|
XDocument doc = XMLExtensions.TryLoadXml(savePath);
|
||||||
|
|
||||||
|
if (setLanguage || string.IsNullOrEmpty(Language))
|
||||||
|
{
|
||||||
|
Language = doc.Root.GetAttributeString("language", "English");
|
||||||
|
}
|
||||||
|
|
||||||
|
MasterServerUrl = doc.Root.GetAttributeString("masterserverurl", "");
|
||||||
|
|
||||||
|
AutoCheckUpdates = doc.Root.GetAttributeBool("autocheckupdates", true);
|
||||||
|
WasGameUpdated = doc.Root.GetAttributeBool("wasgameupdated", false);
|
||||||
|
|
||||||
|
VerboseLogging = doc.Root.GetAttributeBool("verboselogging", false);
|
||||||
|
SaveDebugConsoleLogs = doc.Root.GetAttributeBool("savedebugconsolelogs", false);
|
||||||
|
|
||||||
|
QuickStartSubmarineName = doc.Root.GetAttributeString("quickstartsub", "");
|
||||||
|
|
||||||
MasterServerUrl = doc.Root.GetAttributeString("masterserverurl", "");
|
MasterServerUrl = doc.Root.GetAttributeString("masterserverurl", "");
|
||||||
|
|
||||||
@@ -821,54 +894,6 @@ 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);
|
||||||
@@ -934,55 +959,6 @@ namespace Barotrauma
|
|||||||
|
|
||||||
selectedContentPackagePaths = new HashSet<string>();
|
selectedContentPackagePaths = new HashSet<string>();
|
||||||
|
|
||||||
foreach (XElement subElement in doc.Root.Elements())
|
|
||||||
{
|
|
||||||
switch (subElement.Name.ToString().ToLowerInvariant())
|
|
||||||
{
|
|
||||||
case "keymapping":
|
|
||||||
LoadKeyBinds(subElement);
|
|
||||||
break;
|
|
||||||
case "gameplay":
|
|
||||||
jobPreferences = new List<string>();
|
|
||||||
foreach (XElement ele in subElement.Element("jobpreferences").Elements("job"))
|
|
||||||
{
|
|
||||||
string jobIdentifier = ele.GetAttributeString("identifier", "");
|
|
||||||
if (string.IsNullOrEmpty(jobIdentifier)) continue;
|
|
||||||
jobPreferences.Add(jobIdentifier);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "player":
|
|
||||||
defaultPlayerName = subElement.GetAttributeString("name", defaultPlayerName);
|
|
||||||
CharacterHeadIndex = subElement.GetAttributeInt("headindex", CharacterHeadIndex);
|
|
||||||
if (Enum.TryParse(subElement.GetAttributeString("gender", "none"), true, out Gender g))
|
|
||||||
{
|
|
||||||
CharacterGender = g;
|
|
||||||
}
|
|
||||||
if (Enum.TryParse(subElement.GetAttributeString("race", "white"), true, out Race r))
|
|
||||||
{
|
|
||||||
CharacterRace = r;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
CharacterRace = Race.White;
|
|
||||||
}
|
|
||||||
CharacterHairIndex = subElement.GetAttributeInt("hairindex", CharacterHairIndex);
|
|
||||||
CharacterBeardIndex = subElement.GetAttributeInt("beardindex", CharacterBeardIndex);
|
|
||||||
CharacterMoustacheIndex = subElement.GetAttributeInt("moustacheindex", CharacterMoustacheIndex);
|
|
||||||
CharacterFaceAttachmentIndex = subElement.GetAttributeInt("faceattachmentindex", CharacterFaceAttachmentIndex);
|
|
||||||
break;
|
|
||||||
case "tutorials":
|
|
||||||
foreach (XElement tutorialElement in subElement.Elements())
|
|
||||||
{
|
|
||||||
CompletedTutorialNames.Add(tutorialElement.GetAttributeString("name", ""));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
UnsavedSettings = false;
|
|
||||||
|
|
||||||
selectedContentPackagePaths = new HashSet<string>();
|
|
||||||
|
|
||||||
foreach (XElement subElement in doc.Root.Elements())
|
foreach (XElement subElement in doc.Root.Elements())
|
||||||
{
|
{
|
||||||
gSettings = new XElement("graphicssettings");
|
gSettings = new XElement("graphicssettings");
|
||||||
|
|||||||
Reference in New Issue
Block a user