Make the explosions throw the container/item they originated from (#32428)

Extra fun if it's something that can trigger multiple times
This commit is contained in:
Saphire Lattice
2024-10-04 14:43:45 +06:00
committed by GitHub
parent 8b65186bfa
commit 88f060d51a

View File

@@ -488,9 +488,12 @@ public sealed partial class ExplosionSystem
&& physics.BodyType == BodyType.Dynamic) && physics.BodyType == BodyType.Dynamic)
{ {
var pos = _transformSystem.GetWorldPosition(xform); var pos = _transformSystem.GetWorldPosition(xform);
var dir = pos - epicenter.Position;
if (dir.IsLengthZero())
dir = _robustRandom.NextVector2().Normalized();
_throwingSystem.TryThrow( _throwingSystem.TryThrow(
uid, uid,
pos - epicenter.Position, dir,
physics, physics,
xform, xform,
_projectileQuery, _projectileQuery,