Renamed the CollisionMisc collision category to CollisionItem, teleporting items inside/outside the sub if their physicsbody leaves/enters a hull, powercontainer charge can be changed in editor (i.e. batteries can be set to fully loaded)

This commit is contained in:
Regalis
2016-05-19 19:47:26 +03:00
parent 6651933c45
commit a477dad1b2
12 changed files with 25 additions and 14 deletions
+11
View File
@@ -707,7 +707,18 @@ namespace Barotrauma
if (Math.Abs(body.LinearVelocity.X) > 0.01f || Math.Abs(body.LinearVelocity.Y) > 0.01f)
{
Submarine prevSub = Submarine;
FindHull();
if (Submarine == null && prevSub != null)
{
body.SetTransform(body.SimPosition + prevSub.SimPosition, body.Rotation);
}
else if (Submarine != null && prevSub == null)
{
body.SetTransform(body.SimPosition - Submarine.SimPosition, body.Rotation);
}
Vector2 moveAmount = body.SimPosition - body.LastSentPosition;
if (parentInventory == null && moveAmount != Vector2.Zero && moveAmount.Length() > NetConfig.ItemPosUpdateDistance)