Fixed carrying stunned people being a severe case of a major ass pain by carrying over the "stairs" from the carrier.
Added "CarriedBy" property, publicized CarriedCharacter and CarriedBy, synced CarriedCharacter and CarriedBy for cool points Publicized Stairs property
This commit is contained in:
@@ -237,7 +237,7 @@ namespace Barotrauma
|
||||
|
||||
float getUpSpeed = 0.3f;
|
||||
float walkCycleSpeed = movement.X * walkAnimSpeed;
|
||||
if (stairs != null)
|
||||
if (Stairs != null)
|
||||
{
|
||||
TargetMovement = new Vector2(MathHelper.Clamp(TargetMovement.X, -1.5f, 1.5f), TargetMovement.Y);
|
||||
|
||||
@@ -328,7 +328,7 @@ namespace Barotrauma
|
||||
float floorPos = GetFloorY(colliderPos + new Vector2(Math.Sign(movement.X) * 0.5f, 1.0f));
|
||||
bool onSlope = floorPos > GetColliderBottom().Y + 0.05f;
|
||||
|
||||
if (stairs != null || onSlope)
|
||||
if (Stairs != null || onSlope)
|
||||
{
|
||||
torso.pullJoint.WorldAnchorB = new Vector2(
|
||||
MathHelper.SmoothStep(torso.SimPosition.X, footMid + movement.X * 0.25f, getUpSpeed * 0.8f),
|
||||
@@ -382,7 +382,7 @@ namespace Barotrauma
|
||||
Vector2 footPos = stepSize * -i;
|
||||
if (stepSize.Y < 0.0f) stepSize.Y = -0.15f;
|
||||
|
||||
if (onSlope && stairs == null)
|
||||
if (onSlope && Stairs == null)
|
||||
{
|
||||
footPos.Y *= 2.0f;
|
||||
}
|
||||
@@ -462,7 +462,7 @@ namespace Barotrauma
|
||||
footPos = new Vector2(GetCenterOfMass().X + stepSize.X * i * 0.2f, colliderPos.Y - 0.1f);
|
||||
}
|
||||
|
||||
if (stairs == null)
|
||||
if (Stairs == null)
|
||||
{
|
||||
footPos.Y = Math.Max(Math.Min(floorPos, footPos.Y + 0.5f), footPos.Y);
|
||||
}
|
||||
@@ -987,7 +987,7 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
//if on stairs, make the dragged character "climb up" (= collide with stairs)
|
||||
//if (stairs != null) target.AnimController.TargetMovement = new Vector2 (target.AnimController.TargetMovement.X, 1.0f);
|
||||
//if (Stairs != null) target.AnimController.TargetMovement = new Vector2 (target.AnimController.TargetMovement.X, 1.0f);
|
||||
}
|
||||
|
||||
public void Grab(Vector2 rightHandPos, Vector2 leftHandPos)
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace Barotrauma
|
||||
|
||||
protected float colliderHeightFromFloor;
|
||||
|
||||
protected Structure stairs;
|
||||
public Structure Stairs;
|
||||
|
||||
protected Direction dir;
|
||||
|
||||
@@ -452,7 +452,7 @@ namespace Barotrauma
|
||||
}
|
||||
else if (structure.StairDirection != Direction.None)
|
||||
{
|
||||
stairs = null;
|
||||
Stairs = null;
|
||||
|
||||
//don't collider with stairs if
|
||||
|
||||
@@ -475,8 +475,15 @@ namespace Barotrauma
|
||||
if (inWater && targetMovement.Y < 0.5f) return false;
|
||||
|
||||
//---------------
|
||||
|
||||
stairs = structure;
|
||||
|
||||
//set stairs to that of the one dragging us
|
||||
if (character.SelectedBy != null)
|
||||
Stairs = character.SelectedBy.AnimController.Stairs;
|
||||
else
|
||||
Stairs = structure;
|
||||
|
||||
if (Stairs == null)
|
||||
return false;
|
||||
}
|
||||
|
||||
CalculateImpact(f1, f2, contact);
|
||||
@@ -895,8 +902,8 @@ namespace Barotrauma
|
||||
limb.Update(deltaTime);
|
||||
}
|
||||
|
||||
bool onStairs = stairs != null;
|
||||
stairs = null;
|
||||
bool onStairs = Stairs != null;
|
||||
Stairs = null;
|
||||
|
||||
var contacts = Collider.FarseerBody.ContactList;
|
||||
while (Collider.FarseerBody.Enabled && contacts != null && contacts.Contact != null)
|
||||
@@ -914,7 +921,7 @@ namespace Barotrauma
|
||||
Structure structure = contacts.Contact.FixtureA.Body.UserData as Structure;
|
||||
if (structure != null && onStairs)
|
||||
{
|
||||
stairs = structure;
|
||||
Stairs = structure;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -963,7 +970,7 @@ namespace Barotrauma
|
||||
rayEnd.Y -= Collider.height * 0.5f + Collider.radius + colliderHeightFromFloor*1.2f;
|
||||
|
||||
Vector2 colliderBottomDisplay = ConvertUnits.ToDisplayUnits(GetColliderBottom());
|
||||
if (!inWater && !character.IsDead && !character.IsUnconscious && levitatingCollider && Collider.LinearVelocity.Y>-ImpactTolerance)
|
||||
if (!inWater && !character.IsDead && character.Stun <= 0f && levitatingCollider && Collider.LinearVelocity.Y>-ImpactTolerance)
|
||||
{
|
||||
float closestFraction = 1.0f;
|
||||
Fixture closestFixture = null;
|
||||
@@ -975,6 +982,7 @@ namespace Barotrauma
|
||||
Structure structure = fixture.Body.UserData as Structure;
|
||||
if (inWater && targetMovement.Y < 0.5f) return -1;
|
||||
if (colliderBottomDisplay.Y < structure.Rect.Y - structure.Rect.Height + 30 && TargetMovement.Y < 0.5f) return -1;
|
||||
if (character.SelectedBy != null) return -1;
|
||||
break;
|
||||
case Physics.CollisionPlatform:
|
||||
Structure platform = fixture.Body.UserData as Structure;
|
||||
@@ -1004,7 +1012,7 @@ namespace Barotrauma
|
||||
switch (closestFixture.CollisionCategories)
|
||||
{
|
||||
case Physics.CollisionStairs:
|
||||
stairs = closestFixture.Body.UserData as Structure;
|
||||
Stairs = closestFixture.Body.UserData as Structure;
|
||||
onStairs = true;
|
||||
forceImmediate = true;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user