Files
OldThink/Content.Shared/_White/Body/BodyRejuvenateSystem.cs
Aviu00 74ef19d6a6 Cult update (#220)
* - tweak: Cult door not bump openable.

* - tweak: Better summoning and Narsie

* - tweak: Construct update.

* - tweak: Eldrich blade fits in suit storage.

* - tweak: More spell limit.

* - fix: Fix pylon desc.

* - tweak: Teleport works on cuffed targets.

* - tweak: More popups if target is holy.

* - fix: No rune drawing using fingers.

* - tweak: Better pylon placement & less pylon healing range.

* - tweak: More blood rites charge.

* - fix: Fix max spell amount.

* - tweak: Less cult door and wall health.

* - fix: Constructs are dead IC.

* - add: Revive rune now notifies player.

* - add: Narsie summon rune eui.

* - fix: Fix narsie summon sound not playing for reapers.

* - tweak: Whatever.

* - add: Conceal presence spell.

* - tweak: Tweakz.

* - add: Blood spear.

* - add: Blood boil barrage.

* - tweak: Artificer flies.

* - tweak: Blood bolt color tweaks.

* - tweak: Runic door is bump openable again.

* - fix: Fix concealed door outline.

* - add: Update concealable name and desc.

* - tweak: Remove the unremoveable.

* - tweak: Gift ignore.

* - add: Organs regenerate on rejuvenate.

* - tweak: Brainless cultist is fine.

* - add: Added more fun.

* - add: Add rune descriptions.

* - fix: Fixes.

* - tweak: Blood rites now uses verb.

* - tweak: Bring it back.
2024-03-22 08:23:33 +00:00

49 lines
1.6 KiB
C#

using System.Linq;
using Content.Shared.Body.Components;
using Content.Shared.Body.Systems;
using Content.Shared.Rejuvenate;
using Robust.Shared.Containers;
using Robust.Shared.Prototypes;
namespace Content.Shared._White.Body;
public sealed class BodyRejuvenateSystem : EntitySystem
{
[Dependency] private readonly SharedBodySystem _body = default!;
[Dependency] private readonly SharedContainerSystem _container = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<BodyComponent, RejuvenateEvent>(OnRejuvenate);
}
private void OnRejuvenate(Entity<BodyComponent> ent, ref RejuvenateEvent args)
{
if (ent.Comp.Prototype == null)
return;
var prototype = _prototypeManager.Index(ent.Comp.Prototype.Value);
var protoSlots = prototype.Slots.Values.ToList();
foreach (var (id, component) in _body.GetBodyChildren(ent.Owner, ent.Comp))
{
foreach (var organSlot in component.Organs.Values)
{
if (!_container.TryGetContainer(id, SharedBodySystem.GetOrganContainerId(organSlot.Id),
out var container))
continue;
if (container.Count > 0)
continue;
var organ = protoSlots.Where(x => x.Organs.ContainsKey(organSlot.Id))
.Select(x => x.Organs[organSlot.Id]).FirstOrDefault();
TrySpawnInContainer(organ, id, SharedBodySystem.GetOrganContainerId(organSlot.Id), out _);
}
}
}
}