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)
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 = {}
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()
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)))
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)
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)))
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)
def unload(): # Delete the repeat loop if repeat.status('gungameHandicapLoop'): repeat.delete('gungameHandicapLoop')
def loopStop(): # Loop running ? if repeat.status('gungameHandicapLoop'): # Stop loop repeat.stop('gungameHandicapLoop')
def player_disconnect(event_var): userid = event_var['userid'] if repeat.status('hpk_track_' + userid) != 0: repeat.find('hpk_track_' + userid).delete()
def unload(): for userid in map(str, es.getUseridList()): if repeat.status('hpk_track_' + userid) != 0: repeat.find('hpk_track_' + userid).delete() xahighpingkick.unregister()