Revert "OBT1.1.0 Merge branch 'dev_pte' into dev"

This reverts commit 177cf89756, reversing
changes made to 42ba733cd4.
This commit is contained in:
Eero
2025-12-29 11:18:11 +08:00
parent 177cf89756
commit 046483b9da
86 changed files with 800 additions and 2496 deletions
@@ -2,7 +2,6 @@
using FarseerPhysics;
using Microsoft.Xna.Framework;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using FarseerPhysics.Dynamics;
@@ -15,9 +14,9 @@ namespace Barotrauma.Items.Components
{
partial class Door : Pickable, IDrawableComponent, IServerSerializable
{
private static readonly ConcurrentDictionary<Door, byte> _doorDict = new ConcurrentDictionary<Door, byte>();
private static readonly HashSet<Door> doorList = new HashSet<Door>();
public static ICollection<Door> DoorList => _doorDict.Keys;
public static IReadOnlyCollection<Door> DoorList { get { return doorList; } }
private Gap linkedGap;
private bool isOpen;
@@ -278,7 +277,7 @@ namespace Barotrauma.Items.Components
}
IsActive = true;
_doorDict.TryAdd(this, 0);
doorList.Add(this);
}
public override void OnItemLoaded()
@@ -314,21 +313,13 @@ namespace Barotrauma.Items.Components
public override void Move(Vector2 amount, bool ignoreContacts = false)
{
// Defer physics operation if in parallel context (Farseer is not thread-safe)
if (Body != null)
if (ignoreContacts)
{
var capturedBody = Body;
var capturedNewPos = Body.SimPosition + ConvertUnits.ToSimUnits(amount);
if (ignoreContacts)
{
PhysicsBodyQueue.ExecuteOrDefer(() =>
capturedBody.SetTransformIgnoreContacts(capturedNewPos, 0.0f));
}
else
{
PhysicsBodyQueue.ExecuteOrDefer(() =>
capturedBody.SetTransform(capturedNewPos, 0.0f));
}
Body?.SetTransformIgnoreContacts(Body.SimPosition + ConvertUnits.ToSimUnits(amount), 0.0f);
}
else
{
Body?.SetTransform(Body.SimPosition + ConvertUnits.ToSimUnits(amount), 0.0f);
}
#if CLIENT
UpdateConvexHulls();
@@ -678,7 +669,7 @@ namespace Barotrauma.Items.Components
convexHull2?.Remove();
#endif
_doorDict.TryRemove(this, out _);
doorList.Remove(this);
}
private bool CheckSubmarinesInDoorWay()
@@ -794,19 +785,13 @@ namespace Barotrauma.Items.Components
//immediately teleport it to the correct side
if (Math.Sign(diff) != dir)
{
// Defer physics operation if in parallel context (Farseer is not thread-safe)
var capturedBody = body;
if (IsHorizontal)
{
Vector2 newPos = new Vector2(body.SimPosition.X, item.SimPosition.Y + dir * doorRectSimSize.Y * 2.0f);
float rotation = body.Rotation;
PhysicsBodyQueue.ExecuteOrDefer(() => capturedBody.SetTransformIgnoreContacts(newPos, rotation));
body.SetTransformIgnoreContacts(new Vector2(body.SimPosition.X, item.SimPosition.Y + dir * doorRectSimSize.Y * 2.0f), body.Rotation);
}
else
{
Vector2 newPos = new Vector2(item.SimPosition.X + dir * doorRectSimSize.X * 1.2f, body.SimPosition.Y);
float rotation = body.Rotation;
PhysicsBodyQueue.ExecuteOrDefer(() => capturedBody.SetTransformIgnoreContacts(newPos, rotation));
body.SetTransformIgnoreContacts(new Vector2(item.SimPosition.X + dir * doorRectSimSize.X * 1.2f, body.SimPosition.Y), body.Rotation);
}
}