Adds like 17 new logs (#5499)

Co-authored-by: Pieter-Jan Briers <pieterjan.briers@gmail.com>
This commit is contained in:
Moony
2021-11-24 16:52:31 -06:00
committed by GitHub
parent 078f3a7738
commit c576eb91d3
10 changed files with 116 additions and 5 deletions

View File

@@ -1,5 +1,7 @@
using Content.Server.Administration.Logs;
using Content.Server.Camera;
using Content.Server.Projectiles.Components;
using Content.Shared.Administration.Logs;
using Content.Shared.Body.Components;
using Content.Shared.Damage;
using JetBrains.Annotations;
@@ -15,6 +17,7 @@ namespace Content.Server.Projectiles
internal sealed class ProjectileSystem : EntitySystem
{
[Dependency] private readonly DamageableSystem _damageableSystem = default!;
[Dependency] private readonly AdminLogSystem _adminLogSystem = default!;
public override void Initialize()
{
@@ -50,8 +53,11 @@ namespace Content.Server.Projectiles
if (!otherEntity.Deleted)
{
_damageableSystem.TryChangeDamage(otherEntity.Uid, component.Damage);
var dmg = _damageableSystem.TryChangeDamage(otherEntity.Uid, component.Damage);
component.DamagedEntity = true;
if (dmg is not null && EntityManager.TryGetEntity(component.Shooter, out var shooter))
_adminLogSystem.Add(LogType.BulletHit, LogImpact.Low, $"Bullet shot by {shooter} hit {otherEntity}");
// "DamagedEntity" is misleading. Hit entity may be more accurate, as the damage may have been resisted
// by resistance sets.
}