(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);
|
DebugConsole.ThrowError("Tried to add the same character info to CrewManager twice.\n" + Environment.StackTrace);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
characterInfos.Add(characterInfo);
|
characterInfos.Add(characterInfo);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ using System.Xml.Linq;
|
|||||||
|
|
||||||
namespace Barotrauma.Items.Components
|
namespace Barotrauma.Items.Components
|
||||||
{
|
{
|
||||||
partial class Repairable : ItemComponent
|
partial class Repairable : ItemComponent, IDrawableComponent
|
||||||
{
|
{
|
||||||
private GUIButton repairButton;
|
private GUIButton repairButton;
|
||||||
private GUIProgressBar progressBar;
|
private GUIProgressBar progressBar;
|
||||||
@@ -26,6 +26,12 @@ namespace Barotrauma.Items.Components
|
|||||||
set;
|
set;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Vector2 DrawSize
|
||||||
|
{
|
||||||
|
//use the extents of the item as the draw size
|
||||||
|
get { return Vector2.Zero; }
|
||||||
|
}
|
||||||
|
|
||||||
public override bool ShouldDrawHUD(Character character)
|
public override bool ShouldDrawHUD(Character character)
|
||||||
{
|
{
|
||||||
if (!HasRequiredItems(character, false) || character.SelectedConstruction != item) return false;
|
if (!HasRequiredItems(character, false) || character.SelectedConstruction != item) return false;
|
||||||
@@ -137,5 +143,28 @@ namespace Barotrauma.Items.Components
|
|||||||
{
|
{
|
||||||
//no need to write anything, just letting the server know we started repairing
|
//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;
|
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;
|
private Character currentFixer;
|
||||||
public Character CurrentFixer
|
public Character CurrentFixer
|
||||||
{
|
{
|
||||||
@@ -221,7 +229,7 @@ namespace Barotrauma.Items.Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return DeteriorateAlways;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateFixAnimation(Character character)
|
private void UpdateFixAnimation(Character character)
|
||||||
|
|||||||
Reference in New Issue
Block a user