v1.5.7.0 (Summer Update)

This commit is contained in:
Regalis11
2024-06-18 16:49:51 +03:00
parent 4a63dacbce
commit 230d1b6e78
263 changed files with 7792 additions and 2845 deletions
@@ -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;
}
}