Esempio n. 1
0
def resetintel(connection, value):
    """
    Manually reset the blue or green team's intel
    /resetintel <team>
    """
    team = get_team(connection, value)
    reset_intel_position(connection.protocol, team)
Esempio n. 2
0
def switch(connection, player=None, team=None):
    """
    Switch teams either for yourself or for a given player
    /switch [player]
    """
    protocol = connection.protocol
    if player is not None:
        player = get_player(protocol, player)
    elif connection in protocol.players:
        player = connection
    else:
        raise ValueError()
    if player.team.spectator:
        player.send_chat(
            "The switch command can't be used on a spectating player.")
        return
    if team is None:
        new_team = player.team.other
    else:
        new_team = get_team(connection, team)
    if player.invisible:
        old_team = player.team
        player.team = new_team
        player.on_team_changed(old_team)
        player.spawn(player.world_object.position.get())
        player.send_chat('Switched to %s team' % player.team.name)
        if connection is not player and connection in protocol.players:
            connection.send_chat('Switched %s to %s team' %
                                 (player.name, player.team.name))
        protocol.irc_say('* %s silently switched teams' % player.name)
    else:
        player.respawn_time = protocol.respawn_time
        player.set_team(new_team)
        protocol.send_chat('%s switched teams' % player.name, irc=True)
Esempio n. 3
0
def unlock(connection, value):
    """
    Unlock a team
    /unlock <blue|green|spectator>
    """
    team = get_team(connection, value)
    team.locked = False
    connection.protocol.send_chat('%s team is now unlocked' % team.name)
    connection.protocol.irc_say('* %s unlocked %s team' %
                                (connection.name, team.name))
Esempio n. 4
0
def lock(connection, value):
    """
    Make a specified team no longer joinable until it's unlocked
    /lock <blue|green|spectator>
    New players will be placed in the spectator team even if it's locked
    """
    team = get_team(connection, value)
    team.locked = True
    connection.protocol.send_chat('%s team is now locked' % team.name)
    connection.protocol.irc_say('* %s locked %s team' %
                                (connection.name, team.name))
def add_bot(connection, amount=None, team=None):
    protocol = connection.protocol
    if team:
        bot_team = get_team(connection, team)
    blue, green = protocol.blue_team, protocol.green_team
    amount = int(amount or 1)
    for i in range(amount):
        if not team:
            bot_team = blue if blue.count() < green.count() else green
        bot = protocol.add_bot(bot_team)
        if not bot:
            return "Added %s bot(s)" % i
    return "Added %s bot(s)" % amount