Bullet only damage the first entity it collided with (#1912)
Co-authored-by: David Tan <>
This commit is contained in:
@@ -36,6 +36,8 @@ namespace Content.Server.GameObjects.Components.Projectiles
|
|||||||
private string _soundHit;
|
private string _soundHit;
|
||||||
private string _soundHitSpecies;
|
private string _soundHitSpecies;
|
||||||
|
|
||||||
|
private bool _damagedEntity;
|
||||||
|
|
||||||
public override void ExposeData(ObjectSerializer serializer)
|
public override void ExposeData(ObjectSerializer serializer)
|
||||||
{
|
{
|
||||||
base.ExposeData(serializer);
|
base.ExposeData(serializer);
|
||||||
@@ -64,6 +66,11 @@ namespace Content.Server.GameObjects.Components.Projectiles
|
|||||||
/// <param name="entity"></param>
|
/// <param name="entity"></param>
|
||||||
void ICollideBehavior.CollideWith(IEntity entity)
|
void ICollideBehavior.CollideWith(IEntity entity)
|
||||||
{
|
{
|
||||||
|
if (_damagedEntity)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// This is so entities that shouldn't get a collision are ignored.
|
// This is so entities that shouldn't get a collision are ignored.
|
||||||
if (entity.TryGetComponent(out ICollidableComponent collidable) && collidable.Hard == false)
|
if (entity.TryGetComponent(out ICollidableComponent collidable) && collidable.Hard == false)
|
||||||
{
|
{
|
||||||
@@ -91,6 +98,8 @@ namespace Content.Server.GameObjects.Components.Projectiles
|
|||||||
{
|
{
|
||||||
damage.ChangeDamage(damageType, amount, false, shooter);
|
damage.ChangeDamage(damageType, amount, false, shooter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_damagedEntity = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!entity.Deleted && entity.TryGetComponent(out CameraRecoilComponent recoilComponent)
|
if (!entity.Deleted && entity.TryGetComponent(out CameraRecoilComponent recoilComponent)
|
||||||
|
|||||||
Reference in New Issue
Block a user