(94ad97066) Refactor combat objective. The bots should now be able to reload and seek more ammunition. When they run out of ammunition, they first try to use another weapon and only if no other weapon is found, they seek more ammunition. Had to change the contain item and get item objectives a bit. Hopefully doesn't break things too much.

This commit is contained in:
Joonas Rikkonen
2019-05-16 06:13:15 +03:00
parent 298f1a79b0
commit ce7b9c4f52
41 changed files with 634 additions and 348 deletions
@@ -198,9 +198,7 @@ namespace Barotrauma
focusName = character.FocusedCharacter.Info.DisplayName;
}
Vector2 textPos = startPos;
Vector2 offset = GUI.Font.MeasureString(focusName);
textPos -= new Vector2(offset.X / 2, offset.Y);
textPos -= new Vector2(GUI.Font.MeasureString(focusName).X / 2, 20);
Color nameColor = Color.White;
if (character.TeamID != character.FocusedCharacter.TeamID)
@@ -209,23 +207,23 @@ namespace Barotrauma
}
GUI.DrawString(spriteBatch, textPos, focusName, nameColor, Color.Black * 0.7f, 2);
textPos.Y += offset.Y;
textPos.Y += 20;
if (character.FocusedCharacter.CanInventoryBeAccessed)
{
GUI.DrawString(spriteBatch, textPos, GetCachedHudText("GrabHint", GameMain.Config.KeyBind(InputType.Grab).ToString()),
Color.LightGreen, Color.Black, 2, GUI.SmallFont);
textPos.Y += offset.Y;
textPos.Y += 15;
}
if (character.FocusedCharacter.CharacterHealth.UseHealthWindow)
{
GUI.DrawString(spriteBatch, textPos, GetCachedHudText("HealHint", GameMain.Config.KeyBind(InputType.Health).ToString()),
Color.LightGreen, Color.Black, 2, GUI.SmallFont);
textPos.Y += offset.Y;
textPos.Y += 15;
}
if (!string.IsNullOrEmpty(character.FocusedCharacter.customInteractHUDText))
{
GUI.DrawString(spriteBatch, textPos, character.FocusedCharacter.customInteractHUDText, Color.LightGreen, Color.Black, 2, GUI.SmallFont);
textPos.Y += offset.Y;
textPos.Y += 15;
}
}
@@ -261,10 +259,8 @@ namespace Barotrauma
var hudTexts = focusedItem.GetHUDTexts(character);
int dir = Math.Sign(focusedItem.WorldPosition.X - character.WorldPosition.X);
Vector2 offset = GUI.Font.MeasureString(focusedItem.Name);
Vector2 startPos = cam.WorldToScreen(focusedItem.DrawPosition);
startPos.Y -= (hudTexts.Count + 1) * offset.Y;
startPos.Y -= (hudTexts.Count + 1) * 20;
if (focusedItem.Sprite != null)
{
startPos.X += (int)(circleSize * 0.4f * dir);
@@ -272,17 +268,17 @@ namespace Barotrauma
}
Vector2 textPos = startPos;
if (dir == -1) textPos.X -= offset.X;
if (dir == -1) textPos.X -= (int)GUI.Font.MeasureString(focusedItem.Name).X;
float alpha = MathHelper.Clamp((focusedItemOverlayTimer - ItemOverlayDelay) * 2.0f, 0.0f, 1.0f);
GUI.DrawString(spriteBatch, textPos, focusedItem.Name, Color.White * alpha, Color.Black * alpha * 0.7f, 2);
textPos.Y += offset.Y;
textPos.Y += 20.0f;
foreach (ColoredText coloredText in hudTexts)
{
if (dir == -1) textPos.X = (int)(startPos.X - GUI.SmallFont.MeasureString(coloredText.Text).X);
GUI.DrawString(spriteBatch, textPos, coloredText.Text, coloredText.Color * alpha, Color.Black * alpha * 0.7f, 2, GUI.SmallFont);
textPos.Y += offset.Y;
textPos.Y += 20;
}
}
}