Named fixtures for banana peels (#3822)

* Named fixtures for banana peels

* Soaps and PDAs

* Update submodule
This commit is contained in:
metalgearsloth
2021-04-13 20:57:29 +10:00
committed by GitHub
parent 499cfe7c3d
commit dc48b25a3b
31 changed files with 124 additions and 97 deletions

View File

@@ -43,7 +43,7 @@ namespace Content.Shared.GameObjects.Components.Buckle
bool ICollideSpecial.PreventCollide(IPhysBody collidedwith)
{
if (collidedwith.Entity.Uid == LastEntityBuckledTo)
if (collidedwith.Owner.Uid == LastEntityBuckledTo)
{
IsOnStrapEntityThisFrame = true;
return Buckled || DontCollide;

View File

@@ -75,14 +75,14 @@ namespace Content.Shared.GameObjects.Components.Disposal
bool ICollideSpecial.PreventCollide(IPhysBody collided)
{
if (IsExiting(collided.Entity)) return true;
if (IsExiting(collided.Owner)) return true;
if (!Owner.TryGetComponent(out IContainerManager? manager)) return false;
if (manager.ContainsEntity(collided.Entity))
if (manager.ContainsEntity(collided.Owner))
{
if (!_intersecting.Contains(collided.Entity))
if (!_intersecting.Contains(collided.Owner))
{
_intersecting.Add(collided.Entity);
_intersecting.Add(collided.Owner);
}
return true;
}

View File

@@ -102,7 +102,7 @@ namespace Content.Shared.GameObjects.Components.Doors
// stops us colliding with people we're crushing, to prevent hitbox clipping and jank
public bool PreventCollide(IPhysBody collidedwith)
{
return CurrentlyCrushing.Contains(collidedwith.Entity.Uid);
return CurrentlyCrushing.Contains(collidedwith.Owner.Uid);
}
/// <summary>

View File

@@ -18,15 +18,15 @@ namespace Content.Shared.GameObjects.Components.Items
private Fixture? _fixture;
void IStartCollide.CollideWith(IPhysBody ourBody, IPhysBody otherBody, in Manifold manifold)
void IStartCollide.CollideWith(Fixture ourFixture, Fixture otherFixture, in Manifold manifold)
{
if (otherBody.Entity == Thrower) return;
EntitySystem.Get<ThrownItemSystem>().ThrowCollideInteraction(Thrower, ourBody, otherBody);
if (otherFixture.Body.Owner == Thrower) return;
EntitySystem.Get<ThrownItemSystem>().ThrowCollideInteraction(Thrower, ourFixture.Body, otherFixture.Body);
}
bool ICollideSpecial.PreventCollide(IPhysBody collidedwith)
{
return collidedwith.Entity == Thrower;
return collidedwith.Owner == Thrower;
}
void IThrown.Thrown(ThrownEventArgs eventArgs)

View File

@@ -13,6 +13,7 @@ using Robust.Shared.IoC;
using Robust.Shared.Maths;
using Robust.Shared.Physics;
using Robust.Shared.Physics.Collision;
using Robust.Shared.Physics.Dynamics;
using Robust.Shared.Player;
using Robust.Shared.Players;
using Robust.Shared.Serialization;
@@ -153,8 +154,8 @@ namespace Content.Shared.GameObjects.Components.Movement
{
if (!Slippery
|| Owner.IsInContainer()
|| _slipped.Contains(otherBody.Entity.Uid)
|| !otherBody.Entity.TryGetComponent(out SharedStunnableComponent? stun))
|| _slipped.Contains(otherBody.Owner.Uid)
|| !otherBody.Owner.TryGetComponent(out SharedStunnableComponent? stun))
{
return false;
}
@@ -171,7 +172,7 @@ namespace Content.Shared.GameObjects.Components.Movement
return false;
}
if (!EffectBlockerSystem.CanSlip(otherBody.Entity))
if (!EffectBlockerSystem.CanSlip(otherBody.Owner))
{
return false;
}
@@ -179,7 +180,7 @@ namespace Content.Shared.GameObjects.Components.Movement
otherBody.LinearVelocity *= LaunchForwardsMultiplier;
stun.Paralyze(5);
_slipped.Add(otherBody.Entity.Uid);
_slipped.Add(otherBody.Owner.Uid);
Dirty();
if (!string.IsNullOrEmpty(SlipSound) && _moduleManager.IsServerModule)
@@ -190,9 +191,9 @@ namespace Content.Shared.GameObjects.Components.Movement
return true;
}
void IStartCollide.CollideWith(IPhysBody ourBody, IPhysBody otherBody, in Manifold manifold)
void IStartCollide.CollideWith(Fixture _, Fixture otherFixture, in Manifold manifold)
{
_colliding.Add(otherBody.Owner.Uid);
_colliding.Add(otherFixture.Body.Owner.Uid);
}
public void Update()

View File

@@ -41,7 +41,7 @@ namespace Content.Shared.GameObjects.Components.Projectiles
public bool PreventCollide(IPhysBody collidedwith)
{
return IgnoreShooter && collidedwith.Entity.Uid == Shooter;
return IgnoreShooter && collidedwith.Owner.Uid == Shooter;
}
}
}

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -131,7 +131,7 @@ namespace Content.Shared.Physics.Controllers
!otherCollider.CanCollide ||
((collider.CollisionMask & otherCollider.CollisionLayer) == 0 &&
(otherCollider.CollisionMask & collider.CollisionLayer) == 0) ||
(otherCollider.Entity.TryGetComponent(out SharedPullableComponent? pullable) && pullable.BeingPulled))
(otherCollider.Owner.TryGetComponent(out SharedPullableComponent? pullable) && pullable.BeingPulled))
{
continue;
}