Start game with !join
This commit is contained in:
parent
f63dc2565b
commit
c3ef05382f
70
gameloop.py
70
gameloop.py
|
@ -360,34 +360,7 @@ def game(send, notice, voice, devoice, get_event):
|
||||||
else:
|
else:
|
||||||
error('Unknown event type: %s' % event)
|
error('Unknown event type: %s' % event)
|
||||||
|
|
||||||
def no_game():
|
def start_game(rest):
|
||||||
nonlocal players, bots, decks, limit, round_number, round_call_card, czar, card_choices
|
|
||||||
if players is not None:
|
|
||||||
devoice(players)
|
|
||||||
|
|
||||||
players = {}
|
|
||||||
bots = {}
|
|
||||||
decks = {}
|
|
||||||
limit = Limit(limit_types.points, 5)
|
|
||||||
round_number = 1
|
|
||||||
round_call_card = None
|
|
||||||
czar = None
|
|
||||||
card_choices = None
|
|
||||||
|
|
||||||
while True:
|
|
||||||
event, *args = get_event()
|
|
||||||
|
|
||||||
if event == events.status:
|
|
||||||
send('Idle')
|
|
||||||
|
|
||||||
elif event == events.start:
|
|
||||||
nick, *rest = args
|
|
||||||
|
|
||||||
add_player(nick)
|
|
||||||
voice(nick)
|
|
||||||
|
|
||||||
send('%s started a game, !join to join!' % nick)
|
|
||||||
|
|
||||||
expert = False
|
expert = False
|
||||||
if len(rest) == 0 or rest[0] == 'default':
|
if len(rest) == 0 or rest[0] == 'default':
|
||||||
send('Adding the default CAH deck (A5DCM)')
|
send('Adding the default CAH deck (A5DCM)')
|
||||||
|
@ -419,6 +392,47 @@ def game(send, notice, voice, devoice, get_event):
|
||||||
send('Limit is %i %s, change with !limit' % (limit.number, limit_type))
|
send('Limit is %i %s, change with !limit' % (limit.number, limit_type))
|
||||||
send('Once you are ready to start the game, everyone send !ready')
|
send('Once you are ready to start the game, everyone send !ready')
|
||||||
|
|
||||||
|
def no_game():
|
||||||
|
nonlocal players, bots, decks, limit, round_number, round_call_card, czar, card_choices
|
||||||
|
if players is not None:
|
||||||
|
devoice(players)
|
||||||
|
|
||||||
|
players = {}
|
||||||
|
bots = {}
|
||||||
|
decks = {}
|
||||||
|
limit = Limit(limit_types.points, 5)
|
||||||
|
round_number = 1
|
||||||
|
round_call_card = None
|
||||||
|
czar = None
|
||||||
|
card_choices = None
|
||||||
|
|
||||||
|
while True:
|
||||||
|
event, *args = get_event()
|
||||||
|
|
||||||
|
if event == events.status:
|
||||||
|
send('Idle')
|
||||||
|
|
||||||
|
elif event == events.start:
|
||||||
|
nick, *rest = args
|
||||||
|
|
||||||
|
add_player(nick)
|
||||||
|
voice(nick)
|
||||||
|
|
||||||
|
send('%s started a game, !join to join!' % nick)
|
||||||
|
|
||||||
|
start_game(rest)
|
||||||
|
|
||||||
|
return game_setup
|
||||||
|
|
||||||
|
elif event == events.join:
|
||||||
|
nick = args[0]
|
||||||
|
|
||||||
|
send('Started game, !join to join!')
|
||||||
|
|
||||||
|
common_handler(event, args)
|
||||||
|
|
||||||
|
start_game([])
|
||||||
|
|
||||||
return game_setup
|
return game_setup
|
||||||
|
|
||||||
elif event == events.quit:
|
elif event == events.quit:
|
||||||
|
|
Loading…
Reference in New Issue