Named fixtures for banana peels (#3822)
* Named fixtures for banana peels * Soaps and PDAs * Update submodule
This commit is contained in:
@@ -4,6 +4,7 @@ using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Physics.Collision;
|
||||
using Robust.Shared.Physics.Dynamics;
|
||||
|
||||
namespace Content.Shared.GameObjects.EntitySystems
|
||||
{
|
||||
@@ -24,13 +25,15 @@ namespace Content.Shared.GameObjects.EntitySystems
|
||||
/// <summary>
|
||||
/// Fake pushing for player collisions.
|
||||
/// </summary>
|
||||
private void HandleCollisionMessage(IPhysBody ourBody, IPhysBody otherBody, float frameTime, Manifold manifold)
|
||||
private void HandleCollisionMessage(Fixture ourFixture, Fixture otherFixture, float frameTime, Manifold manifold)
|
||||
{
|
||||
if (otherBody.BodyType != BodyType.Dynamic) return;
|
||||
var otherBody = otherFixture.Body;
|
||||
|
||||
if (otherBody.BodyType != BodyType.Dynamic || !otherFixture.Hard) return;
|
||||
|
||||
var normal = manifold.LocalNormal;
|
||||
|
||||
if (!ourBody.Entity.TryGetComponent(out IMobMoverComponent? mobMover) || normal == Vector2.Zero) return;
|
||||
if (!ourFixture.Body.Owner.TryGetComponent(out IMobMoverComponent? mobMover) || normal == Vector2.Zero) return;
|
||||
|
||||
otherBody.ApplyLinearImpulse(-normal * mobMover.PushStrength * frameTime);
|
||||
}
|
||||
|
||||
@@ -65,36 +65,36 @@ namespace Content.Shared.GameObjects.EntitySystems
|
||||
public void ThrowCollideInteraction(IEntity? user, IPhysBody thrown, IPhysBody target)
|
||||
{
|
||||
// TODO: Just pass in the bodies directly
|
||||
var collideMsg = new ThrowCollideMessage(user, thrown.Entity, target.Entity);
|
||||
var collideMsg = new ThrowCollideMessage(user, thrown.Owner, target.Owner);
|
||||
RaiseLocalEvent(collideMsg);
|
||||
if (collideMsg.Handled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var eventArgs = new ThrowCollideEventArgs(user, thrown.Entity, target.Entity);
|
||||
var eventArgs = new ThrowCollideEventArgs(user, thrown.Owner, target.Owner);
|
||||
|
||||
foreach (var comp in target.Entity.GetAllComponents<IThrowCollide>())
|
||||
foreach (var comp in target.Owner.GetAllComponents<IThrowCollide>())
|
||||
{
|
||||
_throwCollide.Add(comp);
|
||||
}
|
||||
|
||||
foreach (var collide in _throwCollide)
|
||||
{
|
||||
if (target.Entity.Deleted) break;
|
||||
if (target.Owner.Deleted) break;
|
||||
collide.HitBy(eventArgs);
|
||||
}
|
||||
|
||||
_throwCollide.Clear();
|
||||
|
||||
foreach (var comp in thrown.Entity.GetAllComponents<IThrowCollide>())
|
||||
foreach (var comp in thrown.Owner.GetAllComponents<IThrowCollide>())
|
||||
{
|
||||
_throwCollide.Add(comp);
|
||||
}
|
||||
|
||||
foreach (var collide in _throwCollide)
|
||||
{
|
||||
if (thrown.Entity.Deleted) break;
|
||||
if (thrown.Owner.Deleted) break;
|
||||
collide.DoHit(eventArgs);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user