2021-11-29 02:34:44 +13:00
|
|
|
using Content.Server.Administration.Logs;
|
2021-09-12 16:22:58 +10:00
|
|
|
using Content.Server.Damage.Components;
|
2021-11-29 02:34:44 +13:00
|
|
|
using Content.Shared.Administration.Logs;
|
2021-09-12 16:22:58 +10:00
|
|
|
using Content.Shared.Damage;
|
2021-11-28 14:56:53 +01:00
|
|
|
using Content.Shared.Database;
|
2021-09-12 16:22:58 +10:00
|
|
|
using Content.Shared.Throwing;
|
|
|
|
|
using Robust.Shared.GameObjects;
|
|
|
|
|
using Robust.Shared.IoC;
|
|
|
|
|
|
|
|
|
|
namespace Content.Server.Damage.Systems
|
|
|
|
|
{
|
|
|
|
|
public sealed class DamageOnLandSystem : EntitySystem
|
|
|
|
|
{
|
2021-09-15 03:07:37 +10:00
|
|
|
[Dependency] private readonly DamageableSystem _damageableSystem = default!;
|
2021-11-29 02:34:44 +13:00
|
|
|
[Dependency] private readonly AdminLogSystem _logSystem = default!;
|
2021-09-12 16:22:58 +10:00
|
|
|
|
|
|
|
|
public override void Initialize()
|
|
|
|
|
{
|
|
|
|
|
base.Initialize();
|
|
|
|
|
SubscribeLocalEvent<DamageOnLandComponent, LandEvent>(DamageOnLand);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void DamageOnLand(EntityUid uid, DamageOnLandComponent component, LandEvent args)
|
|
|
|
|
{
|
2021-11-29 02:34:44 +13:00
|
|
|
var dmg = _damageableSystem.TryChangeDamage(uid, component.Damage, component.IgnoreResistances);
|
|
|
|
|
if (dmg == null)
|
|
|
|
|
return;
|
|
|
|
|
|
2021-11-28 14:56:53 +01:00
|
|
|
_logSystem.Add(LogType.Landed, $"{component.Owner} received {dmg.Total} damage from landing");
|
2021-09-12 16:22:58 +10:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|