Clear avatar from golf-course join barrier on disconnect
avatarExited cleans up rewardBarrier when a player drops out, then tries
to do the same for the wait-clients-join barrier (self.__barrier), but
the guard is broken in two ways:
if hasattr(self, '__barrier'):
if self.__barrier:
self.__.clear(avId)
Python name-mangling rewrites self.__barrier inside the class body to
self._DistributedGolfCourseAI__barrier, but the hasattr() string is not
mangled, so hasattr(self, '__barrier') is always False. The cleanup
branch never runs. The author got the same pattern right at line 256
where they wrote hasattr(self, '_DistributedGolfCourseAI__barrier').
And the inner call self.__.clear(...) is a typo for
self.__barrier.clear(...) that would AttributeError if it ever fired.
self.__barrier is initialized to None at line 63 and only later set to a
real ToonBarrier, so the attribute always exists. Replace the broken
hasattr/typo combo with a plain truthy check and the correct clear call.
Effect: if a player disconnects during the 'wait for other clients to
join' phase, they now get removed from the barrier so the barrier can
fire with the remaining players instead of holding everyone until
JOIN_TIMEOUT.
This commit is contained in:
parent
a5ecbb8b1e
commit
12e9fa7b48
|
|
@ -188,9 +188,8 @@ class DistributedGolfCourseAI(DistributedObjectAI.DistributedObjectAI, FSM):
|
|||
if hasattr(self, 'rewardBarrier'):
|
||||
if self.rewardBarrier:
|
||||
self.rewardBarrier.clear(avId)
|
||||
if hasattr(self, '__barrier'):
|
||||
if self.__barrier:
|
||||
self.__.clear(avId)
|
||||
if self.__barrier:
|
||||
self.__barrier.clear(avId)
|
||||
|
||||
def startNextHole(self):
|
||||
self.notify.debugStateCall(self)
|
||||
|
|
|
|||
Loading…
Reference in New Issue