Fixed endless messagebox spam when the controlled character turns into a husk, fixed an index our of range exception when merging firesources

This commit is contained in:
Joonas Rikkonen
2017-07-09 16:17:44 +03:00
parent 2598bb1bd3
commit bd4c7d68d0
3 changed files with 5 additions and 7 deletions
@@ -20,9 +20,9 @@ namespace Barotrauma
new GUIMessageBox("", InfoTextManager.GetInfoText("HuskCantSpeak")); new GUIMessageBox("", InfoTextManager.GetInfoText("HuskCantSpeak"));
} }
} }
else else if (state != InfectionState.Active && Character.Controlled == character)
{ {
if (Character.Controlled == character) new GUIMessageBox("", InfoTextManager.GetInfoText("HuskActivate")); new GUIMessageBox("", InfoTextManager.GetInfoText("HuskActivate"));
} }
} }
} }
@@ -44,6 +44,7 @@ namespace Barotrauma
{ {
float prevTimer = IncubationTimer; float prevTimer = IncubationTimer;
UpdateProjSpecific(prevTimer,character);
if (IncubationTimer < 0.5f) if (IncubationTimer < 0.5f)
{ {
UpdateDormantState(deltaTime, character); UpdateDormantState(deltaTime, character);
@@ -56,7 +57,6 @@ namespace Barotrauma
{ {
UpdateActiveState(deltaTime, character); UpdateActiveState(deltaTime, character);
} }
UpdateProjSpecific(prevTimer,character);
} }
partial void UpdateProjSpecific(float prevTimer, Character character); partial void UpdateProjSpecific(float prevTimer, Character character);
@@ -86,7 +86,7 @@ namespace Barotrauma
state = InfectionState.Active; state = InfectionState.Active;
} }
character.AddDamage(CauseOfDeath.Husk, 0.5f*deltaTime, null); character.AddDamage(CauseOfDeath.Husk, 0.5f * deltaTime, null);
} }
@@ -117,11 +117,9 @@ namespace Barotrauma
{ {
for (int j = i - 1; j >= 0; j--) for (int j = i - 1; j >= 0; j--)
{ {
if (fireSources[i].hull != fireSources[j].hull) continue;
i = Math.Min(i, fireSources.Count - 1); i = Math.Min(i, fireSources.Count - 1);
j = Math.Min(j, i - 1); j = Math.Min(j, i - 1);
if (!fireSources[i].CheckOverLap(fireSources[j])) continue; if (!fireSources[i].CheckOverLap(fireSources[j])) continue;
float leftEdge = Math.Min(fireSources[i].position.X, fireSources[j].position.X); float leftEdge = Math.Min(fireSources[i].position.X, fireSources[j].position.X);