Files
tbd-station-14/Content.Server/Explosion/Components/ExplosionLaunchedComponent.cs
metalgearsloth 29e335c54d Bump up tile friction (#4329)
* Bump up tile friction

* Increase throwing speed

* Fix ExplosionLaunched throwing

* Flying time
2021-07-25 16:58:02 +10:00

35 lines
1.0 KiB
C#

using Content.Server.Throwing;
using Content.Shared.Acts;
using Robust.Shared.GameObjects;
namespace Content.Server.Explosion.Components
{
[RegisterComponent]
public class ExplosionLaunchedComponent : Component, IExAct
{
public override string Name => "ExplosionLaunched";
void IExAct.OnExplosion(ExplosionEventArgs eventArgs)
{
if (Owner.Deleted)
return;
var sourceLocation = eventArgs.Source;
var targetLocation = eventArgs.Target.Transform.Coordinates;
if (sourceLocation.Equals(targetLocation)) return;
var direction = (targetLocation.ToMapPos(Owner.EntityManager) - sourceLocation.ToMapPos(Owner.EntityManager)).Normalized;
var throwForce = eventArgs.Severity switch
{
ExplosionSeverity.Heavy => 30,
ExplosionSeverity.Light => 20,
_ => 0,
};
Owner.TryThrow(direction, throwForce);
}
}
}