mirror of
https://github.com/SpudGunMan/meshing-around.git
synced 2026-08-06 17:03:04 +02:00
golfEnhance
This commit is contained in:
@@ -471,6 +471,14 @@ def handleGolf(nodeID, message):
|
||||
if golfTracker[i]['nodeID'] == nodeID:
|
||||
last_cmd = golfTracker[i]['cmd']
|
||||
|
||||
if "end" in message.lower() or message.lower().startswith("e"):
|
||||
logger.debug(f"System: GolfSim: {nodeID} is leaving the game")
|
||||
msg = "You have left the Game."
|
||||
for i in range(len(golfTracker)):
|
||||
if golfTracker[i]['nodeID'] == nodeID:
|
||||
golfTracker.pop(i)
|
||||
return msg
|
||||
|
||||
if last_cmd == "":
|
||||
# create new player
|
||||
logger.debug("System: GolfSim: New Player: " + str(nodeID))
|
||||
|
||||
@@ -56,6 +56,13 @@ def finish_hole():
|
||||
finish = random.choice(putt_outcomes)
|
||||
return finish
|
||||
|
||||
def endGameGolf(nodeID):
|
||||
# pop player from tracker
|
||||
for i in range(len(golfTracker)):
|
||||
if golfTracker[i]['nodeID'] == nodeID:
|
||||
golfTracker.pop(i)
|
||||
logger.debug("System: GolfSim: Player " + str(nodeID) + " has ended their round.")
|
||||
|
||||
# Main game loop
|
||||
def playGolf(nodeID, message):
|
||||
msg = ''
|
||||
|
||||
Reference in New Issue
Block a user