fix teaching a lesson to nuggets (#2753)
* add OriginalMind to MCC * make teach lesson use OriginalMind --------- Co-authored-by: deltanedas <@deltanedas:kde.org>
This commit is contained in:
parent
f4d42aacca
commit
9dc34a72eb
|
|
@ -264,6 +264,7 @@ public sealed class MindSystem : SharedMindSystem
|
|||
if (entity != null)
|
||||
{
|
||||
component!.Mind = mindId;
|
||||
component.OriginalMind ??= mindId; // DeltaV
|
||||
mind.OwnedEntity = entity;
|
||||
mind.OriginalOwnedEntity ??= GetNetEntity(mind.OwnedEntity);
|
||||
Entity<MindComponent> mindEnt = (mindId, mind);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
using Content.Server._DV.Objectives.Components;
|
||||
using Content.Server.Objectives.Components;
|
||||
using Content.Server.Objectives.Systems;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.Mind.Components;
|
||||
using Content.Shared.Mobs;
|
||||
|
||||
namespace Content.Server._DV.Objectives.Systems;
|
||||
|
|
@ -12,7 +12,6 @@ namespace Content.Server._DV.Objectives.Systems;
|
|||
public sealed class TeachLessonConditionSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly CodeConditionSystem _codeCondition = default!;
|
||||
[Dependency] private readonly SharedMindSystem _mind = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
|
|
@ -27,8 +26,9 @@ public sealed class TeachLessonConditionSystem : EntitySystem
|
|||
if (args.NewMobState != MobState.Dead)
|
||||
return;
|
||||
|
||||
// Get the mind of the entity that just died (if it has one)
|
||||
if (!_mind.TryGetMind(args.Target, out var mindId, out _))
|
||||
// Get the mind of the entity that just died (if it had one)
|
||||
// Uses OriginalMind so if someone ghosts or otherwise loses control of a mob, you can still greentext
|
||||
if (!TryComp<MindContainerComponent>(args.Target, out var mc) || mc.OriginalMind is not {} mindId)
|
||||
return;
|
||||
|
||||
// Get all TeachLessonConditionComponent entities
|
||||
|
|
|
|||
|
|
@ -16,6 +16,12 @@ public sealed partial class MindContainerComponent : Component
|
|||
[DataField, AutoNetworkedField]
|
||||
public EntityUid? Mind { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// DeltaV: The first mind to control this mob. Will only be null if the mob never had a mind at all.
|
||||
/// </summary>
|
||||
[DataField, AutoNetworkedField]
|
||||
public EntityUid? OriginalMind;
|
||||
|
||||
/// <summary>
|
||||
/// True if we have a mind, false otherwise.
|
||||
/// </summary>
|
||||
|
|
|
|||
Loading…
Reference in New Issue