(45f083a5a) Merge branch 'dev' of https://github.com/Regalis11/Barotrauma-development into dev
This commit is contained in:
@@ -631,8 +631,7 @@ namespace Barotrauma
|
||||
else
|
||||
{
|
||||
// If the secondary cooldown is defined and expired, check if we can switch the attack
|
||||
var previousLimb = AttackingLimb;
|
||||
var newLimb = GetAttackLimb(attackWorldPos, previousLimb);
|
||||
var newLimb = GetAttackLimb(attackWorldPos, AttackingLimb);
|
||||
if (newLimb != null)
|
||||
{
|
||||
// Attack with the new limb
|
||||
@@ -680,8 +679,7 @@ namespace Barotrauma
|
||||
else
|
||||
{
|
||||
// If the secondary cooldown is defined and expired, check if we can switch the attack
|
||||
var previousLimb = AttackingLimb;
|
||||
var newLimb = GetAttackLimb(attackWorldPos, previousLimb);
|
||||
var newLimb = GetAttackLimb(attackWorldPos, AttackingLimb);
|
||||
if (newLimb != null)
|
||||
{
|
||||
// Attack with the new limb
|
||||
@@ -707,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;
|
||||
@@ -725,6 +722,12 @@ namespace Barotrauma
|
||||
// Check that we can reach the target
|
||||
distance = Vector2.Distance(AttackingLimb.WorldPosition, attackWorldPos);
|
||||
canAttack = distance < AttackingLimb.attack.Range;
|
||||
if (!canAttack && !IsCoolDownRunning)
|
||||
{
|
||||
// If not, reset the attacking limb, if the cooldown is not running
|
||||
// Don't use the property, because we don't want cancel reversing, if we are reversing.
|
||||
_attackingLimb = null;
|
||||
}
|
||||
}
|
||||
|
||||
// If the attacking limb is a hand or claw, for example, using it as the steering limb can end in the result where the character circles around the target. For example the Hammerhead steering with the claws when it should use the torso.
|
||||
@@ -794,7 +797,6 @@ namespace Barotrauma
|
||||
{
|
||||
UpdateLimbAttack(deltaTime, AttackingLimb, attackSimPos, distance);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool SteerThroughGap(Structure wall, WallSection section, Vector2 targetWorldPos, float deltaTime)
|
||||
@@ -1041,7 +1043,7 @@ namespace Barotrauma
|
||||
}
|
||||
else
|
||||
{
|
||||
steeringManager.SteeringSeek(attackSimPosition - (mouthPos - SimPosition));
|
||||
steeringManager.SteeringSeek(attackSimPosition - (mouthPos - SimPosition), 2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1165,15 +1167,15 @@ namespace Barotrauma
|
||||
else if (target.Entity is Structure s)
|
||||
{
|
||||
targetingTag = "wall";
|
||||
if (!s.HasBody)
|
||||
{
|
||||
// Ignore structures that doesn't have a body (not walls)
|
||||
continue;
|
||||
}
|
||||
// Ignore walls when inside.
|
||||
valueModifier = character.CurrentHull == null ? 1 : 0;
|
||||
if (aggressiveBoarding)
|
||||
{
|
||||
// Ignore walls when inside.
|
||||
valueModifier = character.CurrentHull == null ? 2 : 0;
|
||||
if (valueModifier > 0)
|
||||
{
|
||||
// Ignore structures that doesn't have a body (not walls)
|
||||
valueModifier *= s.HasBody ? 1 : 0;
|
||||
}
|
||||
for (int i = 0; i < s.Sections.Length; i++)
|
||||
{
|
||||
var section = s.Sections[i];
|
||||
@@ -1190,6 +1192,23 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Ignore disabled walls
|
||||
bool isDisabled = true;
|
||||
for (int i = 0; i < s.Sections.Length; i++)
|
||||
{
|
||||
if (!s.SectionBodyDisabled(i))
|
||||
{
|
||||
isDisabled = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (isDisabled)
|
||||
{
|
||||
valueModifier = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
+1
-4
@@ -84,12 +84,9 @@ namespace Barotrauma
|
||||
useExtinquisherTimer += deltaTime;
|
||||
if (useExtinquisherTimer > 2.0f) useExtinquisherTimer = 0.0f;
|
||||
|
||||
character.AIController.SteeringManager.Reset();
|
||||
character.CursorPosition = fs.Position;
|
||||
character.SetInput(InputType.Aim, false, true);
|
||||
if (!character.IsClimbing)
|
||||
{
|
||||
character.AIController.SteeringManager.Reset();
|
||||
}
|
||||
extinguisher.Use(deltaTime, character);
|
||||
|
||||
if (!targetHull.FireSources.Contains(fs))
|
||||
|
||||
+5
-2
@@ -168,8 +168,11 @@ namespace Barotrauma
|
||||
// Too close -> steer away
|
||||
character.AIController.SteeringManager.SteeringManual(deltaTime, Vector2.Normalize(character.SimPosition - Item.SimPosition) / 2);
|
||||
}
|
||||
if (character.IsClimbing ||
|
||||
VectorExtensions.Angle(VectorExtensions.Forward(repairTool.Item.body.TransformedRotation), fromToolToTarget) < MathHelper.PiOver4)
|
||||
else
|
||||
{
|
||||
character.AIController.SteeringManager.Reset();
|
||||
}
|
||||
if (VectorExtensions.Angle(VectorExtensions.Forward(repairTool.Item.body.TransformedRotation), fromToolToTarget) < MathHelper.PiOver4)
|
||||
{
|
||||
repairTool.Use(deltaTime, character);
|
||||
}
|
||||
|
||||
@@ -696,7 +696,7 @@ namespace Barotrauma
|
||||
return;
|
||||
}
|
||||
|
||||
limb.body.ApplyForce(diff * (float)(Math.Sin(WalkPos) * Math.Sqrt(limb.Mass)) * 30.0f * animStrength);
|
||||
limb.body.ApplyForce(diff * (float)(Math.Sin(WalkPos) * Math.Sqrt(limb.Mass)) * 30.0f * animStrength, maxVelocity: 10.0f);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Barotrauma.Extensions;
|
||||
using Barotrauma.Networking;
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
@@ -1122,9 +1123,6 @@ namespace Barotrauma
|
||||
//prevent the hands from going above the top of the ladders
|
||||
handPos.Y = Math.Min(-0.5f, handPos.Y);
|
||||
|
||||
//prevent the hands from going above the top of the ladders
|
||||
handPos.Y = Math.Min(-0.5f, handPos.Y);
|
||||
|
||||
// TODO: lock only one hand when aiming?
|
||||
if (!PlayerInput.KeyDown(InputType.Aim) || Math.Abs(movement.Y) > 0.01f)
|
||||
{
|
||||
@@ -1660,7 +1658,7 @@ namespace Barotrauma
|
||||
|
||||
Holdable holdable = item.GetComponent<Holdable>();
|
||||
|
||||
if (!character.IsClimbing && !usingController && character.Stun <= 0.0f && aim && itemPos != Vector2.Zero)
|
||||
if (!isClimbing && !usingController && character.Stun <= 0.0f && aim && itemPos != Vector2.Zero)
|
||||
{
|
||||
Vector2 mousePos = ConvertUnits.ToSimUnits(character.SmoothedCursorPosition);
|
||||
|
||||
@@ -1690,7 +1688,7 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
Vector2 transformedHoldPos = shoulder.WorldAnchorA;
|
||||
if (itemPos == Vector2.Zero || character.IsClimbing || usingController)
|
||||
if (itemPos == Vector2.Zero || isClimbing || usingController)
|
||||
{
|
||||
if (character.SelectedItems[0] == item)
|
||||
{
|
||||
@@ -1779,8 +1777,6 @@ namespace Barotrauma
|
||||
|
||||
item.SetTransform(currItemPos, itemAngle + itemAngleRelativeToHoldAngle * Dir);
|
||||
|
||||
if (character.IsClimbing) return;
|
||||
|
||||
if (!isClimbing)
|
||||
{
|
||||
for (int i = 0; i < 2; i++)
|
||||
|
||||
@@ -1147,7 +1147,7 @@ namespace Barotrauma
|
||||
{
|
||||
//Limb head = AnimController.GetLimb(LimbType.Head);
|
||||
// Values lower than this seem to cause constantious flipping when the mouse is near the player and the player is running, because the root collider moves after flipping.
|
||||
float followMargin = 30;
|
||||
float followMargin = 40;
|
||||
if (dontFollowCursor)
|
||||
{
|
||||
AnimController.TargetDir = Direction.Right;
|
||||
@@ -2187,7 +2187,7 @@ namespace Barotrauma
|
||||
|
||||
if (limbHit == null) return new AttackResult();
|
||||
|
||||
limbHit.body?.ApplyLinearImpulse(attack.TargetImpulseWorld + attack.TargetForceWorld * deltaTime);
|
||||
limbHit.body?.ApplyLinearImpulse(attack.TargetImpulseWorld + attack.TargetForceWorld * deltaTime, maxVelocity: NetConfig.MaxPhysicsBodyVelocity);
|
||||
#if SERVER
|
||||
if (attacker is Character attackingCharacter && attackingCharacter.AIController == null)
|
||||
{
|
||||
@@ -2273,7 +2273,8 @@ namespace Barotrauma
|
||||
{
|
||||
Vector2 diff = dir;
|
||||
if (diff == Vector2.Zero) diff = Rand.Vector(1.0f);
|
||||
hitLimb.body.ApplyLinearImpulse(Vector2.Normalize(diff) * attackImpulse, hitLimb.SimPosition + ConvertUnits.ToSimUnits(diff));
|
||||
hitLimb.body.ApplyLinearImpulse(Vector2.Normalize(diff) * attackImpulse, hitLimb.SimPosition + ConvertUnits.ToSimUnits(diff),
|
||||
maxVelocity: NetConfig.MaxPhysicsBodyVelocity);
|
||||
}
|
||||
Vector2 simPos = hitLimb.SimPosition + ConvertUnits.ToSimUnits(dir);
|
||||
AttackResult attackResult = hitLimb.AddDamage(simPos, afflictions, playSound);
|
||||
|
||||
@@ -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, Entity interact, AnimController.Animation animation = AnimController.Animation.None)
|
||||
: this(pos, rotation, velocity, angularVelocity, 0, time, dir, interact, 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, 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)
|
||||
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)
|
||||
{
|
||||
}
|
||||
|
||||
protected CharacterStateInfo(Vector2 pos, float? rotation, Vector2 velocity, float? angularVelocity, UInt16 ID, float time, Direction dir, Entity interact, AnimController.Animation animation = AnimController.Animation.None)
|
||||
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)
|
||||
: base(pos, rotation, velocity, angularVelocity, ID, time)
|
||||
{
|
||||
Direction = dir;
|
||||
|
||||
@@ -626,13 +626,17 @@ namespace Barotrauma
|
||||
|
||||
Limb limb = character.AnimController.Limbs[limbIndex];
|
||||
Vector2 forcePos = limb.pullJoint == null ? limb.body.SimPosition : limb.pullJoint.WorldAnchorA;
|
||||
limb.body.ApplyLinearImpulse(limb.Mass * attack.Force * Vector2.Normalize(attackSimPos - SimPosition), forcePos);
|
||||
limb.body.ApplyLinearImpulse(limb.Mass * attack.Force * Vector2.Normalize(attackSimPos - SimPosition), forcePos,
|
||||
maxVelocity: NetConfig.MaxPhysicsBodyVelocity);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Vector2 forcePos = pullJoint == null ? body.SimPosition : pullJoint.WorldAnchorA;
|
||||
body.ApplyLinearImpulse(Mass * attack.Force * Vector2.Normalize(attackSimPos - SimPosition), forcePos);
|
||||
body.ApplyLinearImpulse(
|
||||
Mass * attack.Force * Vector2.Normalize(attackSimPos - SimPosition),
|
||||
forcePos,
|
||||
maxVelocity: NetConfig.MaxPhysicsBodyVelocity);
|
||||
}
|
||||
}
|
||||
return wasHit;
|
||||
|
||||
Reference in New Issue
Block a user