Progress bars that show the health of wall sections when welding/cutting

This commit is contained in:
Regalis
2016-09-20 18:40:30 +03:00
parent f8368f464a
commit 5918e845ac
7 changed files with 140 additions and 41 deletions
@@ -182,7 +182,13 @@ namespace Barotrauma.Items.Components
int sectionIndex = targetStructure.FindSectionIndex(ConvertUnits.ToDisplayUnits(pickedPosition));
if (sectionIndex < 0) return;
targetStructure.HighLightSection(sectionIndex);
var progressBar = user.UpdateHUDProgressBar(
targetStructure,
targetStructure.SectionPosition(sectionIndex) + targetStructure.Submarine.DrawPosition,
1.0f - targetStructure.SectionDamage(sectionIndex) / targetStructure.Health,
Color.Red, Color.Green);
progressBar.Size = new Vector2(60.0f, 20.0f);
targetStructure.AddDamage(sectionIndex, -StructureFixAmount * degreeOfSuccess);
@@ -195,7 +201,7 @@ namespace Barotrauma.Items.Components
(sectionIndex == targetStructure.SectionCount - 2 && i == 1) ||
(nextSectionLength > 0 && nextSectionLength < Structure.wallSectionSize * 0.3f))
{
targetStructure.HighLightSection(sectionIndex + i);
//targetStructure.HighLightSection(sectionIndex + i);
targetStructure.AddDamage(sectionIndex + i, -StructureFixAmount * degreeOfSuccess);
}
}
@@ -213,7 +219,7 @@ namespace Barotrauma.Items.Components
ApplyStatusEffects(ActionType.OnUse, targetItem.AllPropertyObjects, deltaTime);
}
}
public override bool AIOperate(float deltaTime, Character character, AIObjectiveOperateItem objective)
{
Gap leak = objective.OperateTarget as Gap;
@@ -222,7 +228,7 @@ namespace Barotrauma.Items.Components
float dist = Vector2.Distance(leak.WorldPosition, item.WorldPosition);
//too far away -> consider this done and hope the AI is smart enough to move closer
if (dist > range*5.0f) return true;
if (dist > range * 5.0f) return true;
//steer closer if almost in range
if (dist > range)
@@ -240,8 +246,6 @@ namespace Barotrauma.Items.Components
//close enough -> stop moving
character.AIController.SteeringManager.Reset();
}
character.CursorPosition = leak.Position;
character.SetInput(InputType.Aim, false, true);