- Fixed structure-gap links not being saved
- Saving gap orientation - Waypoint generation works with small hulls and even if SubBody doesn't exist - Fixed charactermode when a editing mid-round - Fixed powercontainer charge progressbar position
This commit is contained in:
@@ -57,7 +57,7 @@ namespace Barotrauma
|
|||||||
frame = new GUIFrame(Rectangle.Empty, Color.Black * 0.6f);
|
frame = new GUIFrame(Rectangle.Empty, Color.Black * 0.6f);
|
||||||
frame.Padding = new Vector4(200.0f, 100.0f, 200.0f, 100.0f);
|
frame.Padding = new Vector4(200.0f, 100.0f, 200.0f, 100.0f);
|
||||||
|
|
||||||
GUIButton closeButton = new GUIButton(new Rectangle(0, 50, 100, 20), "Close", GUI.Style, frame);
|
GUIButton closeButton = new GUIButton(new Rectangle(0, 50, 100, 20), "Close", Alignment.BottomCenter, GUI.Style, frame);
|
||||||
closeButton.OnClicked = (GUIButton button, object userData) =>
|
closeButton.OnClicked = (GUIButton button, object userData) =>
|
||||||
{
|
{
|
||||||
ToggleGUIFrame();
|
ToggleGUIFrame();
|
||||||
|
|||||||
@@ -177,7 +177,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
base.Update(deltaTime);
|
base.Update(deltaTime);
|
||||||
|
|
||||||
scrollBar.Update(deltaTime);
|
if (scrollBarEnabled && !scrollBarHidden) scrollBar.Update(deltaTime);
|
||||||
|
|
||||||
if ((MouseOn == this || MouseOn == scrollBar || IsParentOf(MouseOn)) && PlayerInput.ScrollWheelSpeed != 0)
|
if ((MouseOn == this || MouseOn == scrollBar || IsParentOf(MouseOn)) && PlayerInput.ScrollWheelSpeed != 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -98,7 +98,8 @@ namespace Barotrauma
|
|||||||
img.Scale = 30.0f / img.SourceRect.Width;
|
img.Scale = 30.0f / img.SourceRect.Width;
|
||||||
img.Color = order.Color;
|
img.Color = order.Color;
|
||||||
img.CanBeFocused = false;
|
img.CanBeFocused = false;
|
||||||
img.ToolTip ="Order: "+ order.Name;
|
|
||||||
|
orderListBox.children[characterIndex].ToolTip = "Order: " + order.Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool SelectCharacterOrder(GUIComponent component, object selection)
|
public bool SelectCharacterOrder(GUIComponent component, object selection)
|
||||||
|
|||||||
@@ -186,12 +186,12 @@ namespace Barotrauma.Items.Components
|
|||||||
base.Draw(spriteBatch);
|
base.Draw(spriteBatch);
|
||||||
|
|
||||||
GUI.DrawRectangle(spriteBatch,
|
GUI.DrawRectangle(spriteBatch,
|
||||||
new Vector2(item.Rect.X + item.Rect.Width / 2 - 4, -item.Rect.Y + 9),
|
new Vector2(item.DrawPosition.X- 4, -item.DrawPosition.Y),
|
||||||
new Vector2(8, 22), Color.Black);
|
new Vector2(8, 22), Color.Black);
|
||||||
|
|
||||||
if (charge > 0)
|
if (charge > 0)
|
||||||
GUI.DrawRectangle(spriteBatch,
|
GUI.DrawRectangle(spriteBatch,
|
||||||
new Vector2(item.Rect.X + item.Rect.Width / 2 - 3, -item.Rect.Y + 10 + (20.0f * (1.0f - charge / capacity))),
|
new Vector2(item.DrawPosition.X - 3, -item.DrawPosition.Y + 1 + (20.0f * (1.0f - charge / capacity))),
|
||||||
new Vector2(6, 20 * (charge / capacity)), Color.Green, true);
|
new Vector2(6, 20 * (charge / capacity)), Color.Green, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1023,6 +1023,9 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
picked = true;
|
picked = true;
|
||||||
ic.ApplyStatusEffects(ActionType.OnPicked, 1.0f, picker);
|
ic.ApplyStatusEffects(ActionType.OnPicked, 1.0f, picker);
|
||||||
|
|
||||||
|
GUIComponent.MouseOn = null;
|
||||||
|
|
||||||
if (ic.CanBeSelected) selected = true;
|
if (ic.CanBeSelected) selected = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -560,7 +560,9 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
XElement element = new XElement("Gap");
|
XElement element = new XElement("Gap");
|
||||||
|
|
||||||
element.Add(new XAttribute("ID", ID));
|
element.Add(
|
||||||
|
new XAttribute("ID", ID),
|
||||||
|
new XAttribute("horizontal", isHorizontal ? "true" : "false"));
|
||||||
|
|
||||||
element.Add(new XAttribute("rect",
|
element.Add(new XAttribute("rect",
|
||||||
(int)(rect.X - Submarine.HiddenSubPosition.X) + "," +
|
(int)(rect.X - Submarine.HiddenSubPosition.X) + "," +
|
||||||
@@ -608,7 +610,15 @@ namespace Barotrauma
|
|||||||
int.Parse(element.Attribute("height").Value));
|
int.Parse(element.Attribute("height").Value));
|
||||||
}
|
}
|
||||||
|
|
||||||
Gap g = new Gap(rect, submarine);
|
bool isHorizontal = rect.Height > rect.Width;
|
||||||
|
|
||||||
|
var horizontalAttribute = element.Attribute("horizontal");
|
||||||
|
if (horizontalAttribute!=null)
|
||||||
|
{
|
||||||
|
isHorizontal = horizontalAttribute.Value.ToString() == "true";
|
||||||
|
}
|
||||||
|
|
||||||
|
Gap g = new Gap(rect, isHorizontal, submarine);
|
||||||
g.ID = (ushort)int.Parse(element.Attribute("ID").Value);
|
g.ID = (ushort)int.Parse(element.Attribute("ID").Value);
|
||||||
|
|
||||||
g.linkedToID = new List<ushort>();
|
g.linkedToID = new List<ushort>();
|
||||||
|
|||||||
@@ -178,6 +178,34 @@ namespace Barotrauma
|
|||||||
InsertToList();
|
InsertToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Rectangle GetBorders()
|
||||||
|
{
|
||||||
|
if (!hullList.Any()) return Rectangle.Empty;
|
||||||
|
|
||||||
|
Rectangle rect = hullList[0].rect;
|
||||||
|
|
||||||
|
foreach (Hull hull in hullList)
|
||||||
|
{
|
||||||
|
if (hull.Rect.X < rect.X)
|
||||||
|
{
|
||||||
|
rect.Width += rect.X - hull.rect.X;
|
||||||
|
rect.X = hull.rect.X;
|
||||||
|
|
||||||
|
}
|
||||||
|
if (hull.rect.Right > rect.Right) rect.Width = hull.rect.Right - rect.X;
|
||||||
|
|
||||||
|
if (hull.rect.Y > rect.Y)
|
||||||
|
{
|
||||||
|
rect.Height += hull.rect.Y - rect.Y;
|
||||||
|
|
||||||
|
rect.Y = hull.rect.Y;
|
||||||
|
}
|
||||||
|
if (hull.rect.Y - hull.rect.Height < rect.Y - rect.Height) rect.Height = rect.Y - (hull.rect.Y - hull.rect.Height);
|
||||||
|
}
|
||||||
|
|
||||||
|
return rect;
|
||||||
|
}
|
||||||
|
|
||||||
public static void GenerateEntityGrid()
|
public static void GenerateEntityGrid()
|
||||||
{
|
{
|
||||||
entityGrid = new EntityGrid(Submarine.Borders, 200.0f);
|
entityGrid = new EntityGrid(Submarine.Borders, 200.0f);
|
||||||
|
|||||||
@@ -147,6 +147,11 @@ namespace Barotrauma
|
|||||||
newRect.Width = (int)Math.Max(newRect.Width, Submarine.GridSize.X);
|
newRect.Width = (int)Math.Max(newRect.Width, Submarine.GridSize.X);
|
||||||
newRect.Height = (int)Math.Max(newRect.Height, Submarine.GridSize.Y);
|
newRect.Height = (int)Math.Max(newRect.Height, Submarine.GridSize.Y);
|
||||||
|
|
||||||
|
if (Submarine.Loaded != null)
|
||||||
|
{
|
||||||
|
newRect.Location -= Submarine.Loaded.Position.ToPoint();
|
||||||
|
}
|
||||||
|
|
||||||
if (PlayerInput.GetMouseState.LeftButton == ButtonState.Released)
|
if (PlayerInput.GetMouseState.LeftButton == ButtonState.Released)
|
||||||
{
|
{
|
||||||
object[] lobject = new object[] { this, newRect };
|
object[] lobject = new object[] { this, newRect };
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ namespace Barotrauma
|
|||||||
public float damage;
|
public float damage;
|
||||||
public Gap gap;
|
public Gap gap;
|
||||||
|
|
||||||
|
public int GapIndex;
|
||||||
|
|
||||||
public float lastSentDamage;
|
public float lastSentDamage;
|
||||||
|
|
||||||
public bool isHighLighted;
|
public bool isHighLighted;
|
||||||
@@ -613,9 +615,17 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
if (sections[i].damage == 0.0f) continue;
|
if (sections[i].damage == 0.0f) continue;
|
||||||
|
|
||||||
element.Add(new XElement("section",
|
var sectionElement =
|
||||||
new XAttribute("i", i),
|
new XElement("section",
|
||||||
new XAttribute("damage", sections[i].damage)));
|
new XAttribute("i", i),
|
||||||
|
new XAttribute("damage", sections[i].damage));
|
||||||
|
|
||||||
|
if (sections[i].gap!=null)
|
||||||
|
{
|
||||||
|
sectionElement.Add(new XAttribute("gap", sections[i].gap.ID));
|
||||||
|
}
|
||||||
|
|
||||||
|
element.Add(sectionElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
doc.Root.Add(element);
|
doc.Root.Add(element);
|
||||||
@@ -660,15 +670,27 @@ namespace Barotrauma
|
|||||||
switch (subElement.Name.ToString())
|
switch (subElement.Name.ToString())
|
||||||
{
|
{
|
||||||
case "section":
|
case "section":
|
||||||
if (subElement.Attribute("i") == null) continue;
|
int index = ToolBox.GetAttributeInt(subElement, "i", -1);
|
||||||
|
if (index == -1) continue;
|
||||||
|
|
||||||
s.sections[int.Parse(subElement.Attribute("i").Value)].damage =
|
s.sections[index].damage =
|
||||||
ToolBox.GetAttributeFloat(subElement, "damage", 0.0f);
|
ToolBox.GetAttributeFloat(subElement, "damage", 0.0f);
|
||||||
|
|
||||||
|
s.sections[index].GapIndex = ToolBox.GetAttributeInt(subElement, "gap", -1);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnMapLoaded()
|
||||||
|
{
|
||||||
|
foreach (WallSection s in sections)
|
||||||
|
{
|
||||||
|
if (s.GapIndex == -1) continue;
|
||||||
|
|
||||||
|
s.gap = FindEntityByID((ushort)s.GapIndex) as Gap;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool FillNetworkData(NetworkEventType type, NetBuffer message, object data)
|
public override bool FillNetworkData(NetworkEventType type, NetBuffer message, object data)
|
||||||
|
|||||||
@@ -328,10 +328,31 @@ namespace Barotrauma
|
|||||||
float outSideWaypointInterval = 200.0f;
|
float outSideWaypointInterval = 200.0f;
|
||||||
int outsideWaypointDist = 100;
|
int outsideWaypointDist = 100;
|
||||||
|
|
||||||
Rectangle borders = new Rectangle(Submarine.Borders.X - outsideWaypointDist, Submarine.Borders.Y + outsideWaypointDist,
|
Rectangle borders = Hull.GetBorders();
|
||||||
Submarine.Borders.Width + outsideWaypointDist*2, Submarine.Borders.Height+outsideWaypointDist*2);
|
|
||||||
|
|
||||||
|
borders.X -= outsideWaypointDist;
|
||||||
|
borders.Y += outsideWaypointDist;
|
||||||
|
|
||||||
|
borders.Width += outsideWaypointDist * 2;
|
||||||
|
borders.Height += outsideWaypointDist * 2;
|
||||||
|
|
||||||
|
borders.Location -= Submarine.HiddenSubPosition.ToPoint();
|
||||||
|
|
||||||
|
if (borders.Width <= outSideWaypointInterval*2)
|
||||||
|
{
|
||||||
|
borders.Inflate(outSideWaypointInterval*2 - borders.Width, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (borders.Height <= outSideWaypointInterval * 2)
|
||||||
|
{
|
||||||
|
int inflateAmount = (int)(outSideWaypointInterval * 2) - borders.Height;
|
||||||
|
borders.Y += inflateAmount / 2;
|
||||||
|
|
||||||
|
borders.Height += inflateAmount;
|
||||||
|
}
|
||||||
|
|
||||||
WayPoint[,] cornerWaypoint = new WayPoint[2,2];
|
WayPoint[,] cornerWaypoint = new WayPoint[2,2];
|
||||||
|
|
||||||
for (int i = 0; i<2; i++)
|
for (int i = 0; i<2; i++)
|
||||||
{
|
{
|
||||||
for (float x = borders.X + outSideWaypointInterval; x < borders.Right - outSideWaypointInterval; x += outSideWaypointInterval)
|
for (float x = borders.X + outSideWaypointInterval; x < borders.Right - outSideWaypointInterval; x += outSideWaypointInterval)
|
||||||
@@ -351,7 +372,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
cornerWaypoint[i, 1] = WayPoint.WayPointList[WayPointList.Count - 1];
|
cornerWaypoint[i, 1] = WayPoint.WayPointList[WayPointList.Count - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 2; i++)
|
for (int i = 0; i < 2; i++)
|
||||||
{
|
{
|
||||||
WayPoint wayPoint = null;
|
WayPoint wayPoint = null;
|
||||||
|
|||||||
@@ -409,7 +409,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (dummyCharacter.SelectedConstruction==null)
|
if (dummyCharacter.SelectedConstruction==null)
|
||||||
{
|
{
|
||||||
Vector2 mouseSimPos = FarseerPhysics.ConvertUnits.ToSimUnits(cam.ScreenToWorld(PlayerInput.MousePosition));
|
Vector2 mouseSimPos = FarseerPhysics.ConvertUnits.ToSimUnits(dummyCharacter.CursorPosition);
|
||||||
foreach (Limb limb in dummyCharacter.AnimController.Limbs)
|
foreach (Limb limb in dummyCharacter.AnimController.Limbs)
|
||||||
{
|
{
|
||||||
limb.body.SetTransform(mouseSimPos, 0.0f);
|
limb.body.SetTransform(mouseSimPos, 0.0f);
|
||||||
@@ -473,7 +473,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
if (dummyCharacter != null)
|
if (dummyCharacter != null)
|
||||||
{
|
{
|
||||||
dummyCharacter.AnimController.FindHull();
|
dummyCharacter.AnimController.FindHull(dummyCharacter.CursorWorldPosition, false);
|
||||||
|
|
||||||
foreach (Item item in dummyCharacter.SelectedItems)
|
foreach (Item item in dummyCharacter.SelectedItems)
|
||||||
{
|
{
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user