mirror of
https://github.com/space-wizards/space-station-14.git
synced 2026-02-15 03:31:30 +01:00
* Nubody * fix test fails * gibbing * lung test returns * doc comment * hand organ test * giblet test * yaml formatting * returning * relocate * trimming * re-smite * oops thusd tweak * arachnids have slower metabolism i guess * never mind the old behaviour is bad actually * rider whyyy * style changes and allat * fix collision --------- Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com>
46 lines
1.6 KiB
C#
46 lines
1.6 KiB
C#
using Content.Server.Mind;
|
|
using Content.Server.Zombies;
|
|
using Content.Shared.Body;
|
|
using Content.Shared.Species.Components;
|
|
using Content.Shared.Zombies;
|
|
using Robust.Shared.Prototypes;
|
|
|
|
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 ZombieSystem _zombie = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<NymphComponent, OrganGotRemovedEvent>(OnRemovedFromPart);
|
|
}
|
|
|
|
private void OnRemovedFromPart(EntityUid uid, NymphComponent comp, ref OrganGotRemovedEvent args)
|
|
{
|
|
if (TerminatingOrDeleted(uid) || TerminatingOrDeleted(args.Target))
|
|
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 = SpawnAtPosition(entityProto.ID, coords);
|
|
|
|
if (HasComp<ZombieComponent>(args.Target)) // 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.Target, out var mindId, out var mind))
|
|
_mindSystem.TransferTo(mindId, nymph, mind: mind);
|
|
|
|
// Delete the old organ
|
|
QueueDel(uid);
|
|
}
|
|
}
|