diff --git a/Barotrauma/BarotraumaClient/ClientSource/Characters/CharacterInfo.cs b/Barotrauma/BarotraumaClient/ClientSource/Characters/CharacterInfo.cs
index cf337b8e4..332b80c91 100644
--- a/Barotrauma/BarotraumaClient/ClientSource/Characters/CharacterInfo.cs
+++ b/Barotrauma/BarotraumaClient/ClientSource/Characters/CharacterInfo.cs
@@ -185,15 +185,19 @@ namespace Barotrauma
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 a2e32d741..dae7f109d 100644
--- a/Barotrauma/BarotraumaClient/ClientSource/GUI/GUINumberInput.cs
+++ b/Barotrauma/BarotraumaClient/ClientSource/GUI/GUINumberInput.cs
@@ -81,10 +81,13 @@ namespace Barotrauma
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 @@ namespace Barotrauma
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 @@ namespace Barotrauma
};
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 @@ namespace Barotrauma
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 @@ namespace Barotrauma
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 @@ namespace Barotrauma
///
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 @@ namespace Barotrauma
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 e34555c26..693ffa18e 100644
--- a/Barotrauma/BarotraumaClient/ClientSource/Items/Components/RepairTool.cs
+++ b/Barotrauma/BarotraumaClient/ClientSource/Items/Components/RepairTool.cs
@@ -66,7 +66,11 @@ namespace Barotrauma.Items.Components
{
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 @@ namespace Barotrauma.Items.Components
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 03488b972..72d42a906 100644
--- a/Barotrauma/BarotraumaClient/ClientSource/Items/Components/Signal/Connection.cs
+++ b/Barotrauma/BarotraumaClient/ClientSource/Items/Components/Signal/Connection.cs
@@ -48,7 +48,7 @@ namespace Barotrauma.Items.Components
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 @@ namespace Barotrauma.Items.Components
{
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 4d95518c7..a306ae4ff 100644
--- a/Barotrauma/BarotraumaClient/ClientSource/Screens/SubEditorScreen.cs
+++ b/Barotrauma/BarotraumaClient/ClientSource/Screens/SubEditorScreen.cs
@@ -1677,10 +1677,6 @@ namespace Barotrauma
};
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 @@ namespace Barotrauma
};
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 30c98547c..e45443392 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 6b7413f0c..c798f8c5b 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 ec594cf78..ca058f39b 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 c8d387363..3935c348b 100644
--- a/Barotrauma/BarotraumaServer/ServerSource/Networking/GameServer.cs
+++ b/Barotrauma/BarotraumaServer/ServerSource/Networking/GameServer.cs
@@ -2293,9 +2293,18 @@ namespace Barotrauma.Networking
}
}
- if (crewManager != null && crewManager.HasBots && hadBots)
+ if (crewManager != null && crewManager.HasBots)
{
- crewManager?.InitRound();
+ if (hadBots)
+ {
+ //loaded existing bots -> init them
+ crewManager?.InitRound();
+ }
+ else
+ {
+ //created new bots -> save them
+ SaveUtil.SaveGame(GameMain.GameSession.SavePath);
+ }
}
campaign?.LoadPets();
diff --git a/Barotrauma/BarotraumaShared/SharedSource/Characters/Animation/HumanoidAnimController.cs b/Barotrauma/BarotraumaShared/SharedSource/Characters/Animation/HumanoidAnimController.cs
index b42f8dfa1..e811835b8 100644
--- a/Barotrauma/BarotraumaShared/SharedSource/Characters/Animation/HumanoidAnimController.cs
+++ b/Barotrauma/BarotraumaShared/SharedSource/Characters/Animation/HumanoidAnimController.cs
@@ -1315,16 +1315,23 @@ namespace Barotrauma
var thigh = i == 0 ? GetLimb(LimbType.LeftThigh) : GetLimb(LimbType.RightThigh);
if (thigh == null) { continue; }
if (thigh.IsSevered) { continue; }
-
float thighDiff = Math.Abs(MathUtils.GetShortestAngle(torso.Rotation, thigh.Rotation));
- float thighTorque = thighDiff * thigh.Mass * Math.Sign(torso.Rotation - thigh.Rotation) * 5.0f;
- thigh.body.ApplyTorque(thighTorque * strength);
+ float diff = torso.Rotation - thigh.Rotation;
+ if (MathUtils.IsValid(diff))
+ {
+ float thighTorque = thighDiff * thigh.Mass * Math.Sign(diff) * 5.0f;
+ thigh.body.ApplyTorque(thighTorque * strength);
+ }
var leg = i == 0 ? GetLimb(LimbType.LeftLeg) : GetLimb(LimbType.RightLeg);
if (leg == null || leg.IsSevered) { continue; }
float legDiff = Math.Abs(MathUtils.GetShortestAngle(torso.Rotation, leg.Rotation));
- float legTorque = legDiff * leg.Mass * Math.Sign(torso.Rotation - leg.Rotation) * 5.0f;
- leg.body.ApplyTorque(legTorque * strength);
+ diff = torso.Rotation - leg.Rotation;
+ if (MathUtils.IsValid(diff))
+ {
+ float legTorque = legDiff * leg.Mass * Math.Sign(diff) * 5.0f;
+ leg.body.ApplyTorque(legTorque * strength);
+ }
}
}
diff --git a/Barotrauma/BarotraumaShared/SharedSource/Items/Components/Holdable/Holdable.cs b/Barotrauma/BarotraumaShared/SharedSource/Items/Components/Holdable/Holdable.cs
index 4bd9ad9ce..b571acff8 100644
--- a/Barotrauma/BarotraumaShared/SharedSource/Items/Components/Holdable/Holdable.cs
+++ b/Barotrauma/BarotraumaShared/SharedSource/Items/Components/Holdable/Holdable.cs
@@ -401,7 +401,7 @@ namespace Barotrauma.Items.Components
//if the item has a connection panel and rewiring is disabled, don't allow deattaching
var connectionPanel = item.GetComponent();
- if (connectionPanel != null && (connectionPanel.Locked || !(GameMain.NetworkMember?.ServerSettings?.AllowRewiring ?? true)))
+ if (connectionPanel != null && !connectionPanel.AlwaysAllowRewiring && (connectionPanel.Locked || !(GameMain.NetworkMember?.ServerSettings?.AllowRewiring ?? true)))
{
return false;
}
@@ -578,7 +578,7 @@ namespace Barotrauma.Items.Components
Vector2 attachPos = userPos + mouseDiff;
- if (user.Submarine == null)
+ if (user.Submarine == null && Level.Loaded != null)
{
bool edgeFound = false;
foreach (var cell in Level.Loaded.GetCells(attachPos))
@@ -606,6 +606,7 @@ namespace Barotrauma.Items.Components
private Voronoi2.VoronoiCell GetAttachTargetCell(float maxDist)
{
+ if (Level.Loaded == null) { return null; }
foreach (var cell in Level.Loaded.GetCells(item.WorldPosition, searchDepth: 1))
{
if (cell.CellType != Voronoi2.CellType.Solid) { continue; }
diff --git a/Barotrauma/BarotraumaShared/SharedSource/Items/Components/Holdable/RepairTool.cs b/Barotrauma/BarotraumaShared/SharedSource/Items/Components/Holdable/RepairTool.cs
index b0e4daf2f..69eee9534 100644
--- a/Barotrauma/BarotraumaShared/SharedSource/Items/Components/Holdable/RepairTool.cs
+++ b/Barotrauma/BarotraumaShared/SharedSource/Items/Components/Holdable/RepairTool.cs
@@ -109,10 +109,11 @@ namespace Barotrauma.Items.Components
{
get
{
+ if (item.body == null) { return BarrelPos; }
Matrix bodyTransform = Matrix.CreateRotationZ(item.body.Rotation + MathHelper.ToRadians(BarrelRotation));
Vector2 flippedPos = BarrelPos;
if (item.body.Dir < 0.0f) { flippedPos.X = -flippedPos.X; }
- return (Vector2.Transform(flippedPos, bodyTransform));
+ return Vector2.Transform(flippedPos, bodyTransform);
}
}
@@ -228,11 +229,15 @@ namespace Barotrauma.Items.Components
}
float spread = MathHelper.ToRadians(MathHelper.Lerp(UnskilledSpread, Spread, degreeOfSuccess));
- float angle = item.body.Rotation + MathHelper.ToRadians(BarrelRotation) + spread * Rand.Range(-0.5f, 0.5f);
- Vector2 rayEnd = rayStartWorld +
- ConvertUnits.ToSimUnits(new Vector2(
- (float)Math.Cos(angle),
- (float)Math.Sin(angle)) * Range * item.body.Dir);
+
+ float angle = MathHelper.ToRadians(BarrelRotation) + spread * Rand.Range(-0.5f, 0.5f);
+ float dir = 1;
+ if (item.body != null)
+ {
+ angle += item.body.Rotation;
+ dir = item.body.Dir;
+ }
+ Vector2 rayEnd = rayStartWorld + ConvertUnits.ToSimUnits(new Vector2((float)Math.Cos(angle), (float)Math.Sin(angle)) * Range * dir);
ignoredBodies.Clear();
if (character != null)
@@ -438,7 +443,7 @@ namespace Barotrauma.Items.Components
}
}
- if (WaterAmount > 0.0f && item.CurrentHull?.Submarine != null)
+ if (WaterAmount > 0.0f && item.Submarine != null)
{
Vector2 pos = ConvertUnits.ToDisplayUnits(rayStart + item.Submarine.SimPosition);
@@ -466,7 +471,7 @@ namespace Barotrauma.Items.Components
#if CLIENT
float barOffset = 10f * GUI.Scale;
Vector2 offset = planter.PlantSlots.ContainsKey(i) ? planter.PlantSlots[i].Offset : Vector2.Zero;
- user.UpdateHUDProgressBar(planter, planter.Item.DrawPosition + new Vector2(barOffset, 0) + offset, seed.Health / seed.MaxHealth, GUI.Style.Blue, GUI.Style.Blue, "progressbar.watering");
+ user?.UpdateHUDProgressBar(planter, planter.Item.DrawPosition + new Vector2(barOffset, 0) + offset, seed.Health / seed.MaxHealth, GUI.Style.Blue, GUI.Style.Blue, "progressbar.watering");
#endif
}
}
diff --git a/Barotrauma/BarotraumaShared/SharedSource/Items/Components/Machines/Pump.cs b/Barotrauma/BarotraumaShared/SharedSource/Items/Components/Machines/Pump.cs
index e7a199447..fda5537bb 100644
--- a/Barotrauma/BarotraumaShared/SharedSource/Items/Components/Machines/Pump.cs
+++ b/Barotrauma/BarotraumaShared/SharedSource/Items/Components/Machines/Pump.cs
@@ -31,20 +31,6 @@ namespace Barotrauma.Items.Components
private float pumpSpeedLockTimer, isActiveLockTimer;
- private bool infected;
-
- [Serialize(false, true, description: "Whether or not the pump is infected with ballast flora spores.")]
- public bool Infected
- {
- get => infected;
- set
- {
- infected = value;
- }
- }
-
- public string InfectIdentifier;
-
[Serialize(0.0f, true, description: "How fast the item is currently pumping water (-100 = full speed out, 100 = full speed in). Intended to be used by StatusEffect conditionals (setting this value in XML has no effect).")]
public float FlowPercentage
{
@@ -122,13 +108,6 @@ namespace Barotrauma.Items.Components
//less effective when in a bad condition
currFlow *= MathHelper.Lerp(0.5f, 1.0f, item.Condition / item.MaxCondition);
-
- if (currFlow < 0 && Infected)
- {
- InfectBallast(InfectIdentifier);
- }
- Infected = false;
-
item.CurrentHull.WaterVolume += currFlow;
if (item.CurrentHull.WaterVolume > item.CurrentHull.Volume) { item.CurrentHull.Pressure += 0.5f; }
}
@@ -143,8 +122,15 @@ namespace Barotrauma.Items.Components
if (hull.BallastFlora != null) { return; }
+ var ballastFloraPrefab = BallastFloraPrefab.Find(identifier);
+ if (ballastFloraPrefab == null)
+ {
+ DebugConsole.ThrowError($"Failed to infect a ballast pump (could not find a ballast flora prefab with the identifier \"{identifier}\").\n" + Environment.StackTrace);
+ return;
+ }
+
Vector2 offset = item.WorldPosition - hull.WorldPosition;
- hull.BallastFlora = new BallastFloraBehavior(hull, BallastFloraPrefab.Find(identifier), offset, firstGrowth: true);
+ hull.BallastFlora = new BallastFloraBehavior(hull, ballastFloraPrefab, offset, firstGrowth: true);
#if SERVER
hull.BallastFlora.SendNetworkMessage(hull.BallastFlora, BallastFloraBehavior.NetworkHeader.Spawn);
diff --git a/Barotrauma/BarotraumaShared/SharedSource/Items/Components/Projectile.cs b/Barotrauma/BarotraumaShared/SharedSource/Items/Components/Projectile.cs
index 27108cd50..d51f61eec 100644
--- a/Barotrauma/BarotraumaShared/SharedSource/Items/Components/Projectile.cs
+++ b/Barotrauma/BarotraumaShared/SharedSource/Items/Components/Projectile.cs
@@ -331,21 +331,21 @@ namespace Barotrauma.Items.Components
IsActive = true;
Vector2 rayStart = simPositon;
- Vector2 rayEnd = simPositon + dir * 1000.0f;
+ Vector2 rayEnd = simPositon + dir * 500.0f;
List hits = new List();
- hits.AddRange(DoRayCast(rayStart, rayEnd));
+ hits.AddRange(DoRayCast(rayStart, rayEnd, submarine: item.Submarine));
if (item.Submarine != null)
{
//shooting indoors, do a hitscan outside as well
- hits.AddRange(DoRayCast(rayStart + item.Submarine.SimPosition, rayEnd + item.Submarine.SimPosition));
+ hits.AddRange(DoRayCast(rayStart + item.Submarine.SimPosition, rayEnd + item.Submarine.SimPosition, submarine: null));
//also in the coordinate space of docked subs
foreach (Submarine dockedSub in item.Submarine.DockedTo)
{
if (dockedSub == item.Submarine) { continue; }
- hits.AddRange(DoRayCast(rayStart + item.Submarine.SimPosition - dockedSub.SimPosition, rayEnd + item.Submarine.SimPosition - dockedSub.SimPosition));
+ hits.AddRange(DoRayCast(rayStart + item.Submarine.SimPosition - dockedSub.SimPosition, rayEnd + item.Submarine.SimPosition - dockedSub.SimPosition, dockedSub));
}
}
else
@@ -353,7 +353,7 @@ namespace Barotrauma.Items.Components
//shooting outdoors, see if we can hit anything inside a sub
foreach (Submarine submarine in Submarine.Loaded)
{
- var inSubHits = DoRayCast(rayStart - submarine.SimPosition, rayEnd - submarine.SimPosition);
+ var inSubHits = DoRayCast(rayStart - submarine.SimPosition, rayEnd - submarine.SimPosition, submarine);
//transform back to world coordinates
for (int i = 0; i < inSubHits.Count; i++)
{
@@ -402,7 +402,7 @@ namespace Barotrauma.Items.Components
}
}
- private List DoRayCast(Vector2 rayStart, Vector2 rayEnd)
+ private List DoRayCast(Vector2 rayStart, Vector2 rayEnd, Submarine submarine)
{
List hits = new List();
@@ -417,14 +417,20 @@ namespace Barotrauma.Items.Components
if (fixture?.Body == null || fixture.IsSensor) { return true; }
if (fixture.Body.UserData is VineTile) { return true; }
if (fixture.Body.UserData is Item item && (item.GetComponent() == null && !item.Prefab.DamagedByProjectiles || item.Condition <= 0)) { return true; }
- if (fixture.Body?.UserData as string == "ruinroom") { return true; }
+ if (fixture.Body.UserData as string == "ruinroom") { return true; }
+
+ //if doing the raycast in a submarine's coordinate space, ignore anything that's not in that sub
+ if (submarine != null)
+ {
+ if (fixture.Body.UserData is Entity entity && entity.Submarine != submarine) { return true; }
+ }
//ignore everything else than characters, sub walls and level walls
if (!fixture.CollisionCategories.HasFlag(Physics.CollisionCharacter) &&
!fixture.CollisionCategories.HasFlag(Physics.CollisionWall) &&
!fixture.CollisionCategories.HasFlag(Physics.CollisionLevel)) { return true; }
- if (fixture.Body.UserData is VoronoiCell && this.item.Submarine != null) { return true; }
+ if (fixture.Body.UserData is VoronoiCell && (this.item.Submarine != null || submarine != null)) { return true; }
fixture.Body.GetTransform(out FarseerPhysics.Common.Transform transform);
if (!fixture.Shape.TestPoint(ref transform, ref rayStart)) { return true; }
@@ -447,7 +453,13 @@ namespace Barotrauma.Items.Components
!fixture.CollisionCategories.HasFlag(Physics.CollisionWall) &&
!fixture.CollisionCategories.HasFlag(Physics.CollisionLevel)) { return -1; }
- //ignore level cells if the item the point of impact are inside a sub
+ //if doing the raycast in a submarine's coordinate space, ignore anything that's not in that sub
+ if (submarine != null)
+ {
+ if (fixture.Body.UserData is Entity entity && entity.Submarine != submarine) { return -1; }
+ }
+
+ //ignore level cells if the item and the point of impact are inside a sub
if (fixture.Body.UserData is VoronoiCell && this.item.Submarine != null)
{
if (Hull.FindHull(ConvertUnits.ToDisplayUnits(point), this.item.CurrentHull) != null)
@@ -805,7 +817,8 @@ namespace Barotrauma.Items.Components
{
MotorEnabled = true,
MaxMotorForce = 30.0f,
- LimitEnabled = true
+ LimitEnabled = true,
+ Breakpoint = 1000.0f
};
if (StickPermanently)
diff --git a/Barotrauma/BarotraumaShared/SharedSource/Items/Components/Signal/ConnectionPanel.cs b/Barotrauma/BarotraumaShared/SharedSource/Items/Components/Signal/ConnectionPanel.cs
index b3d11592a..2dc21d449 100644
--- a/Barotrauma/BarotraumaShared/SharedSource/Items/Components/Signal/ConnectionPanel.cs
+++ b/Barotrauma/BarotraumaShared/SharedSource/Items/Components/Signal/ConnectionPanel.cs
@@ -21,6 +21,14 @@ namespace Barotrauma.Items.Components
private List disconnectedWireIds;
+ ///
+ /// Allows rewiring the connection panel despite rewiring being disabled on a server
+ ///
+ public bool AlwaysAllowRewiring
+ {
+ get { return item.Submarine?.Info.Type == SubmarineType.BeaconStation; }
+ }
+
[Editable, Serialize(false, true, description: "Locked connection panels cannot be rewired in-game.", alwaysUseInstanceValues: true)]
public bool Locked
{
diff --git a/Barotrauma/BarotraumaShared/SharedSource/Map/Creatures/State/GrowToTargetState.cs b/Barotrauma/BarotraumaShared/SharedSource/Map/Creatures/State/GrowToTargetState.cs
index 251ad8abb..4d30f0f94 100644
--- a/Barotrauma/BarotraumaShared/SharedSource/Map/Creatures/State/GrowToTargetState.cs
+++ b/Barotrauma/BarotraumaShared/SharedSource/Map/Creatures/State/GrowToTargetState.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.Linq;
using Barotrauma.Items.Components;
using Microsoft.Xna.Framework;
@@ -25,6 +26,17 @@ namespace Barotrauma.MapCreatures.Behavior
protected override void Grow()
{
+ if (TargetBranches.Any(b => b.Removed))
+ {
+ if (!Behavior.IgnoredTargets.ContainsKey(Target))
+ {
+ Behavior.IgnoredTargets.Add(Target, 10);
+ }
+
+ isFinished = true;
+ return;
+ }
+
if (Target == null || Target.Removed)
{
isFinished = true;
diff --git a/Barotrauma/BarotraumaShared/SharedSource/Map/Submarine.cs b/Barotrauma/BarotraumaShared/SharedSource/Map/Submarine.cs
index 9f4601332..71dd3e156 100644
--- a/Barotrauma/BarotraumaShared/SharedSource/Map/Submarine.cs
+++ b/Barotrauma/BarotraumaShared/SharedSource/Map/Submarine.cs
@@ -304,7 +304,6 @@ namespace Barotrauma
{
if ((!anyHasTag || item.HasTag("ballast")) && item.GetComponent() is { } pump)
{
- if (pump.Infected) { continue; }
pumps.Add(pump);
}
}
@@ -312,11 +311,13 @@ namespace Barotrauma
if (!pumps.Any()) { return; }
Pump randomPump = pumps.GetRandom(Rand.RandSync.Unsynced);
- randomPump.Infected = true;
- randomPump.InfectIdentifier = identifier;
+ if (randomPump.IsOn && randomPump.HasPower && randomPump.FlowPercentage > 0 && randomPump.Item.Condition > 0.0f)
+ {
+ randomPump.InfectBallast(identifier);
#if SERVER
- randomPump.Item.CreateServerEvent(randomPump);
+ randomPump.Item.CreateServerEvent(randomPump);
#endif
+ }
}
public void MakeWreck()
@@ -1277,11 +1278,7 @@ namespace Barotrauma
HiddenSubPosition += Vector2.UnitY * (sub.Borders.Height + 5000.0f);
}
- IdOffset = 0;
- foreach (MapEntity me in MapEntity.mapEntityList)
- {
- IdOffset = Math.Max(IdOffset, me.ID);
- }
+ IdOffset = IdRemap.DetermineNewOffset();
List newEntities = new List();
if (loadEntities == null)
diff --git a/Barotrauma/BarotraumaShared/SharedSource/Utils/IdRemap.cs b/Barotrauma/BarotraumaShared/SharedSource/Utils/IdRemap.cs
index b1c8ab169..53919c70a 100644
--- a/Barotrauma/BarotraumaShared/SharedSource/Utils/IdRemap.cs
+++ b/Barotrauma/BarotraumaShared/SharedSource/Utils/IdRemap.cs
@@ -1,4 +1,5 @@
using Microsoft.Xna.Framework;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Xml.Linq;
@@ -99,5 +100,16 @@ namespace Barotrauma
}
return 0;
}
+
+ public static ushort DetermineNewOffset()
+ {
+ ushort idOffset = 0;
+ foreach (Entity e in Entity.GetEntities())
+ {
+ if (e.ID > Entity.ReservedIDStart || e is Submarine) { continue; }
+ idOffset = Math.Max(idOffset, e.ID);
+ }
+ return idOffset;
+ }
}
}
\ No newline at end of file
diff --git a/Barotrauma/BarotraumaShared/changelog.txt b/Barotrauma/BarotraumaShared/changelog.txt
index a3e6d57c1..ffc6ffd72 100644
--- a/Barotrauma/BarotraumaShared/changelog.txt
+++ b/Barotrauma/BarotraumaShared/changelog.txt
@@ -1,3 +1,19 @@
+---------------------------------------------------------------------------------------------------------
+v0.11.0.10
+---------------------------------------------------------------------------------------------------------
+
+- Fixed monster missions causing a disconnect in multiplayer mission mode.
+- Fixed bots getting removed from the crew when starting a multiplayer campaign, returning to the lobby during the first round and then reloading the campaign.
+- Fixed crashing when entering a new level in the campaign when an inactive pump has been infected with ballast flora.
+- Fixed ballast flora branches respawning instantly if they're destroyed while they're growing towards a target.
+- Fixed crashing when attempting to place components outside of the submarine in test mode.
+- Fixed inability to rewire beacon stations when rewiring is disabled on the server.
+- Fixed repair tools that aren't held causing a crash upon use (only affects modded items).
+- Fixed raycast weapons (revolvers, shotguns, SMGs) sometimes not hitting monsters in specific areas outside the sub.
+- Fixed submarine's price field being difficult to edit in the sub editor due to the value getting clamped above the minimum price while typing in the box.
+- Potential fix to certain projectiles (e.g. harpoons, spineling's spikes) sometimes causing erratic physics behavior and errors (ragdolls going crazy, submarine getting launched off at a high velocity...) when they stick to the submarine or to characters.
+- Fixed occasional crashes when swapping to another character's ID card with a mask or diving suit on.
+
---------------------------------------------------------------------------------------------------------
v0.11.0.9
---------------------------------------------------------------------------------------------------------