fix stale players

This commit is contained in:
SpudGunMan
2024-09-18 01:05:28 -07:00
parent f424da410b
commit f651f2e577
2 changed files with 15 additions and 2 deletions

View File

@@ -248,6 +248,10 @@ I used ideas and snippets from other responder bots and want to call them out!
- https://github.com/pdxlocations/meshtastic-Python-Examples
- https://github.com/geoffwhittington/meshtastic-matrix-relay
GitHub user mrpatrick1991 For Docker configs, PiDiBi looking at test functions and other suggestions like wxc, CPU use, and alerting ideas
Discord and Mesh user Cisien, and github Hailo1999, for testing and ideas!
Games Ported from..
- https://github.com/tigerpointe/Lemonade-Stand/
- https://github.com/Reconfirefly/drugwars
GitHub user mrpatrick1991 For Docker configs, PiDiBi looking at test functions and other suggestions like wxc, CPU use, and alerting ideas
Discord and Mesh user Cisien, and github Hailo1999, for testing and ideas! Lots of individuals on the Meshtastic discord who have tossed out ideas and tested code!

View File

@@ -497,6 +497,11 @@ def onReceive(packet, interface):
game = "DopeWars"
if llm_enabled:
logger.debug(f"System: LLM Disabled for {message_from_id} for duration of game")
#if time exceeds 8 hours reset the player
if dwPlayerTracker[i].get('last_played') < (time.time() - 28800):
dwPlayerTracker.pop(i)
for i in range(0, len(lemonadeTracker)):
if lemonadeTracker[i].get('nodeID') == message_from_id:
@@ -506,6 +511,10 @@ def onReceive(packet, interface):
game = "LemonadeStand"
if llm_enabled:
logger.debug(f"System: LLM Disabled for {message_from_id} for duration of game")
#if time exceeds 8 hours reset the player
if lemonadeTracker[i].get('time') < (time.time() - 28800):
lemonadeTracker.pop(i)
else:
playingGame = False
else: