v1.5.7.0 (Summer Update)
This commit is contained in:
@@ -215,7 +215,9 @@ namespace Barotrauma
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Math.Sign(flowTargetHull.Rect.Y - rect.Y) != Math.Sign(lerpedFlowForce.Y)) { return; }
|
||||
//do not emit particles unless water is flowing towards the target hull
|
||||
//(using lerpedFlowForce smooths out "flickers" when the direction of flow is rapidly changing)
|
||||
if (Math.Sign(flowTargetHull.WorldPosition.Y - WorldPosition.Y) != Math.Sign(lerpedFlowForce.Y)) { return; }
|
||||
|
||||
float particlesPerSec = Math.Max(open * rect.Width * particleAmountMultiplier, 10.0f);
|
||||
float emitInterval = 1.0f / particlesPerSec;
|
||||
|
||||
@@ -210,7 +210,9 @@ namespace Barotrauma
|
||||
{
|
||||
bool primaryMouseButtonHeld = PlayerInput.PrimaryMouseButtonHeld();
|
||||
bool secondaryMouseButtonHeld = PlayerInput.SecondaryMouseButtonHeld();
|
||||
if (!primaryMouseButtonHeld && !secondaryMouseButtonHeld) { return; }
|
||||
bool doubleClicked = PlayerInput.DoubleClicked();
|
||||
bool secondaryDoubleClicked = PlayerInput.SecondaryDoubleClicked();
|
||||
if (!primaryMouseButtonHeld && !secondaryMouseButtonHeld && !doubleClicked && !secondaryDoubleClicked) { return; }
|
||||
|
||||
Vector2 position = cam.ScreenToWorld(PlayerInput.MousePosition);
|
||||
Hull hull = FindHull(position);
|
||||
@@ -218,29 +220,67 @@ namespace Barotrauma
|
||||
if (hull == null || hull.IdFreed) { return; }
|
||||
if (EditWater)
|
||||
{
|
||||
const float waterIncrement = 100000.0f;
|
||||
if (primaryMouseButtonHeld)
|
||||
{
|
||||
ShowHulls = true;
|
||||
hull.WaterVolume += 100000.0f * deltaTime;
|
||||
hull.networkUpdatePending = true;
|
||||
hull.serverUpdateDelay = 0.5f;
|
||||
SetWaterVolume(hull.WaterVolume + waterIncrement * deltaTime);
|
||||
}
|
||||
else if (secondaryMouseButtonHeld)
|
||||
{
|
||||
hull.WaterVolume -= 100000.0f * deltaTime;
|
||||
SetWaterVolume(hull.WaterVolume - waterIncrement * deltaTime);
|
||||
}
|
||||
|
||||
if (doubleClicked)
|
||||
{
|
||||
SetWaterVolume(hull.Volume * MaxCompress);
|
||||
}
|
||||
else if (secondaryDoubleClicked)
|
||||
{
|
||||
SetWaterVolume(0f);
|
||||
}
|
||||
|
||||
void SetWaterVolume(float newVolume)
|
||||
{
|
||||
ShowHulls = true;
|
||||
hull.WaterVolume = newVolume;
|
||||
hull.networkUpdatePending = true;
|
||||
hull.serverUpdateDelay = 0.5f;
|
||||
}
|
||||
|
||||
}
|
||||
else if (EditFire)
|
||||
{
|
||||
bool networkUpdate = false;
|
||||
|
||||
if (primaryMouseButtonHeld)
|
||||
{
|
||||
new FireSource(position, hull, isNetworkMessage: true);
|
||||
networkUpdate = true;
|
||||
}
|
||||
else if (secondaryMouseButtonHeld || secondaryDoubleClicked)
|
||||
{
|
||||
for (int index = hull.FireSources.Count - 1; index >= 0; index--)
|
||||
{
|
||||
var currentFireSource = hull.FireSources[index];
|
||||
|
||||
if (secondaryMouseButtonHeld)
|
||||
{
|
||||
const float extinguishAmount = 120f;
|
||||
currentFireSource.Extinguish(deltaTime, extinguishAmount);
|
||||
networkUpdate = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
currentFireSource.Remove();
|
||||
networkUpdate = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (networkUpdate)
|
||||
{
|
||||
hull.networkUpdatePending = true;
|
||||
hull.serverUpdateDelay = 0.5f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -70,7 +70,7 @@ namespace Barotrauma.Lights
|
||||
|
||||
public bool LightingEnabled = true;
|
||||
|
||||
public bool ObstructVision;
|
||||
public float ObstructVisionAmount;
|
||||
|
||||
private readonly Texture2D visionCircle;
|
||||
|
||||
@@ -498,7 +498,7 @@ namespace Barotrauma.Lights
|
||||
{
|
||||
foreach (MapEntity e in (Submarine.VisibleEntities ?? MapEntity.MapEntityList))
|
||||
{
|
||||
if (e is Item item && !item.HiddenInGame && item.GetComponent<Wire>() is Wire wire)
|
||||
if (e is Item item && !item.IsHidden && item.GetComponent<Wire>() is Wire wire)
|
||||
{
|
||||
wire.DebugDraw(spriteBatch, alpha: 0.4f);
|
||||
}
|
||||
@@ -664,7 +664,7 @@ namespace Barotrauma.Lights
|
||||
visibleHulls.Clear();
|
||||
foreach (Hull hull in Hull.HullList)
|
||||
{
|
||||
if (hull.HiddenInGame) { continue; }
|
||||
if (hull.IsHidden) { continue; }
|
||||
var drawRect =
|
||||
hull.Submarine == null ?
|
||||
hull.Rect :
|
||||
@@ -682,12 +682,12 @@ namespace Barotrauma.Lights
|
||||
|
||||
public void UpdateObstructVision(GraphicsDevice graphics, SpriteBatch spriteBatch, Camera cam, Vector2 lookAtPosition)
|
||||
{
|
||||
if ((!LosEnabled || LosMode == LosMode.None) && !ObstructVision) { return; }
|
||||
if ((!LosEnabled || LosMode == LosMode.None) && ObstructVisionAmount <= 0.0f) { return; }
|
||||
if (ViewTarget == null) return;
|
||||
|
||||
graphics.SetRenderTarget(LosTexture);
|
||||
|
||||
if (ObstructVision)
|
||||
if (ObstructVisionAmount > 0.0f)
|
||||
{
|
||||
graphics.Clear(Color.Black);
|
||||
Vector2 diff = lookAtPosition - ViewTarget.WorldPosition;
|
||||
@@ -697,13 +697,14 @@ namespace Barotrauma.Lights
|
||||
|
||||
//the visible area stretches to the maximum when the cursor is this far from the character
|
||||
const float MaxOffset = 256.0f;
|
||||
const float MinHorizontalScale = 2.2f;
|
||||
const float MaxHorizontalScale = 2.8f;
|
||||
const float VerticalScale = 2.5f;
|
||||
//the magic numbers here are just based on experimentation
|
||||
float MinHorizontalScale = MathHelper.Lerp(3.5f, 1.5f, ObstructVisionAmount);
|
||||
float MaxHorizontalScale = MinHorizontalScale * 1.25f;
|
||||
float VerticalScale = MathHelper.Lerp(4.0f, 1.25f, ObstructVisionAmount);
|
||||
|
||||
//Starting point and scale-based modifier that moves the point of origin closer to the edge of the texture if the player moves their mouse further away, or vice versa.
|
||||
float relativeOriginStartPosition = 0.22f; //Increasing this value moves the origin further behind the character
|
||||
float originStartPosition = visionCircle.Width * relativeOriginStartPosition;
|
||||
float relativeOriginStartPosition = 0.1f; //Increasing this value moves the origin further behind the character
|
||||
float originStartPosition = visionCircle.Width * relativeOriginStartPosition * MinHorizontalScale;
|
||||
float relativeOriginLookAtPosModifier = -0.055f; //Increase this value increases how much the vision changes by moving the mouse
|
||||
float originLookAtPosModifier = visionCircle.Width * relativeOriginLookAtPosModifier;
|
||||
|
||||
|
||||
@@ -1115,13 +1115,23 @@ namespace Barotrauma
|
||||
|
||||
float subCrushDepth = SubmarineInfo.GetSubCrushDepth(SubmarineSelection.CurrentOrPendingSubmarine(), ref pendingSubInfo);
|
||||
string crushDepthWarningIconStyle = null;
|
||||
if (connection.LevelData.InitialDepth * Physics.DisplayToRealWorldRatio > subCrushDepth)
|
||||
|
||||
var levelData = connection.LevelData;
|
||||
float spawnDepth =
|
||||
levelData.InitialDepth +
|
||||
//base the warning on the start or end position of the level, whichever is deeper
|
||||
levelData.Size.Y * Math.Max(levelData.GenerationParams.StartPosition.Y, levelData.GenerationParams.EndPosition.Y);
|
||||
|
||||
//"high warning" if the sub spawns at/below crush depth
|
||||
if (spawnDepth * Physics.DisplayToRealWorldRatio > subCrushDepth)
|
||||
{
|
||||
iconCount++;
|
||||
crushDepthWarningIconStyle = "CrushDepthWarningHighIcon";
|
||||
tooltip = "crushdepthwarninghigh";
|
||||
}
|
||||
else if ((connection.LevelData.InitialDepth + connection.LevelData.Size.Y) * Physics.DisplayToRealWorldRatio > subCrushDepth)
|
||||
//"low warning" if the spawn position is less than the level's height away from crush depth
|
||||
//(i.e. the crush depth is pretty close to the spawn pos, possibly inside the level or at least close enough that many parts of the abyss are unreachable)
|
||||
else if ((spawnDepth + connection.LevelData.Size.Y) * Physics.DisplayToRealWorldRatio > subCrushDepth)
|
||||
{
|
||||
iconCount++;
|
||||
crushDepthWarningIconStyle = "CrushDepthWarningLowIcon";
|
||||
|
||||
@@ -382,7 +382,10 @@ namespace Barotrauma
|
||||
if (!HasBody && !ShowStructures) { return; }
|
||||
if (HasBody && !ShowWalls) { return; }
|
||||
}
|
||||
else if (HiddenInGame) { return; }
|
||||
else if (IsHidden)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Color color = IsIncludedInSelection && editing ? GUIStyle.Blue : IsHighlighted ? GUIStyle.Orange * Math.Max(spriteColor.A / (float) byte.MaxValue, 0.1f) : spriteColor;
|
||||
|
||||
|
||||
@@ -20,13 +20,13 @@ namespace Barotrauma
|
||||
|
||||
public override bool SelectableInEditor
|
||||
{
|
||||
get { return !IsHidden(); }
|
||||
get { return ShouldDrawIcon(); }
|
||||
}
|
||||
|
||||
public override void Draw(SpriteBatch spriteBatch, bool editing, bool back = true)
|
||||
{
|
||||
if (!editing && (!GameMain.DebugDraw || Screen.Selected.Cam.Zoom < 0.1f)) { return; }
|
||||
if (IsHidden()) { return; }
|
||||
if (!ShouldDrawIcon()) { return; }
|
||||
|
||||
Vector2 drawPos = Position;
|
||||
if (Submarine != null) { drawPos += Submarine.DrawPosition; }
|
||||
@@ -59,8 +59,10 @@ namespace Barotrauma
|
||||
Color.White);
|
||||
}
|
||||
|
||||
Sprite sprite = iconSprites[SpawnType.ToString()];
|
||||
Sprite sprite2 = null;
|
||||
//there are no sprites for all possible combinations of SpawnType flags, but in the vanilla game the only possible combination is
|
||||
//SpawnType.Disabled + some other flag, in which case it's fine to just not show the icon.
|
||||
iconSprites.TryGetValue(SpawnType.ToString(), out Sprite sprite);
|
||||
if (spawnType == SpawnType.Human && AssignedJob?.Icon != null)
|
||||
{
|
||||
sprite = iconSprites["Path"];
|
||||
@@ -87,9 +89,12 @@ namespace Barotrauma
|
||||
sprite = iconSprites["Ladder"];
|
||||
}
|
||||
|
||||
float spriteScale = iconSize / (float)sprite.SourceRect.Width;
|
||||
sprite.Draw(spriteBatch, drawPos, clr, origin: sprite.size / 2, scale: spriteScale, depth: 0.001f);
|
||||
sprite2?.Draw(spriteBatch, drawPos + sprite.size * spriteScale * 0.5f, clr, origin: sprite2.size / 2, scale: spriteScale, depth: 0.001f);
|
||||
if (sprite != null)
|
||||
{
|
||||
float spriteScale = iconSize / (float)sprite.SourceRect.Width;
|
||||
sprite.Draw(spriteBatch, drawPos, clr, origin: sprite.size / 2, scale: spriteScale, depth: 0.001f);
|
||||
sprite2?.Draw(spriteBatch, drawPos + sprite.size * spriteScale * 0.5f, clr, origin: sprite2.size / 2, scale: spriteScale, depth: 0.001f);
|
||||
}
|
||||
|
||||
if (spawnType == SpawnType.Human && AssignedJob?.Icon != null)
|
||||
{
|
||||
@@ -160,22 +165,22 @@ namespace Barotrauma
|
||||
|
||||
public override bool IsMouseOn(Vector2 position)
|
||||
{
|
||||
if (IsHidden()) { return false; }
|
||||
if (!ShouldDrawIcon()) { return false; }
|
||||
float dist = Vector2.DistanceSquared(position, WorldPosition);
|
||||
float radius = (SpawnType == SpawnType.Path ? WaypointSize : SpawnPointSize) * 0.6f;
|
||||
return dist < radius * radius;
|
||||
}
|
||||
|
||||
private bool IsHidden()
|
||||
private bool ShouldDrawIcon()
|
||||
{
|
||||
if (!SubEditorScreen.IsLayerVisible(this)) { return true; }
|
||||
if (!SubEditorScreen.IsLayerVisible(this)) { return false; }
|
||||
if (spawnType == SpawnType.Path)
|
||||
{
|
||||
return (!GameMain.DebugDraw && !ShowWayPoints);
|
||||
return GameMain.DebugDraw || ShowWayPoints;
|
||||
}
|
||||
else
|
||||
{
|
||||
return (!GameMain.DebugDraw && !ShowSpawnPoints);
|
||||
return GameMain.DebugDraw || ShowSpawnPoints;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user