Fix projectiles and vehicles (#10358)

Co-authored-by: metalgearsloth <metalgearsloth@gmail.com>
This commit is contained in:
metalgearsloth
2022-09-14 20:03:00 +10:00
committed by GitHub
parent bd2a3ed223
commit 84d5bfdab3
4 changed files with 42 additions and 19 deletions

View File

@@ -5,6 +5,7 @@ using Content.Shared.Damage;
using Content.Shared.Database;
using Content.Shared.FixedPoint;
using Content.Shared.Projectiles;
using Content.Shared.Vehicle.Components;
using Content.Shared.Weapons.Melee;
using JetBrains.Annotations;
using Robust.Server.GameObjects;
@@ -19,10 +20,10 @@ namespace Content.Server.Projectiles
[UsedImplicitly]
public sealed class ProjectileSystem : SharedProjectileSystem
{
[Dependency] private readonly DamageableSystem _damageableSystem = default!;
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
[Dependency] private readonly SharedCameraRecoilSystem _sharedCameraRecoil = default!;
[Dependency] private readonly DamageableSystem _damageableSystem = default!;
[Dependency] private readonly GunSystem _guns = default!;
[Dependency] private readonly SharedCameraRecoilSystem _sharedCameraRecoil = default!;
public override void Initialize()
{
@@ -43,7 +44,7 @@ namespace Content.Server.Projectiles
return;
var otherEntity = args.OtherFixture.Body.Owner;
var direction = args.OurFixture.Body.LinearVelocity.Normalized;
var modifiedDamage = _damageableSystem.TryChangeDamage(otherEntity, component.Damage, component.IgnoreResistances);
component.DamagedEntity = true;
@@ -56,7 +57,7 @@ namespace Content.Server.Projectiles
_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");
$"Projectile {ToPrettyString(uid):projectile} shot by {ToPrettyString(component.Shooter):user} hit {ToPrettyString(otherEntity):target} and dealt {modifiedDamage.Total:damage} damage");
}
_guns.PlayImpactSound(otherEntity, modifiedDamage, component.SoundHit, component.ForceSound);
@@ -64,7 +65,6 @@ namespace Content.Server.Projectiles
// Damaging it can delete it
if (HasComp<CameraRecoilComponent>(otherEntity))
{
var direction = args.OurFixture.Body.LinearVelocity.Normalized;
_sharedCameraRecoil.KickCamera(otherEntity, direction);
}
@@ -72,7 +72,7 @@ namespace Content.Server.Projectiles
{
QueueDel(uid);
if (component.ImpactEffect != null && TryComp<TransformComponent>(uid, out var xform))
if (component.ImpactEffect != null && TryComp<TransformComponent>(component.Owner, out var xform))
{
RaiseNetworkEvent(new ImpactEffectEvent(component.ImpactEffect, xform.Coordinates), Filter.Pvs(xform.Coordinates, entityMan: EntityManager));
}