Add reflection for crystals (#16426)

This commit is contained in:
metalgearsloth
2023-05-15 15:21:05 +10:00
committed by GitHub
parent fd35b61160
commit 347dcfbeb5
11 changed files with 177 additions and 81 deletions

View File

@@ -14,7 +14,6 @@ using Robust.Shared.Physics.Events;
namespace Content.Server.Projectiles;
[UsedImplicitly]
public sealed class ProjectileSystem : SharedProjectileSystem
{
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
@@ -47,7 +46,6 @@ public sealed class ProjectileSystem : SharedProjectileSystem
var otherName = ToPrettyString(otherEntity);
var direction = args.OurBody.LinearVelocity.Normalized;
var modifiedDamage = _damageableSystem.TryChangeDamage(otherEntity, component.Damage, component.IgnoreResistances, origin: component.Shooter);
component.DamagedEntity = true;
var deleted = Deleted(otherEntity);
if (modifiedDamage is not null && EntityManager.EntityExists(component.Shooter))
@@ -68,11 +66,19 @@ public sealed class ProjectileSystem : SharedProjectileSystem
_sharedCameraRecoil.KickCamera(otherEntity, direction);
}
if (component.DeleteOnCollide)
{
QueueDel(uid);
var ev = new ProjectileCollideEvent(uid, false);
RaiseLocalEvent(args.OtherEntity, ref ev);
if (component.ImpactEffect != null && TryComp<TransformComponent>(component.Owner, out var xform))
if (!ev.Cancelled)
{
component.DamagedEntity = true;
if (component.DeleteOnCollide)
{
QueueDel(uid);
}
if (component.ImpactEffect != null && TryComp<TransformComponent>(uid, out var xform))
{
RaiseNetworkEvent(new ImpactEffectEvent(component.ImpactEffect, xform.Coordinates), Filter.Pvs(xform.Coordinates, entityMan: EntityManager));
}