Use red damage animation for guns too (#10938)
This commit is contained in:
@@ -3,11 +3,14 @@ using Content.Server.Projectiles.Components;
|
||||
using Content.Shared.Camera;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Content.Shared.Projectiles;
|
||||
using Content.Shared.Weapons.Melee;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Physics.Dynamics;
|
||||
using Robust.Shared.Player;
|
||||
using GunSystem = Content.Server.Weapon.Ranged.Systems.GunSystem;
|
||||
|
||||
namespace Content.Server.Projectiles
|
||||
@@ -45,6 +48,11 @@ namespace Content.Server.Projectiles
|
||||
|
||||
if (modifiedDamage is not null && EntityManager.EntityExists(component.Shooter))
|
||||
{
|
||||
if (modifiedDamage.Total > FixedPoint2.Zero)
|
||||
{
|
||||
RaiseNetworkEvent(new DamageEffectEvent(otherEntity), Filter.Pvs(otherEntity, entityManager: EntityManager));
|
||||
}
|
||||
|
||||
_adminLogger.Add(LogType.BulletHit,
|
||||
HasComp<ActorComponent>(otherEntity) ? LogImpact.Extreme : LogImpact.High,
|
||||
$"Projectile {ToPrettyString(component.Owner):projectile} shot by {ToPrettyString(component.Shooter):user} hit {ToPrettyString(otherEntity):target} and dealt {modifiedDamage.Total:damage} damage");
|
||||
@@ -65,7 +73,7 @@ namespace Content.Server.Projectiles
|
||||
|
||||
if (component.ImpactEffect != null && TryComp<TransformComponent>(uid, out var xform))
|
||||
{
|
||||
RaiseNetworkEvent(new ImpactEffectEvent(component.ImpactEffect, xform.Coordinates));
|
||||
RaiseNetworkEvent(new ImpactEffectEvent(component.ImpactEffect, xform.Coordinates), Filter.Pvs(xform.Coordinates, entityMan: EntityManager));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ using Content.Server.Weapon.Ranged.Components;
|
||||
using Content.Shared.Audio;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Content.Shared.Weapons.Melee;
|
||||
using Content.Shared.Weapons.Ranged;
|
||||
using Content.Shared.Weapons.Ranged.Components;
|
||||
using Content.Shared.Weapons.Ranged.Events;
|
||||
@@ -124,6 +126,11 @@ public sealed partial class GunSystem : SharedGunSystem
|
||||
|
||||
if (dmg != null)
|
||||
{
|
||||
if (dmg.Total > FixedPoint2.Zero)
|
||||
{
|
||||
RaiseNetworkEvent(new DamageEffectEvent(result.HitEntity), Filter.Pvs(result.HitEntity, entityManager: EntityManager));
|
||||
}
|
||||
|
||||
PlayImpactSound(result.HitEntity, dmg, hitscan.Sound, hitscan.ForceSound);
|
||||
|
||||
if (user != null)
|
||||
@@ -292,7 +299,7 @@ public sealed partial class GunSystem : SharedGunSystem
|
||||
|
||||
if (sprites.Count > 0)
|
||||
{
|
||||
RaiseNetworkEvent(new HitscanEvent()
|
||||
RaiseNetworkEvent(new HitscanEvent
|
||||
{
|
||||
Sprites = sprites,
|
||||
}, Filter.Pvs(fromCoordinates, entityMan: EntityManager));
|
||||
|
||||
Reference in New Issue
Block a user