Skip to content

Commit 93a3e10

Browse files
committed
fix freezing P2
#906
1 parent f3c3062 commit 93a3e10

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

game/world/objects/npc.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2791,12 +2791,12 @@ bool Npc::startState(ScriptFn id, std::string_view wp, gtime endTime, bool noFin
27912791
}
27922792

27932793
auto& st = owner.script().aiState(id);
2794-
// allowed player states are hard-coded
2795-
// https://forum.worldofplayers.de/forum/threads/1533803-G1-AI_StartState-hardcoded-ZS-states-for-Player?p=26034737&viewfull=1#post26034737
27962794
if(isPlayer() && !isPlayerEnabledState(st)) {
27972795
// disable for now, as it causes infinite lock in freeze state
27982796
// https://github.com/Try/OpenGothic/issues/906
2799-
//return false;
2797+
// extra 'aiStandup' to avoid issue with B_StopMagicFreeze
2798+
aiPush(AiQueue::aiStandup());
2799+
return false;
28002800
}
28012801

28022802
aiState.started = false;
@@ -2822,6 +2822,9 @@ void Npc::clearState(bool noFinalize) {
28222822
}
28232823

28242824
bool Npc::isPlayerEnabledState(const ::AiState& st) const {
2825+
// allowed player states are hard-coded
2826+
// https://forum.worldofplayers.de/forum/threads/1533803-G1-AI_StartState-hardcoded-ZS-states-for-Player?p=26034737&viewfull=1#post26034737
2827+
28252828
static const std::array playerEnabledStatesG1 = {
28262829
"ZS_DEAD", "ZS_UNCONSCIOUS", "ZS_MAGICFREEZE",
28272830
"ZS_PYRO", "ZS_ASSESSMAGIC", "ZS_ASSESSSTOPMAGIC",

0 commit comments

Comments
 (0)