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

@@ -5,6 +5,7 @@ using Content.Shared.Chemistry;
using Robust.Shared.GameObjects;
using Robust.Shared.Physics;
using Robust.Shared.Physics.Collision;
using Robust.Shared.Physics.Dynamics;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.ViewVariables;
@@ -33,9 +34,9 @@ namespace Content.Server.GameObjects.Components.Projectiles
_solutionContainer = Owner.EnsureComponent<SolutionContainerComponent>();
}
void IStartCollide.CollideWith(IPhysBody ourBody, IPhysBody otherBody, in Manifold manifold)
void IStartCollide.CollideWith(Fixture ourFixture, Fixture otherFixture, in Manifold manifold)
{
if (!otherBody.Entity.TryGetComponent<BloodstreamComponent>(out var bloodstream))
if (!otherFixture.Body.Owner.TryGetComponent<BloodstreamComponent>(out var bloodstream))
return;
var solution = _solutionContainer.Solution;

View File

@@ -2,6 +2,7 @@ using Content.Server.GameObjects.Components.Explosion;
using Robust.Shared.GameObjects;
using Robust.Shared.Physics;
using Robust.Shared.Physics.Collision;
using Robust.Shared.Physics.Dynamics;
namespace Content.Server.GameObjects.Components.Projectiles
{
@@ -17,7 +18,7 @@ namespace Content.Server.GameObjects.Components.Projectiles
Owner.EnsureComponent<ExplosiveComponent>();
}
void IStartCollide.CollideWith(IPhysBody ourBody, IPhysBody otherBody, in Manifold manifold)
void IStartCollide.CollideWith(Fixture ourFixture, Fixture otherFixture, in Manifold manifold)
{
if (Owner.TryGetComponent(out ExplosiveComponent? explosive))
{

View File

@@ -3,6 +3,7 @@ using Robust.Shared.GameObjects;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.Physics;
using Robust.Shared.Physics.Collision;
using Robust.Shared.Physics.Dynamics;
using Robust.Shared.Serialization;
namespace Content.Server.GameObjects.Components.Projectiles
@@ -29,12 +30,9 @@ namespace Content.Server.GameObjects.Components.Projectiles
Owner.EnsureComponent<ProjectileComponent>();
}
void IStartCollide.CollideWith(IPhysBody ourBody, IPhysBody otherBody, in Manifold manifold)
void IStartCollide.CollideWith(Fixture ourFixture, Fixture otherFixture, in Manifold manifold)
{
if (_flashed)
{
return;
}
if (_flashed) return;
FlashableComponent.FlashAreaHelper(Owner, _range, _duration);
_flashed = true;

View File

@@ -8,6 +8,7 @@ using Robust.Shared.Audio;
using Robust.Shared.GameObjects;
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.Manager.Attributes;
@@ -57,17 +58,17 @@ namespace Content.Server.GameObjects.Components.Projectiles
/// <summary>
/// Applies the damage when our projectile collides with its victim
/// </summary>
void IStartCollide.CollideWith(IPhysBody ourBody, IPhysBody otherBody, in Manifold manifold)
void IStartCollide.CollideWith(Fixture ourFixture, Fixture otherFixture, in Manifold manifold)
{
// This is so entities that shouldn't get a collision are ignored.
if (!otherBody.Hard || _damagedEntity)
if (!otherFixture.Hard || _damagedEntity)
{
return;
}
var coordinates = otherBody.Entity.Transform.Coordinates;
var coordinates = otherFixture.Body.Owner.Transform.Coordinates;
var playerFilter = Filter.Pvs(coordinates);
if (otherBody.Entity.TryGetComponent(out IDamageableComponent? damage) && _soundHitSpecies != null)
if (otherFixture.Body.Owner.TryGetComponent(out IDamageableComponent? damage) && _soundHitSpecies != null)
{
SoundSystem.Play(playerFilter, _soundHitSpecies, coordinates);
}
@@ -89,9 +90,9 @@ namespace Content.Server.GameObjects.Components.Projectiles
}
// Damaging it can delete it
if (!otherBody.Entity.Deleted && otherBody.Entity.TryGetComponent(out CameraRecoilComponent? recoilComponent))
if (!otherFixture.Body.Deleted && otherFixture.Body.Owner.TryGetComponent(out CameraRecoilComponent? recoilComponent))
{
var direction = ourBody.LinearVelocity.Normalized;
var direction = ourFixture.Body.LinearVelocity.Normalized;
recoilComponent.Kick(direction);
}

View File

@@ -2,6 +2,7 @@ using Content.Server.GameObjects.Components.Mobs;
using Robust.Shared.GameObjects;
using Robust.Shared.Physics;
using Robust.Shared.Physics.Collision;
using Robust.Shared.Physics.Dynamics;
using Robust.Shared.Serialization.Manager.Attributes;
namespace Content.Server.GameObjects.Components.Projectiles
@@ -29,9 +30,9 @@ namespace Content.Server.GameObjects.Components.Projectiles
Owner.EnsureComponentWarn(out ProjectileComponent _);
}
void IStartCollide.CollideWith(IPhysBody ourBody, IPhysBody otherBody, in Manifold manifold)
void IStartCollide.CollideWith(Fixture ourFixture, Fixture otherFixture, in Manifold manifold)
{
if (otherBody.Entity.TryGetComponent(out StunnableComponent? stunnableComponent))
if (otherFixture.Body.Owner.TryGetComponent(out StunnableComponent? stunnableComponent))
{
stunnableComponent.Stun(_stunAmount);
stunnableComponent.Knockdown(_knockdownAmount);