Fixed Ragdoll.HeadInWater not being set to true if the character is inside a water-filled hull but the head is outside the sub, HUDProgressBars aren't created when a non-controlled character repairs something

This commit is contained in:
Regalis
2016-12-28 20:00:40 +02:00
parent 49d4108eeb
commit 12b7290bad
3 changed files with 4 additions and 1 deletions

View File

@@ -869,6 +869,7 @@ namespace Barotrauma
{
//limb isn't in any room -> it's in the water
limb.inWater = true;
if (limb.type == LimbType.Head) headInWater = true;
}
else if (limbHull.Volume > 0.0f && Submarine.RectContains(limbHull.Rect, limb.Position))
{

View File

@@ -1423,6 +1423,8 @@ namespace Barotrauma
/// </summary>
public HUDProgressBar UpdateHUDProgressBar(object linkedObject, Vector2 worldPosition, float progress, Color emptyColor, Color fullColor)
{
if (controlled != this) return null;
HUDProgressBar progressBar = null;
if (!hudProgressBars.TryGetValue(linkedObject, out progressBar))
{

View File

@@ -195,7 +195,7 @@ namespace Barotrauma.Items.Components
1.0f - targetStructure.SectionDamage(sectionIndex) / targetStructure.Health,
Color.Red, Color.Green);
progressBar.Size = new Vector2(60.0f, 20.0f);
if (progressBar != null) progressBar.Size = new Vector2(60.0f, 20.0f);
targetStructure.AddDamage(sectionIndex, -StructureFixAmount * degreeOfSuccess);