Unstable v0.19.5.0

This commit is contained in:
Juan Pablo Arce
2022-09-14 12:47:17 -03:00
parent 3f2c843247
commit 1fd2a51bbb
158 changed files with 5702 additions and 4813 deletions
@@ -84,7 +84,6 @@ namespace Barotrauma
}
}
private bool disposed = false;
public override Sprite Sprite => null;
@@ -102,9 +101,8 @@ namespace Barotrauma
public override void Dispose()
{
if (disposed) { return; }
disposed = true;
Prefabs.Remove(this);
throw new InvalidOperationException(
$"{nameof(CoreEntityPrefab)}.{nameof(Dispose)} should never be called");
}
}
}
@@ -157,7 +157,7 @@ namespace Barotrauma
public void Delete()
{
Dispose();
Prefabs.Remove(this);
try
{
if (ContentPackage is { Files: { Length: 1 } }
@@ -238,8 +238,8 @@ namespace Barotrauma
//find the edge at the opposite side of the adjacent cell
foreach (GraphEdge otherEdge in adjacentEmptyCell.Edges)
{
if (Vector2.Dot(adjacentEmptyCell.Center - edge.Center, adjacentEmptyCell.Center - otherEdge.Center) < 0 &&
otherEdge.AdjacentCell(adjacentEmptyCell)?.CellType == CellType.Solid)
if (Vector2.Dot(adjacentEmptyCell.Center - edge.Center, adjacentEmptyCell.Center - otherEdge.Center) > 0 &&
otherEdge.AdjacentCell(adjacentEmptyCell)?.CellType != CellType.Solid)
{
adjacentEdge = otherEdge;
break;
@@ -11,15 +11,7 @@ namespace Barotrauma
{
partial class LinkedSubmarinePrefab : MapEntityPrefab
{
//public static readonly PrefabCollection<LinkedSubmarinePrefab> Prefabs = new PrefabCollection<LinkedSubmarinePrefab>();
private bool disposed = false;
public override void Dispose()
{
if (disposed) { return; }
disposed = true;
//Prefabs.Remove(this);
}
public override void Dispose() { }
public readonly SubmarineInfo subInfo;
@@ -1253,7 +1253,7 @@ namespace Barotrauma
{
var characters = GameSession.GetSessionCrewCharacters(CharacterType.Both);
if (!characters.Any()) { return 0; }
return characters.Max(c => (int)c.GetStatValue(StatTypes.ExtraSpecialSalesCount));
return characters.Sum(c => (int)c.GetStatValue(StatTypes.ExtraSpecialSalesCount));
}
public void Discover(bool checkTalents = true)
@@ -280,5 +280,29 @@ namespace Barotrauma
return AllowedLinks.Contains(target.Identifier) || target.AllowedLinks.Contains(Identifier)
|| target.Tags.Any(t => AllowedLinks.Contains(t)) || Tags.Any(t => target.AllowedLinks.Contains(t));
}
protected void LoadDescription(ContentXElement element)
{
Identifier descriptionIdentifier = element.GetAttributeIdentifier("descriptionidentifier", "");
Identifier nameIdentifier = element.GetAttributeIdentifier("nameidentifier", "");
string originalDescription = Description.Value;
if (descriptionIdentifier != Identifier.Empty)
{
Description = TextManager.Get($"EntityDescription.{descriptionIdentifier}");
}
else if (nameIdentifier == Identifier.Empty)
{
Description = TextManager.Get($"EntityDescription.{Identifier}");
}
else
{
Description = TextManager.Get($"EntityDescription.{nameIdentifier}");
}
if (!originalDescription.IsNullOrEmpty())
{
Description = Description.Fallback(originalDescription);
}
}
}
}
@@ -142,8 +142,6 @@ namespace Barotrauma
//only used if the item doesn't have a name/description defined in the currently selected language
Identifier fallbackNameIdentifier = element.GetAttributeIdentifier("fallbacknameidentifier", "");
Identifier descriptionIdentifier = element.GetAttributeIdentifier("descriptionidentifier", "");
Name = TextManager.Get(nameIdentifier.IsEmpty
? $"EntityName.{Identifier}"
: $"EntityName.{nameIdentifier}",
@@ -271,18 +269,7 @@ namespace Barotrauma
tags.Add("wall".ToIdentifier());
}
if (!descriptionIdentifier.IsEmpty)
{
Description = TextManager.Get($"EntityDescription.{descriptionIdentifier}").Fallback(Description);
}
else if (nameIdentifier.IsEmpty)
{
Description = TextManager.Get($"EntityDescription.{Identifier}").Fallback(Description);
}
else
{
Description = TextManager.Get($"EntityDescription.{nameIdentifier}").Fallback(Description);
}
LoadDescription(element);
//backwards compatibility
if (element.GetAttribute("size") == null)
@@ -331,12 +318,6 @@ namespace Barotrauma
throw new NotImplementedException();
}
private bool disposed = false;
public override void Dispose()
{
if (disposed) { return; }
disposed = true;
Prefabs.Remove(this);
}
public override void Dispose() { }
}
}
@@ -1548,6 +1548,7 @@ namespace Barotrauma
element.Add(new XAttribute("description", Info.Description ?? ""));
element.Add(new XAttribute("checkval", Rand.Int(int.MaxValue)));
element.Add(new XAttribute("price", Info.Price));
element.Add(new XAttribute("tier", Info.Tier));
element.Add(new XAttribute("initialsuppliesspawned", Info.InitialSuppliesSpawned));
element.Add(new XAttribute("noitems", Info.NoItems));
element.Add(new XAttribute("lowfuel", !CheckFuel()));