(5d9bdaea4) Deterioration values (timer, deterioration rate, whether the timer is currently running, item condition) are visible in debugdraw, fixed items that should only deteriorate for X seconds after being used deteriorating continuously
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user