Make recyclers great again (#6653)
Co-authored-by: metalgearsloth <metalgearsloth@gmail.com>
This commit is contained in:
@@ -6,13 +6,8 @@ using Content.Server.Popups;
|
||||
using Content.Shared.Body.Components;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Recycling;
|
||||
using Content.Shared.Sound;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Analyzers;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.Recycling.Components
|
||||
{
|
||||
@@ -23,6 +18,10 @@ namespace Content.Server.Recycling.Components
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
[ViewVariables]
|
||||
[DataField("enabled")]
|
||||
public bool Enabled = true;
|
||||
|
||||
/// <summary>
|
||||
/// Whether or not sentient beings will be recycled
|
||||
/// </summary>
|
||||
@@ -47,13 +46,15 @@ namespace Content.Server.Recycling.Components
|
||||
|
||||
SuicideKind ISuicideAct.Suicide(EntityUid victim, IChatManager chat)
|
||||
{
|
||||
if (_entMan.TryGetComponent(victim, out ActorComponent? actor) && actor.PlayerSession.ContentData()?.Mind is {} mind)
|
||||
if (_entMan.TryGetComponent(victim, out ActorComponent? actor) &&
|
||||
actor.PlayerSession.ContentData()?.Mind is { } mind)
|
||||
{
|
||||
EntitySystem.Get<GameTicker>().OnGhostAttempt(mind, false);
|
||||
mind.OwnedEntity?.PopupMessage(Loc.GetString("recycler-component-suicide-message"));
|
||||
}
|
||||
|
||||
victim.PopupMessageOtherClients(Loc.GetString("recycler-component-suicide-message-others", ("victim",victim)));
|
||||
victim.PopupMessageOtherClients(Loc.GetString("recycler-component-suicide-message-others",
|
||||
("victim", victim)));
|
||||
|
||||
if (_entMan.TryGetComponent<SharedBodyComponent?>(victim, out var body))
|
||||
{
|
||||
@@ -61,8 +62,16 @@ namespace Content.Server.Recycling.Components
|
||||
}
|
||||
|
||||
EntitySystem.Get<RecyclerSystem>().Bloodstain(this);
|
||||
|
||||
return SuicideKind.Bloodloss;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Default sound to play when recycling
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite)] [DataField("sound")]
|
||||
public SoundSpecifier? Sound = new SoundPathSpecifier("/Audio/Effects/saw.ogg");
|
||||
|
||||
// Ratelimit sounds to avoid spam
|
||||
public TimeSpan LastSound;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user