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

@@ -75,7 +75,7 @@ namespace Content.Client.GameObjects.Components.Suspicion
}
// all entities have a TransformComponent
var transform = physics.Entity.Transform;
var transform = physics.Owner.Transform;
// if not on the same map, continue
if (transform.MapID != _eyeManager.CurrentMap || !transform.IsMapTransform)

View File

@@ -160,7 +160,7 @@ namespace Content.Server.Atmos
|| entity.IsInContainer())
continue;
var pressureMovements = physics.Entity.EnsureComponent<MovedByPressureComponent>();
var pressureMovements = physics.Owner.EnsureComponent<MovedByPressureComponent>();
if (pressure.LastHighPressureMovementAirCycle < _gridAtmosphereComponent.UpdateCounter)
{
pressureMovements.ExperiencePressureDifference(_gridAtmosphereComponent.UpdateCounter, PressureDifference, _pressureDirection, 0, PressureSpecificTarget?.GridIndices.ToEntityCoordinates(GridIndex, _mapManager) ?? EntityCoordinates.Invalid);

View File

@@ -19,6 +19,7 @@ using Robust.Shared.GameObjects;
using Robust.Shared.Localization;
using Robust.Shared.Physics;
using Robust.Shared.Physics.Collision;
using Robust.Shared.Physics.Dynamics;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.ViewVariables;
@@ -144,9 +145,9 @@ namespace Content.Server.GameObjects.Components.Atmos
}
}
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 FlammableComponent? otherFlammable))
if (!otherFixture.Body.Owner.TryGetComponent(out FlammableComponent? otherFlammable))
return;
if (!FireSpread || !otherFlammable.FireSpread)

View File

@@ -9,6 +9,7 @@ using Robust.Shared.Map;
using Robust.Shared.Maths;
using Robust.Shared.Physics;
using Robust.Shared.Physics.Collision;
using Robust.Shared.Physics.Dynamics;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.ViewVariables;
@@ -114,15 +115,15 @@ namespace Content.Server.GameObjects.Components.Chemistry
return true;
}
void IStartCollide.CollideWith(IPhysBody ourBody, IPhysBody otherBody, in Manifold manifold)
void IStartCollide.CollideWith(Fixture ourFixture, Fixture otherFixture, in Manifold manifold)
{
if (!Owner.TryGetComponent(out SolutionContainerComponent? contents))
return;
contents.Solution.DoEntityReaction(otherBody.Entity, ReactionMethod.Touch);
contents.Solution.DoEntityReaction(otherFixture.Body.Owner, ReactionMethod.Touch);
// Check for collision with a impassable object (e.g. wall) and stop
if ((otherBody.CollisionLayer & (int) CollisionGroup.Impassable) != 0 && otherBody.Hard)
if ((otherFixture.CollisionLayer & (int) CollisionGroup.Impassable) != 0 && otherFixture.Hard)
{
Owner.Delete();
}

View File

@@ -9,6 +9,7 @@ using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Physics;
using Robust.Shared.Physics.Collision;
using Robust.Shared.Physics.Dynamics;
using Robust.Shared.Player;
using Robust.Shared.Random;
using Robust.Shared.Serialization.Manager.Attributes;
@@ -44,16 +45,16 @@ namespace Content.Server.GameObjects.Components.Damage
public float DamageCooldown { get; set; } = 2f;
private TimeSpan _lastHit = TimeSpan.Zero;
void IStartCollide.CollideWith(IPhysBody ourBody, IPhysBody otherBody, in Manifold manifold)
void IStartCollide.CollideWith(Fixture ourFixture, Fixture otherFixture, in Manifold manifold)
{
if (!Owner.TryGetComponent(out IDamageableComponent? damageable)) return;
var speed = ourBody.LinearVelocity.Length;
var speed = ourFixture.Body.LinearVelocity.Length;
if (speed < MinimumSpeed) return;
if (!string.IsNullOrEmpty(SoundHit))
SoundSystem.Play(Filter.Pvs(otherBody.Entity), SoundHit, otherBody.Entity, AudioHelpers.WithVariation(0.125f).WithVolume(-0.125f));
SoundSystem.Play(Filter.Pvs(otherFixture.Body.Owner), SoundHit, otherFixture.Body.Owner, AudioHelpers.WithVariation(0.125f).WithVolume(-0.125f));
if ((_gameTiming.CurTime - _lastHit).TotalSeconds < DamageCooldown)
return;
@@ -65,7 +66,7 @@ namespace Content.Server.GameObjects.Components.Damage
if (Owner.TryGetComponent(out StunnableComponent? stun) && _robustRandom.Prob(StunChance))
stun.Stun(StunSeconds);
damageable.ChangeDamage(Damage, damage, false, otherBody.Entity);
damageable.ChangeDamage(Damage, damage, false, otherFixture.Body.Owner);
}
}
}

