Admin ghosts can now interact with stuff (#4178)
* Ghosts now have a bool for interacting with stuff * Wrong ghost * Simping for Swept * Merge cleanup * IT'S ODNE Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
@@ -94,8 +94,6 @@ namespace Content.Shared.Body.Components
|
||||
SlotIds[slotId].SetConnectionsInternal(connections);
|
||||
}
|
||||
}
|
||||
|
||||
CalculateSpeed();
|
||||
}
|
||||
|
||||
protected override void OnRemove()
|
||||
@@ -474,51 +472,8 @@ namespace Content.Shared.Body.Components
|
||||
}
|
||||
}
|
||||
|
||||
private void CalculateSpeed()
|
||||
{
|
||||
if (!Owner.TryGetComponent(out MovementSpeedModifierComponent? playerMover))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var legs = GetPartsWithProperty<LegComponent>().ToArray();
|
||||
float speedSum = 0;
|
||||
|
||||
foreach (var leg in legs)
|
||||
{
|
||||
var footDistance = DistanceToNearestFoot(leg.part);
|
||||
|
||||
if (Math.Abs(footDistance - float.MinValue) <= 0.001f)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
speedSum += leg.property.Speed * (1 + (float) Math.Log(footDistance, 1024.0));
|
||||
}
|
||||
|
||||
if (speedSum <= 0.001f)
|
||||
{
|
||||
playerMover.BaseWalkSpeed = 0.8f;
|
||||
playerMover.BaseSprintSpeed = 2.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Extra legs stack diminishingly.
|
||||
playerMover.BaseWalkSpeed =
|
||||
speedSum / (legs.Length - (float) Math.Log(legs.Length, 4.0));
|
||||
|
||||
playerMover.BaseSprintSpeed = playerMover.BaseWalkSpeed * 1.75f;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnBodyChanged()
|
||||
{
|
||||
// Calculate move speed based on this body.
|
||||
if (Owner.HasComponent<MovementSpeedModifierComponent>())
|
||||
{
|
||||
CalculateSpeed();
|
||||
}
|
||||
|
||||
Dirty();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user