Taking structure offset from origin into account when spawning the sub, repairtool automatically targets last section if welding the second-to-last
This commit is contained in:
@@ -119,7 +119,10 @@ namespace Barotrauma
|
|||||||
if (level != null)
|
if (level != null)
|
||||||
{
|
{
|
||||||
level.Generate();
|
level.Generate();
|
||||||
submarine.SetPosition(level.StartPosition - new Vector2(0.0f, 2000.0f));
|
|
||||||
|
Vector2 subOffsetFromCenter = new Vector2(Submarine.Borders.Center.X, Submarine.Borders.Y - Submarine.Borders.Height / 2);
|
||||||
|
|
||||||
|
submarine.SetPosition(level.StartPosition - subOffsetFromCenter - new Vector2(0.0f, 2000.0f));
|
||||||
|
|
||||||
GameMain.GameScreen.BackgroundCreatureManager.SpawnSprites(80);
|
GameMain.GameScreen.BackgroundCreatureManager.SpawnSprites(80);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -170,13 +170,19 @@ namespace Barotrauma.Items.Components
|
|||||||
|
|
||||||
//if the next section is small enough, apply the effect to it as well
|
//if the next section is small enough, apply the effect to it as well
|
||||||
//(to make it easier to fix a small "left-over" section)
|
//(to make it easier to fix a small "left-over" section)
|
||||||
int nextSectionLength = targetStructure.SectionLength(sectionIndex + 1);
|
for (int i = -1; i<2; i+=2)
|
||||||
if (nextSectionLength > 0 && nextSectionLength < Structure.wallSectionSize * 0.3f)
|
|
||||||
{
|
{
|
||||||
targetStructure.HighLightSection(sectionIndex + 1);
|
int nextSectionLength = targetStructure.SectionLength(sectionIndex + i);
|
||||||
targetStructure.AddDamage(sectionIndex + 1, -StructureFixAmount * degreeOfSuccess);
|
if ((sectionIndex==1 && i ==-1) ||
|
||||||
|
(sectionIndex==targetStructure.SectionCount-2 && i == 1) ||
|
||||||
|
(nextSectionLength > 0 && nextSectionLength < Structure.wallSectionSize * 0.3f))
|
||||||
|
{
|
||||||
|
targetStructure.HighLightSection(sectionIndex + i);
|
||||||
|
targetStructure.AddDamage(sectionIndex + i, -StructureFixAmount * degreeOfSuccess);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else if ((targetLimb = (targetBody.UserData as Limb)) != null)
|
else if ((targetLimb = (targetBody.UserData as Limb)) != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -239,11 +239,11 @@ namespace Barotrauma.Items.Components
|
|||||||
|
|
||||||
DrawMarker(spriteBatch,
|
DrawMarker(spriteBatch,
|
||||||
(GameMain.GameSession.Map == null) ? "Start" : GameMain.GameSession.Map.CurrentLocation.Name,
|
(GameMain.GameSession.Map == null) ? "Start" : GameMain.GameSession.Map.CurrentLocation.Name,
|
||||||
(Level.Loaded.StartPosition - (Submarine.Loaded.Position + Submarine.HiddenSubPosition)), displayScale, center, (rect.Width * 0.55f));
|
(Level.Loaded.StartPosition - item.WorldPosition), displayScale, center, (rect.Width * 0.55f));
|
||||||
|
|
||||||
DrawMarker(spriteBatch,
|
DrawMarker(spriteBatch,
|
||||||
(GameMain.GameSession.Map == null) ? "End" : GameMain.GameSession.Map.SelectedLocation.Name,
|
(GameMain.GameSession.Map == null) ? "End" : GameMain.GameSession.Map.SelectedLocation.Name,
|
||||||
(Level.Loaded.EndPosition - (Submarine.Loaded.Position+Submarine.HiddenSubPosition)), displayScale, center, (rect.Width * 0.55f));
|
(Level.Loaded.EndPosition - item.WorldPosition), displayScale, center, (rect.Width * 0.55f));
|
||||||
|
|
||||||
if (GameMain.GameSession.Mission != null)
|
if (GameMain.GameSession.Mission != null)
|
||||||
{
|
{
|
||||||
@@ -253,7 +253,7 @@ namespace Barotrauma.Items.Components
|
|||||||
{
|
{
|
||||||
DrawMarker(spriteBatch,
|
DrawMarker(spriteBatch,
|
||||||
mission.RadarLabel,
|
mission.RadarLabel,
|
||||||
mission.RadarPosition - (Submarine.Loaded.Position + Submarine.HiddenSubPosition), displayScale, center, (rect.Width * 0.55f));
|
mission.RadarPosition - item.WorldPosition, displayScale, center, (rect.Width * 0.55f));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -294,7 +294,7 @@ namespace Barotrauma
|
|||||||
wayPoint.MoveWithLevel = true;
|
wayPoint.MoveWithLevel = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//startPosition = pathCells[0].Center;
|
startPosition.X = pathCells[0].Center.X;
|
||||||
//endPosition = pathCells[pathCells.Count - 1].Center;
|
//endPosition = pathCells[pathCells.Count - 1].Center;
|
||||||
|
|
||||||
foreach (List<Vector2> tunnel in smallTunnels)
|
foreach (List<Vector2> tunnel in smallTunnels)
|
||||||
|
|||||||
@@ -305,7 +305,7 @@ namespace Barotrauma
|
|||||||
var msgBox = new GUIMessageBox("Password required:", "", new string[] { "OK", "Cancel" });
|
var msgBox = new GUIMessageBox("Password required:", "", new string[] { "OK", "Cancel" });
|
||||||
var passwordBox = new GUITextBox(new Rectangle(0,40,150,25), Alignment.TopLeft, GUI.Style, msgBox.children[0]);
|
var passwordBox = new GUITextBox(new Rectangle(0,40,150,25), Alignment.TopLeft, GUI.Style, msgBox.children[0]);
|
||||||
passwordBox.UserData = "password";
|
passwordBox.UserData = "password";
|
||||||
|
|
||||||
var okButton = msgBox.Buttons[0];
|
var okButton = msgBox.Buttons[0];
|
||||||
var cancelButton = msgBox.Buttons[1];
|
var cancelButton = msgBox.Buttons[1];
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user