v1.0.13.1 (first post-1.0 patch)

This commit is contained in:
Regalis11
2023-05-10 15:07:17 +03:00
parent 96fb49ba14
commit ee1db852b1
272 changed files with 5738 additions and 2413 deletions
@@ -1,16 +1,13 @@
using Barotrauma.Items.Components;
using Barotrauma.Extensions;
using Barotrauma.IO;
using Barotrauma.Items.Components;
using Barotrauma.Networking;
using Barotrauma.Extensions;
using FarseerPhysics;
using FarseerPhysics.Dynamics;
using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using Barotrauma.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Xml.Linq;
using Voronoi2;
@@ -1044,6 +1041,30 @@ namespace Barotrauma
#endif
}
public void EnableFactionSpecificEntities(Identifier factionIdentifier)
{
foreach (MapEntity me in MapEntity.mapEntityList)
{
if (string.IsNullOrEmpty(me.Layer) || me.Submarine != this) { continue; }
var layerAsIdentifier = me.Layer.ToIdentifier();
if (FactionPrefab.Prefabs.ContainsKey(layerAsIdentifier))
{
me.HiddenInGame = factionIdentifier != layerAsIdentifier;
#if CLIENT
//normally this is handled in LightComponent.OnMapLoaded, but this method is called after that
if (me.HiddenInGame && me is Item item)
{
foreach (var lightComponent in item.GetComponents<LightComponent>())
{
lightComponent.Light.Enabled = false;
}
}
#endif
}
}
}
public void Update(float deltaTime)
{
if (Info.IsWreck)
@@ -1098,7 +1119,7 @@ namespace Barotrauma
public void ApplyForce(Vector2 force)
{
if (subBody != null) subBody.ApplyForce(force);
if (subBody != null) { subBody.ApplyForce(force); }
}
public void EnableMaintainPosition()
@@ -1690,9 +1711,30 @@ namespace Barotrauma
}
}
Dictionary<int, MapEntity> savedEntities = new Dictionary<int, MapEntity>();
foreach (MapEntity e in MapEntity.mapEntityList.OrderBy(e => e.ID))
{
if (!e.ShouldBeSaved) { continue; }
if (e.Removed)
{
GameAnalyticsManager.AddErrorEventOnce(
"Submarine.SaveToXElement:Removed" + e.Name,
GameAnalyticsManager.ErrorSeverity.Error,
$"Attempted to save a removed entity (\"{e.Name}\"). Duplicate ID: {savedEntities.ContainsKey(e.ID)}");
DebugConsole.ThrowError($"Error while saving the submarine. Attempted to save a removed entity (\"{e.Name} ({e.ID})\"). The entity will not be saved to avoid corrupting the submarine file.");
continue;
}
if (savedEntities.TryGetValue(e.ID, out MapEntity duplicateEntity))
{
GameAnalyticsManager.AddErrorEventOnce(
"Submarine.SaveToXElement:DuplicateId" + e.Name,
GameAnalyticsManager.ErrorSeverity.Error,
$"Attempted to save an entity with a duplicate ID ({e.Name}, {duplicateEntity.Name}).");
DebugConsole.ThrowError($"Error while saving the submarine. The entity \"{e.Name}\" has the same ID as \"{duplicateEntity.Name}\" ({e.ID}). The entity will not be saved to avoid corrupting the submarine file.");
continue;
}
if (e is Item item)
{
if (item.FindParentInventory(inv => inv is CharacterInventory) != null) { continue; }
@@ -1712,6 +1754,7 @@ namespace Barotrauma
}
e.Save(element);
savedEntities.Add(e.ID, e);
}
Info.CheckSubsLeftBehind(element);
}