mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-17 13:37:47 +03:00
Uses the following Cherry-Picks: https://github.com/space-wizards/space-station-14/pull/26994 https://github.com/space-wizards/space-station-14/pull/26518 https://github.com/space-wizards/space-station-14/pull/26279 https://github.com/space-wizards/space-station-14/pull/24946 https://github.com/space-wizards/space-station-14/pull/27188 Requires: https://github.com/Simple-Station/Einstein-Engines/pull/535 https://github.com/Simple-Station/Einstein-Engines/pull/534 --------- Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Co-authored-by: Leon Friedrich <60421075+ElectroJr@users.noreply.github.com> Co-authored-by: Jake Huxell <JakeHuxell@pm.me> Co-authored-by: Tayrtahn <tayrtahn@gmail.com> Co-authored-by: 0x6273 <0x40@keemail.me> Co-authored-by: DEATHB4DEFEAT <zachcaffee@outlook.com>
51 lines
1.8 KiB
C#
51 lines
1.8 KiB
C#
using Content.Server.Mind;
|
|
using Content.Shared.Species.Components;
|
|
using Content.Shared.Body.Events;
|
|
using Content.Shared.Zombies;
|
|
using Content.Server.Zombies;
|
|
using Robust.Shared.Prototypes;
|
|
using Robust.Shared.Timing;
|
|
|
|
namespace Content.Server.Species.Systems;
|
|
|
|
public sealed partial class NymphSystem : EntitySystem
|
|
{
|
|
[Dependency] private readonly IPrototypeManager _protoManager= default!;
|
|
[Dependency] private readonly MindSystem _mindSystem = default!;
|
|
[Dependency] private readonly IGameTiming _timing = default!;
|
|
[Dependency] private readonly ZombieSystem _zombie = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<NymphComponent, OrganRemovedFromBodyEvent>(OnRemovedFromPart);
|
|
}
|
|
|
|
private void OnRemovedFromPart(EntityUid uid, NymphComponent comp, ref OrganRemovedFromBodyEvent args)
|
|
{
|
|
if (!_timing.IsFirstTimePredicted)
|
|
return;
|
|
|
|
if (TerminatingOrDeleted(uid) || TerminatingOrDeleted(args.OldBody))
|
|
return;
|
|
|
|
if (!_protoManager.TryIndex<EntityPrototype>(comp.EntityPrototype, out var entityProto))
|
|
return;
|
|
|
|
// Get the organs' position & spawn a nymph there
|
|
var coords = Transform(uid).Coordinates;
|
|
var nymph = EntityManager.SpawnAtPosition(entityProto.ID, coords);
|
|
|
|
if (HasComp<ZombieComponent>(args.OldBody)) // Zombify the new nymph if old one is a zombie
|
|
_zombie.ZombifyEntity(nymph);
|
|
|
|
// Move the mind if there is one and it's supposed to be transferred
|
|
if (comp.TransferMind == true && _mindSystem.TryGetMind(args.OldBody, out var mindId, out var mind))
|
|
_mindSystem.TransferTo(mindId, nymph, mind: mind);
|
|
|
|
// Delete the old organ
|
|
QueueDel(uid);
|
|
}
|
|
}
|