Do not wake up NPC if there is still a mind attached. (#27651)
* Do not wake up NPC if there is still a mind attached. This became apparent with diona nymphs (?) and slime gyras (?). This caused players that disconnected while a nymph, gyras or other npc to resume their NPC behavior. Which I would call unwanted. This fixes that. * Zombies become AI anyway * Update Content.Server/NPC/Systems/NPCSystem.cs --------- Co-authored-by: Nemanja <98561806+EmoGarbage404@users.noreply.github.com>
This commit is contained in:
@@ -2,6 +2,8 @@ using System.Diagnostics.CodeAnalysis;
|
|||||||
using Content.Server.NPC.Components;
|
using Content.Server.NPC.Components;
|
||||||
using Content.Server.NPC.HTN;
|
using Content.Server.NPC.HTN;
|
||||||
using Content.Shared.CCVar;
|
using Content.Shared.CCVar;
|
||||||
|
using Content.Shared.Mind;
|
||||||
|
using Content.Shared.Mind.Components;
|
||||||
using Content.Shared.Mobs;
|
using Content.Shared.Mobs;
|
||||||
using Content.Shared.Mobs.Systems;
|
using Content.Shared.Mobs.Systems;
|
||||||
using Content.Shared.NPC;
|
using Content.Shared.NPC;
|
||||||
@@ -49,6 +51,10 @@ namespace Content.Server.NPC.Systems
|
|||||||
if (_mobState.IsIncapacitated(uid) || TerminatingOrDeleted(uid))
|
if (_mobState.IsIncapacitated(uid) || TerminatingOrDeleted(uid))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// This NPC has an attached mind, so it should not wake up.
|
||||||
|
if (TryComp<MindContainerComponent>(uid, out var mindContainer) && mindContainer.HasMind)
|
||||||
|
return;
|
||||||
|
|
||||||
WakeNPC(uid, component);
|
WakeNPC(uid, component);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ namespace Content.Server.Zombies
|
|||||||
/// <param name="target">the entity being zombified</param>
|
/// <param name="target">the entity being zombified</param>
|
||||||
/// <param name="mobState"></param>
|
/// <param name="mobState"></param>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// ALRIGHT BIG BOY. YOU'VE COME TO THE LAYER OF THE BEAST. THIS IS YOUR WARNING.
|
/// ALRIGHT BIG BOYS, GIRLS AND ANYONE ELSE. YOU'VE COME TO THE LAYER OF THE BEAST. THIS IS YOUR WARNING.
|
||||||
/// This function is the god function for zombie stuff, and it is cursed. I have
|
/// This function is the god function for zombie stuff, and it is cursed. I have
|
||||||
/// attempted to label everything thouroughly for your sanity. I have attempted to
|
/// attempted to label everything thouroughly for your sanity. I have attempted to
|
||||||
/// rewrite this, but this is how it shall lie eternal. Turn back now.
|
/// rewrite this, but this is how it shall lie eternal. Turn back now.
|
||||||
@@ -226,6 +226,11 @@ namespace Content.Server.Zombies
|
|||||||
|
|
||||||
_identity.QueueIdentityUpdate(target);
|
_identity.QueueIdentityUpdate(target);
|
||||||
|
|
||||||
|
var htn = EnsureComp<HTNComponent>(target);
|
||||||
|
htn.RootTask = new HTNCompoundTask() { Task = "SimpleHostileCompound" };
|
||||||
|
htn.Blackboard.SetValue(NPCBlackboard.Owner, target);
|
||||||
|
_npc.SleepNPC(target, htn);
|
||||||
|
|
||||||
//He's gotta have a mind
|
//He's gotta have a mind
|
||||||
var hasMind = _mind.TryGetMind(target, out var mindId, out _);
|
var hasMind = _mind.TryGetMind(target, out var mindId, out _);
|
||||||
if (hasMind && _mind.TryGetSession(mindId, out var session))
|
if (hasMind && _mind.TryGetSession(mindId, out var session))
|
||||||
@@ -241,9 +246,6 @@ namespace Content.Server.Zombies
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var htn = EnsureComp<HTNComponent>(target);
|
|
||||||
htn.RootTask = new HTNCompoundTask() { Task = "SimpleHostileCompound" };
|
|
||||||
htn.Blackboard.SetValue(NPCBlackboard.Owner, target);
|
|
||||||
_npc.WakeNPC(target, htn);
|
_npc.WakeNPC(target, htn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user