Ragdoll.SetPosition takes platforms into account if the character isn't ignoring platforms (i.e. forcing a character on top of a platform won't make it fall through it), reaching the top/bottom of a ladder won't make networkplayers fall off, server ignores position updates from dead/unconscious characters, smaller ResetRagdollDistance
This commit is contained in:
@@ -814,15 +814,12 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
notClimbing = Math.Abs(targetMovement.X) > 0.05f;
|
notClimbing = Math.Abs(targetMovement.X) > 0.05f ||
|
||||||
|
(TargetMovement.Y < 0.0f && ConvertUnits.ToSimUnits(trigger.Height) + handPos.Y < HeadPosition) ||
|
||||||
|
(TargetMovement.Y > 0.0f && handPos.Y > 0.1f);
|
||||||
}
|
}
|
||||||
|
|
||||||
//stop climbing if:
|
if (notClimbing)
|
||||||
// - moving sideways
|
|
||||||
// - reached the top or bottom of the ladder
|
|
||||||
if (notClimbing ||
|
|
||||||
(TargetMovement.Y < 0.0f && ConvertUnits.ToSimUnits(trigger.Height) + handPos.Y < HeadPosition) ||
|
|
||||||
(TargetMovement.Y > 0.0f && handPos.Y > 0.1f))
|
|
||||||
{
|
{
|
||||||
Anim = Animation.None;
|
Anim = Animation.None;
|
||||||
character.SelectedConstruction = null;
|
character.SelectedConstruction = null;
|
||||||
|
|||||||
@@ -793,7 +793,10 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (original != simPosition)
|
if (original != simPosition)
|
||||||
{
|
{
|
||||||
Body body = Submarine.CheckVisibility(original, simPosition);
|
Category collisionCategory = Physics.CollisionWall | Physics.CollisionLevel;
|
||||||
|
if (!ignorePlatforms) collisionCategory |= Physics.CollisionPlatform;
|
||||||
|
|
||||||
|
Body body = Submarine.PickBody(original, simPosition, null, collisionCategory);
|
||||||
|
|
||||||
//if there's something in between the limbs
|
//if there's something in between the limbs
|
||||||
if (body != null)
|
if (body != null)
|
||||||
@@ -803,13 +806,10 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (lerp)
|
if (lerp)
|
||||||
{
|
{
|
||||||
limb.body.TargetPosition = movePos;
|
limb.body.TargetPosition = movePos;
|
||||||
limb.body.MoveToTargetPosition(Vector2.Distance(limb.SimPosition, movePos) < 10.0f);
|
limb.body.MoveToTargetPosition(Vector2.Distance(limb.SimPosition, movePos) < 10.0f);
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1602,6 +1602,7 @@ namespace Barotrauma
|
|||||||
GameServer.Log(Name + " selected " + pickedItem.Name, Color.Orange);
|
GameServer.Log(Name + " selected " + pickedItem.Name, Color.Orange);
|
||||||
}
|
}
|
||||||
pickedItem.Pick(this, false, pickHit, actionHit);
|
pickedItem.Pick(this, false, pickHit, actionHit);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@@ -1732,6 +1733,8 @@ namespace Barotrauma
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (GameMain.Server != null && (isDead || IsUnconscious)) return;
|
||||||
|
|
||||||
keys[(int)InputType.Use].Held = actionKeyState;
|
keys[(int)InputType.Use].Held = actionKeyState;
|
||||||
keys[(int)InputType.Use].SetState(false, actionKeyState);
|
keys[(int)InputType.Use].SetState(false, actionKeyState);
|
||||||
|
|
||||||
|
|||||||
@@ -1301,14 +1301,19 @@ namespace Barotrauma
|
|||||||
|
|
||||||
System.Diagnostics.Debug.WriteLine("Item.Pick(" + picker + ", " + forceSelectKey + ")");
|
System.Diagnostics.Debug.WriteLine("Item.Pick(" + picker + ", " + forceSelectKey + ")");
|
||||||
|
|
||||||
if (picker.SelectedConstruction == this)
|
if (selected)
|
||||||
{
|
{
|
||||||
if (picker.IsKeyHit(InputType.Select)) picker.SelectedConstruction = null;
|
if (picker.SelectedConstruction == this)
|
||||||
}
|
{
|
||||||
else if (selected)
|
picker.SelectedConstruction = null;
|
||||||
{
|
}
|
||||||
picker.SelectedConstruction = this;
|
else
|
||||||
|
{
|
||||||
|
picker.SelectedConstruction = this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (!hasRequiredSkills && Character.Controlled==picker && Screen.Selected != GameMain.EditMapScreen)
|
if (!hasRequiredSkills && Character.Controlled==picker && Screen.Selected != GameMain.EditMapScreen)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -383,12 +383,18 @@ namespace Barotrauma
|
|||||||
fixture.CollisionCategories == Category.None ||
|
fixture.CollisionCategories == Category.None ||
|
||||||
fixture.CollisionCategories == Physics.CollisionItem) return -1;
|
fixture.CollisionCategories == Physics.CollisionItem) return -1;
|
||||||
|
|
||||||
if (collisionCategory != null && !fixture.CollisionCategories.HasFlag((Category)collisionCategory)) return -1;
|
if (collisionCategory != null &&
|
||||||
|
!fixture.CollisionCategories.HasFlag((Category)collisionCategory) &&
|
||||||
|
!((Category)collisionCategory).HasFlag(fixture.CollisionCategories)) return -1;
|
||||||
|
|
||||||
if (ignoredBodies != null && ignoredBodies.Contains(fixture.Body)) return -1;
|
if (ignoredBodies != null && ignoredBodies.Contains(fixture.Body)) return -1;
|
||||||
|
|
||||||
Structure structure = fixture.Body.UserData as Structure;
|
Structure structure = fixture.Body.UserData as Structure;
|
||||||
if (structure != null && (structure.IsPlatform || !structure.HasBody)) return -1;
|
if (structure != null)
|
||||||
|
{
|
||||||
|
if (!structure.HasBody) return -1;
|
||||||
|
if (structure.IsPlatform && collisionCategory != null && !((Category)collisionCategory).HasFlag(Physics.CollisionPlatform)) return -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (fraction < closestFraction)
|
if (fraction < closestFraction)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
//if a ragdoll is further than this from the correct position, teleport it there
|
//if a ragdoll is further than this from the correct position, teleport it there
|
||||||
//(in sim units)
|
//(in sim units)
|
||||||
public const float ResetRagdollDistance = 2.0f;
|
public const float ResetRagdollDistance = 1.0f;
|
||||||
|
|
||||||
//if the ragdoll is closer than this, don't try to correct its position
|
//if the ragdoll is closer than this, don't try to correct its position
|
||||||
public const float AllowedRagdollDistance = 0.1f;
|
public const float AllowedRagdollDistance = 0.1f;
|
||||||
|
|||||||
Reference in New Issue
Block a user