diff --git a/Barotrauma/BarotraumaClient/ClientSource/Characters/CharacterInfo.cs b/Barotrauma/BarotraumaClient/ClientSource/Characters/CharacterInfo.cs
index cf337b8e49..332b80c91f 100644
--- a/Barotrauma/BarotraumaClient/ClientSource/Characters/CharacterInfo.cs
+++ b/Barotrauma/BarotraumaClient/ClientSource/Characters/CharacterInfo.cs
@@ -185,15 +185,19 @@ partial void OnSkillChanged(string skillIdentifier, float prevLevel, float newLe
private void GetDisguisedSprites(IdCard idCard)
{
+ if (idCard.Item.Tags == string.Empty) return;
+
if (idCard.StoredJobPrefab == null || idCard.StoredPortrait == null)
{
string[] readTags = idCard.Item.Tags.Split(',');
+ if (readTags.Length == 0) return;
+
if (idCard.StoredJobPrefab == null)
{
- string jobIdTag = readTags.First(s => s.StartsWith("jobid:"));
+ string jobIdTag = readTags.FirstOrDefault(s => s.StartsWith("jobid:"));
- if (jobIdTag != string.Empty && jobIdTag.Length > 6)
+ if (jobIdTag != null && jobIdTag.Length > 6)
{
string jobId = jobIdTag.Substring(6);
if (jobId != string.Empty)
diff --git a/Barotrauma/BarotraumaClient/ClientSource/GUI/GUINumberInput.cs b/Barotrauma/BarotraumaClient/ClientSource/GUI/GUINumberInput.cs
index a2e32d741f..dae7f109d3 100644
--- a/Barotrauma/BarotraumaClient/ClientSource/GUI/GUINumberInput.cs
+++ b/Barotrauma/BarotraumaClient/ClientSource/GUI/GUINumberInput.cs
@@ -81,10 +81,13 @@ public float? MaxValueFloat
private float floatValue;
public float FloatValue
{
- get { return floatValue; }
+ get
+ {
+ return floatValue;
+ }
set
{
- if (MathUtils.NearlyEqual(value, floatValue)) return;
+ if (MathUtils.NearlyEqual(value, floatValue)) { return; }
floatValue = value;
ClampFloatValue();
float newValue = floatValue;
@@ -129,10 +132,13 @@ public int? MaxValueInt
private int intValue;
public int IntValue
{
- get { return intValue; }
+ get
+ {
+ return intValue;
+ }
set
{
- if (value == intValue) return;
+ if (value == intValue) { return; }
intValue = value;
UpdateText();
}
@@ -192,6 +198,29 @@ public GUINumberInput(RectTransform rectT, NumberType inputType, string style =
};
TextBox.CaretColor = TextBox.TextColor;
TextBox.OnTextChanged += TextChanged;
+ TextBox.OnDeselected += (sender, key) =>
+ {
+ if (inputType == NumberType.Int)
+ {
+ ClampIntValue();
+ }
+ else
+ {
+ ClampFloatValue();
+ }
+ };
+ TextBox.OnEnterPressed += (textBox, text) =>
+ {
+ if (inputType == NumberType.Int)
+ {
+ ClampIntValue();
+ }
+ else
+ {
+ ClampFloatValue();
+ }
+ return true;
+ };
var buttonArea = new GUIFrame(new RectTransform(new Vector2(_relativeButtonAreaWidth, 1.0f), LayoutGroup.RectTransform, Anchor.CenterRight), style: null);
PlusButton = new GUIButton(new RectTransform(new Vector2(1.0f, 0.5f), buttonArea.RectTransform), style: null);
@@ -299,10 +328,12 @@ private void ReduceValue()
if (inputType == NumberType.Int)
{
IntValue -= valueStep > 0 ? (int)valueStep : 1;
+ ClampIntValue();
}
else if (maxValueFloat.HasValue && minValueFloat.HasValue)
{
FloatValue -= valueStep > 0 ? valueStep : Round();
+ ClampFloatValue();
}
}
@@ -311,10 +342,12 @@ private void IncreaseValue()
if (inputType == NumberType.Int)
{
IntValue += valueStep > 0 ? (int)valueStep : 1;
+ ClampIntValue();
}
else if (inputType == NumberType.Float)
{
FloatValue += valueStep > 0 ? valueStep : Round();
+ ClampFloatValue();
}
}
@@ -325,7 +358,7 @@ private void IncreaseValue()
///
private float Round()
{
- if (!maxValueFloat.HasValue || !minValueFloat.HasValue) return 0;
+ if (!maxValueFloat.HasValue || !minValueFloat.HasValue) { return 0; }
float onePercent = MathHelper.Lerp(minValueFloat.Value, maxValueFloat.Value, 0.01f);
float diff = maxValueFloat.Value - minValueFloat.Value;
int decimals = (int)MathHelper.Lerp(3, 0, MathUtils.InverseLerp(10, 1000, diff));
@@ -337,28 +370,24 @@ private bool TextChanged(GUITextBox textBox, string text)
switch (InputType)
{
case NumberType.Int:
- int newIntValue = IntValue;
if (string.IsNullOrWhiteSpace(text) || text == "-")
{
intValue = 0;
}
- else if (int.TryParse(text, out newIntValue))
+ else if (int.TryParse(text, out int newIntValue))
{
intValue = newIntValue;
}
- ClampIntValue();
break;
case NumberType.Float:
- float newFloatValue = FloatValue;
if (string.IsNullOrWhiteSpace(text) || text == "-")
{
floatValue = 0;
}
- else if (float.TryParse(text, NumberStyles.Any, CultureInfo.InvariantCulture, out newFloatValue))
+ else if (float.TryParse(text, NumberStyles.Any, CultureInfo.InvariantCulture, out float newFloatValue))
{
floatValue = newFloatValue;
}
- ClampFloatValue();
break;
}
OnValueChanged?.Invoke(this);
diff --git a/Barotrauma/BarotraumaClient/ClientSource/Items/Components/RepairTool.cs b/Barotrauma/BarotraumaClient/ClientSource/Items/Components/RepairTool.cs
index e34555c26b..693ffa18ed 100644
--- a/Barotrauma/BarotraumaClient/ClientSource/Items/Components/RepairTool.cs
+++ b/Barotrauma/BarotraumaClient/ClientSource/Items/Components/RepairTool.cs
@@ -66,7 +66,11 @@ partial void UseProjSpecific(float deltaTime, Vector2 raystart)
{
foreach (ParticleEmitter particleEmitter in particleEmitters)
{
- float particleAngle = item.body.Rotation + MathHelper.ToRadians(BarrelRotation) + ((item.body.Dir > 0.0f) ? 0.0f : MathHelper.Pi);
+ float particleAngle = MathHelper.ToRadians(BarrelRotation);
+ if (item.body != null)
+ {
+ particleAngle += item.body.Rotation + ((item.body.Dir > 0.0f) ? 0.0f : MathHelper.Pi);
+ }
particleEmitter.Emit(
deltaTime, ConvertUnits.ToDisplayUnits(raystart),
item.CurrentHull, particleAngle, particleEmitter.Prefab.CopyEntityAngle ? -particleAngle : 0);
@@ -118,7 +122,7 @@ partial void FixItemProjSpecific(Character user, float deltaTime, Item targetIte
if (door == null || door.Stuck <= 0)
{
Vector2 progressBarPos = targetItem.DrawPosition;
- var progressBar = user.UpdateHUDProgressBar(
+ var progressBar = user?.UpdateHUDProgressBar(
targetItem,
progressBarPos,
progressBarState,
diff --git a/Barotrauma/BarotraumaClient/ClientSource/Items/Components/Signal/Connection.cs b/Barotrauma/BarotraumaClient/ClientSource/Items/Components/Signal/Connection.cs
index 03488b972f..72d42a9069 100644
--- a/Barotrauma/BarotraumaClient/ClientSource/Items/Components/Signal/Connection.cs
+++ b/Barotrauma/BarotraumaClient/ClientSource/Items/Components/Signal/Connection.cs
@@ -48,7 +48,7 @@ public static void DrawConnections(SpriteBatch spriteBatch, ConnectionPanel pane
Wire equippedWire = null;
- bool allowRewiring = GameMain.NetworkMember?.ServerSettings == null || GameMain.NetworkMember.ServerSettings.AllowRewiring;
+ bool allowRewiring = GameMain.NetworkMember?.ServerSettings == null || GameMain.NetworkMember.ServerSettings.AllowRewiring || panel.AlwaysAllowRewiring;
if (allowRewiring && (!panel.Locked || Screen.Selected == GameMain.SubEditorScreen))
{
//if the Character using the panel has a wire item equipped
@@ -380,7 +380,7 @@ private static void DrawWire(SpriteBatch spriteBatch, Wire wire, Vector2 end, Ve
{
ConnectionPanel.HighlightedWire = wire;
- bool allowRewiring = GameMain.NetworkMember?.ServerSettings == null || GameMain.NetworkMember.ServerSettings.AllowRewiring;
+ bool allowRewiring = GameMain.NetworkMember?.ServerSettings == null || GameMain.NetworkMember.ServerSettings.AllowRewiring || panel.AlwaysAllowRewiring;
if (allowRewiring && (!wire.Locked && !panel.Locked || Screen.Selected == GameMain.SubEditorScreen))
{
//start dragging the wire
diff --git a/Barotrauma/BarotraumaClient/ClientSource/Screens/SubEditorScreen.cs b/Barotrauma/BarotraumaClient/ClientSource/Screens/SubEditorScreen.cs
index 4d95518c79..a306ae4ff8 100644
--- a/Barotrauma/BarotraumaClient/ClientSource/Screens/SubEditorScreen.cs
+++ b/Barotrauma/BarotraumaClient/ClientSource/Screens/SubEditorScreen.cs
@@ -1677,10 +1677,6 @@ private void CreateSaveScreen(bool quickSave = false)
};
outpostModuleGroup.RectTransform.MinSize = new Point(0, outpostModuleGroup.RectTransform.Children.Max(c => c.MinSize.Y));
-
-
-
-
// module flags ---------------------
var allowAttachGroup = new GUILayoutGroup(new RectTransform(new Vector2(.975f, 0.1f), outpostSettingsContainer.RectTransform), isHorizontal: true, childAnchor: Anchor.CenterLeft);
@@ -1717,17 +1713,6 @@ private void CreateSaveScreen(bool quickSave = false)
};
allowAttachGroup.RectTransform.MinSize = new Point(0, allowAttachGroup.RectTransform.Children.Max(c => c.MinSize.Y));
-
-
-
-
-
-
-
-
-
-
-
// location types ---------------------
var locationTypeGroup = new GUILayoutGroup(new RectTransform(new Vector2(.975f, 0.1f), outpostSettingsContainer.RectTransform), isHorizontal: true, childAnchor: Anchor.CenterLeft);
diff --git a/Barotrauma/BarotraumaClient/LinuxClient.csproj b/Barotrauma/BarotraumaClient/LinuxClient.csproj
index 30c98547ca..e454433929 100644
--- a/Barotrauma/BarotraumaClient/LinuxClient.csproj
+++ b/Barotrauma/BarotraumaClient/LinuxClient.csproj
@@ -6,7 +6,7 @@
Barotrauma
FakeFish, Undertow Games
Barotrauma
- 0.11.0.9
+ 0.11.0.10
Copyright © FakeFish 2018-2020
AnyCPU;x64
Barotrauma
diff --git a/Barotrauma/BarotraumaClient/MacClient.csproj b/Barotrauma/BarotraumaClient/MacClient.csproj
index 6b7413f0c2..c798f8c5bf 100644
--- a/Barotrauma/BarotraumaClient/MacClient.csproj
+++ b/Barotrauma/BarotraumaClient/MacClient.csproj
@@ -6,7 +6,7 @@
Barotrauma
FakeFish, Undertow Games
Barotrauma
- 0.11.0.9
+ 0.11.0.10
Copyright © FakeFish 2018-2020
AnyCPU;x64
Barotrauma
diff --git a/Barotrauma/BarotraumaClient/WindowsClient.csproj b/Barotrauma/BarotraumaClient/WindowsClient.csproj
index ec594cf78a..ca058f39b8 100644
--- a/Barotrauma/BarotraumaClient/WindowsClient.csproj
+++ b/Barotrauma/BarotraumaClient/WindowsClient.csproj
@@ -6,7 +6,7 @@
Barotrauma
FakeFish, Undertow Games
Barotrauma
- 0.11.0.9
+ 0.11.0.10
Copyright © FakeFish 2018-2020
AnyCPU;x64
Barotrauma
diff --git a/Barotrauma/BarotraumaServer/ServerSource/Networking/GameServer.cs b/Barotrauma/BarotraumaServer/ServerSource/Networking/GameServer.cs
index c8d3873637..3935c348ba 100644
--- a/Barotrauma/BarotraumaServer/ServerSource/Networking/GameServer.cs
+++ b/Barotrauma/BarotraumaServer/ServerSource/Networking/GameServer.cs
@@ -2293,9 +2293,18 @@ private IEnumerable