v0.12.0.2
This commit is contained in:
@@ -65,6 +65,8 @@ namespace Barotrauma.MapCreatures.Behavior
|
||||
public readonly List<DamageParticle> DamageParticles = new List<DamageParticle>();
|
||||
public readonly List<DamageParticle> DeathParticles = new List<DamageParticle>();
|
||||
|
||||
public static bool AlwaysShowBallastFloraSprite = false;
|
||||
|
||||
partial void LoadPrefab(XElement element)
|
||||
{
|
||||
string? branchAtlasPath = element.GetAttributeString("branchatlas", null);
|
||||
@@ -125,7 +127,7 @@ namespace Barotrauma.MapCreatures.Behavior
|
||||
float particleAmount = Rand.Range(16, 32);
|
||||
for (int i = 0; i < particleAmount; i++)
|
||||
{
|
||||
GameMain.ParticleManager.CreateParticle("shrapnel", pos, Rand.Vector(Rand.Range(-50f, 50.0f)));
|
||||
GameMain.ParticleManager.CreateParticle("shrapnel", pos, Rand.Vector(Rand.Range(0f, 250.0f)), Rand.Range(0f, 360.0f));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -43,10 +43,10 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
public void DrawFront(SpriteBatch spriteBatch, Camera cam)
|
||||
public void DrawDebugOverlay(SpriteBatch spriteBatch, Camera cam)
|
||||
{
|
||||
if (renderer == null) { return; }
|
||||
renderer.Draw(spriteBatch, cam);
|
||||
renderer.DrawDebugOverlay(spriteBatch, cam);
|
||||
|
||||
if (GameMain.DebugDraw && Screen.Selected.Cam.Zoom > 0.1f)
|
||||
{
|
||||
@@ -114,10 +114,13 @@ namespace Barotrauma
|
||||
|
||||
graphics.Clear(BackgroundColor);
|
||||
|
||||
if (renderer == null) return;
|
||||
renderer.DrawBackground(spriteBatch, cam, LevelObjectManager, backgroundCreatureManager);
|
||||
renderer?.DrawBackground(spriteBatch, cam, LevelObjectManager, backgroundCreatureManager);
|
||||
}
|
||||
|
||||
public void DrawFront(SpriteBatch spriteBatch, Camera cam)
|
||||
{
|
||||
renderer?.DrawForeground(spriteBatch, cam, LevelObjectManager);
|
||||
}
|
||||
public void ClientRead(ServerNetObject type, IReadMessage msg, float sendingTime)
|
||||
{
|
||||
bool isGlobalUpdate = msg.ReadBoolean();
|
||||
|
||||
@@ -241,6 +241,7 @@ namespace Barotrauma
|
||||
|
||||
private void UpdateDeformations(float deltaTime)
|
||||
{
|
||||
if (ActivePrefab.DeformableSprite == null) { return; }
|
||||
foreach (SpriteDeformation deformation in spriteDeformations)
|
||||
{
|
||||
if (deformation is PositionalDeformation positionalDeformation)
|
||||
|
||||
+35
-4
@@ -10,6 +10,7 @@ namespace Barotrauma
|
||||
partial class LevelObjectManager
|
||||
{
|
||||
private readonly List<LevelObject> visibleObjectsBack = new List<LevelObject>();
|
||||
private readonly List<LevelObject> visibleObjectsMid = new List<LevelObject>();
|
||||
private readonly List<LevelObject> visibleObjectsFront = new List<LevelObject>();
|
||||
|
||||
private double NextRefreshTime;
|
||||
@@ -26,6 +27,10 @@ namespace Barotrauma
|
||||
{
|
||||
obj.Update(deltaTime);
|
||||
}
|
||||
foreach (LevelObject obj in visibleObjectsMid)
|
||||
{
|
||||
obj.Update(deltaTime);
|
||||
}
|
||||
foreach (LevelObject obj in visibleObjectsFront)
|
||||
{
|
||||
obj.Update(deltaTime);
|
||||
@@ -34,7 +39,7 @@ namespace Barotrauma
|
||||
|
||||
public IEnumerable<LevelObject> GetVisibleObjects()
|
||||
{
|
||||
return visibleObjectsBack.Union(visibleObjectsFront);
|
||||
return visibleObjectsBack.Union(visibleObjectsMid).Union(visibleObjectsFront);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -43,6 +48,7 @@ namespace Barotrauma
|
||||
private void RefreshVisibleObjects(Rectangle currentIndices, float zoom)
|
||||
{
|
||||
visibleObjectsBack.Clear();
|
||||
visibleObjectsMid.Clear();
|
||||
visibleObjectsFront.Clear();
|
||||
|
||||
float minSizeToDraw = MathHelper.Lerp(10.0f, 5.0f, Math.Min(zoom * 20.0f, 1.0f));
|
||||
@@ -70,7 +76,10 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
var objectList = obj.Position.Z >= 0 ? visibleObjectsBack : visibleObjectsFront;
|
||||
var objectList =
|
||||
obj.Position.Z >= 0 ?
|
||||
visibleObjectsBack :
|
||||
(obj.Position.Z < -1 ? visibleObjectsFront : visibleObjectsMid);
|
||||
int drawOrderIndex = 0;
|
||||
for (int i = 0; i < objectList.Count; i++)
|
||||
{
|
||||
@@ -102,8 +111,31 @@ namespace Barotrauma
|
||||
currentGridIndices = currentIndices;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draw the objects behind the level walls
|
||||
/// </summary>
|
||||
public void DrawObjectsBack(SpriteBatch spriteBatch, Camera cam)
|
||||
{
|
||||
DrawObjects(spriteBatch, cam, visibleObjectsBack);
|
||||
}
|
||||
|
||||
public void DrawObjects(SpriteBatch spriteBatch, Camera cam, bool drawFront)
|
||||
/// <summary>
|
||||
/// Draw the objects in front of the level walls, but behind characters
|
||||
/// </summary>
|
||||
public void DrawObjectsMid(SpriteBatch spriteBatch, Camera cam)
|
||||
{
|
||||
DrawObjects(spriteBatch, cam, visibleObjectsMid);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draw the objects in front of the level walls and characters
|
||||
/// </summary>
|
||||
public void DrawObjectsFront(SpriteBatch spriteBatch, Camera cam)
|
||||
{
|
||||
DrawObjects(spriteBatch, cam, visibleObjectsFront);
|
||||
}
|
||||
|
||||
private void DrawObjects(SpriteBatch spriteBatch, Camera cam, List<LevelObject> objectList)
|
||||
{
|
||||
Rectangle indices = Rectangle.Empty;
|
||||
indices.X = (int)Math.Floor(cam.WorldView.X / (float)GridSize);
|
||||
@@ -132,7 +164,6 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
var objectList = drawFront ? visibleObjectsFront : visibleObjectsBack;
|
||||
foreach (LevelObject obj in objectList)
|
||||
{
|
||||
Vector2 camDiff = new Vector2(obj.Position.X, obj.Position.Y) - cam.WorldViewCenter;
|
||||
|
||||
@@ -220,7 +220,7 @@ namespace Barotrauma
|
||||
SamplerState.LinearWrap, DepthStencilState.DepthRead, null, null,
|
||||
cam.Transform);
|
||||
|
||||
backgroundSpriteManager?.DrawObjects(spriteBatch, cam, drawFront: false);
|
||||
backgroundSpriteManager?.DrawObjectsBack(spriteBatch, cam);
|
||||
if (cam.Zoom > 0.05f)
|
||||
{
|
||||
backgroundCreatureManager?.Draw(spriteBatch, cam);
|
||||
@@ -262,8 +262,6 @@ namespace Barotrauma
|
||||
color: Color.White * alpha, textureScale: new Vector2(texScale));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
spriteBatch.End();
|
||||
|
||||
RenderWalls(GameMain.Instance.GraphicsDevice, cam);
|
||||
@@ -272,11 +270,21 @@ namespace Barotrauma
|
||||
BlendState.NonPremultiplied,
|
||||
SamplerState.LinearClamp, DepthStencilState.DepthRead, null, null,
|
||||
cam.Transform);
|
||||
if (backgroundSpriteManager != null) backgroundSpriteManager.DrawObjects(spriteBatch, cam, drawFront: true);
|
||||
backgroundSpriteManager?.DrawObjectsMid(spriteBatch, cam);
|
||||
spriteBatch.End();
|
||||
}
|
||||
|
||||
public void Draw(SpriteBatch spriteBatch, Camera cam)
|
||||
public void DrawForeground(SpriteBatch spriteBatch, Camera cam, LevelObjectManager backgroundSpriteManager = null)
|
||||
{
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred,
|
||||
BlendState.NonPremultiplied,
|
||||
SamplerState.LinearClamp, DepthStencilState.DepthRead, null, null,
|
||||
cam.Transform);
|
||||
backgroundSpriteManager?.DrawObjectsFront(spriteBatch, cam);
|
||||
spriteBatch.End();
|
||||
}
|
||||
|
||||
public void DrawDebugOverlay(SpriteBatch spriteBatch, Camera cam)
|
||||
{
|
||||
if (GameMain.DebugDraw && cam.Zoom > 0.1f)
|
||||
{
|
||||
|
||||
@@ -391,7 +391,7 @@ namespace Barotrauma.Lights
|
||||
if (GUI.DisableItemHighlights) { return false; }
|
||||
|
||||
highlightedEntities.Clear();
|
||||
if (Character.Controlled != null && (!Character.Controlled.IsKeyDown(InputType.Aim) || Character.Controlled.SelectedItems.Any(it => it?.GetComponent<Sprayer>() == null)))
|
||||
if (Character.Controlled != null && (!Character.Controlled.IsKeyDown(InputType.Aim) || Character.Controlled.HeldItems.Any(it => it.GetComponent<Sprayer>() == null)))
|
||||
{
|
||||
if (Character.Controlled.FocusedItem != null)
|
||||
{
|
||||
|
||||
@@ -222,7 +222,7 @@ namespace Barotrauma
|
||||
return !tileDiscovered[MathHelper.Clamp(x, 0, tileDiscovered.Length), MathHelper.Clamp(y, 0, tileDiscovered.Length)];
|
||||
}
|
||||
|
||||
partial void ChangeLocationType(Location location, string prevName, LocationTypeChange change)
|
||||
partial void ChangeLocationTypeProjSpecific(Location location, string prevName, LocationTypeChange change)
|
||||
{
|
||||
if (change.Messages.Any())
|
||||
{
|
||||
@@ -383,11 +383,11 @@ namespace Barotrauma
|
||||
Level.Loaded.DebugSetEndLocation(null);
|
||||
|
||||
CurrentLocation.Discovered = true;
|
||||
CurrentLocation.CreateStore();
|
||||
OnLocationChanged?.Invoke(prevLocation, CurrentLocation);
|
||||
SelectLocation(-1);
|
||||
if (GameMain.Client == null)
|
||||
{
|
||||
CurrentLocation.CreateStore();
|
||||
ProgressWorld();
|
||||
}
|
||||
else
|
||||
@@ -550,7 +550,7 @@ namespace Barotrauma
|
||||
|
||||
location.Type.Sprite.Draw(spriteBatch, pos, color,
|
||||
scale: generationParams.LocationIconSize / location.Type.Sprite.size.X * iconScale * zoom);
|
||||
if (location.TypeChangeTimer <= 0 && !string.IsNullOrEmpty(location.LastTypeChangeMessage) && generationParams.TypeChangeIcon != null)
|
||||
if (location.TimeSinceLastTypeChange < 1 && !string.IsNullOrEmpty(location.LastTypeChangeMessage) && generationParams.TypeChangeIcon != null)
|
||||
{
|
||||
Vector2 typeChangeIconPos = pos + new Vector2(1.35f, -0.35f) * generationParams.LocationIconSize * 0.5f * zoom;
|
||||
float typeChangeIconScale = 18.0f / generationParams.TypeChangeIcon.SourceRect.Width;
|
||||
@@ -610,7 +610,7 @@ namespace Barotrauma
|
||||
Vector2 nameSize = GUI.LargeFont.MeasureString(HighlightedLocation.Name);
|
||||
Vector2 typeSize = GUI.Font.MeasureString(HighlightedLocation.Type.Name);
|
||||
Vector2 size = new Vector2(Math.Max(nameSize.X, typeSize.X), nameSize.Y + typeSize.Y);
|
||||
bool showReputation = HighlightedLocation.Discovered && HighlightedLocation.Type.HasOutpost && HighlightedLocation.Reputation != null;
|
||||
bool showReputation = hudVisibility > 0.0f && HighlightedLocation.Discovered && HighlightedLocation.Type.HasOutpost && HighlightedLocation.Reputation != null;
|
||||
string repLabelText = null, repValueText = null;
|
||||
Vector2 repLabelSize = Vector2.Zero, repBarSize = Vector2.Zero;
|
||||
if (showReputation)
|
||||
|
||||
@@ -214,7 +214,7 @@ namespace Barotrauma
|
||||
}
|
||||
else if (PlayerInput.KeyHit(Keys.V))
|
||||
{
|
||||
Paste(cam.WorldViewCenter);
|
||||
Paste(cam.ScreenToWorld(PlayerInput.MousePosition));
|
||||
}
|
||||
else if (PlayerInput.KeyHit(Keys.G))
|
||||
{
|
||||
@@ -279,31 +279,10 @@ namespace Barotrauma
|
||||
|
||||
if (GUI.KeyboardDispatcher.Subscriber == null)
|
||||
{
|
||||
int up = PlayerInput.KeyDown(Keys.Up) ? 1 : 0,
|
||||
down = PlayerInput.KeyDown(Keys.Down) ? -1 : 0,
|
||||
left = PlayerInput.KeyDown(Keys.Left) ? -1 : 0,
|
||||
right = PlayerInput.KeyDown(Keys.Right) ? 1 : 0;
|
||||
|
||||
int xKeysDown = (left + right);
|
||||
int yKeysDown = (up + down);
|
||||
|
||||
if (xKeysDown != 0 || yKeysDown != 0) { keyDelay += (float) Timing.Step; } else { keyDelay = 0; }
|
||||
|
||||
Vector2 nudgeAmount = Vector2.Zero;
|
||||
|
||||
if (keyDelay >= 0.5f)
|
||||
Vector2 nudge = GetNudgeAmount();
|
||||
if (nudge != Vector2.Zero)
|
||||
{
|
||||
nudgeAmount.Y = yKeysDown;
|
||||
nudgeAmount.X = xKeysDown;
|
||||
}
|
||||
|
||||
if (PlayerInput.KeyHit(Keys.Up)) nudgeAmount.Y = 1f;
|
||||
if (PlayerInput.KeyHit(Keys.Down)) nudgeAmount.Y = -1f;
|
||||
if (PlayerInput.KeyHit(Keys.Left)) nudgeAmount.X = -1f;
|
||||
if (PlayerInput.KeyHit(Keys.Right)) nudgeAmount.X = 1f;
|
||||
if (nudgeAmount != Vector2.Zero)
|
||||
{
|
||||
foreach (MapEntity entityToNudge in selectedList) { entityToNudge.Move(nudgeAmount); }
|
||||
foreach (MapEntity entityToNudge in selectedList) { entityToNudge.Move(nudge); }
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -476,6 +455,8 @@ namespace Barotrauma
|
||||
{
|
||||
if (PlayerInput.PrimaryMouseButtonHeld() &&
|
||||
PlayerInput.KeyUp(Keys.Space) &&
|
||||
PlayerInput.KeyUp(Keys.LeftAlt) &&
|
||||
PlayerInput.KeyUp(Keys.RightAlt) &&
|
||||
(highlightedListBox == null || (GUI.MouseOn != highlightedListBox && !highlightedListBox.IsParentOf(GUI.MouseOn))))
|
||||
{
|
||||
//if clicking a selected entity, start moving it
|
||||
@@ -491,6 +472,37 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
public static Vector2 GetNudgeAmount(bool doHold = true)
|
||||
{
|
||||
Vector2 nudgeAmount = Vector2.Zero;
|
||||
if (doHold)
|
||||
{
|
||||
int up = PlayerInput.KeyDown(Keys.Up) ? 1 : 0,
|
||||
down = PlayerInput.KeyDown(Keys.Down) ? -1 : 0,
|
||||
left = PlayerInput.KeyDown(Keys.Left) ? -1 : 0,
|
||||
right = PlayerInput.KeyDown(Keys.Right) ? 1 : 0;
|
||||
|
||||
int xKeysDown = (left + right);
|
||||
int yKeysDown = (up + down);
|
||||
|
||||
if (xKeysDown != 0 || yKeysDown != 0) { keyDelay += (float) Timing.Step; } else { keyDelay = 0; }
|
||||
|
||||
|
||||
if (keyDelay >= 0.5f)
|
||||
{
|
||||
nudgeAmount.Y = yKeysDown;
|
||||
nudgeAmount.X = xKeysDown;
|
||||
}
|
||||
}
|
||||
|
||||
if (PlayerInput.KeyHit(Keys.Up)) nudgeAmount.Y = 1f;
|
||||
if (PlayerInput.KeyHit(Keys.Down)) nudgeAmount.Y = -1f;
|
||||
if (PlayerInput.KeyHit(Keys.Left)) nudgeAmount.X = -1f;
|
||||
if (PlayerInput.KeyHit(Keys.Right)) nudgeAmount.X = 1f;
|
||||
|
||||
return nudgeAmount;
|
||||
}
|
||||
|
||||
public MapEntity GetReplacementOrThis()
|
||||
{
|
||||
return ReplacedBy?.GetReplacementOrThis() ?? this;
|
||||
@@ -511,7 +523,7 @@ namespace Barotrauma
|
||||
{
|
||||
if (entities == null)
|
||||
{
|
||||
if (potentialContainer.OwnInventory != null && potentialContainer.ParentInventory == null && !potentialContainer.OwnInventory.IsFull())
|
||||
if (potentialContainer.OwnInventory != null && potentialContainer.ParentInventory == null && !potentialContainer.OwnInventory.IsFull(takeStacksIntoAccount: true))
|
||||
{
|
||||
targetContainer = potentialContainer;
|
||||
break;
|
||||
|
||||
@@ -45,7 +45,10 @@ namespace Barotrauma
|
||||
{
|
||||
CreateInstance(newRect);
|
||||
placePosition = Vector2.Zero;
|
||||
selected = null;
|
||||
if (!PlayerInput.IsShiftDown())
|
||||
{
|
||||
selected = null;
|
||||
}
|
||||
}
|
||||
|
||||
newRect.Y = -newRect.Y;
|
||||
|
||||
@@ -191,10 +191,11 @@ namespace Barotrauma
|
||||
Vector2 max = new Vector2(worldRect.Right, worldRect.Y);
|
||||
foreach (DecorativeSprite decorativeSprite in Prefab.DecorativeSprites)
|
||||
{
|
||||
min.X = Math.Min(worldPos.X - decorativeSprite.Sprite.size.X * decorativeSprite.Sprite.RelativeOrigin.X * decorativeSprite.Scale * Scale, min.X);
|
||||
max.X = Math.Max(worldPos.X + decorativeSprite.Sprite.size.X * (1.0f - decorativeSprite.Sprite.RelativeOrigin.X) * decorativeSprite.Scale * Scale, max.X);
|
||||
min.Y = Math.Min(worldPos.Y - decorativeSprite.Sprite.size.Y * (1.0f - decorativeSprite.Sprite.RelativeOrigin.Y) * decorativeSprite.Scale * Scale, min.Y);
|
||||
max.Y = Math.Max(worldPos.Y + decorativeSprite.Sprite.size.Y * decorativeSprite.Sprite.RelativeOrigin.Y * decorativeSprite.Scale * Scale, max.Y);
|
||||
float scale = decorativeSprite.GetScale(spriteAnimState[decorativeSprite].RandomScaleFactor) * Scale;
|
||||
min.X = Math.Min(worldPos.X - decorativeSprite.Sprite.size.X * decorativeSprite.Sprite.RelativeOrigin.X * scale, min.X);
|
||||
max.X = Math.Max(worldPos.X + decorativeSprite.Sprite.size.X * (1.0f - decorativeSprite.Sprite.RelativeOrigin.X) * scale, max.X);
|
||||
min.Y = Math.Min(worldPos.Y - decorativeSprite.Sprite.size.Y * (1.0f - decorativeSprite.Sprite.RelativeOrigin.Y) * scale, min.Y);
|
||||
max.Y = Math.Max(worldPos.Y + decorativeSprite.Sprite.size.Y * decorativeSprite.Sprite.RelativeOrigin.Y * scale, max.Y);
|
||||
}
|
||||
|
||||
if (min.X > worldView.Right || max.X < worldView.X) { return false; }
|
||||
@@ -220,9 +221,14 @@ namespace Barotrauma
|
||||
Draw(spriteBatch, editing, false, damageEffect);
|
||||
}
|
||||
|
||||
private float GetRealDepth()
|
||||
{
|
||||
return SpriteDepthOverrideIsSet ? SpriteOverrideDepth : prefab.sprite.Depth;
|
||||
}
|
||||
|
||||
public float GetDrawDepth()
|
||||
{
|
||||
return GetDrawDepth(SpriteDepthOverrideIsSet ? SpriteOverrideDepth : prefab.sprite.Depth, prefab.sprite);
|
||||
return GetDrawDepth(GetRealDepth(), prefab.sprite);
|
||||
}
|
||||
|
||||
private void Draw(SpriteBatch spriteBatch, bool editing, bool back = true, Effect damageEffect = null)
|
||||
@@ -320,7 +326,7 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
if (back == depth > 0.5f)
|
||||
if (back == GetRealDepth() > 0.5f)
|
||||
{
|
||||
SpriteEffects oldEffects = prefab.sprite.effects;
|
||||
prefab.sprite.effects ^= SpriteEffects;
|
||||
@@ -377,10 +383,10 @@ namespace Barotrauma
|
||||
foreach (var decorativeSprite in Prefab.DecorativeSprites)
|
||||
{
|
||||
if (!spriteAnimState[decorativeSprite].IsActive) { continue; }
|
||||
float rotation = decorativeSprite.GetRotation(ref spriteAnimState[decorativeSprite].RotationState);
|
||||
Vector2 offset = decorativeSprite.GetOffset(ref spriteAnimState[decorativeSprite].OffsetState) * Scale;
|
||||
float rotation = decorativeSprite.GetRotation(ref spriteAnimState[decorativeSprite].RotationState, spriteAnimState[decorativeSprite].RandomRotationFactor);
|
||||
Vector2 offset = decorativeSprite.GetOffset(ref spriteAnimState[decorativeSprite].OffsetState, spriteAnimState[decorativeSprite].RandomOffsetMultiplier) * Scale;
|
||||
decorativeSprite.Sprite.Draw(spriteBatch, new Vector2(DrawPosition.X + offset.X, -(DrawPosition.Y + offset.Y)), color,
|
||||
rotation, decorativeSprite.Scale * Scale, prefab.sprite.effects,
|
||||
rotation, decorativeSprite.GetScale(spriteAnimState[decorativeSprite].RandomScaleFactor) * Scale, prefab.sprite.effects,
|
||||
depth: Math.Min(depth + (decorativeSprite.Sprite.Depth - prefab.sprite.Depth), 0.999f));
|
||||
}
|
||||
prefab.sprite.effects = oldEffects;
|
||||
|
||||
@@ -62,7 +62,11 @@ namespace Barotrauma
|
||||
};
|
||||
|
||||
SubEditorScreen.StoreCommand(new AddOrDeleteCommand(new List<MapEntity> { structure }, false));
|
||||
selected = null;
|
||||
placePosition = Vector2.Zero;
|
||||
if (!PlayerInput.IsShiftDown())
|
||||
{
|
||||
selected = null;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,8 @@ namespace Barotrauma
|
||||
public readonly float Range;
|
||||
public readonly Vector2 FrequencyMultiplierRange;
|
||||
public readonly bool Stream;
|
||||
public readonly bool IgnoreMuffling;
|
||||
|
||||
|
||||
public string Filename
|
||||
{
|
||||
@@ -55,7 +57,7 @@ namespace Barotrauma
|
||||
{
|
||||
DebugConsole.ThrowError($"Loaded frequency range exceeds max value: {FrequencyMultiplierRange} (original string was \"{freqMultAttr}\")");
|
||||
}
|
||||
sound.IgnoreMuffling = element.GetAttributeBool("dontmuffle", false);
|
||||
IgnoreMuffling = element.GetAttributeBool("dontmuffle", false);
|
||||
}
|
||||
|
||||
public float GetRandomFrequencyMultiplier()
|
||||
@@ -376,22 +378,19 @@ namespace Barotrauma
|
||||
|
||||
public static void DrawGrid(SpriteBatch spriteBatch, int gridCells, Vector2 gridCenter, Vector2 roundedGridCenter, float alpha = 1.0f)
|
||||
{
|
||||
var horizontalLine = GUI.Style.GetComponentStyle("HorizontalLine").GetDefaultSprite();
|
||||
var verticalLine = GUI.Style.GetComponentStyle("VerticalLine").GetDefaultSprite();
|
||||
|
||||
Vector2 topLeft = roundedGridCenter - Vector2.One * GridSize * gridCells / 2;
|
||||
Vector2 bottomRight = roundedGridCenter + Vector2.One * GridSize * gridCells / 2;
|
||||
|
||||
for (int i = 0; i < gridCells; i++)
|
||||
{
|
||||
float distFromGridX = (MathUtils.RoundTowardsClosest(gridCenter.X, GridSize.X) - gridCenter.X) / GridSize.X;
|
||||
float distFromGridY = (MathUtils.RoundTowardsClosest(gridCenter.X, GridSize.Y) - gridCenter.X) / GridSize.Y;
|
||||
float distFromGridY = (MathUtils.RoundTowardsClosest(gridCenter.Y, GridSize.Y) - gridCenter.Y) / GridSize.Y;
|
||||
|
||||
float normalizedDistX = Math.Abs(i + distFromGridX - gridCells / 2) / (gridCells / 2);
|
||||
float normalizedDistY = Math.Abs(i - distFromGridY - gridCells / 2) / (gridCells / 2);
|
||||
|
||||
float expandX = MathHelper.Lerp(30.0f, 0.0f, normalizedDistX);
|
||||
float expandY = MathHelper.Lerp(30.0f, 0.0f, normalizedDistY);
|
||||
float expandX = MathHelper.Lerp(30.0f, 0.0f, normalizedDistY);
|
||||
float expandY = MathHelper.Lerp(30.0f, 0.0f, normalizedDistX);
|
||||
|
||||
GUI.DrawLine(spriteBatch,
|
||||
new Vector2(topLeft.X - expandX, -bottomRight.Y + i * GridSize.Y),
|
||||
@@ -420,9 +419,10 @@ namespace Barotrauma
|
||||
parent.RectTransform, Anchor.Center),
|
||||
style: null);
|
||||
|
||||
var connectedSubs = GetConnectedSubs();
|
||||
foreach (Hull hull in Hull.hullList)
|
||||
{
|
||||
if (hull.Submarine != this && !(DockedTo.Contains(hull.Submarine))) continue;
|
||||
if (hull.Submarine != this && !connectedSubs.Contains(hull.Submarine)) { continue; }
|
||||
if (ignoreOutpost && !IsEntityFoundOnThisSub(hull, true)) { continue; }
|
||||
|
||||
Vector2 relativeHullPos = new Vector2(
|
||||
@@ -533,11 +533,11 @@ namespace Barotrauma
|
||||
for (int i = 0; i < item.Connections.Count; i++)
|
||||
{
|
||||
int wireCount = item.Connections[i].Wires.Count(w => w != null);
|
||||
if (doorLinks + wireCount > Connection.MaxLinked)
|
||||
if (doorLinks + wireCount > item.Connections[i].MaxWires)
|
||||
{
|
||||
errorMsgs.Add(TextManager.GetWithVariables("InsufficientFreeConnectionsWarning",
|
||||
new string[] { "[doorcount]", "[freeconnectioncount]" },
|
||||
new string[] { doorLinks.ToString(), (Connection.MaxLinked - wireCount).ToString() }));
|
||||
new string[] { doorLinks.ToString(), (item.Connections[i].MaxWires - wireCount).ToString() }));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user