(b522c4551) Don't assign the attackinglimb if we shouldn't be attacking. Fixes Hammerhead not falling back after hitting the sub.
This commit is contained in:
@@ -705,16 +705,15 @@ namespace Barotrauma
|
||||
default:
|
||||
UpdateFallBack(attackWorldPos, deltaTime);
|
||||
return;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (AttackingLimb == null || _previousAiTarget != SelectedAiTarget)
|
||||
{
|
||||
AttackingLimb = GetAttackLimb(attackWorldPos);
|
||||
}
|
||||
if (canAttack)
|
||||
{
|
||||
if (AttackingLimb == null || _previousAiTarget != SelectedAiTarget)
|
||||
{
|
||||
AttackingLimb = GetAttackLimb(attackWorldPos);
|
||||
}
|
||||
canAttack = AttackingLimb != null && AttackingLimb.attack.CoolDownTimer <= 0;
|
||||
}
|
||||
float distance = 0;
|
||||
@@ -1233,11 +1232,52 @@ namespace Barotrauma
|
||||
valueModifier = isOutdoor ? 1 : 0;
|
||||
valueModifier *= isOpen ? 5 : 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Ignore disabled walls
|
||||
bool isDisabled = true;
|
||||
for (int i = 0; i < s.Sections.Length; i++)
|
||||
{
|
||||
valueModifier = isOutdoor ? 0 : 1;
|
||||
valueModifier *= isOpen ? 0 : 1;
|
||||
}
|
||||
if (isDisabled)
|
||||
{
|
||||
valueModifier = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
targetingTag = "room";
|
||||
}
|
||||
if (door != null)
|
||||
{
|
||||
// If there's not a more specific tag for the door
|
||||
if (string.IsNullOrEmpty(targetingTag) || targetingTag == "room")
|
||||
{
|
||||
targetingTag = "door";
|
||||
}
|
||||
bool isOutdoor = door.LinkedGap?.FlowTargetHull != null && !door.LinkedGap.IsRoomToRoom;
|
||||
bool isOpen = door.IsOpen || door.Item.Condition <= 0.0f;
|
||||
//increase priority if the character is outside and an aggressive boarder, and the door is from outside to inside
|
||||
if (aggressiveBoarding)
|
||||
{
|
||||
if (character.CurrentHull == null)
|
||||
{
|
||||
valueModifier = isOutdoor ? 1 : 0;
|
||||
valueModifier *= isOpen ? 5 : 1;
|
||||
}
|
||||
for (int i = 0; i < s.Sections.Length; i++)
|
||||
{
|
||||
valueModifier = isOutdoor ? 0 : 1;
|
||||
valueModifier *= isOpen ? 0 : 1;
|
||||
}
|
||||
}
|
||||
else if (isOpen) //ignore broken and open doors
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else if (isOpen) //ignore broken and open doors
|
||||
{
|
||||
|
||||
@@ -14,17 +14,17 @@ namespace Barotrauma
|
||||
|
||||
public readonly AnimController.Animation Animation;
|
||||
|
||||
public CharacterStateInfo(Vector2 pos, float? rotation, Vector2 velocity, float? angularVelocity, float time, Direction dir, Character selectedCharacter, Item selectedItem, AnimController.Animation animation = AnimController.Animation.None)
|
||||
: this(pos, rotation, velocity, angularVelocity, 0, time, dir, selectedCharacter, selectedItem, animation)
|
||||
public CharacterStateInfo(Vector2 pos, float? rotation, Vector2 velocity, float? angularVelocity, float time, Direction dir, Entity interact, AnimController.Animation animation = AnimController.Animation.None)
|
||||
: this(pos, rotation, velocity, angularVelocity, 0, time, dir, interact, animation)
|
||||
{
|
||||
}
|
||||
|
||||
public CharacterStateInfo(Vector2 pos, float? rotation, UInt16 ID, Direction dir, Character selectedCharacter, Item selectedItem, AnimController.Animation animation = AnimController.Animation.None)
|
||||
: this(pos, rotation, Vector2.Zero, 0.0f, ID, 0.0f, dir, selectedCharacter, selectedItem, animation)
|
||||
public CharacterStateInfo(Vector2 pos, float? rotation, UInt16 ID, Direction dir, Entity interact, AnimController.Animation animation = AnimController.Animation.None)
|
||||
: this(pos, rotation, Vector2.Zero, 0.0f, ID, 0.0f, dir, interact, animation)
|
||||
{
|
||||
}
|
||||
|
||||
protected CharacterStateInfo(Vector2 pos, float? rotation, Vector2 velocity, float? angularVelocity, UInt16 ID, float time, Direction dir, Character selectedCharacter, Item selectedItem, AnimController.Animation animation = AnimController.Animation.None)
|
||||
protected CharacterStateInfo(Vector2 pos, float? rotation, Vector2 velocity, float? angularVelocity, UInt16 ID, float time, Direction dir, Entity interact, AnimController.Animation animation = AnimController.Animation.None)
|
||||
: base(pos, rotation, velocity, angularVelocity, ID, time)
|
||||
{
|
||||
Direction = dir;
|
||||
|
||||
@@ -1016,6 +1016,39 @@ namespace Barotrauma
|
||||
|
||||
AllowedLinks = element.GetAttributeStringArray("allowedlinks", new string[0], convertToLowerInvariant: true).ToList();
|
||||
|
||||
if (sprite == null)
|
||||
{
|
||||
DebugConsole.ThrowError("Item \"" + Name + "\" has no sprite!");
|
||||
#if SERVER
|
||||
sprite = new Sprite("", Vector2.Zero);
|
||||
sprite.SourceRect = new Rectangle(0, 0, 32, 32);
|
||||
#else
|
||||
sprite = new Sprite(TextureLoader.PlaceHolderTexture, null, null)
|
||||
{
|
||||
Origin = TextureLoader.PlaceHolderTexture.Bounds.Size.ToVector2() / 2
|
||||
};
|
||||
#endif
|
||||
size = sprite.size;
|
||||
sprite.EntityID = identifier;
|
||||
}
|
||||
|
||||
if (!category.HasFlag(MapEntityCategory.Legacy) && string.IsNullOrEmpty(identifier))
|
||||
{
|
||||
DebugConsole.ThrowError(
|
||||
"Item prefab \"" + name + "\" has no identifier. All item prefabs have a unique identifier string that's used to differentiate between items during saving and loading.");
|
||||
}
|
||||
if (!string.IsNullOrEmpty(identifier))
|
||||
{
|
||||
MapEntityPrefab existingPrefab = List.Find(e => e.Identifier == identifier);
|
||||
if (existingPrefab != null)
|
||||
{
|
||||
DebugConsole.ThrowError(
|
||||
"Map entity prefabs \"" + name + "\" and \"" + existingPrefab.Name + "\" have the same identifier!");
|
||||
}
|
||||
}
|
||||
|
||||
AllowedLinks = element.GetAttributeStringArray("allowedlinks", new string[0], convertToLowerInvariant: true).ToList();
|
||||
|
||||
List.Add(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -74,23 +74,5 @@ namespace Barotrauma.Networking
|
||||
if (lengthSqr > 1000.0f) { return Vector2.Zero; }
|
||||
return cursorPositionError *= 0.7f;
|
||||
}
|
||||
|
||||
public static Vector2 Quantize(Vector2 value, float min, float max, int numberOfBits)
|
||||
{
|
||||
return new Vector2(
|
||||
Quantize(value.X, min, max, numberOfBits),
|
||||
Quantize(value.Y, min, max, numberOfBits));
|
||||
}
|
||||
|
||||
public static float Quantize(float value, float min, float max, int numberOfBits)
|
||||
{
|
||||
float step = (max - min) / (1 << (numberOfBits + 1));
|
||||
if (Math.Abs(value) < step + 0.00001f)
|
||||
{
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
return MathUtils.RoundTowardsClosest(MathHelper.Clamp(value, min, max), step);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user