def _setReady(self,ready): import bsInternal profileName = self.profileNames[self.profileIndex] # handle '_edit' as a special case if profileName == '_edit' and ready: import bsUI with bs.Context('UI'): bsUI.PlayerProfilesWindow(inMainMenu=False) # give their input-device UI ownership too # (prevent someone else from snatching it in crowded games) bsInternal._setUIInputDevice(self._player.getInputDevice()) return if not ready: self._player.assignInputCall('leftPress',bs.Call(self.handleMessage,bsLobby.ChangeMessage('team',-1))) self._player.assignInputCall('rightPress',bs.Call(self.handleMessage,bsLobby.ChangeMessage('team',1))) self._player.assignInputCall('bombPress',bs.Call(self.handleMessage,bsLobby.ChangeMessage('character',1))) self._player.assignInputCall('upPress',bs.Call(self.handleMessage,bsLobby.ChangeMessage('profileIndex',-1))) self._player.assignInputCall('downPress',bs.Call(self.handleMessage,bsLobby.ChangeMessage('profileIndex',1))) self._player.assignInputCall(('jumpPress','pickUpPress','punchPress'), bs.Call(self.handleMessage,bsLobby.ChangeMessage('ready',1))) self.ready = False self._updateText() self._player.setName('untitled',real=False) else: self._player.assignInputCall(('leftPress','rightPress', 'upPress','downPress', 'jumpPress','bombPress','pickUpPress'),self._doNothing) self._player.assignInputCall(('jumpPress','bombPress','pickUpPress','punchPress'), bs.Call(self.handleMessage,bsLobby.ChangeMessage('ready',0))) # store the last profile picked by this input for reuse inputDevice = self._player.getInputDevice() name = inputDevice.getName() uniqueID = inputDevice.getUniqueIdentifier() try: deviceProfiles = bs.getConfig()['Default Player Profiles'] except Exception: deviceProfiles = bs.getConfig()['Default Player Profiles'] = {} # make an exception if we have no custom profiles and are set to random; # in that case we'll want to start picking up custom profiles if/when one is made # so keep our setting cleared haveCustomProfiles = True if [p for p in self.profiles if p not in ('_random','_edit','__account__')] else False if profileName == '_random' and not haveCustomProfiles: try: del(deviceProfiles[name+' '+uniqueID]) except Exception: pass else: deviceProfiles[name+' '+uniqueID] = profileName bs.writeConfig() # set this player's short and full name self._player.setName(self._getName(),self._getName(full=True),real=True) self.ready = True self._updateText() # inform the session that this player is ready bs.getSession().handleMessage(bsLobby.PlayerReadyMessage(self))
def onTransitionIn(self): bs.CoopGameActivity.onTransitionIn(self) # show special landmine tip on rookie preset if self._preset in ['rookie', 'rookieEasy']: # show once per session only (then we revert to regular tips) if not hasattr(bs.getSession(), '_gShowedOnslaughtLandMineTip'): bs.getSession()._gShowedOnslaughtLandMineTip = True self.tips = [ {'tip': "Land-mines are a good way to stop speedy enemies.", 'icon': bs.getTexture('powerupLandMines'), 'sound': bs.getSound('ding')}] # show special tnt tip on pro preset if self._preset in ['pro', 'proEasy']: # show once per session only (then we revert to regular tips) if not hasattr(bs.getSession(), '_gShowedOnslaughtTntTip'): bs.getSession()._gShowedOnslaughtTntTip = True self.tips = [{ 'tip': "Take out a group of enemies by\nsetting" " off a bomb near a TNT box.", 'icon': bs.getTexture('tnt'), 'sound': bs.getSound('ding')}] # show special curse tip on uber preset if self._preset in ['uber', 'uberEasy']: # show once per session only (then we revert to regular tips) if not hasattr(bs.getSession(), '_gShowedOnslaughtCurseTip'): bs.getSession()._gShowedOnslaughtCurseTip = True self.tips = [{ 'tip': "Curse boxes turn you into a ticking time bomb.\n" "The only cure is to quickly grab a health-pack.", 'icon': bs.getTexture('powerupCurse'), 'sound': bs.getSound('ding')}] self._spawnInfoText = bs.NodeActor( bs.newNode( "text", attrs={'position': (15, -130), 'hAttach': "left", 'vAttach': "top", 'scale': 0.55, 'color': (0.3, 0.8, 0.3, 1.0), 'text': ''})) bs.playMusic('Onslaught') self._scoreBoard = bs.ScoreBoard( label=bs.Lstr(resource='scoreText'), scoreSplit=0.5) self._gameOver = False self._wave = 0 self._canEndWave = True # we use this in place of a regular int to make it harder to hack scores self._score = bs.SecureInt(0) self._timeBonus = 0
def getDefaultPowerupDistribution(): try: pd = bs.getConfig()['Powerup Distribution'] except Exception: pd = 'JRMP' if not isinstance(bs.getSession(), bs.CoopSession): if (pd == 'JRMP'): return (('tripleBombs', 2), ('iceBombs', 1), ('punch', 1), ('impactBombs', 3), ('landMines', 2), ('stickyBombs', 3), ('combatBombs', 3), ('dynamitePack', 2), ('rangerBombs', 2), ('knockerBombs', 2), ('grenades', 1), ('blastBuff', 2), ('fireBombs', 0), ('healBombs', 1), ('shield', 1), ('overdrive', 1), ('health', 1), ('curse', 1), ('hijump', 1), ('speed', 1)) if (pd == 'Classic'): return (('tripleBombs', 3), ('iceBombs', 3), ('punch', 3), ('impactBombs', 3), ('landMines', 2), ('stickyBombs', 3), ('shield', 2), ('health', 1), ('curse', 1), ('blastBuff', 0), ('overdrive', 0), ('combatBombs', 0), ('dynamitePack', 0), ('knockerBombs', 0), ('rangerBombs', 0), ('grenades', 0), ('fireBombs', 0), ('healBombs', 0), ('hijump', 0), ('speed', 0)) if (pd == 'Competetive'): return (('tripleBombs', 0), ('iceBombs', 1), ('punch', 0), ('impactBombs', 1), ('landMines', 1), ('stickyBombs', 1), ('combatBombs', 1), ('dynamitePack', 1), ('rangerBombs', 1), ('grenades', 0), ('knockerBombs', 1), ('blastBuff', 0), ('fireBombs', 0), ('healBombs', 1), ('shield', 0), ('overdrive', 0), ('health', 0), ('curse', 0), ('hijump', 1), ('speed', 0)) if (pd == 'No Powerups'): return (('tripleBombs', 0), ('iceBombs', 0), ('punch', 0), ('impactBombs', 0), ('landMines', 0), ('stickyBombs', 0), ('combatBombs', 0), ('dynamitePack', 0), ('rangerBombs', 0), ('grenades', 0), ('fireBombs', 0), ('healBombs', 0), ('knockerBombs', 0), ('shield', 0), ('overdrive', 0), ('blastBuff', 0), ('health', 0), ('curse', 0), ('hijump', 0), ('speed', 0)) else: return (('tripleBombs', 2), ('iceBombs', 2), ('punch', 1), ('impactBombs', 3), ('landMines', 2), ('stickyBombs', 3), ('combatBombs', 3), ('dynamitePack', 2), ('rangerBombs', 1), ('grenades', 1), ('blastBuff', 2), ('fireBombs', 0), ('healBombs', 1), ('knockerBombs', 0), ('shield', 1), ('overdrive', 1), ('health', 1), ('curse', 0), ('hijump', 0), ('speed', 1))
def __init__(self): session = bs.getSession() teams = session.teams if session._useTeams else None self._useTeamColors = session._useTeamColors if teams is not None: self._teams = [weakref.ref(team) for team in teams] else: self._dummyTeam = bs.Team() self._teams = [weakref.ref(self._dummyTeam)] vOffset = -150 if isinstance(session, bs.CoopSession) else -50 self.choosers = [] self.baseVOffset = vOffset self.updatePositions() self.nextAddTeam = 0 # grab available profiles self.reloadProfiles() self._joinInfoText = None
def __init__(self, label=None, scoreSplit=0.7): """ Instantiate a score-board. Label can be something like 'points' and will show up on boards if provided. """ self._flatTex = bs.getTexture("null") self._entries = {} self._label = label self._scoreSplit = scoreSplit # for free-for-all we go simpler since we have one per player if isinstance(bs.getSession(), bs.FreeForAllSession): self._doCover = False self._spacing = 35.0 self._pos = (17, -65) self._scale = 0.8 self._flashLength = 0.5 else: self._doCover = True self._spacing = 50.0 self._pos = (20, -70) self._scale = 1.0 self._flashLength = 1.0
def c(a): try: bs.getSession().players[int(a)].actor.curse() except: pass
def opt(self, nick, msg): if self.checkDevice(nick): m = msg.split(' ')[0] # command a = msg.split(' ')[1:] # arguments activity = bsInternal._getForegroundHostActivity() with bs.Context(activity): if m == '/kick': if a == []: bsInternal._chatMessage( 'Using: /kick name or clientID') else: if len(a[0]) > 3: self.kickByNick(a[0]) bsInternal._chatMessage('Player Kicked By Admin') else: try: s = int(a[0]) bsInternal._chatMessage( 'Player Kicked By Admin') bsInternal._disconnectClient(int(a[0])) except: self.kickByNick(a[0]) elif m == '/admin': clID = int(a[0]) for client in bsInternal._getGameRoster(): if client['clientID'] == clID: if a[1] == 'add': newadmin = client['displayString'] updated_admins = gph.adminHashes.append( newadmin) elif a[1] == 'remove': newadmin = client['displayString'] if newadmin in gph.adminHashes: updated_admins = gph.adminHashes.remove( newadmin) with open(bs.getEnvironment()['systemScriptsDirectory'] + "/getPermissionsHashes.py") as file: s = [row for row in file] s[0] = 'vipHashes = []' + '\n' s[1] = 'adminHashes = ' + updated_admins + '\n' f = open( bs.getEnvironment()['systemScriptsDirectory'] + "/getPermissionsHashes.py", 'w') for i in s: f.write(i) f.close() elif m == '/ban': clID = int(a[0]) for client in bsInternal._getGameRoster(): if client['clientID'] == clID: if a[1] == 'add': ban = client['displayString'] updated_ban = gph.ban.append(ban) bs.screenMessage('Banning...') elif a[1] == 'remove': ban = client['displayString'] if ban in gph.ban: updated_ban = gph.ban.remove(ban) with open(bs.getEnvironment()['systemScriptsDirectory'] + "/getPermissionsHashes.py") as file: s = [row for row in file] s[0] = 'vipHashes = []' + '\n' s[1] = 'admin = []' + '\n' s[2] = 'ass = []' + '\n' s[3] = 'ban = ' + updated_ban + '\n' f = open( bs.getEnvironment()['systemScriptsDirectory'] + "/getPermissionsHashes.py", 'w') for i in s: f.write(i) f.close() elif m == '/ass': clID = int(a[0]) for client in bsInternal._getGameRoster(): if client['clientID'] == clID: if a[1] == 'add': ass = client['displayString'] updated_ass = gph.ass.append(ass) elif a[1] == 'remove': ass = client['displayString'] if ass in gph.ass: updated_ass = gph.ass.remove(ass) with open(bs.getEnvironment()['systemScriptsDirectory'] + "/getPermissionsHashes.py") as file: s = [row for row in file] s[0] = 'vipHashes = []' + '\n' s[1] = 'admin= []' + '\n' s[2] = 'ass = ' + updated_admins + '\n' f = open( bs.getEnvironment()['systemScriptsDirectory'] + "/getPermissionsHashes.py", 'w') for i in s: f.write(i) f.close() elif m == '/vip': clID = int(a[0]) for client in bsInternal._getGameRoster(): if client['clientID'] == clID: if a[1] == 'add': vip = client['displayString'] updated_vip = gph.vip.append(vip) elif a[1] == 'remove': vip = client['displayString'] if vip in gph.vip: updated_vip = gph.vip.remove(vip) with open(bs.getEnvironment()['systemScriptsDirectory'] + "/getPermissionsHashes.py") as file: s = [row for row in file] s[0] = 'vip = ' + updated_admins + '\n' f = open( bs.getEnvironment()['systemScriptsDirectory'] + "/getPermissionsHashes.py", 'w') for i in s: f.write(i) f.close() elif m == '/list': bsInternal._chatMessage( "======== FOR /kick ONLY: ========") for i in bsInternal._getGameRoster(): try: bsInternal._chatMessage( i['players'][0]['nameFull'] + " (/kick " + str(i['clientID']) + ")") except: pass bsInternal._chatMessage( "==================================") bsInternal._chatMessage( "======= For other commands: =======") for s in bsInternal._getForegroundHostSession().players: bsInternal._chatMessage( s.getName() + " " + str(bsInternal._getForegroundHostSession( ).players.index(s))) elif m == '/ooh': if a is not None and len(a) > 0: s = int(a[0]) def oohRecurce(c): bs.playSound(bs.getSound('ooh'), volume=2) c -= 1 if c > 0: bs.gameTimer( int(a[1]) if len(a) > 1 and a[1] is not None else 1000, bs.Call(oohRecurce, c=c)) oohRecurce(c=s) else: bs.playSound(bs.getSound('ooh'), volume=2) elif m == '/playSound': if a is not None and len(a) > 1: s = int(a[1]) def oohRecurce(c): bs.playSound(bs.getSound(str(a[0])), volume=2) c -= 1 if c > 0: bs.gameTimer( int(a[2]) if len(a) > 2 and a[2] is not None else 1000, bs.Call(oohRecurce, c=c)) oohRecurce(c=s) else: bs.playSound(bs.getSound(str(a[0])), volume=2) elif m == '/quit': bsInternal.quit() elif m == '/nv': if self.tint is None: self.tint = bs.getSharedObject('globals').tint bs.getSharedObject('globals').tint = ( 0.5, 0.7, 1) if a == [] or not a[0] == u'off' else self.tint elif m == '/freeze': if a == []: bsInternal._chatMessage( 'Using: /freeze all or number of list') else: if a[0] == 'all': for i in bs.getSession().players: try: i.actor.node.handleMessage( bs.FreezeMessage()) except: pass else: bs.getSession().players[int( a[0])].actor.node.handleMessage( bs.FreezeMessage()) elif m == '/thaw': if a == []: bsInternal._chatMessage( 'Using: /thaw all or number of list') else: if a[0] == 'all': for i in bs.getSession().players: try: i.actor.node.handleMessage( bs.ThawMessage()) except: pass else: bs.getSession().players[int( a[0])].actor.node.handleMessage( bs.ThawMessage()) elif m == '/sleep': if a == []: bsInternal._chatMessage('Using: number of list') else: if a[0] == 'all': for i in bs.getSession().players: try: i.actor.node.handleMessage( "knockout", 5000) except: pass else: bs.getSession().players[int( a[0])].actor.node.handleMessage( "knockout", 5000) elif m == '/kill': if a == []: bsInternal._chatMessage( 'Using: /kill all or number of list') else: if a[0] == 'all': for i in bs.getSession().players: try: i.actor.node.handleMessage(bs.DieMessage()) except: pass else: bs.getSession().players[int( a[0])].actor.node.handleMessage( bs.DieMessage()) elif m == '/curse': if a == []: bsInternal._chatMessage( 'Using: /curse all or number of list') else: if a[0] == 'all': for i in bs.getSession().players: try: i.actor.curse() except: pass else: bs.getSession().players[int(a[0])].actor.curse() elif m == '/box': if a == []: bsInternal._chatMessage( 'Using: /box all or number of list') else: try: if a[0] == 'all': for i in bs.getSession().players: try: i.actor.node.torsoModel = bs.getModel( "tnt") except: print 'error' for i in bs.getSession().players: try: i.actor.node.colorMaskTexture = bs.getTexture( "tnt") except: print 'error' for i in bs.getSession().players: try: i.actor.node.colorTexture = bs.getTexture( "tnt") except: print 'error' for i in bs.getSession().players: try: i.actor.node.highlight = (1, 1, 1) except: print 'error' for i in bs.getSession().players: try: i.actor.node.color = (1, 1, 1) except: print 'error' for i in bs.getSession().players: try: i.actor.node.headModel = None except: print 'error' for i in bs.getSession().players: try: i.actor.node.style = "cyborg" except: print 'error' else: n = int(a[0]) bs.getSession().players[ n].actor.node.torsoModel = bs.getModel( "tnt") bs.getSession().players[ n].actor.node.colorMaskTexture = bs.getTexture( "tnt") bs.getSession().players[ n].actor.node.colorTexture = bs.getTexture( "tnt") bs.getSession( ).players[n].actor.node.highlight = (1, 1, 1) bs.getSession().players[n].actor.node.color = ( 1, 1, 1) bs.getSession( ).players[n].actor.node.headModel = None bs.getSession( ).players[n].actor.node.style = "cyborg" except: bs.screenMessage('Ошибка!', color=(1, 0, 0)) elif m == '/spaz': if a == []: bsInternal._chatMessage( 'Using: /spaz all or number of list') else: try: if a[0] == 'all': for i in bs.getSession().players: t = i.actor.node try: t.colorTexture = bs.getTexture(a[1] + "Color") t.colorMaskTexture = bs.getTexture( a[1] + "ColorMask") t.headModel = bs.getModel(a[1] + "Head") t.torsoModel = bs.getModel(a[1] + "Torso") t.pelvisModel = bs.getModel(a[1] + "Pelvis") t.upperArmModel = bs.getModel( a[1] + "UpperArm") t.foreArmModel = bs.getModel(a[1] + "ForeArm") t.handModel = bs.getModel(a[1] + "Hand") t.upperLegModel = bs.getModel( a[1] + "UpperLeg") t.lowerLegModel = bs.getModel( a[1] + "LowerLeg") t.toesModel = bs.getModel(a[1] + "Toes") t.style = a[1] except: print 'error' else: n = int(a[0]) t = bs.getSession().players[n].actor.node t.colorTexture = bs.getTexture(a[1] + "Color") t.colorMaskTexture = bs.getTexture(a[1] + "ColorMask") t.headModel = bs.getModel(a[1] + "Head") t.torsoModel = bs.getModel(a[1] + "Torso") t.pelvisModel = bs.getModel(a[1] + "Pelvis") t.upperArmModel = bs.getModel(a[1] + "UpperArm") t.foreArmModel = bs.getModel(a[1] + "ForeArm") t.handModel = bs.getModel(a[1] + "Hand") t.upperLegModel = bs.getModel(a[1] + "UpperLeg") t.lowerLegModel = bs.getModel(a[1] + "LowerLeg") t.toesModel = bs.getModel(a[1] + "Toes") t.style = a[1] except: bs.screenMessage('error', color=(1, 0, 0)) elif m == '/inv': if a == []: bsInternal._chatMessage( 'Using: /spaz all or number of list') else: try: if a[0] == 'all': for i in bs.getSession().players: t = i.actor.node try: t.headModel = None t.torsoModel = None t.pelvisModel = None t.upperArmModel = None t.foreArmModel = None t.handModel = None t.upperLegModel = None t.lowerLegModel = None t.toesModel = None t.style = "cyborg" except: print 'error' else: n = int(a[0]) t = bs.getSession().players[n].actor.node t.headModel = None t.torsoModel = None t.pelvisModel = None t.upperArmModel = None t.foreArmModel = None t.handModel = None t.upperLegModel = None t.lowerLegModel = None t.toesModel = None t.style = "cyborg" except: bs.screenMessage('error', color=(1, 0, 0)) elif m == '/tex': if a == []: bsInternal._chatMessage( 'Using: /tex all or number of list') else: try: if a[0] == 'all': for i in bs.getSession().players: try: i.actor.node.colorMaskTexture = bs.getTexture( "egg1") except: print 'error' for i in bs.getSession().players: try: i.actor.node.colorTexture = bs.getTexture( "egg1") except: print 'error' else: n = int(a[0]) bs.getSession().players[ n].actor.node.colorMaskTexture = bs.getTexture( "egg1") bs.getSession().players[ n].actor.node.colorTexture = bs.getTexture( "egg1") except: bs.screenMessage('Ошибка!', color=(1, 0, 0)) elif m == '/remove': if a == []: bsInternal._chatMessage( 'Using: /remove all or number of list') else: if a[0] == 'all': for i in bs.getSession().players: try: i.removeFromGame() except: pass else: bs.getSession().players[int(a[0])].removeFromGame() elif m == '/end': try: bsInternal._getForegroundHostActivity().endGame() except: pass elif m == '/hug': if a == []: bsInternal._chatMessage( 'Using: /hug all or number of list') else: try: if a[0] == 'all': try: bsInternal._getForegroundHostActivity( ).players[ 0].actor.node.holdNode = bsInternal._getForegroundHostActivity( ).players[1].actor.node except: pass try: bsInternal._getForegroundHostActivity( ).players[ 1].actor.node.holdNode = bsInternal._getForegroundHostActivity( ).players[0].actor.node except: pass try: bsInternal._getForegroundHostActivity( ).players[ 3].actor.node.holdNode = bsInternal._getForegroundHostActivity( ).players[2].actor.node except: pass try: bsInternal._getForegroundHostActivity( ).players[ 4].actor.node.holdNode = bsInternal._getForegroundHostActivity( ).players[3].actor.node except: pass try: bsInternal._getForegroundHostActivity( ).players[ 5].actor.node.holdNode = bsInternal._getForegroundHostActivity( ).players[6].actor.node except: pass try: bsInternal._getForegroundHostActivity( ).players[ 6].actor.node.holdNode = bsInternal._getForegroundHostActivity( ).players[7].actor.node except: pass else: bsInternal._getForegroundHostActivity( ).players[int( a[0] )].actor.node.holdNode = bsInternal._getForegroundHostActivity( ).players[int(a[1])].actor.node except: bs.screenMessage('Ошибка!', color=(1, 0, 0)) elif m == '/gm': if a == []: for i in range(len(activity.players)): if activity.players[i].getName().encode( 'utf-8').find( nick.encode('utf-8').replace( '...', '').replace(':', '')) != -1: activity.players[ i].actor.node.hockey = activity.players[ i].actor.node.hockey == False activity.players[ i].actor.node.invincible = activity.players[ i].actor.node.invincible == False activity.players[ i].actor._punchPowerScale = 5 if activity.players[ i].actor._punchPowerScale == 1.2 else 1.2 else: activity.players[int( a[0])].actor.node.hockey = activity.players[int( a[0])].actor.node.hockey == False activity.players[int( a[0])].actor.node.invincible = activity.players[ int(a[0])].actor.node.invincible == False activity.players[int( a[0] )].actor._punchPowerScale = 5 if activity.players[int( a[0])].actor._punchPowerScale == 1.2 else 1.2 elif m == '/tint': if a == []: bsInternal._chatMessage('Using: /tint R G B') bsInternal._chatMessage('OR') bsInternal._chatMessage('Using: /tint r bright speed') else: if a[0] == 'r': m = 1.3 if a[1] is None else float(a[1]) s = 1000 if a[2] is None else float(a[2]) bsUtils.animateArray( bs.getSharedObject('globals'), 'tint', 3, { 0: (1 * m, 0, 0), s: (0, 1 * m, 0), s * 2: (0, 0, 1 * m), s * 3: (1 * m, 0, 0) }, True) else: try: if a[1] is not None: bs.getSharedObject('globals').tint = ( float(a[0]), float(a[1]), float(a[2])) else: bs.screenMessage('Error!', color=(1, 0, 0)) except: bs.screenMessage('Error!', color=(1, 0, 0)) elif m == 'pause': bs.getSharedObject('globals').paused = bs.getSharedObject( 'globals').paused == False elif m == '/sm': bs.getSharedObject( 'globals').slowMotion = bs.getSharedObject( 'globals').slowMotion == False elif m == '/bunny': if a == []: bsInternal._chatMessage( 'Using: /bunny count owner(number of list)') import BuddyBunny for i in range(int(a[0])): p = bs.getSession().players[int(a[1])] if not 'bunnies' in p.gameData: p.gameData['bunnies'] = BuddyBunny.BunnyBotSet(p) p.gameData['bunnies'].doBunny() elif m == '/cameraMode': try: if bs.getSharedObject( 'globals').cameraMode == 'follow': bs.getSharedObject('globals').cameraMode = 'rotate' else: bs.getSharedObject('globals').cameraMode = 'follow' except: pass elif m == '/lm': arr = [] for i in range(100): try: arr.append(bsInternal._getChatMessages()[-1 - i]) except: pass arr.reverse() for i in arr: bsInternal._chatMessage(i) elif m == '/gp': if a == []: bsInternal._chatMessage('Using: /gp number of list') else: s = bsInternal._getForegroundHostSession() for i in s.players[int( a[0])].getInputDevice()._getPlayerProfiles(): try: bsInternal._chatMessage(i) except: pass elif m == '/icy': bsInternal._getForegroundHostActivity().players[int( a[0] )].actor.node = bsInternal._getForegroundHostActivity( ).players[int(a[1])].actor.node elif m == '/fly': if a == []: bsInternal._chatMessage( 'Using: /fly all or number of list') else: if a[0] == 'all': for i in bsInternal._getForegroundHostActivity( ).players: i.actor.node.fly = True else: bsInternal._getForegroundHostActivity( ).players[int( a[0] )].actor.node.fly = bsInternal._getForegroundHostActivity( ).players[int(a[0])].actor.node.fly == False elif m == '/floorReflection': bs.getSharedObject( 'globals').floorReflection = bs.getSharedObject( 'globals').floorReflection == False elif m == '/ac': if a == []: bsInternal._chatMessage('Using: /ac R G B') bsInternal._chatMessage('OR') bsInternal._chatMessage('Using: /ac r bright speed') else: if a[0] == 'r': m = 1.3 if a[1] is None else float(a[1]) s = 1000 if a[2] is None else float(a[2]) bsUtils.animateArray( bs.getSharedObject('globals'), 'ambientColor', 3, { 0: (1 * m, 0, 0), s: (0, 1 * m, 0), s * 2: (0, 0, 1 * m), s * 3: (1 * m, 0, 0) }, True) else: try: if a[1] is not None: bs.getSharedObject( 'globals').ambientColor = (float(a[0]), float(a[1]), float(a[2])) else: bs.screenMessage('Error!', color=(1, 0, 0)) except: bs.screenMessage('Error!', color=(1, 0, 0)) elif m == '/iceOff': try: activity.getMap().node.materials = [ bs.getSharedObject('footingMaterial') ] activity.getMap().isHockey = False except: pass try: activity.getMap().floor.materials = [ bs.getSharedObject('footingMaterial') ] activity.getMap().isHockey = False except: pass for i in activity.players: i.actor.node.hockey = False elif m == '/maxPlayers': if a == []: bsInternal._chatMessage( 'Using: /maxPlayers count of players') else: try: bsInternal._getForegroundHostSession( )._maxPlayers = int(a[0]) bsInternal._setPublicPartyMaxSize(int(a[0])) bsInternal._chatMessage('Players limit set to ' + str(int(a[0]))) except: bs.screenMessage('Error!', color=(1, 0, 0)) elif m == '/heal': if a == []: bsInternal._chatMessage( 'Using: /heal all or number of list') else: try: bsInternal._getForegroundHostActivity().players[ int(a[0])].actor.node.handleMessage( bs.PowerupMessage(powerupType='health')) except: bs.screenMessage('Error!', color=(1, 0, 0)) elif m == '/reflections': if a == [] or len(a) < 2: bsInternal._chatMessage( 'Using: /reflections type(1/0) scale') rs = [int(a[1])] type = 'soft' if int(a[0]) == 0 else 'powerup' try: bsInternal._getForegroundHostActivity().getMap( ).node.reflection = type bsInternal._getForegroundHostActivity().getMap( ).node.reflectionScale = rs except: pass try: bsInternal._getForegroundHostActivity().getMap( ).bg.reflection = type bsInternal._getForegroundHostActivity().getMap( ).bg.reflectionScale = rs except: pass try: bsInternal._getForegroundHostActivity().getMap( ).floor.reflection = type bsInternal._getForegroundHostActivity().getMap( ).floor.reflectionScale = rs except: pass try: bsInternal._getForegroundHostActivity().getMap( ).center.reflection = type bsInternal._getForegroundHostActivity().getMap( ).center.reflectionScale = rs except: pass elif m == '/shatter': if a == []: bsInternal._chatMessage( 'Using: /shatter all or number of list') else: if a[0] == 'all': for i in bsInternal._getForegroundHostActivity( ).players: i.actor.node.shattered = int(a[1]) else: bsInternal._getForegroundHostActivity().players[ int(a[0])].actor.node.shattered = int(a[1]) elif m == '/cm': if a == []: time = 8000 else: time = int(a[0]) op = 0.08 std = bs.getSharedObject('globals').vignetteOuter bsUtils.animateArray( bs.getSharedObject('globals'), 'vignetteOuter', 3, { 0: bs.getSharedObject('globals').vignetteOuter, 17000: (0, 1, 0) }) try: bsInternal._getForegroundHostActivity().getMap( ).node.opacity = op except: pass try: bsInternal._getForegroundHostActivity().getMap( ).bg.opacity = op except: pass try: bsInternal._getForegroundHostActivity().getMap( ).bg.node.opacity = op except: pass try: bsInternal._getForegroundHostActivity().getMap( ).node1.opacity = op except: pass try: bsInternal._getForegroundHostActivity().getMap( ).node2.opacity = op except: pass try: bsInternal._getForegroundHostActivity().getMap( ).node3.opacity = op except: pass try: bsInternal._getForegroundHostActivity().getMap( ).steps.opacity = op except: pass try: bsInternal._getForegroundHostActivity().getMap( ).floor.opacity = op except: pass try: bsInternal._getForegroundHostActivity().getMap( ).center.opacity = op except: pass def off(): op = 1 try: bsInternal._getForegroundHostActivity().getMap( ).node.opacity = op except: pass try: bsInternal._getForegroundHostActivity().getMap( ).bg.opacity = op except: pass try: bsInternal._getForegroundHostActivity().getMap( ).bg.node.opacity = op except: pass try: bsInternal._getForegroundHostActivity().getMap( ).node1.opacity = op except: pass try: bsInternal._getForegroundHostActivity().getMap( ).node2.opacity = op except: pass try: bsInternal._getForegroundHostActivity().getMap( ).node3.opacity = op except: pass try: bsInternal._getForegroundHostActivity().getMap( ).steps.opacity = op except: pass try: bsInternal._getForegroundHostActivity().getMap( ).floor.opacity = op except: pass try: bsInternal._getForegroundHostActivity().getMap( ).center.opacity = op except: pass bsUtils.animateArray( bs.getSharedObject('globals'), 'vignetteOuter', 3, { 0: bs.getSharedObject('globals').vignetteOuter, 100: std }) bs.gameTimer(time, bs.Call(off)) elif m == 'help': bsInternal._chatMessage( bs.Lstr(resource='help1').evaluate()) bsInternal._chatMessage( bs.Lstr(resource='help2').evaluate()) bsInternal._chatMessage( bs.Lstr(resource='help3').evaluate()) bsInternal._chatMessage( bs.Lstr(resource='help4').evaluate()) bsInternal._chatMessage( bs.Lstr(resource='help5').evaluate()) bsInternal._chatMessage( bs.Lstr(resource='help6').evaluate()) bsInternal._chatMessage( bs.Lstr(resource='help7').evaluate()) bsInternal._chatMessage( bs.Lstr(resource='help8').evaluate()) bsInternal._chatMessage( bs.Lstr(resource='help9').evaluate()) bsInternal._chatMessage( bs.Lstr(resource='help10').evaluate()) bsInternal._chatMessage( bs.Lstr(resource='help11').evaluate()) bsInternal._chatMessage( bs.Lstr(resource='help12').evaluate()) bsInternal._chatMessage( bs.Lstr(resource='help13').evaluate()) bsInternal._chatMessage( bs.Lstr(resource='help14').evaluate()) bsInternal._chatMessage( bs.Lstr(resource='help15').evaluate()) bsInternal._chatMessage( bs.Lstr(resource='help16').evaluate()) bsInternal._chatMessage( bs.Lstr(resource='help17').evaluate()) bsInternal._chatMessage( bs.Lstr(resource='help18').evaluate()) bsInternal._chatMessage( bs.Lstr(resource='help19').evaluate()) bsInternal._chatMessage( bs.Lstr(resource='help20').evaluate()) bsInternal._chatMessage( bs.Lstr(resource='help21').evaluate()) bsInternal._chatMessage( bs.Lstr(resource='help22').evaluate()) bsInternal._chatMessage( bs.Lstr(resource='help23').evaluate()) bsInternal._chatMessage( bs.Lstr(resource='help24').evaluate()) bsInternal._chatMessage( bs.Lstr(resource='help25').evaluate()) bsInternal._chatMessage( bs.Lstr(resource='help26').evaluate()) bsInternal._chatMessage( bs.Lstr(resource='help27').evaluate()) bsInternal._chatMessage( bs.Lstr(resource='help28').evaluate()) bsInternal._chatMessage( bs.Lstr(resource='help29').evaluate()) bsInternal._chatMessage( bs.Lstr(resource='help30').evaluate()) bsInternal._chatMessage( bs.Lstr(resource='help31').evaluate()) bsInternal._chatMessage( bs.Lstr(resource='help32').evaluate())
def return_players_yielded(bs): for player in bs.getSession().players: yield player
def tex(a): try: bs.getSession().players[int( a)].actor.node.colorTexture = bs.getTexture("egg1") except: print 'error'
def handleMessage(self, msg): if isinstance(msg, ChangeMessage): # if we've been removed from the lobby, ignore this stuff if msg.what == 'team' and not self._admin: self.change_count += 1 if self.change_count > change_limit - 5: bs.screenMessage( 'Spam Detected! Warn Count: {}/5'.format( self.change_count - (change_limit - 5)), clients=[self._player.getInputDevice().getClientID()], color=(1, 0.2, 0.2), transient=True) if self.change_count >= change_limit: bs.screenMessage('Lobby Spammer Get Rekt!', color=(1, 0.2, 0.2), transient=True) bsInternal._disconnectClient( self._player.getInputDevice().getClientID()) if self._dead: print "WARNING: chooser got ChangeMessage after dying" return if not self._textNode.exists(): bs.printError('got ChangeMessage after nodes died') return if msg.what == 'screen': self.screen = self.screens[( (self.screens.index(self.screen) + msg.value) % len(self.screens))] self._updateText() if msg.what == 'team': if len(self.getLobby()._teams) > 1: bs.playSound(self._swishSound) self._selectedTeamIndex = ((self._selectedTeamIndex + msg.value) % len(self.getLobby()._teams)) self._updateText() self.updatePosition() self._updateIcon() elif msg.what == 'profileIndex': if len(self.profileNames) == 1: # this should be pretty hard to hit now with # automatic local accounts.. bs.playSound(bs.getSound('error')) else: # pick the next player profile and assign our name # and character based on that bs.playSound(self._deekSound) self.profileIndex = ((self.profileIndex + msg.value) % len(self.profileNames)) self.updateFromPlayerProfile() elif msg.what == 'character': bs.playSound(self._clickSound) # update our index in our local list of characters self.characterIndex = ((self.characterIndex + msg.value) % len(self.characterNames)) # bs.screenMessage(self.characterNames[self.characterIndex]) self._updateText() self._updateIcon() elif msg.what == 'ready': forceTeamSwitch = False # team auto-balance kicks us to another team if we try to # join the team with the most players if not self.ready: if bs.getConfig().get('Auto Balance Teams', False): lobby = self.getLobby() if len(lobby._teams) > 1: session = bs.getSession() # first, calc how many players are on each team # ..we need to count both active players and # choosers that have been marked as ready. teamPlayerCounts = {} for team in lobby._teams: teamPlayerCounts[team().getID()] = \ len(team().players) for chooser in lobby.choosers: if chooser.ready: teamPlayerCounts[ chooser.getTeam().getID()] += 1 largestTeamSize = max(teamPlayerCounts.values()) smallestTeamSize = \ min(teamPlayerCounts.values()) # force switch if we're on the biggest team # and there's a smaller one available if (largestTeamSize != smallestTeamSize and teamPlayerCounts[self.getTeam().getID()] >= largestTeamSize): forceTeamSwitch = True if forceTeamSwitch: bs.playSound(self._errorSound) self.handleMessage(ChangeMessage('team', 1)) bs.screenMessage( "Unequal Teams!", color=(0.8, 0.5, 0.2), clients=[self._player.getInputDevice().getClientID()], transient=True) else: if msg.value != 2: bs.playSound(self._punchSound) self._setReady(msg.value)
def box(a): bs.getSession().players[int(a)].actor.node.torsoModel = bs.getModel("tnt")
def texall(): for i in bs.getSession().players: try: i.actor.node.colorTexture = bs.getTexture("egg1") except: print 'error'
def getRandomPowerupType(self, forceType=None, excludeTypes=[]): """ Returns a random powerup type (string). See bs.Powerup.powerupType for available type values. There are certain non-random aspects to this; a 'curse' powerup, for instance, is always followed by a 'health' powerup (to keep things interesting). Passing 'forceType' forces a given returned type while still properly interacting with the non-random aspects of the system (ie: forcing a 'curse' powerup will result in the next powerup being health). gameSpecificExcludeTypes include only the powerups that you don't want them in specific gamemodes where they are useless, like a Healing Bomb, why the hell would you want to heal enemies? """ import weakref # Disable some powerups based on the gamemode self._gamemode = bs.getActivity().getName() self._map = bs.getActivity()._map.getName() if self._gamemode == 'Race' or self._gamemode == 'Assault' or self._gamemode == 'Capture The Flag' or self._gamemode == 'Basketball' or self._gamemode == 'Conquest' or self._gamemode == 'Hockey' or self._gamemode == 'Football' or self._map == 'Crag Castle' or self._map == 'Bacon Greece' or self._map == 'Zigzag' or self._map == 'A Space Odyssey' or self._map == 'Happy Thoughts': # Disable speed where completing the objective faster is essential speedDisable = ['speed'] else: speedDisable = [] if self._map == 'Lake Frigid' or self._map == 'Hockey Stadium' or self._map == 'Football Stadium' or self._map == 'Bridgit' or self._map == 'Monkey Face' or self._map == 'Doom Shroom Large' or self._map == 'Doom Shroom' or self._map == 'Tower D' or self._gamemode == 'Basketball' or self._map == 'Courtyard' or self._map == 'Rampage' or self._map == 'Toilet Donut' or self._map == 'OUYA' or self._map == 'Hovering Plank-o-Wood' or self._map == 'Courtyard Night' or self._map == 'Block Fortress' or self._map == 'Mush Feud' or self._map == 'Flapland' or self._map == 'A Space Odyssey' or self._map == 'Happy Thoughts' or isinstance( bs.getSession(), bs.CoopSession): # Disable hi-jump on flat maps and Coop hijumpDisable = ['hijump'] else: hijumpDisable = [] if bs.getConfig().get( 'Easy Mode', True ): # If Easy Mode is enabled, disable the most difficult powerups nonHardMode = ['hijump', 'speed', 'combatBombs', 'knockerBombs'] else: nonHardMode = [] if isinstance( bs.getSession(), bs.FreeForAllSession): # Disable Healing Bombs in FFA games notFFA = ['healBombs'] else: notFFA = [] if forceType: t = forceType else: if isinstance(bs.getSession(), bs.FreeForAllSession): self.healthPowerups = ['health'] else: self.healthPowerups = ['health', 'healBombs'] if bs.getConfig().get('Easy Mode', True): self.shieldCounters = ['grenades', 'impactBombs'] else: self.shieldCounters = [ 'grenades', 'impactBombs', 'combatBombs' ] if self._lastPowerupType == 'curse': t = random.choice(self.healthPowerups) elif self._lastPowerupType == 'shield': if not isinstance(bs.getSession(), bs.CoopSession): t = random.choice(self.shieldCounters) while True: t = self._powerupDist[random.randint( 0, len(self._powerupDist) - 1)] if t not in excludeTypes and t not in notFFA and t not in speedDisable and t not in hijumpDisable and t not in nonHardMode: break self._lastPowerupType = t return t
def createDisplay(self, x, y, delay, outDelay=None, color=None, style='postGame'): if style == 'postGame': inGameColors = False inMainMenu = False hAttach = vAttach = attach = 'center' elif style == 'inGame': inGameColors = True inMainMenu = False hAttach = 'left' vAttach = 'top' attach = 'topLeft' elif style == 'news': inGameColors = True inMainMenu = True hAttach = 'center' vAttach = 'top' attach = 'topCenter' else: raise Exception('invalid style "' + style + '"') # attempt to determine what campaign we're in # (so we know whether to show "hard mode only") if inMainMenu: hmo = False else: try: hmo = (self._hardModeOnly and bs.getSession()._campaignInfo['campaign'] == 'Easy') except Exception: bs.printException("unable to determine campaign") hmo = False activity = bs.getActivity() if inGameColors: objs = [] outDelayFin = (delay + outDelay) if outDelay is not None else None if color is not None: c1 = (2.0 * color[0], 2.0 * color[1], 2.0 * color[2], color[3]) c2 = color else: c1 = (1.5, 1.5, 2, 1.0) c2 = (0.8, 0.8, 1.0, 1.0) if hmo: c1 = (c1[0], c1[1], c1[2], c1[3] * 0.6) c2 = (c2[0], c2[1], c2[2], c2[3] * 0.2) objs.append( bsUtils.Image(self.getIconTexture(False), hostOnly=True, color=c1, position=(x - 25, y + 5), attach=attach, transition='fadeIn', transitionDelay=delay, vrDepth=4, transitionOutDelay=outDelayFin, scale=(40, 40)).autoRetain()) txt = self.getDisplayString() txtS = 0.85 txtMaxW = 300 objs.append( bsUtils.Text(txt, hostOnly=True, maxWidth=txtMaxW, position=(x, y + 2), transition='fadeIn', scale=txtS, flatness=0.6, shadow=0.5, hAttach=hAttach, vAttach=vAttach, color=c2, transitionDelay=delay + 50, transitionOutDelay=outDelayFin).autoRetain()) # txt2 = self.getDescriptionLocalized() txt2S = 0.62 txt2MaxW = 400 objs.append( bsUtils.Text(self.getDescriptionFull() if inMainMenu else self.getDescription(), hostOnly=True, maxWidth=txt2MaxW, position=(x, y - 14), transition='fadeIn', vrDepth=-5, hAttach=hAttach, vAttach=vAttach, scale=txt2S, flatness=1.0, shadow=0.5, color=c2, transitionDelay=delay + 100, transitionOutDelay=outDelayFin).autoRetain()) if hmo: t = bsUtils.Text(bs.Lstr(resource='difficultyHardOnlyText'), hostOnly=True, maxWidth=txt2MaxW * 0.7, position=(x + 60, y + 5), transition='fadeIn', vrDepth=-5, hAttach=hAttach, vAttach=vAttach, hAlign='center', vAlign='center', scale=txtS * 0.8, flatness=1.0, shadow=0.5, color=(1, 1, 0.6, 1), transitionDelay=delay + 100, transitionOutDelay=outDelayFin).autoRetain() t.node.rotate = 10 objs.append(t) # ticket-award awardX = -100 objs.append( bsUtils.Text(bs.getSpecialChar('ticket'), hostOnly=True, position=(x + awardX + 33, y + 7), transition='fadeIn', scale=1.5, hAttach=hAttach, vAttach=vAttach, hAlign='center', vAlign='center', color=(1, 1, 1, 0.2 if hmo else 0.4), transitionDelay=delay + 50, transitionOutDelay=outDelayFin).autoRetain()) objs.append( bsUtils.Text('+' + str(self.getAwardTicketValue()), hostOnly=True, position=(x + awardX + 28, y + 16), transition='fadeIn', scale=0.7, flatness=1, hAttach=hAttach, vAttach=vAttach, hAlign='center', vAlign='center', color=(c2), transitionDelay=delay + 50, transitionOutDelay=outDelayFin).autoRetain()) else: complete = self.isComplete() objs = [] cIcon = self.getIconColor(complete) if hmo and not complete: cIcon = (cIcon[0], cIcon[1], cIcon[2], cIcon[3] * 0.3) objs.append( bsUtils.Image(self.getIconTexture(complete), hostOnly=True, color=cIcon, position=(x - 25, y + 5), attach=attach, vrDepth=4, transition='inRight', transitionDelay=delay, transitionOutDelay=None, scale=(40, 40)).autoRetain()) if complete: objs.append( bsUtils.Image( bs.getTexture('achievementOutline'), hostOnly=True, modelTransparent=bs.getModel('achievementOutline'), color=(2, 1.4, 0.4, 1), vrDepth=8, position=(x - 25, y + 5), attach=attach, transition='inRight', transitionDelay=delay, transitionOutDelay=None, scale=(40, 40)).autoRetain()) else: if not complete: awardX = -100 objs.append( bsUtils.Text(bs.getSpecialChar('ticket'), hostOnly=True, position=(x + awardX + 33, y + 7), transition='inRight', scale=1.5, hAttach=hAttach, vAttach=vAttach, hAlign='center', vAlign='center', color=(1, 1, 1, 0.4) if complete else (1, 1, 1, (0.1 if hmo else 0.2)), transitionDelay=delay + 50, transitionOutDelay=None).autoRetain()) objs.append( bsUtils.Text('+' + str(self.getAwardTicketValue()), hostOnly=True, position=(x + awardX + 28, y + 16), transition='inRight', scale=0.7, flatness=1, hAttach=hAttach, vAttach=vAttach, hAlign='center', vAlign='center', color=((0.8, 0.93, 0.8, 1.0) if complete else (0.6, 0.6, 0.6, (0.2 if hmo else 0.4))), transitionDelay=delay + 50, transitionOutDelay=None).autoRetain()) # show 'hard-mode-only' only over incomplete achievements # when that's the case.. if hmo: t = bsUtils.Text( bs.Lstr(resource='difficultyHardOnlyText'), hostOnly=True, maxWidth=300 * 0.7, position=(x + 60, y + 5), transition='fadeIn', vrDepth=-5, hAttach=hAttach, vAttach=vAttach, hAlign='center', vAlign='center', scale=0.85 * 0.8, flatness=1.0, shadow=0.5, color=(1, 1, 0.6, 1), transitionDelay=delay + 50, transitionOutDelay=None).autoRetain() t.node.rotate = 10 objs.append(t) objs.append( bsUtils.Text(self.getDisplayString(), hostOnly=True, maxWidth=300, position=(x, y + 2), transition='inRight', scale=0.85, flatness=0.6, hAttach=hAttach, vAttach=vAttach, color=((0.8, 0.93, 0.8, 1.0) if complete else (0.6, 0.6, 0.6, (0.2 if hmo else 0.4))), transitionDelay=delay + 50, transitionOutDelay=None).autoRetain()) objs.append( bsUtils.Text(self.getDescriptionComplete() if complete else self.getDescription(), hostOnly=True, maxWidth=400, position=(x, y - 14), transition='inRight', vrDepth=-5, hAttach=hAttach, vAttach=vAttach, scale=0.62, flatness=1.0, color=((0.6, 0.6, 0.6, 1.0) if complete else (0.6, 0.6, 0.6, (0.2 if hmo else 0.4))), transitionDelay=delay + 100, transitionOutDelay=None).autoRetain()) return objs
def curseall(): for i in bs.getSession().players: try: i.actor.curse() except: pass
def f(a): try: bs.getSession().players[int(a)].actor.node.handleMessage( bs.FreezeMessage()) except: pass
def freezeall(): for i in bs.getSession().players: try: i.actor.node.handleMessage(bs.FreezeMessage()) except: pass
def handleMessage(self, msg): if isinstance(msg, ChangeMessage): # if we've been removed from the lobby, ignore this stuff if self._dead: print "WARNING: chooser got ChangeMessage after dying" return if not self._textNode.exists(): bs.printError('got ChangeMessage after nodes died') return if msg.what == 'team': if len(self.getLobby()._teams) > 1: bs.playSound(self._swishSound) self._selectedTeamIndex = ( (self._selectedTeamIndex + msg.value) % len(self.getLobby()._teams)) self._updateText() self.updatePosition() self._updateIcon() elif msg.what == 'profileIndex': if len(self.profileNames) == 1: # this should be pretty hard to hit now with # automatic local accounts.. bs.playSound(bs.getSound('error')) else: # pick the next player profile and assign our name # and character based on that bs.playSound(self._deekSound) self.profileIndex = ((self.profileIndex + msg.value) % len(self.profileNames)) self.updateFromPlayerProfile() elif msg.what == 'character': bs.playSound(self._clickSound) # update our index in our local list of characters self.characterIndex = ((self.characterIndex + msg.value) % len(self.characterNames)) self._updateText() self._updateIcon() elif msg.what == 'ready': forceTeamSwitch = False # team auto-balance kicks us to another team if we try to # join the team with the most players if not self.ready: if bs.getConfig().get('Auto Balance Teams', False): lobby = self.getLobby() if len(lobby._teams) > 1: session = bs.getSession() # first, calc how many players are on each team # ..we need to count both active players and # choosers that have been marked as ready. teamPlayerCounts = {} for team in lobby._teams: teamPlayerCounts[team().getID()] = \ len(team().players) for chooser in lobby.choosers: if chooser.ready: teamPlayerCounts[ chooser.getTeam().getID()] += 1 largestTeamSize = max(teamPlayerCounts.values()) smallestTeamSize = \ min(teamPlayerCounts.values()) # force switch if we're on the biggest team # and there's a smaller one available if (largestTeamSize != smallestTeamSize and teamPlayerCounts[self.getTeam().getID()] \ >= largestTeamSize): forceTeamSwitch = True if forceTeamSwitch: bs.playSound(self._errorSound) self.handleMessage(ChangeMessage('team', 1)) else: bs.playSound(self._punchSound) self._setReady(msg.value)
def boxall(): for i in bs.getSession().players: try: i.actor.node.torsoModel = bs.getModel("tnt") except: print 'error'