Skip to content

Commit

Permalink
Add admin logs to Rehydration comp. (space-wizards#30597)
Browse files Browse the repository at this point in the history
  • Loading branch information
Titian3 authored and themias committed Aug 9, 2024
1 parent 6d15f7e commit 23828a6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Content.Shared/Chemistry/EntitySystems/RehydratableSystem.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using Content.Shared.Administration.Logs;
using Content.Shared.Chemistry.Components;
using Content.Shared.Database;
using Content.Shared.FixedPoint;
using Content.Shared.Popups;
using Robust.Shared.Network;
Expand All @@ -13,6 +15,7 @@ public sealed class RehydratableSystem : EntitySystem
[Dependency] private readonly SharedPopupSystem _popup = default!;
[Dependency] private readonly SharedSolutionContainerSystem _solutions = default!;
[Dependency] private readonly SharedTransformSystem _xform = default!;
[Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;

public override void Initialize()
{
Expand All @@ -24,6 +27,7 @@ public override void Initialize()
private void OnSolutionChange(Entity<RehydratableComponent> ent, ref SolutionContainerChangedEvent args)
{
var quantity = _solutions.GetTotalPrototypeQuantity(ent, ent.Comp.CatalystPrototype);
_adminLogger.Add(LogType.Action, LogImpact.Medium, $"{ToPrettyString(ent.Owner)} was hydrated, now contains a solution of: {SharedSolutionContainerSystem.ToPrettyString(args.Solution)}.");
if (quantity != FixedPoint2.Zero && quantity >= ent.Comp.CatalystMinimum)
{
Expand(ent);
Expand All @@ -41,6 +45,8 @@ private void Expand(Entity<RehydratableComponent> ent)
var randomMob = _random.Pick(comp.PossibleSpawns);

var target = Spawn(randomMob, Transform(uid).Coordinates);
_adminLogger.Add(LogType.Action, LogImpact.Medium, $"{ToPrettyString(ent.Owner)} has been hydrated correctly and spawned: {ToPrettyString(target)}.");

_popup.PopupEntity(Loc.GetString("rehydratable-component-expands-message", ("owner", uid)), target);

_xform.AttachToGridOrMap(target);
Expand Down

0 comments on commit 23828a6

Please sign in to comment.