コード例 #1
0
ファイル: gg_handicap.py プロジェクト: robtomlinson/GunGame
def loopStart():
    myRepeat = repeat.find('gungameHandicapLoop')
    status = repeat.status('gungameHandicapLoop')

    # If the gg_handicap_update is removed
    if int(gg_handicap_update) == 0:

        # If the repeat exists, delete it
        if status > 0:
            myRepeat.delete()

        # Stop here
        return

    # Loop running ?
    if status == 0:
        # Create loop
        myRepeat = repeat.create('gungameHandicapLoop', handicapUpdate)
        myRepeat.start(int(gg_handicap_update), 0)
        return

    # If the gg_handicap_update was changed, re-create the loop
    if int(myRepeat['interval']) != float(gg_handicap_update):
        loopStop()
        gamethread.delayed(0.1, loopStart)
        return

    # Is the loop stopped?
    if status == 2:
        # Start loop
        myRepeat.start(int(gg_handicap_update), 0)
コード例 #2
0
def round_end(event_var):
    '''
    On the round end delete the keys from our dict of ghosters and also end the repeat to minimize server load
    '''
    global blinded
    if repeat.status("xaip") > 0:
        r = repeat.find("xaip")
        r.stop()
        r.delete()
    blinded = {}
コード例 #3
0
def round_end(event_var):
    '''
    On the round end delete the keys from our dict of ghosters and also end the repeat to minimize server load
    '''
    global blinded
    if repeat.status("xaip") > 0:
        r = repeat.find("xaip")
        r.stop()
        r.delete()
    blinded = {}
コード例 #4
0
def remove_from_spec(uid):
    '''
    Removes the user from the spec dict and stops the repeat if the dict is empty
    '''
    global spec_blinded
    spec_blinded.pop(uid)
    if len(spec_blinded) < 1:
        # no one IP ghosting as spec so kill the repeat
        if repeat.status("xaip_spec") > 0:
            r = repeat.find("xaip_spec")
            r.stop()
            r.delete()
コード例 #5
0
def remove_from_spec(uid):
    '''
    Removes the user from the spec dict and stops the repeat if the dict is empty
    '''
    global spec_blinded
    spec_blinded.pop(uid)
    if len(spec_blinded) < 1:
        # no one IP ghosting as spec so kill the repeat
        if repeat.status("xaip_spec") > 0:
            r = repeat.find("xaip_spec")
            r.stop()
            r.delete()
コード例 #6
0
def blindplayer_spec(uid):
    '''
    As above but for the spectator Dict
    '''
    global spec_blinded
    if repeat.status("xaip_spec") == 0:
        a = repeat.create("xaip_spec", repeat_fade_spec)
        a.start(1,0)
    # do the initial fade 
    spec_blinded[uid] = Player(uid)
    spec_blinded[uid].blind()
    # tell them
    spec_blinded[uid].tell_blinded()
    # log that they were blinded
    ghosting.logging.log("Blinded player %s (%s)" % (str(uid), es.getplayersteamid(uid)))
コード例 #7
0
def blindplayer_spec(uid):
    '''
    As above but for the spectator Dict
    '''
    global spec_blinded
    if repeat.status("xaip_spec") == 0:
        a = repeat.create("xaip_spec", repeat_fade_spec)
        a.start(1, 0)
    # do the initial fade
    spec_blinded[uid] = Player(uid)
    spec_blinded[uid].blind()
    # tell them
    spec_blinded[uid].tell_blinded()
    # log that they were blinded
    ghosting.logging.log("blinded for ghosting", uid)
コード例 #8
0
def blindplayer(uid):
    '''
    - Starts the fade repeat if it isn't already running
    - Fades out the player
    - Tell them 3 times they have been blinded
    '''
    global blinded
    if repeat.status("xaip") == 0:
        a = repeat.create("xaip", repeat_fade)
        a.start(1,0)
    # do the initial fade 
    blinded[uid] = Player(uid)
    blinded[uid].blind()
    # tell them
    blinded[uid].tell_blinded()
    # log that they were blinded
    ghosting.logging.log("Blinded player %s (%s)" % (str(uid), es.getplayersteamid(uid)))
コード例 #9
0
def blindplayer(uid):
    '''
    - Starts the fade repeat if it isn't already running
    - Fades out the player
    - Tell them 3 times they have been blinded
    '''
    global blinded
    if repeat.status("xaip") == 0:
        a = repeat.create("xaip", repeat_fade)
        a.start(1, 0)
    # do the initial fade
    blinded[uid] = Player(uid)
    blinded[uid].blind()
    # tell them
    blinded[uid].tell_blinded()
    # log that they were blinded
    ghosting.logging.log("blinded for ghosting", uid)
コード例 #10
0
ファイル: gg_handicap.py プロジェクト: robtomlinson/GunGame
def unload():
    # Delete the repeat loop
    if repeat.status('gungameHandicapLoop'):
        repeat.delete('gungameHandicapLoop')
コード例 #11
0
ファイル: gg_handicap.py プロジェクト: robtomlinson/GunGame
def loopStop():
    # Loop running ?
    if repeat.status('gungameHandicapLoop'):
        # Stop loop
        repeat.stop('gungameHandicapLoop')
コード例 #12
0
def player_disconnect(event_var):
    userid = event_var['userid']
    if repeat.status('hpk_track_' + userid) != 0:
        repeat.find('hpk_track_' + userid).delete()
コード例 #13
0
def unload(): 
    for userid in map(str, es.getUseridList()):
        if repeat.status('hpk_track_' + userid) != 0:
            repeat.find('hpk_track_' + userid).delete()
    xahighpingkick.unregister() 
コード例 #14
0
def player_disconnect(event_var):
    userid = event_var['userid']
    if repeat.status('hpk_track_' + userid) != 0:
        repeat.find('hpk_track_' + userid).delete()
コード例 #15
0
def unload():
    for userid in map(str, es.getUseridList()):
        if repeat.status('hpk_track_' + userid) != 0:
            repeat.find('hpk_track_' + userid).delete()
    xahighpingkick.unregister()