(b0f5305f2) Unstable v0.9.10.0
This commit is contained in:
@@ -136,7 +136,7 @@ namespace Barotrauma
|
||||
if (powered == null || !powered.VulnerableToEMP) continue;
|
||||
if (item.Repairables.Any())
|
||||
{
|
||||
item.Condition -= 100 * EmpStrength * distFactor;
|
||||
item.Condition -= item.MaxCondition * EmpStrength * distFactor;
|
||||
}
|
||||
|
||||
//discharge batteries
|
||||
|
||||
@@ -10,11 +10,14 @@ namespace Barotrauma
|
||||
{
|
||||
partial class ItemAssemblyPrefab : MapEntityPrefab
|
||||
{
|
||||
private string name;
|
||||
private readonly string name;
|
||||
public override string Name { get { return name; } }
|
||||
|
||||
public static readonly PrefabCollection<ItemAssemblyPrefab> Prefabs = new PrefabCollection<ItemAssemblyPrefab>();
|
||||
|
||||
public static readonly string VanillaSaveFolder = Path.Combine("Content", "Items", "Assemblies");
|
||||
public static readonly string SaveFolder = "ItemAssemblies";
|
||||
|
||||
private bool disposed = false;
|
||||
public override void Dispose()
|
||||
{
|
||||
@@ -144,11 +147,14 @@ namespace Barotrauma
|
||||
|
||||
List<string> itemAssemblyFiles = new List<string>();
|
||||
|
||||
//find assembly files in the item assembly folder
|
||||
string directoryPath = Path.Combine("Content", "Items", "Assemblies");
|
||||
if (Directory.Exists(directoryPath))
|
||||
//find assembly files in the item assembly folders
|
||||
if (Directory.Exists(VanillaSaveFolder))
|
||||
{
|
||||
itemAssemblyFiles.AddRange(Directory.GetFiles(directoryPath));
|
||||
itemAssemblyFiles.AddRange(Directory.GetFiles(VanillaSaveFolder));
|
||||
}
|
||||
if (Directory.Exists(SaveFolder))
|
||||
{
|
||||
itemAssemblyFiles.AddRange(Directory.GetFiles(SaveFolder));
|
||||
}
|
||||
|
||||
//find assembly files in selected content packages
|
||||
|
||||
@@ -174,7 +174,11 @@ namespace Barotrauma
|
||||
int newWidth = ResizeHorizontal ? rect.Width : (int)(defaultRect.Width * relativeScale);
|
||||
int newHeight = ResizeVertical ? rect.Height : (int)(defaultRect.Height * relativeScale);
|
||||
Rect = new Rectangle(rect.X, rect.Y, newWidth, newHeight);
|
||||
if (Sections != null)
|
||||
if (StairDirection != Direction.None)
|
||||
{
|
||||
CreateStairBodies();
|
||||
}
|
||||
else if (Sections != null)
|
||||
{
|
||||
UpdateSections();
|
||||
}
|
||||
@@ -431,6 +435,7 @@ namespace Barotrauma
|
||||
private void CreateStairBodies()
|
||||
{
|
||||
Bodies = new List<Body>();
|
||||
bodyDebugDimensions.Clear();
|
||||
|
||||
float stairAngle = MathHelper.ToRadians(Math.Min(Prefab.StairAngle, 75.0f));
|
||||
|
||||
@@ -448,7 +453,7 @@ namespace Barotrauma
|
||||
newBody.Friction = 0.8f;
|
||||
newBody.UserData = this;
|
||||
|
||||
newBody.Position = ConvertUnits.ToSimUnits(stairPos) + BodyOffset;
|
||||
newBody.Position = ConvertUnits.ToSimUnits(stairPos) + BodyOffset * Scale;
|
||||
|
||||
bodyDebugDimensions.Add(new Vector2(bodyWidth, bodyHeight));
|
||||
|
||||
@@ -575,12 +580,12 @@ namespace Barotrauma
|
||||
{
|
||||
foreach (MapEntity mapEntity in mapEntityList)
|
||||
{
|
||||
if (!(mapEntity is Structure structure)) continue;
|
||||
if (!structure.Prefab.AllowAttachItems) continue;
|
||||
if (structure.Bodies != null && structure.Bodies.Count > 0) continue;
|
||||
if (!(mapEntity is Structure structure)) { continue; }
|
||||
if (!structure.Prefab.AllowAttachItems) { continue; }
|
||||
if (structure.Bodies != null && structure.Bodies.Count > 0) { continue; }
|
||||
Rectangle worldRect = mapEntity.WorldRect;
|
||||
if (worldPosition.X < worldRect.X || worldPosition.X > worldRect.Right) continue;
|
||||
if (worldPosition.Y > worldRect.Y || worldPosition.Y < worldRect.Y - worldRect.Height) continue;
|
||||
if (worldPosition.X < worldRect.X || worldPosition.X > worldRect.Right) { continue; }
|
||||
if (worldPosition.Y > worldRect.Y || worldPosition.Y < worldRect.Y - worldRect.Height) { continue; }
|
||||
return structure;
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -817,6 +817,9 @@ namespace Barotrauma
|
||||
|
||||
Item.UpdateHulls();
|
||||
Gap.UpdateHulls();
|
||||
#if CLIENT
|
||||
Lights.ConvexHull.RecalculateAll(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
public void Update(float deltaTime)
|
||||
|
||||
@@ -372,10 +372,13 @@ namespace Barotrauma
|
||||
public bool SaveAs(string filePath, System.IO.MemoryStream previewImage=null)
|
||||
{
|
||||
var newElement = new XElement(SubmarineElement.Name,
|
||||
SubmarineElement.Attributes().Where(a => !string.Equals(a.Name.LocalName, "previewimage", StringComparison.InvariantCultureIgnoreCase)),
|
||||
SubmarineElement.Attributes().Where(a => !string.Equals(a.Name.LocalName, "previewimage", StringComparison.InvariantCultureIgnoreCase) &&
|
||||
!string.Equals(a.Name.LocalName, "name", StringComparison.InvariantCultureIgnoreCase)),
|
||||
SubmarineElement.Elements());
|
||||
XDocument doc = new XDocument(newElement);
|
||||
|
||||
doc.Root.Add(new XAttribute("name", Name));
|
||||
|
||||
if (previewImage != null)
|
||||
{
|
||||
doc.Root.Add(new XAttribute("previewimage", Convert.ToBase64String(previewImage.ToArray())));
|
||||
|
||||
@@ -594,6 +594,11 @@ namespace Barotrauma
|
||||
return assignedWayPoints;
|
||||
}
|
||||
|
||||
public void FindHull()
|
||||
{
|
||||
currentHull = Hull.FindHull(WorldPosition, CurrentHull);
|
||||
}
|
||||
|
||||
public override void OnMapLoaded()
|
||||
{
|
||||
currentHull = Hull.FindHull(WorldPosition, currentHull);
|
||||
|
||||
Reference in New Issue
Block a user