From 2502a04bc7b40e8dd2281cfc39426304167ce1af Mon Sep 17 00:00:00 2001 From: Edmond Mondor Date: Wed, 16 Aug 2023 14:39:07 -0700 Subject: [PATCH 1/2] Add check for server init being completed before allowing onNotify to run Weird issue happens when arriving in Gahreesen from the bahro pole book --- Scripts/Python/grsnNexusBookMachine.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Scripts/Python/grsnNexusBookMachine.py b/Scripts/Python/grsnNexusBookMachine.py index 674f0f8293..485280f0eb 100644 --- a/Scripts/Python/grsnNexusBookMachine.py +++ b/Scripts/Python/grsnNexusBookMachine.py @@ -81,6 +81,7 @@ kElevMoving = 1 kElevUp = 2 elevatorStatus = kElevDown +serverInitDone = False class grsnNexusBookMachine(ptResponder): @@ -105,6 +106,8 @@ def GetPlayersInChatDistance(self, minPlayers=8): return plyrList def OnServerInitComplete(self): + global serverInitDone + serverInitDone = True bookPillarSpinning.run(self.key,netPropagate=False) if not PtIsSolo(): return @@ -151,6 +154,8 @@ def OnNotify(self,state,id,events): global elevatorStatus #PtDebugPrint("id ",id) + if not serverInitDone: + return avatar=PtFindAvatar(events) local = PtGetLocalAvatar() From 5ce9f10a0c37a5e6c099c46bd491bba3c0ed4bc0 Mon Sep 17 00:00:00 2001 From: Edmond Mondor Date: Wed, 16 Aug 2023 22:39:09 -0700 Subject: [PATCH 2/2] requested changes Co-authored-by: Adam Johnson --- Scripts/Python/grsnNexusBookMachine.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Scripts/Python/grsnNexusBookMachine.py b/Scripts/Python/grsnNexusBookMachine.py index 485280f0eb..acf31833d0 100644 --- a/Scripts/Python/grsnNexusBookMachine.py +++ b/Scripts/Python/grsnNexusBookMachine.py @@ -81,7 +81,6 @@ kElevMoving = 1 kElevUp = 2 elevatorStatus = kElevDown -serverInitDone = False class grsnNexusBookMachine(ptResponder): @@ -90,6 +89,7 @@ def __init__(self): PtDebugPrint("book machine init") self.id = 53624 self.version = 2 + self.serverInitDone = False def IAmMaster(self): return (self.sceneobject.isLocallyOwned()) @@ -106,8 +106,7 @@ def GetPlayersInChatDistance(self, minPlayers=8): return plyrList def OnServerInitComplete(self): - global serverInitDone - serverInitDone = True + self.serverInitDone = True bookPillarSpinning.run(self.key,netPropagate=False) if not PtIsSolo(): return @@ -154,7 +153,7 @@ def OnNotify(self,state,id,events): global elevatorStatus #PtDebugPrint("id ",id) - if not serverInitDone: + if not self.serverInitDone: return avatar=PtFindAvatar(events)