View File

@@ -34,6 +34,7 @@ using Robust.Shared.ViewVariables;
using Timer = Robust.Shared.Timing.Timer;
using Content.Server.GameObjects.Components.Construction;
using Robust.Shared.Containers;
using Robust.Shared.Physics.Dynamics;
namespace Content.Server.GameObjects.Components.Doors
{
@@ -215,7 +216,7 @@ namespace Content.Server.GameObjects.Components.Doors
}
}
void IStartCollide.CollideWith(IPhysBody ourBody, IPhysBody otherBody, in Manifold manifold)
void IStartCollide.CollideWith(Fixture ourFixture, Fixture otherFixture, in Manifold manifold)
{
if (State != DoorState.Closed)
{
@@ -229,9 +230,9 @@ namespace Content.Server.GameObjects.Components.Doors
// Disabled because it makes it suck hard to walk through double doors.
if (otherBody.Entity.HasComponent<IBody>())
if (otherFixture.Body.Owner.HasComponent<IBody>())
{
if (!otherBody.Entity.TryGetComponent<IMoverComponent>(out var mover)) return;
if (!otherFixture.Body.Owner.TryGetComponent<IMoverComponent>(out var mover)) return;
/*
// TODO: temporary hack to fix the physics system raising collision events akwardly.
@@ -244,7 +245,7 @@ namespace Content.Server.GameObjects.Components.Doors
TryOpen(entity);
*/
TryOpen(otherBody.Entity);
TryOpen(otherFixture.Body.Owner);
}
}
@@ -430,7 +431,7 @@ namespace Content.Server.GameObjects.Components.Doors
var broadPhaseSystem = EntitySystem.Get<SharedBroadPhaseSystem>();
// Use this version so we can ignore the CanCollide being false
foreach(var e in broadPhaseSystem.GetCollidingEntities(physicsComponent.Entity.Transform.MapID, physicsComponent.GetWorldAABB()))
foreach(var e in broadPhaseSystem.GetCollidingEntities(physicsComponent.Owner.Transform.MapID, physicsComponent.GetWorldAABB()))
{
if ((physicsComponent.CollisionMask & e.CollisionLayer) != 0 && broadPhaseSystem.IntersectionPercent(physicsComponent, e) > 0.01f) return true;
}
@@ -510,8 +511,8 @@ namespace Content.Server.GameObjects.Components.Doors
// Crush
foreach (var e in collidingentities)
{
if (!e.Entity.TryGetComponent(out StunnableComponent? stun)
|| !e.Entity.TryGetComponent(out IDamageableComponent? damage))
if (!e.Owner.TryGetComponent(out StunnableComponent? stun)
|| !e.Owner.TryGetComponent(out IDamageableComponent? damage))
{
continue;
}
@@ -522,7 +523,7 @@ namespace Content.Server.GameObjects.Components.Doors
continue;
hitsomebody = true;
CurrentlyCrushing.Add(e.Entity.Uid);
CurrentlyCrushing.Add(e.Owner.Uid);
damage.ChangeDamage(DamageType.Blunt, DoorCrushDamage, false, Owner);
stun.Paralyze(DoorStunTime);

View File

@@ -8,6 +8,7 @@ using Robust.Shared.Log;
using Robust.Shared.Maths;
using Robust.Shared.Physics;
using Robust.Shared.Physics.Collision;
using Robust.Shared.Physics.Dynamics;
using Robust.Shared.Timing;
namespace Content.Server.GameObjects.Components.PA
@@ -17,9 +18,9 @@ namespace Content.Server.GameObjects.Components.PA
{
public override string Name => "ParticleProjectile";
private ParticleAcceleratorPowerState _state;
void IStartCollide.CollideWith(IPhysBody ourBody, IPhysBody otherBody, in Manifold manifold)
void IStartCollide.CollideWith(Fixture ourFixture, Fixture otherFixture, in Manifold manifold)
{
if (otherBody.Entity.TryGetComponent<ServerSingularityComponent>(out var singularityComponent))
if (otherFixture.Body.Owner.TryGetComponent<ServerSingularityComponent>(out var singularityComponent))
{
var multiplier = _state switch
{
@@ -33,7 +34,7 @@ namespace Content.Server.GameObjects.Components.PA
singularityComponent.Energy += 10 * multiplier;
Owner.Delete();
}
else if (otherBody.Entity.TryGetComponent<SingularityGeneratorComponent>(out var singularityGeneratorComponent))
else if (otherFixture.Body.Owner.TryGetComponent<SingularityGeneratorComponent>(out var singularityGeneratorComponent))
{
singularityGeneratorComponent.Power += _state switch
{

View File

@@ -9,6 +9,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.Player;
using Robust.Shared.Serialization;
using Robust.Shared.ViewVariables;
@@ -156,11 +157,11 @@ namespace Content.Server.GameObjects.Components.Portal
StartCooldown();
}
void IStartCollide.CollideWith(IPhysBody ourBody, IPhysBody otherBody, in Manifold manifold)
void IStartCollide.CollideWith(Fixture ourFixture, Fixture otherFixture, in Manifold manifold)
{
if (_onCooldown == false)
{
TryPortalEntity(otherBody.Entity);
TryPortalEntity(otherFixture.Body.Owner);
}
}
}

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

View File

@@ -40,7 +40,7 @@ namespace Content.Server.GameObjects.Components.Pulling
}
data.Visibility = VerbVisibility.Visible;
data.Text = component.Puller == userPhysics.Entity
data.Text = component.Puller == userPhysics.Owner
? Loc.GetString("Stop pulling")
: Loc.GetString("Pull");
}

View File

@@ -19,6 +19,7 @@ using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Physics;
using Robust.Shared.Physics.Collision;
using Robust.Shared.Physics.Dynamics;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.ViewVariables;
@@ -140,9 +141,9 @@ namespace Content.Server.GameObjects.Components.Recycling
return true;
}
void IStartCollide.CollideWith(IPhysBody ourBody, IPhysBody otherBody, in Manifold manifold)
void IStartCollide.CollideWith(Fixture ourFixture, Fixture otherFixture, in Manifold manifold)
{
Recycle(otherBody.Entity);
Recycle(otherFixture.Body.Owner);
}
SuicideKind ISuicideAct.Suicide(IEntity victim, IChatManager chat)

View File

@@ -2,6 +2,7 @@
using Robust.Shared.GameObjects;
using Robust.Shared.Physics;
using Robust.Shared.Physics.Collision;
using Robust.Shared.Physics.Dynamics;
namespace Content.Server.GameObjects.Components.Singularity
{
@@ -11,7 +12,7 @@ namespace Content.Server.GameObjects.Components.Singularity
public override string Name => "ContainmentField";
public ContainmentFieldConnection? Parent;
void IStartCollide.CollideWith(IPhysBody ourBody, IPhysBody otherBody, in Manifold manifold)
void IStartCollide.CollideWith(Fixture ourFixture, Fixture otherFixture, in Manifold manifold)
{
if (Parent == null)
{
@@ -19,7 +20,7 @@ namespace Content.Server.GameObjects.Components.Singularity
return;
}
Parent.TryRepell(Owner, otherBody.Entity);
Parent.TryRepell(Owner, otherFixture.Body.Owner);
}
}
}

View File

@@ -13,6 +13,7 @@ using Robust.Shared.Physics.Broadphase;
using Robust.Shared.ViewVariables;
using Robust.Server.GameObjects;
using Robust.Shared.Physics.Collision;
using Robust.Shared.Physics.Dynamics;
namespace Content.Server.GameObjects.Components.Singularity
{
@@ -177,9 +178,9 @@ namespace Content.Server.GameObjects.Components.Singularity
}
}
void IStartCollide.CollideWith(IPhysBody ourBody, IPhysBody otherBody, in Manifold manifold)
void IStartCollide.CollideWith(Fixture ourFixture, Fixture otherFixture, in Manifold manifold)
{
if(otherBody.Entity.HasTag("EmitterBolt")) {
if(otherFixture.Body.Owner.HasTag("EmitterBolt")) {
ReceivePower(4);
}
}

View File

@@ -10,6 +10,7 @@ using Robust.Shared.Map;
using Robust.Shared.Physics;
using Robust.Shared.Physics.Collision;
using Robust.Shared.Physics.Collision.Shapes;
using Robust.Shared.Physics.Dynamics;
using Robust.Shared.Player;
using Robust.Shared.Players;
using Robust.Shared.Timing;
@@ -121,13 +122,13 @@ namespace Content.Server.GameObjects.Components.Singularity
Energy -= EnergyDrain * seconds;
}
void IStartCollide.CollideWith(IPhysBody ourBody, IPhysBody otherBody, in Manifold manifold)
void IStartCollide.CollideWith(Fixture ourFixture, Fixture otherFixture, in Manifold manifold)
{
var otherEntity = otherBody.Entity;
var otherEntity = otherFixture.Body.Owner;
if (otherEntity.TryGetComponent<IMapGridComponent>(out var mapGridComponent))
{
foreach (var tile in mapGridComponent.Grid.GetTilesIntersecting(ourBody.GetWorldAABB()))
foreach (var tile in mapGridComponent.Grid.GetTilesIntersecting(ourFixture.Body.GetWorldAABB()))
{
mapGridComponent.Grid.SetTile(tile.GridIndices, Tile.Empty);
Energy++;

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

View File

@@ -185,14 +185,18 @@
- type: CollisionWake
enabled: false
- type: Physics
bodyType: KinematicController
fixtures: # TODO: Make a second fixture. One should be for slipping, and the other for collisions.
bodyType: Dynamic
fixtures:
- shape:
!type:PhysShapeAabb
bounds: "-0.2,-0.2,0.2,0.2"
name: "slips"
hard: false
layer:
- SmallImpassable
- shape:
!type:PhysShapeAabb
bounds: "-0.2,-0.2,0.2,0.2"
mass: 5
layer:
- SmallImpassable
mask:
- Impassable
- MobImpassable
- SmallImpassable

View File

@@ -88,18 +88,21 @@
- type: CollisionWake
enabled: false
- type: Physics
bodyType: KinematicController
fixtures: # TODO: Make a second fixture.
bodyType: Dynamic
fixtures:
- shape:
!type:PhysShapeAabb
bounds: "-0.3,-0.4,0.3,0.4"
name: "slips"
hard: false
layer:
- SmallImpassable
- shape:
!type:PhysShapeAabb
bounds: "-0.3,-0.4,0.3,0.4"
mass: 2.5
hard: false
layer:
- SmallImpassable
mask:
- Impassable
- MobImpassable
- SmallImpassable
- type: entity
name: Mime PDA

View File

@@ -109,17 +109,21 @@
- type: CollisionWake
enabled: false
- type: Physics
bodyType: KinematicController
fixtures: # TODO: Make a second fixture. One should be for slipping, and the other for collisions.
bodyType: Dynamic
fixtures:
- shape:
!type:PhysShapeAabb
bounds: "-0.3,-0.4,0.3,0.4"
mass: 2.5
name: "slips"
hard: false
layer:
- SmallImpassable
- SmallImpassable
- shape:
!type:PhysShapeAabb
bounds: "-0.3,-0.4,0.3,0.4"
mass: 5
mask:
- Impassable
- MobImpassable
- SmallImpassable
- type: entity
name: soap