Zombie Diona Fixes (#25404)

No reform, zombie nymphs
This commit is contained in:
LankLTE
2024-02-26 15:31:37 -08:00
committed by GitHub
parent bd99c0dcdb
commit cc865c547b
2 changed files with 18 additions and 5 deletions

View File

@@ -1,6 +1,8 @@
using Content.Server.Mind; using Content.Server.Mind;
using Content.Shared.Species.Components; using Content.Shared.Species.Components;
using Content.Shared.Body.Events; using Content.Shared.Body.Events;
using Content.Shared.Zombies;
using Content.Server.Zombies;
using Robust.Shared.Prototypes; using Robust.Shared.Prototypes;
using Robust.Shared.Timing; using Robust.Shared.Timing;
@@ -11,6 +13,7 @@ public sealed partial class NymphSystem : EntitySystem
[Dependency] private readonly IPrototypeManager _protoManager= default!; [Dependency] private readonly IPrototypeManager _protoManager= default!;
[Dependency] private readonly MindSystem _mindSystem = default!; [Dependency] private readonly MindSystem _mindSystem = default!;
[Dependency] private readonly IGameTiming _timing = default!; [Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly ZombieSystem _zombie = default!;
public override void Initialize() public override void Initialize()
{ {
@@ -30,12 +33,18 @@ public sealed partial class NymphSystem : EntitySystem
if (!_protoManager.TryIndex<EntityPrototype>(comp.EntityPrototype, out var entityProto)) if (!_protoManager.TryIndex<EntityPrototype>(comp.EntityPrototype, out var entityProto))
return; return;
// Get the organs' position & spawn a nymph there
var coords = Transform(uid).Coordinates; var coords = Transform(uid).Coordinates;
var nymph = EntityManager.SpawnAtPosition(entityProto.ID, coords); 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)) if (comp.TransferMind == true && _mindSystem.TryGetMind(args.OldBody, out var mindId, out var mind))
_mindSystem.TransferTo(mindId, nymph, mind: mind); _mindSystem.TransferTo(mindId, nymph, mind: mind);
// Delete the old organ
QueueDel(uid); QueueDel(uid);
} }
} }

View File

@@ -4,12 +4,11 @@ using Content.Shared.DoAfter;
using Content.Shared.Popups; using Content.Shared.Popups;
using Content.Shared.Stunnable; using Content.Shared.Stunnable;
using Content.Shared.Mind; using Content.Shared.Mind;
using Content.Shared.Humanoid; using Content.Shared.Zombies;
using Robust.Shared.Network; using Robust.Shared.Network;
using Robust.Shared.Prototypes; using Robust.Shared.Prototypes;
using Robust.Shared.Serialization; using Robust.Shared.Serialization;
using Robust.Shared.Timing; using Robust.Shared.Timing;
using Robust.Shared.Serialization.Manager;
namespace Content.Shared.Species; namespace Content.Shared.Species;
@@ -23,8 +22,6 @@ public sealed partial class ReformSystem : EntitySystem
[Dependency] private readonly SharedStunSystem _stunSystem = default!; [Dependency] private readonly SharedStunSystem _stunSystem = default!;
[Dependency] private readonly IGameTiming _gameTiming = default!; [Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly SharedMindSystem _mindSystem = default!; [Dependency] private readonly SharedMindSystem _mindSystem = default!;
[Dependency] private readonly MetaDataSystem _metaData = default!;
[Dependency] private readonly ISerializationManager _serializationManager = default!;
public override void Initialize() public override void Initialize()
{ {
@@ -35,6 +32,8 @@ public sealed partial class ReformSystem : EntitySystem
SubscribeLocalEvent<ReformComponent, ReformEvent>(OnReform); SubscribeLocalEvent<ReformComponent, ReformEvent>(OnReform);
SubscribeLocalEvent<ReformComponent, ReformDoAfterEvent>(OnDoAfter); SubscribeLocalEvent<ReformComponent, ReformDoAfterEvent>(OnDoAfter);
SubscribeLocalEvent<ReformComponent, EntityZombifiedEvent>(OnZombified);
} }
private void OnMapInit(EntityUid uid, ReformComponent comp, MapInitEvent args) private void OnMapInit(EntityUid uid, ReformComponent comp, MapInitEvent args)
@@ -101,6 +100,11 @@ public sealed partial class ReformSystem : EntitySystem
QueueDel(uid); QueueDel(uid);
} }
private void OnZombified(EntityUid uid, ReformComponent comp, ref EntityZombifiedEvent args)
{
_actionsSystem.RemoveAction(uid, comp.ActionEntity); // Zombies can't reform
}
public sealed partial class ReformEvent : InstantActionEvent { } public sealed partial class ReformEvent : InstantActionEvent { }
[Serializable, NetSerializable] [Serializable, NetSerializable]