WS DTO assign rework

This commit is contained in:
Eden Kirin
2023-03-25 15:27:15 +01:00
parent 9aabcf61f4
commit 0f0fe68890
11 changed files with 79 additions and 30 deletions

View File

@ -29,7 +29,11 @@ class InactivityWatchdog(Thread):
)
for player in self.players:
if player.active and player.last_seen < inactivity_threshold:
if (
player.can_be_deactivated
and player.active
and player.last_seen < inactivity_threshold
):
player.active = False
logging.info(f"Player {player} set as inactive")
@ -37,7 +41,7 @@ class InactivityWatchdog(Thread):
n = 0
while n < len(self.players):
player = self.players[n]
if player.last_seen < kick_threshold:
if player.can_be_deactivated and player.last_seen < kick_threshold:
self.players.pop(n)
logging.info(f"Player {player} kicked out")
else: