(ce8e185aa) Merge branch 'dev' of https://github.com/Regalis11/Barotrauma-development into dev

This commit is contained in:
Joonas Rikkonen
2019-04-16 17:12:09 +03:00
parent bd07acf26d
commit 6262b3ea54
96 changed files with 1972 additions and 825 deletions
+25 -6
View File
@@ -90,6 +90,25 @@ namespace Barotrauma
}
}
public string DisplayName
{
get;
private set;
}
private string roomName;
[Editable, Serialize("", true, translationTextTag: "RoomName.")]
public string RoomName
{
get { return roomName; }
set
{
if (roomName == value) { return; }
roomName = value;
DisplayName = TextManager.Get(roomName, returnNull: true) ?? roomName;
}
}
public override Rectangle Rect
{
get
@@ -817,17 +836,17 @@ namespace Barotrauma
}
if (roomItems.Contains("reactor"))
return TextManager.Get("ReactorRoom");
return "RoomName.ReactorRoom";
else if (roomItems.Contains("engine"))
return TextManager.Get("EngineRoom");
return "RoomName.EngineRoom";
else if (roomItems.Contains("steering") && roomItems.Contains("sonar"))
return TextManager.Get("CommandRoom");
return "RoomName.CommandRoom";
else if (roomItems.Contains("ballast"))
return TextManager.Get("Ballast");
return "RoomName.Ballast";
if (ConnectedGaps.Any(g => !g.IsRoomToRoom && g.ConnectedDoor != null))
{
return TextManager.Get("Airlock");
return "RoomName.Airlock";
}
Rectangle subRect = Submarine.CalculateDimensions();
@@ -847,7 +866,7 @@ namespace Barotrauma
else
roomPos |= Alignment.Right;
return TextManager.Get("Sub" + roomPos.ToString());
return "RoomName.Sub" + roomPos.ToString();
}
public static Hull Load(XElement element, Submarine submarine)
@@ -144,6 +144,20 @@ namespace Barotrauma
get { return spriteColor; }
set { spriteColor = value; }
}
[Editable, Serialize(false, true)]
public bool UseDropShadow
{
get;
private set;
}
[Serialize("0,0", true), Editable(ToolTip = "The position of the drop shadow relative to the structure. If set to zero, the shadow is positioned automatically so that it points towards the sub's center of mass.")]
public Vector2 DropShadowOffset
{
get;
private set;
}
public override Rectangle Rect
{
@@ -299,8 +313,8 @@ namespace Barotrauma
}
}
// Only add ai targets automatically to walls
if (aiTarget == null && HasBody && Tags.Contains("wall"))
// Only add ai targets automatically to submarine/outpost walls
if (aiTarget == null && HasBody && Tags.Contains("wall") && submarine != null)
{
aiTarget = new AITarget(this);
}
@@ -1139,6 +1153,13 @@ namespace Barotrauma
if (element.GetAttributeBool("flippedx", false)) s.FlipX(false);
if (element.GetAttributeBool("flippedy", false)) s.FlipY(false);
SerializableProperty.DeserializeProperties(s, element);
//structures with a body drop a shadow by default
if (element.Attribute("usedropshadow") == null)
{
s.UseDropShadow = prefab.Body;
}
return s;
}
@@ -194,7 +194,14 @@ namespace Barotrauma
break;
case "backgroundsprite":
sp.BackgroundSprite = new Sprite(subElement, lazyLoad: true);
if (subElement.Attribute("sourcerect") == null && sp.sprite != null)
{
sp.BackgroundSprite.SourceRect = sp.sprite.SourceRect;
sp.BackgroundSprite.size = sp.sprite.size;
sp.BackgroundSprite.size.X *= sp.sprite.SourceRect.Width;
sp.BackgroundSprite.size.Y *= sp.sprite.SourceRect.Height;
sp.BackgroundSprite.RelativeOrigin = subElement.GetAttributeVector2("origin", new Vector2(0.5f, 0.5f));
}
if (subElement.GetAttributeBool("fliphorizontal", false))
sp.BackgroundSprite.effects = SpriteEffects.FlipHorizontally;
if (subElement.GetAttributeBool("flipvertical", false))
@@ -417,7 +417,10 @@ namespace Barotrauma
if (me.Submarine != this) { continue; }
if (me is Item item)
{
item.Indestructible = true;
if (item.GetComponent<Repairable>() != null)
{
item.Indestructible = true;
}
foreach (ItemComponent ic in item.Components)
{
if (ic is ConnectionPanel connectionPanel)