Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove RepairTool progress bars from indestructible structures and items. #13754

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -76,19 +76,22 @@ public Vector2 DrawSize

partial void FixStructureProjSpecific(Character user, float deltaTime, Structure targetStructure, int sectionIndex)
{
Vector2 progressBarPos = targetStructure.SectionPosition(sectionIndex);
if (targetStructure.Submarine != null)
if (!targetStructure.Indestructible && targetStructure.Submarine is not { GodMode: true })
{
progressBarPos += targetStructure.Submarine.DrawPosition;
}
Vector2 progressBarPos = targetStructure.SectionPosition(sectionIndex);
if (targetStructure.Submarine != null)
{
progressBarPos += targetStructure.Submarine.DrawPosition;
}

var progressBar = user.UpdateHUDProgressBar(
targetStructure.ID * 1000 + sectionIndex, //unique "identifier" for each wall section
progressBarPos,
MathUtils.InverseLerp(targetStructure.Prefab.MinHealth, targetStructure.Health, targetStructure.Health - targetStructure.SectionDamage(sectionIndex)),
GUIStyle.Red, GUIStyle.Green);
var progressBar = user.UpdateHUDProgressBar(
targetStructure.ID * 1000 + sectionIndex, //unique "identifier" for each wall section
progressBarPos,
MathUtils.InverseLerp(targetStructure.Prefab.MinHealth, targetStructure.Health, targetStructure.Health - targetStructure.SectionDamage(sectionIndex)),
GUIStyle.Red, GUIStyle.Green);

if (progressBar != null) progressBar.Size = new Vector2(60.0f, 20.0f);
if (progressBar != null) progressBar.Size = new Vector2(60.0f, 20.0f);
}

Vector2 particlePos = ConvertUnits.ToDisplayUnits(pickedPosition);
if (targetStructure.Submarine != null) particlePos += targetStructure.Submarine.DrawPosition;
Expand All @@ -112,7 +115,7 @@ public Vector2 DrawSize

partial void FixItemProjSpecific(Character user, float deltaTime, Item targetItem, bool showProgressBar)
{
if (showProgressBar)
if (!targetItem.Indestructible && !targetItem.InvulnerableToDamage && showProgressBar)
{
float progressBarState = targetItem.ConditionPercentage / 100.0f;
if (!MathUtils.NearlyEqual(progressBarState, prevProgressBarState) || prevProgressBarTarget != targetItem)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ public void Draw(SpriteBatch spriteBatch, bool editing, float itemDepth = -1, Co
paused ? Color.Cyan : GUIStyle.Red, Color.Black * 0.5f);
}
GUI.DrawString(spriteBatch,
new Vector2(item.DrawPosition.X, -item.DrawPosition.Y + 20), "Condition: " + (int)item.Condition + "/" + (int)item.MaxCondition,
new Vector2(item.DrawPosition.X, -item.DrawPosition.Y + 20), "Condition: " + (int)item.Condition + "/" + (int)item.MaxCondition + (item.Indestructible || item.InvulnerableToDamage ? "\n[INDESTRUCTIBLE]" : ""),
GUIStyle.Orange);
}
}
Expand Down
4 changes: 3 additions & 1 deletion Barotrauma/BarotraumaClient/ClientSource/Map/Structure.cs
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,9 @@ private void Draw(SpriteBatch spriteBatch, bool editing, bool back = true, Effec
{
var textPos = SectionPosition(i, true);
textPos.Y = -textPos.Y;
GUI.DrawString(spriteBatch, textPos, "Damage: " + (int)((GetSection(i).damage / MaxHealth) * 100f) + "%", Color.Yellow);
GUI.DrawString(spriteBatch,
textPos, "Damage: " + (int)((GetSection(i).damage / MaxHealth) * 100f) + "%" + (Indestructible ? "\n[INDESTRUCTIBLE]" : (Submarine is { GodMode: true } ? "\n[GODMODE]" : "")),
Color.Yellow);
}
}
}
Expand Down