Event-ify Rejuvenate (#11145)

This commit is contained in:
Visne
2022-09-14 19:30:56 +02:00
committed by GitHub
parent 81eee73995
commit 356a6b8d2e
13 changed files with 100 additions and 61 deletions

View File

@@ -5,6 +5,7 @@ using Content.Server.Atmos.EntitySystems;
using Content.Server.Temperature.Systems;
using Content.Server.Body.Components;
using Content.Shared.Examine;
using Content.Shared.Rejuvenate;
using Robust.Server.GameObjects;
using Content.Shared.Tag;
using Robust.Shared.Containers;
@@ -132,6 +133,7 @@ namespace Content.Server.Atmos.Miasma
SubscribeLocalEvent<PerishableComponent, MobStateChangedEvent>(OnMobStateChanged);
SubscribeLocalEvent<PerishableComponent, BeingGibbedEvent>(OnGibbed);
SubscribeLocalEvent<PerishableComponent, ExaminedEvent>(OnExamined);
SubscribeLocalEvent<RottingComponent, RejuvenateEvent>(OnRejuvenate);
// Containers
SubscribeLocalEvent<AntiRottingContainerComponent, EntInsertedIntoContainerMessage>(OnEntInserted);
SubscribeLocalEvent<AntiRottingContainerComponent, EntRemovedFromContainerMessage>(OnEntRemoved);
@@ -198,6 +200,11 @@ namespace Content.Server.Atmos.Miasma
args.PushMarkup(Loc.GetString(description));
}
private void OnRejuvenate(EntityUid uid, RottingComponent component, RejuvenateEvent args)
{
EntityManager.RemoveComponentDeferred<RottingComponent>(uid);
}
/// Containers
private void OnEntInserted(EntityUid uid, AntiRottingContainerComponent component, EntInsertedIntoContainerMessage args)

View File

@@ -1,9 +1,9 @@
namespace Content.Server.Atmos.Miasma
{
[RegisterComponent]
/// <summary>
/// Tracking component for stuff that has started to rot.
/// </summary>
[RegisterComponent]
public sealed class RottingComponent : Component
{
/// <summary>