This reverts commit bb0776c496.
# Conflicts:
# Content.Server/Projectiles/ProjectileSystem.cs
# Content.Shared/Projectiles/SharedProjectileSystem.cs
# Resources/Prototypes/Entities/Objects/Weapons/Guns/flare_gun.yml
# Resources/Prototypes/Entities/Objects/Weapons/Melee/sword.yml
This commit is contained in:
@@ -9,9 +9,6 @@ using Content.Shared._White;
|
||||
using Robust.Shared.Configuration;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Physics.Events;
|
||||
using Content.Shared.Mobs.Components;
|
||||
using Robust.Shared.Physics.Events;
|
||||
using Robust.Shared.Player;
|
||||
|
||||
namespace Content.Server.Projectiles;
|
||||
|
||||
@@ -64,12 +61,27 @@ public sealed class ProjectileSystem : SharedProjectileSystem
|
||||
return;
|
||||
}
|
||||
|
||||
if (TryHandleProjectile(target, (uid, component)))
|
||||
{
|
||||
var direction = args.OurBody.LinearVelocity.Normalized();
|
||||
_sharedCameraRecoil.KickCamera(target, direction);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tries to handle a projectile interacting with the target.
|
||||
/// </summary>
|
||||
/// <returns>True if the target isn't deleted.</returns>
|
||||
public bool TryHandleProjectile(EntityUid target, Entity<ProjectileComponent> projectile)
|
||||
{
|
||||
var uid = projectile.Owner;
|
||||
var component = projectile.Comp;
|
||||
|
||||
var ev = new ProjectileHitEvent(component.Damage, target, component.Shooter);
|
||||
RaiseLocalEvent(uid, ref ev);
|
||||
|
||||
var otherName = ToPrettyString(target);
|
||||
var direction = args.OurBody.LinearVelocity.Normalized();
|
||||
var modifiedDamage = _damageableSystem.TryChangeDamage(target, ev.Damage * DamageModifier, component.IgnoreResistances, origin: component.Shooter);
|
||||
var modifiedDamage = _damageableSystem.TryChangeDamage(target, ev.Damage, component.IgnoreResistances, origin: component.Shooter);
|
||||
var deleted = Deleted(target);
|
||||
|
||||
if (modifiedDamage is not null && EntityManager.EntityExists(component.Shooter))
|
||||
@@ -87,11 +99,13 @@ public sealed class ProjectileSystem : SharedProjectileSystem
|
||||
if (!deleted)
|
||||
{
|
||||
_guns.PlayImpactSound(target, modifiedDamage, component.SoundHit, component.ForceSound);
|
||||
_sharedCameraRecoil.KickCamera(target, direction);
|
||||
}
|
||||
|
||||
component.DamagedEntity = true;
|
||||
|
||||
var afterProjectileHitEvent = new AfterProjectileHitEvent(component.Damage, target);
|
||||
RaiseLocalEvent(uid, ref afterProjectileHitEvent);
|
||||
|
||||
if (component.DeleteOnCollide)
|
||||
QueueDel(uid);
|
||||
|
||||
@@ -99,5 +113,7 @@ public sealed class ProjectileSystem : SharedProjectileSystem
|
||||
{
|
||||
RaiseNetworkEvent(new ImpactEffectEvent(component.ImpactEffect, GetNetCoordinates(xform.Coordinates)), Filter.Pvs(xform.Coordinates, entityMan: EntityManager));
|
||||
}
|
||||
|
||||
return !deleted;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user