(2df363efc) Refactor avoiding, because the previous method wasn't working well. It now should work better, but requires a heading vector. Add some notes on how to improve the method. TODO: revisit fishes.

This commit is contained in:
Joonas Rikkonen
2019-05-18 17:41:58 +03:00
parent 1a5bf77149
commit 11d08f4f70
17 changed files with 123 additions and 107 deletions
@@ -273,7 +273,7 @@ namespace Barotrauma
{ {
IsHorizontal = false IsHorizontal = false
}; };
cprButton = new GUIButton(new RectTransform(new Point((int)(80 * GUI.Scale)), GUI.Canvas), text: "", style: "CPRButton") cprButton = new GUIButton(new RectTransform(new Point(80, 80), GUI.Canvas), text: "", style: "CPRButton")
{ {
OnClicked = (button, userData) => OnClicked = (button, userData) =>
{ {
@@ -397,10 +397,7 @@ namespace Barotrauma
MouseOn.DrawToolTip(spriteBatch); MouseOn.DrawToolTip(spriteBatch);
} }
if (GameMain.WindowActive) Cursor.Draw(spriteBatch, PlayerInput.LatestMousePosition);
{
Cursor.Draw(spriteBatch, PlayerInput.LatestMousePosition, 0, Scale / 2f);
}
} }
public static void DrawBackgroundSprite(SpriteBatch spriteBatch, Sprite backgroundSprite, float blurAmount = 1.0f, float aberrationStrength = 1.0f) public static void DrawBackgroundSprite(SpriteBatch spriteBatch, Sprite backgroundSprite, float blurAmount = 1.0f, float aberrationStrength = 1.0f)
@@ -91,7 +91,7 @@ namespace Barotrauma
} }
InnerFrame.RectTransform.NonScaledSize = InnerFrame.RectTransform.NonScaledSize =
new Point(InnerFrame.Rect.Width, (int)Math.Max(height / Content.RectTransform.RelativeSize.Y, height + (int)(50 * GUI.yScale))); new Point(InnerFrame.Rect.Width, (int)Math.Max(height / Content.RectTransform.RelativeSize.Y, height + 50));
Content.RectTransform.NonScaledSize = Content.RectTransform.NonScaledSize =
new Point(Content.Rect.Width, height); new Point(Content.Rect.Width, height);
} }
@@ -99,7 +99,7 @@ namespace Barotrauma
Buttons = new List<GUIButton>(buttons.Length); Buttons = new List<GUIButton>(buttons.Length);
for (int i = 0; i < buttons.Length; i++) for (int i = 0; i < buttons.Length; i++)
{ {
var button = new GUIButton(new RectTransform(new Vector2(Math.Min(0.9f / buttons.Length, 0.5f), 1.0f), buttonContainer.RectTransform), buttons[i], style: "GUIButtonLarge"); var button = new GUIButton(new RectTransform(new Vector2(Math.Min(0.9f / buttons.Length, 0.5f), 1.0f), buttonContainer.RectTransform, maxSize: new Point(300, 35)), buttons[i], style: "GUIButtonLarge");
Buttons.Add(button); Buttons.Add(button);
} }
@@ -334,7 +334,7 @@ namespace Barotrauma
SoundManager.SetCategoryGainMultiplier("ui", Config.SoundVolume); SoundManager.SetCategoryGainMultiplier("ui", Config.SoundVolume);
SoundManager.SetCategoryGainMultiplier("waterambience", Config.SoundVolume); SoundManager.SetCategoryGainMultiplier("waterambience", Config.SoundVolume);
SoundManager.SetCategoryGainMultiplier("music", Config.MusicVolume); SoundManager.SetCategoryGainMultiplier("music", Config.MusicVolume);
SoundManager.SetCategoryGainMultiplier("voip", Config.VoiceChatVolume * 5.0f); SoundManager.SetCategoryGainMultiplier("voip", Config.VoiceChatVolume);
if (Config.EnableSplashScreen) if (Config.EnableSplashScreen)
{ {
var pendingSplashScreens = TitleScreen.PendingSplashScreens; var pendingSplashScreens = TitleScreen.PendingSplashScreens;
@@ -666,7 +666,7 @@ namespace Barotrauma
(NetworkMember == null || !NetworkMember.GameStarted); (NetworkMember == null || !NetworkMember.GameStarted);
#if !DEBUG #if !DEBUG
if (NetworkMember == null && !WindowActive && !paused && true && Screen.Selected != MainMenuScreen && Config.PauseOnFocusLost) if (NetworkMember == null && !WindowActive && !paused && true && Screen.Selected != MainMenuScreen)
{ {
GUI.TogglePauseMenu(); GUI.TogglePauseMenu();
paused = true; paused = true;
@@ -543,10 +543,7 @@ namespace Barotrauma
//equipped item that can't be put in the inventory, use delayed dropping //equipped item that can't be put in the inventory, use delayed dropping
if (quickUseAction == QuickUseAction.Drop) if (quickUseAction == QuickUseAction.Drop)
{ {
slots[i].QuickUseButtonToolTip = slots[i].QuickUseButtonToolTip = "Hold to unequip";
TextManager.Get("QuickUseAction.HoldToUnequip", returnNull: true) ??
(GameMain.Config.Language == "English" ? "Hold to unequip" : TextManager.Get("QuickUseAction.Unequip"));
if (PlayerInput.LeftButtonHeld()) if (PlayerInput.LeftButtonHeld())
{ {
slots[i].QuickUseTimer = Math.Max(0.1f, slots[i].QuickUseTimer + deltaTime); slots[i].QuickUseTimer = Math.Max(0.1f, slots[i].QuickUseTimer + deltaTime);
@@ -143,7 +143,7 @@ namespace Barotrauma.Items.Components
private void Draw(SpriteBatch spriteBatch, ConnectionPanel panel, Vector2 position, Vector2 labelPos, Vector2 wirePosition, bool mouseIn, Wire equippedWire, float wireInterval) private void Draw(SpriteBatch spriteBatch, ConnectionPanel panel, Vector2 position, Vector2 labelPos, Vector2 wirePosition, bool mouseIn, Wire equippedWire, float wireInterval)
{ {
//spriteBatch.DrawString(GUI.SmallFont, Name, new Vector2(labelPos.X, labelPos.Y-10), Color.White); //spriteBatch.DrawString(GUI.SmallFont, Name, new Vector2(labelPos.X, labelPos.Y-10), Color.White);
GUI.DrawString(spriteBatch, labelPos, DisplayName, IsPower ? Color.Red : Color.White, Color.Black, 0, GUI.SmallFont); GUI.DrawString(spriteBatch, labelPos, Name, IsPower ? Color.Red : Color.White, Color.Black, 0, GUI.SmallFont);
connectionSprite.Draw(spriteBatch, position); connectionSprite.Draw(spriteBatch, position);
@@ -281,8 +281,7 @@ namespace Barotrauma
new Vector2(rect.Width, rect.Height), new Vector2(rect.Width, rect.Height),
color: color, color: color,
textureScale: TextureScale * Scale, textureScale: TextureScale * Scale,
startOffset: backGroundOffset, startOffset: backGroundOffset);
depth: Math.Max(Prefab.BackgroundSprite.Depth, depth + 0.000001f));
if (UseDropShadow) if (UseDropShadow)
{ {
@@ -903,7 +903,7 @@ namespace Barotrauma.Networking
connected = false; connected = false;
ConnectToServer(serverIP); ConnectToServer(serverIP);
} }
if (clientID == myID) else
{ {
string msg = ""; string msg = "";
if (disconnectReason == DisconnectReason.Unknown) if (disconnectReason == DisconnectReason.Unknown)
@@ -921,18 +921,8 @@ namespace Barotrauma.Networking
msg += TextManager.GetServerMessage(splitMsg[i]); msg += TextManager.GetServerMessage(splitMsg[i]);
} }
} }
var msgBox = new GUIMessageBox(TextManager.Get(allowReconnect ? "ConnectionLost" : "CouldNotConnectToServer"), msg);
if (msg == NetConnection.NoResponseMessage) msgBox.Buttons[0].OnClicked += ReturnToServerList;
{
//display a generic "could not connect" popup if the message is Lidgren's "failed to establish connection"
var msgBox = new GUIMessageBox(TextManager.Get("ConnectionFailed"), TextManager.Get(allowReconnect ? "ConnectionLost" : "CouldNotConnectToServer"));
msgBox.Buttons[0].OnClicked += ReturnToServerList;
}
else
{
var msgBox = new GUIMessageBox(TextManager.Get(allowReconnect ? "ConnectionLost" : "CouldNotConnectToServer"), msg);
msgBox.Buttons[0].OnClicked += ReturnToServerList;
}
} }
} }
@@ -31,8 +31,6 @@ namespace Barotrauma
private bool masterServerResponded; private bool masterServerResponded;
private IRestResponse masterServerResponse; private IRestResponse masterServerResponse;
private GUIButton refreshButton;
private float[] columnRelativeWidth; private float[] columnRelativeWidth;
//filters //filters
@@ -142,7 +140,7 @@ namespace Barotrauma
OnClicked = GameMain.MainMenuScreen.ReturnToMainMenu OnClicked = GameMain.MainMenuScreen.ReturnToMainMenu
}; };
refreshButton = new GUIButton(new RectTransform(new Vector2(buttonContainer.Rect.Height / (float)buttonContainer.Rect.Width, 0.9f), buttonContainer.RectTransform, Anchor.Center), var refreshButton = new GUIButton(new RectTransform(new Vector2(buttonContainer.Rect.Height / (float)buttonContainer.Rect.Width, 0.9f), buttonContainer.RectTransform, Anchor.Center),
"", style: "GUIButtonRefresh") { "", style: "GUIButtonRefresh") {
ToolTip = TextManager.Get("ServerListRefresh"), ToolTip = TextManager.Get("ServerListRefresh"),
@@ -204,23 +202,7 @@ namespace Barotrauma
private bool RefreshJoinButtonState(GUIComponent component, object obj) private bool RefreshJoinButtonState(GUIComponent component, object obj)
{ {
if (obj == null || waitingForRefresh) { return false; } if (obj == null || waitingForRefresh) return false;
if (!string.IsNullOrWhiteSpace(clientNameBox.Text) && !string.IsNullOrWhiteSpace(ipBox.Text))
{
joinButton.Enabled = true;
}
else
{
joinButton.Enabled = false;
}
return true;
}
private bool RefreshJoinButtonState(GUIComponent component, object obj)
{
if (obj == null || waitingForRefresh) { return false; }
if (!string.IsNullOrWhiteSpace(clientNameBox.Text) && !string.IsNullOrWhiteSpace(ipBox.Text)) if (!string.IsNullOrWhiteSpace(clientNameBox.Text) && !string.IsNullOrWhiteSpace(ipBox.Text))
{ {
@@ -248,6 +230,16 @@ namespace Barotrauma
joinButton.Enabled = false; joinButton.Enabled = false;
} }
if (!string.IsNullOrWhiteSpace(clientNameBox.Text))
{
joinButton.Enabled = true;
}
else
{
clientNameBox.Flash();
joinButton.Enabled = false;
}
ServerInfo serverInfo; ServerInfo serverInfo;
try try
{ {
@@ -272,11 +264,8 @@ namespace Barotrauma
ipBox.Text = null; ipBox.Text = null;
joinButton.Enabled = false; joinButton.Enabled = false;
new GUITextBlock(new RectTransform(new Vector2(1.0f, 1.0f), serverList.Content.RectTransform), new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), serverList.Content.RectTransform),
TextManager.Get("RefreshingServerList"), textAlignment: Alignment.Center) TextManager.Get("RefreshingServerList"));
{
CanBeFocused = false
};
CoroutineManager.StartCoroutine(WaitForRefresh()); CoroutineManager.StartCoroutine(WaitForRefresh());
@@ -297,19 +286,17 @@ namespace Barotrauma
if (!SteamManager.GetServers(AddToServerList, UpdateServerInfo, ServerQueryFinished)) if (!SteamManager.GetServers(AddToServerList, UpdateServerInfo, ServerQueryFinished))
{ {
serverList.ClearChildren(); serverList.ClearChildren();
new GUITextBlock(new RectTransform(new Vector2(1.0f, 1.0f), serverList.Content.RectTransform), new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), serverList.Content.RectTransform),
TextManager.Get("ServerListNoSteamConnection"), textAlignment: Alignment.Center) TextManager.Get("ServerListNoSteamConnection"));
{
CanBeFocused = false
};
} }
} }
else else
{ {
CoroutineManager.StartCoroutine(SendMasterServerRequest()); CoroutineManager.StartCoroutine(SendMasterServerRequest());
waitingForRefresh = false;
} }
waitingForRefresh = false;
refreshDisableTimer = DateTime.Now + AllowedRefreshInterval; refreshDisableTimer = DateTime.Now + AllowedRefreshInterval;
yield return CoroutineStatus.Success; yield return CoroutineStatus.Success;
@@ -374,11 +361,8 @@ namespace Barotrauma
serverList.Content.ClearChildren(); serverList.Content.ClearChildren();
if (serverInfos.Count() == 0) if (serverInfos.Count() == 0)
{ {
new GUITextBlock(new RectTransform(new Vector2(1.0f, 1.0f), serverList.Content.RectTransform), new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), serverList.Content.RectTransform),
TextManager.Get("NoServers"), textAlignment: Alignment.Center) TextManager.Get("NoServers"));
{
CanBeFocused = false
};
return; return;
} }
foreach (ServerInfo serverInfo in serverInfos) foreach (ServerInfo serverInfo in serverInfos)
@@ -518,7 +502,6 @@ namespace Barotrauma
UserData = "noresults" UserData = "noresults"
}; };
} }
waitingForRefresh = false;
} }
private IEnumerable<object> SendMasterServerRequest() private IEnumerable<object> SendMasterServerRequest()
@@ -478,7 +478,7 @@ namespace Barotrauma
} }
else else
{ {
var downloadBtn = new GUIButton(new RectTransform(new Point((int)(32 * GUI.Scale)), rightColumn.RectTransform), "+", style: null) var downloadBtn = new GUIButton(new RectTransform(new Point(32, 32), rightColumn.RectTransform), "+", style: null)
{ {
Font = GUI.LargeFont, Font = GUI.LargeFont,
Color = new Color(38, 65, 86, 255), Color = new Color(38, 65, 86, 255),
@@ -360,9 +360,6 @@ namespace Barotrauma
if (GameMain.GameSession?.CrewManager != null && GameMain.GameSession.CrewManager.AddOrder(newOrder, newOrder.FadeOutTime)) if (GameMain.GameSession?.CrewManager != null && GameMain.GameSession.CrewManager.AddOrder(newOrder, newOrder.FadeOutTime))
{ {
Character.Speak(newOrder.GetChatMessage("", Character.CurrentHull?.DisplayName, givingOrderToSelf: false), ChatMessageType.Order); Character.Speak(newOrder.GetChatMessage("", Character.CurrentHull?.DisplayName, givingOrderToSelf: false), ChatMessageType.Order);
#if SERVER
GameMain.Server.SendOrderChatMessage(new OrderChatMessage(newOrder, "", Character.CurrentHull, null, Character));
#endif
} }
} }
} }
@@ -115,9 +115,9 @@ namespace Barotrauma
Vector2 currTargetSimPos = Vector2.Zero; Vector2 currTargetSimPos = Vector2.Zero;
currTargetSimPos = Target.SimPosition; currTargetSimPos = Target.SimPosition;
// Take the sub position into account in the sim pos // Take the sub position into account in the sim pos
if (character.Submarine == null && Target.Submarine != null) if (SteeringManager != PathSteering && character.Submarine == null && Target.Submarine != null)
{ {
//currTargetSimPos += Target.Submarine.SimPosition; currTargetSimPos += Target.Submarine.SimPosition;
} }
else if (character.Submarine != null && Target.Submarine == null) else if (character.Submarine != null && Target.Submarine == null)
{ {
@@ -1,6 +1,8 @@
using FarseerPhysics.Dynamics; using FarseerPhysics.Dynamics;
using Microsoft.Xna.Framework; using Microsoft.Xna.Framework;
using System; using System;
using FarseerPhysics;
using Barotrauma.Extensions;
namespace Barotrauma namespace Barotrauma
{ {
@@ -43,9 +45,9 @@ namespace Barotrauma
steering += DoSteeringWander(weight); steering += DoSteeringWander(weight);
} }
public void SteeringAvoid(float deltaTime, float lookAheadDistance, float weight = 1) public void SteeringAvoid(float deltaTime, float lookAheadDistance, float weight = 1, Vector2? heading = null)
{ {
steering += DoSteeringAvoid(deltaTime, lookAheadDistance, weight); steering += DoSteeringAvoid(deltaTime, lookAheadDistance, weight, heading);
} }
public void SteeringManual(float deltaTime, Vector2 velocity) public void SteeringManual(float deltaTime, Vector2 velocity)
@@ -127,10 +129,12 @@ namespace Barotrauma
return newSteering; return newSteering;
} }
protected virtual Vector2 DoSteeringAvoid(float deltaTime, float lookAheadDistance, float weight) protected virtual Vector2 DoSteeringAvoid(float deltaTime, float lookAheadDistance, float weight, Vector2? heading = null)
{ {
if (steering == Vector2.Zero || host.Steering == Vector2.Zero) return Vector2.Zero; if (steering == Vector2.Zero || host.Steering == Vector2.Zero)
{
return Vector2.Zero;
}
float maxDistance = lookAheadDistance; float maxDistance = lookAheadDistance;
if (rayCastTimer <= 0.0f) if (rayCastTimer <= 0.0f)
{ {
@@ -144,6 +148,7 @@ namespace Barotrauma
} }
else else
{ {
// TODO: Doesn't take items into account (like turrets)
if (closestBody.UserData is Structure closestStructure) if (closestBody.UserData is Structure closestStructure)
{ {
Vector2 obstaclePosition = Submarine.LastPickedPosition; Vector2 obstaclePosition = Submarine.LastPickedPosition;
@@ -155,37 +160,45 @@ namespace Barotrauma
{ {
obstaclePosition.X = closestStructure.SimPosition.X; obstaclePosition.X = closestStructure.SimPosition.X;
} }
avoidObstaclePos = obstaclePosition; avoidObstaclePos = obstaclePosition;
//avoidSteering = Vector2.Normalize(Submarine.LastPickedPosition - obstaclePosition);
} }
/*else if (closestBody.UserData is Item)
{
avoidSteering = Vector2.Normalize(Submarine.LastPickedPosition - item.SimPosition);
}*/
else else
{ {
avoidObstaclePos = Submarine.LastPickedPosition; avoidObstaclePos = Submarine.LastPickedPosition;
//avoidSteering = Vector2.Normalize(host.SimPosition - Submarine.LastPickedPosition);
} }
} }
} }
else else
{ {
rayCastTimer -= deltaTime; rayCastTimer -= deltaTime;
} }
if (!avoidObstaclePos.HasValue)
if (!avoidObstaclePos.HasValue) return Vector2.Zero; {
return Vector2.Zero;
}
Vector2 diff = avoidObstaclePos.Value - host.SimPosition; Vector2 diff = avoidObstaclePos.Value - host.SimPosition;
float dist = diff.Length(); float dist = diff.Length();
if (dist > maxDistance) return Vector2.Zero; if (dist > maxDistance)
{
return -diff * (1.0f - dist / maxDistance) * weight; return Vector2.Zero;
}
if (heading.HasValue)
{
var f = heading ?? host.Steering;
// Avoid to left or right depending on the current heading
Vector2 relativeVector = Vector2.Normalize(diff) - Vector2.Normalize(f);
var dir = relativeVector.X > 0 ? diff.Right() : diff.Left();
float factor = 1.0f - Math.Min(dist / maxDistance, 1);
return dir * factor * weight;
}
else
{
// Doesn't work right because it effectively just slows down or reverses the movement, where as we'd like to go right or left to avoid the target.
// There's also another issue, which also affects going right or left: the raycast doesn't hit anything if we turn too much -> avoiding doesn't work well.
// Could probably "remember" the avoidance a bit longer so that the avoid steering is not immedieately disgarded, but kept for a while and reduced gradually?
return -diff * (1.0f - dist / maxDistance) * weight;
}
} }
} }
} }
@@ -45,7 +45,7 @@ namespace Barotrauma
public bool PauseOnFocusLost { get; set; } = true; public bool PauseOnFocusLost { get; set; } = true;
public bool MuteOnFocusLost { get; set; } public bool MuteOnFocusLost { get; set; }
public bool UseDirectionalVoiceChat { get; set; } = true; public bool UseDirectionalVoiceChat { get; set; }
public enum VoiceMode public enum VoiceMode
{ {
@@ -206,7 +206,7 @@ namespace Barotrauma
{ {
voiceChatVolume = MathHelper.Clamp(value, 0.0f, 1.0f); voiceChatVolume = MathHelper.Clamp(value, 0.0f, 1.0f);
#if CLIENT #if CLIENT
GameMain.SoundManager?.SetCategoryGainMultiplier("voip", voiceChatVolume * 5.0f); GameMain.SoundManager?.SetCategoryGainMultiplier("voip", voiceChatVolume);
#endif #endif
} }
} }
@@ -821,6 +821,54 @@ namespace Barotrauma
VoiceSetting = voiceSetting; VoiceSetting = voiceSetting;
} }
} }
if (!SelectedContentPackages.Any())
{
var availablePackage = ContentPackage.List.FirstOrDefault(cp => cp.IsCompatible() && cp.CorePackage);
if (availablePackage != null)
{
SelectedContentPackages.Add(availablePackage);
}
}
//save to get rid of the invalid selected packages in the config file
if (missingPackagePaths.Count > 0 || incompatiblePackages.Count > 0) { SaveNewPlayerConfig(); }
}
#endregion
#region Save DefaultConfig
private void SaveNewDefaultConfig()
{
XDocument doc = new XDocument();
if (doc.Root == null)
{
doc.Add(new XElement("config"));
}
doc.Root.Add(
new XAttribute("language", TextManager.Language),
new XAttribute("masterserverurl", MasterServerUrl),
new XAttribute("autocheckupdates", AutoCheckUpdates),
new XAttribute("musicvolume", musicVolume),
new XAttribute("soundvolume", soundVolume),
new XAttribute("voicechatvolume", voiceChatVolume),
new XAttribute("verboselogging", VerboseLogging),
new XAttribute("savedebugconsolelogs", SaveDebugConsoleLogs),
new XAttribute("enablesplashscreen", EnableSplashScreen),
new XAttribute("usesteammatchmaking", useSteamMatchmaking),
new XAttribute("quickstartsub", QuickStartSubmarineName),
new XAttribute("requiresteamauthentication", requireSteamAuthentication),
new XAttribute("aimassistamount", aimAssistAmount));
if (!ShowUserStatisticsPrompt)
{
doc.Root.Add(new XAttribute("senduserstatistics", sendUserStatistics));
}
if (WasGameUpdated)
{
doc.Root.Add(new XAttribute("wasgameupdated", true));
}
useSteamMatchmaking = doc.Root.GetAttributeBool("usesteammatchmaking", useSteamMatchmaking); useSteamMatchmaking = doc.Root.GetAttributeBool("usesteammatchmaking", useSteamMatchmaking);
requireSteamAuthentication = doc.Root.GetAttributeBool("requiresteamauthentication", requireSteamAuthentication); requireSteamAuthentication = doc.Root.GetAttributeBool("requiresteamauthentication", requireSteamAuthentication);
@@ -609,7 +609,8 @@ namespace Barotrauma
foreach (InterestingPosition pos in positionsOfInterest) foreach (InterestingPosition pos in positionsOfInterest)
{ {
if (pos.PositionType != PositionType.MainPath || pos.Position.X < 5000 || pos.Position.X > Size.X - 5000) continue; if (pos.PositionType != PositionType.MainPath || pos.Position.X < 5000 || pos.Position.X > Size.X - 5000) continue;
if (Math.Abs(pos.Position.X - StartPosition.X) < minWidth * 2 || Math.Abs(pos.Position.X - EndPosition.X) < minWidth * 2) continue; if (Math.Abs(pos.Position.X - StartPosition.X) < 10000) continue;
if (Math.Abs(pos.Position.Y - StartPosition.Y) < 10000) continue;
if (GetTooCloseCells(pos.Position.ToVector2(), minWidth * 0.7f).Count > 0) continue; if (GetTooCloseCells(pos.Position.ToVector2(), minWidth * 0.7f).Count > 0) continue;
iceChunkPositions.Add(pos.Position); iceChunkPositions.Add(pos.Position);
} }
@@ -301,10 +301,6 @@ namespace Barotrauma
#endif #endif
spriteColor = prefab.SpriteColor; spriteColor = prefab.SpriteColor;
if (sp.IsHorizontal.HasValue) if (sp.IsHorizontal.HasValue)
{
IsHorizontal = sp.IsHorizontal.Value;
}
else if (ResizeHorizontal && !ResizeVertical)
{ {
IsHorizontal = true; IsHorizontal = true;
} }
@@ -349,7 +345,7 @@ namespace Barotrauma
} }
// Only add ai targets automatically to submarine/outpost walls // Only add ai targets automatically to submarine/outpost walls
if (aiTarget == null && HasBody && Tags.Contains("wall") && submarine != null && !Prefab.NoAITarget) if (aiTarget == null && HasBody && Tags.Contains("wall") && submarine != null)
{ {
aiTarget = new AITarget(this); aiTarget = new AITarget(this);
} }
@@ -184,11 +184,6 @@ namespace Barotrauma
sp.Tags.Add(tag.Trim().ToLowerInvariant()); sp.Tags.Add(tag.Trim().ToLowerInvariant());
} }
if (element.Attribute("ishorizontal") != null)
{
sp.IsHorizontal = element.GetAttributeBool("ishorizontal", false);
}
foreach (XElement subElement in element.Elements()) foreach (XElement subElement in element.Elements())
{ {
switch (subElement.Name.ToString()) switch (subElement.Name.ToString())