- moving characters out of the way when the sub is teleported to the right position in multiplayer (monsters shouldn't randomly pop up inside the submarine anymore)

- taking sub position into account when snapping cursor position to the grid -> new items/structures are aligned with existing ones if editing the sub while a round is running
This commit is contained in:
Regalis
2016-03-28 16:11:55 +03:00
parent 9a0bf07fc2
commit c1a1990f08
3 changed files with 129 additions and 67 deletions
+10 -2
View File
@@ -24,7 +24,7 @@ namespace Barotrauma
//position of the "actual submarine" which is rendered wherever the SubmarineBody is
//should be in an unreachable place
public static readonly Vector2 HiddenSubPosition = new Vector2(0.0f, 50032.0f);
public static readonly Vector2 HiddenSubPosition = new Vector2(-50000.0f, 80000.0f);
public static List<Submarine> SavedSubmarines = new List<Submarine>();
@@ -249,7 +249,15 @@ namespace Barotrauma
Vector2 position = PlayerInput.MousePosition;
position = cam.ScreenToWorld(position);
return VectorToWorldGrid(position);
Vector2 worldGridPos = VectorToWorldGrid(position);
if (loaded != null)
{
worldGridPos.X += loaded.Position.X % GridSize.X;
worldGridPos.Y += loaded.Position.Y % GridSize.Y;
}
return worldGridPos;
}
public static Vector2 VectorToWorldGrid(Vector2 position)