Modify damage logging. (#5579)

This commit is contained in:
Leon Friedrich
2021-11-29 02:34:44 +13:00
committed by GitHub
parent b807250021
commit 0de4b7bc9f
28 changed files with 265 additions and 62 deletions

View File

@@ -1,4 +1,6 @@
using Content.Server.Administration.Logs;
using Content.Server.Damage.Components;
using Content.Shared.Administration.Logs;
using Content.Shared.Damage;
using Content.Shared.Throwing;
using Robust.Shared.GameObjects;
@@ -9,6 +11,7 @@ namespace Content.Server.Damage.Systems
public sealed class DamageOnLandSystem : EntitySystem
{
[Dependency] private readonly DamageableSystem _damageableSystem = default!;
[Dependency] private readonly AdminLogSystem _logSystem = default!;
public override void Initialize()
{
@@ -18,7 +21,11 @@ namespace Content.Server.Damage.Systems
private void DamageOnLand(EntityUid uid, DamageOnLandComponent component, LandEvent args)
{
_damageableSystem.TryChangeDamage(uid, component.Damage, component.IgnoreResistances);
var dmg = _damageableSystem.TryChangeDamage(uid, component.Damage, component.IgnoreResistances);
if (dmg == null)
return;
_logSystem.Add(LogType.Landed, $"{component.Owner} received {dmg.Total} damage from landing");
}
}
}