- teleporting from sub to another works now
- repairtool fix - submarines collide with each other - every submarine is updated (so MainSub isn't the only one that can move) - submarinebody vertex generation fix
This commit is contained in:
@@ -76,10 +76,13 @@ namespace Barotrauma
|
||||
|
||||
currentTarget = target;
|
||||
Vector2 pos = host.SimPosition;
|
||||
if (character!=null && character.Submarine==null)
|
||||
if (character != null && character.Submarine == null)
|
||||
{
|
||||
//todo: take multiple subs into account
|
||||
pos -= Submarine.MainSub.SimPosition;
|
||||
var targetHull = Hull.FindHull(FarseerPhysics.ConvertUnits.ToDisplayUnits(target), null, false);
|
||||
if (targetHull!=null && targetHull.Submarine != null)
|
||||
{
|
||||
pos -= targetHull.SimPosition;
|
||||
}
|
||||
}
|
||||
|
||||
currentPath = pathFinder.FindPath(pos, target);
|
||||
|
||||
@@ -572,6 +572,7 @@ namespace Barotrauma
|
||||
|
||||
if (setSubmarine)
|
||||
{
|
||||
//in -> out
|
||||
if (newHull == null && currentHull.Submarine != null)
|
||||
{
|
||||
for (int i = -1; i < 2; i += 2)
|
||||
@@ -584,12 +585,18 @@ namespace Barotrauma
|
||||
if (Gap.FindAdjacent(currentHull.ConnectedGaps, findPos, 150.0f) != null) return;
|
||||
|
||||
Teleport(ConvertUnits.ToSimUnits(currentHull.Submarine.Position), currentHull.Submarine.Velocity, true);
|
||||
|
||||
}
|
||||
//out -> in
|
||||
else if (currentHull == null && newHull.Submarine != null)
|
||||
{
|
||||
Teleport(-ConvertUnits.ToSimUnits(newHull.Submarine.Position), -newHull.Submarine.Velocity, false);
|
||||
}
|
||||
//from one sub to another
|
||||
else if (newHull != null && currentHull != null && newHull.Submarine != currentHull.Submarine)
|
||||
{
|
||||
Teleport(ConvertUnits.ToSimUnits(currentHull.Submarine.Position - newHull.Submarine.Position),
|
||||
Vector2.Zero, false);
|
||||
}
|
||||
}
|
||||
|
||||
CurrentHull = newHull;
|
||||
|
||||
@@ -144,7 +144,7 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
else
|
||||
{
|
||||
Repair(rayStart, rayEnd, deltaTime, character, degreeOfSuccess, ignoredBodies);
|
||||
Repair(rayStart - character.Submarine.SimPosition, rayEnd - character.Submarine.SimPosition, deltaTime, character, degreeOfSuccess, ignoredBodies);
|
||||
}
|
||||
|
||||
GameMain.ParticleManager.CreateParticle(particles, item.WorldPosition + TransformedBarrelPos,
|
||||
|
||||
@@ -153,7 +153,13 @@ namespace Barotrauma
|
||||
|
||||
body.BodyType = BodyType.Dynamic;
|
||||
body.CollisionCategories = Physics.CollisionWall;
|
||||
body.CollidesWith = Physics.CollisionItem | Physics.CollisionLevel | Physics.CollisionCharacter | Physics.CollisionProjectile;
|
||||
body.CollidesWith =
|
||||
Physics.CollisionItem |
|
||||
Physics.CollisionLevel |
|
||||
Physics.CollisionCharacter |
|
||||
Physics.CollisionProjectile |
|
||||
Physics.CollisionWall;
|
||||
|
||||
body.Restitution = Restitution;
|
||||
body.Friction = Friction;
|
||||
body.FixedRotation = true;
|
||||
@@ -179,6 +185,8 @@ namespace Barotrauma
|
||||
|
||||
foreach (Structure wall in Structure.WallList)
|
||||
{
|
||||
if (wall.Submarine != submarine) continue;
|
||||
|
||||
for (int x = -1; x <= 1; x += 2)
|
||||
{
|
||||
for (int y = -1; y <= 1; y += 2)
|
||||
@@ -233,7 +241,7 @@ namespace Barotrauma
|
||||
|
||||
ForceTranslate(moveAmount);
|
||||
|
||||
GameMain.GameScreen.Cam.UpdateTransform(false);
|
||||
if (submarine == Submarine.MainSub) GameMain.GameScreen.Cam.UpdateTransform(false);
|
||||
|
||||
submarine.SetPrevTransform(submarine.Position);
|
||||
submarine.UpdateTransform();
|
||||
@@ -336,6 +344,8 @@ namespace Barotrauma
|
||||
float volume = 0.0f;
|
||||
foreach (Hull hull in Hull.hullList)
|
||||
{
|
||||
if (hull.Submarine != submarine) continue;
|
||||
|
||||
waterVolume += hull.Volume;
|
||||
volume += hull.FullVolume;
|
||||
}
|
||||
|
||||
@@ -136,11 +136,11 @@ namespace Barotrauma
|
||||
|
||||
Ragdoll.UpdateAll(cam, (float)Physics.step);
|
||||
|
||||
if (GameMain.GameSession != null && GameMain.GameSession.Level != null && GameMain.GameSession.Submarine!=null)
|
||||
foreach (Submarine sub in Submarine.Loaded)
|
||||
{
|
||||
GameMain.GameSession.Submarine.Update((float)Physics.step);
|
||||
sub.Update((float)Physics.step);
|
||||
}
|
||||
|
||||
|
||||
GameMain.World.Step((float)Physics.step);
|
||||
|
||||
//Level.AfterWorldStep();
|
||||
|
||||
Reference in New Issue
Block a user