Adds non randomized rod velocity (#27123)
* adds non randomized rod velocity * Adds despawn suffix to despawn rod
This commit is contained in:
@@ -60,15 +60,18 @@ public sealed class ImmovableRodSystem : EntitySystem
|
||||
_physics.SetFriction(uid, phys, 0f);
|
||||
_physics.SetBodyStatus(uid, phys, BodyStatus.InAir);
|
||||
|
||||
if (!component.RandomizeVelocity)
|
||||
return;
|
||||
|
||||
var xform = Transform(uid);
|
||||
var vel = component.DirectionOverride.Degrees switch
|
||||
var worldRot = _transform.GetWorldRotation(uid);
|
||||
var vel = worldRot.ToWorldVec() * component.MaxSpeed;
|
||||
|
||||
if (component.RandomizeVelocity)
|
||||
{
|
||||
0f => _random.NextVector2(component.MinSpeed, component.MaxSpeed),
|
||||
_ => _transform.GetWorldRotation(uid).RotateVec(component.DirectionOverride.ToVec()) * _random.NextFloat(component.MinSpeed, component.MaxSpeed)
|
||||
};
|
||||
vel = component.DirectionOverride.Degrees switch
|
||||
{
|
||||
0f => _random.NextVector2(component.MinSpeed, component.MaxSpeed),
|
||||
_ => worldRot.RotateVec(component.DirectionOverride.ToVec()) * _random.NextFloat(component.MinSpeed, component.MaxSpeed)
|
||||
};
|
||||
}
|
||||
|
||||
_physics.ApplyLinearImpulse(uid, vel, body: phys);
|
||||
xform.LocalRotation = (vel - _transform.GetWorldPosition(uid)).ToWorldAngle() + MathHelper.PiOver2;
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
|
||||
- type: entity
|
||||
id: ImmovableRodDespawn
|
||||
suffix: Despawn
|
||||
parent: ImmovableRod
|
||||
components:
|
||||
- type: TimedDespawn
|
||||
|
||||
Reference in New Issue
Block a user