From ebc2d59f2e755dcab538bc6b349d442c7aa12a2d Mon Sep 17 00:00:00 2001 From: DTanxxx <55208219+DTanxxx@users.noreply.github.com> Date: Sat, 29 Aug 2020 22:50:43 +1200 Subject: [PATCH] Bullet only damage the first entity it collided with (#1912) Co-authored-by: David Tan <> --- .../Components/Projectiles/ProjectileComponent.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Content.Server/GameObjects/Components/Projectiles/ProjectileComponent.cs b/Content.Server/GameObjects/Components/Projectiles/ProjectileComponent.cs index d3395a5ca2..e9dd0df848 100644 --- a/Content.Server/GameObjects/Components/Projectiles/ProjectileComponent.cs +++ b/Content.Server/GameObjects/Components/Projectiles/ProjectileComponent.cs @@ -36,6 +36,8 @@ namespace Content.Server.GameObjects.Components.Projectiles private string _soundHit; private string _soundHitSpecies; + private bool _damagedEntity; + public override void ExposeData(ObjectSerializer serializer) { base.ExposeData(serializer); @@ -64,6 +66,11 @@ namespace Content.Server.GameObjects.Components.Projectiles /// void ICollideBehavior.CollideWith(IEntity entity) { + if (_damagedEntity) + { + return; + } + // This is so entities that shouldn't get a collision are ignored. 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); } + + _damagedEntity = true; } if (!entity.Deleted && entity.TryGetComponent(out CameraRecoilComponent recoilComponent)