Named fixtures for banana peels (#3822)
* Named fixtures for banana peels * Soaps and PDAs * Update submodule
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user