Modify damage logging. (#5579)
This commit is contained in:
@@ -21,5 +21,10 @@ namespace Content.Server.Atmos.Components
|
||||
[DataField("maxDamage")]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public FixedPoint2 MaxDamage = 200;
|
||||
|
||||
/// <summary>
|
||||
/// Used to keep track of when damage starts/stops. Useful for logs.
|
||||
/// </summary>
|
||||
public bool TakingDamage = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using Content.Server.Administration.Logs;
|
||||
using Content.Server.Alert;
|
||||
using Content.Server.Atmos.Components;
|
||||
using Content.Shared.Administration.Logs;
|
||||
using Content.Shared.Alert;
|
||||
using Content.Shared.Atmos;
|
||||
using Content.Shared.Damage;
|
||||
@@ -15,6 +17,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
{
|
||||
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
|
||||
[Dependency] private readonly DamageableSystem _damageableSystem = default!;
|
||||
[Dependency] private readonly AdminLogSystem _logSystem = default!;
|
||||
|
||||
private const float UpdateTimer = 1f;
|
||||
|
||||
@@ -105,6 +108,12 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
// Deal damage and ignore resistances. Resistance to pressure damage should be done via pressure protection gear.
|
||||
_damageableSystem.TryChangeDamage(uid, barotrauma.Damage * Atmospherics.LowPressureDamage, true, false);
|
||||
|
||||
if (!barotrauma.TakingDamage)
|
||||
{
|
||||
barotrauma.TakingDamage = true;
|
||||
_logSystem.Add(LogType.Barotrauma, $"{barotrauma.Owner} started taking low pressure damage");
|
||||
}
|
||||
|
||||
if (status == null) break;
|
||||
|
||||
if (pressure <= Atmospherics.HazardLowPressure)
|
||||
@@ -128,6 +137,12 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
// Deal damage and ignore resistances. Resistance to pressure damage should be done via pressure protection gear.
|
||||
_damageableSystem.TryChangeDamage(uid, barotrauma.Damage * damageScale, true, false);
|
||||
|
||||
if (!barotrauma.TakingDamage)
|
||||
{
|
||||
barotrauma.TakingDamage = true;
|
||||
_logSystem.Add(LogType.Barotrauma, $"{barotrauma.Owner} started taking high pressure damage");
|
||||
}
|
||||
|
||||
if (status == null) break;
|
||||
|
||||
if (pressure >= Atmospherics.HazardHighPressure)
|
||||
@@ -141,6 +156,11 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
|
||||
// Normal pressure.
|
||||
default:
|
||||
if (barotrauma.TakingDamage)
|
||||
{
|
||||
barotrauma.TakingDamage = false;
|
||||
_logSystem.Add(LogType.Barotrauma, $"{barotrauma.Owner} stopped taking pressure damage");
|
||||
}
|
||||
status?.ClearAlertCategory(AlertCategory.Pressure);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Content.Server.Administration.Logs;
|
||||
using Content.Server.Alert;
|
||||
using Content.Server.Atmos.Components;
|
||||
using Content.Server.Stunnable;
|
||||
using Content.Server.Temperature.Systems;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Administration.Logs;
|
||||
using Content.Shared.Alert;
|
||||
using Content.Shared.Atmos;
|
||||
using Content.Shared.Damage;
|
||||
@@ -26,6 +28,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
[Dependency] private readonly StunSystem _stunSystem = default!;
|
||||
[Dependency] private readonly TemperatureSystem _temperatureSystem = default!;
|
||||
[Dependency] private readonly DamageableSystem _damageableSystem = default!;
|
||||
[Dependency] private readonly AdminLogSystem _logSystem = default!;
|
||||
|
||||
private const float MinimumFireStacks = -10f;
|
||||
private const float MaximumFireStacks = 20f;
|
||||
@@ -140,6 +143,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
if (!flammable.OnFire)
|
||||
return;
|
||||
|
||||
_logSystem.Add(LogType.Flammable, $"{flammable.Owner} stopped being on fire damage");
|
||||
flammable.OnFire = false;
|
||||
flammable.FireStacks = 0;
|
||||
|
||||
@@ -155,6 +159,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
|
||||
if (flammable.FireStacks > 0 && !flammable.OnFire)
|
||||
{
|
||||
_logSystem.Add(LogType.Flammable, $"{flammable.Owner} is on fire");
|
||||
flammable.OnFire = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Content.Server.Administration.Logs;
|
||||
using Content.Server.Alert;
|
||||
using Content.Server.Atmos;
|
||||
using Content.Server.Atmos.EntitySystems;
|
||||
@@ -8,6 +9,7 @@ using Content.Server.Body.Behavior;
|
||||
using Content.Server.Temperature.Components;
|
||||
using Content.Server.Temperature.Systems;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Administration.Logs;
|
||||
using Content.Shared.Alert;
|
||||
using Content.Shared.Atmos;
|
||||
using Content.Shared.Body.Components;
|
||||
@@ -313,6 +315,9 @@ namespace Content.Server.Body.Components
|
||||
|
||||
private void TakeSuffocationDamage()
|
||||
{
|
||||
if (!Suffocating)
|
||||
EntitySystem.Get<AdminLogSystem>().Add(LogType.Asphyxiation, $"{Owner} started suffocating");
|
||||
|
||||
Suffocating = true;
|
||||
|
||||
if (Owner.TryGetComponent(out ServerAlertsComponent? alertsComponent))
|
||||
@@ -325,6 +330,9 @@ namespace Content.Server.Body.Components
|
||||
|
||||
private void StopSuffocation()
|
||||
{
|
||||
if (Suffocating)
|
||||
EntitySystem.Get<AdminLogSystem>().Add(LogType.Asphyxiation, $"{Owner} stopped suffocating");
|
||||
|
||||
Suffocating = false;
|
||||
|
||||
if (Owner.TryGetComponent(out ServerAlertsComponent? alertsComponent))
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
using System.Linq;
|
||||
using Content.Server.Act;
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.Administration.Logs;
|
||||
using Content.Server.Chat.Managers;
|
||||
using Content.Server.GameTicking;
|
||||
using Content.Server.Hands.Components;
|
||||
using Content.Server.Items;
|
||||
using Content.Server.Players;
|
||||
using Content.Server.Popups;
|
||||
using Content.Shared.Administration.Logs;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Damage.Prototypes;
|
||||
using Content.Shared.Popups;
|
||||
@@ -81,6 +83,8 @@ namespace Content.Server.Chat.Commands
|
||||
//TODO: needs to check if the mob is actually alive
|
||||
//TODO: maybe set a suicided flag to prevent resurrection?
|
||||
|
||||
EntitySystem.Get<AdminLogSystem>().Add(LogType.Suicide, $"{player.AttachedEntity} is committing suicide");
|
||||
|
||||
// Held item suicide
|
||||
var handsComponent = owner.GetComponent<HandsComponent>();
|
||||
var itemComponent = handsComponent.GetActiveHand;
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
using System;
|
||||
using Content.Server.Administration.Logs;
|
||||
using Content.Server.Damage.Components;
|
||||
using Content.Server.Stunnable;
|
||||
using Content.Server.Stunnable.Components;
|
||||
using Content.Shared.Administration.Logs;
|
||||
using Content.Shared.Audio;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Stunnable;
|
||||
@@ -23,6 +25,7 @@ namespace Content.Server.Damage.Systems
|
||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||
[Dependency] private readonly DamageableSystem _damageableSystem = default!;
|
||||
[Dependency] private readonly StunSystem _stunSystem = default!;
|
||||
[Dependency] private readonly AdminLogSystem _logSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -50,7 +53,11 @@ namespace Content.Server.Damage.Systems
|
||||
_stunSystem.TryStun(uid, TimeSpan.FromSeconds(component.StunSeconds));
|
||||
|
||||
var damageScale = (speed / component.MinimumSpeed) * component.Factor;
|
||||
_damageableSystem.TryChangeDamage(uid, component.Damage * damageScale);
|
||||
|
||||
var dmg = _damageableSystem.TryChangeDamage(uid, component.Damage * damageScale);
|
||||
|
||||
if (dmg != null)
|
||||
_logSystem.Add(LogType.Damaged, $"{component.Owner} took {dmg.Total} damage from a high speed collision");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using Content.Server.Administration.Logs;
|
||||
using Content.Server.Damage.Components;
|
||||
using Content.Server.Tools.Components;
|
||||
using Content.Shared.Administration.Logs;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Interaction;
|
||||
using Robust.Shared.GameObjects;
|
||||
@@ -10,6 +12,7 @@ namespace Content.Server.Damage.Systems
|
||||
public class DamageOnToolInteractSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly DamageableSystem _damageableSystem = default!;
|
||||
[Dependency] private readonly AdminLogSystem _logSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -27,18 +30,25 @@ namespace Content.Server.Damage.Systems
|
||||
&& args.Used.TryGetComponent<WelderComponent>(out var welder)
|
||||
&& welder.Lit)
|
||||
{
|
||||
_damageableSystem.TryChangeDamage(args.Target.Uid, weldingDamage);
|
||||
args.Handled = true;
|
||||
return;
|
||||
}
|
||||
var dmg = _damageableSystem.TryChangeDamage(args.Target.Uid, weldingDamage);
|
||||
|
||||
if (component.DefaultDamage is {} damage
|
||||
if (dmg != null)
|
||||
_logSystem.Add(LogType.Damaged,
|
||||
$"{args.User} used {args.Used} as a welder to deal {dmg.Total} damage to {args.Target}");
|
||||
|
||||
args.Handled = true;
|
||||
}
|
||||
else if (component.DefaultDamage is {} damage
|
||||
&& args.Used.TryGetComponent<ToolComponent>(out var tool)
|
||||
&& tool.Qualities.ContainsAny(component.Tools))
|
||||
{
|
||||
_damageableSystem.TryChangeDamage(args.Target.Uid, damage);
|
||||
var dmg = _damageableSystem.TryChangeDamage(args.Target.Uid, damage);
|
||||
|
||||
if (dmg != null)
|
||||
_logSystem.Add(LogType.Damaged,
|
||||
$"{args.User} used {args.Used} as a tool to deal {dmg.Total} damage to {args.Target}");
|
||||
|
||||
args.Handled = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,7 +11,8 @@ namespace Content.Server.Damage.Systems
|
||||
public class DamageOtherOnHitSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly DamageableSystem _damageableSystem = default!;
|
||||
|
||||
[Dependency] private readonly AdminLogSystem _logSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
SubscribeLocalEvent<DamageOtherOnHitComponent, ThrowDoHitEvent>(OnDoHit);
|
||||
@@ -17,7 +20,9 @@ namespace Content.Server.Damage.Systems
|
||||
|
||||
private void OnDoHit(EntityUid uid, DamageOtherOnHitComponent component, ThrowDoHitEvent args)
|
||||
{
|
||||
_damageableSystem.TryChangeDamage(args.Target.Uid, component.Damage, component.IgnoreResistances);
|
||||
var dmg = _damageableSystem.TryChangeDamage(args.Target.Uid, component.Damage, component.IgnoreResistances);
|
||||
if (dmg != null)
|
||||
_logSystem.Add(LogType.ThrowHit, $"{args.Target} received {dmg.Total} damage from collision");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Content.Server.Administration.Logs;
|
||||
using Content.Server.NodeContainer;
|
||||
using Content.Server.NodeContainer.EntitySystems;
|
||||
using Content.Server.NodeContainer.NodeGroups;
|
||||
@@ -8,6 +9,7 @@ using Content.Server.Power.Components;
|
||||
using Content.Server.Power.EntitySystems;
|
||||
using Content.Server.Power.NodeGroups;
|
||||
using Content.Server.Window;
|
||||
using Content.Shared.Administration.Logs;
|
||||
using Content.Shared.Alert;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Damage.Prototypes;
|
||||
@@ -46,6 +48,7 @@ namespace Content.Server.Electrocution
|
||||
[Dependency] private readonly SharedPopupSystem _popupSystem = default!;
|
||||
[Dependency] private readonly DamageableSystem _damageableSystem = default!;
|
||||
[Dependency] private readonly NodeGroupSystem _nodeGroupSystem = default!;
|
||||
[Dependency] private readonly AdminLogSystem _logSystem = default!;
|
||||
|
||||
private const string StatusEffectKey = "Electrocution";
|
||||
private const string DamageType = "Shock";
|
||||
@@ -104,7 +107,10 @@ namespace Content.Server.Electrocution
|
||||
_prototypeManager.Index<DamageTypePrototype>(DamageType),
|
||||
(int) finished.AccumulatedDamage);
|
||||
|
||||
_damageableSystem.TryChangeDamage(finished.Electrocuting, damage);
|
||||
var actual = _damageableSystem.TryChangeDamage(finished.Electrocuting, damage);
|
||||
if (actual != null)
|
||||
_logSystem.Add(LogType.Electrocution,
|
||||
$"{finished.Owner} took {actual.Total} powered electrocution damage");
|
||||
}
|
||||
|
||||
EntityManager.DeleteEntity(uid);
|
||||
@@ -337,9 +343,15 @@ namespace Content.Server.Electrocution
|
||||
// TODO: Sparks here.
|
||||
|
||||
if(shockDamage is {} dmg)
|
||||
_damageableSystem.TryChangeDamage(uid,
|
||||
{
|
||||
var actual = _damageableSystem.TryChangeDamage(uid,
|
||||
new DamageSpecifier(_prototypeManager.Index<DamageTypePrototype>(DamageType), dmg));
|
||||
|
||||
if (actual != null)
|
||||
_logSystem.Add(LogType.Electrocution,
|
||||
$"{statusEffects.Owner} took {actual.Total} powered electrocution damage");
|
||||
}
|
||||
|
||||
_stutteringSystem.DoStutter(uid, time * StutteringTimeMultiplier, statusEffects, alerts);
|
||||
_jitteringSystem.DoJitter(uid, time * JitterTimeMultiplier, JitterAmplitude, JitterFrequency, true,
|
||||
statusEffects, alerts);
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Content.Server.Administration.Logs;
|
||||
using Content.Server.Camera;
|
||||
using Content.Server.Explosion.Components;
|
||||
using Content.Shared.Acts;
|
||||
using Content.Shared.Administration.Logs;
|
||||
using Content.Shared.Interaction.Helpers;
|
||||
using Content.Shared.Maps;
|
||||
using Content.Shared.Physics;
|
||||
@@ -48,6 +50,7 @@ namespace Content.Server.Explosion.EntitySystems
|
||||
[Dependency] private readonly ActSystem _acts = default!;
|
||||
[Dependency] private readonly EffectSystem _effects = default!;
|
||||
[Dependency] private readonly TriggerSystem _triggers = default!;
|
||||
[Dependency] private readonly AdminLogSystem _logSystem = default!;
|
||||
|
||||
private bool IgnoreExplosivePassable(IEntity e)
|
||||
{
|
||||
@@ -335,6 +338,9 @@ namespace Content.Server.Explosion.EntitySystems
|
||||
return;
|
||||
}
|
||||
|
||||
_logSystem.Add(LogType.Damaged, LogImpact.High ,
|
||||
$"Spawned explosion at {epicenter} with range {devastationRange}/{heavyImpactRange}/{lightImpactRange}/{flashRange}");
|
||||
|
||||
var maxRange = MathHelper.Max(devastationRange, heavyImpactRange, lightImpactRange, 0);
|
||||
var epicenterMapPos = epicenter.ToMapPos(EntityManager);
|
||||
var boundingBox = new Box2(epicenterMapPos - new Vector2(maxRange, maxRange),
|
||||
|
||||
@@ -8,6 +8,7 @@ using Content.Server.Items;
|
||||
using Content.Server.Stack;
|
||||
using Content.Server.Storage.Components;
|
||||
using Content.Server.Throwing;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Hands;
|
||||
using Content.Shared.Hands.Components;
|
||||
@@ -35,6 +36,7 @@ namespace Content.Server.Hands.Systems
|
||||
[Dependency] private readonly InteractionSystem _interactionSystem = default!;
|
||||
[Dependency] private readonly StackSystem _stackSystem = default!;
|
||||
[Dependency] private readonly HandVirtualItemSystem _virtualItemSystem = default!;
|
||||
[Dependency] private readonly ActionBlockerSystem _actionBlockerSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -223,7 +225,7 @@ namespace Content.Server.Hands.Systems
|
||||
playerEnt.IsInContainer() ||
|
||||
!playerEnt.TryGetComponent(out SharedHandsComponent? hands) ||
|
||||
!hands.TryGetActiveHeldEntity(out var throwEnt) ||
|
||||
!_interactionSystem.TryThrowInteraction(hands.Owner, throwEnt))
|
||||
!_actionBlockerSystem.CanThrow(playerEnt.Uid))
|
||||
return false;
|
||||
|
||||
if (throwEnt.TryGetComponent(out StackComponent? stack) && stack.Count > 1 && stack.ThrowIndividually)
|
||||
|
||||
@@ -22,6 +22,8 @@ using Robust.Shared.Audio;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Maths;
|
||||
using Content.Shared.Audio;
|
||||
using Content.Server.Administration.Logs;
|
||||
using Content.Shared.Administration.Logs;
|
||||
|
||||
namespace Content.Server.Light.EntitySystems
|
||||
{
|
||||
@@ -35,6 +37,7 @@ namespace Content.Server.Light.EntitySystems
|
||||
[Dependency] private readonly SharedAmbientSoundSystem _ambientSystem = default!;
|
||||
[Dependency] private readonly LightBulbSystem _bulbSystem = default!;
|
||||
[Dependency] private readonly SharedPopupSystem _popupSystem = default!;
|
||||
[Dependency] private readonly AdminLogSystem _logSystem = default!;
|
||||
|
||||
private static readonly TimeSpan ThunkDelay = TimeSpan.FromSeconds(2);
|
||||
|
||||
@@ -112,7 +115,13 @@ namespace Content.Server.Light.EntitySystems
|
||||
// apply damage to users hands and show message with sound
|
||||
var burnMsg = Loc.GetString("powered-light-component-burn-hand");
|
||||
_popupSystem.PopupEntity(burnMsg, uid, Filter.Entities(userUid));
|
||||
_damageableSystem.TryChangeDamage(userUid, light.Damage);
|
||||
|
||||
var damage = _damageableSystem.TryChangeDamage(userUid, light.Damage);
|
||||
|
||||
if (damage != null)
|
||||
_logSystem.Add(LogType.Damaged,
|
||||
$"{args.User} burned their hand on {args.Target} and received {damage.Total} damage");
|
||||
|
||||
SoundSystem.Play(Filter.Pvs(uid), light.BurnHandSound.GetSound(), uid);
|
||||
|
||||
args.Handled = true;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using System.Threading.Tasks;
|
||||
using Content.Server.Administration.Logs;
|
||||
using Content.Server.Stack;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Administration.Logs;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Damage.Prototypes;
|
||||
using Content.Shared.Interaction;
|
||||
@@ -62,7 +64,15 @@ namespace Content.Server.Medical.Components
|
||||
return true;
|
||||
}
|
||||
|
||||
EntitySystem.Get<DamageableSystem>().TryChangeDamage(eventArgs.Target.Uid, Damage, true);
|
||||
var healed = EntitySystem.Get<DamageableSystem>().TryChangeDamage(eventArgs.Target.Uid, Damage, true);
|
||||
|
||||
if (healed == null)
|
||||
return true;
|
||||
|
||||
if (eventArgs.Target != eventArgs.User)
|
||||
EntitySystem.Get<AdminLogSystem>().Add(LogType.Healed, $"{eventArgs.User} healed {eventArgs.Target} for {healed.Total} damage");
|
||||
else
|
||||
EntitySystem.Get<AdminLogSystem>().Add(LogType.Healed, $"{eventArgs.User} healed themselves for {healed.Total} damage");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Content.Server.Administration.Logs;
|
||||
using Content.Server.Alert;
|
||||
using Content.Shared.Administration.Logs;
|
||||
using Content.Shared.Alert;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.MobState.Components;
|
||||
@@ -203,6 +205,11 @@ namespace Content.Server.Nutrition.Components
|
||||
// _trySound(calculatedThreshold);
|
||||
if (calculatedHungerThreshold != _currentHungerThreshold)
|
||||
{
|
||||
if (_currentHungerThreshold == HungerThreshold.Dead)
|
||||
EntitySystem.Get<AdminLogSystem>().Add(LogType.Hunger, $"{Owner} has stopped starving");
|
||||
else if (calculatedHungerThreshold == HungerThreshold.Dead)
|
||||
EntitySystem.Get<AdminLogSystem>().Add(LogType.Hunger, $"{Owner} has started starving");
|
||||
|
||||
_currentHungerThreshold = calculatedHungerThreshold;
|
||||
HungerThresholdEffect();
|
||||
Dirty();
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Content.Server.Administration.Logs;
|
||||
using Content.Server.Alert;
|
||||
using Content.Shared.Administration.Logs;
|
||||
using Content.Shared.Alert;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.MobState.Components;
|
||||
@@ -200,6 +202,11 @@ namespace Content.Server.Nutrition.Components
|
||||
// _trySound(calculatedThreshold);
|
||||
if (calculatedThirstThreshold != _currentThirstThreshold)
|
||||
{
|
||||
if (_currentThirstThreshold == ThirstThreshold.Dead)
|
||||
EntitySystem.Get<AdminLogSystem>().Add(LogType.Thirst, $"{Owner} has stopped taking dehydration damage");
|
||||
else if (calculatedThirstThreshold == ThirstThreshold.Dead)
|
||||
EntitySystem.Get<AdminLogSystem>().Add(LogType.Thirst, $"{Owner} has started taking dehydration damage");
|
||||
|
||||
_currentThirstThreshold = calculatedThirstThreshold;
|
||||
ThirstThresholdEffect();
|
||||
Dirty();
|
||||
|
||||
@@ -57,9 +57,8 @@ namespace Content.Server.Projectiles
|
||||
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.
|
||||
_adminLogSystem.Add(LogType.BulletHit, LogImpact.Low,
|
||||
$"Projectile {component.Owner} shot by {shooter} hit {otherEntity} and dealt {dmg.Total} damage");
|
||||
}
|
||||
|
||||
// Damaging it can delete it
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using Content.Server.Administration.Logs;
|
||||
using Content.Server.Tools;
|
||||
using Content.Server.Tools.Components;
|
||||
using Content.Shared.Administration.Logs;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Popups;
|
||||
@@ -14,6 +16,7 @@ namespace Content.Server.Repairable
|
||||
{
|
||||
[Dependency] private readonly ToolSystem _toolSystem = default!;
|
||||
[Dependency] private readonly DamageableSystem _damageableSystem = default!;
|
||||
[Dependency] private readonly AdminLogSystem _logSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -32,6 +35,7 @@ namespace Content.Server.Repairable
|
||||
|
||||
// Repair all damage
|
||||
_damageableSystem.SetAllDamage(damageable, 0);
|
||||
_logSystem.Add(LogType.Healed, $"{args.User} repaired ${uid} back to full health");
|
||||
|
||||
component.Owner.PopupMessage(args.User,
|
||||
Loc.GetString("comp-repairable-repair",
|
||||
|
||||
@@ -70,5 +70,10 @@ namespace Content.Server.Temperature.Components
|
||||
[DataField("damageCap")]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public FixedPoint2 DamageCap = FixedPoint2.New(8);
|
||||
|
||||
/// <summary>
|
||||
/// Used to keep track of when damage starts/stops. Useful for logs.
|
||||
/// </summary>
|
||||
public bool TakingDamage = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Content.Server.Administration.Logs;
|
||||
using Content.Server.Alert;
|
||||
using Content.Server.Atmos.Components;
|
||||
using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Server.Temperature.Components;
|
||||
using Content.Shared.Administration.Logs;
|
||||
using Content.Shared.Alert;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.FixedPoint;
|
||||
@@ -17,6 +19,7 @@ namespace Content.Server.Temperature.Systems
|
||||
{
|
||||
[Dependency] private readonly DamageableSystem _damageableSystem = default!;
|
||||
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
|
||||
[Dependency] private readonly AdminLogSystem _logSystem = default!;
|
||||
|
||||
/// <summary>
|
||||
/// All the components that will have their damage updated at the end of the tick.
|
||||
@@ -160,17 +163,34 @@ namespace Content.Server.Temperature.Systems
|
||||
|
||||
if (temperature.CurrentTemperature >= temperature.HeatDamageThreshold)
|
||||
{
|
||||
if (!temperature.TakingDamage)
|
||||
{
|
||||
_logSystem.Add(LogType.Temperature, $"{temperature.Owner} started taking high temperature damage");
|
||||
temperature.TakingDamage = true;
|
||||
}
|
||||
|
||||
var diff = Math.Abs(temperature.CurrentTemperature - temperature.HeatDamageThreshold);
|
||||
var tempDamage = c / (1 + a * Math.Pow(Math.E, -heatK * diff)) - y;
|
||||
_damageableSystem.TryChangeDamage(uid, temperature.HeatDamage * tempDamage);
|
||||
}
|
||||
else if (temperature.CurrentTemperature <= temperature.ColdDamageThreshold)
|
||||
{
|
||||
if (!temperature.TakingDamage)
|
||||
{
|
||||
_logSystem.Add(LogType.Temperature, $"{temperature.Owner} started taking low temperature damage");
|
||||
temperature.TakingDamage = true;
|
||||
}
|
||||
|
||||
var diff = Math.Abs(temperature.CurrentTemperature - temperature.ColdDamageThreshold);
|
||||
var tempDamage =
|
||||
Math.Sqrt(diff * (Math.Pow(temperature.DamageCap.Double(), 2) / temperature.ColdDamageThreshold));
|
||||
_damageableSystem.TryChangeDamage(uid, temperature.ColdDamage * tempDamage);
|
||||
}
|
||||
else if (temperature.TakingDamage)
|
||||
{
|
||||
_logSystem.Add(LogType.Temperature, $"{temperature.Owner} stopped taking temperature damage");
|
||||
temperature.TakingDamage = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTemperatureChangeAttempt(EntityUid uid, TemperatureProtectionComponent component, ModifyChangedTemperatureEvent args)
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Content.Server.Administration.Logs;
|
||||
using Content.Server.Body.Components;
|
||||
using Content.Server.Chemistry.Components;
|
||||
using Content.Server.Chemistry.EntitySystems;
|
||||
using Content.Server.Cooldown;
|
||||
using Content.Server.Weapon.Melee.Components;
|
||||
using Content.Shared.Administration.Logs;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Hands;
|
||||
using Content.Shared.Interaction;
|
||||
@@ -28,6 +30,7 @@ namespace Content.Server.Weapon.Melee
|
||||
[Dependency] private IGameTiming _gameTiming = default!;
|
||||
[Dependency] private readonly DamageableSystem _damageableSystem = default!;
|
||||
[Dependency] private SolutionContainerSystem _solutionsSystem = default!;
|
||||
[Dependency] private readonly AdminLogSystem _logSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -92,8 +95,19 @@ namespace Content.Server.Weapon.Melee
|
||||
|
||||
RaiseLocalEvent(target.Uid, new AttackedEvent(args.Used, args.User, args.ClickLocation));
|
||||
|
||||
_damageableSystem.TryChangeDamage(target.Uid,
|
||||
var damage = _damageableSystem.TryChangeDamage(target.Uid,
|
||||
DamageSpecifier.ApplyModifierSets(comp.Damage, hitEvent.ModifiersList));
|
||||
|
||||
if (damage != null)
|
||||
{
|
||||
if (args.Used == args.User)
|
||||
_logSystem.Add(LogType.MeleeHit,
|
||||
$"{args.User} melee attacked {args.TargetEntity} using their hands and dealt {damage.Total} damage");
|
||||
else
|
||||
_logSystem.Add(LogType.MeleeHit,
|
||||
$"{args.User} melee attacked {args.TargetEntity} using {args.Used} and dealt {damage.Total} damage");
|
||||
}
|
||||
|
||||
SoundSystem.Play(Filter.Pvs(owner), comp.HitSound.GetSound(), target);
|
||||
}
|
||||
}
|
||||
@@ -160,8 +174,18 @@ namespace Content.Server.Weapon.Melee
|
||||
{
|
||||
RaiseLocalEvent(entity.Uid, new AttackedEvent(args.Used, args.User, args.ClickLocation));
|
||||
|
||||
_damageableSystem.TryChangeDamage(entity.Uid,
|
||||
DamageSpecifier.ApplyModifierSets(comp.Damage, hitEvent.ModifiersList));
|
||||
var damage = _damageableSystem.TryChangeDamage(entity.Uid,
|
||||
DamageSpecifier.ApplyModifierSets(comp.Damage, hitEvent.ModifiersList));
|
||||
|
||||
if (damage != null)
|
||||
{
|
||||
if (args.Used == args.User)
|
||||
_logSystem.Add(LogType.MeleeHit,
|
||||
$"{args.User} melee attacked {entity} using their hands and dealt {damage.Total} damage");
|
||||
else
|
||||
_logSystem.Add(LogType.MeleeHit,
|
||||
$"{args.User} melee attacked {entity} using {args.Used} and dealt {damage.Total} damage");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,9 +2,11 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Content.Server.Administration.Logs;
|
||||
using Content.Server.Camera;
|
||||
using Content.Server.Projectiles.Components;
|
||||
using Content.Server.Weapon.Ranged.Ammunition.Components;
|
||||
using Content.Shared.Administration.Logs;
|
||||
using Content.Shared.Audio;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Examine;
|
||||
@@ -396,7 +398,10 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
|
||||
var result = rayCastResults[0];
|
||||
var distance = result.Distance;
|
||||
hitscan.FireEffects(shooter, distance, angle, result.HitEntity);
|
||||
EntitySystem.Get<DamageableSystem>().TryChangeDamage(result.HitEntity.Uid, hitscan.Damage);
|
||||
var dmg = EntitySystem.Get<DamageableSystem>().TryChangeDamage(result.HitEntity.Uid, hitscan.Damage);
|
||||
if (dmg != null)
|
||||
EntitySystem.Get<AdminLogSystem>().Add(LogType.HitScanHit,
|
||||
$"{shooter} hit {result.HitEntity} using {hitscan.Owner} and dealt {dmg.Total} damage");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user