Unstable 0.16.1.0

This commit is contained in:
Markus Isberg
2022-01-27 00:30:32 +09:00
parent 7d6421a548
commit b259af5911
161 changed files with 1913 additions and 638 deletions
@@ -315,7 +315,7 @@ namespace Barotrauma.MapCreatures.Behavior
}
else
{
RemoveClaim(itemId);
RemoveClaim(item);
}
}
else
@@ -128,13 +128,13 @@ namespace Barotrauma
{
//no flow particles between linked hulls (= rooms consisting of multiple hulls)
if (hull1.linkedTo.Contains(hull2)) { return; }
foreach (Hull h in hull1.linkedTo)
foreach (var linkedEntity in hull1.linkedTo)
{
if (h.linkedTo.Contains(hull1) && h.linkedTo.Contains(hull2)) { return; }
if (linkedEntity is Hull h && h.linkedTo.Contains(hull1) && h.linkedTo.Contains(hull2)) { return; }
}
foreach (Hull h in hull2.linkedTo)
foreach (var linkedEntity in hull2.linkedTo)
{
if (h.linkedTo.Contains(hull1) && h.linkedTo.Contains(hull2)) { return; }
if (linkedEntity is Hull h && h.linkedTo.Contains(hull1) && h.linkedTo.Contains(hull2)) { return; }
}
}
@@ -244,7 +244,7 @@ namespace Barotrauma
float emitInterval = 1.0f / particlesPerSec;
while (particleTimer > emitInterval)
{
pos.X = Rand.Range(rect.X, rect.X + rect.Width);
pos.X = Rand.Range(rect.X, rect.X + rect.Width + 1);
Vector2 velocity = new Vector2(
lerpedFlowForce.X * Rand.Range(0.5f, 0.7f),
MathHelper.Clamp(lerpedFlowForce.Y, -500.0f, 1000.0f) * Rand.Range(0.5f, 0.7f));
@@ -95,7 +95,7 @@ namespace Barotrauma
var prefab = ToolBox.SelectWeightedRandom(availablePrefabs, availablePrefabs.Select(p => p.GetCommonness(level.GenerationParams)).ToList(), Rand.RandSync.ClientOnly);
if (prefab == null) { break; }
int amount = Rand.Range(prefab.SwarmMin, prefab.SwarmMax, Rand.RandSync.ClientOnly);
int amount = Rand.Range(prefab.SwarmMin, prefab.SwarmMax + 1, Rand.RandSync.ClientOnly);
List<BackgroundCreature> swarmMembers = new List<BackgroundCreature>();
for (int n = 0; n < amount; n++)
{
@@ -5,6 +5,7 @@ using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using Barotrauma.Lights;
@@ -36,9 +37,6 @@ namespace Barotrauma
private static List<MapEntity> highlightedList = new List<MapEntity>();
// Test feature. Not yet saved.
public static Dictionary<MapEntity, HashSet<MapEntity>> SelectionGroups { get; private set; } = new Dictionary<MapEntity, HashSet<MapEntity>>();
private static float highlightTimer;
private static GUIListBox highlightedListBox;
@@ -197,7 +195,7 @@ namespace Barotrauma
{
Paste(cam.ScreenToWorld(PlayerInput.MousePosition));
}
else if (PlayerInput.KeyHit(Keys.G))
/*else if (PlayerInput.KeyHit(Keys.G))
{
if (SelectedList.Any())
{
@@ -217,7 +215,7 @@ namespace Barotrauma
}
}
}
}
}*/
}
}
@@ -360,14 +358,15 @@ namespace Barotrauma
{
if (highLightedEntity != null)
{
if (SelectionGroups.TryGetValue(highLightedEntity, out HashSet<MapEntity> group))
if (SubEditorScreen.IsLayerLinked(highLightedEntity)/*SelectionGroups.TryGetValue(highLightedEntity, out HashSet<MapEntity> group)*/)
{
foreach (MapEntity entity in group.Where(e => !newSelection.Contains(e)))
ImmutableHashSet<MapEntity> entitiesInSameLayer = SubEditorScreen.GetEntitiesInSameLayer(highLightedEntity);
foreach (MapEntity entity in entitiesInSameLayer.Where(e => !newSelection.Contains(e)))
{
newSelection.Add(entity);
}
foreach (MapEntity entity in group)
foreach (MapEntity entity in entitiesInSameLayer)
{
entity.IsIncludedInSelection = true;
}
@@ -1197,14 +1196,24 @@ namespace Barotrauma
Rectangle selectionRect = Submarine.AbsRect(pos, size);
foreach (MapEntity e in mapEntityList)
foreach (MapEntity entity in mapEntityList)
{
if (!e.SelectableInEditor) continue;
if (!entity.SelectableInEditor) { continue; }
if (Submarine.RectsOverlap(selectionRect, e.rect))
if (Submarine.RectsOverlap(selectionRect, entity.rect))
{
foundEntities.Add(e);
e.IsIncludedInSelection = true;
foundEntities.Add(entity);
entity.IsIncludedInSelection = true;
if (SubEditorScreen.IsLayerLinked(entity))
{
ImmutableHashSet<MapEntity> entitiesInSameLayer = SubEditorScreen.GetEntitiesInSameLayer(entity);
foreach (MapEntity layerEntity in entitiesInSameLayer.Where(e => !foundEntities.Contains(e)))
{
foundEntities.Add(layerEntity);
layerEntity.IsIncludedInSelection = true;
}
}
}
}
@@ -651,7 +651,11 @@ namespace Barotrauma
public void Dispose()
{
previewFrame = null;
if (previewFrame != null)
{
previewFrame.RectTransform.Parent = null;
previewFrame = null;
}
spriteRecorder?.Dispose();
isDisposed = true;
}