Merge remote-tracking branch 'refs/remotes/origin/dev'
# Conflicts: # Barotrauma/BarotraumaClient/LinuxClient.csproj # Barotrauma/BarotraumaClient/MacClient.csproj # Barotrauma/BarotraumaClient/WindowsClient.csproj # Barotrauma/BarotraumaServer/LinuxServer.csproj # Barotrauma/BarotraumaServer/MacServer.csproj # Barotrauma/BarotraumaServer/WindowsServer.csproj # Barotrauma/BarotraumaShared/changelog.txt
This commit is contained in:
@@ -806,12 +806,18 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
if (order.Identifier == Tags.DeconstructThis)
|
if (order.Identifier == Tags.DeconstructThis)
|
||||||
{
|
{
|
||||||
Item.DeconstructItems.Add(item);
|
foreach (var stackedItem in item.GetStackedItems())
|
||||||
|
{
|
||||||
|
Item.DeconstructItems.Add(stackedItem);
|
||||||
|
}
|
||||||
HintManager.OnItemMarkedForDeconstruction(order.OrderGiver);
|
HintManager.OnItemMarkedForDeconstruction(order.OrderGiver);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Item.DeconstructItems.Remove(item);
|
foreach (var stackedItem in item.GetStackedItems())
|
||||||
|
{
|
||||||
|
Item.DeconstructItems.Remove(stackedItem);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -820,8 +826,19 @@ namespace Barotrauma
|
|||||||
WallSection ws = null;
|
WallSection ws = null;
|
||||||
if (order.TargetType == Order.OrderTargetType.Entity && order.TargetEntity is IIgnorable ignorable)
|
if (order.TargetType == Order.OrderTargetType.Entity && order.TargetEntity is IIgnorable ignorable)
|
||||||
{
|
{
|
||||||
ignorable.OrderedToBeIgnored = order.Identifier == Tags.IgnoreThis;
|
if (ignorable is Item item)
|
||||||
AddOrder(order.Clone(), null);
|
{
|
||||||
|
foreach (var stackedItem in item.GetStackedItems())
|
||||||
|
{
|
||||||
|
stackedItem.OrderedToBeIgnored = order.Identifier == Tags.IgnoreThis;
|
||||||
|
AddOrder(order.Clone().WithTargetEntity(stackedItem), fadeOutTime: null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ignorable.OrderedToBeIgnored = order.Identifier == Tags.IgnoreThis;
|
||||||
|
AddOrder(order.Clone(), fadeOutTime: null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (order.TargetType == Order.OrderTargetType.WallSection && order.TargetEntity is Structure s)
|
else if (order.TargetType == Order.OrderTargetType.WallSection && order.TargetEntity is Structure s)
|
||||||
{
|
{
|
||||||
@@ -830,7 +847,7 @@ namespace Barotrauma
|
|||||||
if (ws != null)
|
if (ws != null)
|
||||||
{
|
{
|
||||||
ws.OrderedToBeIgnored = order.Identifier == Tags.IgnoreThis;
|
ws.OrderedToBeIgnored = order.Identifier == Tags.IgnoreThis;
|
||||||
AddOrder(order.WithWallSection(s, wallSectionIndex), null);
|
AddOrder(order.WithWallSection(s, wallSectionIndex), fadeOutTime: null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -841,9 +858,9 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
hull = Hull.FindHull(ws.WorldPosition);
|
hull = Hull.FindHull(ws.WorldPosition);
|
||||||
}
|
}
|
||||||
else if (order.TargetEntity is Item i)
|
else if (order.TargetEntity is Item item)
|
||||||
{
|
{
|
||||||
hull = i.CurrentHull;
|
hull = item.CurrentHull;
|
||||||
}
|
}
|
||||||
else if (order.TargetEntity is ISpatialEntity se)
|
else if (order.TargetEntity is ISpatialEntity se)
|
||||||
{
|
{
|
||||||
@@ -1238,7 +1255,7 @@ namespace Barotrauma
|
|||||||
if (GUI.DisableHUD) { return; }
|
if (GUI.DisableHUD) { return; }
|
||||||
if (CoroutineManager.IsCoroutineRunning("LevelTransition") || CoroutineManager.IsCoroutineRunning("SubmarineTransition")) { return; }
|
if (CoroutineManager.IsCoroutineRunning("LevelTransition") || CoroutineManager.IsCoroutineRunning("SubmarineTransition")) { return; }
|
||||||
|
|
||||||
commandFrame?.AddToGUIUpdateList();
|
commandFrame?.AddToGUIUpdateList(order: 1);
|
||||||
|
|
||||||
if (GUI.DisableUpperHUD) { return; }
|
if (GUI.DisableUpperHUD) { return; }
|
||||||
|
|
||||||
@@ -1977,8 +1994,6 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
if (commandFrame != null) { DisableCommandUI(); }
|
if (commandFrame != null) { DisableCommandUI(); }
|
||||||
|
|
||||||
CharacterHealth.OpenHealthWindow = null;
|
|
||||||
|
|
||||||
// Character context works differently to others as we still use the "basic" command interface,
|
// Character context works differently to others as we still use the "basic" command interface,
|
||||||
// but the order will be automatically assigned to this character
|
// but the order will be automatically assigned to this character
|
||||||
isContextual = forceContextual;
|
isContextual = forceContextual;
|
||||||
|
|||||||
@@ -720,9 +720,16 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (errorMsgs.Any())
|
if (errorMsgs.Any())
|
||||||
{
|
{
|
||||||
GUIMessageBox msgBox = new GUIMessageBox(TextManager.Get("Warning"), string.Join("\n\n", errorMsgs), new Vector2(0.25f, 0.0f), new Point(400, 200));
|
GUIMessageBox msgBox = new GUIMessageBox(TextManager.Get("Warning"), string.Empty, new Vector2(0.25f, 0.0f), minSize: new Point(GUI.IntScale(650), GUI.IntScale(650)));
|
||||||
if (warnings.Any())
|
if (warnings.Any())
|
||||||
{
|
{
|
||||||
|
var textListBox = new GUIListBox(new RectTransform(new Vector2(1.0f, 0.75f), msgBox.Content.RectTransform));
|
||||||
|
var text = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), textListBox.Content.RectTransform), string.Join("\n\n", errorMsgs), wrap: true)
|
||||||
|
{
|
||||||
|
CanBeFocused = false
|
||||||
|
};
|
||||||
|
text.RectTransform.MinSize = new Point(0, (int)text.TextSize.Y);
|
||||||
|
|
||||||
Point size = msgBox.RectTransform.NonScaledSize;
|
Point size = msgBox.RectTransform.NonScaledSize;
|
||||||
GUITickBox suppress = new GUITickBox(new RectTransform(new Vector2(1f, 0.33f), msgBox.Content.RectTransform), TextManager.Get("editor.suppresswarnings"));
|
GUITickBox suppress = new GUITickBox(new RectTransform(new Vector2(1f, 0.33f), msgBox.Content.RectTransform), TextManager.Get("editor.suppresswarnings"));
|
||||||
msgBox.RectTransform.NonScaledSize = new Point(size.X, size.Y + suppress.RectTransform.NonScaledSize.Y);
|
msgBox.RectTransform.NonScaledSize = new Point(size.X, size.Y + suppress.RectTransform.NonScaledSize.Y);
|
||||||
@@ -736,7 +743,6 @@ namespace Barotrauma
|
|||||||
SubEditorScreen.SuppressedWarnings.Add(warning);
|
SubEditorScreen.SuppressedWarnings.Add(warning);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1815,6 +1815,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public void StoreServerFilters()
|
public void StoreServerFilters()
|
||||||
{
|
{
|
||||||
|
if (loadingServerFilters) { return; }
|
||||||
foreach (KeyValuePair<Identifier, GUITickBox> filterBox in filterTickBoxes)
|
foreach (KeyValuePair<Identifier, GUITickBox> filterBox in filterTickBoxes)
|
||||||
{
|
{
|
||||||
ServerListFilters.Instance.SetAttribute(filterBox.Key, filterBox.Value.Selected.ToString());
|
ServerListFilters.Instance.SetAttribute(filterBox.Key, filterBox.Value.Selected.ToString());
|
||||||
@@ -1826,8 +1827,10 @@ namespace Barotrauma
|
|||||||
GameSettings.SaveCurrentConfig();
|
GameSettings.SaveCurrentConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool loadingServerFilters;
|
||||||
public void LoadServerFilters()
|
public void LoadServerFilters()
|
||||||
{
|
{
|
||||||
|
loadingServerFilters = true;
|
||||||
XDocument currentConfigDoc = XMLExtensions.TryLoadXml(GameSettings.PlayerConfigPath);
|
XDocument currentConfigDoc = XMLExtensions.TryLoadXml(GameSettings.PlayerConfigPath);
|
||||||
ServerListFilters.Init(currentConfigDoc.Root.GetChildElement("serverfilters"));
|
ServerListFilters.Init(currentConfigDoc.Root.GetChildElement("serverfilters"));
|
||||||
foreach (KeyValuePair<Identifier, GUITickBox> filterBox in filterTickBoxes)
|
foreach (KeyValuePair<Identifier, GUITickBox> filterBox in filterTickBoxes)
|
||||||
@@ -1845,6 +1848,7 @@ namespace Barotrauma
|
|||||||
var child = ternaryFilter.Value.ListBox.Content.GetChildByUserData(ternaryOption);
|
var child = ternaryFilter.Value.ListBox.Content.GetChildByUserData(ternaryOption);
|
||||||
ternaryFilter.Value.Select(ternaryFilter.Value.ListBox.Content.GetChildIndex(child));
|
ternaryFilter.Value.Select(ternaryFilter.Value.ListBox.Content.GetChildIndex(child));
|
||||||
}
|
}
|
||||||
|
loadingServerFilters = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -868,12 +868,8 @@ namespace Barotrauma
|
|||||||
string prefabTags = GetPrefabTags(it);
|
string prefabTags = GetPrefabTags(it);
|
||||||
if (string.IsNullOrEmpty(text) || string.IsNullOrEmpty(prefabTags)) { return text; }
|
if (string.IsNullOrEmpty(text) || string.IsNullOrEmpty(prefabTags)) { return text; }
|
||||||
|
|
||||||
text = text.Remove(prefabTags);
|
string[] splitTags = text.Split(',');
|
||||||
if (text.StartsWith(","))
|
return string.Join(',', splitTags.Where(t => !it.Prefab.Tags.Contains(t)));
|
||||||
{
|
|
||||||
text = text.Remove(0, 1);
|
|
||||||
}
|
|
||||||
return text;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static string GetPrefabTags(Item it) => string.Join(',', it.Prefab.Tags);
|
static string GetPrefabTags(Item it) => string.Join(',', it.Prefab.Tags);
|
||||||
|
|||||||
@@ -444,6 +444,7 @@ namespace Barotrauma
|
|||||||
var modifiedLine = line;
|
var modifiedLine = line;
|
||||||
while (font.MeasureString($"{modifiedLine}...").X > lineX)
|
while (font.MeasureString($"{modifiedLine}...").X > lineX)
|
||||||
{
|
{
|
||||||
|
if (modifiedLine.Length == 0) { break; }
|
||||||
modifiedLine = modifiedLine[..^1];
|
modifiedLine = modifiedLine[..^1];
|
||||||
}
|
}
|
||||||
sb.AppendLine($"{modifiedLine}...");
|
sb.AppendLine($"{modifiedLine}...");
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<RootNamespace>Barotrauma</RootNamespace>
|
<RootNamespace>Barotrauma</RootNamespace>
|
||||||
<Authors>FakeFish, Undertow Games</Authors>
|
<Authors>FakeFish, Undertow Games</Authors>
|
||||||
<Product>Barotrauma</Product>
|
<Product>Barotrauma</Product>
|
||||||
<Version>1.4.5.0</Version>
|
<Version>1.4.6.0</Version>
|
||||||
<Copyright>Copyright © FakeFish 2018-2023</Copyright>
|
<Copyright>Copyright © FakeFish 2018-2023</Copyright>
|
||||||
<Platforms>AnyCPU;x64</Platforms>
|
<Platforms>AnyCPU;x64</Platforms>
|
||||||
<AssemblyName>Barotrauma</AssemblyName>
|
<AssemblyName>Barotrauma</AssemblyName>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<RootNamespace>Barotrauma</RootNamespace>
|
<RootNamespace>Barotrauma</RootNamespace>
|
||||||
<Authors>FakeFish, Undertow Games</Authors>
|
<Authors>FakeFish, Undertow Games</Authors>
|
||||||
<Product>Barotrauma</Product>
|
<Product>Barotrauma</Product>
|
||||||
<Version>1.4.5.0</Version>
|
<Version>1.4.6.0</Version>
|
||||||
<Copyright>Copyright © FakeFish 2018-2023</Copyright>
|
<Copyright>Copyright © FakeFish 2018-2023</Copyright>
|
||||||
<Platforms>AnyCPU;x64</Platforms>
|
<Platforms>AnyCPU;x64</Platforms>
|
||||||
<AssemblyName>Barotrauma</AssemblyName>
|
<AssemblyName>Barotrauma</AssemblyName>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<RootNamespace>Barotrauma</RootNamespace>
|
<RootNamespace>Barotrauma</RootNamespace>
|
||||||
<Authors>FakeFish, Undertow Games</Authors>
|
<Authors>FakeFish, Undertow Games</Authors>
|
||||||
<Product>Barotrauma</Product>
|
<Product>Barotrauma</Product>
|
||||||
<Version>1.4.5.0</Version>
|
<Version>1.4.6.0</Version>
|
||||||
<Copyright>Copyright © FakeFish 2018-2023</Copyright>
|
<Copyright>Copyright © FakeFish 2018-2023</Copyright>
|
||||||
<Platforms>AnyCPU;x64</Platforms>
|
<Platforms>AnyCPU;x64</Platforms>
|
||||||
<AssemblyName>Barotrauma</AssemblyName>
|
<AssemblyName>Barotrauma</AssemblyName>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<RootNamespace>Barotrauma</RootNamespace>
|
<RootNamespace>Barotrauma</RootNamespace>
|
||||||
<Authors>FakeFish, Undertow Games</Authors>
|
<Authors>FakeFish, Undertow Games</Authors>
|
||||||
<Product>Barotrauma Dedicated Server</Product>
|
<Product>Barotrauma Dedicated Server</Product>
|
||||||
<Version>1.4.5.0</Version>
|
<Version>1.4.6.0</Version>
|
||||||
<Copyright>Copyright © FakeFish 2018-2023</Copyright>
|
<Copyright>Copyright © FakeFish 2018-2023</Copyright>
|
||||||
<Platforms>AnyCPU;x64</Platforms>
|
<Platforms>AnyCPU;x64</Platforms>
|
||||||
<AssemblyName>DedicatedServer</AssemblyName>
|
<AssemblyName>DedicatedServer</AssemblyName>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<RootNamespace>Barotrauma</RootNamespace>
|
<RootNamespace>Barotrauma</RootNamespace>
|
||||||
<Authors>FakeFish, Undertow Games</Authors>
|
<Authors>FakeFish, Undertow Games</Authors>
|
||||||
<Product>Barotrauma Dedicated Server</Product>
|
<Product>Barotrauma Dedicated Server</Product>
|
||||||
<Version>1.4.5.0</Version>
|
<Version>1.4.6.0</Version>
|
||||||
<Copyright>Copyright © FakeFish 2018-2023</Copyright>
|
<Copyright>Copyright © FakeFish 2018-2023</Copyright>
|
||||||
<Platforms>AnyCPU;x64</Platforms>
|
<Platforms>AnyCPU;x64</Platforms>
|
||||||
<AssemblyName>DedicatedServer</AssemblyName>
|
<AssemblyName>DedicatedServer</AssemblyName>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<RootNamespace>Barotrauma</RootNamespace>
|
<RootNamespace>Barotrauma</RootNamespace>
|
||||||
<Authors>FakeFish, Undertow Games</Authors>
|
<Authors>FakeFish, Undertow Games</Authors>
|
||||||
<Product>Barotrauma Dedicated Server</Product>
|
<Product>Barotrauma Dedicated Server</Product>
|
||||||
<Version>1.4.5.0</Version>
|
<Version>1.4.6.0</Version>
|
||||||
<Copyright>Copyright © FakeFish 2018-2023</Copyright>
|
<Copyright>Copyright © FakeFish 2018-2023</Copyright>
|
||||||
<Platforms>AnyCPU;x64</Platforms>
|
<Platforms>AnyCPU;x64</Platforms>
|
||||||
<AssemblyName>DedicatedServer</AssemblyName>
|
<AssemblyName>DedicatedServer</AssemblyName>
|
||||||
|
|||||||
@@ -272,6 +272,7 @@ namespace Barotrauma
|
|||||||
CumulativeMonsterStrengthRuins = 0;
|
CumulativeMonsterStrengthRuins = 0;
|
||||||
CumulativeMonsterStrengthWrecks = 0;
|
CumulativeMonsterStrengthWrecks = 0;
|
||||||
CumulativeMonsterStrengthCaves = 0;
|
CumulativeMonsterStrengthCaves = 0;
|
||||||
|
distanceTraveled = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ActivateEvent(Event newEvent)
|
public void ActivateEvent(Event newEvent)
|
||||||
@@ -726,14 +727,12 @@ namespace Barotrauma
|
|||||||
|
|
||||||
private bool CanStartEventSet(EventSet eventSet)
|
private bool CanStartEventSet(EventSet eventSet)
|
||||||
{
|
{
|
||||||
ISpatialEntity refEntity = GetRefEntity();
|
|
||||||
float distFromStart = (float)Math.Sqrt(MathUtils.LineSegmentToPointDistanceSquared(level.StartExitPosition.ToPoint(), level.StartPosition.ToPoint(), refEntity.WorldPosition.ToPoint()));
|
|
||||||
float distFromEnd = (float)Math.Sqrt(MathUtils.LineSegmentToPointDistanceSquared(level.EndExitPosition.ToPoint(), level.EndPosition.ToPoint(), refEntity.WorldPosition.ToPoint()));
|
|
||||||
|
|
||||||
if (!eventSet.AllowAtStart)
|
if (!eventSet.AllowAtStart)
|
||||||
{
|
{
|
||||||
if (distFromStart * Physics.DisplayToRealWorldRatio < 50.0f ||
|
ISpatialEntity refEntity = GetRefEntity();
|
||||||
distFromEnd * Physics.DisplayToRealWorldRatio < 50.0f)
|
float distFromStart = (float)Math.Sqrt(MathUtils.LineSegmentToPointDistanceSquared(level.StartExitPosition.ToPoint(), level.StartPosition.ToPoint(), refEntity.WorldPosition.ToPoint()));
|
||||||
|
float distFromEnd = (float)Math.Sqrt(MathUtils.LineSegmentToPointDistanceSquared(level.EndExitPosition.ToPoint(), level.EndPosition.ToPoint(), refEntity.WorldPosition.ToPoint()));
|
||||||
|
if (distFromStart * Physics.DisplayToRealWorldRatio < 50.0f || distFromEnd * Physics.DisplayToRealWorldRatio < 50.0f)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -182,7 +182,6 @@ namespace Barotrauma.Items.Components
|
|||||||
if (source == null || target == null || target.Removed ||
|
if (source == null || target == null || target.Removed ||
|
||||||
source is Entity { Removed: true } ||
|
source is Entity { Removed: true } ||
|
||||||
source is Limb { Removed: true } ||
|
source is Limb { Removed: true } ||
|
||||||
user is null ||
|
|
||||||
user is { Removed: true })
|
user is { Removed: true })
|
||||||
{
|
{
|
||||||
ResetSource();
|
ResetSource();
|
||||||
@@ -312,82 +311,87 @@ namespace Barotrauma.Items.Components
|
|||||||
{
|
{
|
||||||
targetMass = float.MaxValue;
|
targetMass = float.MaxValue;
|
||||||
}
|
}
|
||||||
if (!snapped)
|
// Currently can only apply pull forces to the source, when it's a character, not e.g. when the item would be auto-operated by an AI. Might have to change this.
|
||||||
|
if (user != null)
|
||||||
{
|
{
|
||||||
user.AnimController.HoldToRope();
|
if (!snapped)
|
||||||
if (targetCharacter != null)
|
|
||||||
{
|
{
|
||||||
targetCharacter.AnimController.DragWithRope();
|
user.AnimController.HoldToRope();
|
||||||
}
|
if (targetCharacter != null)
|
||||||
if (user.InWater)
|
|
||||||
{
|
|
||||||
user.AnimController.HangWithRope();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (Math.Abs(SourcePullForce) > 0.001f && targetMass > TargetMinMass)
|
|
||||||
{
|
|
||||||
// This should be the main collider.
|
|
||||||
var sourceBody = GetBodyToPull(source);
|
|
||||||
if (sourceBody != null)
|
|
||||||
{
|
|
||||||
isReelingIn = user.InWater && user.IsRagdolled || !user.InWater && targetCharacter is { IsIncapacitated: false };
|
|
||||||
if (isReelingIn)
|
|
||||||
{
|
{
|
||||||
float pullForce = SourcePullForce;
|
targetCharacter.AnimController.DragWithRope();
|
||||||
if (!user.InWater)
|
}
|
||||||
|
if (user.InWater)
|
||||||
|
{
|
||||||
|
user.AnimController.HangWithRope();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (Math.Abs(SourcePullForce) > 0.001f && targetMass > TargetMinMass)
|
||||||
|
{
|
||||||
|
// This should be the main collider.
|
||||||
|
var sourceBody = GetBodyToPull(source);
|
||||||
|
if (sourceBody != null)
|
||||||
|
{
|
||||||
|
isReelingIn = user.InWater && user.IsRagdolled || !user.InWater && targetCharacter is { IsIncapacitated: false };
|
||||||
|
if (isReelingIn)
|
||||||
{
|
{
|
||||||
// Apply a tiny amount to the character holding the rope, so that the connection "feels" more real.
|
float pullForce = SourcePullForce;
|
||||||
pullForce *= 0.1f;
|
if (!user.InWater)
|
||||||
}
|
|
||||||
float lengthFactor = MathUtils.InverseLerp(0, MaxLength / 2, currentRopeLength);
|
|
||||||
float force = LerpForces ? MathHelper.Lerp(0, pullForce, lengthFactor) : pullForce;
|
|
||||||
sourceBody.ApplyForce(forceDir * force);
|
|
||||||
// Take the target velocity into account.
|
|
||||||
PhysicsBody targetBody = GetBodyToPull(target);
|
|
||||||
if (targetBody != null)
|
|
||||||
{
|
|
||||||
if (targetCharacter != null)
|
|
||||||
{
|
{
|
||||||
if (targetBody.LinearVelocity != Vector2.Zero && sourceBody.LinearVelocity != Vector2.Zero)
|
// Apply a tiny amount to the character holding the rope, so that the connection "feels" more real.
|
||||||
|
pullForce *= 0.1f;
|
||||||
|
}
|
||||||
|
float lengthFactor = MathUtils.InverseLerp(0, MaxLength / 2, currentRopeLength);
|
||||||
|
float force = LerpForces ? MathHelper.Lerp(0, pullForce, lengthFactor) : pullForce;
|
||||||
|
sourceBody.ApplyForce(forceDir * force);
|
||||||
|
// Take the target velocity into account.
|
||||||
|
PhysicsBody targetBody = GetBodyToPull(target);
|
||||||
|
if (targetBody != null)
|
||||||
|
{
|
||||||
|
if (targetCharacter != null)
|
||||||
{
|
{
|
||||||
Vector2 targetDir = Vector2.Normalize(targetBody.LinearVelocity);
|
if (targetBody.LinearVelocity != Vector2.Zero && sourceBody.LinearVelocity != Vector2.Zero)
|
||||||
float movementDot = Vector2.Dot(Vector2.Normalize(sourceBody.LinearVelocity), targetDir);
|
|
||||||
if (movementDot < 0)
|
|
||||||
{
|
{
|
||||||
// Pushing to a different dir -> add some counter force
|
Vector2 targetDir = Vector2.Normalize(targetBody.LinearVelocity);
|
||||||
const float multiplier = 5;
|
float movementDot = Vector2.Dot(Vector2.Normalize(sourceBody.LinearVelocity), targetDir);
|
||||||
float inverseLengthFactor = MathHelper.Lerp(1, 0, lengthFactor);
|
if (movementDot < 0)
|
||||||
sourceBody.ApplyForce(targetBody.LinearVelocity * Math.Min(targetBody.Mass * multiplier, 250) * sourceBody.Mass * -movementDot * inverseLengthFactor);
|
{
|
||||||
}
|
// Pushing to a different dir -> add some counter force
|
||||||
float forceDot = Vector2.Dot(forceDir, targetDir);
|
const float multiplier = 5;
|
||||||
if (forceDot > 0)
|
float inverseLengthFactor = MathHelper.Lerp(1, 0, lengthFactor);
|
||||||
{
|
sourceBody.ApplyForce(targetBody.LinearVelocity * Math.Min(targetBody.Mass * multiplier, 250) * sourceBody.Mass * -movementDot * inverseLengthFactor);
|
||||||
// Pulling to the same dir -> add extra force
|
}
|
||||||
float targetSpeed = targetBody.LinearVelocity.Length();
|
float forceDot = Vector2.Dot(forceDir, targetDir);
|
||||||
const float multiplier = 25;
|
if (forceDot > 0)
|
||||||
sourceBody.ApplyForce(forceDir * targetSpeed * sourceBody.Mass * multiplier * forceDot * lengthFactor);
|
{
|
||||||
}
|
// Pulling to the same dir -> add extra force
|
||||||
float colliderMainLimbDistance = Vector2.Distance(sourceBody.SimPosition, user.AnimController.MainLimb.SimPosition);
|
float targetSpeed = targetBody.LinearVelocity.Length();
|
||||||
const float minDist = 1;
|
const float multiplier = 25;
|
||||||
const float maxDist = 10;
|
sourceBody.ApplyForce(forceDir * targetSpeed * sourceBody.Mass * multiplier * forceDot * lengthFactor);
|
||||||
if (colliderMainLimbDistance > minDist)
|
}
|
||||||
{
|
float colliderMainLimbDistance = Vector2.Distance(sourceBody.SimPosition, user.AnimController.MainLimb.SimPosition);
|
||||||
// Move the ragdoll closer to the collider, if it's too far (the correction force in HumanAnimController is not enough -> the ragdoll would lag behind and get teleported).
|
const float minDist = 1;
|
||||||
float correctionForce = MathHelper.Lerp(10.0f, NetConfig.MaxPhysicsBodyVelocity, MathUtils.InverseLerp(minDist, maxDist, colliderMainLimbDistance));
|
const float maxDist = 10;
|
||||||
Vector2 targetPos = sourceBody.SimPosition + new Vector2((float)Math.Sin(-sourceBody.Rotation), (float)Math.Cos(-sourceBody.Rotation)) * 0.4f;
|
if (colliderMainLimbDistance > minDist)
|
||||||
user.AnimController.MainLimb.MoveToPos(targetPos, correctionForce);
|
{
|
||||||
|
// Move the ragdoll closer to the collider, if it's too far (the correction force in HumanAnimController is not enough -> the ragdoll would lag behind and get teleported).
|
||||||
|
float correctionForce = MathHelper.Lerp(10.0f, NetConfig.MaxPhysicsBodyVelocity, MathUtils.InverseLerp(minDist, maxDist, colliderMainLimbDistance));
|
||||||
|
Vector2 targetPos = sourceBody.SimPosition + new Vector2((float)Math.Sin(-sourceBody.Rotation), (float)Math.Cos(-sourceBody.Rotation)) * 0.4f;
|
||||||
|
user.AnimController.MainLimb.MoveToPos(targetPos, correctionForce);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
else
|
{
|
||||||
{
|
sourceBody.ApplyForce(targetBody.LinearVelocity * sourceBody.Mass);
|
||||||
sourceBody.ApplyForce(targetBody.LinearVelocity * sourceBody.Mass);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Math.Abs(TargetPullForce) > 0.001f && !user.IsRagdolled)
|
|
||||||
|
if (Math.Abs(TargetPullForce) > 0.001f && user is not { IsRagdolled: true})
|
||||||
{
|
{
|
||||||
PhysicsBody targetBody = GetBodyToPull(target);
|
PhysicsBody targetBody = GetBodyToPull(target);
|
||||||
if (targetBody == null) { return; }
|
if (targetBody == null) { return; }
|
||||||
|
|||||||
@@ -3452,6 +3452,30 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns this item and all the other items in the stack (either in the same inventory slot, or the same dropped stack).
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public IEnumerable<Item> GetStackedItems()
|
||||||
|
{
|
||||||
|
yield return this;
|
||||||
|
foreach (var stackedItem in DroppedStack)
|
||||||
|
{
|
||||||
|
if (stackedItem == this) { continue; }
|
||||||
|
yield return stackedItem;
|
||||||
|
}
|
||||||
|
if (ParentInventory != null)
|
||||||
|
{
|
||||||
|
int slotIndex = ParentInventory.FindIndex(this);
|
||||||
|
foreach (var stackedItem in ParentInventory.GetItemsAt(slotIndex))
|
||||||
|
{
|
||||||
|
if (stackedItem == this) { continue; }
|
||||||
|
yield return stackedItem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void Equip(Character character)
|
public void Equip(Character character)
|
||||||
{
|
{
|
||||||
if (Removed)
|
if (Removed)
|
||||||
|
|||||||
@@ -1,4 +1,20 @@
|
|||||||
-------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
v1.4.6.0
|
||||||
|
-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
- Fixed monsters sometimes spawning immediately after the round starts (Often happened between levels, when there was no outpost between them).
|
||||||
|
- The 'Art of Submarine Warfare' book granted by the 'War Stories' talent is now a separate item and the original book has been reverted to its original state.
|
||||||
|
- Fixed Thalamus' fleshgun ropes not being able to stick to a submarine anymore.
|
||||||
|
- Fixed Thalamus' flesh spike crashing the game in the multiplayer game mode.
|
||||||
|
- Added a scrollbar to the submarine warning list. Fixes the list not fitting on the screen, when there were multiple, long errors.
|
||||||
|
- Fixed sever list filters not saving properly.
|
||||||
|
- Fixed marking a stack of items to be ignored or deconstructed only taking into account the first item of the stack, instead applying to all items of the stack.
|
||||||
|
- Removed duplicate localization lines that caused old versions of text to show up in some places.
|
||||||
|
- Fixes to the Chinese localization.
|
||||||
|
- Fixed the inability to edit tags that contained the same word as one of the predefined tags.
|
||||||
|
- Fixed a crash on opening the contextual order menu for an item of another character's inventory while the health interface is open.
|
||||||
|
- Fixed a crash when editing and resizing the circuit box label texts.
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
v1.4.5.0
|
v1.4.5.0
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
@@ -194,8 +194,8 @@ public static class SteamPipeAssistant
|
|||||||
new SingleItem("contentroot", Path.GetFullPath(Deployables.ResultPath)),
|
new SingleItem("contentroot", Path.GetFullPath(Deployables.ResultPath)),
|
||||||
new SingleItem("setlive", appId switch
|
new SingleItem("setlive", appId switch
|
||||||
{
|
{
|
||||||
ClientAppId => "refactor_our_souls",
|
ClientAppId => "experimental",
|
||||||
ServerAppId => "refactor_our_souls",
|
ServerAppId => "development",
|
||||||
_ => throw new InvalidOperationException()
|
_ => throw new InvalidOperationException()
|
||||||
}),
|
}),
|
||||||
new SingleItem("preview", "0"),
|
new SingleItem("preview", "0"),
|
||||||
|
|||||||
Reference in New Issue
Block a user