diff --git a/Barotrauma/BarotraumaClient/Source/GameSession/CrewManager.cs b/Barotrauma/BarotraumaClient/Source/GameSession/CrewManager.cs index 5a263c325..8e6d17d51 100644 --- a/Barotrauma/BarotraumaClient/Source/GameSession/CrewManager.cs +++ b/Barotrauma/BarotraumaClient/Source/GameSession/CrewManager.cs @@ -271,7 +271,6 @@ namespace Barotrauma DebugConsole.ThrowError("Tried to add the same character info to CrewManager twice.\n" + Environment.StackTrace); return; } - } characterInfos.Add(characterInfo); } diff --git a/Barotrauma/BarotraumaClient/Source/Items/Components/Repairable.cs b/Barotrauma/BarotraumaClient/Source/Items/Components/Repairable.cs index 7e8fdc706..ddd2ffb29 100644 --- a/Barotrauma/BarotraumaClient/Source/Items/Components/Repairable.cs +++ b/Barotrauma/BarotraumaClient/Source/Items/Components/Repairable.cs @@ -8,7 +8,7 @@ using System.Xml.Linq; namespace Barotrauma.Items.Components { - partial class Repairable : ItemComponent + partial class Repairable : ItemComponent, IDrawableComponent { private GUIButton repairButton; private GUIProgressBar progressBar; @@ -25,7 +25,13 @@ namespace Barotrauma.Items.Components get; set; } - + + public Vector2 DrawSize + { + //use the extents of the item as the draw size + get { return Vector2.Zero; } + } + public override bool ShouldDrawHUD(Character character) { if (!HasRequiredItems(character, false) || character.SelectedConstruction != item) return false; @@ -98,7 +104,7 @@ namespace Barotrauma.Items.Components } } } - + public override void DrawHUD(SpriteBatch spriteBatch, Character character) { IsActive = true; @@ -137,5 +143,28 @@ namespace Barotrauma.Items.Components { //no need to write anything, just letting the server know we started repairing } + + public void Draw(SpriteBatch spriteBatch, bool editing) + { + if (GameMain.DebugDraw && Character.Controlled?.FocusedItem == item) + { + bool paused = !ShouldDeteriorate(); + if (deteriorationTimer > 0.0f) + { + GUI.DrawString(spriteBatch, + new Vector2(item.WorldPosition.X, -item.WorldPosition.Y), "Deterioration delay " + ((int)deteriorationTimer) + (paused ? " [PAUSED]" : ""), + paused ? Color.Cyan : Color.Lime, Color.Black * 0.5f); + } + else + { + GUI.DrawString(spriteBatch, + new Vector2(item.WorldPosition.X, -item.WorldPosition.Y), "Deteriorating at " + (int)(DeteriorationSpeed * 60.0f) + " units/min" + (paused ? " [PAUSED]" : ""), + paused ? Color.Cyan : Color.Red, Color.Black * 0.5f); + } + GUI.DrawString(spriteBatch, + new Vector2(item.WorldPosition.X, -item.WorldPosition.Y + 20), "Condition: " + (int)item.Condition + "/" + (int)item.MaxCondition, + Color.Orange); + } + } } } diff --git a/Barotrauma/BarotraumaShared/Source/Items/Components/Repairable.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Repairable.cs index f10a3bf3f..867a6c724 100644 --- a/Barotrauma/BarotraumaShared/Source/Items/Components/Repairable.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Components/Repairable.cs @@ -66,6 +66,14 @@ namespace Barotrauma.Items.Components set; } + //if enabled, the deterioration timer will always run regardless if the item is being used or not + [Serialize(false, false)] + public bool DeteriorateAlways + { + get; + set; + } + private Character currentFixer; public Character CurrentFixer { @@ -221,7 +229,7 @@ namespace Barotrauma.Items.Components } } - return true; + return DeteriorateAlways; } private void UpdateFixAnimation(Character character)