Impulses aren't applied to disabled item bodies when the submarine hits something, velocities of item bodies are reset when the item is dropped, pathfinding errors don't open the debug console

This commit is contained in:
Regalis
2016-06-01 20:55:15 +03:00
parent 1828198abf
commit 0621f6c9e3
4 changed files with 16 additions and 6 deletions

View File

@@ -123,7 +123,8 @@ namespace Barotrauma
if (startNode == null)
{
DebugConsole.ThrowError("Pathfinding error, couldn't find a start node");
DebugConsole.NewMessage("Pathfinding error, couldn't find a start node", Color.DarkRed);
return new SteeringPath();
}
@@ -152,7 +153,7 @@ namespace Barotrauma
if (endNode == null)
{
DebugConsole.ThrowError("Pathfinding error, couldn't find an end node");
DebugConsole.NewMessage("Pathfinding error, couldn't find an end node", Color.DarkRed);
return new SteeringPath();
}
@@ -185,7 +186,7 @@ namespace Barotrauma
if (startNode == null || endNode == null)
{
DebugConsole.ThrowError("Pathfinding error, couldn't find matching pathnodes to waypoints");
DebugConsole.NewMessage("Pathfinding error, couldn't find matching pathnodes to waypoints", Color.DarkRed);
return new SteeringPath();
}

View File

@@ -203,9 +203,11 @@ namespace Barotrauma.Items.Components
if (picker == null || picker.Inventory == null)
{
if (item.ParentInventory!=null && item.ParentInventory.Owner!=null)
if (item.ParentInventory != null && item.ParentInventory.Owner != null)
{
bodyDropPos = item.ParentInventory.Owner.SimPosition;
if (item.body != null) item.body.ResetDynamics();
}
}
else
@@ -217,6 +219,12 @@ namespace Barotrauma.Items.Components
Limb rightHand = picker.AnimController.GetLimb(LimbType.RightHand);
bodyDropPos = rightHand.SimPosition;
if (item.body!=null)
{
item.body.LinearVelocity = rightHand.body.LinearVelocity;
item.body.AngularVelocity = rightHand.body.AngularVelocity;
}
picker.Inventory.RemoveItem(item);
picker = null;
}

View File

@@ -1680,7 +1680,7 @@ namespace Barotrauma
if (body != null)
{
body.ReadNetworkData(message, sendingTime);
body.MoveToTargetPosition(false);
body.MoveToTargetPosition();
}
break;
case NetworkEventType.PhysicsBodyPosition:

View File

@@ -511,7 +511,8 @@ namespace Barotrauma
foreach (Item item in Item.ItemList)
{
if (item.Submarine != submarine || item.CurrentHull == null || item.body == null) continue;
if (item.Submarine != submarine || item.CurrentHull == null ||
item.body == null || !item.body.Enabled) continue;
item.body.ApplyLinearImpulse(item.body.Mass * impulse);
}