(bb287fabc) Decreased simple physics distance, sonar now displays characters that are in simple physics mode
This commit is contained in:
@@ -785,15 +785,32 @@ namespace Barotrauma.Items.Components
|
|||||||
|
|
||||||
foreach (Character c in Character.CharacterList)
|
foreach (Character c in Character.CharacterList)
|
||||||
{
|
{
|
||||||
if (c.AnimController.CurrentHull != null || !c.Enabled) continue;
|
if (c.AnimController.CurrentHull != null || !c.Enabled) { continue; }
|
||||||
if (DetectSubmarineWalls && c.AnimController.CurrentHull == null && item.CurrentHull != null) continue;
|
if (DetectSubmarineWalls && c.AnimController.CurrentHull == null && item.CurrentHull != null) { continue; }
|
||||||
|
|
||||||
|
if (c.AnimController.SimplePhysicsEnabled)
|
||||||
|
{
|
||||||
|
float pointDist = ((c.WorldPosition - pingSource) * displayScale).LengthSquared();
|
||||||
|
if (pointDist > DisplayRadius * DisplayRadius) { continue; }
|
||||||
|
|
||||||
|
if (pointDist > prevPingRadiusSqr && pointDist < pingRadiusSqr)
|
||||||
|
{
|
||||||
|
var blip = new SonarBlip(
|
||||||
|
c.WorldPosition,
|
||||||
|
MathHelper.Clamp(c.Mass, 0.1f, pingStrength),
|
||||||
|
MathHelper.Clamp(c.Mass * 0.03f, 0.1f, 2.0f));
|
||||||
|
if (!passive && !CheckBlipVisibility(blip, transducerPos)) { continue; }
|
||||||
|
sonarBlips.Add(blip);
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
foreach (Limb limb in c.AnimController.Limbs)
|
foreach (Limb limb in c.AnimController.Limbs)
|
||||||
{
|
{
|
||||||
if (!limb.body.Enabled) { continue; }
|
if (!limb.body.Enabled) { continue; }
|
||||||
|
|
||||||
float pointDist = ((limb.WorldPosition - pingSource) * displayScale).LengthSquared();
|
float pointDist = ((limb.WorldPosition - pingSource) * displayScale).LengthSquared();
|
||||||
if (limb.SimPosition == Vector2.Zero || pointDist > DisplayRadius * DisplayRadius) continue;
|
if (limb.SimPosition == Vector2.Zero || pointDist > DisplayRadius * DisplayRadius) { continue; }
|
||||||
|
|
||||||
if (pointDist > prevPingRadiusSqr && pointDist < pingRadiusSqr)
|
if (pointDist > prevPingRadiusSqr && pointDist < pingRadiusSqr)
|
||||||
{
|
{
|
||||||
@@ -801,7 +818,7 @@ namespace Barotrauma.Items.Components
|
|||||||
limb.WorldPosition + Rand.Vector(limb.Mass / 10.0f),
|
limb.WorldPosition + Rand.Vector(limb.Mass / 10.0f),
|
||||||
MathHelper.Clamp(limb.Mass, 0.1f, pingStrength),
|
MathHelper.Clamp(limb.Mass, 0.1f, pingStrength),
|
||||||
MathHelper.Clamp(limb.Mass * 0.1f, 0.1f, 2.0f));
|
MathHelper.Clamp(limb.Mass * 0.1f, 0.1f, 2.0f));
|
||||||
if (!passive && !CheckBlipVisibility(blip, transducerPos)) continue;
|
if (!passive && !CheckBlipVisibility(blip, transducerPos)) { continue; }
|
||||||
sonarBlips.Add(blip);
|
sonarBlips.Add(blip);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
//characters that are further than this from the camera (and all clients)
|
//characters that are further than this from the camera (and all clients)
|
||||||
//have all their limb physics bodies disabled
|
//have all their limb physics bodies disabled
|
||||||
const float EnableSimplePhysicsDist = 10000.0f;
|
const float EnableSimplePhysicsDist = 6000.0f;
|
||||||
const float DisableSimplePhysicsDist = EnableSimplePhysicsDist * 0.9f;
|
const float DisableSimplePhysicsDist = EnableSimplePhysicsDist * 0.9f;
|
||||||
|
|
||||||
const float EnableSimplePhysicsDistSqr = EnableSimplePhysicsDist * EnableSimplePhysicsDist;
|
const float EnableSimplePhysicsDistSqr = EnableSimplePhysicsDist * EnableSimplePhysicsDist;
|
||||||
|
|||||||
Reference in New Issue
Block a user