(ad567dea) v0.9.7.1

This commit is contained in:
Juan Pablo Arce
2020-03-04 19:54:29 -03:00
parent 3c09ebe02f
commit 3e99a49383
212 changed files with 1970 additions and 3265 deletions
@@ -14,7 +14,7 @@ namespace Barotrauma
partial class FireSource : ISpatialEntity
{
const float OxygenConsumption = 50.0f;
const float GrowSpeed = 20.0f;
const float GrowSpeed = 5.0f;
protected Hull hull;
@@ -378,7 +378,7 @@ namespace Barotrauma
delta = Math.Min(((hull2.Pressure + subOffset.Y) - hull1.Pressure) * 5.0f * sizeModifier, Math.Min(hull2.WaterVolume, hull2.Volume));
//make sure not to place more water to the target room than it can hold
delta = Math.Min(delta, hull1.Volume * Hull.MaxCompress - (hull1.WaterVolume));
delta = Math.Min(delta, hull1.Volume + Hull.MaxCompress - (hull1.WaterVolume));
hull1.WaterVolume += delta;
hull2.WaterVolume -= delta;
if (hull1.WaterVolume > hull1.Volume)
@@ -399,7 +399,7 @@ namespace Barotrauma
delta = Math.Min((hull1.Pressure - (hull2.Pressure + subOffset.Y)) * 5.0f * sizeModifier, Math.Min(hull1.WaterVolume, hull1.Volume));
//make sure not to place more water to the target room than it can hold
delta = Math.Min(delta, hull2.Volume * Hull.MaxCompress - (hull2.WaterVolume));
delta = Math.Min(delta, hull2.Volume + Hull.MaxCompress - (hull2.WaterVolume));
hull1.WaterVolume -= delta;
hull2.WaterVolume += delta;
if (hull2.WaterVolume > hull2.Volume)
@@ -414,14 +414,14 @@ namespace Barotrauma
{
float avg = (hull1.Surface + hull2.Surface) / 2.0f;
if (hull1.WaterVolume < hull1.Volume / Hull.MaxCompress &&
if (hull1.WaterVolume < hull1.Volume - Hull.MaxCompress &&
hull1.Surface + hull1.WaveY[hull1.WaveY.Length - 1] < rect.Y)
{
hull1.WaveVel[hull1.WaveY.Length - 1] = (avg - (hull1.Surface + hull1.WaveY[hull1.WaveY.Length - 1])) * 0.1f;
hull1.WaveVel[hull1.WaveY.Length - 2] = hull1.WaveVel[hull1.WaveY.Length - 1];
}
if (hull2.WaterVolume < hull2.Volume / Hull.MaxCompress &&
if (hull2.WaterVolume < hull2.Volume - Hull.MaxCompress &&
hull2.Surface + hull2.WaveY[0] < rect.Y)
{
hull2.WaveVel[0] = (avg - (hull2.Surface + hull2.WaveY[0])) * 0.1f;
@@ -436,12 +436,12 @@ namespace Barotrauma
//lower room is full of water
if (hull2.Pressure + subOffset.Y > hull1.Pressure && hull2.WaterVolume > 0.0f)
{
float delta = Math.Min(hull2.WaterVolume - hull2.Volume + (hull2.Volume * Hull.MaxCompress), deltaTime * 8000.0f * sizeModifier);
float delta = Math.Min(hull2.WaterVolume - hull2.Volume + Hull.MaxCompress, deltaTime * 8000.0f * sizeModifier);
//make sure not to place more water to the target room than it can hold
if (hull1.WaterVolume + delta > hull1.Volume * Hull.MaxCompress)
if (hull1.WaterVolume + delta > hull1.Volume + Hull.MaxCompress)
{
delta -= (hull1.WaterVolume + delta) - (hull1.Volume * Hull.MaxCompress);
delta -= (hull1.WaterVolume + delta) - (hull1.Volume + Hull.MaxCompress);
}
delta = Math.Max(delta, 0.0f);
@@ -469,9 +469,9 @@ namespace Barotrauma
float delta = Math.Min(hull1.WaterVolume, deltaTime * 25000f * sizeModifier);
//make sure not to place more water to the target room than it can hold
if (hull2.WaterVolume + delta > hull2.Volume * Hull.MaxCompress)
if (hull2.WaterVolume + delta > hull2.Volume + Hull.MaxCompress)
{
delta -= (hull2.WaterVolume + delta) - (hull2.Volume * Hull.MaxCompress);
delta -= (hull2.WaterVolume + delta) - (hull2.Volume + Hull.MaxCompress);
}
hull1.WaterVolume -= delta;
hull2.WaterVolume += delta;
@@ -489,7 +489,7 @@ namespace Barotrauma
if (open > 0.0f)
{
if (hull1.WaterVolume > hull1.Volume / Hull.MaxCompress && hull2.WaterVolume > hull2.Volume / Hull.MaxCompress)
if (hull1.WaterVolume > hull1.Volume - Hull.MaxCompress && hull2.WaterVolume > hull2.Volume - Hull.MaxCompress)
{
float avgLethality = (hull1.LethalPressure + hull2.LethalPressure) / 2.0f;
hull1.LethalPressure = avgLethality;
@@ -515,10 +515,10 @@ namespace Barotrauma
//the larger the gap is, the faster the water flows
float sizeModifier = size * open * open;
float delta = hull1.Volume * Hull.MaxCompress * sizeModifier * deltaTime;
float delta = Hull.MaxCompress * sizeModifier * deltaTime;
//make sure not to place more water to the target room than it can hold
delta = Math.Min(delta, hull1.Volume * Hull.MaxCompress - hull1.WaterVolume);
delta = Math.Min(delta, hull1.Volume + Hull.MaxCompress - hull1.WaterVolume);
hull1.WaterVolume += delta;
if (hull1.WaterVolume > hull1.Volume) hull1.Pressure += 0.5f;
@@ -541,7 +541,7 @@ namespace Barotrauma
higherSurface = hull1.Surface;
lowerSurface = rect.Y;
if (hull1.WaterVolume < hull1.Volume / Hull.MaxCompress &&
if (hull1.WaterVolume < hull1.Volume - Hull.MaxCompress &&
hull1.Surface < rect.Y)
{
if (rect.X > hull1.Rect.X + hull1.Rect.Width / 2.0f)
@@ -576,7 +576,7 @@ namespace Barotrauma
{
flowForce = new Vector2(0.0f, delta);
}
if (hull1.WaterVolume >= hull1.Volume / Hull.MaxCompress)
if (hull1.WaterVolume >= hull1.Volume - Hull.MaxCompress)
{
hull1.LethalPressure += (Submarine != null && Submarine.AtDamageDepth) ? 100.0f * deltaTime : 10.0f * deltaTime;
}
@@ -26,9 +26,8 @@ namespace Barotrauma
public static float WaveSpread = 0.05f;
public static float WaveDampening = 0.05f;
//how much excess water the room can contain, relative to the volume of the room.
//needed to make it possible for pressure to "push" water up through U-shaped hull configurations
public const float MaxCompress = 1.05f;
//how much excess water the room can contain (= more than the volume of the room)
public const float MaxCompress = 10000f;
public readonly Dictionary<string, SerializableProperty> properties;
public Dictionary<string, SerializableProperty> SerializableProperties
@@ -155,7 +154,7 @@ namespace Barotrauma
set
{
if (!MathUtils.IsValid(value)) return;
waterVolume = MathHelper.Clamp(value, 0.0f, Volume * MaxCompress);
waterVolume = MathHelper.Clamp(value, 0.0f, Volume + MaxCompress);
if (waterVolume < Volume) Pressure = rect.Y - rect.Height + waterVolume / rect.Width;
if (waterVolume > 0.0f) update = true;
}
@@ -322,7 +321,6 @@ namespace Barotrauma
CeilingHeight = ConvertUnits.ToDisplayUnits(upperPickedPos.Y - lowerPickedPos.Y);
}
}
Pressure = rect.Y - rect.Height + waterVolume / rect.Width;
}
public void AddToGrid(Submarine submarine)
@@ -875,7 +873,7 @@ namespace Barotrauma
var hull = new Hull(MapEntityPrefab.Find(null, "hull"), rect, submarine)
{
WaterVolume = element.GetAttributeFloat("pressure", 0.0f),
waterVolume = element.GetAttributeFloat("pressure", 0.0f),
ID = (ushort)int.Parse(element.Attribute("ID").Value)
};
@@ -310,7 +310,6 @@ namespace Barotrauma
if (Submarine.MainSub != null)
{
Rectangle dockedSubBorders = Submarine.MainSub.GetDockedBorders();
dockedSubBorders.Inflate(dockedSubBorders.Size.ToVector2() * 0.05f);
minWidth = Math.Max(minWidth, Math.Max(dockedSubBorders.Width, dockedSubBorders.Height));
minWidth = Math.Min(minWidth, maxWidth);
}
@@ -1623,7 +1622,7 @@ namespace Barotrauma
EndOutpost = outpost;
if (GameMain.GameSession?.EndLocation != null) { outpost.Name = GameMain.GameSession.EndLocation.Name; }
}
}
}
}
private bool IsModeStartOutpostCompatible()
@@ -415,10 +415,10 @@ namespace Barotrauma
string biomeName = biomeNames[i].Trim().ToLowerInvariant();
if (biomeName == "none") { continue; }
Biome matchingBiome = biomes.Find(b => b.Identifier.Equals(biomeName, StringComparison.OrdinalIgnoreCase));
Biome matchingBiome = biomes.Find(b => b.Identifier.ToLowerInvariant() == biomeName);
if (matchingBiome == null)
{
matchingBiome = biomes.Find(b => b.DisplayName.Equals(biomeName, StringComparison.OrdinalIgnoreCase));
matchingBiome = biomes.Find(b => b.DisplayName.ToLowerInvariant() == biomeName);
if (matchingBiome == null)
{
DebugConsole.ThrowError("Error in level generation parameters: biome \"" + biomeName + "\" not found.");
@@ -487,7 +487,7 @@ namespace Barotrauma
mainElement = doc.Root.FirstElement();
biomeElements.Clear();
levelParamElements.Clear();
DebugConsole.NewMessage($"Overriding the level generation parameters and biomes with '{file.Path}'", Color.Yellow);
DebugConsole.NewMessage($"Overriding the level generation parameters with '{file.Path}'", Color.Yellow);
}
else if (biomeElements.Any() || levelParamElements.Any())
{
@@ -497,22 +497,7 @@ namespace Barotrauma
foreach (XElement element in mainElement.Elements())
{
if (element.IsOverride())
{
if (element.FirstElement().Name.ToString().Equals("biomes", StringComparison.OrdinalIgnoreCase))
{
biomeElements.Clear();
biomeElements.AddRange(element.FirstElement().Elements());
DebugConsole.NewMessage($"Overriding biomes with '{file.Path}'", Color.Yellow);
}
else
{
levelParamElements.Clear();
DebugConsole.NewMessage($"Overriding the level generation parameters with '{file.Path}'", Color.Yellow);
levelParamElements.AddRange(element.Elements());
}
}
else if (element.Name.ToString().Equals("biomes", StringComparison.OrdinalIgnoreCase))
if (element.Name.ToString().ToLowerInvariant() == "biomes")
{
biomeElements.AddRange(element.Elements());
}
@@ -277,7 +277,7 @@ namespace Barotrauma.RuinGeneration
{
foreach (XElement subElement in element2.Elements())
{
if (subElement.Name.ToString().Equals("chooseone", StringComparison.OrdinalIgnoreCase))
if (subElement.Name.ToString().ToLowerInvariant() == "chooseone")
{
groupIndex++;
LoadEntities(subElement, ref groupIndex);
@@ -390,7 +390,7 @@ namespace Barotrauma.RuinGeneration
SourceEntityIdentifier = element.GetAttributeString("sourceentity", "");
foreach (XElement subElement in element.Elements())
{
if (subElement.Name.ToString().Equals("wire", StringComparison.OrdinalIgnoreCase))
if (subElement.Name.ToString().ToLowerInvariant() == "wire")
{
WireConnection = new Pair<string, string>(
subElement.GetAttributeString("from", ""),
@@ -721,10 +721,8 @@ namespace Barotrauma.RuinGeneration
//doors create their own gaps, don't create an additional one if there's a door at this
bool doorFound = false;
foreach (Item item in Item.ItemList)
foreach (Door door in doors)
{
var door = item.GetComponent<Door>();
if (door == null) { continue; }
if (Math.Abs(door.Item.WorldPosition.X - gapRect.Value.Center.X) < 5 &&
Math.Abs(door.Item.WorldPosition.Y - gapRect.Value.Center.Y) < 5)
{
@@ -284,7 +284,7 @@ namespace Barotrauma
foreach (LocationConnection connection in connections)
{
float centerDist = Vector2.Distance(connection.CenterPos, mapCenter);
connection.Difficulty = MathHelper.Clamp(((1.0f - centerDist / mapRadius) * 100) + Rand.Range(-10.0f, 0.0f, Rand.RandSync.Server), 0, 100);
connection.Difficulty = MathHelper.Clamp(((1.0f - centerDist / mapRadius) * 100) + Rand.Range(-10.0f, 10.0f, Rand.RandSync.Server), 0, 100);
}
AssignBiomes();
@@ -463,7 +463,7 @@ namespace Barotrauma
bool disallowedFound = false;
foreach (string disallowedLocationName in typeChange.DisallowedAdjacentLocations)
{
if (location.Connections.Any(c => c.OtherLocation(location).Type.Identifier.Equals(disallowedLocationName, StringComparison.OrdinalIgnoreCase)))
if (location.Connections.Any(c => c.OtherLocation(location).Type.Identifier.ToLowerInvariant() == disallowedLocationName.ToLowerInvariant()))
{
disallowedFound = true;
break;
@@ -475,7 +475,7 @@ namespace Barotrauma
bool requiredFound = false;
foreach (string requiredLocationName in typeChange.RequiredAdjacentLocations)
{
if (location.Connections.Any(c => c.OtherLocation(location).Type.Identifier.Equals(requiredLocationName, StringComparison.OrdinalIgnoreCase)))
if (location.Connections.Any(c => c.OtherLocation(location).Type.Identifier.ToLowerInvariant() == requiredLocationName.ToLowerInvariant()))
{
requiredFound = true;
break;
@@ -499,7 +499,7 @@ namespace Barotrauma
if (selectedTypeChange != null)
{
string prevName = location.Name;
location.ChangeType(LocationType.List.Find(lt => lt.Identifier.Equals(selectedTypeChange.ChangeToType, StringComparison.OrdinalIgnoreCase)));
location.ChangeType(LocationType.List.Find(lt => lt.Identifier.ToLowerInvariant() == selectedTypeChange.ChangeToType.ToLowerInvariant()));
ChangeLocationType(location, prevName, selectedTypeChange);
location.TypeChangeTimer = -1;
break;
@@ -553,12 +553,13 @@ namespace Barotrauma
string prevLocationName = location.Name;
LocationType prevLocationType = location.Type;
location.Discovered = true;
location.ChangeType(LocationType.List.Find(lt => lt.Identifier.Equals(locationType, StringComparison.OrdinalIgnoreCase)));
location.ChangeType(LocationType.List.Find(lt => lt.Identifier.ToLowerInvariant() == locationType.ToLowerInvariant()));
location.TypeChangeTimer = typeChangeTimer;
location.MissionsCompleted = missionsCompleted;
if (showNotifications && prevLocationType != location.Type)
{
var change = prevLocationType.CanChangeTo.Find(c => c.ChangeToType.Equals(location.Type.Identifier, StringComparison.OrdinalIgnoreCase));
var change = prevLocationType.CanChangeTo.Find(c =>
c.ChangeToType.ToLowerInvariant() == location.Type.Identifier.ToLowerInvariant());
if (change != null)
{
ChangeLocationType(location, prevLocationName, change);
@@ -43,6 +43,7 @@ namespace Barotrauma
protected string originalName;
protected string identifier;
protected ContentPackage contentPackage;
public Sprite sprite;
@@ -242,10 +243,7 @@ namespace Barotrauma
/// <param name="identifier">The identifier of the item (if null, the identifier is ignored and the search is done only based on the name)</param>
public static MapEntityPrefab Find(string name, string identifier = null, bool showErrorMessages = true)
{
if (name != null)
{
name = name.ToLowerInvariant();
}
if (name != null) name = name.ToLowerInvariant();
foreach (MapEntityPrefab prefab in List)
{
if (identifier != null)
@@ -256,17 +254,12 @@ namespace Barotrauma
}
else
{
if (string.IsNullOrEmpty(name)) { return prefab; }
if (string.IsNullOrEmpty(name)) return prefab;
}
}
if (!string.IsNullOrEmpty(name))
{
if (prefab.Name.Equals(name, StringComparison.OrdinalIgnoreCase) ||
prefab.originalName.Equals(name, StringComparison.OrdinalIgnoreCase) ||
(prefab.Aliases != null && prefab.Aliases.Any(a => a.Equals(name, StringComparison.OrdinalIgnoreCase))))
{
return prefab;
}
if (prefab.Name.ToLowerInvariant() == name || prefab.originalName.ToLowerInvariant() == name || (prefab.Aliases != null && prefab.Aliases.Any(a => a.ToLowerInvariant() == name))) return prefab;
}
}
@@ -289,9 +282,27 @@ namespace Barotrauma
/// <summary>
/// Check if the name or any of the aliases of this prefab match the given name.
/// </summary>
public bool NameMatches(string name, StringComparison comparisonType) => originalName.Equals(name, comparisonType) || (Aliases != null && Aliases.Any(a => a.Equals(name, comparisonType)));
public bool NameMatches(string name, bool caseSensitive = false)
{
if (caseSensitive)
{
return this.originalName == name || (Aliases != null && Aliases.Any(a => a == name));
}
else
{
name = name.ToLowerInvariant();
return this.originalName.ToLowerInvariant() == name || (Aliases != null && Aliases.Any(a => a.ToLowerInvariant() == name));
}
}
public bool NameMatches(IEnumerable<string> allowedNames, StringComparison comparisonType) => allowedNames.Any(n => NameMatches(n, comparisonType));
public bool NameMatches(IEnumerable<string> allowedNames, bool caseSensitive = false)
{
foreach (string name in allowedNames)
{
if (NameMatches(name, caseSensitive)) return true;
}
return false;
}
public bool IsLinkAllowed(MapEntityPrefab target)
{
@@ -260,15 +260,15 @@ namespace Barotrauma
}
#if CLIENT
if (subElement.GetAttributeBool("fliphorizontal", false))
if (subElement.GetAttributeBool("fliphorizontal", false))
sp.sprite.effects = SpriteEffects.FlipHorizontally;
if (subElement.GetAttributeBool("flipvertical", false))
if (subElement.GetAttributeBool("flipvertical", false))
sp.sprite.effects = SpriteEffects.FlipVertically;
#endif
sp.canSpriteFlipX = subElement.GetAttributeBool("canflipx", true);
sp.canSpriteFlipY = subElement.GetAttributeBool("canflipy", true);
if (subElement.Attribute("name") == null && !string.IsNullOrWhiteSpace(sp.Name))
{
sp.sprite.Name = sp.Name;
@@ -286,10 +286,12 @@ namespace Barotrauma
sp.BackgroundSprite.RelativeOrigin = subElement.GetAttributeVector2("origin", new Vector2(0.5f, 0.5f));
}
#if CLIENT
if (subElement.GetAttributeBool("fliphorizontal", false)) { sp.BackgroundSprite.effects = SpriteEffects.FlipHorizontally; }
if (subElement.GetAttributeBool("flipvertical", false)) { sp.BackgroundSprite.effects = SpriteEffects.FlipVertically; }
sp.BackgroundSpriteColor = subElement.GetAttributeColor("color", Color.White);
if (subElement.GetAttributeBool("fliphorizontal", false))
sp.BackgroundSprite.effects = SpriteEffects.FlipHorizontally;
if (subElement.GetAttributeBool("flipvertical", false))
sp.BackgroundSprite.effects = SpriteEffects.FlipVertically;
#endif
break;
}
}
@@ -77,18 +77,7 @@ namespace Barotrauma
private SubmarineBody subBody;
public readonly Dictionary<Submarine, DockingPort> ConnectedDockingPorts;
public IEnumerable<Submarine> DockedTo
{
get
{
if (ConnectedDockingPorts == null) { yield break; }
foreach (Submarine sub in ConnectedDockingPorts.Keys)
{
yield return sub;
}
}
}
public readonly List<Submarine> DockedTo;
private static Vector2 lastPickedPosition;
private static float lastPickedFraction;
@@ -453,7 +442,7 @@ namespace Barotrauma
}
}
ConnectedDockingPorts = new Dictionary<Submarine, DockingPort>();
DockedTo = new List<Submarine>();
FreeID();
}
@@ -511,7 +500,7 @@ namespace Barotrauma
LeftBehindSubDockingPortOccupied = false;
foreach (XElement subElement in element.Elements())
{
if (!subElement.Name.ToString().Equals("linkedsubmarine")) { continue; }
if (subElement.Name.ToString().ToLowerInvariant() != "linkedsubmarine") { continue; }
if (subElement.Attribute("location") == null) { continue; }
subsLeftBehind = true;
@@ -572,32 +561,27 @@ namespace Barotrauma
/// <summary>
/// Returns a rect that contains the borders of this sub and all subs docked to it
/// </summary>
public Rectangle GetDockedBorders(List<Submarine> checkd=null)
public Rectangle GetDockedBorders()
{
if (checkd == null) { checkd = new List<Submarine>(); }
checkd.Add(this);
Rectangle dockedBorders = Borders;
dockedBorders.Y -= dockedBorders.Height;
var connectedSubs = DockedTo.Where(s => !checkd.Contains(s) && !s.IsOutpost).ToList();
var connectedSubs = GetConnectedSubs();
foreach (Submarine dockedSub in connectedSubs)
{
//use docking ports instead of world position to determine
//borders, as world position will not necessarily match where
//the subs are supposed to go
Vector2? expectedLocation = CalculateDockOffset(this, dockedSub);
if (expectedLocation == null) { continue; }
if (dockedSub == this) continue;
Rectangle dockedSubBorders = dockedSub.GetDockedBorders(checkd);
dockedSubBorders.Location += MathUtils.ToPoint(expectedLocation.Value);
Vector2 diff = dockedSub.Submarine == this ? dockedSub.WorldPosition : dockedSub.WorldPosition - WorldPosition;
Rectangle dockedSubBorders = dockedSub.Borders;
dockedSubBorders.Y -= dockedSubBorders.Height;
dockedSubBorders.Location += MathUtils.ToPoint(diff);
dockedBorders.Y = -dockedBorders.Y;
dockedSubBorders.Y = -dockedSubBorders.Y;
dockedBorders = Rectangle.Union(dockedBorders, dockedSubBorders);
dockedBorders.Y = -dockedBorders.Y;
}
dockedBorders.Y += dockedBorders.Height;
return dockedBorders;
}
@@ -1147,37 +1131,25 @@ namespace Barotrauma
prevPosition = position;
}
public void SetPosition(Vector2 position, List<Submarine> checkd=null)
public void SetPosition(Vector2 position)
{
if (!MathUtils.IsValid(position)) return;
if (checkd == null) { checkd = new List<Submarine>(); }
if (checkd.Contains(this)) { return; }
checkd.Add(this);
subBody.SetPosition(position);
foreach (Submarine dockedSub in DockedTo)
foreach (Submarine sub in loaded)
{
Vector2? expectedLocation = CalculateDockOffset(this, dockedSub);
if (expectedLocation == null) { continue; }
if (sub != this && sub.Submarine == this)
{
sub.SetPosition(position + sub.WorldPosition);
sub.Submarine = null;
}
dockedSub.SetPosition(position + expectedLocation.Value, checkd);
}
//Level.Loaded.SetPosition(-position);
//prevPosition = position;
}
public static Vector2? CalculateDockOffset(Submarine sub, Submarine dockedSub)
{
Item myPort = sub.ConnectedDockingPorts.ContainsKey(dockedSub) ? sub.ConnectedDockingPorts[dockedSub].Item : null;
if (myPort == null) { return null; }
Item theirPort = dockedSub.ConnectedDockingPorts.ContainsKey(sub) ? dockedSub.ConnectedDockingPorts[sub].Item : null;
if (theirPort == null) { return null; }
return (myPort.Position - sub.HiddenSubPosition) - (theirPort.Position - dockedSub.HiddenSubPosition);
}
public void Translate(Vector2 amount)
{
if (amount == Vector2.Zero || !MathUtils.IsValid(amount)) return;
@@ -1264,17 +1236,9 @@ namespace Barotrauma
{
if (Path.GetFullPath(savedSubmarines[i].filePath) == fullPath)
{
if (savedSubmarines[i] == MainSub)
{
savedSubmarines.Remove(savedSubmarines[i]);
}
else
{
savedSubmarines[i].Dispose();
}
savedSubmarines[i].Dispose();
}
}
if (File.Exists(filePath))
{
var sub = new Submarine(filePath);
@@ -1592,7 +1556,7 @@ namespace Barotrauma
foreach (Hull hull in matchingHulls)
{
if (string.IsNullOrEmpty(hull.RoomName) || !hull.RoomName.Contains("roomname.", StringComparison.OrdinalIgnoreCase))
if (string.IsNullOrEmpty(hull.RoomName) || !hull.RoomName.ToLowerInvariant().Contains("roomname."))
{
hull.RoomName = hull.CreateRoomName();
}
@@ -1769,7 +1733,7 @@ namespace Barotrauma
if (MainSub == this) MainSub = null;
if (MainSubs[1] == this) MainSubs[1] = null;
ConnectedDockingPorts?.Clear();
DockedTo?.Clear();
}
public void Dispose()
@@ -121,15 +121,9 @@ namespace Barotrauma
idCardTags = new string[0];
#if CLIENT
if (iconSprites == null)
if (iconTexture == null)
{
iconSprites = new Dictionary<SpawnType, Sprite>()
{
{ SpawnType.Path, new Sprite("Content/UI/MainIconsAtlas.png", new Rectangle(0,0,128,128)) },
{ SpawnType.Human, new Sprite("Content/UI/MainIconsAtlas.png", new Rectangle(128,0,128,128)) },
{ SpawnType.Enemy, new Sprite("Content/UI/MainIconsAtlas.png", new Rectangle(256,0,128,128)) },
{ SpawnType.Cargo, new Sprite("Content/UI/MainIconsAtlas.png", new Rectangle(384,0,128,128)) }
};
iconTexture = Sprite.LoadTexture("Content/Map/waypointIcons.png");
}
#endif
@@ -154,12 +148,21 @@ namespace Barotrauma
return clone;
}
public static bool GenerateSubWaypoints(Submarine submarine)
public override bool IsMouseOn(Vector2 position)
{
#if CLIENT
if (IsHidden()) return false;
#endif
return base.IsMouseOn(position);
}
public static void GenerateSubWaypoints(Submarine submarine)
{
if (!Hull.hullList.Any())
{
DebugConsole.ThrowError("Couldn't generate waypoints: no hulls found.");
return false;
return;
}
List<WayPoint> existingWaypoints = WayPointList.FindAll(wp => wp.spawnType == SpawnType.Path);
@@ -462,8 +465,6 @@ namespace Barotrauma
{
door.Body.Enabled = false;
}
return true;
}
private WayPoint FindClosest(int dir, bool horizontalSearch, Vector2 tolerance, Body ignoredBody = null)
@@ -653,7 +654,7 @@ namespace Barotrauma
{
w.assignedJob =
JobPrefab.Get(jobIdentifier) ??
JobPrefab.Prefabs.Find(jp => jp.Name.Equals(jobIdentifier, StringComparison.OrdinalIgnoreCase));
JobPrefab.Prefabs.Find(jp => jp.Name.ToLowerInvariant() == jobIdentifier);
}
w.ladderId = (ushort)element.GetAttributeInt("ladders", 0);