Unstable 0.1300.1.11

This commit is contained in:
Markus Isberg
2021-04-26 21:07:23 +03:00
parent 841d755394
commit 2c750282ec
76 changed files with 671 additions and 396 deletions
@@ -424,13 +424,7 @@ namespace Barotrauma
}
foreach (var edge in cell.Edges)
{
if (!MathUtils.GetLineIntersection(worldPosition, cell.Center, edge.Point1 + cell.Translation, edge.Point2 + cell.Translation, out Vector2 intersection))
{
continue;
}
float wallDist = Vector2.DistanceSquared(worldPosition, intersection);
if (wallDist < worldRange * worldRange)
if (MathUtils.LineSegmentToPointDistanceSquared((edge.Point1 + cell.Translation).ToPoint(), (edge.Point2 + cell.Translation).ToPoint(), worldPosition.ToPoint()) < worldRange * worldRange)
{
destructibleWall.AddDamage(damage, worldPosition);
break;
@@ -501,7 +501,7 @@ namespace Barotrauma
EntityGrids.Add(newGrid);
foreach (Hull hull in hullList)
{
if (hull.Submarine == submarine) newGrid.InsertEntity(hull);
if (hull.Submarine == submarine && !hull.IdFreed) { newGrid.InsertEntity(hull); }
}
return newGrid;
}
@@ -3663,7 +3663,7 @@ namespace Barotrauma
}
//break powered items
foreach (Item item in beaconItems.Where(it => it.Components.Any(c => c is Powered)))
foreach (Item item in beaconItems.Where(it => it.Components.Any(c => c is Powered) && it.Components.Any(c => c is Repairable)))
{
if (item.NonInteractable) { continue; }
if (Rand.Range(0f, 1f, Rand.RandSync.Unsynced) < 0.5f)
@@ -252,6 +252,10 @@ namespace Barotrauma
Vector2 worldPos = saveElement.GetAttributeVector2("worldpos", Vector2.Zero);
if (worldPos != Vector2.Zero)
{
if (GameMain.GameSession != null && GameMain.GameSession.MirrorLevel)
{
worldPos.X = GameMain.GameSession.LevelData.Size.X - worldPos.X;
}
sub.SetPosition(worldPos);
}
else
@@ -417,7 +421,12 @@ namespace Barotrauma
if (leaveBehind)
{
saveElement.SetAttributeValue("location", Level.Loaded.Seed);
saveElement.SetAttributeValue("worldpos", XMLExtensions.Vector2ToString(sub.SubBody.Position));
Vector2 position = sub.SubBody.Position;
if (Level.Loaded.Mirrored)
{
position.X = Level.Loaded.Size.X - position.X;
}
saveElement.SetAttributeValue("worldpos", XMLExtensions.Vector2ToString(position));
}
else
{
@@ -975,7 +975,14 @@ namespace Barotrauma
private void ChangeLocationType(Location location, LocationTypeChange change)
{
string prevName = location.Name;
location.ChangeType(LocationType.List.Find(lt => lt.Identifier.Equals(change.ChangeToType, StringComparison.OrdinalIgnoreCase)));
var newType = LocationType.List.Find(lt => lt.Identifier.Equals(change.ChangeToType, StringComparison.OrdinalIgnoreCase));
if (newType.OutpostTeam != location.Type.OutpostTeam ||
newType.HasOutpost != location.Type.HasOutpost)
{
location.ClearMissions();
}
location.ChangeType(newType);
ChangeLocationTypeProjSpecific(location, prevName, change);
foreach (var requirement in change.Requirements)
{
@@ -146,7 +146,7 @@ namespace Barotrauma
foreach (Hull hull in Hull.hullList)
{
if (hull.Submarine != submarine) { continue; }
if (hull.Submarine != submarine || hull.IdFreed) { continue; }
Rectangle rect = hull.Rect;
farseerBody.CreateRectangle(